@central-ui/react 0.1.1 → 0.2.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/LICENSE +49 -0
- package/README.md +1 -1
- package/dist/components/accordion/index.d.ts +7 -6
- package/dist/components/accordion/index.js +13 -10
- package/dist/components/autocomplete/index.d.ts +22 -33
- package/dist/components/autocomplete/index.js +90 -73
- package/dist/components/avatar/index.d.ts +1 -2
- package/dist/components/avatar/index.js +6 -6
- package/dist/components/badge/index.d.ts +0 -1
- package/dist/components/badge/index.js +2 -2
- package/dist/components/banner/index.d.ts +1 -1
- package/dist/components/banner/index.js +24 -26
- package/dist/components/barchart/index.d.ts +106 -0
- package/dist/components/barchart/index.js +122 -0
- package/dist/components/breadcrumb/index.d.ts +0 -1
- package/dist/components/breadcrumb/index.js +6 -7
- package/dist/components/button/index.d.ts +3 -4
- package/dist/components/button/index.js +11 -12
- package/dist/components/card/index.d.ts +0 -1
- package/dist/components/card/index.js +0 -1
- package/dist/components/checkbox/index.d.ts +13 -11
- package/dist/components/checkbox/index.js +59 -39
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js +2 -3
- package/dist/components/combobox/index.d.ts +32 -44
- package/dist/components/combobox/index.js +112 -88
- package/dist/components/datepicker/index.d.ts +54 -55
- package/dist/components/datepicker/index.js +105 -100
- package/dist/components/dialog/index.d.ts +17 -30
- package/dist/components/dialog/index.js +25 -26
- package/dist/components/divider/index.d.ts +0 -1
- package/dist/components/divider/index.js +0 -1
- package/dist/components/donutchart/index.d.ts +100 -0
- package/dist/components/donutchart/index.js +178 -0
- package/dist/components/drawer/index.d.ts +15 -24
- package/dist/components/drawer/index.js +45 -47
- package/dist/components/empty/index.d.ts +1 -2
- package/dist/components/empty/index.js +2 -4
- package/dist/components/fileupload/index.d.ts +4 -9
- package/dist/components/fileupload/index.js +27 -39
- package/dist/components/form/index.d.ts +0 -1
- package/dist/components/form/index.js +0 -1
- package/dist/components/horizontalbarchart/index.d.ts +120 -0
- package/dist/components/horizontalbarchart/index.js +193 -0
- package/dist/components/input/index.d.ts +23 -23
- package/dist/components/input/index.js +86 -115
- package/dist/components/linechart/index.d.ts +114 -0
- package/dist/components/linechart/index.js +139 -0
- package/dist/components/menu/index.d.ts +14 -16
- package/dist/components/menu/index.js +56 -53
- package/dist/components/metric/index.d.ts +0 -1
- package/dist/components/metric/index.js +0 -1
- package/dist/components/numberinput/index.d.ts +16 -23
- package/dist/components/numberinput/index.js +55 -68
- package/dist/components/otpinput/index.d.ts +14 -9
- package/dist/components/otpinput/index.js +32 -25
- package/dist/components/page/index.d.ts +0 -1
- package/dist/components/page/index.js +2 -4
- package/dist/components/passwordinput/index.d.ts +16 -13
- package/dist/components/passwordinput/index.js +47 -56
- package/dist/components/popover/index.d.ts +21 -19
- package/dist/components/popover/index.js +40 -21
- package/dist/components/radio/index.d.ts +13 -9
- package/dist/components/radio/index.js +80 -71
- package/dist/components/ratinginput/index.d.ts +15 -10
- package/dist/components/ratinginput/index.js +38 -18
- package/dist/components/select/index.d.ts +29 -32
- package/dist/components/select/index.js +79 -50
- package/dist/components/skeleton/index.d.ts +0 -1
- package/dist/components/skeleton/index.js +0 -1
- package/dist/components/slider/index.d.ts +14 -9
- package/dist/components/slider/index.js +75 -74
- package/dist/components/spinner/index.d.ts +2 -3
- package/dist/components/spinner/index.js +2 -3
- package/dist/components/splitter/index.d.ts +1 -2
- package/dist/components/splitter/index.js +6 -7
- package/dist/components/stepper/index.d.ts +8 -20
- package/dist/components/stepper/index.js +15 -16
- package/dist/components/switch/index.d.ts +12 -10
- package/dist/components/switch/index.js +52 -36
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/table/index.js +17 -16
- package/dist/components/tabs/index.d.ts +3 -4
- package/dist/components/tabs/index.js +6 -7
- package/dist/components/textarea/index.d.ts +16 -13
- package/dist/components/textarea/index.js +46 -55
- package/dist/components/textlink/index.d.ts +3 -1
- package/dist/components/textlink/index.js +4 -1
- package/dist/components/toast/index.d.ts +8 -14
- package/dist/components/toast/index.js +54 -54
- package/dist/components/toggle/index.d.ts +5 -6
- package/dist/components/toggle/index.js +19 -26
- package/dist/components/tooltip/index.d.ts +11 -13
- package/dist/components/tooltip/index.js +14 -11
- package/dist/components/tour/index.d.ts +154 -0
- package/dist/components/tour/index.js +280 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -1
- package/dist/types/Icon.d.ts +10 -0
- package/dist/types/Icon.js +1 -0
- package/dist/types/Style.d.ts +0 -1
- package/dist/types/Style.js +0 -1
- package/dist/types/Tone.d.ts +0 -1
- package/dist/types/Tone.js +0 -1
- package/dist/types/Validation.d.ts +12 -0
- package/dist/types/Validation.js +1 -0
- package/dist/utils/ArkStateToDataAttributes.d.ts +0 -1
- package/dist/utils/ArkStateToDataAttributes.js +3 -2
- package/dist/utils/Tone.d.ts +0 -1
- package/dist/utils/Tone.js +1 -2
- package/dist/utils/Validation.d.ts +14 -0
- package/dist/utils/Validation.js +23 -0
- package/dist/utils/asChild.d.ts +41 -0
- package/dist/utils/asChild.js +15 -0
- package/dist/utils/icons.d.ts +24 -0
- package/dist/utils/icons.js +160 -0
- package/dist/utils/useForwardClickToInput.d.ts +0 -1
- package/dist/utils/useForwardClickToInput.js +4 -3
- package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts +0 -1
- package/dist/utils/virtualization/useVirtualizedAutocomplete.js +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.d.ts +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.js +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.d.ts +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.js +0 -1
- package/package.json +12 -11
- package/src/presets/shopify-polaris/shopify-polaris-autocomplete.css +15 -6
- package/src/presets/shopify-polaris/shopify-polaris-badge.css +1 -1
- package/src/presets/shopify-polaris/shopify-polaris-barchart.css +64 -0
- package/src/presets/shopify-polaris/shopify-polaris-checkbox.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-chip.css +3 -3
- package/src/presets/shopify-polaris/shopify-polaris-combobox.css +19 -10
- package/src/presets/shopify-polaris/shopify-polaris-datepicker.css +20 -11
- package/src/presets/shopify-polaris/shopify-polaris-dialog.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-donutchart.css +172 -0
- package/src/presets/shopify-polaris/shopify-polaris-drawer.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-fileupload.css +1 -1
- package/src/presets/shopify-polaris/shopify-polaris-horizontalbarchart.css +60 -0
- package/src/presets/shopify-polaris/shopify-polaris-input.css +14 -5
- package/src/presets/shopify-polaris/shopify-polaris-linechart.css +68 -0
- package/src/presets/shopify-polaris/shopify-polaris-menu.css +47 -6
- package/src/presets/shopify-polaris/shopify-polaris-numberinput.css +16 -7
- package/src/presets/shopify-polaris/shopify-polaris-otpinput.css +3 -3
- package/src/presets/shopify-polaris/shopify-polaris-passwordinput.css +14 -5
- package/src/presets/shopify-polaris/shopify-polaris-popover.css +29 -0
- package/src/presets/shopify-polaris/shopify-polaris-radio.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-ratinginput.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-select.css +15 -6
- package/src/presets/shopify-polaris/shopify-polaris-slider.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-stepper.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-switch.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-textarea.css +13 -4
- package/src/presets/shopify-polaris/shopify-polaris-toast.css +43 -0
- package/src/presets/shopify-polaris/shopify-polaris-tooltip.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris.css +5 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-autocomplete.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-barchart.css +64 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-checkbox.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-combobox.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-datepicker.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-dialog.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-donutchart.css +172 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-drawer.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-fileupload.css +1 -1
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-horizontalbarchart.css +60 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-input.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-linechart.css +68 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-menu.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-numberinput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-otpinput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-passwordinput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-popover.css +22 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-radio.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-ratinginput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-slider.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-stepper.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-switch.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textarea.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tooltip.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +4 -0
- package/dist/components/accordion/index.d.ts.map +0 -1
- package/dist/components/accordion/index.js.map +0 -1
- package/dist/components/autocomplete/index.d.ts.map +0 -1
- package/dist/components/autocomplete/index.js.map +0 -1
- package/dist/components/avatar/index.d.ts.map +0 -1
- package/dist/components/avatar/index.js.map +0 -1
- package/dist/components/badge/index.d.ts.map +0 -1
- package/dist/components/badge/index.js.map +0 -1
- package/dist/components/banner/index.d.ts.map +0 -1
- package/dist/components/banner/index.js.map +0 -1
- package/dist/components/breadcrumb/index.d.ts.map +0 -1
- package/dist/components/breadcrumb/index.js.map +0 -1
- package/dist/components/button/index.d.ts.map +0 -1
- package/dist/components/button/index.js.map +0 -1
- package/dist/components/card/index.d.ts.map +0 -1
- package/dist/components/card/index.js.map +0 -1
- package/dist/components/checkbox/index.d.ts.map +0 -1
- package/dist/components/checkbox/index.js.map +0 -1
- package/dist/components/chip/index.d.ts.map +0 -1
- package/dist/components/chip/index.js.map +0 -1
- package/dist/components/combobox/index.d.ts.map +0 -1
- package/dist/components/combobox/index.js.map +0 -1
- package/dist/components/datepicker/index.d.ts.map +0 -1
- package/dist/components/datepicker/index.js.map +0 -1
- package/dist/components/dialog/index.d.ts.map +0 -1
- package/dist/components/dialog/index.js.map +0 -1
- package/dist/components/divider/index.d.ts.map +0 -1
- package/dist/components/divider/index.js.map +0 -1
- package/dist/components/drawer/index.d.ts.map +0 -1
- package/dist/components/drawer/index.js.map +0 -1
- package/dist/components/empty/index.d.ts.map +0 -1
- package/dist/components/empty/index.js.map +0 -1
- package/dist/components/fileupload/index.d.ts.map +0 -1
- package/dist/components/fileupload/index.js.map +0 -1
- package/dist/components/form/index.d.ts.map +0 -1
- package/dist/components/form/index.js.map +0 -1
- package/dist/components/input/index.d.ts.map +0 -1
- package/dist/components/input/index.js.map +0 -1
- package/dist/components/menu/index.d.ts.map +0 -1
- package/dist/components/menu/index.js.map +0 -1
- package/dist/components/metric/index.d.ts.map +0 -1
- package/dist/components/metric/index.js.map +0 -1
- package/dist/components/numberinput/index.d.ts.map +0 -1
- package/dist/components/numberinput/index.js.map +0 -1
- package/dist/components/otpinput/index.d.ts.map +0 -1
- package/dist/components/otpinput/index.js.map +0 -1
- package/dist/components/page/index.d.ts.map +0 -1
- package/dist/components/page/index.js.map +0 -1
- package/dist/components/passwordinput/index.d.ts.map +0 -1
- package/dist/components/passwordinput/index.js.map +0 -1
- package/dist/components/popover/index.d.ts.map +0 -1
- package/dist/components/popover/index.js.map +0 -1
- package/dist/components/radio/index.d.ts.map +0 -1
- package/dist/components/radio/index.js.map +0 -1
- package/dist/components/ratinginput/index.d.ts.map +0 -1
- package/dist/components/ratinginput/index.js.map +0 -1
- package/dist/components/select/index.d.ts.map +0 -1
- package/dist/components/select/index.js.map +0 -1
- package/dist/components/skeleton/index.d.ts.map +0 -1
- package/dist/components/skeleton/index.js.map +0 -1
- package/dist/components/slider/index.d.ts.map +0 -1
- package/dist/components/slider/index.js.map +0 -1
- package/dist/components/spinner/index.d.ts.map +0 -1
- package/dist/components/spinner/index.js.map +0 -1
- package/dist/components/splitter/index.d.ts.map +0 -1
- package/dist/components/splitter/index.js.map +0 -1
- package/dist/components/stepper/index.d.ts.map +0 -1
- package/dist/components/stepper/index.js.map +0 -1
- package/dist/components/switch/index.d.ts.map +0 -1
- package/dist/components/switch/index.js.map +0 -1
- package/dist/components/table/index.d.ts.map +0 -1
- package/dist/components/table/index.js.map +0 -1
- package/dist/components/tabs/index.d.ts.map +0 -1
- package/dist/components/tabs/index.js.map +0 -1
- package/dist/components/textarea/index.d.ts.map +0 -1
- package/dist/components/textarea/index.js.map +0 -1
- package/dist/components/textlink/index.d.ts.map +0 -1
- package/dist/components/textlink/index.js.map +0 -1
- package/dist/components/toast/index.d.ts.map +0 -1
- package/dist/components/toast/index.js.map +0 -1
- package/dist/components/toggle/index.d.ts.map +0 -1
- package/dist/components/toggle/index.js.map +0 -1
- package/dist/components/tooltip/index.d.ts.map +0 -1
- package/dist/components/tooltip/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/Style.d.ts.map +0 -1
- package/dist/types/Style.js.map +0 -1
- package/dist/types/Tone.d.ts.map +0 -1
- package/dist/types/Tone.js.map +0 -1
- package/dist/utils/ArkStateToDataAttributes.d.ts.map +0 -1
- package/dist/utils/ArkStateToDataAttributes.js.map +0 -1
- package/dist/utils/Tone.d.ts.map +0 -1
- package/dist/utils/Tone.js.map +0 -1
- package/dist/utils/useForwardClickToInput.d.ts.map +0 -1
- package/dist/utils/useForwardClickToInput.js.map +0 -1
- package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts.map +0 -1
- package/dist/utils/virtualization/useVirtualizedAutocomplete.js.map +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.d.ts.map +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.js.map +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.d.ts.map +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
|
|
3
|
-
import { Check, ChevronsUpDown, LoaderCircle, X } from
|
|
4
|
-
import { cloneElement, createContext, forwardRef, useContext, useId, useState
|
|
3
|
+
import { Check, ChevronsUpDown, LoaderCircle, X } from "../../utils/icons.js";
|
|
4
|
+
import { cloneElement, createContext, forwardRef, useContext, useEffect, useId, useState } from 'react';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
|
-
import {
|
|
6
|
+
import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
|
|
7
7
|
/**
|
|
8
8
|
* Searchable selection using Base UI's built-in filtering and keyboard handling.
|
|
9
9
|
* Does not render an element. Keep all parts inside Root.
|
|
@@ -157,37 +157,44 @@ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
|
|
|
157
157
|
* <Combobox.AddonOpenButtonIcon />
|
|
158
158
|
* </Combobox.AddonOpenButton>
|
|
159
159
|
*/
|
|
160
|
-
export function Root({ children, id,
|
|
160
|
+
export function Root({ children, id, validation, defaultOpen = false, onOpenChange, ...props }) {
|
|
161
|
+
//1. Tracking the open state even when uncontrolled, so parts can carry data-open
|
|
162
|
+
const [openInternalState, setOpenInternalState] = useState(defaultOpen);
|
|
163
|
+
//2. Holding the ids of Description, Error and Success, so Input announces them to screen readers through aria-describedby
|
|
164
|
+
const [describedByIds, setDescribedByIds] = useState([]);
|
|
165
|
+
//3. Sharing everything with the parts
|
|
161
166
|
const generatedId = useId();
|
|
162
167
|
const inputId = id ?? generatedId;
|
|
163
|
-
|
|
164
|
-
return (_jsx(BaseCombobox.Root, { ...props, id: inputId, open: open, defaultOpen: defaultOpen, onItemHighlighted: onItemHighlighted, isItemEqualToValue: (item, selected) => item.value === selected.value, onOpenChange: (nextOpen, details) => {
|
|
168
|
+
return (_jsx(BaseCombobox.Root, { ...props, id: inputId, defaultOpen: defaultOpen, isItemEqualToValue: (item, selected) => item.value === selected.value, onOpenChange: (nextOpen, details) => {
|
|
165
169
|
onOpenChange?.(nextOpen, details);
|
|
166
170
|
if (!details.isCanceled)
|
|
167
171
|
setOpenInternalState(nextOpen);
|
|
168
172
|
}, children: _jsx(ComboboxContext.Provider, { value: {
|
|
169
173
|
inputId,
|
|
170
|
-
open: open ?? openInternalState,
|
|
174
|
+
open: props.open ?? openInternalState,
|
|
171
175
|
disabled: props.disabled ?? false,
|
|
172
176
|
readOnly: props.readOnly ?? false,
|
|
173
177
|
required: props.required ?? false,
|
|
174
|
-
|
|
178
|
+
validation: readValidation(validation),
|
|
179
|
+
describedByIds,
|
|
180
|
+
setDescribedByIds,
|
|
181
|
+
}, children: children }) }));
|
|
175
182
|
}
|
|
176
183
|
/** Use for the standard stacked layout, or omit when supplying your own layout. */
|
|
177
|
-
export const Container = forwardRef(function Container({ disableStyle, className, ...props }, ref) {
|
|
184
|
+
export const Container = /* @__PURE__ */ forwardRef(function Container({ disableStyle, className, ...props }, ref) {
|
|
178
185
|
return (_jsx("div", { ...props, ref: ref, "data-component": "combobox-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
179
186
|
});
|
|
180
187
|
/** Labels the input automatically using Root's id. Supply the visible label as children; no htmlFor needed. */
|
|
181
|
-
export const Label = forwardRef(function Label({ disableStyle, className, ...props }, ref) {
|
|
182
|
-
const
|
|
188
|
+
export const Label = /* @__PURE__ */ forwardRef(function Label({ disableStyle, className, ...props }, ref) {
|
|
189
|
+
const context = useComboboxContext();
|
|
183
190
|
const attributes = usePartAttributes();
|
|
184
|
-
return (_jsx("label", { ...attributes, ...props, ref: ref, htmlFor: inputId, "data-component": "combobox-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
191
|
+
return (_jsx("label", { ...attributes, ...props, ref: ref, htmlFor: context.inputId, "data-component": "combobox-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
185
192
|
});
|
|
186
193
|
/** Search input with built-in filtering and selected-label display. Its id is managed by Root. Inside ChipsList, the preset automatically uses the compact chip-input sizing. */
|
|
187
|
-
export const Input = forwardRef(function Input({ disableStyle, className, ...props }, ref) {
|
|
188
|
-
const
|
|
194
|
+
export const Input = /* @__PURE__ */ forwardRef(function Input({ disableStyle, className, 'aria-describedby': describedBy, ...props }, ref) {
|
|
195
|
+
const context = useComboboxContext();
|
|
189
196
|
const inChips = useContext(ChipsContext);
|
|
190
|
-
return (_jsx(BaseCombobox.Input, { ...props, ref: ref, id: inputId, "data-component": "combobox-input", "data-style-disabled": disableStyle ? '' : undefined, "data-in-chips": inChips ? '' : undefined, className: className }));
|
|
197
|
+
return (_jsx(BaseCombobox.Input, { "aria-invalid": context.validation.state === 'error' || undefined, "aria-describedby": [describedBy, ...context.describedByIds].filter(Boolean).join(' ') || undefined, ...props, ref: ref, id: context.inputId, "data-component": "combobox-input", "data-style-disabled": disableStyle ? '' : undefined, "data-in-chips": inChips ? '' : undefined, className: className }));
|
|
191
198
|
});
|
|
192
199
|
function ChipsListInner({ disableStyle, children, className, ...props }, ref) {
|
|
193
200
|
return (_jsx(BaseCombobox.Value, { children: (selected) => (_jsx(ChipsContext.Provider, { value: true, children: _jsx(BaseCombobox.Chips, { ...props, ref: ref, "data-slot": "chips-list", "data-component": "combobox-chipslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? children(selected) : children }) })) }));
|
|
@@ -218,28 +225,28 @@ function ChipsListInner({ disableStyle, children, className, ...props }, ref) {
|
|
|
218
225
|
* </Combobox.ChipsList>
|
|
219
226
|
* </Combobox.InputGroup>
|
|
220
227
|
*/
|
|
221
|
-
export const ChipsList = forwardRef(ChipsListInner);
|
|
228
|
+
export const ChipsList = /* @__PURE__ */ forwardRef(ChipsListInner);
|
|
222
229
|
/** Reads Base UI selection without rendering its own element. Use its children callback only when you need a custom selection display; Input already displays the selected label automatically. */
|
|
223
230
|
export const Value = BaseCombobox.Value;
|
|
224
231
|
/** Required listbox and scroll viewport inside Popup. Place GroupsList inside it. Owns keyboard/listbox semantics; do not nest another listbox primitive. */
|
|
225
|
-
export const ScrollArea = forwardRef(function ScrollArea({ disableStyle, className,
|
|
226
|
-
return (_jsx(BaseCombobox.List, { ...props, ref: ref,
|
|
232
|
+
export const ScrollArea = /* @__PURE__ */ forwardRef(function ScrollArea({ disableStyle, className, ...props }, ref) {
|
|
233
|
+
return (_jsx(BaseCombobox.List, { ...props, ref: ref, "data-component": "combobox-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
227
234
|
});
|
|
228
235
|
/** 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 Combobox.GroupType<typeof rootItems>, using the exact items variable passed to Root. */
|
|
229
|
-
export function GroupsList({ disableStyle, children, className,
|
|
230
|
-
return (_jsx("div", { ...props,
|
|
236
|
+
export function GroupsList({ disableStyle, children, className, ...props }) {
|
|
237
|
+
return (_jsx("div", { ...props, "data-component": "combobox-groupslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? (_jsx(BaseCombobox.Collection, { children: children })) : (children) }));
|
|
231
238
|
}
|
|
232
239
|
/** Required items container inside Group. A children callback receives the filtered items belonging to that Group; do not repeat filtering yourself. Manually annotate item with Combobox.ItemType<typeof rootItems>, using the exact items variable passed to Root. */
|
|
233
|
-
export function ItemsList({ disableStyle, children, className,
|
|
234
|
-
return (_jsx("div", { ...props,
|
|
240
|
+
export function ItemsList({ disableStyle, children, className, ...props }) {
|
|
241
|
+
return (_jsx("div", { ...props, "data-component": "combobox-itemslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: typeof children === 'function' ? (_jsx(BaseCombobox.Collection, { children: children })) : (children) }));
|
|
235
242
|
}
|
|
236
243
|
/** 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. */
|
|
237
|
-
export function Group({ disableStyle, className,
|
|
238
|
-
return (_jsx(BaseCombobox.Group, { ...props,
|
|
244
|
+
export function Group({ disableStyle, className, ...props }) {
|
|
245
|
+
return (_jsx(BaseCombobox.Group, { ...props, "data-component": "combobox-group", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
239
246
|
}
|
|
240
247
|
/** Required selectable row inside ItemsList. Pass the complete item object as value, with ItemText and ItemIndicator inside. Selection, highlighting, and keyboard behavior are built in. */
|
|
241
|
-
export function Item({ disableStyle, className,
|
|
242
|
-
return (_jsx(BaseCombobox.Item, { ...props,
|
|
248
|
+
export function Item({ disableStyle, className, ...props }) {
|
|
249
|
+
return (_jsx(BaseCombobox.Item, { ...props, "data-component": "combobox-item", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
243
250
|
}
|
|
244
251
|
/** 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. */
|
|
245
252
|
export function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side = 'bottom', sideOffset = 5, align = 'start', alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }) {
|
|
@@ -252,23 +259,15 @@ export function Popup({ disableStyle, container, keepMounted, anchor, positionMe
|
|
|
252
259
|
: { ...baseStyle, ...style } }) }) }));
|
|
253
260
|
}
|
|
254
261
|
/** Optional decorative popup arrow. Place inside Popup; the SVG and direction handling are supplied. No children needed. */
|
|
255
|
-
export const Arrow = forwardRef(function Arrow({ disableStyle, className, style, ...props }, ref) {
|
|
262
|
+
export const Arrow = /* @__PURE__ */ forwardRef(function Arrow({ disableStyle, className, style, ...props }, ref) {
|
|
256
263
|
return (_jsxs(BaseCombobox.Arrow, { style: style, render: _jsx("svg", { ...props, ref: ref, "aria-hidden": true, width: "20", height: "10", viewBox: "0 0 20 10" }), "data-component": "combobox-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": "combobox-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": "combobox-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": "combobox-arrow-3" })] }));
|
|
257
264
|
});
|
|
258
|
-
/** Behavior only: turns its single child element into the popup trigger. Adds no preset styling and has no disableStyle prop. Use an accessible button child; pass className to the child for its appearance. */
|
|
259
|
-
export const PopupOpenHandler = forwardRef(function PopupOpenHandler({ children, ...props }, ref) {
|
|
260
|
-
return _jsx(BaseCombobox.Trigger, { ...props, ref: ref, render: children });
|
|
261
|
-
});
|
|
262
|
-
/** Behavior only: turns its single child element into a removal control for the surrounding Chip. Adds no preset styling and has no disableStyle prop. Use an accessible button child. */
|
|
263
|
-
export const ChipRemoveHandler = forwardRef(function ChipRemoveHandler({ children, ...props }, ref) {
|
|
264
|
-
return _jsx(BaseCombobox.ChipRemove, { ...props, ref: ref, render: children });
|
|
265
|
-
});
|
|
266
265
|
/** Optional input adornment container inside InputGroup. Wraps icons, text, or buttons without adding trigger behavior. */
|
|
267
|
-
export const Addon = forwardRef(function Addon({ disableStyle, variant = 'normal', className, ...props }, ref) {
|
|
266
|
+
export const Addon = /* @__PURE__ */ forwardRef(function Addon({ disableStyle, variant = 'normal', className, ...props }, ref) {
|
|
268
267
|
return (_jsx("div", { ...props, ref: ref, "data-variant": variant, "data-component": "combobox-addon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
269
268
|
});
|
|
270
269
|
/** Clones one supplied icon element, forwarding its ref and preserving its classes. Decorative only; does not open the popup or perform an action. */
|
|
271
|
-
export const AddonIcon = forwardRef(function AddonIcon({ disableStyle, children, className, strokeWidth = 1.5, ...props }, ref) {
|
|
270
|
+
export const AddonIcon = /* @__PURE__ */ forwardRef(function AddonIcon({ disableStyle, children, className, strokeWidth = 1.5, ...props }, ref) {
|
|
272
271
|
const attributes = usePartAttributes();
|
|
273
272
|
return cloneElement(children, {
|
|
274
273
|
...attributes,
|
|
@@ -282,96 +281,110 @@ export const AddonIcon = forwardRef(function AddonIcon({ disableStyle, children,
|
|
|
282
281
|
});
|
|
283
282
|
});
|
|
284
283
|
/** Optional general-purpose button inside Addon. Supply its action yourself. Automatically disabled when Root is disabled or readOnly; defaults to type="button". */
|
|
285
|
-
export const AddonButton = forwardRef(function AddonButton({ disableStyle, className, disabled, type = 'button', ...props }, ref) {
|
|
284
|
+
export const AddonButton = /* @__PURE__ */ forwardRef(function AddonButton({ disableStyle, className, disabled, type = 'button', ...props }, ref) {
|
|
286
285
|
const context = useComboboxContext();
|
|
287
286
|
const attributes = usePartAttributes();
|
|
288
287
|
return (_jsx("button", { ...attributes, ...props, ref: ref, type: type, disabled: disabled || context.disabled || context.readOnly, "data-component": "combobox-addonbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
289
288
|
});
|
|
290
|
-
/** Input control wrapper. Place Input (or ChipsList containing Input) and optional Addon controls inside. Root
|
|
291
|
-
export const InputGroup = forwardRef(function InputGroup({ disableStyle, className, ...props }, ref) {
|
|
292
|
-
const
|
|
293
|
-
return (_jsx(BaseCombobox.InputGroup, { "data-
|
|
289
|
+
/** Input control wrapper. Place Input (or ChipsList containing Input) and optional Addon controls inside. Root validation controls its preset validation border. */
|
|
290
|
+
export const InputGroup = /* @__PURE__ */ forwardRef(function InputGroup({ disableStyle, className, ...props }, ref) {
|
|
291
|
+
const attributes = usePartAttributes();
|
|
292
|
+
return (_jsx(BaseCombobox.InputGroup, { "data-validation": attributes['data-validation'], ...props, ref: ref, "data-component": "combobox-inputgroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
294
293
|
});
|
|
295
294
|
/** Displays one selected item inside ChipsList. Keep chips in selected-item order so Base UI can remove the matching item. Supply the item label and an optional removal control. */
|
|
296
|
-
export const Chip = forwardRef(function Chip({ disableStyle, className, ...props }, ref) {
|
|
295
|
+
export const Chip = /* @__PURE__ */ forwardRef(function Chip({ disableStyle, className, ...props }, ref) {
|
|
297
296
|
return (_jsx(BaseCombobox.Chip, { ...props, ref: ref, "data-component": "combobox-chip", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
298
297
|
});
|
|
299
298
|
/** Removes the surrounding Chip from selection automatically; no onClick handler needed. Supply its content, normally ChipRemoveButtonIcon, and an accessible label. */
|
|
300
|
-
export const ChipRemoveButton = forwardRef(function ChipRemoveButton({ disableStyle, className, ...props }, ref) {
|
|
299
|
+
export const ChipRemoveButton = /* @__PURE__ */ forwardRef(function ChipRemoveButton({ disableStyle, className, ...props }, ref) {
|
|
301
300
|
return (_jsx(BaseCombobox.ChipRemove, { ...props, ref: ref, "data-component": "combobox-chipremovebutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
302
301
|
});
|
|
303
302
|
/** Opens and closes the popup automatically; no click handler needed. Supply its content, normally AddonOpenButtonIcon, and an accessible label. */
|
|
304
|
-
export const AddonOpenButton = forwardRef(function AddonOpenButton({ disableStyle, className, ...props }, ref) {
|
|
303
|
+
export const AddonOpenButton = /* @__PURE__ */ forwardRef(function AddonOpenButton({ disableStyle, className, ...props }, ref) {
|
|
305
304
|
return (_jsx(BaseCombobox.Trigger, { ...props, ref: ref, "data-component": "combobox-addonopenbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
306
305
|
});
|
|
307
306
|
/** Clears the selection automatically; no click handler needed. Supply its content, normally AddonClearButtonIcon, and an accessible label. */
|
|
308
|
-
export const AddonClearButton = forwardRef(function AddonClearButton({ disableStyle, className, ...props }, ref) {
|
|
307
|
+
export const AddonClearButton = /* @__PURE__ */ forwardRef(function AddonClearButton({ disableStyle, className, ...props }, ref) {
|
|
309
308
|
return (_jsx(BaseCombobox.Clear, { ...props, ref: ref, "data-component": "combobox-addonclearbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
310
309
|
});
|
|
311
310
|
/** Optional heading inside Group. Supply group.label as children. Omit this part for an empty label; always keep Group and ItemsList. */
|
|
312
|
-
export const GroupLabel = forwardRef(function GroupLabel({ disableStyle, className, ...props }, ref) {
|
|
311
|
+
export const GroupLabel = /* @__PURE__ */ forwardRef(function GroupLabel({ disableStyle, className, ...props }, ref) {
|
|
313
312
|
return (_jsx(BaseCombobox.GroupLabel, { ...props, ref: ref, "data-component": "combobox-grouplabel", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
314
313
|
});
|
|
315
314
|
/** 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. */
|
|
316
|
-
export const Empty = forwardRef(function Empty({ disableStyle, className, ...props }, ref) {
|
|
315
|
+
export const Empty = /* @__PURE__ */ forwardRef(function Empty({ disableStyle, className, ...props }, ref) {
|
|
317
316
|
return (_jsx(BaseCombobox.Empty, { ...props, ref: ref, "data-component": "combobox-empty", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
318
317
|
});
|
|
319
318
|
/** Optional visual separator inside the popup. Does not replace Group or any required list containers. */
|
|
320
|
-
export const Separator = forwardRef(function Separator({ disableStyle, className, ...props }, ref) {
|
|
319
|
+
export const Separator = /* @__PURE__ */ forwardRef(function Separator({ disableStyle, className, ...props }, ref) {
|
|
321
320
|
return (_jsx(BaseCombobox.Separator, { ...props, ref: ref, "data-component": "combobox-separator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
322
321
|
});
|
|
323
322
|
/** Required label content inside Item. Supply item.label as children; does not derive text from the item automatically. */
|
|
324
|
-
export const ItemText = forwardRef(function ItemText({ disableStyle, className, ...props }, ref) {
|
|
323
|
+
export const ItemText = /* @__PURE__ */ forwardRef(function ItemText({ disableStyle, className, ...props }, ref) {
|
|
325
324
|
const attributes = usePartAttributes();
|
|
326
325
|
return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "combobox-itemtext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
327
326
|
});
|
|
328
327
|
/** Optional decorative text inside Addon. Supply the text as children. */
|
|
329
|
-
export const AddonText = forwardRef(function AddonText({ disableStyle, className, ...props }, ref) {
|
|
328
|
+
export const AddonText = /* @__PURE__ */ forwardRef(function AddonText({ disableStyle, className, ...props }, ref) {
|
|
330
329
|
const attributes = usePartAttributes();
|
|
331
330
|
return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "combobox-addontext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
332
331
|
});
|
|
333
332
|
/** Text content inside Empty. Supply your empty-result message; Empty handles its visibility automatically. */
|
|
334
|
-
export const EmptyText = forwardRef(function EmptyText({ disableStyle, className, ...props }, ref) {
|
|
333
|
+
export const EmptyText = /* @__PURE__ */ forwardRef(function EmptyText({ disableStyle, className, ...props }, ref) {
|
|
335
334
|
const attributes = usePartAttributes();
|
|
336
335
|
return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "combobox-emptytext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
337
336
|
});
|
|
338
|
-
/** Optional supporting text. Supply its content; it
|
|
339
|
-
export const Description = forwardRef(function Description({ disableStyle, className, ...props }, ref) {
|
|
337
|
+
/** Optional supporting text. Supply its content; it describes the input to screen readers automatically. */
|
|
338
|
+
export const Description = /* @__PURE__ */ forwardRef(function Description({ disableStyle, className, id, ...props }, ref) {
|
|
339
|
+
const describedById = useDescribedById(id);
|
|
340
340
|
const attributes = usePartAttributes();
|
|
341
|
-
return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "combobox-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
341
|
+
return (_jsx("div", { ...attributes, ...props, id: describedById, ref: ref, "data-component": "combobox-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
342
342
|
});
|
|
343
|
-
/**
|
|
344
|
-
export const Error = forwardRef(function Error({
|
|
345
|
-
const
|
|
346
|
-
|
|
343
|
+
/** 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. */
|
|
344
|
+
export const Error = /* @__PURE__ */ forwardRef(function Error({ children, ...props }, ref) {
|
|
345
|
+
const context = useComboboxContext();
|
|
346
|
+
const content = validationMessageContent(context.validation, 'error', children);
|
|
347
|
+
if (content === undefined)
|
|
348
|
+
return null;
|
|
349
|
+
return _jsx(Message, { ...props, ref: ref, role: "alert", component: "combobox-error", children: content });
|
|
347
350
|
});
|
|
348
|
-
/**
|
|
349
|
-
export const Success = forwardRef(function Success({
|
|
351
|
+
/** 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. */
|
|
352
|
+
export const Success = /* @__PURE__ */ forwardRef(function Success({ children, ...props }, ref) {
|
|
353
|
+
const context = useComboboxContext();
|
|
354
|
+
const content = validationMessageContent(context.validation, 'success', children);
|
|
355
|
+
if (content === undefined)
|
|
356
|
+
return null;
|
|
357
|
+
return _jsx(Message, { ...props, ref: ref, role: "status", component: "combobox-success", children: content });
|
|
358
|
+
});
|
|
359
|
+
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the input
|
|
360
|
+
const Message = /* @__PURE__ */ forwardRef(function Message({ disableStyle, className, id, component, ...props }, ref) {
|
|
361
|
+
const describedById = useDescribedById(id);
|
|
350
362
|
const attributes = usePartAttributes();
|
|
351
|
-
return
|
|
363
|
+
return _jsx("div", { "aria-atomic": "true", ...attributes, ...props, id: describedById, ref: ref, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
352
364
|
});
|
|
353
365
|
/** Built-in decorative open-button icon. Place inside AddonOpenButton; no children needed. Defaults to strokeWidth 1.5. */
|
|
354
|
-
export const AddonOpenButtonIcon = forwardRef(function AddonOpenButtonIcon(
|
|
355
|
-
|
|
356
|
-
return (_jsx(ChevronsUpDown, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-addonopenbuttonicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
366
|
+
export const AddonOpenButtonIcon = /* @__PURE__ */ forwardRef(function AddonOpenButtonIcon(props, ref) {
|
|
367
|
+
return _jsx(BuiltInIcon, { ...props, ref: ref, icon: ChevronsUpDown, component: "combobox-addonopenbuttonicon" });
|
|
357
368
|
});
|
|
358
369
|
/** Built-in decorative clear icon. Place inside AddonClearButton; no children needed. Defaults to strokeWidth 1.5. */
|
|
359
|
-
export const AddonClearButtonIcon = forwardRef(function AddonClearButtonIcon(
|
|
360
|
-
|
|
361
|
-
return (_jsx(X, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-addonclearbuttonicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
370
|
+
export const AddonClearButtonIcon = /* @__PURE__ */ forwardRef(function AddonClearButtonIcon(props, ref) {
|
|
371
|
+
return _jsx(BuiltInIcon, { ...props, ref: ref, icon: X, component: "combobox-addonclearbuttonicon" });
|
|
362
372
|
});
|
|
363
373
|
/** Built-in decorative removal icon. Place inside ChipRemoveButton; no children needed. Defaults to strokeWidth 1.5. */
|
|
364
|
-
export const ChipRemoveButtonIcon = forwardRef(function ChipRemoveButtonIcon(
|
|
365
|
-
|
|
366
|
-
return (_jsx(X, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-chipremovebuttonicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
374
|
+
export const ChipRemoveButtonIcon = /* @__PURE__ */ forwardRef(function ChipRemoveButtonIcon(props, ref) {
|
|
375
|
+
return _jsx(BuiltInIcon, { ...props, ref: ref, icon: X, component: "combobox-chipremovebuttonicon" });
|
|
367
376
|
});
|
|
368
377
|
/** Optional spinner inside Addon. Does not detect requests: you decide when to render it. Defaults to strokeWidth 1.5. */
|
|
369
|
-
export const AddonLoadingIcon = forwardRef(function AddonLoadingIcon(
|
|
378
|
+
export const AddonLoadingIcon = /* @__PURE__ */ forwardRef(function AddonLoadingIcon(props, ref) {
|
|
379
|
+
return _jsx(BuiltInIcon, { ...props, ref: ref, icon: LoaderCircle, component: "combobox-addonloadingicon" });
|
|
380
|
+
});
|
|
381
|
+
// The shared body of the built-in decorative icons above, which only differ by their icon and component name
|
|
382
|
+
const BuiltInIcon = /* @__PURE__ */ forwardRef(function BuiltInIcon({ disableStyle, className, strokeWidth = 1.5, icon: Icon, component, ...props }, ref) {
|
|
370
383
|
const attributes = usePartAttributes();
|
|
371
|
-
return
|
|
384
|
+
return _jsx(Icon, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
372
385
|
});
|
|
373
386
|
/** Required selection indicator inside Item. Visibility is automatic and a checkmark is supplied: no children or selection condition needed. Pass children only to replace the built-in checkmark. */
|
|
374
|
-
export const ItemIndicator = forwardRef(function ItemIndicator({ disableStyle, children, keepMounted, ...props }, ref) {
|
|
387
|
+
export const ItemIndicator = /* @__PURE__ */ forwardRef(function ItemIndicator({ disableStyle, children, keepMounted, ...props }, ref) {
|
|
375
388
|
const iconProps = {
|
|
376
389
|
'aria-hidden': true,
|
|
377
390
|
strokeWidth: 2,
|
|
@@ -383,34 +396,45 @@ export const ItemIndicator = forwardRef(function ItemIndicator({ disableStyle, c
|
|
|
383
396
|
return (_jsx(BaseCombobox.ItemIndicator, { keepMounted: keepMounted, children: null, render: cloneElement(children ?? _jsx(Check, {}), iconProps) }));
|
|
384
397
|
});
|
|
385
398
|
/** 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. */
|
|
386
|
-
export const Loading = forwardRef(function Loading({ disableStyle, className, ...props }, ref) {
|
|
399
|
+
export const Loading = /* @__PURE__ */ forwardRef(function Loading({ disableStyle, className, ...props }, ref) {
|
|
387
400
|
return (_jsx(BaseCombobox.Status, { ...props, ref: ref, "data-component": "combobox-loading", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
388
401
|
});
|
|
389
402
|
/** Text inside Loading. Supply the message only while your request is loading; this part does not detect request state. */
|
|
390
|
-
export const LoadingText = forwardRef(function LoadingText({ disableStyle, className, ...props }, ref) {
|
|
403
|
+
export const LoadingText = /* @__PURE__ */ forwardRef(function LoadingText({ disableStyle, className, ...props }, ref) {
|
|
391
404
|
return (_jsx("div", { ...props, ref: ref, "data-component": "combobox-loadingtext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
392
405
|
});
|
|
393
406
|
/** Built-in decorative spinner for Loading. No children needed; you control when it is rendered. */
|
|
394
|
-
export const LoadingIcon = forwardRef(function LoadingIcon({ disableStyle, className, ...props }, ref) {
|
|
395
|
-
return (_jsx(LoaderCircle, { "aria-hidden": true,
|
|
407
|
+
export const LoadingIcon = /* @__PURE__ */ forwardRef(function LoadingIcon({ disableStyle, className, strokeWidth = 2, ...props }, ref) {
|
|
408
|
+
return (_jsx(LoaderCircle, { "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "combobox-loadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
396
409
|
});
|
|
397
|
-
const ComboboxContext = createContext(null);
|
|
398
|
-
|
|
410
|
+
const ComboboxContext = /* @__PURE__ */ createContext(null);
|
|
411
|
+
// Telling Input it sits inside ChipsList, so the preset uses the compact chip-input sizing
|
|
412
|
+
const ChipsContext = /* @__PURE__ */ createContext(false);
|
|
399
413
|
function useComboboxContext() {
|
|
400
414
|
const context = useContext(ComboboxContext);
|
|
401
415
|
if (!context)
|
|
402
416
|
throw new globalThis.Error('Combobox parts must be inside Combobox.Root');
|
|
403
417
|
return context;
|
|
404
418
|
}
|
|
419
|
+
// The state attributes every part carries, so presets can style any part from Root's state
|
|
405
420
|
function usePartAttributes() {
|
|
406
|
-
const
|
|
407
|
-
const tone = useToneContext();
|
|
421
|
+
const context = useComboboxContext();
|
|
408
422
|
return {
|
|
409
|
-
'data-open': open ? '' : undefined,
|
|
410
|
-
'data-disabled': disabled ? '' : undefined,
|
|
411
|
-
'data-readonly': readOnly ? '' : undefined,
|
|
412
|
-
'data-required': required ? '' : undefined,
|
|
413
|
-
|
|
423
|
+
'data-open': context.open ? '' : undefined,
|
|
424
|
+
'data-disabled': context.disabled ? '' : undefined,
|
|
425
|
+
'data-readonly': context.readOnly ? '' : undefined,
|
|
426
|
+
'data-required': context.required ? '' : undefined,
|
|
427
|
+
...validationAttributes(context.validation),
|
|
414
428
|
};
|
|
415
429
|
}
|
|
416
|
-
|
|
430
|
+
// Registering a part's id in Input's aria-describedby while the part is mounted
|
|
431
|
+
function useDescribedById(id) {
|
|
432
|
+
const context = useComboboxContext();
|
|
433
|
+
const generatedId = useId();
|
|
434
|
+
const describedById = id ?? generatedId;
|
|
435
|
+
useEffect(() => {
|
|
436
|
+
context.setDescribedByIds((current) => [...current, describedById]);
|
|
437
|
+
return () => context.setDescribedByIds((current) => current.filter((currentId) => currentId !== describedById));
|
|
438
|
+
}, [describedById, context.setDescribedByIds]);
|
|
439
|
+
return describedById;
|
|
440
|
+
}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
|
-
import {
|
|
3
|
-
import type { DatePickerProps
|
|
2
|
+
import type { AsChildProps } from '../../utils/asChild.ts';
|
|
3
|
+
import type { DatePickerProps } from 'react-aria-components/DatePicker';
|
|
4
|
+
import type { DateRangePickerProps } from 'react-aria-components/DateRangePicker';
|
|
5
|
+
import { Label as AriaLabel } from 'react-aria-components/Label';
|
|
6
|
+
import { Group as AriaGroup } from 'react-aria-components/Group';
|
|
7
|
+
import { DateInput as AriaDateInput } from 'react-aria-components/DateField';
|
|
8
|
+
import type { DateSegmentProps } from 'react-aria-components/DateField';
|
|
9
|
+
import type { ButtonProps } from 'react-aria-components/Button';
|
|
10
|
+
import type { PopoverProps } from 'react-aria-components/Popover';
|
|
11
|
+
import { CalendarGrid } from 'react-aria-components/Calendar';
|
|
12
|
+
import type { CalendarProps } from 'react-aria-components/Calendar';
|
|
13
|
+
import { Heading } from 'react-aria-components/Heading';
|
|
14
|
+
import type { ListBoxProps, ListBoxItemProps } from 'react-aria-components/ListBox';
|
|
15
|
+
import { Text } from 'react-aria-components/Text';
|
|
16
|
+
import { FieldError } from 'react-aria-components/FieldError';
|
|
4
17
|
import type { CalendarDate } from '@internationalized/date';
|
|
5
18
|
import type { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
6
|
-
import type {
|
|
19
|
+
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
20
|
+
import type { Validation } from '../../types/Validation.ts';
|
|
21
|
+
import type { ValidationMessageChildren } from '../../utils/Validation.ts';
|
|
7
22
|
type DateRange = {
|
|
8
23
|
start: string;
|
|
9
24
|
end: string;
|
|
@@ -23,8 +38,6 @@ type SharedRootProps = {
|
|
|
23
38
|
readOnly?: DatePickerProps<CalendarDate>['isReadOnly'];
|
|
24
39
|
/** Require a date when validating a surrounding form. */
|
|
25
40
|
required?: DatePickerProps<CalendarDate>['isRequired'];
|
|
26
|
-
/** Mark the picker invalid for accessibility and validation; use tone for a separate visual tone. */
|
|
27
|
-
invalid?: DatePickerProps<CalendarDate>['isInvalid'];
|
|
28
41
|
/** Control the popup from application state. Omit to let trigger interactions manage it. */
|
|
29
42
|
open?: DatePickerProps<CalendarDate>['isOpen'];
|
|
30
43
|
/** Prevent selection before this ISO calendar date (YYYY-MM-DD). Omit for no lower limit. */
|
|
@@ -35,8 +48,11 @@ type SharedRootProps = {
|
|
|
35
48
|
placeholderValue?: string | null;
|
|
36
49
|
/** Choose date formatting and language. Omit to use the inherited application locale. */
|
|
37
50
|
locale?: string;
|
|
38
|
-
/**
|
|
39
|
-
|
|
51
|
+
/**
|
|
52
|
+
* The picker's validation state, with an optional message: `'error'` marks it invalid, `['error', 'Pick a later date']` also shows that message in Error. Same for `'success'` and Success.
|
|
53
|
+
* Omit it to keep only the picker's own validation, like a required or out-of-range date.
|
|
54
|
+
*/
|
|
55
|
+
validation?: Validation;
|
|
40
56
|
};
|
|
41
57
|
type SingleRootProps = Pick<DatePickerProps<CalendarDate>, CoreKeys | 'name' | 'autoComplete'> & SharedRootProps & {
|
|
42
58
|
/** Use range for a start/end selection; single is the default. Choose the corresponding field composition. */
|
|
@@ -155,15 +171,15 @@ export declare function Addon({ disableStyle, className, variant, ...props }: (C
|
|
|
155
171
|
}) & StyleProps): import("react").JSX.Element;
|
|
156
172
|
export declare function AddonText({ disableStyle, className, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
157
173
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
158
|
-
export declare function AddonIcon({ disableStyle, children, className, ...props }: (Omit<
|
|
174
|
+
export declare function AddonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
|
|
159
175
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
160
|
-
children: ReactElement<
|
|
161
|
-
}) & StyleProps): ReactElement<
|
|
176
|
+
children: ReactElement<SVGIconProps>;
|
|
177
|
+
}) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
|
|
162
178
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
163
|
-
export declare function AddonLoadingIcon({ disableStyle, children, className, ...props }: (Omit<
|
|
179
|
+
export declare function AddonLoadingIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
|
|
164
180
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
165
|
-
children?: ReactElement<
|
|
166
|
-
}) & StyleProps): ReactElement<
|
|
181
|
+
children?: ReactElement<SVGIconProps>;
|
|
182
|
+
}) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
|
|
167
183
|
export declare function AddonButton({ disableStyle, className, disabled, type, ...props }: ComponentProps<'button'> & StyleProps): import("react").JSX.Element;
|
|
168
184
|
export declare function InputsList({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
169
185
|
export declare function InputsListSeparator({ disableStyle, children, className, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
@@ -184,37 +200,28 @@ type StyledButtonProps = Omit<ButtonProps, 'className' | 'style' | 'slot' | 'ren
|
|
|
184
200
|
};
|
|
185
201
|
export declare function AddonOpenButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
|
|
186
202
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
187
|
-
export declare function AddonOpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<
|
|
203
|
+
export declare function AddonOpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
|
|
188
204
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
189
|
-
children?: ReactElement<
|
|
190
|
-
}) & StyleProps): ReactElement<
|
|
191
|
-
/**
|
|
192
|
-
export declare function
|
|
193
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
194
|
-
children: ReactElement<ComponentProps<'button'>>;
|
|
195
|
-
}): import("react").JSX.Element;
|
|
196
|
-
export declare function OpenButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
|
|
197
|
-
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
198
|
-
export declare function OpenHandler({ children, isDisabled, ...props }: Omit<StyledButtonProps, 'children' | 'render'> & {
|
|
199
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
200
|
-
children: ReactElement<ComponentProps<'button'>>;
|
|
201
|
-
}): import("react").JSX.Element;
|
|
205
|
+
children?: ReactElement<SVGIconProps>;
|
|
206
|
+
}) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
|
|
207
|
+
/** Opens the calendar popup. Pass asChild to give this behavior to your own button, like a "Choose appointment" Button; it keeps the state data attributes but none of this part's styling. */
|
|
208
|
+
export declare function OpenButton({ asChild, disableStyle, isDisabled, children, ...props }: StyledButtonProps & AsChildProps & StyleProps): import("react").JSX.Element;
|
|
202
209
|
/** Formats the selected date or range automatically. Omit children for the usual display; supply children only to replace it. Placeholder appears before selection. */
|
|
203
210
|
export declare function OpenButtonValue({ disableStyle, children, placeholder, className, ...props }: (ComponentProps<'span'> & {
|
|
204
211
|
/** Shown before a date is selected. Omit children to keep the automatic formatted date display. */
|
|
205
212
|
placeholder?: string;
|
|
206
213
|
}) & StyleProps): import("react").JSX.Element;
|
|
207
214
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
208
|
-
export declare function OpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<
|
|
215
|
+
export declare function OpenButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
|
|
209
216
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
210
|
-
children?: ReactElement<
|
|
211
|
-
}) & StyleProps): ReactElement<
|
|
217
|
+
children?: ReactElement<SVGIconProps>;
|
|
218
|
+
}) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
|
|
212
219
|
export type PopupProps = Omit<PopoverProps, 'className' | 'style' | 'render' | 'slot' | 'trigger' | 'isOpen' | 'defaultOpen' | 'onOpenChange'> & {
|
|
213
220
|
className?: string;
|
|
214
221
|
style?: ComponentProps<'div'>['style'];
|
|
215
222
|
} & StyleProps;
|
|
216
223
|
/** Use the same calendar composition for both trigger choices. Opening and focus management are handled by the picker; do not add your own popup visibility condition. */
|
|
217
|
-
export declare const Popup: import("react").ForwardRefExoticComponent<Omit<PopoverProps, "
|
|
224
|
+
export declare const Popup: import("react").ForwardRefExoticComponent<Omit<PopoverProps, "className" | "slot" | "style" | "render" | "onOpenChange" | "defaultOpen" | "isOpen" | "trigger"> & {
|
|
218
225
|
className?: string;
|
|
219
226
|
style?: ComponentProps<"div">["style"];
|
|
220
227
|
} & StyleProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -246,36 +253,26 @@ export declare function Item({ disableStyle, value, className, textValue, ...pro
|
|
|
246
253
|
className?: string;
|
|
247
254
|
style?: ComponentProps<'div'>['style'];
|
|
248
255
|
}) & StyleProps): import("react").JSX.Element;
|
|
249
|
-
export declare const ItemText: import("react").ForwardRefExoticComponent<Omit<Omit<import("react-aria-components").TextProps & import("react").RefAttributes<HTMLElement>, "slot" | "render"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
256
|
+
export declare const ItemText: import("react").ForwardRefExoticComponent<Omit<Omit<import("react-aria-components/DatePicker").TextProps & import("react").RefAttributes<HTMLElement>, "slot" | "render"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
250
257
|
/** 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. */
|
|
251
|
-
export declare const ItemIndicator: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
258
|
+
export declare const ItemIndicator: import("react").ForwardRefExoticComponent<Omit<Omit<SVGIconProps, "children"> & {
|
|
252
259
|
/** Optional replacement SVG icon. It receives this indicator's props and ref. */
|
|
253
|
-
children?: ReactElement<
|
|
260
|
+
children?: ReactElement<SVGIconProps>;
|
|
254
261
|
} & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
255
262
|
export declare function Actions({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
256
263
|
export declare function ViewDateValue({ disableStyle, className, level, ...props }: (Omit<ComponentProps<'h2'>, 'children'> & Pick<ComponentProps<typeof Heading>, 'level'>) & StyleProps): import("react").JSX.Element;
|
|
257
264
|
export declare function PreviousButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
|
|
258
265
|
export declare function NextButton({ disableStyle, className, isDisabled, ...props }: StyledButtonProps & StyleProps): import("react").JSX.Element;
|
|
259
|
-
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
260
|
-
export declare function PreviousHandler({ children, isDisabled, ...props }: Omit<StyledButtonProps, 'children' | 'render'> & {
|
|
261
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
262
|
-
children: ReactElement<ComponentProps<'button'>>;
|
|
263
|
-
}): import("react").JSX.Element;
|
|
264
|
-
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
265
|
-
export declare function NextHandler({ children, isDisabled, ...props }: Omit<StyledButtonProps, 'children' | 'render'> & {
|
|
266
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
267
|
-
children: ReactElement<ComponentProps<'button'>>;
|
|
268
|
-
}): import("react").JSX.Element;
|
|
269
266
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
270
|
-
export declare function PreviousButtonIcon({ disableStyle, children, className, ...props }: (Omit<
|
|
267
|
+
export declare function PreviousButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
|
|
271
268
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
272
|
-
children?: ReactElement<
|
|
273
|
-
}) & StyleProps): ReactElement<
|
|
269
|
+
children?: ReactElement<SVGIconProps>;
|
|
270
|
+
}) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
|
|
274
271
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
275
|
-
export declare function NextButtonIcon({ disableStyle, children, className, ...props }: (Omit<
|
|
272
|
+
export declare function NextButtonIcon({ disableStyle, children, className, ...props }: (Omit<SVGIconProps, 'children'> & {
|
|
276
273
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
277
|
-
children?: ReactElement<
|
|
278
|
-
}) & StyleProps): ReactElement<
|
|
274
|
+
children?: ReactElement<SVGIconProps>;
|
|
275
|
+
}) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
|
|
279
276
|
/** Calls children for each visible month. Pass its index to Table rather than manually calculating month offsets. */
|
|
280
277
|
export declare function TablesList({ disableStyle, className, children, ...props }: (Omit<ComponentProps<'div'>, 'children'> & {
|
|
281
278
|
/** Return Table with the supplied index; do not manually calculate month offsets. */
|
|
@@ -287,11 +284,13 @@ export declare function Table({ disableStyle, index, className, ...props }: (Omi
|
|
|
287
284
|
index?: number;
|
|
288
285
|
}) & StyleProps): import("react").JSX.Element;
|
|
289
286
|
export declare function Description({ disableStyle, className, ...props }: Omit<ComponentProps<typeof Text>, 'slot' | 'render'> & StyleProps): import("react").JSX.Element;
|
|
290
|
-
/** Keep mounted
|
|
291
|
-
export declare function Error({ disableStyle, className, ...props }: (Omit<ComponentProps<typeof FieldError>, 'className' | 'render'> & {
|
|
287
|
+
/** Keep mounted: it shows while the picker is invalid. With no children it shows Root's message from `['error', message]`, or else the picker's own validation text, like a required or out-of-range date. A function children formats Root's message, and other children replace it. */
|
|
288
|
+
export declare function Error({ disableStyle, className, children, ...props }: (Omit<ComponentProps<typeof FieldError>, 'className' | 'render' | 'children'> & {
|
|
292
289
|
className?: string;
|
|
290
|
+
children?: ValidationMessageChildren;
|
|
293
291
|
}) & StyleProps): import("react").JSX.Element;
|
|
294
|
-
/**
|
|
295
|
-
export declare function Success({ disableStyle, className, ...props }: Omit<ComponentProps<typeof Text>, 'slot' | 'render'> &
|
|
292
|
+
/** 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. */
|
|
293
|
+
export declare function Success({ disableStyle, className, children, ...props }: Omit<ComponentProps<typeof Text>, 'slot' | 'render' | 'children'> & {
|
|
294
|
+
children?: ValidationMessageChildren;
|
|
295
|
+
} & StyleProps): import("react").JSX.Element | null;
|
|
296
296
|
export {};
|
|
297
|
-
//# sourceMappingURL=index.d.ts.map
|