@central-ui/react 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/index.d.ts +14 -14
- package/dist/components/accordion/index.js +19 -19
- package/dist/components/autocomplete/index.d.ts +51 -47
- package/dist/components/autocomplete/index.js +57 -57
- package/dist/components/avatar/index.d.ts +7 -6
- package/dist/components/avatar/index.js +9 -9
- package/dist/components/banner/index.js +1 -1
- package/dist/components/carousel/index.d.ts +31 -11
- package/dist/components/carousel/index.js +25 -21
- package/dist/components/checkbox/index.d.ts +12 -11
- package/dist/components/checkbox/index.js +21 -21
- package/dist/components/combobox/index.d.ts +56 -56
- package/dist/components/combobox/index.js +67 -68
- package/dist/components/datepicker/index.d.ts +8 -9
- package/dist/components/datepicker/index.js +13 -13
- package/dist/components/dialog/index.d.ts +18 -18
- package/dist/components/dialog/index.js +22 -21
- package/dist/components/drawer/index.d.ts +24 -24
- package/dist/components/drawer/index.js +28 -27
- package/dist/components/exception/index.d.ts +23 -11
- package/dist/components/exception/index.js +17 -17
- package/dist/components/fileupload/index.d.ts +8 -8
- package/dist/components/input/index.d.ts +14 -14
- package/dist/components/input/index.js +27 -27
- package/dist/components/menu/index.d.ts +37 -37
- package/dist/components/menu/index.js +47 -47
- package/dist/components/numberinput/index.d.ts +22 -22
- package/dist/components/numberinput/index.js +35 -35
- package/dist/components/otpinput/index.d.ts +12 -12
- package/dist/components/otpinput/index.js +21 -21
- package/dist/components/passwordinput/index.d.ts +15 -15
- package/dist/components/passwordinput/index.js +27 -27
- package/dist/components/popover/index.d.ts +16 -16
- package/dist/components/popover/index.js +20 -19
- package/dist/components/radio/index.d.ts +12 -12
- package/dist/components/radio/index.js +25 -25
- package/dist/components/ratinginput/index.d.ts +1 -1
- package/dist/components/ratinginput/index.js +3 -3
- package/dist/components/select/index.d.ts +29 -29
- package/dist/components/select/index.js +33 -33
- package/dist/components/slider/index.d.ts +20 -20
- package/dist/components/slider/index.js +27 -27
- package/dist/components/stepper/index.d.ts +8 -7
- package/dist/components/stepper/index.js +4 -2
- package/dist/components/switch/index.d.ts +9 -9
- package/dist/components/switch/index.js +17 -17
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +16 -16
- package/dist/components/tabs/index.d.ts +10 -10
- package/dist/components/tabs/index.js +11 -11
- package/dist/components/textarea/index.d.ts +13 -13
- package/dist/components/textarea/index.js +25 -25
- package/dist/components/toast/index.d.ts +11 -11
- package/dist/components/toast/index.js +11 -11
- package/dist/components/toggle/index.d.ts +7 -7
- package/dist/components/toggle/index.js +9 -9
- package/dist/components/tooltip/index.d.ts +6 -6
- package/dist/components/tooltip/index.js +6 -7
- package/dist/components/tour/index.d.ts +2 -2
- package/dist/components/tour/index.js +5 -4
- package/dist/utils/icons.d.ts +92 -23
- package/dist/utils/icons.js +3 -3
- package/package.json +69 -69
- package/src/presets/shopify-polaris/shopify-polaris-accordion.css +28 -28
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-accordion.css +28 -28
|
@@ -40,38 +40,38 @@ export type RootProps<Value extends number | readonly number[] = number | readon
|
|
|
40
40
|
* </Slider.Track>
|
|
41
41
|
*/
|
|
42
42
|
export declare function Root<Value extends number | readonly number[]>({ children, validation, ...props }: RootProps<Value>): import("react").JSX.Element;
|
|
43
|
-
export declare
|
|
44
|
-
export declare
|
|
43
|
+
export declare function Container({ disableStyle, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
44
|
+
export declare function Label({ disableStyle, className, ref, ...props }: (Omit<BaseSlider.Label.Props, 'className' | 'render'> & {
|
|
45
45
|
className?: string;
|
|
46
|
-
} & StyleProps
|
|
47
|
-
export declare
|
|
46
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
47
|
+
export declare function Value({ disableStyle, className, ref, ...props }: (Omit<BaseSlider.Value.Props, 'className' | 'render'> & {
|
|
48
48
|
className?: string;
|
|
49
|
-
} & StyleProps
|
|
50
|
-
export declare
|
|
49
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
50
|
+
export declare function TrackGroup({ disableStyle, className, ref, ...props }: (Omit<BaseSlider.Control.Props, 'className' | 'render'> & {
|
|
51
51
|
className?: string;
|
|
52
|
-
} & StyleProps
|
|
53
|
-
export declare
|
|
52
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
53
|
+
export declare function Track({ disableStyle, className, ref, ...props }: (Omit<BaseSlider.Track.Props, 'className' | 'render'> & {
|
|
54
54
|
className?: string;
|
|
55
|
-
} & StyleProps
|
|
56
|
-
export declare
|
|
55
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
56
|
+
export declare function Indicator({ disableStyle, className, ref, ...props }: (Omit<BaseSlider.Indicator.Props, 'className' | 'render'> & {
|
|
57
57
|
className?: string;
|
|
58
|
-
} & StyleProps
|
|
59
|
-
export declare
|
|
58
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
59
|
+
export declare function DragHandle({ disableStyle, className, ref, ...props }: (Omit<BaseSlider.Thumb.Props, 'className' | 'render'> & {
|
|
60
60
|
className?: string;
|
|
61
|
-
} & StyleProps
|
|
62
|
-
export declare
|
|
61
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
62
|
+
export declare function MarksList({ disableStyle, children, className, ref, ...props }: (Omit<ComponentProps<'div'>, 'children'> & {
|
|
63
63
|
children: (value: number) => ReactNode;
|
|
64
|
-
} & StyleProps
|
|
65
|
-
export declare
|
|
64
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
65
|
+
export declare function Mark({ disableStyle, value, children, className, style, ref, ...props }: (ComponentProps<'div'> & {
|
|
66
66
|
/** Place this mark at the corresponding value within Root bounds; its position is calculated automatically. */
|
|
67
67
|
value: number;
|
|
68
|
-
} & StyleProps
|
|
69
|
-
export declare
|
|
68
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
69
|
+
export declare function Description({ disableStyle, className, id, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
70
70
|
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
71
71
|
children?: ValidationMessageChildren;
|
|
72
72
|
};
|
|
73
73
|
/** 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. */
|
|
74
|
-
export declare
|
|
74
|
+
export declare function Error({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
75
75
|
/** 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. */
|
|
76
|
-
export declare
|
|
76
|
+
export declare function Success({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
77
77
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
3
3
|
import { useDirection } from '@base-ui/react/direction-provider';
|
|
4
|
-
import { Fragment as ReactFragment, createContext, useCallback,
|
|
4
|
+
import { Fragment as ReactFragment, createContext, useCallback, useContext, useEffect, useId, useState, } from 'react';
|
|
5
5
|
import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
|
|
6
6
|
/**
|
|
7
7
|
* Configure bounds and value on Root. Keep Track inside TrackGroup, then Indicator and indexed DragHandles inside Track. One handle adjusts a single value; a range needs a handle for each end. MarksList/Mark are optional labels, not interactive handles.
|
|
@@ -42,33 +42,33 @@ export function Root({ children, validation, ...props }) {
|
|
|
42
42
|
return (_jsx(SliderContext.Provider, { value: { elementProps, state, messageIds, setMessageIds, validation: readValidation(validation) }, children: _jsx(_Fragment, { children: children }) }));
|
|
43
43
|
}, children: children }));
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export function Container({ disableStyle, ref, ...props }) {
|
|
46
46
|
const context = useSliderContext();
|
|
47
47
|
const { ref: nativeRef, ...nativeProps } = context.elementProps;
|
|
48
48
|
return (_jsx("div", { ...nativeProps, ...props, ref: useRootRef(nativeRef, ref), ...validationAttributes(context.validation), "data-component": "slider-container", "data-style-disabled": disableStyle ? '' : undefined, className: props.className }));
|
|
49
|
-
}
|
|
50
|
-
export
|
|
49
|
+
}
|
|
50
|
+
export function Label({ disableStyle, className, ref, ...props }) {
|
|
51
51
|
return (_jsx(BaseSlider.Label, { ...props, ref: ref, "data-component": "slider-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
52
|
-
}
|
|
53
|
-
export
|
|
52
|
+
}
|
|
53
|
+
export function Value({ disableStyle, className, ref, ...props }) {
|
|
54
54
|
return (_jsx(BaseSlider.Value, { ...props, ref: ref, "data-component": "slider-value", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
55
|
-
}
|
|
56
|
-
export
|
|
55
|
+
}
|
|
56
|
+
export function TrackGroup({ disableStyle, className, ref, ...props }) {
|
|
57
57
|
return (_jsx(BaseSlider.Control, { ...props, ref: ref, "data-component": "slider-trackgroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
58
|
-
}
|
|
59
|
-
export
|
|
58
|
+
}
|
|
59
|
+
export function Track({ disableStyle, className, ref, ...props }) {
|
|
60
60
|
return (_jsx(BaseSlider.Track, { ...props, ref: ref, "data-component": "slider-track", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
61
|
-
}
|
|
62
|
-
export
|
|
61
|
+
}
|
|
62
|
+
export function Indicator({ disableStyle, className, ref, ...props }) {
|
|
63
63
|
const context = useSliderContext();
|
|
64
64
|
return (_jsx(BaseSlider.Indicator, { ...props, ref: ref, ...validationAttributes(context.validation), "data-component": "slider-indicator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
65
|
-
}
|
|
66
|
-
export
|
|
65
|
+
}
|
|
66
|
+
export function DragHandle({ disableStyle, className, ref, ...props }) {
|
|
67
67
|
const context = useSliderContext();
|
|
68
68
|
return (_jsx(BaseSlider.Thumb, { ...props, ref: ref, "aria-invalid": context.validation.state === 'error' || props['aria-invalid'] || undefined, "aria-describedby": [props['aria-describedby'], ...context.messageIds].filter(Boolean).join(' ') ||
|
|
69
69
|
undefined, "data-component": "slider-draghandle", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
70
|
-
}
|
|
71
|
-
export
|
|
70
|
+
}
|
|
71
|
+
export function MarksList({ disableStyle, children, className, ref, ...props }) {
|
|
72
72
|
const context = useSliderContext();
|
|
73
73
|
const count = Math.floor(Number(((context.state.max - context.state.min) / context.state.step).toPrecision(15))) +
|
|
74
74
|
1;
|
|
@@ -76,8 +76,8 @@ export const MarksList = /* @__PURE__ */ forwardRef(function MarksList({ disable
|
|
|
76
76
|
const value = Number((context.state.min + index * context.state.step).toPrecision(15));
|
|
77
77
|
return _jsx(ReactFragment, { children: children(value) }, value);
|
|
78
78
|
}) }));
|
|
79
|
-
}
|
|
80
|
-
export
|
|
79
|
+
}
|
|
80
|
+
export function Mark({ disableStyle, value, children, className, style, ref, ...props }) {
|
|
81
81
|
const context = useSliderContext();
|
|
82
82
|
const direction = useDirection();
|
|
83
83
|
const percent = ((value - context.state.min) / (context.state.max - context.state.min)) * 100;
|
|
@@ -87,34 +87,34 @@ export const Mark = /* @__PURE__ */ forwardRef(function Mark({ disableStyle, val
|
|
|
87
87
|
: { insetInlineStart: percent + '%' }),
|
|
88
88
|
...style,
|
|
89
89
|
}, "data-component": "slider-mark", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [_jsx("span", { "data-component": "slider-mark-1", "data-orientation": context.state.orientation }), children != null && (_jsx("span", { "data-orientation": context.state.orientation, "data-component": "slider-mark-2", children: children }))] }));
|
|
90
|
-
}
|
|
91
|
-
export
|
|
90
|
+
}
|
|
91
|
+
export function Description({ disableStyle, className, id, ref, ...props }) {
|
|
92
92
|
const messageId = useMessageId(id);
|
|
93
93
|
const context = useSliderContext();
|
|
94
94
|
return (_jsx("div", { ...props, ref: ref, id: messageId, "data-disabled": context.state.disabled ? '' : undefined, ...validationAttributes(context.validation), "data-component": "slider-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
96
|
/** 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. */
|
|
97
|
-
export
|
|
97
|
+
export function Error({ children, ref, ...props }) {
|
|
98
98
|
const context = useSliderContext();
|
|
99
99
|
const content = validationMessageContent(context.validation, 'error', children);
|
|
100
100
|
if (content === undefined)
|
|
101
101
|
return null;
|
|
102
102
|
return _jsx(Message, { ...props, ref: ref, role: "alert", component: "slider-error", children: content });
|
|
103
|
-
}
|
|
103
|
+
}
|
|
104
104
|
/** 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. */
|
|
105
|
-
export
|
|
105
|
+
export function Success({ children, ref, ...props }) {
|
|
106
106
|
const context = useSliderContext();
|
|
107
107
|
const content = validationMessageContent(context.validation, 'success', children);
|
|
108
108
|
if (content === undefined)
|
|
109
109
|
return null;
|
|
110
110
|
return _jsx(Message, { ...props, ref: ref, role: "status", component: "slider-success", children: content });
|
|
111
|
-
}
|
|
111
|
+
}
|
|
112
112
|
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the slider
|
|
113
|
-
|
|
113
|
+
function Message({ disableStyle, className, id, component, ref, ...props }) {
|
|
114
114
|
const messageId = useMessageId(id);
|
|
115
115
|
const context = useSliderContext();
|
|
116
116
|
return _jsx("div", { "aria-atomic": "true", ...props, ref: ref, id: messageId, "data-disabled": context.state.disabled ? '' : undefined, ...validationAttributes(context.validation), "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
117
|
-
}
|
|
117
|
+
}
|
|
118
118
|
const SliderContext = /* @__PURE__ */ createContext(null);
|
|
119
119
|
function useSliderContext() {
|
|
120
120
|
const context = useContext(SliderContext);
|
|
@@ -60,11 +60,12 @@ export declare function Root({ children, className, orientation, ...props }: Omi
|
|
|
60
60
|
export declare function NextButton({ asChild, disableStyle, ...props }: Steps.NextTriggerProps & StyleProps): import("react").JSX.Element;
|
|
61
61
|
/** Moves to the previous step. Pass asChild to give this behavior to your own button, like a "Back" Button; it keeps the state data attributes but none of this part's styling. */
|
|
62
62
|
export declare function PreviousButton({ asChild, disableStyle, ...props }: Steps.PrevTriggerProps & StyleProps): import("react").JSX.Element;
|
|
63
|
-
export declare function List({ disableStyle, className, ...props }: Steps.ListProps & StyleProps): import("react").JSX.Element;
|
|
64
|
-
export declare function Item({ disableStyle, className, ...props }: Steps.ItemProps & StyleProps): import("react").JSX.Element;
|
|
63
|
+
export declare function List({ disableStyle, className, ...props }: Omit<Steps.ListProps, 'asChild'> & StyleProps): import("react").JSX.Element;
|
|
64
|
+
export declare function Item({ disableStyle, className, ...props }: Omit<Steps.ItemProps, 'asChild'> & StyleProps): import("react").JSX.Element;
|
|
65
65
|
/** 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. */
|
|
66
|
-
export declare function Indicator({ disableStyle, className, ...props }: Omit<Steps.IndicatorProps, 'children'> & StyleProps): import("react").JSX.Element;
|
|
67
|
-
export declare function Separator({ disableStyle, className, ...props }: Steps.SeparatorProps & StyleProps): import("react").JSX.Element;
|
|
68
|
-
export declare function Content({ disableStyle, className, ...props }: Steps.ContentProps & StyleProps): import("react").JSX.Element;
|
|
69
|
-
export declare function CompletedContent({ disableStyle, className, ...props }: Steps.CompletedContentProps & StyleProps): import("react").JSX.Element;
|
|
70
|
-
|
|
66
|
+
export declare function Indicator({ disableStyle, className, ...props }: Omit<Steps.IndicatorProps, 'asChild' | 'children'> & StyleProps): import("react").JSX.Element;
|
|
67
|
+
export declare function Separator({ disableStyle, className, ...props }: Omit<Steps.SeparatorProps, 'asChild'> & StyleProps): import("react").JSX.Element;
|
|
68
|
+
export declare function Content({ disableStyle, className, ...props }: Omit<Steps.ContentProps, 'asChild'> & StyleProps): import("react").JSX.Element;
|
|
69
|
+
export declare function CompletedContent({ disableStyle, className, ...props }: Omit<Steps.CompletedContentProps, 'asChild'> & StyleProps): import("react").JSX.Element;
|
|
70
|
+
/** Opens its Item's step. Pass asChild to give this behavior to your own button; it keeps the state data attributes but none of this part's styling. */
|
|
71
|
+
export declare function OpenButton({ asChild, disableStyle, ...props }: Steps.TriggerProps & StyleProps): import("react").JSX.Element;
|
|
@@ -94,6 +94,8 @@ export function Content({ disableStyle, className, ...props }) {
|
|
|
94
94
|
export function CompletedContent({ disableStyle, className, ...props }) {
|
|
95
95
|
return (_jsx(Steps.CompletedContent, { "data-component": "stepper-completedcontent", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
/** Opens its Item's step. Pass asChild to give this behavior to your own button; it keeps the state data attributes but none of this part's styling. */
|
|
98
|
+
export function OpenButton({ asChild, disableStyle, ...props }) {
|
|
99
|
+
const styleAttributes = asChildStyleAttributes({ asChild, component: 'stepper-openbutton', disableStyle });
|
|
100
|
+
return _jsx(Steps.Trigger, { ...props, asChild: asChild, ...styleAttributes });
|
|
99
101
|
}
|
|
@@ -38,22 +38,22 @@ export type RootProps = Pick<BaseSwitch.Root.Props, CoreKeys> & ValidationProps
|
|
|
38
38
|
* </Switch.Root>
|
|
39
39
|
*/
|
|
40
40
|
export declare function Root({ children, validation, checked, defaultChecked, onCheckedChange, id, ...props }: RootProps): import("react").JSX.Element;
|
|
41
|
-
export declare
|
|
42
|
-
export declare
|
|
41
|
+
export declare function Container({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
42
|
+
export declare function Button({ disableStyle, className, ref, ...props }: (Omit<BaseSwitch.Root.Props, CoreKeys | 'className' | 'render' | 'nativeButton'> & {
|
|
43
43
|
className?: string;
|
|
44
|
-
} & StyleProps
|
|
44
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
45
45
|
/** 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. */
|
|
46
|
-
export declare
|
|
46
|
+
export declare function Indicator({ disableStyle, className, ref, ...props }: (Omit<BaseSwitch.Thumb.Props, 'className' | 'render'> & {
|
|
47
47
|
className?: string;
|
|
48
|
-
} & StyleProps
|
|
48
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
49
49
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
50
|
-
export declare
|
|
51
|
-
export declare
|
|
50
|
+
export declare function Label({ disableStyle, className, ref, ...props }: Omit<ComponentProps<'label'>, 'htmlFor'> & StyleProps): import("react").JSX.Element;
|
|
51
|
+
export declare function Description({ disableStyle, className, id, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
52
52
|
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
53
53
|
children?: ValidationMessageChildren;
|
|
54
54
|
};
|
|
55
55
|
/** 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. */
|
|
56
|
-
export declare
|
|
56
|
+
export declare function Error({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
57
57
|
/** 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. */
|
|
58
|
-
export declare
|
|
58
|
+
export declare function Success({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
59
59
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
3
|
-
import { createContext,
|
|
3
|
+
import { createContext, useContext, useEffect, useId, useState, } from 'react';
|
|
4
4
|
import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
|
|
5
5
|
/**
|
|
6
6
|
* Keep Button, Indicator, and Label in the same Root. Indicator follows the checked state automatically; do not add a second boolean just for its position.
|
|
@@ -55,48 +55,48 @@ export function Root({ children, validation, checked, defaultChecked = false, on
|
|
|
55
55
|
validation: readValidation(validation),
|
|
56
56
|
}, children: children }));
|
|
57
57
|
}
|
|
58
|
-
export
|
|
58
|
+
export function Container({ disableStyle, className, ref, ...props }) {
|
|
59
59
|
return (_jsx("div", { ...props, ref: ref, "data-component": "switch-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
60
|
-
}
|
|
61
|
-
export
|
|
60
|
+
}
|
|
61
|
+
export function Button({ disableStyle, className, ref, ...props }) {
|
|
62
62
|
const context = useSwitchContext();
|
|
63
63
|
return (_jsx(BaseSwitch.Root, { ...props, ...context.coreProps, "aria-invalid": context.validation.state === 'error' || props['aria-invalid'] || undefined, "aria-describedby": [props['aria-describedby'], ...context.messageIds].filter(Boolean).join(' ') ||
|
|
64
64
|
undefined, ref: ref, ...validationAttributes(context.validation), "data-component": "switch-button", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
65
|
-
}
|
|
65
|
+
}
|
|
66
66
|
/** 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. */
|
|
67
|
-
export
|
|
67
|
+
export function Indicator({ disableStyle, className, ref, ...props }) {
|
|
68
68
|
return (_jsx(BaseSwitch.Thumb, { ...props, ref: ref, "data-component": "switch-indicator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
71
|
-
export
|
|
71
|
+
export function Label({ disableStyle, className, ref, ...props }) {
|
|
72
72
|
const context = useSwitchContext();
|
|
73
73
|
return (_jsx("label", { ...props, ref: ref, htmlFor: context.coreProps.id, "data-disabled": context.coreProps.disabled ? '' : undefined, "data-component": "switch-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
74
|
-
}
|
|
75
|
-
export
|
|
74
|
+
}
|
|
75
|
+
export function Description({ disableStyle, className, id, ref, ...props }) {
|
|
76
76
|
const messageId = useMessageId(id);
|
|
77
77
|
return (_jsx("div", { id: messageId, ...props, ref: ref, "data-component": "switch-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
78
|
-
}
|
|
78
|
+
}
|
|
79
79
|
/** 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. */
|
|
80
|
-
export
|
|
80
|
+
export function Error({ children, ref, ...props }) {
|
|
81
81
|
const context = useSwitchContext();
|
|
82
82
|
const content = validationMessageContent(context.validation, 'error', children);
|
|
83
83
|
if (content === undefined)
|
|
84
84
|
return null;
|
|
85
85
|
return _jsx(Message, { ...props, ref: ref, role: "alert", component: "switch-error", children: content });
|
|
86
|
-
}
|
|
86
|
+
}
|
|
87
87
|
/** 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. */
|
|
88
|
-
export
|
|
88
|
+
export function Success({ children, ref, ...props }) {
|
|
89
89
|
const context = useSwitchContext();
|
|
90
90
|
const content = validationMessageContent(context.validation, 'success', children);
|
|
91
91
|
if (content === undefined)
|
|
92
92
|
return null;
|
|
93
93
|
return _jsx(Message, { ...props, ref: ref, role: "status", component: "switch-success", children: content });
|
|
94
|
-
}
|
|
94
|
+
}
|
|
95
95
|
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the switch
|
|
96
|
-
|
|
96
|
+
function Message({ disableStyle, className, id, component, ref, ...props }) {
|
|
97
97
|
const messageId = useMessageId(id);
|
|
98
98
|
return _jsx("div", { "aria-atomic": "true", ...props, id: messageId, ref: ref, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
99
|
-
}
|
|
99
|
+
}
|
|
100
100
|
const SwitchContext = /* @__PURE__ */ createContext(null);
|
|
101
101
|
function useSwitchContext() {
|
|
102
102
|
const context = useContext(SwitchContext);
|
|
@@ -91,8 +91,8 @@ export declare function Table({ disableStyle, className, ...props }: ComponentPr
|
|
|
91
91
|
export declare function ColGroup({ disableStyle, className, ...props }: ComponentProps<'colgroup'> & StyleProps): import("react").JSX.Element;
|
|
92
92
|
export declare function Col({ disableStyle, className, ...props }: ComponentProps<'col'> & StyleProps): import("react").JSX.Element;
|
|
93
93
|
export declare function Head({ disableStyle, className, ...props }: ComponentProps<'thead'> & StyleProps): import("react").JSX.Element;
|
|
94
|
-
export declare
|
|
95
|
-
export declare
|
|
94
|
+
export declare function Body({ disableStyle, className, ref, ...props }: ComponentProps<'tbody'> & StyleProps): import("react").JSX.Element;
|
|
95
|
+
export declare function Row({ disableStyle, className, ref, ...props }: ComponentProps<'tr'> & StyleProps): import("react").JSX.Element;
|
|
96
96
|
export declare function HeadCell({ disableStyle, className, ...props }: ComponentProps<'th'> & StyleProps): import("react").JSX.Element;
|
|
97
97
|
/** Already styled as text: write plain text directly inside it, without a wrapping text element. Add your own elements only when the content needs more than plain text, like an avatar next to a name or a lighter secondary line. */
|
|
98
98
|
export declare function Cell({ disableStyle, className, ...props }: ComponentProps<'td'> & StyleProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement, createContext,
|
|
2
|
+
import { cloneElement, createContext, useContext, useEffect, useRef, useState, } from 'react';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
const PinningContext = /* @__PURE__ */ createContext(null);
|
|
5
5
|
function usePinning() {
|
|
@@ -141,17 +141,17 @@ export function ScrollArea({ disableStyle, className, onScroll, style, ...props
|
|
|
141
141
|
onScroll?.(event);
|
|
142
142
|
}, "data-component": "table-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
143
143
|
}
|
|
144
|
-
const pinningStyles = `
|
|
145
|
-
table[data-slot="table"] > :is(thead, tbody, tfoot) > tr > :is(th, td)[data-pinning="first"]:first-child {
|
|
146
|
-
position: sticky;
|
|
147
|
-
left: 0;
|
|
148
|
-
z-index: 10;
|
|
149
|
-
}
|
|
150
|
-
table[data-slot="table"] > :is(thead, tbody, tfoot) > tr > :is(th, td)[data-pinning="last"]:last-child {
|
|
151
|
-
position: sticky;
|
|
152
|
-
right: 0;
|
|
153
|
-
z-index: 10;
|
|
154
|
-
}
|
|
144
|
+
const pinningStyles = `
|
|
145
|
+
table[data-slot="table"] > :is(thead, tbody, tfoot) > tr > :is(th, td)[data-pinning="first"]:first-child {
|
|
146
|
+
position: sticky;
|
|
147
|
+
left: 0;
|
|
148
|
+
z-index: 10;
|
|
149
|
+
}
|
|
150
|
+
table[data-slot="table"] > :is(thead, tbody, tfoot) > tr > :is(th, td)[data-pinning="last"]:last-child {
|
|
151
|
+
position: sticky;
|
|
152
|
+
right: 0;
|
|
153
|
+
z-index: 10;
|
|
154
|
+
}
|
|
155
155
|
`;
|
|
156
156
|
export function Table({ disableStyle, className, ...props }) {
|
|
157
157
|
return (_jsxs(_Fragment, { children: [_jsx("style", { children: pinningStyles }), _jsx("table", { ...props, "data-slot": "table", "data-component": "table-table", "data-style-disabled": disableStyle ? '' : undefined, className: className })] }));
|
|
@@ -165,12 +165,12 @@ export function Col({ disableStyle, className, ...props }) {
|
|
|
165
165
|
export function Head({ disableStyle, className, ...props }) {
|
|
166
166
|
return (_jsx("thead", { ...props, "data-slot": "table-header", "data-component": "table-head", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
167
167
|
}
|
|
168
|
-
export
|
|
168
|
+
export function Body({ disableStyle, className, ref, ...props }) {
|
|
169
169
|
return (_jsx("tbody", { ...props, ref: ref, "data-component": "table-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
170
|
-
}
|
|
171
|
-
export
|
|
170
|
+
}
|
|
171
|
+
export function Row({ disableStyle, className, ref, ...props }) {
|
|
172
172
|
return (_jsx("tr", { ...props, ref: ref, "data-component": "table-row", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
173
|
-
}
|
|
173
|
+
}
|
|
174
174
|
export function HeadCell({ disableStyle, className, ...props }) {
|
|
175
175
|
const pinning = usePinning();
|
|
176
176
|
return (_jsx("th", { ...props, "data-pinning": pinning, "data-component": "table-headcell", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
@@ -47,20 +47,20 @@ import type { SVGIconProps } from '../../types/Icon.ts';
|
|
|
47
47
|
* </Tabs.List>
|
|
48
48
|
*/
|
|
49
49
|
export declare function Root({ children, ...props }: Omit<BaseTabs.Root.Props, 'render' | 'className'>): import("react").JSX.Element;
|
|
50
|
-
export declare
|
|
50
|
+
export declare function List({ disableStyle, className, ref, ...props }: (Omit<BaseTabs.List.Props, 'className' | 'render'> & {
|
|
51
51
|
className?: string;
|
|
52
|
-
} & StyleProps
|
|
53
|
-
export declare
|
|
52
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
53
|
+
export declare function Tab({ disableStyle, className, ref, ...props }: (Omit<BaseTabs.Tab.Props, 'className' | 'render'> & {
|
|
54
54
|
className?: string;
|
|
55
|
-
} & StyleProps
|
|
55
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
56
56
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
57
|
-
export declare
|
|
57
|
+
export declare function Icon({ disableStyle, children, className, ref, ...props }: (SVGIconProps & {
|
|
58
58
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
59
59
|
children: ReactElement<SVGIconProps>;
|
|
60
|
-
} & StyleProps,
|
|
61
|
-
export declare
|
|
60
|
+
}) & StyleProps): ReactElement<SVGIconProps, string | import("react").JSXElementConstructor<any>>;
|
|
61
|
+
export declare function Indicator({ disableStyle, className, ref, ...props }: (Omit<BaseTabs.Indicator.Props, 'className' | 'render'> & {
|
|
62
62
|
className?: string;
|
|
63
|
-
} & StyleProps
|
|
64
|
-
export declare
|
|
63
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
64
|
+
export declare function Content({ disableStyle, className, ref, ...props }: (Omit<BaseTabs.Panel.Props, 'className' | 'render'> & {
|
|
65
65
|
className?: string;
|
|
66
|
-
} & StyleProps
|
|
66
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
3
|
-
import { cloneElement
|
|
3
|
+
import { cloneElement } from 'react';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
/**
|
|
6
6
|
* Match each Tab value to a Content value in the same Root. Let Tabs handle the active panel and keyboard navigation; do not add separate visibility conditions. Indicator is optional decoration.
|
|
@@ -50,14 +50,14 @@ export function Root({ children, ...props }) {
|
|
|
50
50
|
// Native Root renders a div; the fragment preserves our wrapper-free Root contract.
|
|
51
51
|
return (_jsx(BaseTabs.Root, { ...props, render: (rootProps) => _jsx(_Fragment, { children: rootProps.children }), children: children }));
|
|
52
52
|
}
|
|
53
|
-
export
|
|
53
|
+
export function List({ disableStyle, className, ref, ...props }) {
|
|
54
54
|
return (_jsx(BaseTabs.List, { ...props, ref: ref, "data-component": "tabs-list", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
55
|
-
}
|
|
56
|
-
export
|
|
55
|
+
}
|
|
56
|
+
export function Tab({ disableStyle, className, ref, ...props }) {
|
|
57
57
|
return (_jsx(BaseTabs.Tab, { ...props, ref: ref, "data-component": "tabs-tab", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
60
|
-
export
|
|
60
|
+
export function Icon({ disableStyle, children, className, ref, ...props }) {
|
|
61
61
|
return cloneElement(children, {
|
|
62
62
|
...props,
|
|
63
63
|
ref,
|
|
@@ -68,10 +68,10 @@ export const Icon = /* @__PURE__ */ forwardRef(function Icon({ disableStyle, chi
|
|
|
68
68
|
},
|
|
69
69
|
className: twMerge(children.props.className, className),
|
|
70
70
|
});
|
|
71
|
-
}
|
|
72
|
-
export
|
|
71
|
+
}
|
|
72
|
+
export function Indicator({ disableStyle, className, ref, ...props }) {
|
|
73
73
|
return (_jsx(BaseTabs.Indicator, { ...props, ref: ref, "data-component": "tabs-indicator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
74
|
-
}
|
|
75
|
-
export
|
|
74
|
+
}
|
|
75
|
+
export function Content({ disableStyle, className, ref, ...props }) {
|
|
76
76
|
return (_jsx(BaseTabs.Panel, { ...props, ref: ref, "data-component": "tabs-content", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
77
|
-
}
|
|
77
|
+
}
|
|
@@ -46,30 +46,30 @@ export declare function Root({ children, id, validation, value, defaultValue, on
|
|
|
46
46
|
export type TextareaProps = Omit<ComponentProps<'textarea'>, keyof Pick<RootProps, 'id' | 'name' | 'form' | 'value' | 'defaultValue' | 'onValueChange' | 'disabled' | 'readOnly' | 'required'>> & {
|
|
47
47
|
className?: string;
|
|
48
48
|
} & StyleProps;
|
|
49
|
-
export declare
|
|
50
|
-
export declare
|
|
51
|
-
export declare
|
|
49
|
+
export declare function Textarea({ disableStyle, className, 'aria-describedby': describedBy, ref, ...props }: TextareaProps): import("react").JSX.Element;
|
|
50
|
+
export declare function TextareaGroup({ disableStyle, className, onClick, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
51
|
+
export declare function Container({ disableStyle, className, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
52
52
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
53
|
-
export declare
|
|
54
|
-
export declare
|
|
53
|
+
export declare function Label({ disableStyle, className, id, ref, ...props }: Omit<ComponentProps<'label'>, 'htmlFor'> & StyleProps): import("react").JSX.Element;
|
|
54
|
+
export declare function Description({ disableStyle, className, id, ref, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
55
55
|
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
56
56
|
children?: ValidationMessageChildren;
|
|
57
57
|
};
|
|
58
58
|
/** 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. */
|
|
59
|
-
export declare
|
|
59
|
+
export declare function Error({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
60
60
|
/** 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. */
|
|
61
|
-
export declare
|
|
62
|
-
export declare
|
|
61
|
+
export declare function Success({ children, ref, ...props }: MessageProps): import("react").JSX.Element | null;
|
|
62
|
+
export declare function Addon({ disableStyle, className, variant, ref, ...props }: (ComponentProps<'div'> & {
|
|
63
63
|
/** Choose the preset appearance; this does not add action behavior. */
|
|
64
|
-
variant?:
|
|
65
|
-
} & StyleProps
|
|
66
|
-
export declare
|
|
64
|
+
variant?: 'normal' | 'emphasized';
|
|
65
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
66
|
+
export declare function AddonText({ disableStyle, className, ref, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
67
67
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
68
68
|
export declare function AddonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
|
|
69
69
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
70
70
|
children: ReactElement<ComponentProps<'svg'>>;
|
|
71
71
|
}) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
|
|
72
|
-
export declare
|
|
72
|
+
export declare function AddonButton({ disableStyle, className, disabled, type, ref, ...props }: ComponentProps<'button'> & StyleProps): import("react").JSX.Element;
|
|
73
73
|
/** Built-in icon; no children needed. Use it inside its matching control. */
|
|
74
|
-
export declare
|
|
74
|
+
export declare function AddonLoadingIcon({ disableStyle, className, strokeWidth, ref, ...props }: Omit<SVGIconProps, 'children'> & StyleProps): import("react").JSX.Element;
|
|
75
75
|
export {};
|