@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,12 +1,11 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import type { UseStepsProps } from '@ark-ui/react/steps';
|
|
3
3
|
import { Steps } from '@ark-ui/react/steps';
|
|
4
|
-
import type { ReactElement } from 'react';
|
|
5
4
|
export declare function useSteps(props: UseStepsProps): import("@ark-ui/react/steps").UseStepsReturn;
|
|
6
5
|
export { useStepsContext } from '@ark-ui/react/steps';
|
|
7
6
|
export { useStepsItemContext } from '@ark-ui/react/steps';
|
|
8
7
|
/**
|
|
9
|
-
* Root owns the active step. Keep each Item in List with its index, and match Content indices to those items.
|
|
8
|
+
* Root owns the active step. Keep each Item in List with its index, and match Content indices to those items. NextButton/PreviousButton navigate between steps; pass asChild to give their behavior to your own buttons instead. Indicator reflects progress automatically; CompletedContent is shown after the last step.
|
|
10
9
|
*
|
|
11
10
|
* @example Complete composition
|
|
12
11
|
* import { Button, Stepper } from '@central-ui/react'
|
|
@@ -35,16 +34,12 @@ export { useStepsItemContext } from '@ark-ui/react/steps';
|
|
|
35
34
|
* <Stepper.Content index={1}>Check everything.</Stepper.Content>
|
|
36
35
|
* <Stepper.CompletedContent>Done.</Stepper.CompletedContent>
|
|
37
36
|
* <div className="flex gap-2">
|
|
38
|
-
* <Stepper.
|
|
39
|
-
*
|
|
40
|
-
* Previous
|
|
41
|
-
* </Button.default>
|
|
42
|
-
* </Stepper.PreviousHandler>
|
|
43
|
-
* <Stepper.NextHandler>
|
|
37
|
+
* <Stepper.PreviousButton>Previous</Stepper.PreviousButton>
|
|
38
|
+
* <Stepper.NextButton asChild>
|
|
44
39
|
* <Button.default variant="primary" size="small">
|
|
45
40
|
* Next
|
|
46
41
|
* </Button.default>
|
|
47
|
-
* </Stepper.
|
|
42
|
+
* </Stepper.NextButton>
|
|
48
43
|
* </div>
|
|
49
44
|
* </div>
|
|
50
45
|
* </div>
|
|
@@ -61,16 +56,10 @@ export { useStepsItemContext } from '@ark-ui/react/steps';
|
|
|
61
56
|
* </Stepper.Root>
|
|
62
57
|
*/
|
|
63
58
|
export declare function Root({ children, className, orientation, ...props }: Omit<Steps.RootProps, 'asChild'>): import("react").JSX.Element;
|
|
64
|
-
/**
|
|
65
|
-
export declare function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}): import("react").JSX.Element;
|
|
69
|
-
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
70
|
-
export declare function PreviousHandler({ children, ...props }: Omit<Steps.PrevTriggerProps, 'asChild' | 'children'> & {
|
|
71
|
-
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
72
|
-
children: ReactElement;
|
|
73
|
-
}): import("react").JSX.Element;
|
|
59
|
+
/** Moves to the next step. Pass asChild to give this behavior to your own button, like a "Continue" Button; it keeps the state data attributes but none of this part's styling. */
|
|
60
|
+
export declare function NextButton({ asChild, disableStyle, ...props }: Steps.NextTriggerProps & StyleProps): import("react").JSX.Element;
|
|
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
|
+
export declare function PreviousButton({ asChild, disableStyle, ...props }: Steps.PrevTriggerProps & StyleProps): import("react").JSX.Element;
|
|
74
63
|
export declare function List({ disableStyle, className, ...props }: Steps.ListProps & StyleProps): import("react").JSX.Element;
|
|
75
64
|
export declare function Item({ disableStyle, className, ...props }: Steps.ItemProps & StyleProps): import("react").JSX.Element;
|
|
76
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. */
|
|
@@ -79,4 +68,3 @@ export declare function Separator({ disableStyle, className, ...props }: Steps.S
|
|
|
79
68
|
export declare function Content({ disableStyle, className, ...props }: Steps.ContentProps & StyleProps): import("react").JSX.Element;
|
|
80
69
|
export declare function CompletedContent({ disableStyle, className, ...props }: Steps.CompletedContentProps & StyleProps): import("react").JSX.Element;
|
|
81
70
|
export declare function OpenButton({ disableStyle, className, ...props }: Steps.TriggerProps & StyleProps): import("react").JSX.Element;
|
|
82
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { asChildStyleAttributes } from "../../utils/asChild.js";
|
|
2
3
|
import { Steps, useSteps as useArkSteps } from '@ark-ui/react/steps';
|
|
3
|
-
import { Check } from
|
|
4
|
+
import { Check } from "../../utils/icons.js";
|
|
4
5
|
// Creates a controlled steps state machine for RootProvider.
|
|
5
6
|
export function useSteps(props) {
|
|
6
7
|
return useArkSteps({ orientation: 'vertical', ...props });
|
|
@@ -10,7 +11,7 @@ export { useStepsContext } from '@ark-ui/react/steps';
|
|
|
10
11
|
// Reads the state of the nearest Steps item.
|
|
11
12
|
export { useStepsItemContext } from '@ark-ui/react/steps';
|
|
12
13
|
/**
|
|
13
|
-
* Root owns the active step. Keep each Item in List with its index, and match Content indices to those items.
|
|
14
|
+
* Root owns the active step. Keep each Item in List with its index, and match Content indices to those items. NextButton/PreviousButton navigate between steps; pass asChild to give their behavior to your own buttons instead. Indicator reflects progress automatically; CompletedContent is shown after the last step.
|
|
14
15
|
*
|
|
15
16
|
* @example Complete composition
|
|
16
17
|
* import { Button, Stepper } from '@central-ui/react'
|
|
@@ -39,16 +40,12 @@ export { useStepsItemContext } from '@ark-ui/react/steps';
|
|
|
39
40
|
* <Stepper.Content index={1}>Check everything.</Stepper.Content>
|
|
40
41
|
* <Stepper.CompletedContent>Done.</Stepper.CompletedContent>
|
|
41
42
|
* <div className="flex gap-2">
|
|
42
|
-
* <Stepper.
|
|
43
|
-
*
|
|
44
|
-
* Previous
|
|
45
|
-
* </Button.default>
|
|
46
|
-
* </Stepper.PreviousHandler>
|
|
47
|
-
* <Stepper.NextHandler>
|
|
43
|
+
* <Stepper.PreviousButton>Previous</Stepper.PreviousButton>
|
|
44
|
+
* <Stepper.NextButton asChild>
|
|
48
45
|
* <Button.default variant="primary" size="small">
|
|
49
46
|
* Next
|
|
50
47
|
* </Button.default>
|
|
51
|
-
* </Stepper.
|
|
48
|
+
* </Stepper.NextButton>
|
|
52
49
|
* </div>
|
|
53
50
|
* </div>
|
|
54
51
|
* </div>
|
|
@@ -65,15 +62,18 @@ export { useStepsItemContext } from '@ark-ui/react/steps';
|
|
|
65
62
|
* </Stepper.Root>
|
|
66
63
|
*/
|
|
67
64
|
export function Root({ children, className, orientation = 'vertical', ...props }) {
|
|
65
|
+
// className is left out, since Root renders no element of its own to receive it
|
|
68
66
|
return (_jsx(Steps.Root, { ...props, orientation: orientation, asChild: true, children: _jsx(_Fragment, { children: children }) }));
|
|
69
67
|
}
|
|
70
|
-
/**
|
|
71
|
-
export function
|
|
72
|
-
|
|
68
|
+
/** Moves to the next step. Pass asChild to give this behavior to your own button, like a "Continue" Button; it keeps the state data attributes but none of this part's styling. */
|
|
69
|
+
export function NextButton({ asChild, disableStyle, ...props }) {
|
|
70
|
+
const styleAttributes = asChildStyleAttributes({ asChild, component: 'stepper-nextbutton', disableStyle });
|
|
71
|
+
return _jsx(Steps.NextTrigger, { ...props, asChild: asChild, ...styleAttributes });
|
|
73
72
|
}
|
|
74
|
-
/**
|
|
75
|
-
export function
|
|
76
|
-
|
|
73
|
+
/** 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. */
|
|
74
|
+
export function PreviousButton({ asChild, disableStyle, ...props }) {
|
|
75
|
+
const styleAttributes = asChildStyleAttributes({ asChild, component: 'stepper-previousbutton', disableStyle });
|
|
76
|
+
return _jsx(Steps.PrevTrigger, { ...props, asChild: asChild, ...styleAttributes });
|
|
77
77
|
}
|
|
78
78
|
export function List({ disableStyle, className, ...props }) {
|
|
79
79
|
return (_jsx(Steps.List, { "data-component": "stepper-list", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
@@ -97,4 +97,3 @@ export function CompletedContent({ disableStyle, className, ...props }) {
|
|
|
97
97
|
export function OpenButton({ disableStyle, className, ...props }) {
|
|
98
98
|
return (_jsx(Steps.Trigger, { "data-component": "stepper-openbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
99
99
|
}
|
|
100
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
3
|
-
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
4
|
+
import type { ValidationProps } from '../../types/Validation.ts';
|
|
5
|
+
import type { ValidationMessageChildren } from '../../utils/Validation.ts';
|
|
4
6
|
type CoreKeys = 'checked' | 'defaultChecked' | 'onCheckedChange' | 'disabled' | 'readOnly' | 'required' | 'name' | 'value' | 'uncheckedValue' | 'form' | 'id' | 'inputRef';
|
|
5
|
-
export type RootProps = Pick<BaseSwitch.Root.Props, CoreKeys> & {
|
|
7
|
+
export type RootProps = Pick<BaseSwitch.Root.Props, CoreKeys> & ValidationProps & {
|
|
6
8
|
children: ReactNode;
|
|
7
|
-
/** Choose the visual tone. This does not validate data or show/hide feedback messages. */
|
|
8
|
-
tone?: 'neutral' | 'valid' | 'invalid';
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* 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.
|
|
@@ -37,7 +37,7 @@ export type RootProps = Pick<BaseSwitch.Root.Props, CoreKeys> & {
|
|
|
37
37
|
* </Switch.Container>
|
|
38
38
|
* </Switch.Root>
|
|
39
39
|
*/
|
|
40
|
-
export declare function Root({ children,
|
|
40
|
+
export declare function Root({ children, validation, checked, defaultChecked, onCheckedChange, id, ...props }: RootProps): import("react").JSX.Element;
|
|
41
41
|
export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
42
42
|
export declare const Button: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SwitchRootProps, "className" | "render" | "nativeButton" | CoreKeys> & {
|
|
43
43
|
className?: string;
|
|
@@ -49,9 +49,11 @@ export declare const Indicator: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
49
49
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
50
50
|
export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
51
51
|
export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
53
|
+
children?: ValidationMessageChildren;
|
|
54
|
+
};
|
|
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 const Error: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
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 const Success: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
56
59
|
export {};
|
|
57
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
3
3
|
import { createContext, forwardRef, useContext, useEffect, useId, useState, } from 'react';
|
|
4
|
-
import {
|
|
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.
|
|
7
7
|
*
|
|
@@ -32,70 +32,86 @@ import { ToneProvider, useToneContext } from "../../utils/Tone.js";
|
|
|
32
32
|
* </Switch.Container>
|
|
33
33
|
* </Switch.Root>
|
|
34
34
|
*/
|
|
35
|
-
export function Root({ children,
|
|
36
|
-
|
|
37
|
-
const [messageIds, setMessageIds] = useState([]);
|
|
35
|
+
export function Root({ children, validation, checked, defaultChecked = false, onCheckedChange, id, ...props }) {
|
|
36
|
+
//1. Holding the checked state when nothing controls it from outside
|
|
38
37
|
const [checkedInternalState, setCheckedInternalState] = useState(defaultChecked);
|
|
38
|
+
//2. Holding the ids of Description, Error and Success, so Button announces them to screen readers through aria-describedby
|
|
39
|
+
const [messageIds, setMessageIds] = useState([]);
|
|
40
|
+
//3. Sharing Base UI's props with Button, apart from what only the parts need
|
|
41
|
+
const generatedId = useId();
|
|
39
42
|
return (_jsx(SwitchContext.Provider, { value: {
|
|
43
|
+
coreProps: {
|
|
44
|
+
...props,
|
|
45
|
+
id: id ?? generatedId,
|
|
46
|
+
checked: checked ?? checkedInternalState,
|
|
47
|
+
onCheckedChange: (next, details) => {
|
|
48
|
+
onCheckedChange?.(next, details);
|
|
49
|
+
if (!details.isCanceled)
|
|
50
|
+
setCheckedInternalState(next);
|
|
51
|
+
},
|
|
52
|
+
},
|
|
40
53
|
messageIds,
|
|
41
54
|
setMessageIds,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
checked: checked ?? checkedInternalState,
|
|
45
|
-
onCheckedChange: (next, details) => {
|
|
46
|
-
onCheckedChange?.(next, details);
|
|
47
|
-
if (!details.isCanceled)
|
|
48
|
-
setCheckedInternalState(next);
|
|
49
|
-
},
|
|
50
|
-
}, children: _jsx(ToneProvider, { value: tone, children: children }) }));
|
|
55
|
+
validation: readValidation(validation),
|
|
56
|
+
}, children: children }));
|
|
51
57
|
}
|
|
52
|
-
export const Container = forwardRef(function Container({ disableStyle, className, ...props }, ref) {
|
|
58
|
+
export const Container = /* @__PURE__ */ forwardRef(function Container({ disableStyle, className, ...props }, ref) {
|
|
53
59
|
return (_jsx("div", { ...props, ref: ref, "data-component": "switch-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
54
60
|
});
|
|
55
|
-
export const Button = forwardRef(function Button({ disableStyle, className, ...props }, ref) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
undefined, ref: ref, "data-tone": tone, "data-component": "switch-button", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
61
|
+
export const Button = /* @__PURE__ */ forwardRef(function Button({ disableStyle, className, ...props }, ref) {
|
|
62
|
+
const context = useSwitchContext();
|
|
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
|
+
undefined, ref: ref, ...validationAttributes(context.validation), "data-component": "switch-button", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
60
65
|
});
|
|
61
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. */
|
|
62
|
-
export const Indicator = forwardRef(function Indicator({ disableStyle, className, ...props }, ref) {
|
|
67
|
+
export const Indicator = /* @__PURE__ */ forwardRef(function Indicator({ disableStyle, className, ...props }, ref) {
|
|
63
68
|
return (_jsx(BaseSwitch.Thumb, { ...props, ref: ref, "data-component": "switch-indicator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
64
69
|
});
|
|
65
70
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
66
|
-
export const Label = forwardRef(function Label({ disableStyle, className, ...props }, ref) {
|
|
71
|
+
export const Label = /* @__PURE__ */ forwardRef(function Label({ disableStyle, className, ...props }, ref) {
|
|
67
72
|
const context = useSwitchContext();
|
|
68
|
-
return (_jsx("label", { ...props, ref: ref, htmlFor: context.id, "data-disabled": context.disabled ? '' : undefined, "data-component": "switch-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
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 }));
|
|
69
74
|
});
|
|
70
|
-
export const Description = forwardRef(function Description({ disableStyle, className, id, ...props }, ref) {
|
|
75
|
+
export const Description = /* @__PURE__ */ forwardRef(function Description({ disableStyle, className, id, ...props }, ref) {
|
|
71
76
|
const messageId = useMessageId(id);
|
|
72
77
|
return (_jsx("div", { id: messageId, ...props, ref: ref, "data-component": "switch-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
73
78
|
});
|
|
74
|
-
/**
|
|
75
|
-
export const Error = forwardRef(function Error({
|
|
76
|
-
const
|
|
77
|
-
|
|
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 const Error = /* @__PURE__ */ forwardRef(function Error({ children, ...props }, ref) {
|
|
81
|
+
const context = useSwitchContext();
|
|
82
|
+
const content = validationMessageContent(context.validation, 'error', children);
|
|
83
|
+
if (content === undefined)
|
|
84
|
+
return null;
|
|
85
|
+
return _jsx(Message, { ...props, ref: ref, role: "alert", component: "switch-error", children: content });
|
|
78
86
|
});
|
|
79
|
-
/**
|
|
80
|
-
export const Success = forwardRef(function Success({
|
|
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 const Success = /* @__PURE__ */ forwardRef(function Success({ children, ...props }, ref) {
|
|
89
|
+
const context = useSwitchContext();
|
|
90
|
+
const content = validationMessageContent(context.validation, 'success', children);
|
|
91
|
+
if (content === undefined)
|
|
92
|
+
return null;
|
|
93
|
+
return _jsx(Message, { ...props, ref: ref, role: "status", component: "switch-success", children: content });
|
|
94
|
+
});
|
|
95
|
+
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the switch
|
|
96
|
+
const Message = /* @__PURE__ */ forwardRef(function Message({ disableStyle, className, id, component, ...props }, ref) {
|
|
81
97
|
const messageId = useMessageId(id);
|
|
82
|
-
return
|
|
98
|
+
return _jsx("div", { "aria-atomic": "true", ...props, id: messageId, ref: ref, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
83
99
|
});
|
|
84
|
-
const SwitchContext = createContext(null);
|
|
100
|
+
const SwitchContext = /* @__PURE__ */ createContext(null);
|
|
85
101
|
function useSwitchContext() {
|
|
86
102
|
const context = useContext(SwitchContext);
|
|
87
103
|
if (!context)
|
|
88
104
|
throw new globalThis.Error('Switch parts must be inside Switch.Root');
|
|
89
105
|
return context;
|
|
90
106
|
}
|
|
107
|
+
// Registering a message part's id in Button's aria-describedby while the part is mounted
|
|
91
108
|
function useMessageId(id) {
|
|
92
109
|
const generatedId = useId();
|
|
93
110
|
const messageId = id ?? generatedId;
|
|
94
|
-
const
|
|
111
|
+
const context = useSwitchContext();
|
|
95
112
|
useEffect(() => {
|
|
96
|
-
setMessageIds((current) => [...current, messageId]);
|
|
97
|
-
return () => setMessageIds((current) => current.filter((value) => value !== messageId));
|
|
98
|
-
}, [messageId, setMessageIds]);
|
|
113
|
+
context.setMessageIds((current) => [...current, messageId]);
|
|
114
|
+
return () => context.setMessageIds((current) => current.filter((value) => value !== messageId));
|
|
115
|
+
}, [messageId, context.setMessageIds]);
|
|
99
116
|
return messageId;
|
|
100
117
|
}
|
|
101
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -94,8 +94,9 @@ export declare function Head({ disableStyle, className, ...props }: ComponentPro
|
|
|
94
94
|
export declare const Body: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLTableSectionElement> & HTMLAttributes<HTMLTableSectionElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
95
95
|
export declare const Row: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLTableRowElement> & HTMLAttributes<HTMLTableRowElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
96
96
|
export declare function HeadCell({ disableStyle, className, ...props }: ComponentProps<'th'> & StyleProps): import("react").JSX.Element;
|
|
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. */
|
|
97
98
|
export declare function Cell({ disableStyle, className, ...props }: ComponentProps<'td'> & StyleProps): import("react").JSX.Element;
|
|
98
|
-
export declare function Empty({ disableStyle, className,
|
|
99
|
+
export declare function Empty({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
99
100
|
export declare function EmptyBody({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
100
101
|
export declare function EmptyTitle({ disableStyle, className, ...props }: HTMLAttributes<HTMLParagraphElement> & StyleProps): import("react").JSX.Element;
|
|
101
102
|
export declare function EmptyDescription({ disableStyle, className, ...props }: ComponentProps<'p'> & StyleProps): import("react").JSX.Element;
|
|
@@ -105,6 +106,5 @@ export declare function EmptyIcon({ disableStyle, children, className, ...props
|
|
|
105
106
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
106
107
|
children: ReactElement<ComponentProps<'svg'>>;
|
|
107
108
|
}) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
|
|
108
|
-
export declare function EmptyActionsList({ disableStyle, className,
|
|
109
|
+
export declare function EmptyActionsList({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
109
110
|
export {};
|
|
110
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, createContext, forwardRef, useContext, useEffect, useRef, useState, } from 'react';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
const PinningContext = createContext(null);
|
|
4
|
+
const PinningContext = /* @__PURE__ */ createContext(null);
|
|
5
5
|
function usePinning() {
|
|
6
6
|
return useContext(PinningContext)?.pinning ?? null;
|
|
7
7
|
}
|
|
@@ -83,15 +83,16 @@ function usePinning() {
|
|
|
83
83
|
* </Table.Root>
|
|
84
84
|
*/
|
|
85
85
|
export function Root({ pinning, children, }) {
|
|
86
|
-
const
|
|
86
|
+
const scrollEdges = useScrollEdges();
|
|
87
|
+
// Pinning only while the pinned column would otherwise scroll out of view
|
|
87
88
|
const activePinning = (() => {
|
|
88
|
-
if (pinning === 'first' && edges.passedFirst)
|
|
89
|
+
if (pinning === 'first' && scrollEdges.edges.passedFirst)
|
|
89
90
|
return 'first';
|
|
90
|
-
if (pinning === 'last' && edges.hiddenLast)
|
|
91
|
+
if (pinning === 'last' && scrollEdges.edges.hiddenLast)
|
|
91
92
|
return 'last';
|
|
92
93
|
return null;
|
|
93
94
|
})();
|
|
94
|
-
return (_jsx(PinningContext.Provider, { value: { pinning: activePinning, scrollRef, update }, children: children }));
|
|
95
|
+
return (_jsx(PinningContext.Provider, { value: { pinning: activePinning, scrollRef: scrollEdges.scrollRef, update: scrollEdges.update }, children: children }));
|
|
95
96
|
}
|
|
96
97
|
function useScrollEdges() {
|
|
97
98
|
const scrollRef = useRef(null);
|
|
@@ -104,6 +105,7 @@ function useScrollEdges() {
|
|
|
104
105
|
scrollArea.scrollLeft >
|
|
105
106
|
1,
|
|
106
107
|
};
|
|
108
|
+
// Keeping the same state when nothing changed, so scrolling doesn't re-render on every pixel
|
|
107
109
|
setEdges((current) => current.passedFirst === next.passedFirst &&
|
|
108
110
|
current.hiddenLast === next.hiddenLast
|
|
109
111
|
? current
|
|
@@ -133,9 +135,9 @@ export function SurfaceFooter({ disableStyle, className, ...props }) {
|
|
|
133
135
|
return (_jsx("div", { ...props, "data-component": "table-surfacefooter", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
134
136
|
}
|
|
135
137
|
export function ScrollArea({ disableStyle, className, onScroll, style, ...props }) {
|
|
136
|
-
const
|
|
137
|
-
return (_jsx("div", { ...props, ref: scrollRef, style: { ...style, overflowX: 'auto' }, onScroll: (event) => {
|
|
138
|
-
update(event.currentTarget);
|
|
138
|
+
const pinning = useContext(PinningContext);
|
|
139
|
+
return (_jsx("div", { ...props, ref: pinning.scrollRef, style: { ...style, overflowX: 'auto' }, onScroll: (event) => {
|
|
140
|
+
pinning.update(event.currentTarget);
|
|
139
141
|
onScroll?.(event);
|
|
140
142
|
}, "data-component": "table-scrollarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
141
143
|
}
|
|
@@ -163,22 +165,23 @@ export function Col({ disableStyle, className, ...props }) {
|
|
|
163
165
|
export function Head({ disableStyle, className, ...props }) {
|
|
164
166
|
return (_jsx("thead", { ...props, "data-slot": "table-header", "data-component": "table-head", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
165
167
|
}
|
|
166
|
-
export const Body = forwardRef(function Body({ disableStyle, className, ...props }, ref) {
|
|
168
|
+
export const Body = /* @__PURE__ */ forwardRef(function Body({ disableStyle, className, ...props }, ref) {
|
|
167
169
|
return (_jsx("tbody", { ...props, ref: ref, "data-component": "table-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
168
170
|
});
|
|
169
|
-
export const Row = forwardRef(({ disableStyle, className, ...props }, ref) => {
|
|
171
|
+
export const Row = /* @__PURE__ */ forwardRef(({ disableStyle, className, ...props }, ref) => {
|
|
170
172
|
return (_jsx("tr", { ...props, ref: ref, "data-component": "table-row", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
171
173
|
});
|
|
172
174
|
export function HeadCell({ disableStyle, className, ...props }) {
|
|
173
175
|
const pinning = usePinning();
|
|
174
176
|
return (_jsx("th", { ...props, "data-pinning": pinning, "data-component": "table-headcell", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
175
177
|
}
|
|
178
|
+
/** 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. */
|
|
176
179
|
export function Cell({ disableStyle, className, ...props }) {
|
|
177
180
|
const pinning = usePinning();
|
|
178
181
|
return (_jsx("td", { ...props, "data-pinning": pinning, "data-component": "table-cell", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
179
182
|
}
|
|
180
|
-
export function Empty({ disableStyle, className,
|
|
181
|
-
return (_jsx("div", { "data-component": "table-empty", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props
|
|
183
|
+
export function Empty({ disableStyle, className, ...props }) {
|
|
184
|
+
return (_jsx("div", { "data-component": "table-empty", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
182
185
|
}
|
|
183
186
|
export function EmptyBody({ disableStyle, className, ...props }) {
|
|
184
187
|
return (_jsx("div", { ...props, "data-component": "table-emptybody", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
@@ -195,7 +198,6 @@ export function EmptyImage({ disableStyle, className, ...props }) {
|
|
|
195
198
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
196
199
|
export function EmptyIcon({ disableStyle, children, className, ...props }) {
|
|
197
200
|
return cloneElement(children, {
|
|
198
|
-
...children.props,
|
|
199
201
|
...props,
|
|
200
202
|
...{
|
|
201
203
|
'data-component': 'table-emptyicon',
|
|
@@ -205,7 +207,6 @@ export function EmptyIcon({ disableStyle, children, className, ...props }) {
|
|
|
205
207
|
strokeWidth: props.strokeWidth ?? children.props.strokeWidth ?? 1.5,
|
|
206
208
|
});
|
|
207
209
|
}
|
|
208
|
-
export function EmptyActionsList({ disableStyle, className,
|
|
209
|
-
return (_jsx("div", { "data-component": "table-emptyactionslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props
|
|
210
|
+
export function EmptyActionsList({ disableStyle, className, ...props }) {
|
|
211
|
+
return (_jsx("div", { "data-component": "table-emptyactionslist", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
210
212
|
}
|
|
211
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
3
3
|
import type { ReactElement } from 'react';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
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.
|
|
7
7
|
*
|
|
@@ -54,9 +54,9 @@ export declare const Tab: import("react").ForwardRefExoticComponent<Omit<Omit<im
|
|
|
54
54
|
className?: string;
|
|
55
55
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
56
56
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
57
|
-
export declare const Icon: import("react").ForwardRefExoticComponent<Omit<
|
|
57
|
+
export declare const Icon: import("react").ForwardRefExoticComponent<Omit<SVGIconProps & {
|
|
58
58
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
59
|
-
children: ReactElement<
|
|
59
|
+
children: ReactElement<SVGIconProps>;
|
|
60
60
|
} & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
61
61
|
export declare const Indicator: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsIndicatorProps, "className"> & {
|
|
62
62
|
className?: string;
|
|
@@ -64,4 +64,3 @@ export declare const Indicator: import("react").ForwardRefExoticComponent<Omit<O
|
|
|
64
64
|
export declare const Content: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsPanelProps, "className"> & {
|
|
65
65
|
className?: string;
|
|
66
66
|
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
67
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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 const List = forwardRef(function List({ disableStyle, className, ...props }, ref) {
|
|
53
|
+
export const List = /* @__PURE__ */ forwardRef(function List({ disableStyle, className, ...props }, ref) {
|
|
54
54
|
return (_jsx(BaseTabs.List, { ...props, ref: ref, "data-component": "tabs-list", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
55
55
|
});
|
|
56
|
-
export const Tab = forwardRef(function Tab({ disableStyle, className, ...props }, ref) {
|
|
56
|
+
export const Tab = /* @__PURE__ */ forwardRef(function Tab({ disableStyle, className, ...props }, ref) {
|
|
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 const Icon = forwardRef(function Icon({ disableStyle, children, className, ...props }, ref) {
|
|
60
|
+
export const Icon = /* @__PURE__ */ forwardRef(function Icon({ disableStyle, children, className, ...props }, ref) {
|
|
61
61
|
return cloneElement(children, {
|
|
62
62
|
...props,
|
|
63
63
|
ref,
|
|
@@ -66,13 +66,12 @@ export const Icon = forwardRef(function Icon({ disableStyle, children, className
|
|
|
66
66
|
'data-component': 'tabs-icon',
|
|
67
67
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
68
68
|
},
|
|
69
|
-
className: twMerge(children
|
|
69
|
+
className: twMerge(children.props.className, className),
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
-
export const Indicator = forwardRef(function Indicator({ disableStyle, className, ...props }, ref) {
|
|
72
|
+
export const Indicator = /* @__PURE__ */ forwardRef(function Indicator({ disableStyle, className, ...props }, ref) {
|
|
73
73
|
return (_jsx(BaseTabs.Indicator, { ...props, ref: ref, "data-component": "tabs-indicator", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
74
74
|
});
|
|
75
|
-
export const Content = forwardRef(function Content({ disableStyle, className, ...props }, ref) {
|
|
75
|
+
export const Content = /* @__PURE__ */ forwardRef(function Content({ disableStyle, className, ...props }, ref) {
|
|
76
76
|
return (_jsx(BaseTabs.Panel, { ...props, ref: ref, "data-component": "tabs-content", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
77
77
|
});
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import { Input as BaseInput } from '@base-ui/react/input';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SVGIconProps } from '../../types/Icon.ts';
|
|
4
4
|
import type { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
5
|
+
import type { Validation } from '../../types/Validation.ts';
|
|
6
|
+
import type { ValidationMessageChildren } from '../../utils/Validation.ts';
|
|
5
7
|
export type RootProps = Pick<ComponentProps<'textarea'>, 'id' | 'name' | 'form' | 'value' | 'defaultValue' | 'disabled' | 'readOnly' | 'required'> & Pick<BaseInput.Props, 'onValueChange'> & {
|
|
6
8
|
children?: ReactNode;
|
|
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
13
|
* Keep value, name, and validation configuration on Root. Textarea is the editable control inside TextareaGroup. Optional Addon parts hold your supporting text or actions; they do not implement submission.
|
|
@@ -40,22 +42,23 @@ export type RootProps = Pick<ComponentProps<'textarea'>, 'id' | 'name' | 'form'
|
|
|
40
42
|
* )
|
|
41
43
|
* }
|
|
42
44
|
*/
|
|
43
|
-
export declare function Root({ children, id,
|
|
45
|
+
export declare function Root({ children, id, validation, value, defaultValue, onValueChange, disabled, readOnly, required, ...coreProps }: RootProps): import("react").JSX.Element;
|
|
44
46
|
export type TextareaProps = Omit<ComponentProps<'textarea'>, keyof Pick<RootProps, 'id' | 'name' | 'form' | 'value' | 'defaultValue' | 'onValueChange' | 'disabled' | 'readOnly' | 'required'>> & {
|
|
45
47
|
className?: string;
|
|
46
48
|
} & StyleProps;
|
|
47
|
-
export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<
|
|
48
|
-
className?: string;
|
|
49
|
-
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
49
|
+
export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
50
50
|
export declare const TextareaGroup: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
51
|
export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
52
52
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
53
53
|
export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "htmlFor"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
54
54
|
export declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
type MessageProps = Omit<ComponentProps<'div'>, 'children'> & StyleProps & {
|
|
56
|
+
children?: ValidationMessageChildren;
|
|
57
|
+
};
|
|
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 const Error: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
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 const Success: import("react").ForwardRefExoticComponent<Omit<MessageProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
59
62
|
export declare const Addon: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
60
63
|
/** Choose the preset appearance; this does not add action behavior. */
|
|
61
64
|
variant?: "normal" | "emphasized";
|
|
@@ -68,5 +71,5 @@ export declare function AddonIcon({ disableStyle, children, className, ...props
|
|
|
68
71
|
}) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
|
|
69
72
|
export declare const AddonButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
70
73
|
/** Built-in icon; no children needed. Use it inside its matching control. */
|
|
71
|
-
export declare const AddonLoadingIcon: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
72
|
-
|
|
74
|
+
export declare const AddonLoadingIcon: import("react").ForwardRefExoticComponent<Omit<Omit<SVGIconProps, "children"> & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
75
|
+
export {};
|