@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
|
@@ -2,7 +2,7 @@ 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
4
|
import { createContext, useCallback, forwardRef, useContext, useEffect, useId, useState, } from 'react';
|
|
5
|
-
import {
|
|
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.
|
|
8
8
|
*
|
|
@@ -59,33 +59,36 @@ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
|
|
|
59
59
|
* }
|
|
60
60
|
* </Radio.Root>
|
|
61
61
|
*/
|
|
62
|
-
export function Root({ children,
|
|
62
|
+
export function Root({ children, validation, ...props }) {
|
|
63
|
+
// Holding the ids of the group's labels and messages, so the group announces them to screen readers
|
|
63
64
|
const [labelIds, setLabelIds] = useState([]);
|
|
64
65
|
const [messageIds, setMessageIds] = useState([]);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
const chosenValidation = readValidation(validation);
|
|
67
|
+
return (_jsx(BaseRadioGroup, { ...props, "aria-labelledby": [props['aria-labelledby'], ...labelIds].filter(Boolean).join(' ') ||
|
|
68
|
+
undefined, "aria-describedby": [props['aria-describedby'], ...messageIds].filter(Boolean).join(' ') ||
|
|
69
|
+
undefined, "aria-invalid": chosenValidation.state === 'error' || props['aria-invalid'] || undefined, render: (groupProps, state) => {
|
|
70
|
+
// Base UI's group props go to Container, which renders the group element; only its children render here
|
|
71
|
+
const { children, ...elementProps } = groupProps;
|
|
72
|
+
return (_jsx(RadioContext.Provider, { value: {
|
|
73
|
+
elementProps,
|
|
74
|
+
state,
|
|
75
|
+
messageIds,
|
|
76
|
+
setMessageIds,
|
|
77
|
+
setLabelIds,
|
|
78
|
+
validation: chosenValidation,
|
|
79
|
+
}, children: _jsx(_Fragment, { children: children }) }));
|
|
80
|
+
}, children: children }));
|
|
78
81
|
}
|
|
79
|
-
export const Container = forwardRef(function Container({ disableStyle, className, ...props }, ref) {
|
|
82
|
+
export const Container = /* @__PURE__ */ forwardRef(function Container({ disableStyle, className, ...props }, ref) {
|
|
80
83
|
return (_jsx("div", { ...props, ref: ref, "data-component": "radio-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
81
84
|
});
|
|
82
|
-
export const List = forwardRef(function List({ disableStyle, ...props }, ref) {
|
|
83
|
-
const
|
|
84
|
-
const { ref: nativeRef, ...nativeProps } = elementProps;
|
|
85
|
+
export const List = /* @__PURE__ */ forwardRef(function List({ disableStyle, ...props }, ref) {
|
|
86
|
+
const context = useRadioContext();
|
|
87
|
+
const { ref: nativeRef, ...nativeProps } = context.elementProps;
|
|
85
88
|
return (_jsx("div", { ...nativeProps, ...props, ref: useRootRef(nativeRef, ref), "data-component": "radio-list", "data-style-disabled": disableStyle ? '' : undefined, className: props.className }));
|
|
86
89
|
});
|
|
87
90
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
88
|
-
export const Label = forwardRef(function Label({ disableStyle, className, id, ...props }, ref) {
|
|
91
|
+
export const Label = /* @__PURE__ */ forwardRef(function Label({ disableStyle, className, id, ...props }, ref) {
|
|
89
92
|
const generatedId = useId();
|
|
90
93
|
const labelId = id ?? generatedId;
|
|
91
94
|
const context = useRadioContext();
|
|
@@ -120,23 +123,22 @@ export function Item({ disableStyle, children, value, disabled, readOnly, requir
|
|
|
120
123
|
setMessageIds,
|
|
121
124
|
}, children: _jsx("div", { ...props, "data-component": "radio-item", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children }) }));
|
|
122
125
|
}
|
|
123
|
-
export const ItemButton = forwardRef(function ItemButton({ disableStyle, className, ...props }, ref) {
|
|
126
|
+
export const ItemButton = /* @__PURE__ */ forwardRef(function ItemButton({ disableStyle, className, ...props }, ref) {
|
|
124
127
|
const item = useItemContext();
|
|
125
128
|
const group = useRadioContext();
|
|
126
|
-
const tone = useToneContext();
|
|
127
129
|
return (_jsx(BaseRadio.Root, { ...props, ...item.coreProps, ref: ref, "aria-describedby": [props['aria-describedby'], ...group.messageIds, ...item.messageIds]
|
|
128
130
|
.filter(Boolean)
|
|
129
|
-
.join(' ') || undefined, "aria-invalid":
|
|
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 })) }));
|
|
130
132
|
});
|
|
131
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. */
|
|
132
|
-
export const ItemIndicator = forwardRef(function ItemIndicator({ disableStyle, children, className, ...props }, ref) {
|
|
134
|
+
export const ItemIndicator = /* @__PURE__ */ forwardRef(function ItemIndicator({ disableStyle, children, className, ...props }, ref) {
|
|
133
135
|
return (_jsx(BaseRadio.Indicator, { ...props, ref: ref, "data-component": "radio-itemindicator", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children }));
|
|
134
136
|
});
|
|
135
|
-
export const ItemLabel = forwardRef(function ItemLabel({ disableStyle, className, ...props }, ref) {
|
|
137
|
+
export const ItemLabel = /* @__PURE__ */ forwardRef(function ItemLabel({ disableStyle, className, ...props }, ref) {
|
|
136
138
|
const item = useItemContext();
|
|
137
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 }));
|
|
138
140
|
});
|
|
139
|
-
export const ItemDescription = forwardRef(function ItemDescription({ disableStyle, className, id, ...props }, ref) {
|
|
141
|
+
export const ItemDescription = /* @__PURE__ */ forwardRef(function ItemDescription({ disableStyle, className, id, ...props }, ref) {
|
|
140
142
|
const generatedId = useId();
|
|
141
143
|
const messageId = id ?? generatedId;
|
|
142
144
|
const item = useItemContext();
|
|
@@ -146,87 +148,94 @@ export const ItemDescription = forwardRef(function ItemDescription({ disableStyl
|
|
|
146
148
|
}, [messageId, item.setMessageIds]);
|
|
147
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 }));
|
|
148
150
|
});
|
|
149
|
-
export const Description = forwardRef(function Description({ disableStyle, className, id, ...props }, ref) {
|
|
151
|
+
export const Description = /* @__PURE__ */ forwardRef(function Description({ disableStyle, className, id, ...props }, ref) {
|
|
150
152
|
const messageId = useMessageId(id);
|
|
151
153
|
const context = useRadioContext();
|
|
152
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 }));
|
|
153
155
|
});
|
|
154
|
-
/**
|
|
155
|
-
export const Error = forwardRef(function Error({
|
|
156
|
-
const
|
|
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 const Error = /* @__PURE__ */ forwardRef(function Error({ children, ...props }, ref) {
|
|
158
|
+
const context = useRadioContext();
|
|
159
|
+
const content = validationMessageContent(context.validation, 'error', children);
|
|
160
|
+
if (content === undefined)
|
|
161
|
+
return null;
|
|
162
|
+
return (_jsx(Message, { ...props, ref: ref, role: "alert", component: "radio-error", children: content }));
|
|
163
|
+
});
|
|
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 const Success = /* @__PURE__ */ forwardRef(function Success({ children, ...props }, ref) {
|
|
157
166
|
const context = useRadioContext();
|
|
158
|
-
|
|
167
|
+
const content = validationMessageContent(context.validation, 'success', children);
|
|
168
|
+
if (content === undefined)
|
|
169
|
+
return null;
|
|
170
|
+
return (_jsx(Message, { ...props, ref: ref, role: "status", component: "radio-success", children: content }));
|
|
159
171
|
});
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the group
|
|
173
|
+
const Message = /* @__PURE__ */ forwardRef(function Message({ disableStyle, className, id, component, ...props }, ref) {
|
|
162
174
|
const messageId = useMessageId(id);
|
|
163
175
|
const context = useRadioContext();
|
|
164
|
-
return (_jsx("div", {
|
|
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 }));
|
|
165
177
|
});
|
|
166
|
-
const RadioContext = createContext(null);
|
|
178
|
+
const RadioContext = /* @__PURE__ */ createContext(null);
|
|
167
179
|
function useRadioContext() {
|
|
168
180
|
const context = useContext(RadioContext);
|
|
169
181
|
if (!context)
|
|
170
182
|
throw new globalThis.Error('Radio parts must be inside Radio.Root');
|
|
171
183
|
return context;
|
|
172
184
|
}
|
|
173
|
-
const ItemContext = createContext(null);
|
|
185
|
+
const ItemContext = /* @__PURE__ */ createContext(null);
|
|
174
186
|
function useItemContext() {
|
|
175
187
|
const context = useContext(ItemContext);
|
|
176
188
|
if (!context)
|
|
177
189
|
throw new globalThis.Error('Radio item parts must be inside Radio.Item');
|
|
178
190
|
return context;
|
|
179
191
|
}
|
|
180
|
-
|
|
181
|
-
|
|
192
|
+
// Rendered by Base UI as the radio element, it reports Base UI's live state back to the item's mirror
|
|
193
|
+
const RadioButtonSurface = /* @__PURE__ */ forwardRef(function RadioButtonSurface({ state, ...props }, ref) {
|
|
194
|
+
const context = useItemContext();
|
|
182
195
|
useEffect(() => {
|
|
183
|
-
setState({
|
|
196
|
+
context.setState({
|
|
184
197
|
checked: state.checked,
|
|
185
198
|
disabled: state.disabled,
|
|
186
199
|
readOnly: state.readOnly,
|
|
187
200
|
required: state.required,
|
|
188
201
|
});
|
|
189
|
-
}, [state.checked, state.disabled, state.readOnly, state.required, setState]);
|
|
202
|
+
}, [state.checked, state.disabled, state.readOnly, state.required, context.setState]);
|
|
190
203
|
return _jsx("span", { ...props, ref: ref });
|
|
191
204
|
});
|
|
205
|
+
// Registering a message part's id in the group's and buttons' aria-describedby while the part is mounted
|
|
192
206
|
function useMessageId(id) {
|
|
193
207
|
const generatedId = useId();
|
|
194
208
|
const messageId = id ?? generatedId;
|
|
195
|
-
const
|
|
209
|
+
const context = useRadioContext();
|
|
196
210
|
useEffect(() => {
|
|
197
|
-
setMessageIds((current) => [...current, messageId]);
|
|
198
|
-
return () => setMessageIds((current) => current.filter((value) => value !== messageId));
|
|
199
|
-
}, [messageId, setMessageIds]);
|
|
211
|
+
context.setMessageIds((current) => [...current, messageId]);
|
|
212
|
+
return () => context.setMessageIds((current) => current.filter((value) => value !== messageId));
|
|
213
|
+
}, [messageId, context.setMessageIds]);
|
|
200
214
|
return messageId;
|
|
201
215
|
}
|
|
216
|
+
// Merging Base UI's ref with the consumer's one onto the same element
|
|
202
217
|
function useRootRef(nativeRef, forwardedRef) {
|
|
203
218
|
return useCallback((element) => {
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (typeof
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
else if (typeof forwardedRef === 'function')
|
|
226
|
-
forwardedRef(null);
|
|
227
|
-
else if (forwardedRef)
|
|
228
|
-
forwardedRef.current = null;
|
|
229
|
-
};
|
|
219
|
+
const refs = [nativeRef, forwardedRef];
|
|
220
|
+
//1. Setting both refs, keeping the cleanups that callback refs may return
|
|
221
|
+
const cleanups = refs.map((ref) => {
|
|
222
|
+
if (typeof ref === 'function')
|
|
223
|
+
return ref(element);
|
|
224
|
+
if (ref)
|
|
225
|
+
ref.current = element;
|
|
226
|
+
return undefined;
|
|
227
|
+
});
|
|
228
|
+
//2. Returning a cleanup only when a ref asked for one, since React then stops calling refs with null itself
|
|
229
|
+
if (!cleanups.some((cleanup) => typeof cleanup === 'function'))
|
|
230
|
+
return;
|
|
231
|
+
return () => refs.forEach((ref, index) => {
|
|
232
|
+
const cleanup = cleanups[index];
|
|
233
|
+
if (typeof cleanup === 'function')
|
|
234
|
+
return cleanup();
|
|
235
|
+
if (typeof ref === 'function')
|
|
236
|
+
return ref(null);
|
|
237
|
+
if (ref)
|
|
238
|
+
ref.current = null;
|
|
239
|
+
});
|
|
230
240
|
}, [nativeRef, forwardedRef]);
|
|
231
241
|
}
|
|
232
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import { type RatingGroupControlProps, type RatingGroupItemProps, type RatingGroupLabelProps, type RatingGroupRootProps } from '@ark-ui/react/rating-group';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
4
4
|
import type { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
5
|
+
import type { Validation } from '../../types/Validation.ts';
|
|
6
|
+
import type { ValidationMessageChildren } from '../../utils/Validation.ts';
|
|
5
7
|
/**
|
|
6
8
|
* 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.
|
|
7
9
|
*
|
|
@@ -34,9 +36,9 @@ import type { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
|
34
36
|
* }
|
|
35
37
|
* </RatingInput.Root>
|
|
36
38
|
*/
|
|
37
|
-
export declare function Root({ children,
|
|
38
|
-
/**
|
|
39
|
-
|
|
39
|
+
export declare function Root({ children, validation, ...props }: Omit<RatingGroupRootProps, 'asChild'> & {
|
|
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
|
+
validation?: Validation;
|
|
40
42
|
}): import("react").JSX.Element;
|
|
41
43
|
export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
42
44
|
export declare function Label({ disableStyle, className, ...props }: Omit<RatingGroupLabelProps, 'asChild'> & StyleProps): import("react").JSX.Element;
|
|
@@ -50,10 +52,13 @@ export declare function StarButton({ disableStyle, children, className, ...props
|
|
|
50
52
|
children: ReactElement;
|
|
51
53
|
}) & StyleProps): import("react").JSX.Element;
|
|
52
54
|
/** Built-in icon; no children needed. Use it inside its matching control. */
|
|
53
|
-
export declare function StarIcon({ disableStyle, className, strokeWidth, style, ...props }: Omit<
|
|
55
|
+
export declare function StarIcon({ disableStyle, className, strokeWidth, style, ...props }: Omit<SVGIconProps, 'children'> & StyleProps): import("react").JSX.Element;
|
|
54
56
|
export declare function Description({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
58
|
+
children?: ValidationMessageChildren;
|
|
59
|
+
};
|
|
60
|
+
/** 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. */
|
|
61
|
+
export declare function Error({ children, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
62
|
+
/** 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. */
|
|
63
|
+
export declare function Success({ children, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
64
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
import { Star as DefaultStarIcon } from
|
|
4
|
-
import { cloneElement, forwardRef, useId, Fragment } from 'react';
|
|
5
|
-
import {
|
|
3
|
+
import { Star as DefaultStarIcon } from "../../utils/icons.js";
|
|
4
|
+
import { cloneElement, createContext, forwardRef, useContext, useId, Fragment } from 'react';
|
|
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.
|
|
8
8
|
*
|
|
@@ -35,13 +35,13 @@ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
|
|
|
35
35
|
* }
|
|
36
36
|
* </RatingInput.Root>
|
|
37
37
|
*/
|
|
38
|
-
export function Root({ children,
|
|
38
|
+
export function Root({ children, validation, ...props }) {
|
|
39
39
|
const rating = useRatingGroup(props);
|
|
40
|
-
return (_jsx(
|
|
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 const Container = forwardRef(({ disableStyle, children, className, ...props }, ref) => {
|
|
43
|
-
const
|
|
44
|
-
return (_jsxs("div", { ...props, ref: ref,
|
|
42
|
+
export const Container = /* @__PURE__ */ forwardRef(({ disableStyle, children, className, ...props }, ref) => {
|
|
43
|
+
const root = useRootPropsContext();
|
|
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 }));
|
|
@@ -52,16 +52,16 @@ export function StarsList({ disableStyle, className, children, ...props }) {
|
|
|
52
52
|
return (_jsx(RatingGroup.Control, { ...props, "data-component": "ratinginput-starslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: context.items.map((index) => (_jsx(Fragment, { children: children(index) }, index))) }));
|
|
53
53
|
}
|
|
54
54
|
export function StarButton({ disableStyle, children, className, ...props }) {
|
|
55
|
-
const
|
|
55
|
+
const root = useRootPropsContext();
|
|
56
56
|
const rating = useRatingGroupContext();
|
|
57
57
|
const input = rating.getHiddenInputProps();
|
|
58
|
-
return (_jsx(RatingGroup.Item, { ...props, "
|
|
58
|
+
return (_jsx(RatingGroup.Item, { ...props, "aria-invalid": root.validation.state === 'error' || props['aria-invalid'] || undefined, ...validationAttributes(root.validation), "data-component": "ratinginput-starbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(RatingGroup.ItemContext, { children: ({ highlighted, half, checked }) => cloneElement(children, {
|
|
59
59
|
'data-highlighted': highlighted ? '' : undefined,
|
|
60
60
|
'data-half': half ? '' : undefined,
|
|
61
61
|
'data-checked': checked ? '' : undefined,
|
|
62
62
|
'data-disabled': input.disabled ? '' : undefined,
|
|
63
63
|
'data-readonly': input.readOnly ? '' : undefined,
|
|
64
|
-
|
|
64
|
+
...validationAttributes(root.validation),
|
|
65
65
|
'aria-hidden': true,
|
|
66
66
|
}) }) }));
|
|
67
67
|
}
|
|
@@ -77,12 +77,32 @@ export function StarIcon({ disableStyle, className, strokeWidth, style, ...props
|
|
|
77
77
|
export function Description({ disableStyle, className, ...props }) {
|
|
78
78
|
return (_jsx("div", { ...props, "data-component": "ratinginput-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
export function Error({
|
|
82
|
-
|
|
80
|
+
/** 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. */
|
|
81
|
+
export function Error({ children, ...props }) {
|
|
82
|
+
const root = useRootPropsContext();
|
|
83
|
+
const content = validationMessageContent(root.validation, 'error', children);
|
|
84
|
+
if (content === undefined)
|
|
85
|
+
return null;
|
|
86
|
+
return _jsx(Message, { ...props, role: "alert", component: "ratinginput-error", children: content });
|
|
83
87
|
}
|
|
84
|
-
/**
|
|
85
|
-
export function Success({
|
|
86
|
-
|
|
88
|
+
/** 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. */
|
|
89
|
+
export function Success({ children, ...props }) {
|
|
90
|
+
const root = useRootPropsContext();
|
|
91
|
+
const content = validationMessageContent(root.validation, 'success', children);
|
|
92
|
+
if (content === undefined)
|
|
93
|
+
return null;
|
|
94
|
+
return _jsx(Message, { ...props, role: "status", component: "ratinginput-success", children: content });
|
|
95
|
+
}
|
|
96
|
+
// The shared body of Error and Success, mounted only while they show
|
|
97
|
+
function Message({ disableStyle, className, component, ...props }) {
|
|
98
|
+
const root = useRootPropsContext();
|
|
99
|
+
return _jsx("div", { "aria-atomic": "true", ...props, ...validationAttributes(root.validation), "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
100
|
+
}
|
|
101
|
+
// Root's own props shared with the parts, since Ark's rating context only carries the rating state
|
|
102
|
+
const RootPropsContext = /* @__PURE__ */ createContext(null);
|
|
103
|
+
function useRootPropsContext() {
|
|
104
|
+
const context = useContext(RootPropsContext);
|
|
105
|
+
if (!context)
|
|
106
|
+
throw new globalThis.Error('RatingInput parts must be inside RatingInput.Root');
|
|
107
|
+
return context;
|
|
87
108
|
}
|
|
88
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
|
+
import type { AsChildProps } from '../../utils/asChild.ts';
|
|
2
3
|
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
3
|
-
import type {
|
|
4
|
-
import type { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
5
|
+
import type { ComponentProps, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
6
|
+
import type { Validation } from '../../types/Validation.ts';
|
|
7
|
+
import type { ValidationMessageChildren } from '../../utils/Validation.ts';
|
|
5
8
|
export type ItemShape = {
|
|
6
9
|
/** Used automatically for the displayed selection. No label accessor needed. */
|
|
7
10
|
label: string;
|
|
@@ -23,8 +26,8 @@ export type ItemType<T extends readonly GroupShape[]> = GroupType<T>['items'][nu
|
|
|
23
26
|
export type RootProps<T extends readonly GroupShape[], Multiple extends boolean | undefined = false> = Omit<BaseSelect.Root.Props<ItemType<T>, Multiple>, 'items' | 'itemToStringLabel' | 'itemToStringValue' | 'isItemEqualToValue'> & {
|
|
24
27
|
/** Prepare groups before passing items. For a flat-looking list, use one group with label: empty string and omit GroupLabel; keep Group and ItemsList. */
|
|
25
28
|
items: T;
|
|
26
|
-
/**
|
|
27
|
-
|
|
29
|
+
/** The field's validation state, with an optional message: `'error'` styles it as invalid, `['error', 'Pick a size']` also shows that message in Error. Same for `'success'` and Success. Omit it for a neutral field. */
|
|
30
|
+
validation?: Validation;
|
|
28
31
|
};
|
|
29
32
|
/**
|
|
30
33
|
* 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.
|
|
@@ -111,7 +114,7 @@ export type RootProps<T extends readonly GroupShape[], Multiple extends boolean
|
|
|
111
114
|
* }
|
|
112
115
|
* </Select.Root>
|
|
113
116
|
*/
|
|
114
|
-
export declare function Root<T extends readonly GroupShape[], Multiple extends boolean | undefined = false>({ children, items, id,
|
|
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;
|
|
115
118
|
export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
116
119
|
export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectLabelProps, "className"> & {
|
|
117
120
|
className?: string;
|
|
@@ -123,57 +126,48 @@ export type OpenButtonValueProps<Value extends ItemShape | ItemShape[] | null =
|
|
|
123
126
|
children?: ReactNode | ((value: Value) => ReactNode);
|
|
124
127
|
} & StyleProps;
|
|
125
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. */
|
|
126
|
-
export declare function OpenButtonValue<Value extends ItemShape | ItemShape[] | null = ItemShape | ItemShape[] | null>({ disableStyle, className, ...props }: OpenButtonValueProps<Value>
|
|
129
|
+
export declare function OpenButtonValue<Value extends ItemShape | ItemShape[] | null = ItemShape | ItemShape[] | null>({ disableStyle, className, ...props }: OpenButtonValueProps<Value>): import("react").JSX.Element;
|
|
127
130
|
export type ScrollAreaProps = Omit<ComponentPropsWithRef<typeof BaseSelect.List>, 'children' | 'className'> & {
|
|
128
131
|
className?: string;
|
|
129
132
|
children?: ReactNode;
|
|
130
133
|
} & StyleProps;
|
|
131
|
-
export declare const ScrollArea: import("react").ForwardRefExoticComponent<Omit<
|
|
132
|
-
className?: string;
|
|
133
|
-
children?: ReactNode;
|
|
134
|
-
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
134
|
+
export declare const ScrollArea: import("react").ForwardRefExoticComponent<Omit<ScrollAreaProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
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);
|
|
138
138
|
} & StyleProps;
|
|
139
139
|
/** Let this list render the groups. Manually annotate its children callback with Select.GroupType<typeof rootItems>, using the SAME items variable passed to Root. */
|
|
140
|
-
export declare function GroupsList<Group extends GroupShape = GroupShape>({ disableStyle, children, className,
|
|
140
|
+
export declare function GroupsList<Group extends GroupShape = GroupShape>({ disableStyle, children, className, ...props }: GroupsListProps<Group>): import("react").JSX.Element;
|
|
141
141
|
export type ItemsListProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<'div'>, 'children' | 'className'> & {
|
|
142
142
|
className?: string;
|
|
143
143
|
/** Return Item with ItemText and ItemIndicator. Manually annotate item with Select.ItemType<typeof rootItems>, using the exact items variable passed to Root. */
|
|
144
144
|
children: (item: Item, index: number) => ReactNode;
|
|
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
|
-
export declare function ItemsList<Item extends ItemShape = ItemShape>({ disableStyle, children, className, ...props }: ItemsListProps<Item>
|
|
147
|
+
export declare function ItemsList<Item extends ItemShape = ItemShape>({ disableStyle, children, className, ...props }: ItemsListProps<Item>): import("react").JSX.Element;
|
|
148
148
|
export type GroupProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Group>, 'className'> & {
|
|
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
|
-
/** Prepare groups before passing items. For a flat-looking list, use one group with label: empty string and omit GroupLabel; keep Group and ItemsList. */
|
|
152
151
|
items: readonly Item[];
|
|
153
152
|
} & StyleProps;
|
|
154
|
-
export declare function Group<Item extends ItemShape = ItemShape>({ disableStyle, items, children, className, ...props }: GroupProps<Item>
|
|
153
|
+
export declare function Group<Item extends ItemShape = ItemShape>({ disableStyle, items, children, className, ...props }: GroupProps<Item>): import("react").JSX.Element;
|
|
155
154
|
export type ItemProps<Item extends ItemShape = ItemShape> = Omit<ComponentPropsWithRef<typeof BaseSelect.Item>, 'value' | 'className'> & {
|
|
156
155
|
className?: string;
|
|
157
156
|
/** Pass the item from ItemsList; matching uses its value identifier, so recreated item objects still select correctly. */
|
|
158
157
|
/** Pass the item from ItemsList; matching uses its value identifier, so recreated item objects still select correctly. */
|
|
159
158
|
value: Item;
|
|
160
159
|
} & StyleProps;
|
|
161
|
-
export declare function Item<Item extends ItemShape = ItemShape>({ disableStyle, className, ...props }: ItemProps<Item>
|
|
160
|
+
export declare function Item<Item extends ItemShape = ItemShape>({ disableStyle, className, ...props }: ItemProps<Item>): import("react").JSX.Element;
|
|
162
161
|
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseSelect.Popup>, 'className'> & {
|
|
163
162
|
className?: string;
|
|
164
163
|
} & Pick<BaseSelect.Portal.Props, 'container'> & Pick<BaseSelect.Positioner.Props, 'anchor' | 'positionMethod' | 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'arrowPadding' | 'disableAnchorTracking' | 'collisionAvoidance' | 'alignItemWithTrigger'> & StyleProps;
|
|
165
164
|
/** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
|
|
166
|
-
export declare function Popup({ disableStyle, container, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, alignItemWithTrigger, className, style, ...props }: PopupProps
|
|
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;
|
|
167
166
|
export declare const Arrow: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "children" | "dangerouslySetInnerHTML"> & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
168
|
-
/**
|
|
169
|
-
export declare const
|
|
170
|
-
className?: string;
|
|
171
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
172
|
-
children: ReactElement;
|
|
173
|
-
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
174
|
-
export declare const OpenButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectTriggerProps, "className"> & {
|
|
167
|
+
/** Opens the select. Pass asChild to make your own button the trigger instead, like a "Sort" Button. */
|
|
168
|
+
export declare const OpenButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectTriggerProps, "className" | "render"> & {
|
|
175
169
|
className?: string;
|
|
176
|
-
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
170
|
+
} & AsChildProps & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
177
171
|
/** Omit for an unlabeled/flat-looking group; keep the Group wrapper. Supply the heading only when grouping should be visible. */
|
|
178
172
|
export declare const GroupLabel: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectGroupLabelProps, "className"> & {
|
|
179
173
|
className?: string;
|
|
@@ -185,16 +179,19 @@ export declare const ItemText: import("react").ForwardRefExoticComponent<Omit<Om
|
|
|
185
179
|
className?: string;
|
|
186
180
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
187
181
|
export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
182
|
+
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
183
|
+
children?: ValidationMessageChildren;
|
|
184
|
+
};
|
|
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 const Error: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
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 const Success: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
192
189
|
/** Built-in icon; no children needed. Use it inside its matching control. */
|
|
193
|
-
export declare const OpenButtonIcon: import("react").ForwardRefExoticComponent<Omit<
|
|
190
|
+
export declare const OpenButtonIcon: import("react").ForwardRefExoticComponent<Omit<SVGIconProps & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
194
191
|
/** 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. */
|
|
195
|
-
export declare const ItemIndicator: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
192
|
+
export declare const ItemIndicator: import("react").ForwardRefExoticComponent<Omit<Omit<SVGIconProps, "children"> & Pick<import("@base-ui/react").SelectItemIndicatorProps, "keepMounted"> & {
|
|
196
193
|
/** Optional replacement SVG icon. It receives this indicator's props and ref. */
|
|
197
|
-
children?: ReactElement<
|
|
194
|
+
children?: ReactElement<SVGIconProps>;
|
|
198
195
|
} & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
199
196
|
export declare const ScrollUpArrow: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectScrollUpArrowProps, "className"> & {
|
|
200
197
|
className?: string;
|
|
@@ -202,4 +199,4 @@ export declare const ScrollUpArrow: import("react").ForwardRefExoticComponent<Om
|
|
|
202
199
|
export declare const ScrollDownArrow: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectScrollDownArrowProps, "className"> & {
|
|
203
200
|
className?: string;
|
|
204
201
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
205
|
-
|
|
202
|
+
export {};
|