@central-ui/react 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +49 -0
- package/README.md +1 -1
- package/dist/components/accordion/index.d.ts +7 -6
- package/dist/components/accordion/index.js +13 -10
- package/dist/components/autocomplete/index.d.ts +22 -33
- package/dist/components/autocomplete/index.js +90 -73
- package/dist/components/avatar/index.d.ts +1 -2
- package/dist/components/avatar/index.js +6 -6
- package/dist/components/badge/index.d.ts +0 -1
- package/dist/components/badge/index.js +2 -2
- package/dist/components/banner/index.d.ts +1 -1
- package/dist/components/banner/index.js +24 -26
- package/dist/components/barchart/index.d.ts +106 -0
- package/dist/components/barchart/index.js +122 -0
- package/dist/components/breadcrumb/index.d.ts +0 -1
- package/dist/components/breadcrumb/index.js +6 -7
- package/dist/components/button/index.d.ts +3 -4
- package/dist/components/button/index.js +11 -12
- package/dist/components/card/index.d.ts +0 -1
- package/dist/components/card/index.js +0 -1
- package/dist/components/checkbox/index.d.ts +13 -11
- package/dist/components/checkbox/index.js +59 -39
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js +2 -3
- package/dist/components/combobox/index.d.ts +32 -44
- package/dist/components/combobox/index.js +112 -88
- package/dist/components/datepicker/index.d.ts +54 -55
- package/dist/components/datepicker/index.js +105 -100
- package/dist/components/dialog/index.d.ts +17 -30
- package/dist/components/dialog/index.js +25 -26
- package/dist/components/divider/index.d.ts +0 -1
- package/dist/components/divider/index.js +0 -1
- package/dist/components/donutchart/index.d.ts +100 -0
- package/dist/components/donutchart/index.js +178 -0
- package/dist/components/drawer/index.d.ts +15 -24
- package/dist/components/drawer/index.js +45 -47
- package/dist/components/empty/index.d.ts +1 -2
- package/dist/components/empty/index.js +2 -4
- package/dist/components/fileupload/index.d.ts +4 -9
- package/dist/components/fileupload/index.js +27 -39
- package/dist/components/form/index.d.ts +0 -1
- package/dist/components/form/index.js +0 -1
- package/dist/components/horizontalbarchart/index.d.ts +120 -0
- package/dist/components/horizontalbarchart/index.js +193 -0
- package/dist/components/input/index.d.ts +23 -23
- package/dist/components/input/index.js +86 -115
- package/dist/components/linechart/index.d.ts +114 -0
- package/dist/components/linechart/index.js +139 -0
- package/dist/components/menu/index.d.ts +14 -16
- package/dist/components/menu/index.js +56 -53
- package/dist/components/metric/index.d.ts +0 -1
- package/dist/components/metric/index.js +0 -1
- package/dist/components/numberinput/index.d.ts +16 -23
- package/dist/components/numberinput/index.js +55 -68
- package/dist/components/otpinput/index.d.ts +14 -9
- package/dist/components/otpinput/index.js +32 -25
- package/dist/components/page/index.d.ts +0 -1
- package/dist/components/page/index.js +2 -4
- package/dist/components/passwordinput/index.d.ts +16 -13
- package/dist/components/passwordinput/index.js +47 -56
- package/dist/components/popover/index.d.ts +21 -19
- package/dist/components/popover/index.js +40 -21
- package/dist/components/radio/index.d.ts +13 -9
- package/dist/components/radio/index.js +80 -71
- package/dist/components/ratinginput/index.d.ts +15 -10
- package/dist/components/ratinginput/index.js +38 -18
- package/dist/components/select/index.d.ts +29 -32
- package/dist/components/select/index.js +79 -50
- package/dist/components/skeleton/index.d.ts +0 -1
- package/dist/components/skeleton/index.js +0 -1
- package/dist/components/slider/index.d.ts +14 -9
- package/dist/components/slider/index.js +75 -74
- package/dist/components/spinner/index.d.ts +2 -3
- package/dist/components/spinner/index.js +2 -3
- package/dist/components/splitter/index.d.ts +1 -2
- package/dist/components/splitter/index.js +6 -7
- package/dist/components/stepper/index.d.ts +8 -20
- package/dist/components/stepper/index.js +15 -16
- package/dist/components/switch/index.d.ts +12 -10
- package/dist/components/switch/index.js +52 -36
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/table/index.js +17 -16
- package/dist/components/tabs/index.d.ts +3 -4
- package/dist/components/tabs/index.js +6 -7
- package/dist/components/textarea/index.d.ts +16 -13
- package/dist/components/textarea/index.js +46 -55
- package/dist/components/textlink/index.d.ts +3 -1
- package/dist/components/textlink/index.js +4 -1
- package/dist/components/toast/index.d.ts +8 -14
- package/dist/components/toast/index.js +54 -54
- package/dist/components/toggle/index.d.ts +5 -6
- package/dist/components/toggle/index.js +19 -26
- package/dist/components/tooltip/index.d.ts +11 -13
- package/dist/components/tooltip/index.js +14 -11
- package/dist/components/tour/index.d.ts +154 -0
- package/dist/components/tour/index.js +280 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -1
- package/dist/types/Icon.d.ts +10 -0
- package/dist/types/Icon.js +1 -0
- package/dist/types/Style.d.ts +0 -1
- package/dist/types/Style.js +0 -1
- package/dist/types/Tone.d.ts +0 -1
- package/dist/types/Tone.js +0 -1
- package/dist/types/Validation.d.ts +12 -0
- package/dist/types/Validation.js +1 -0
- package/dist/utils/ArkStateToDataAttributes.d.ts +0 -1
- package/dist/utils/ArkStateToDataAttributes.js +3 -2
- package/dist/utils/Tone.d.ts +0 -1
- package/dist/utils/Tone.js +1 -2
- package/dist/utils/Validation.d.ts +14 -0
- package/dist/utils/Validation.js +23 -0
- package/dist/utils/asChild.d.ts +41 -0
- package/dist/utils/asChild.js +15 -0
- package/dist/utils/icons.d.ts +24 -0
- package/dist/utils/icons.js +160 -0
- package/dist/utils/useForwardClickToInput.d.ts +0 -1
- package/dist/utils/useForwardClickToInput.js +4 -3
- package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts +0 -1
- package/dist/utils/virtualization/useVirtualizedAutocomplete.js +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.d.ts +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.js +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.d.ts +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.js +0 -1
- package/package.json +12 -11
- package/src/presets/shopify-polaris/shopify-polaris-autocomplete.css +15 -6
- package/src/presets/shopify-polaris/shopify-polaris-badge.css +1 -1
- package/src/presets/shopify-polaris/shopify-polaris-barchart.css +64 -0
- package/src/presets/shopify-polaris/shopify-polaris-checkbox.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-chip.css +3 -3
- package/src/presets/shopify-polaris/shopify-polaris-combobox.css +19 -10
- package/src/presets/shopify-polaris/shopify-polaris-datepicker.css +20 -11
- package/src/presets/shopify-polaris/shopify-polaris-dialog.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-donutchart.css +172 -0
- package/src/presets/shopify-polaris/shopify-polaris-drawer.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-fileupload.css +1 -1
- package/src/presets/shopify-polaris/shopify-polaris-horizontalbarchart.css +60 -0
- package/src/presets/shopify-polaris/shopify-polaris-input.css +14 -5
- package/src/presets/shopify-polaris/shopify-polaris-linechart.css +68 -0
- package/src/presets/shopify-polaris/shopify-polaris-menu.css +47 -6
- package/src/presets/shopify-polaris/shopify-polaris-numberinput.css +16 -7
- package/src/presets/shopify-polaris/shopify-polaris-otpinput.css +3 -3
- package/src/presets/shopify-polaris/shopify-polaris-passwordinput.css +14 -5
- package/src/presets/shopify-polaris/shopify-polaris-popover.css +29 -0
- package/src/presets/shopify-polaris/shopify-polaris-radio.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-ratinginput.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-select.css +15 -6
- package/src/presets/shopify-polaris/shopify-polaris-slider.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-stepper.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-switch.css +2 -2
- package/src/presets/shopify-polaris/shopify-polaris-textarea.css +13 -4
- package/src/presets/shopify-polaris/shopify-polaris-toast.css +43 -0
- package/src/presets/shopify-polaris/shopify-polaris-tooltip.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris.css +5 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-autocomplete.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-barchart.css +64 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-checkbox.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-combobox.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-datepicker.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-dialog.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-donutchart.css +172 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-drawer.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-fileupload.css +1 -1
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-horizontalbarchart.css +60 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-input.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-linechart.css +68 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-menu.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-numberinput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-otpinput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-passwordinput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-popover.css +22 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-radio.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-ratinginput.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-slider.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-stepper.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-switch.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textarea.css +2 -2
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tooltip.css +9 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +4 -0
- package/dist/components/accordion/index.d.ts.map +0 -1
- package/dist/components/accordion/index.js.map +0 -1
- package/dist/components/autocomplete/index.d.ts.map +0 -1
- package/dist/components/autocomplete/index.js.map +0 -1
- package/dist/components/avatar/index.d.ts.map +0 -1
- package/dist/components/avatar/index.js.map +0 -1
- package/dist/components/badge/index.d.ts.map +0 -1
- package/dist/components/badge/index.js.map +0 -1
- package/dist/components/banner/index.d.ts.map +0 -1
- package/dist/components/banner/index.js.map +0 -1
- package/dist/components/breadcrumb/index.d.ts.map +0 -1
- package/dist/components/breadcrumb/index.js.map +0 -1
- package/dist/components/button/index.d.ts.map +0 -1
- package/dist/components/button/index.js.map +0 -1
- package/dist/components/card/index.d.ts.map +0 -1
- package/dist/components/card/index.js.map +0 -1
- package/dist/components/checkbox/index.d.ts.map +0 -1
- package/dist/components/checkbox/index.js.map +0 -1
- package/dist/components/chip/index.d.ts.map +0 -1
- package/dist/components/chip/index.js.map +0 -1
- package/dist/components/combobox/index.d.ts.map +0 -1
- package/dist/components/combobox/index.js.map +0 -1
- package/dist/components/datepicker/index.d.ts.map +0 -1
- package/dist/components/datepicker/index.js.map +0 -1
- package/dist/components/dialog/index.d.ts.map +0 -1
- package/dist/components/dialog/index.js.map +0 -1
- package/dist/components/divider/index.d.ts.map +0 -1
- package/dist/components/divider/index.js.map +0 -1
- package/dist/components/drawer/index.d.ts.map +0 -1
- package/dist/components/drawer/index.js.map +0 -1
- package/dist/components/empty/index.d.ts.map +0 -1
- package/dist/components/empty/index.js.map +0 -1
- package/dist/components/fileupload/index.d.ts.map +0 -1
- package/dist/components/fileupload/index.js.map +0 -1
- package/dist/components/form/index.d.ts.map +0 -1
- package/dist/components/form/index.js.map +0 -1
- package/dist/components/input/index.d.ts.map +0 -1
- package/dist/components/input/index.js.map +0 -1
- package/dist/components/menu/index.d.ts.map +0 -1
- package/dist/components/menu/index.js.map +0 -1
- package/dist/components/metric/index.d.ts.map +0 -1
- package/dist/components/metric/index.js.map +0 -1
- package/dist/components/numberinput/index.d.ts.map +0 -1
- package/dist/components/numberinput/index.js.map +0 -1
- package/dist/components/otpinput/index.d.ts.map +0 -1
- package/dist/components/otpinput/index.js.map +0 -1
- package/dist/components/page/index.d.ts.map +0 -1
- package/dist/components/page/index.js.map +0 -1
- package/dist/components/passwordinput/index.d.ts.map +0 -1
- package/dist/components/passwordinput/index.js.map +0 -1
- package/dist/components/popover/index.d.ts.map +0 -1
- package/dist/components/popover/index.js.map +0 -1
- package/dist/components/radio/index.d.ts.map +0 -1
- package/dist/components/radio/index.js.map +0 -1
- package/dist/components/ratinginput/index.d.ts.map +0 -1
- package/dist/components/ratinginput/index.js.map +0 -1
- package/dist/components/select/index.d.ts.map +0 -1
- package/dist/components/select/index.js.map +0 -1
- package/dist/components/skeleton/index.d.ts.map +0 -1
- package/dist/components/skeleton/index.js.map +0 -1
- package/dist/components/slider/index.d.ts.map +0 -1
- package/dist/components/slider/index.js.map +0 -1
- package/dist/components/spinner/index.d.ts.map +0 -1
- package/dist/components/spinner/index.js.map +0 -1
- package/dist/components/splitter/index.d.ts.map +0 -1
- package/dist/components/splitter/index.js.map +0 -1
- package/dist/components/stepper/index.d.ts.map +0 -1
- package/dist/components/stepper/index.js.map +0 -1
- package/dist/components/switch/index.d.ts.map +0 -1
- package/dist/components/switch/index.js.map +0 -1
- package/dist/components/table/index.d.ts.map +0 -1
- package/dist/components/table/index.js.map +0 -1
- package/dist/components/tabs/index.d.ts.map +0 -1
- package/dist/components/tabs/index.js.map +0 -1
- package/dist/components/textarea/index.d.ts.map +0 -1
- package/dist/components/textarea/index.js.map +0 -1
- package/dist/components/textlink/index.d.ts.map +0 -1
- package/dist/components/textlink/index.js.map +0 -1
- package/dist/components/toast/index.d.ts.map +0 -1
- package/dist/components/toast/index.js.map +0 -1
- package/dist/components/toggle/index.d.ts.map +0 -1
- package/dist/components/toggle/index.js.map +0 -1
- package/dist/components/tooltip/index.d.ts.map +0 -1
- package/dist/components/tooltip/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/Style.d.ts.map +0 -1
- package/dist/types/Style.js.map +0 -1
- package/dist/types/Tone.d.ts.map +0 -1
- package/dist/types/Tone.js.map +0 -1
- package/dist/utils/ArkStateToDataAttributes.d.ts.map +0 -1
- package/dist/utils/ArkStateToDataAttributes.js.map +0 -1
- package/dist/utils/Tone.d.ts.map +0 -1
- package/dist/utils/Tone.js.map +0 -1
- package/dist/utils/useForwardClickToInput.d.ts.map +0 -1
- package/dist/utils/useForwardClickToInput.js.map +0 -1
- package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts.map +0 -1
- package/dist/utils/virtualization/useVirtualizedAutocomplete.js.map +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.d.ts.map +0 -1
- package/dist/utils/virtualization/useVirtualizedCombobox.js.map +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.d.ts.map +0 -1
- package/dist/utils/virtualization/useVirtualizedTable.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
|
+
import type { AsChildProps } from '../../utils/asChild.ts';
|
|
2
3
|
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
3
4
|
import type { ComponentPropsWithRef, ReactElement } from 'react';
|
|
4
|
-
import type {
|
|
5
|
+
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* OpenButton renders its own trigger button; pass asChild to give its behavior to your own button instead. Popup already includes its portal and positioner. Choose ButtonItem for actions and LinkItem for navigation. Use the matching checkbox/radio composition for persistent choices; submenu parts belong in SubMenuRoot.
|
|
7
8
|
*
|
|
8
9
|
* @example Complete composition
|
|
9
10
|
* import { Button, Menu } from '@central-ui/react'
|
|
@@ -11,9 +12,9 @@ import type { LucideProps } from 'lucide-react';
|
|
|
11
12
|
* function Example() {
|
|
12
13
|
* return (
|
|
13
14
|
* <Menu.Root>
|
|
14
|
-
* <Menu.
|
|
15
|
+
* <Menu.OpenButton asChild>
|
|
15
16
|
* <Button.default variant="primary">Options</Button.default>
|
|
16
|
-
* </Menu.
|
|
17
|
+
* </Menu.OpenButton>
|
|
17
18
|
* <Menu.Popup>
|
|
18
19
|
* <Menu.Group>
|
|
19
20
|
* <Menu.GroupLabel>Account</Menu.GroupLabel>
|
|
@@ -47,19 +48,17 @@ import type { LucideProps } from 'lucide-react';
|
|
|
47
48
|
* </Menu.Popup>
|
|
48
49
|
* </Menu.SubMenuRoot>
|
|
49
50
|
*/
|
|
50
|
-
export declare
|
|
51
|
+
export declare function Root<Payload = unknown>(props: BaseMenu.Root.Props<Payload>): import("react").JSX.Element;
|
|
51
52
|
export declare const SubMenuRoot: typeof BaseMenu.SubmenuRoot;
|
|
52
|
-
/**
|
|
53
|
-
export declare const
|
|
53
|
+
/** Opens the menu. Pass asChild to give this behavior to your own element, like your app's Button. */
|
|
54
|
+
export declare const OpenButton: import("react").ForwardRefExoticComponent<Omit<Omit<BaseMenu.Trigger.Props<unknown>, "className" | "render"> & {
|
|
54
55
|
className?: string;
|
|
55
|
-
|
|
56
|
-
children: ReactElement;
|
|
57
|
-
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
56
|
+
} & AsChildProps & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
58
57
|
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseMenu.Popup>, 'className'> & {
|
|
59
58
|
className?: string;
|
|
60
59
|
} & Pick<BaseMenu.Portal.Props, 'container' | 'keepMounted'> & Pick<BaseMenu.Positioner.Props, 'anchor' | 'positionMethod' | 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'arrowPadding' | 'disableAnchorTracking' | 'collisionAvoidance'> & StyleProps;
|
|
61
60
|
/** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
|
|
62
|
-
export declare function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }: PopupProps
|
|
61
|
+
export declare function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }: PopupProps): import("react").JSX.Element;
|
|
63
62
|
export declare const Arrow: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").SVGProps<SVGSVGElement>, "children" | "dangerouslySetInnerHTML"> & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
64
63
|
export declare const Group: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ContextMenuGroupProps, "className"> & {
|
|
65
64
|
className?: string;
|
|
@@ -87,14 +86,14 @@ export declare const Separator: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
87
86
|
className?: string;
|
|
88
87
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
89
88
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
90
|
-
export declare const Icon: import("react").ForwardRefExoticComponent<Omit<
|
|
89
|
+
export declare const Icon: import("react").ForwardRefExoticComponent<Omit<SVGIconProps & {
|
|
91
90
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
92
|
-
children: ReactElement<
|
|
91
|
+
children: ReactElement<SVGIconProps>;
|
|
93
92
|
} & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
94
93
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
95
|
-
export declare const SubMenuOpenButtonIcon: import("react").ForwardRefExoticComponent<Omit<
|
|
94
|
+
export declare const SubMenuOpenButtonIcon: import("react").ForwardRefExoticComponent<Omit<SVGIconProps & {
|
|
96
95
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
97
|
-
children?: ReactElement<
|
|
96
|
+
children?: ReactElement<SVGIconProps>;
|
|
98
97
|
} & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
99
98
|
export declare const CheckboxContainer: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
100
99
|
export declare const CheckboxButtonItem: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ContextMenuCheckboxItemProps, "className" | "id" | "render" | "nativeButton"> & {
|
|
@@ -112,4 +111,3 @@ export declare const RadioLabel: import("react").ForwardRefExoticComponent<Omit<
|
|
|
112
111
|
export declare const RadioItemIndicator: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").ContextMenuRadioItemIndicatorProps, "className"> & {
|
|
113
112
|
className?: string;
|
|
114
113
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
115
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { asChildRendering } from "../../utils/asChild.js";
|
|
2
3
|
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
3
4
|
import { cloneElement, createContext, forwardRef, useContext, useEffect, useId, useState, } from 'react';
|
|
4
5
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import { Check, ChevronRight } from
|
|
6
|
+
import { Check, ChevronRight } from "../../utils/icons.js";
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* OpenButton renders its own trigger button; pass asChild to give its behavior to your own button instead. Popup already includes its portal and positioner. Choose ButtonItem for actions and LinkItem for navigation. Use the matching checkbox/radio composition for persistent choices; submenu parts belong in SubMenuRoot.
|
|
8
9
|
*
|
|
9
10
|
* @example Complete composition
|
|
10
11
|
* import { Button, Menu } from '@central-ui/react'
|
|
@@ -12,9 +13,9 @@ import { Check, ChevronRight } from 'lucide-react';
|
|
|
12
13
|
* function Example() {
|
|
13
14
|
* return (
|
|
14
15
|
* <Menu.Root>
|
|
15
|
-
* <Menu.
|
|
16
|
+
* <Menu.OpenButton asChild>
|
|
16
17
|
* <Button.default variant="primary">Options</Button.default>
|
|
17
|
-
* </Menu.
|
|
18
|
+
* </Menu.OpenButton>
|
|
18
19
|
* <Menu.Popup>
|
|
19
20
|
* <Menu.Group>
|
|
20
21
|
* <Menu.GroupLabel>Account</Menu.GroupLabel>
|
|
@@ -48,11 +49,14 @@ import { Check, ChevronRight } from 'lucide-react';
|
|
|
48
49
|
* </Menu.Popup>
|
|
49
50
|
* </Menu.SubMenuRoot>
|
|
50
51
|
*/
|
|
51
|
-
export
|
|
52
|
+
export function Root(props) {
|
|
53
|
+
return _jsx(BaseMenu.Root, { ...props });
|
|
54
|
+
}
|
|
52
55
|
export const SubMenuRoot = BaseMenu.SubmenuRoot;
|
|
53
|
-
/**
|
|
54
|
-
export const
|
|
55
|
-
|
|
56
|
+
/** Opens the menu. Pass asChild to give this behavior to your own element, like your app's Button. */
|
|
57
|
+
export const OpenButton = /* @__PURE__ */ forwardRef(function OpenButton({ asChild, disableStyle, children, ...props }, ref) {
|
|
58
|
+
const rendering = asChildRendering({ asChild, children, component: 'menu-openbutton', disableStyle });
|
|
59
|
+
return _jsx(BaseMenu.Trigger, { ...props, ref: ref, ...rendering });
|
|
56
60
|
});
|
|
57
61
|
/** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
|
|
58
62
|
export function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side = 'bottom', sideOffset = 5, align = 'start', alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }) {
|
|
@@ -64,36 +68,36 @@ export function Popup({ disableStyle, container, keepMounted, anchor, positionMe
|
|
|
64
68
|
? (state) => ({ ...baseStyle, ...style(state) })
|
|
65
69
|
: { ...baseStyle, ...style } }) }) }));
|
|
66
70
|
}
|
|
67
|
-
export const Arrow = forwardRef(function Arrow({ disableStyle, className, style, ...props }, ref) {
|
|
71
|
+
export const Arrow = /* @__PURE__ */ forwardRef(function Arrow({ disableStyle, className, style, ...props }, ref) {
|
|
68
72
|
return (_jsxs(BaseMenu.Arrow, { style: style, render: _jsx("svg", { ...props, ref: ref, "aria-hidden": true, width: "20", height: "10", viewBox: "0 0 20 10" }), "data-component": "menu-arrow", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [_jsx("path", { d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z", "data-component": "menu-arrow-1" }), _jsx("path", { d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z", "data-component": "menu-arrow-2" }), _jsx("path", { d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z", "data-component": "menu-arrow-3" })] }));
|
|
69
73
|
});
|
|
70
|
-
export const Group = forwardRef(function Group({ disableStyle, className, ...props }, ref) {
|
|
74
|
+
export const Group = /* @__PURE__ */ forwardRef(function Group({ disableStyle, className, ...props }, ref) {
|
|
71
75
|
return (_jsx(BaseMenu.Group, { ...props, ref: ref, "data-component": "menu-group", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
72
76
|
});
|
|
73
77
|
/** Omit for an unlabeled/flat-looking group; keep the Group wrapper. Supply the heading only when grouping should be visible. */
|
|
74
|
-
export const GroupLabel = forwardRef(function GroupLabel({ disableStyle, className, ...props }, ref) {
|
|
78
|
+
export const GroupLabel = /* @__PURE__ */ forwardRef(function GroupLabel({ disableStyle, className, ...props }, ref) {
|
|
75
79
|
return (_jsx(BaseMenu.GroupLabel, { ...props, ref: ref, "data-component": "menu-grouplabel", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
76
80
|
});
|
|
77
|
-
export const ItemsList = forwardRef(function ItemsList({ disableStyle, className, ...props }, ref) {
|
|
81
|
+
export const ItemsList = /* @__PURE__ */ forwardRef(function ItemsList({ disableStyle, className, ...props }, ref) {
|
|
78
82
|
return (_jsx("div", { ...props, ref: ref, "data-component": "menu-itemslist", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
79
83
|
});
|
|
80
|
-
export const ButtonItem = forwardRef(function ButtonItem({ disableStyle, className, tone = 'neutral', ...props }, ref) {
|
|
84
|
+
export const ButtonItem = /* @__PURE__ */ forwardRef(function ButtonItem({ disableStyle, className, tone = 'neutral', ...props }, ref) {
|
|
81
85
|
return (_jsx(BaseMenu.Item, { ...props, "data-tone": tone, ref: ref, "data-component": "menu-buttonitem", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
82
86
|
});
|
|
83
|
-
export const LinkItem = forwardRef(function LinkItem({ disableStyle, className, ...props }, ref) {
|
|
87
|
+
export const LinkItem = /* @__PURE__ */ forwardRef(function LinkItem({ disableStyle, className, ...props }, ref) {
|
|
84
88
|
return (_jsx(BaseMenu.LinkItem, { ...props, ref: ref, "data-component": "menu-linkitem", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
85
89
|
});
|
|
86
|
-
export const RadioGroup = forwardRef(function RadioGroup({ disableStyle, className, ...props }, ref) {
|
|
90
|
+
export const RadioGroup = /* @__PURE__ */ forwardRef(function RadioGroup({ disableStyle, className, ...props }, ref) {
|
|
87
91
|
return (_jsx(BaseMenu.RadioGroup, { ...props, ref: ref, "data-component": "menu-radiogroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
88
92
|
});
|
|
89
|
-
export const SubMenuOpenButton = forwardRef(function SubMenuOpenButton({ disableStyle, className, ...props }, ref) {
|
|
93
|
+
export const SubMenuOpenButton = /* @__PURE__ */ forwardRef(function SubMenuOpenButton({ disableStyle, className, ...props }, ref) {
|
|
90
94
|
return (_jsx(BaseMenu.SubmenuTrigger, { ...props, ref: ref, "data-component": "menu-submenuopenbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
91
95
|
});
|
|
92
|
-
export const Separator = forwardRef(function Separator({ disableStyle, className, ...props }, ref) {
|
|
96
|
+
export const Separator = /* @__PURE__ */ forwardRef(function Separator({ disableStyle, className, ...props }, ref) {
|
|
93
97
|
return (_jsx(BaseMenu.Separator, { ...props, ref: ref, "data-component": "menu-separator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
94
98
|
});
|
|
95
99
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
96
|
-
export const Icon = forwardRef(function Icon({ disableStyle, children, className, ...props }, ref) {
|
|
100
|
+
export const Icon = /* @__PURE__ */ forwardRef(function Icon({ disableStyle, children, className, ...props }, ref) {
|
|
97
101
|
return cloneElement(children, {
|
|
98
102
|
...props,
|
|
99
103
|
ref,
|
|
@@ -102,11 +106,11 @@ export const Icon = forwardRef(function Icon({ disableStyle, children, className
|
|
|
102
106
|
'data-component': 'menu-icon',
|
|
103
107
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
104
108
|
},
|
|
105
|
-
className: twMerge(children
|
|
109
|
+
className: twMerge(children.props.className, className),
|
|
106
110
|
});
|
|
107
111
|
});
|
|
108
112
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
109
|
-
export const SubMenuOpenButtonIcon = forwardRef(function SubMenuOpenButtonIcon({ disableStyle, children, className, ...props }, ref) {
|
|
113
|
+
export const SubMenuOpenButtonIcon = /* @__PURE__ */ forwardRef(function SubMenuOpenButtonIcon({ disableStyle, children, className, ...props }, ref) {
|
|
110
114
|
return cloneElement(children ?? _jsx(ChevronRight, {}), {
|
|
111
115
|
...props,
|
|
112
116
|
ref,
|
|
@@ -118,28 +122,35 @@ export const SubMenuOpenButtonIcon = forwardRef(function SubMenuOpenButtonIcon({
|
|
|
118
122
|
className: twMerge(children?.props.className, className),
|
|
119
123
|
});
|
|
120
124
|
});
|
|
121
|
-
export const CheckboxContainer = forwardRef(function CheckboxContainer(
|
|
122
|
-
|
|
123
|
-
const [label, setLabel] = useState('');
|
|
124
|
-
const [state, setState] = useState({
|
|
125
|
-
checked: false,
|
|
126
|
-
disabled: false,
|
|
127
|
-
highlighted: false,
|
|
128
|
-
});
|
|
129
|
-
return (_jsx(CheckableContext.Provider, { value: { id, label, setLabel, state, setState }, children: _jsx("div", { ...props, ref: ref, "data-disabled": state.disabled ? '' : undefined, "data-highlighted": state.highlighted ? '' : undefined, "data-checked": state.checked ? '' : undefined, "data-component": "menu-checkboxcontainer", "data-style-disabled": disableStyle ? '' : undefined, className: className }) }));
|
|
125
|
+
export const CheckboxContainer = /* @__PURE__ */ forwardRef(function CheckboxContainer(props, ref) {
|
|
126
|
+
return _jsx(CheckableContainer, { ...props, ref: ref, component: "menu-checkboxcontainer" });
|
|
130
127
|
});
|
|
131
|
-
export const CheckboxButtonItem = forwardRef(function CheckboxButtonItem({ disableStyle, className, label, ...props }, ref) {
|
|
128
|
+
export const CheckboxButtonItem = /* @__PURE__ */ forwardRef(function CheckboxButtonItem({ disableStyle, className, label, ...props }, ref) {
|
|
132
129
|
const context = useCheckableContext();
|
|
133
130
|
return (_jsx(BaseMenu.CheckboxItem, { ...props, ref: ref, id: context.id, "aria-labelledby": context.id + '-label', label: label ?? context.label, nativeButton: true, "data-component": "menu-checkboxbuttonitem", "data-style-disabled": disableStyle ? '' : undefined, className: className, render: (buttonProps, state) => (_jsx(CheckableButtonSurface, { ...buttonProps, state: state })) }));
|
|
134
131
|
});
|
|
135
|
-
export const CheckboxLabel = forwardRef(function CheckboxLabel(
|
|
136
|
-
|
|
137
|
-
return (_jsx("label", { ...props, ref: ref, id: context.id + '-label', htmlFor: context.id, "data-disabled": context.state.disabled ? '' : undefined, "data-component": "menu-checkboxlabel", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(CheckableLabelText, { children: children }) }));
|
|
132
|
+
export const CheckboxLabel = /* @__PURE__ */ forwardRef(function CheckboxLabel(props, ref) {
|
|
133
|
+
return _jsx(CheckableLabel, { ...props, ref: ref, component: "menu-checkboxlabel" });
|
|
138
134
|
});
|
|
139
|
-
export const CheckboxItemIndicator = forwardRef(function CheckboxItemIndicator({ disableStyle, children, className, ...props }, ref) {
|
|
135
|
+
export const CheckboxItemIndicator = /* @__PURE__ */ forwardRef(function CheckboxItemIndicator({ disableStyle, children, className, ...props }, ref) {
|
|
140
136
|
return (_jsx(BaseMenu.CheckboxItemIndicator, { ...props, ref: ref, "data-component": "menu-checkboxitemindicator", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children ?? (_jsx(Check, { "aria-hidden": true, strokeWidth: 3.5, "data-component": "menu-checkboxitemindicator-1" })) }));
|
|
141
137
|
});
|
|
142
|
-
export const RadioContainer = forwardRef(function RadioContainer(
|
|
138
|
+
export const RadioContainer = /* @__PURE__ */ forwardRef(function RadioContainer(props, ref) {
|
|
139
|
+
return _jsx(CheckableContainer, { ...props, ref: ref, component: "menu-radiocontainer" });
|
|
140
|
+
});
|
|
141
|
+
export const RadioButtonItem = /* @__PURE__ */ forwardRef(function RadioButtonItem({ disableStyle, className, label, ...props }, ref) {
|
|
142
|
+
const context = useCheckableContext();
|
|
143
|
+
return (_jsx(BaseMenu.RadioItem, { ...props, ref: ref, id: context.id, "aria-labelledby": context.id + '-label', label: label ?? context.label, nativeButton: true, "data-component": "menu-radiobuttonitem", "data-style-disabled": disableStyle ? '' : undefined, className: className, render: (buttonProps, state) => (_jsx(CheckableButtonSurface, { ...buttonProps, state: state })) }));
|
|
144
|
+
});
|
|
145
|
+
export const RadioLabel = /* @__PURE__ */ forwardRef(function RadioLabel(props, ref) {
|
|
146
|
+
return _jsx(CheckableLabel, { ...props, ref: ref, component: "menu-radiolabel" });
|
|
147
|
+
});
|
|
148
|
+
export const RadioItemIndicator = /* @__PURE__ */ forwardRef(function RadioItemIndicator({ disableStyle, children, className, ...props }, ref) {
|
|
149
|
+
return (_jsx(BaseMenu.RadioItemIndicator, { ...props, ref: ref, "data-component": "menu-radioitemindicator", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children ?? _jsx("span", { "data-component": "menu-radioitemindicator-1" }) }));
|
|
150
|
+
});
|
|
151
|
+
const CheckableContext = /* @__PURE__ */ createContext(null);
|
|
152
|
+
// Shared by CheckboxContainer and RadioContainer, which only differ by their data-component name
|
|
153
|
+
const CheckableContainer = /* @__PURE__ */ forwardRef(function CheckableContainer({ disableStyle, className, component, ...props }, ref) {
|
|
143
154
|
const id = useId();
|
|
144
155
|
const [label, setLabel] = useState('');
|
|
145
156
|
const [state, setState] = useState({
|
|
@@ -147,42 +158,34 @@ export const RadioContainer = forwardRef(function RadioContainer({ disableStyle,
|
|
|
147
158
|
disabled: false,
|
|
148
159
|
highlighted: false,
|
|
149
160
|
});
|
|
150
|
-
return (_jsx(CheckableContext.Provider, { value: { id, label, setLabel, state, setState }, children: _jsx("div", { ...props, ref: ref, "data-disabled": state.disabled ? '' : undefined, "data-highlighted": state.highlighted ? '' : undefined, "data-checked": state.checked ? '' : undefined, "data-component":
|
|
151
|
-
});
|
|
152
|
-
export const RadioButtonItem = forwardRef(function RadioButtonItem({ disableStyle, className, label, ...props }, ref) {
|
|
153
|
-
const context = useCheckableContext();
|
|
154
|
-
return (_jsx(BaseMenu.RadioItem, { ...props, ref: ref, id: context.id, "aria-labelledby": context.id + '-label', label: label ?? context.label, nativeButton: true, "data-component": "menu-radiobuttonitem", "data-style-disabled": disableStyle ? '' : undefined, className: className, render: (buttonProps, state) => (_jsx(CheckableButtonSurface, { ...buttonProps, state: state })) }));
|
|
161
|
+
return (_jsx(CheckableContext.Provider, { value: { id, label, setLabel, state, setState }, children: _jsx("div", { ...props, ref: ref, "data-disabled": state.disabled ? '' : undefined, "data-highlighted": state.highlighted ? '' : undefined, "data-checked": state.checked ? '' : undefined, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className }) }));
|
|
155
162
|
});
|
|
156
|
-
|
|
163
|
+
// Shared by CheckboxLabel and RadioLabel, which only differ by their data-component name
|
|
164
|
+
const CheckableLabel = /* @__PURE__ */ forwardRef(function CheckableLabel({ disableStyle, className, children, component, ...props }, ref) {
|
|
157
165
|
const context = useCheckableContext();
|
|
158
|
-
return (_jsx("label", { ...props, ref: ref, id: context.id + '-label', htmlFor: context.id, "data-disabled": context.state.disabled ? '' : undefined, "data-component":
|
|
159
|
-
});
|
|
160
|
-
export const RadioItemIndicator = forwardRef(function RadioItemIndicator({ disableStyle, children, className, ...props }, ref) {
|
|
161
|
-
return (_jsx(BaseMenu.RadioItemIndicator, { ...props, ref: ref, "data-component": "menu-radioitemindicator", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: children ?? _jsx("span", { "data-component": "menu-radioitemindicator-1" }) }));
|
|
166
|
+
return (_jsx("label", { ...props, ref: ref, id: context.id + '-label', htmlFor: context.id, "data-disabled": context.state.disabled ? '' : undefined, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className, children: _jsx(CheckableLabelText, { children: children }) }));
|
|
162
167
|
});
|
|
163
|
-
const CheckableContext = createContext(null);
|
|
164
168
|
function useCheckableContext() {
|
|
165
169
|
const context = useContext(CheckableContext);
|
|
166
170
|
if (!context)
|
|
167
171
|
throw new Error('Menu checkable parts must be inside their Container');
|
|
168
172
|
return context;
|
|
169
173
|
}
|
|
170
|
-
const CheckableButtonSurface = forwardRef(function CheckableButtonSurface({ state, ...props }, ref) {
|
|
171
|
-
const
|
|
174
|
+
const CheckableButtonSurface = /* @__PURE__ */ forwardRef(function CheckableButtonSurface({ state, ...props }, ref) {
|
|
175
|
+
const context = useCheckableContext();
|
|
172
176
|
useEffect(() => {
|
|
173
|
-
setState({
|
|
177
|
+
context.setState({
|
|
174
178
|
checked: state.checked,
|
|
175
179
|
disabled: state.disabled,
|
|
176
180
|
highlighted: state.highlighted,
|
|
177
181
|
});
|
|
178
|
-
}, [state.checked, state.disabled, state.highlighted, setState]);
|
|
182
|
+
}, [state.checked, state.disabled, state.highlighted, context.setState]);
|
|
179
183
|
return _jsx("button", { type: "button", ...props, ref: ref });
|
|
180
184
|
});
|
|
181
185
|
function CheckableLabelText({ children }) {
|
|
182
|
-
const
|
|
186
|
+
const context = useCheckableContext();
|
|
183
187
|
return (_jsx("span", { ref: (element) => {
|
|
184
188
|
if (element)
|
|
185
|
-
setLabel(element.textContent ?? '');
|
|
189
|
+
context.setLabel(element.textContent ?? '');
|
|
186
190
|
}, children: children }));
|
|
187
191
|
}
|
|
188
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -21,4 +21,3 @@ export declare function Number({ disableStyle, children, className, ...props }:
|
|
|
21
21
|
children: number;
|
|
22
22
|
}) & StyleProps): import("react").JSX.Element;
|
|
23
23
|
export declare function Unit({ disableStyle, className, ...props }: HTMLAttributes<HTMLParagraphElement> & StyleProps): import("react").JSX.Element;
|
|
24
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -23,4 +23,3 @@ export function Number({ disableStyle, children, className, ...props }) {
|
|
|
23
23
|
export function Unit({ disableStyle, className, ...props }) {
|
|
24
24
|
return (_jsx("p", { "data-component": "metric-unit", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import { NumberField as BaseNumber } from '@base-ui/react/number-field';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
4
4
|
import type { ComponentProps, ReactElement } from 'react';
|
|
5
|
+
import type { Validation } from '../../types/Validation.ts';
|
|
6
|
+
import type { ValidationMessageChildren } from '../../utils/Validation.ts';
|
|
5
7
|
export type RootProps = Omit<BaseNumber.Root.Props, 'className' | 'render'> & {
|
|
6
8
|
className?: string;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
+
/** The field's validation state, with an optional message: `'error'` styles it as invalid, `['error', 'Email is required']` also shows that message in Error. Same for `'success'` and Success. Omit it for a neutral field. */
|
|
10
|
+
validation?: Validation;
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
11
|
-
* Configure value, bounds, and step on Root. IncrementButton and DecrementButton update the number automatically; no custom arithmetic handlers needed. Use ButtonsList to organize them beside Input
|
|
13
|
+
* Configure value, bounds, and step on Root. IncrementButton and DecrementButton update the number automatically; no custom arithmetic handlers needed. Use ButtonsList to organize them beside Input.
|
|
12
14
|
*
|
|
13
15
|
* @example Complete composition
|
|
14
16
|
* import { NumberInput } from '@central-ui/react'
|
|
@@ -44,17 +46,20 @@ export type RootProps = Omit<BaseNumber.Root.Props, 'className' | 'render'> & {
|
|
|
44
46
|
* </NumberInput.Root>
|
|
45
47
|
*/
|
|
46
48
|
export declare const Root: import("react").ForwardRefExoticComponent<Omit<RootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
-
export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldInputProps, "
|
|
49
|
+
export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldInputProps, "className" | "id" | "name" | "form" | "defaultValue" | "disabled" | "value" | "render" | "required" | "readOnly"> & {
|
|
48
50
|
className?: string;
|
|
49
51
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
50
52
|
export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
53
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
52
54
|
export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
53
55
|
export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
57
|
+
children?: ValidationMessageChildren;
|
|
58
|
+
};
|
|
59
|
+
/** 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. */
|
|
60
|
+
export declare const Error: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
61
|
+
/** 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. */
|
|
62
|
+
export declare const Success: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
58
63
|
export declare const Addon: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
59
64
|
/** Choose the preset appearance; this does not add action behavior. */
|
|
60
65
|
variant?: "normal" | "emphasized";
|
|
@@ -67,7 +72,7 @@ export declare function AddonIcon({ disableStyle, children, className, ...props
|
|
|
67
72
|
}) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
|
|
68
73
|
export declare const AddonButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
69
74
|
/** Built-in icon; no children needed. Use it inside its matching control. */
|
|
70
|
-
export declare const AddonLoadingIcon: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
75
|
+
export declare const AddonLoadingIcon: import("react").ForwardRefExoticComponent<Omit<Omit<SVGIconProps, "children"> & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
71
76
|
export declare const InputGroup: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldGroupProps, "className"> & {
|
|
72
77
|
className?: string;
|
|
73
78
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -77,12 +82,6 @@ export declare const ValueText: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
77
82
|
export declare const IncrementButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldIncrementProps, "className"> & {
|
|
78
83
|
className?: string;
|
|
79
84
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
80
|
-
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
81
|
-
export declare const IncrementHandler: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldIncrementProps, "children" | "className" | "render"> & {
|
|
82
|
-
className?: string;
|
|
83
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
84
|
-
children: ReactElement;
|
|
85
|
-
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
86
85
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
87
86
|
export declare function IncrementButtonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
|
|
88
87
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
@@ -91,15 +90,9 @@ export declare function IncrementButtonIcon({ disableStyle, children, className,
|
|
|
91
90
|
export declare const DecrementButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldDecrementProps, "className"> & {
|
|
92
91
|
className?: string;
|
|
93
92
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
94
|
-
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
95
|
-
export declare const DecrementHandler: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").NumberFieldDecrementProps, "children" | "className" | "render"> & {
|
|
96
|
-
className?: string;
|
|
97
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
98
|
-
children: ReactElement;
|
|
99
|
-
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
100
93
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
101
94
|
export declare function DecrementButtonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
|
|
102
95
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
103
96
|
children?: ReactElement<ComponentProps<'svg'>>;
|
|
104
97
|
}) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
|
|
105
|
-
|
|
98
|
+
export {};
|