@central-ui/react 0.0.0-stage → 0.1.1
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 +21 -0
- package/README.md +33 -2
- package/dist/components/accordion/index.d.ts +73 -0
- package/dist/components/accordion/index.d.ts.map +1 -0
- package/dist/components/accordion/index.js +92 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/autocomplete/index.d.ts +365 -0
- package/dist/components/autocomplete/index.d.ts.map +1 -0
- package/dist/components/autocomplete/index.js +369 -0
- package/dist/components/autocomplete/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +48 -0
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/avatar/index.js +60 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +29 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +36 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/banner/index.d.ts +71 -0
- package/dist/components/banner/index.d.ts.map +1 -0
- package/dist/components/banner/index.js +119 -0
- package/dist/components/banner/index.js.map +1 -0
- package/dist/components/breadcrumb/index.d.ts +31 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/index.js +42 -0
- package/dist/components/breadcrumb/index.js.map +1 -0
- package/dist/components/button/index.d.ts +48 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +60 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/card/index.d.ts +34 -0
- package/dist/components/card/index.d.ts.map +1 -0
- package/dist/components/card/index.js +45 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +66 -0
- package/dist/components/checkbox/index.d.ts.map +1 -0
- package/dist/components/checkbox/index.js +146 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/chip/index.d.ts +26 -0
- package/dist/components/chip/index.d.ts.map +1 -0
- package/dist/components/chip/index.js +40 -0
- package/dist/components/chip/index.js.map +1 -0
- package/dist/components/combobox/index.d.ts +427 -0
- package/dist/components/combobox/index.d.ts.map +1 -0
- package/dist/components/combobox/index.js +416 -0
- package/dist/components/combobox/index.js.map +1 -0
- package/dist/components/datepicker/index.d.ts +297 -0
- package/dist/components/datepicker/index.d.ts.map +1 -0
- package/dist/components/datepicker/index.js +507 -0
- package/dist/components/datepicker/index.js.map +1 -0
- package/dist/components/dialog/index.d.ts +88 -0
- package/dist/components/dialog/index.d.ts.map +1 -0
- package/dist/components/dialog/index.js +102 -0
- package/dist/components/dialog/index.js.map +1 -0
- package/dist/components/divider/index.d.ts +21 -0
- package/dist/components/divider/index.d.ts.map +1 -0
- package/dist/components/divider/index.js +24 -0
- package/dist/components/divider/index.js.map +1 -0
- package/dist/components/drawer/index.d.ts +99 -0
- package/dist/components/drawer/index.d.ts.map +1 -0
- package/dist/components/drawer/index.js +137 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/empty/index.d.ts +40 -0
- package/dist/components/empty/index.d.ts.map +1 -0
- package/dist/components/empty/index.js +61 -0
- package/dist/components/empty/index.js.map +1 -0
- package/dist/components/fileupload/index.d.ts +107 -0
- package/dist/components/fileupload/index.d.ts.map +1 -0
- package/dist/components/fileupload/index.js +185 -0
- package/dist/components/fileupload/index.js.map +1 -0
- package/dist/components/form/index.d.ts +34 -0
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/index.js +35 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/input/index.d.ts +85 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/input/index.js +249 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/menu/index.d.ts +115 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +188 -0
- package/dist/components/menu/index.js.map +1 -0
- package/dist/components/metric/index.d.ts +24 -0
- package/dist/components/metric/index.d.ts.map +1 -0
- package/dist/components/metric/index.js +26 -0
- package/dist/components/metric/index.js.map +1 -0
- package/dist/components/numberinput/index.d.ts +105 -0
- package/dist/components/numberinput/index.d.ts.map +1 -0
- package/dist/components/numberinput/index.js +240 -0
- package/dist/components/numberinput/index.js.map +1 -0
- package/dist/components/otpinput/index.d.ts +63 -0
- package/dist/components/otpinput/index.d.ts.map +1 -0
- package/dist/components/otpinput/index.js +133 -0
- package/dist/components/otpinput/index.js.map +1 -0
- package/dist/components/page/index.d.ts +54 -0
- package/dist/components/page/index.d.ts.map +1 -0
- package/dist/components/page/index.js +100 -0
- package/dist/components/page/index.js.map +1 -0
- package/dist/components/passwordinput/index.d.ts +88 -0
- package/dist/components/passwordinput/index.d.ts.map +1 -0
- package/dist/components/passwordinput/index.js +251 -0
- package/dist/components/passwordinput/index.js.map +1 -0
- package/dist/components/popover/index.d.ts +67 -0
- package/dist/components/popover/index.d.ts.map +1 -0
- package/dist/components/popover/index.js +76 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/radio/index.d.ts +90 -0
- package/dist/components/radio/index.d.ts.map +1 -0
- package/dist/components/radio/index.js +232 -0
- package/dist/components/radio/index.js.map +1 -0
- package/dist/components/ratinginput/index.d.ts +59 -0
- package/dist/components/ratinginput/index.d.ts.map +1 -0
- package/dist/components/ratinginput/index.js +88 -0
- package/dist/components/ratinginput/index.js.map +1 -0
- package/dist/components/select/index.d.ts +205 -0
- package/dist/components/select/index.d.ts.map +1 -0
- package/dist/components/select/index.js +234 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/skeleton/index.d.ts +19 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/index.js +20 -0
- package/dist/components/skeleton/index.js.map +1 -0
- package/dist/components/slider/index.d.ts +72 -0
- package/dist/components/slider/index.d.ts.map +1 -0
- package/dist/components/slider/index.js +159 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/spinner/index.d.ts +14 -0
- package/dist/components/spinner/index.d.ts.map +1 -0
- package/dist/components/spinner/index.js +15 -0
- package/dist/components/spinner/index.js.map +1 -0
- package/dist/components/splitter/index.d.ts +49 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +67 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/stepper/index.d.ts +82 -0
- package/dist/components/stepper/index.d.ts.map +1 -0
- package/dist/components/stepper/index.js +100 -0
- package/dist/components/stepper/index.js.map +1 -0
- package/dist/components/switch/index.d.ts +57 -0
- package/dist/components/switch/index.d.ts.map +1 -0
- package/dist/components/switch/index.js +101 -0
- package/dist/components/switch/index.js.map +1 -0
- package/dist/components/table/index.d.ts +110 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +211 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +67 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/index.js +78 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/textarea/index.d.ts +72 -0
- package/dist/components/textarea/index.d.ts.map +1 -0
- package/dist/components/textarea/index.js +205 -0
- package/dist/components/textarea/index.js.map +1 -0
- package/dist/components/textlink/index.d.ts +39 -0
- package/dist/components/textlink/index.d.ts.map +1 -0
- package/dist/components/textlink/index.js +42 -0
- package/dist/components/textlink/index.js.map +1 -0
- package/dist/components/toast/index.d.ts +111 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/index.js +205 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/components/toggle/index.d.ts +41 -0
- package/dist/components/toggle/index.d.ts.map +1 -0
- package/dist/components/toggle/index.js +78 -0
- package/dist/components/toggle/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +44 -0
- package/dist/components/tooltip/index.d.ts.map +1 -0
- package/dist/components/tooltip/index.js +51 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Style.d.ts +14 -0
- package/dist/types/Style.d.ts.map +1 -0
- package/dist/types/Style.js +2 -0
- package/dist/types/Style.js.map +1 -0
- package/dist/types/Tone.d.ts +4 -0
- package/dist/types/Tone.d.ts.map +1 -0
- package/dist/types/Tone.js +2 -0
- package/dist/types/Tone.js.map +1 -0
- package/dist/utils/ArkStateToDataAttributes.d.ts +4 -0
- package/dist/utils/ArkStateToDataAttributes.d.ts.map +1 -0
- package/dist/utils/ArkStateToDataAttributes.js +9 -0
- package/dist/utils/ArkStateToDataAttributes.js.map +1 -0
- package/dist/utils/Tone.d.ts +3 -0
- package/dist/utils/Tone.d.ts.map +1 -0
- package/dist/utils/Tone.js +7 -0
- package/dist/utils/Tone.js.map +1 -0
- package/dist/utils/useForwardClickToInput.d.ts +4 -0
- package/dist/utils/useForwardClickToInput.d.ts.map +1 -0
- package/dist/utils/useForwardClickToInput.js +27 -0
- package/dist/utils/useForwardClickToInput.js.map +1 -0
- package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts +198 -0
- package/dist/utils/virtualization/useVirtualizedAutocomplete.d.ts.map +1 -0
- package/dist/utils/virtualization/useVirtualizedAutocomplete.js +180 -0
- package/dist/utils/virtualization/useVirtualizedAutocomplete.js.map +1 -0
- package/dist/utils/virtualization/useVirtualizedCombobox.d.ts +200 -0
- package/dist/utils/virtualization/useVirtualizedCombobox.d.ts.map +1 -0
- package/dist/utils/virtualization/useVirtualizedCombobox.js +174 -0
- package/dist/utils/virtualization/useVirtualizedCombobox.js.map +1 -0
- package/dist/utils/virtualization/useVirtualizedTable.d.ts +169 -0
- package/dist/utils/virtualization/useVirtualizedTable.d.ts.map +1 -0
- package/dist/utils/virtualization/useVirtualizedTable.js +127 -0
- package/dist/utils/virtualization/useVirtualizedTable.js.map +1 -0
- package/package.json +64 -4
- package/src/presets/shopify-polaris/shopify-polaris-accordion.css +28 -0
- package/src/presets/shopify-polaris/shopify-polaris-autocomplete.css +155 -0
- package/src/presets/shopify-polaris/shopify-polaris-avatar.css +47 -0
- package/src/presets/shopify-polaris/shopify-polaris-badge.css +27 -0
- package/src/presets/shopify-polaris/shopify-polaris-banner.css +111 -0
- package/src/presets/shopify-polaris/shopify-polaris-breadcrumb.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-button.css +79 -0
- package/src/presets/shopify-polaris/shopify-polaris-card.css +28 -0
- package/src/presets/shopify-polaris/shopify-polaris-checkbox.css +52 -0
- package/src/presets/shopify-polaris/shopify-polaris-chip.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-combobox.css +179 -0
- package/src/presets/shopify-polaris/shopify-polaris-datepicker.css +183 -0
- package/src/presets/shopify-polaris/shopify-polaris-dialog.css +40 -0
- package/src/presets/shopify-polaris/shopify-polaris-divider.css +12 -0
- package/src/presets/shopify-polaris/shopify-polaris-drawer.css +40 -0
- package/src/presets/shopify-polaris/shopify-polaris-empty.css +32 -0
- package/src/presets/shopify-polaris/shopify-polaris-fileupload.css +78 -0
- package/src/presets/shopify-polaris/shopify-polaris-form.css +8 -0
- package/src/presets/shopify-polaris/shopify-polaris-input.css +72 -0
- package/src/presets/shopify-polaris/shopify-polaris-menu.css +112 -0
- package/src/presets/shopify-polaris/shopify-polaris-metric.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-numberinput.css +88 -0
- package/src/presets/shopify-polaris/shopify-polaris-otpinput.css +42 -0
- package/src/presets/shopify-polaris/shopify-polaris-page.css +69 -0
- package/src/presets/shopify-polaris/shopify-polaris-passwordinput.css +76 -0
- package/src/presets/shopify-polaris/shopify-polaris-popover.css +47 -0
- package/src/presets/shopify-polaris/shopify-polaris-radio.css +54 -0
- package/src/presets/shopify-polaris/shopify-polaris-ratinginput.css +42 -0
- package/src/presets/shopify-polaris/shopify-polaris-select.css +119 -0
- package/src/presets/shopify-polaris/shopify-polaris-skeleton.css +8 -0
- package/src/presets/shopify-polaris/shopify-polaris-slider.css +86 -0
- package/src/presets/shopify-polaris/shopify-polaris-spinner.css +16 -0
- package/src/presets/shopify-polaris/shopify-polaris-splitter.css +34 -0
- package/src/presets/shopify-polaris/shopify-polaris-stepper.css +55 -0
- package/src/presets/shopify-polaris/shopify-polaris-switch.css +38 -0
- package/src/presets/shopify-polaris/shopify-polaris-table.css +72 -0
- package/src/presets/shopify-polaris/shopify-polaris-tabs.css +33 -0
- package/src/presets/shopify-polaris/shopify-polaris-textarea.css +61 -0
- package/src/presets/shopify-polaris/shopify-polaris-textlink.css +8 -0
- package/src/presets/shopify-polaris/shopify-polaris-toggle.css +52 -0
- package/src/presets/shopify-polaris/shopify-polaris-tooltip.css +31 -0
- package/src/presets/shopify-polaris/shopify-polaris.css +380 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-accordion.css +28 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-autocomplete.css +155 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-avatar.css +47 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-badge.css +27 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-banner.css +96 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-breadcrumb.css +16 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-button.css +68 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-card.css +28 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-checkbox.css +52 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-chip.css +16 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-combobox.css +184 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-datepicker.css +187 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-dialog.css +40 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-divider.css +12 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-drawer.css +40 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-empty.css +32 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-fileupload.css +72 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-form.css +8 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-input.css +72 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-menu.css +112 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-metric.css +16 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-numberinput.css +88 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-otpinput.css +42 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-page.css +69 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-passwordinput.css +76 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-popover.css +47 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-radio.css +54 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-ratinginput.css +42 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-select.css +118 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-skeleton.css +8 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-slider.css +86 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-spinner.css +16 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-splitter.css +34 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-stepper.css +55 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-switch.css +38 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-table.css +72 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tabs.css +33 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textarea.css +61 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-textlink.css +8 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-toast.css +43 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-toggle.css +52 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-tooltip.css +31 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +381 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { StyleProps } from '../../types/Style.ts';
|
|
2
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import type { ReactElement } from 'react';
|
|
4
|
+
import type { LucideProps } from 'lucide-react';
|
|
5
|
+
/**
|
|
6
|
+
* OpenHandler and CloseHandler give behavior to your button children. Popup already includes its portal; do not add one. Use Title to name the dialog and Description when supporting text is needed. Header, Body, and Footer organize content.
|
|
7
|
+
*
|
|
8
|
+
* @example Complete composition
|
|
9
|
+
* import { Button, Dialog } from '@central-ui/react'
|
|
10
|
+
*
|
|
11
|
+
* function Example() {
|
|
12
|
+
* return (
|
|
13
|
+
* <Dialog.Root>
|
|
14
|
+
* <Dialog.OpenHandler>
|
|
15
|
+
* <Button.default variant="secondary">Account details</Button.default>
|
|
16
|
+
* </Dialog.OpenHandler>
|
|
17
|
+
* <Dialog.Backdrop />
|
|
18
|
+
* <Dialog.Popup>
|
|
19
|
+
* <Dialog.Header>
|
|
20
|
+
* <Dialog.Title>Account details</Dialog.Title>
|
|
21
|
+
* <Dialog.Description>Review your account information.</Dialog.Description>
|
|
22
|
+
* <Dialog.CloseButton aria-label="Close">
|
|
23
|
+
* <Dialog.CloseButtonIcon />
|
|
24
|
+
* </Dialog.CloseButton>
|
|
25
|
+
* </Dialog.Header>
|
|
26
|
+
* <Dialog.Body>Your account is ready to use.</Dialog.Body>
|
|
27
|
+
* <Dialog.Footer>
|
|
28
|
+
* <Dialog.CloseHandler>
|
|
29
|
+
* <Button.default variant="primary">Done</Button.default>
|
|
30
|
+
* </Dialog.CloseHandler>
|
|
31
|
+
* </Dialog.Footer>
|
|
32
|
+
* </Dialog.Popup>
|
|
33
|
+
* </Dialog.Root>
|
|
34
|
+
* )
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* @example Require an explicit close action
|
|
38
|
+
* // Keep the same trigger, title, and popup content.
|
|
39
|
+
* ;<Dialog.Root disablePointerDismissal>
|
|
40
|
+
* {
|
|
41
|
+
* // Rest of components here
|
|
42
|
+
* }
|
|
43
|
+
* </Dialog.Root>
|
|
44
|
+
*/
|
|
45
|
+
export declare const Root: <Payload>(props: BaseDialog.Root.Props<Payload>) => React.JSX.Element;
|
|
46
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
47
|
+
export declare const OpenHandler: import("react").ForwardRefExoticComponent<Omit<Omit<BaseDialog.Trigger.Props<unknown>, "children" | "className" | "render"> & {
|
|
48
|
+
className?: string;
|
|
49
|
+
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
50
|
+
children: ReactElement;
|
|
51
|
+
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
52
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
53
|
+
export declare const CloseHandler: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogCloseProps, "children" | "className" | "render"> & {
|
|
54
|
+
className?: string;
|
|
55
|
+
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
56
|
+
children: ReactElement;
|
|
57
|
+
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
58
|
+
export type PopupProps = Omit<BaseDialog.Popup.Props, 'className'> & {
|
|
59
|
+
className?: string;
|
|
60
|
+
} & Pick<BaseDialog.Portal.Props, 'container' | 'keepMounted'> & StyleProps;
|
|
61
|
+
/** Already includes the portal. Keep it in the matching Root and let the native open state control visibility. */
|
|
62
|
+
export declare const Popup: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogPopupProps, "className"> & {
|
|
63
|
+
className?: string;
|
|
64
|
+
} & Pick<import("@base-ui/react").AlertDialogPortalProps, "keepMounted" | "container"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
65
|
+
export type BackdropProps = Omit<BaseDialog.Backdrop.Props, 'className'> & {
|
|
66
|
+
className?: string;
|
|
67
|
+
} & Pick<BaseDialog.Portal.Props, 'container' | 'keepMounted'> & StyleProps;
|
|
68
|
+
export declare const Backdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogBackdropProps, "className"> & {
|
|
69
|
+
className?: string;
|
|
70
|
+
} & Pick<import("@base-ui/react").AlertDialogPortalProps, "keepMounted" | "container"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
71
|
+
export declare const Header: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
72
|
+
export declare const Body: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
73
|
+
export declare const Footer: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
74
|
+
export declare const Title: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogTitleProps, "className"> & {
|
|
75
|
+
className?: string;
|
|
76
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
77
|
+
export declare const Description: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogDescriptionProps, "className"> & {
|
|
78
|
+
className?: string;
|
|
79
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
80
|
+
export declare const CloseButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").AlertDialogCloseProps, "className"> & {
|
|
81
|
+
className?: string;
|
|
82
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
83
|
+
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
84
|
+
export declare const CloseButtonIcon: import("react").ForwardRefExoticComponent<Omit<LucideProps & {
|
|
85
|
+
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
86
|
+
children?: ReactElement<LucideProps>;
|
|
87
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
88
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,OAAO,CAAA;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,IAAI,uEAAkB,CAAA;AACnC,8IAA8I;AAC9I,eAAO,MAAM,WAAW;gBAGR,MAAM;IAClB,2GAA2G;cACjG,YAAY;6DAIxB,CAAA;AAEF,8IAA8I;AAC9I,eAAO,MAAM,YAAY;gBAGT,MAAM;IAClB,2GAA2G;cACjG,YAAY;6DAIxB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAAC,GAC5D,UAAU,CAAA;AACZ,kHAAkH;AAClH,eAAO,MAAM,KAAK;gBAJJ,MAAM;4JAmCnB,CAAA;AACD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAAC,GAC5D,UAAU,CAAA;AACZ,eAAO,MAAM,QAAQ;gBAHP,MAAM;4JAoBnB,CAAA;AACD,eAAO,MAAM,MAAM,uNAajB,CAAA;AAEF,eAAO,MAAM,IAAI,uNAaf,CAAA;AAEF,eAAO,MAAM,MAAM,uNAajB,CAAA;AAEF,eAAO,MAAM,KAAK;gBAE2C,MAAM;2EAYjE,CAAA;AAEF,eAAO,MAAM,WAAW;gBAE2C,MAAM;6EAYvE,CAAA;AAEF,eAAO,MAAM,WAAW;gBAEqC,MAAM;0EAYjE,CAAA;AAEF,8GAA8G;AAC9G,eAAO,MAAM,eAAe;IAGxB,2EAA2E;eAChE,YAAY,CAAC,WAAW,CAAC;sEAiBtC,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import { cloneElement, forwardRef } from 'react';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { X } from 'lucide-react';
|
|
6
|
+
/**
|
|
7
|
+
* OpenHandler and CloseHandler give behavior to your button children. Popup already includes its portal; do not add one. Use Title to name the dialog and Description when supporting text is needed. Header, Body, and Footer organize content.
|
|
8
|
+
*
|
|
9
|
+
* @example Complete composition
|
|
10
|
+
* import { Button, Dialog } from '@central-ui/react'
|
|
11
|
+
*
|
|
12
|
+
* function Example() {
|
|
13
|
+
* return (
|
|
14
|
+
* <Dialog.Root>
|
|
15
|
+
* <Dialog.OpenHandler>
|
|
16
|
+
* <Button.default variant="secondary">Account details</Button.default>
|
|
17
|
+
* </Dialog.OpenHandler>
|
|
18
|
+
* <Dialog.Backdrop />
|
|
19
|
+
* <Dialog.Popup>
|
|
20
|
+
* <Dialog.Header>
|
|
21
|
+
* <Dialog.Title>Account details</Dialog.Title>
|
|
22
|
+
* <Dialog.Description>Review your account information.</Dialog.Description>
|
|
23
|
+
* <Dialog.CloseButton aria-label="Close">
|
|
24
|
+
* <Dialog.CloseButtonIcon />
|
|
25
|
+
* </Dialog.CloseButton>
|
|
26
|
+
* </Dialog.Header>
|
|
27
|
+
* <Dialog.Body>Your account is ready to use.</Dialog.Body>
|
|
28
|
+
* <Dialog.Footer>
|
|
29
|
+
* <Dialog.CloseHandler>
|
|
30
|
+
* <Button.default variant="primary">Done</Button.default>
|
|
31
|
+
* </Dialog.CloseHandler>
|
|
32
|
+
* </Dialog.Footer>
|
|
33
|
+
* </Dialog.Popup>
|
|
34
|
+
* </Dialog.Root>
|
|
35
|
+
* )
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* @example Require an explicit close action
|
|
39
|
+
* // Keep the same trigger, title, and popup content.
|
|
40
|
+
* ;<Dialog.Root disablePointerDismissal>
|
|
41
|
+
* {
|
|
42
|
+
* // Rest of components here
|
|
43
|
+
* }
|
|
44
|
+
* </Dialog.Root>
|
|
45
|
+
*/
|
|
46
|
+
export const Root = BaseDialog.Root;
|
|
47
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
48
|
+
export const OpenHandler = forwardRef(function OpenHandler({ children, ...props }, ref) {
|
|
49
|
+
return _jsx(BaseDialog.Trigger, { ...props, ref: ref, render: children });
|
|
50
|
+
});
|
|
51
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
52
|
+
export const CloseHandler = forwardRef(function CloseHandler({ children, ...props }, ref) {
|
|
53
|
+
return _jsx(BaseDialog.Close, { ...props, ref: ref, render: children });
|
|
54
|
+
});
|
|
55
|
+
/** Already includes the portal. Keep it in the matching Root and let the native open state control visibility. */
|
|
56
|
+
export const Popup = forwardRef(function Popup({ disableStyle, container, keepMounted, className, style, ...props }, ref) {
|
|
57
|
+
const baseStyle = {
|
|
58
|
+
position: 'fixed',
|
|
59
|
+
top: '50%',
|
|
60
|
+
left: '50%',
|
|
61
|
+
translate: '-50% -50%',
|
|
62
|
+
zIndex: 40,
|
|
63
|
+
};
|
|
64
|
+
return (_jsx(BaseDialog.Portal, { container: container, keepMounted: keepMounted, children: _jsx(BaseDialog.Viewport, { children: _jsx(BaseDialog.Popup, { ...props, ref: ref, "data-component": "dialog-popup", "data-style-disabled": disableStyle ? '' : undefined, className: className, style: typeof style === 'function'
|
|
65
|
+
? (state) => ({ ...baseStyle, ...style(state) })
|
|
66
|
+
: { ...baseStyle, ...style } }) }) }));
|
|
67
|
+
});
|
|
68
|
+
export const Backdrop = forwardRef(function Backdrop({ disableStyle, container, keepMounted, className, ...props }, ref) {
|
|
69
|
+
return (_jsx(BaseDialog.Portal, { container: container, keepMounted: keepMounted, children: _jsx(BaseDialog.Backdrop, { ...props, ref: ref, "data-component": "dialog-backdrop", "data-style-disabled": disableStyle ? '' : undefined, className: className }) }));
|
|
70
|
+
});
|
|
71
|
+
export const Header = forwardRef(function Header({ disableStyle, className, ...props }, ref) {
|
|
72
|
+
return (_jsx("div", { ...props, ref: ref, "data-component": "dialog-header", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
73
|
+
});
|
|
74
|
+
export const Body = forwardRef(function Body({ disableStyle, className, ...props }, ref) {
|
|
75
|
+
return (_jsx("div", { ...props, ref: ref, "data-component": "dialog-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
76
|
+
});
|
|
77
|
+
export const Footer = forwardRef(function Footer({ disableStyle, className, ...props }, ref) {
|
|
78
|
+
return (_jsx("div", { ...props, ref: ref, "data-component": "dialog-footer", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
79
|
+
});
|
|
80
|
+
export const Title = forwardRef(function Title({ disableStyle, className, ...props }, ref) {
|
|
81
|
+
return (_jsx(BaseDialog.Title, { ...props, ref: ref, "data-component": "dialog-title", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
82
|
+
});
|
|
83
|
+
export const Description = forwardRef(function Description({ disableStyle, className, ...props }, ref) {
|
|
84
|
+
return (_jsx(BaseDialog.Description, { ...props, ref: ref, "data-component": "dialog-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
85
|
+
});
|
|
86
|
+
export const CloseButton = forwardRef(function CloseButton({ disableStyle, className, ...props }, ref) {
|
|
87
|
+
return (_jsx(BaseDialog.Close, { ...props, ref: ref, "data-component": "dialog-closebutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
88
|
+
});
|
|
89
|
+
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
90
|
+
export const CloseButtonIcon = forwardRef(function CloseButtonIcon({ disableStyle, children, className, ...props }, ref) {
|
|
91
|
+
return cloneElement(children ?? _jsx(X, {}), {
|
|
92
|
+
...props,
|
|
93
|
+
ref,
|
|
94
|
+
'aria-hidden': true,
|
|
95
|
+
...{
|
|
96
|
+
'data-component': 'dialog-closebuttonicon',
|
|
97
|
+
'data-style-disabled': disableStyle ? '' : undefined,
|
|
98
|
+
},
|
|
99
|
+
className: twMerge(children?.props.className, className),
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/dialog/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,OAA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CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAInC,SAAS,WAAW,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAC/D,OAAO,CACL,KAAC,UAAU,CAAC,KAAK,OACX,KAAK,EACT,GAAG,EAAE,GAAG,oBACO,oBAAoB,yBACd,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,GACpB,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,8GAA8G;AAC9G,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAOvC,SAAS,eAAe,CACxB,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAC/C,GAAG;IAEH,OAAO,YAAY,CAAC,QAAQ,IAAI,KAAC,CAAC,KAAG,EAAE;QACrC,GAAG,KAAK;QACR,GAAG;QACH,aAAa,EAAE,IAAI;QACnB,GAAG;YACD,gBAAgB,EAAE,wBAAwB;YAC1C,qBAAqB,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;SACrD;QACD,SAAS,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;KACzD,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StyleProps } from '../../types/Style.ts';
|
|
2
|
+
import type { HTMLAttributes } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Use the default divider alone for a rule, or put Text inside for a labeled divider. It does not manage section visibility.
|
|
5
|
+
*
|
|
6
|
+
* @example Complete composition
|
|
7
|
+
* import { Divider } from '@central-ui/react'
|
|
8
|
+
*
|
|
9
|
+
* function Example() {
|
|
10
|
+
* return (
|
|
11
|
+
* <div className="flex flex-col gap-3">
|
|
12
|
+
* <p className="text-sm">General settings</p>
|
|
13
|
+
* <Divider.default />
|
|
14
|
+
* <p className="text-sm text-neutral-600">Advanced settings</p>
|
|
15
|
+
* </div>
|
|
16
|
+
* )
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export default function Divider({ disableStyle, className, ...props }: HTMLAttributes<HTMLHRElement> & StyleProps): import("react").JSX.Element;
|
|
20
|
+
export declare function Text({ disableStyle, className, ...props }: HTMLAttributes<HTMLParagraphElement> & StyleProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/divider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,aAAa,CAAC,GAAG,UAAU,+BAS5C;AAED,wBAAgB,IAAI,CAAC,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,oBAAoB,CAAC,GAAG,UAAU,+BASnD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Use the default divider alone for a rule, or put Text inside for a labeled divider. It does not manage section visibility.
|
|
4
|
+
*
|
|
5
|
+
* @example Complete composition
|
|
6
|
+
* import { Divider } from '@central-ui/react'
|
|
7
|
+
*
|
|
8
|
+
* function Example() {
|
|
9
|
+
* return (
|
|
10
|
+
* <div className="flex flex-col gap-3">
|
|
11
|
+
* <p className="text-sm">General settings</p>
|
|
12
|
+
* <Divider.default />
|
|
13
|
+
* <p className="text-sm text-neutral-600">Advanced settings</p>
|
|
14
|
+
* </div>
|
|
15
|
+
* )
|
|
16
|
+
* }
|
|
17
|
+
*/
|
|
18
|
+
export default function Divider({ disableStyle, className, ...props }) {
|
|
19
|
+
return (_jsx("hr", { "data-component": "divider-divider", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
20
|
+
}
|
|
21
|
+
export function Text({ disableStyle, className, ...props }) {
|
|
22
|
+
return (_jsx("p", { "data-component": "divider-text", "data-style-disabled": disableStyle ? '' : undefined, className: className, ...props }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/divider/index.tsx"],"names":[],"mappings":";AAIA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACmC;IAC3C,OAAO,CACL,+BACiB,iBAAiB,yBACX,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EAC0C;IAClD,OAAO,CACL,8BACiB,cAAc,yBACR,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,KAChB,KAAK,GACT,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { StyleProps } from '../../types/Style.ts';
|
|
2
|
+
import { Drawer as BaseDrawer } from '@base-ui/react/drawer';
|
|
3
|
+
import type { ReactElement } from 'react';
|
|
4
|
+
import type { LucideProps } from 'lucide-react';
|
|
5
|
+
/**
|
|
6
|
+
* Choose swipeDirection on Root and keep trigger and Popup in that Root. Popup already includes its portal. Provider and Indent parts are for an optional indented-background composition, not required for a basic drawer.
|
|
7
|
+
*
|
|
8
|
+
* @example Complete composition
|
|
9
|
+
* import { Button, Drawer } from '@central-ui/react'
|
|
10
|
+
*
|
|
11
|
+
* function Example() {
|
|
12
|
+
* return (
|
|
13
|
+
* <Drawer.Root swipeDirection="right">
|
|
14
|
+
* <Drawer.OpenHandler>
|
|
15
|
+
* <Button.default variant="secondary">Open account</Button.default>
|
|
16
|
+
* </Drawer.OpenHandler>
|
|
17
|
+
* <Drawer.Backdrop />
|
|
18
|
+
* <Drawer.Popup>
|
|
19
|
+
* <Drawer.Header>
|
|
20
|
+
* <Drawer.Title>Account</Drawer.Title>
|
|
21
|
+
* <Drawer.Description>Manage your account.</Drawer.Description>
|
|
22
|
+
* <Drawer.CloseButton aria-label="Close drawer">
|
|
23
|
+
* <Drawer.CloseButtonIcon />
|
|
24
|
+
* </Drawer.CloseButton>
|
|
25
|
+
* </Drawer.Header>
|
|
26
|
+
* <Drawer.Body>Account information goes here.</Drawer.Body>
|
|
27
|
+
* <Drawer.Footer>
|
|
28
|
+
* <Drawer.CloseHandler>
|
|
29
|
+
* <Button.default variant="primary">Done</Button.default>
|
|
30
|
+
* </Drawer.CloseHandler>
|
|
31
|
+
* </Drawer.Footer>
|
|
32
|
+
* </Drawer.Popup>
|
|
33
|
+
* </Drawer.Root>
|
|
34
|
+
* )
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* @example Open from the bottom
|
|
38
|
+
* // Keep the same Popup and trigger; direction belongs to Root.
|
|
39
|
+
* ;<Drawer.Root swipeDirection="down">
|
|
40
|
+
* {
|
|
41
|
+
* // Rest of components here
|
|
42
|
+
* }
|
|
43
|
+
* </Drawer.Root>
|
|
44
|
+
*/
|
|
45
|
+
export declare function Root<Payload = unknown>({ swipeDirection, ...props }: BaseDrawer.Root.Props<Payload>): import("react").JSX.Element;
|
|
46
|
+
/** Optional: use around IndentBackground, Indent and drawers when app indentation is needed. */
|
|
47
|
+
export declare const Provider: typeof BaseDrawer.Provider;
|
|
48
|
+
/** Optional: background layer for app indentation; use with Indent inside Provider. */
|
|
49
|
+
export declare const IndentBackground: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerIndentBackgroundProps, "className"> & {
|
|
50
|
+
className?: string;
|
|
51
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
52
|
+
/** Optional: wraps the app content when indentation is needed; use inside Provider. */
|
|
53
|
+
export declare const Indent: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerIndentProps, "className"> & {
|
|
54
|
+
className?: string;
|
|
55
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
56
|
+
/** Optional: a custom swipe-to-open area outside Popup but inside Root. Unpainted by default; style its size and position at the call site. */
|
|
57
|
+
export declare const SwipeArea: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerSwipeAreaProps, "className"> & {
|
|
58
|
+
className?: string;
|
|
59
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
60
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
61
|
+
export declare const OpenHandler: import("react").ForwardRefExoticComponent<Omit<Omit<BaseDrawer.Trigger.Props<unknown>, "children" | "className" | "render"> & {
|
|
62
|
+
className?: string;
|
|
63
|
+
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
64
|
+
children: ReactElement;
|
|
65
|
+
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
66
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
67
|
+
export declare const CloseHandler: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerCloseProps, "children" | "className" | "render"> & {
|
|
68
|
+
className?: string;
|
|
69
|
+
/** Supply your own accessible control. It receives the behavior; its own className owns the appearance. */
|
|
70
|
+
children: ReactElement;
|
|
71
|
+
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
72
|
+
export type PopupProps = Omit<BaseDrawer.Popup.Props, 'className'> & {
|
|
73
|
+
className?: string;
|
|
74
|
+
} & Pick<BaseDrawer.Portal.Props, 'container' | 'keepMounted'> & StyleProps;
|
|
75
|
+
/** Already includes the portal. Keep it in the matching Root and let the native open state control visibility. */
|
|
76
|
+
export declare const Popup: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerPopupProps, "className"> & {
|
|
77
|
+
className?: string;
|
|
78
|
+
} & Pick<import("@base-ui/react").DrawerPortalProps, "keepMounted" | "container"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
79
|
+
export declare const Backdrop: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerBackdropProps, "className"> & {
|
|
80
|
+
className?: string;
|
|
81
|
+
} & Pick<import("@base-ui/react").DrawerPortalProps, "keepMounted" | "container"> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
82
|
+
export declare const Header: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
83
|
+
export declare const Body: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
84
|
+
export declare const Footer: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
85
|
+
export declare const Title: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerTitleProps, "className"> & {
|
|
86
|
+
className?: string;
|
|
87
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
88
|
+
export declare const Description: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerDescriptionProps, "className"> & {
|
|
89
|
+
className?: string;
|
|
90
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
91
|
+
export declare const CloseButton: import("react").ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").DrawerCloseProps, "className"> & {
|
|
92
|
+
className?: string;
|
|
93
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
94
|
+
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
95
|
+
export declare const CloseButtonIcon: import("react").ForwardRefExoticComponent<Omit<LucideProps & {
|
|
96
|
+
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
97
|
+
children?: ReactElement<LucideProps>;
|
|
98
|
+
} & StyleProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
99
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,OAAO,CAAA;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,EACtC,cAAwB,EACxB,GAAG,KAAK,EACT,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,+BAEhC;AACD,gGAAgG;AAChG,eAAO,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{ Drawer as BaseDrawer } from '@base-ui/react/drawer';
|
|
3
|
+
import { cloneElement, forwardRef } from 'react';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { X } from 'lucide-react';
|
|
6
|
+
/**
|
|
7
|
+
* Choose swipeDirection on Root and keep trigger and Popup in that Root. Popup already includes its portal. Provider and Indent parts are for an optional indented-background composition, not required for a basic drawer.
|
|
8
|
+
*
|
|
9
|
+
* @example Complete composition
|
|
10
|
+
* import { Button, Drawer } from '@central-ui/react'
|
|
11
|
+
*
|
|
12
|
+
* function Example() {
|
|
13
|
+
* return (
|
|
14
|
+
* <Drawer.Root swipeDirection="right">
|
|
15
|
+
* <Drawer.OpenHandler>
|
|
16
|
+
* <Button.default variant="secondary">Open account</Button.default>
|
|
17
|
+
* </Drawer.OpenHandler>
|
|
18
|
+
* <Drawer.Backdrop />
|
|
19
|
+
* <Drawer.Popup>
|
|
20
|
+
* <Drawer.Header>
|
|
21
|
+
* <Drawer.Title>Account</Drawer.Title>
|
|
22
|
+
* <Drawer.Description>Manage your account.</Drawer.Description>
|
|
23
|
+
* <Drawer.CloseButton aria-label="Close drawer">
|
|
24
|
+
* <Drawer.CloseButtonIcon />
|
|
25
|
+
* </Drawer.CloseButton>
|
|
26
|
+
* </Drawer.Header>
|
|
27
|
+
* <Drawer.Body>Account information goes here.</Drawer.Body>
|
|
28
|
+
* <Drawer.Footer>
|
|
29
|
+
* <Drawer.CloseHandler>
|
|
30
|
+
* <Button.default variant="primary">Done</Button.default>
|
|
31
|
+
* </Drawer.CloseHandler>
|
|
32
|
+
* </Drawer.Footer>
|
|
33
|
+
* </Drawer.Popup>
|
|
34
|
+
* </Drawer.Root>
|
|
35
|
+
* )
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* @example Open from the bottom
|
|
39
|
+
* // Keep the same Popup and trigger; direction belongs to Root.
|
|
40
|
+
* ;<Drawer.Root swipeDirection="down">
|
|
41
|
+
* {
|
|
42
|
+
* // Rest of components here
|
|
43
|
+
* }
|
|
44
|
+
* </Drawer.Root>
|
|
45
|
+
*/
|
|
46
|
+
export function Root({ swipeDirection = 'right', ...props }) {
|
|
47
|
+
return _jsx(BaseDrawer.Root, { ...props, swipeDirection: swipeDirection });
|
|
48
|
+
}
|
|
49
|
+
/** Optional: use around IndentBackground, Indent and drawers when app indentation is needed. */
|
|
50
|
+
export const Provider = BaseDrawer.Provider;
|
|
51
|
+
/** Optional: background layer for app indentation; use with Indent inside Provider. */
|
|
52
|
+
export const IndentBackground = forwardRef(function IndentBackground({ disableStyle, className, ...props }, ref) {
|
|
53
|
+
return (_jsx(BaseDrawer.IndentBackground, { ...props, ref: ref, "data-component": "drawer-indentbackground", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
54
|
+
});
|
|
55
|
+
/** Optional: wraps the app content when indentation is needed; use inside Provider. */
|
|
56
|
+
export const Indent = forwardRef(function Indent({ disableStyle, className, ...props }, ref) {
|
|
57
|
+
return (_jsx(BaseDrawer.Indent, { ...props, ref: ref, "data-component": "drawer-indent", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
58
|
+
});
|
|
59
|
+
/** Optional: a custom swipe-to-open area outside Popup but inside Root. Unpainted by default; style its size and position at the call site. */
|
|
60
|
+
export const SwipeArea = forwardRef(function SwipeArea({ disableStyle, className, ...props }, ref) {
|
|
61
|
+
return (_jsx(BaseDrawer.SwipeArea, { ...props, ref: ref, "data-component": "drawer-swipearea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
62
|
+
});
|
|
63
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
64
|
+
export const OpenHandler = forwardRef(function OpenHandler({ children, ...props }, ref) {
|
|
65
|
+
return _jsx(BaseDrawer.Trigger, { ...props, ref: ref, render: children });
|
|
66
|
+
});
|
|
67
|
+
/** Behavior only: give your child control this action. Style the child itself; this wrapper has no preset appearance or disableStyle prop. */
|
|
68
|
+
export const CloseHandler = forwardRef(function CloseHandler({ children, ...props }, ref) {
|
|
69
|
+
return _jsx(BaseDrawer.Close, { ...props, ref: ref, render: children });
|
|
70
|
+
});
|
|
71
|
+
/** Already includes the portal. Keep it in the matching Root and let the native open state control visibility. */
|
|
72
|
+
export const Popup = forwardRef(function Popup({ disableStyle, container, keepMounted, className, style, ...props }, ref) {
|
|
73
|
+
return (_jsx(BaseDrawer.Portal, { container: container, keepMounted: keepMounted, children: _jsx(BaseDrawer.Viewport, { children: _jsx(BaseDrawer.Popup, { ...props, ref: ref, "data-component": "drawer-popup", "data-style-disabled": disableStyle ? '' : undefined, className: className, style: (state) => {
|
|
74
|
+
const offset = state.swipeDirection === 'left' || state.swipeDirection === 'up'
|
|
75
|
+
? '-100%'
|
|
76
|
+
: '100%';
|
|
77
|
+
const vertical = state.swipeDirection === 'up' || state.swipeDirection === 'down';
|
|
78
|
+
const transitioning = state.transitionStatus === 'starting' ||
|
|
79
|
+
state.transitionStatus === 'ending';
|
|
80
|
+
const baseStyle = {
|
|
81
|
+
zIndex: 40,
|
|
82
|
+
transform: transitioning
|
|
83
|
+
? vertical
|
|
84
|
+
? 'translateY(' + offset + ')'
|
|
85
|
+
: 'translateX(' + offset + ')'
|
|
86
|
+
: vertical
|
|
87
|
+
? 'translateY(calc(var(--drawer-snap-point-offset, 0px) + var(--drawer-swipe-movement-y, 0px)))'
|
|
88
|
+
: 'translateX(var(--drawer-swipe-movement-x, 0px))',
|
|
89
|
+
transitionProperty: 'transform',
|
|
90
|
+
transitionDuration: state.swiping
|
|
91
|
+
? '0ms'
|
|
92
|
+
: state.transitionStatus === 'ending'
|
|
93
|
+
? 'calc(var(--drawer-swipe-strength, 1) * 300ms)'
|
|
94
|
+
: '300ms',
|
|
95
|
+
transitionTimingFunction: 'ease-out',
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
...baseStyle,
|
|
99
|
+
...(typeof style === 'function' ? style(state) : style),
|
|
100
|
+
};
|
|
101
|
+
} }) }) }));
|
|
102
|
+
});
|
|
103
|
+
export const Backdrop = forwardRef(function Backdrop({ disableStyle, container, keepMounted, className, ...props }, ref) {
|
|
104
|
+
return (_jsx(BaseDrawer.Portal, { container: container, keepMounted: keepMounted, children: _jsx(BaseDrawer.Backdrop, { ...props, ref: ref, "data-component": "drawer-backdrop", "data-style-disabled": disableStyle ? '' : undefined, className: className }) }));
|
|
105
|
+
});
|
|
106
|
+
export const Header = forwardRef(function Header({ disableStyle, className, ...props }, ref) {
|
|
107
|
+
return (_jsx("div", { ...props, ref: ref, "data-component": "drawer-header", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
108
|
+
});
|
|
109
|
+
export const Body = forwardRef(function Body({ disableStyle, className, ...props }, ref) {
|
|
110
|
+
return (_jsx("div", { ...props, ref: ref, "data-component": "drawer-body", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
111
|
+
});
|
|
112
|
+
export const Footer = forwardRef(function Footer({ disableStyle, className, ...props }, ref) {
|
|
113
|
+
return (_jsx("div", { ...props, ref: ref, "data-component": "drawer-footer", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
114
|
+
});
|
|
115
|
+
export const Title = forwardRef(function Title({ disableStyle, className, ...props }, ref) {
|
|
116
|
+
return (_jsx(BaseDrawer.Title, { ...props, ref: ref, "data-component": "drawer-title", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
117
|
+
});
|
|
118
|
+
export const Description = forwardRef(function Description({ disableStyle, className, ...props }, ref) {
|
|
119
|
+
return (_jsx(BaseDrawer.Description, { ...props, ref: ref, "data-component": "drawer-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
120
|
+
});
|
|
121
|
+
export const CloseButton = forwardRef(function CloseButton({ disableStyle, className, ...props }, ref) {
|
|
122
|
+
return (_jsx(BaseDrawer.Close, { ...props, ref: ref, "data-component": "drawer-closebutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
123
|
+
});
|
|
124
|
+
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
125
|
+
export const CloseButtonIcon = forwardRef(function CloseButtonIcon({ disableStyle, children, className, ...props }, ref) {
|
|
126
|
+
return cloneElement(children ?? _jsx(X, {}), {
|
|
127
|
+
...props,
|
|
128
|
+
ref,
|
|
129
|
+
'aria-hidden': true,
|
|
130
|
+
...{
|
|
131
|
+
'data-component': 'drawer-closebuttonicon',
|
|
132
|
+
'data-style-disabled': disableStyle ? '' : undefined,
|
|
133
|
+
},
|
|
134
|
+
className: twMerge(children?.props.className, className),
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/drawer/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,IAAI,CAAoB,EACtC,cAAc,GAAG,OAAO,EACxB,GAAG,KAAK,EACuB;IAC/B,OAAO,KAAC,UAAU,CAAC,IAAI,OAAK,KAAK,EAAE,cAAc,EAAE,cAAc,GAAI,CAAA;AACvE,CAAC;AACD,gGAAgG;AAChG,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAA;AAC3C,uFAAuF;AACvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAMxC,SAAS,gBAAgB,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACpE,OAAO,CACL,KAAC,UAAU,CAAC,gBAAgB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AAK,EACT,GAAG,EAAE,GAAG,oBACO,oBAAoB,yBACd,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,GACpB,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAInC,SAAS,WAAW,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAC/D,OAAO,CACL,KAAC,UAAU,CAAC,KAAK,OACX,KAAK,EACT,GAAG,EAAE,GAAG,oBACO,oBAAoB,yBACd,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAClD,SAAS,EAAE,SAAS,GACpB,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,8GAA8G;AAC9G,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAOvC,SAAS,eAAe,CACxB,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAC/C,GAAG;IAEH,OAAO,YAAY,CAAC,QAAQ,IAAI,KAAC,CAAC,KAAG,EAAE;QACrC,GAAG,KAAK;QACR,GAAG;QACH,aAAa,EAAE,IAAI;QACnB,GAAG;YACD,gBAAgB,EAAE,wBAAwB;YAC1C,qBAAqB,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;SACrD;QACD,SAAS,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;KACzD,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { StyleProps } from '../../types/Style.ts';
|
|
2
|
+
import type { ComponentProps, HTMLAttributes, ImgHTMLAttributes, ReactElement } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Compose Surface and Body for an empty-state panel. You decide when the panel appears; it does not inspect your data. Image/Icon and ActionsList are optional ways to explain the state and offer a next action.
|
|
5
|
+
*
|
|
6
|
+
* @example Complete composition
|
|
7
|
+
* import { Button, Empty } from '@central-ui/react'
|
|
8
|
+
* import { FolderOpen } from 'lucide-react'
|
|
9
|
+
*
|
|
10
|
+
* function Example() {
|
|
11
|
+
* return (
|
|
12
|
+
* <Empty.Surface>
|
|
13
|
+
* <Empty.Body>
|
|
14
|
+
* <Empty.Icon>
|
|
15
|
+
* <FolderOpen aria-hidden="true" />
|
|
16
|
+
* </Empty.Icon>
|
|
17
|
+
* <Empty.Title>No projects yet</Empty.Title>
|
|
18
|
+
* <Empty.Description>Create a project to get started.</Empty.Description>
|
|
19
|
+
* <Empty.ActionsList>
|
|
20
|
+
* <Button.default variant="secondary" size="small">
|
|
21
|
+
* Create project
|
|
22
|
+
* </Button.default>
|
|
23
|
+
* </Empty.ActionsList>
|
|
24
|
+
* </Empty.Body>
|
|
25
|
+
* </Empty.Surface>
|
|
26
|
+
* )
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export declare function Surface({ disableStyle, className, children, ...props }: HTMLAttributes<HTMLDivElement> & StyleProps): import("react").JSX.Element;
|
|
30
|
+
export declare function Body({ disableStyle, className, ...props }: ComponentProps<'div'> & StyleProps): import("react").JSX.Element;
|
|
31
|
+
export declare function Title({ disableStyle, className, ...props }: HTMLAttributes<HTMLParagraphElement> & StyleProps): import("react").JSX.Element;
|
|
32
|
+
export declare function Description({ disableStyle, className, ...props }: HTMLAttributes<HTMLParagraphElement> & StyleProps): import("react").JSX.Element;
|
|
33
|
+
export declare function Image({ disableStyle, className, ...props }: ImgHTMLAttributes<HTMLImageElement> & StyleProps): import("react").JSX.Element;
|
|
34
|
+
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
35
|
+
export declare function Icon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
|
|
36
|
+
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
37
|
+
children: ReactElement<ComponentProps<'svg'>>;
|
|
38
|
+
}) & StyleProps): ReactElement<import("react").SVGProps<SVGSVGElement>, string | import("react").JSXElementConstructor<any>>;
|
|
39
|
+
export declare function ActionsList({ disableStyle, className, ...props }: HTMLAttributes<HTMLDivElement> & StyleProps): import("react").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/empty/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,YAAY,EACb,MAAM,OAAO,CAAA;AAId;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,OAAO,CAAC,EACtB,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,UAAU,+BAW7C;AAED,wBAAgB,IAAI,CAAC,EACnB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,UAAU,+BASpC;AAED,wBAAgB,KAAK,CAAC,EACpB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,oBAAoB,CAAC,GAAG,UAAU,+BASnD;AAED,wBAAgB,WAAW,CAAC,EAC1B,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,oBAAoB,CAAC,GAAG,UAAU,+BASnD;AAED,wBAAgB,KAAK,CAAC,EACpB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,UAAU,+BAUlD;AAED,wHAAwH;AACxH,wBAAgB,IAAI,CAAC,EACnB,YAAY,EACZ,QAAQ,EACR,SAA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