@primitiv-ui/react 0.1.0 → 0.1.2
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/package.json +2 -1
- package/src/AccessibleIcon/AccessibleIcon.tsx +6 -2
- package/src/AccessibleIcon/__tests__/AccessibleIcon.test.tsx +1 -1
- package/src/AccessibleIcon/types.ts +4 -0
- package/src/Accordion/Accordion.tsx +34 -12
- package/src/Accordion/AccordionContext.ts +1 -1
- package/src/Accordion/__tests__/Accordion.reading-direction.test.tsx +1 -1
- package/src/Accordion/hooks/useAccordionItem.ts +1 -1
- package/src/Accordion/hooks/useAccordionRoot.ts +1 -1
- package/src/Accordion/hooks/useAccordionTrigger.ts +2 -2
- package/src/Accordion/index.ts +2 -1
- package/src/Accordion/types.ts +55 -13
- package/src/Alert/Alert.tsx +9 -2
- package/src/Alert/__tests__/Alert.test.tsx +1 -1
- package/src/Alert/types.ts +1 -0
- package/src/Avatar/Avatar.tsx +20 -7
- package/src/Avatar/AvatarContext.ts +12 -6
- package/src/Breadcrumb/Breadcrumb.tsx +32 -10
- package/src/Button/Button.tsx +5 -2
- package/src/Button/types.ts +4 -0
- package/src/Carousel/Carousel.tsx +30 -14
- package/src/Carousel/CarouselContext.ts +7 -3
- package/src/Carousel/__tests__/Carousel.asChild.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.auto-play.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.basic-rendering.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.controlled-state.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.error-handling.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.ids.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.imperative-api.test.tsx +2 -2
- package/src/Carousel/__tests__/Carousel.indicators.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.intersection-observer.test.tsx +2 -2
- package/src/Carousel/__tests__/Carousel.keyboard-navigation.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.play-pause.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.prev-next.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.reduced-motion.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.refresh-progress.test.tsx +2 -2
- package/src/Carousel/__tests__/Carousel.scroll-snap-change.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.scroll-sync.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.slides-per-move.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.slides-per-page.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.touch-interaction.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.transition-modes.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.translations.test.tsx +1 -1
- package/src/Carousel/__tests__/Carousel.uncontrolled-state.test.tsx +1 -1
- package/src/Carousel/types.ts +8 -0
- package/src/Checkbox/Checkbox.tsx +11 -6
- package/src/Checkbox/CheckboxContext.ts +1 -1
- package/src/Checkbox/hooks/useCheckboxRoot.ts +1 -1
- package/src/Checkbox/index.ts +1 -0
- package/src/Checkbox/types.ts +30 -3
- package/src/CheckboxCard/CheckboxCard.tsx +13 -11
- package/src/CheckboxCard/CheckboxCardContext.ts +19 -6
- package/src/CheckboxCard/hooks/useCheckboxCardRoot.ts +2 -2
- package/src/CheckboxCard/types.ts +21 -5
- package/src/Collapsible/Collapsible.tsx +37 -21
- package/src/Collapsible/CollapsibleContext.ts +1 -1
- package/src/Collapsible/hooks/useCollapsibleRoot.ts +1 -1
- package/src/Collapsible/hooks/useCollapsibleTrigger.ts +1 -1
- package/src/Collapsible/index.ts +1 -0
- package/src/Collapsible/types.ts +45 -12
- package/src/ContextMenu/ContextMenu.tsx +60 -34
- package/src/ContextMenu/ContextMenuContext.ts +2 -2
- package/src/ContextMenu/ContextMenuSubContext.ts +1 -1
- package/src/ContextMenu/__tests__/ContextMenu.reading-direction.test.tsx +1 -1
- package/src/ContextMenu/index.ts +2 -1
- package/src/ContextMenu/types.ts +160 -17
- package/src/DirectionProvider/DirectionProvider.tsx +7 -1
- package/src/DirectionProvider/__tests__/DirectionProvider.test.tsx +1 -1
- package/src/DirectionProvider/types.ts +1 -0
- package/src/Divider/Divider.tsx +4 -1
- package/src/Divider/__tests__/Divider.test.tsx +1 -1
- package/src/Divider/index.ts +2 -1
- package/src/Divider/types.ts +5 -0
- package/src/Dropdown/Dropdown.tsx +60 -34
- package/src/Dropdown/DropdownContext.ts +2 -2
- package/src/Dropdown/DropdownSubContext.ts +1 -1
- package/src/Dropdown/__tests__/Dropdown.reading-direction.test.tsx +1 -1
- package/src/Dropdown/hooks/useDropdownContent.ts +1 -1
- package/src/Dropdown/hooks/useDropdownItem.ts +1 -1
- package/src/Dropdown/hooks/useDropdownRoot.ts +2 -2
- package/src/Dropdown/hooks/useDropdownTrigger.ts +1 -1
- package/src/Dropdown/index.ts +2 -1
- package/src/Dropdown/types.ts +153 -25
- package/src/EmptyState/EmptyState.tsx +34 -20
- package/src/EmptyState/__tests__/EmptyState.Actions.test.tsx +1 -1
- package/src/EmptyState/__tests__/EmptyState.Description.test.tsx +1 -1
- package/src/EmptyState/__tests__/EmptyState.Media.test.tsx +1 -1
- package/src/EmptyState/__tests__/EmptyState.Root.test.tsx +1 -1
- package/src/EmptyState/__tests__/EmptyState.Title.test.tsx +1 -1
- package/src/EmptyState/types.ts +2 -1
- package/src/Field/Field.tsx +24 -10
- package/src/Field/FieldContext.ts +1 -1
- package/src/Field/types.ts +4 -0
- package/src/Fieldset/Fieldset.tsx +26 -10
- package/src/Fieldset/types.ts +2 -0
- package/src/Input/Input.tsx +6 -3
- package/src/Input/__tests__/Input.field-integration.test.tsx +1 -1
- package/src/Input/types.ts +4 -0
- package/src/InputGroup/InputGroup.tsx +15 -8
- package/src/InputGroup/types.ts +9 -0
- package/src/MillerColumns/MillerColumns.tsx +28 -8
- package/src/MillerColumns/MillerColumnsContext.ts +1 -1
- package/src/MillerColumns/hooks/useMillerColumnsItem.ts +2 -2
- package/src/MillerColumns/hooks/useMillerColumnsRoot.ts +0 -0
- package/src/MillerColumns/index.ts +1 -1
- package/src/MillerColumns/types.ts +67 -14
- package/src/MillerColumns/useMillerColumnsSelection.ts +1 -1
- package/src/Modal/Modal.tsx +25 -11
- package/src/Modal/ModalContext.ts +14 -7
- package/src/Modal/hooks/useModalRoot.ts +1 -1
- package/src/Modal/hooks/useModalTrigger.ts +2 -2
- package/src/Modal/types.ts +51 -2
- package/src/Portal/Portal.tsx +3 -1
- package/src/Portal/types.ts +4 -0
- package/src/Progress/Progress.tsx +12 -7
- package/src/Progress/ProgressContext.ts +18 -6
- package/src/RadioCard/RadioCard.tsx +17 -11
- package/src/RadioCard/RadioCardContext.ts +17 -5
- package/src/RadioCard/RadioCardItemContext.ts +18 -5
- package/src/RadioCard/__tests__/RadioCard.reading-direction.test.tsx +1 -1
- package/src/RadioCard/hooks/useRadioCardRoot.ts +1 -1
- package/src/RadioCard/types.ts +24 -3
- package/src/RadioGroup/RadioGroup.tsx +17 -11
- package/src/RadioGroup/RadioGroupContext.ts +1 -1
- package/src/RadioGroup/RadioGroupItemContext.ts +1 -1
- package/src/RadioGroup/__tests__/RadioGroup.reading-direction.test.tsx +1 -1
- package/src/RadioGroup/hooks/useRadioGroupRoot.ts +1 -1
- package/src/RadioGroup/index.ts +1 -0
- package/src/RadioGroup/types.ts +34 -3
- package/src/Select/Select.tsx +23 -8
- package/src/Select/__tests__/Select.field-integration.test.tsx +1 -1
- package/src/Select/index.ts +1 -1
- package/src/Select/types.ts +18 -3
- package/src/SkipNav/SkipNav.tsx +7 -2
- package/src/SkipNav/__tests__/SkipNav.ids.test.tsx +1 -1
- package/src/Slider/Slider.tsx +26 -11
- package/src/Slider/SliderContext.ts +13 -6
- package/src/Slider/__tests__/Slider.reading-direction.test.tsx +1 -1
- package/src/Slider/hooks/useSliderRoot.ts +1 -1
- package/src/Slider/types.ts +12 -3
- package/src/Status/Status.tsx +9 -2
- package/src/Status/__tests__/Status.test.tsx +1 -1
- package/src/Status/types.ts +4 -0
- package/src/Switch/Switch.tsx +16 -6
- package/src/Switch/SwitchContext.ts +13 -5
- package/src/Switch/hooks/useSwitchRoot.ts +1 -1
- package/src/Switch/types.ts +24 -3
- package/src/Table/Table.tsx +51 -25
- package/src/Table/__tests__/Table.Body.test.tsx +1 -1
- package/src/Table/__tests__/Table.Caption.test.tsx +1 -1
- package/src/Table/__tests__/Table.Cell.test.tsx +1 -1
- package/src/Table/__tests__/Table.Footer.test.tsx +1 -1
- package/src/Table/__tests__/Table.Head.test.tsx +1 -1
- package/src/Table/__tests__/Table.Header.test.tsx +1 -1
- package/src/Table/__tests__/Table.Root.test.tsx +1 -1
- package/src/Table/__tests__/Table.Row.test.tsx +1 -1
- package/src/Table/__tests__/Table.ScrollArea.test.tsx +1 -1
- package/src/Table/index.ts +2 -1
- package/src/Tabs/Tabs.tsx +30 -10
- package/src/Tabs/TabsContext.ts +15 -7
- package/src/Tabs/__tests__/Tabs.asChild.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.basic-rendering.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.change-event-callbacks.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.controlled-state.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.error-handling.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.imperative-api.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.keyboard-interaction.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.lazy-mount.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.mouse-interaction.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.reading-direction.test.tsx +1 -1
- package/src/Tabs/__tests__/Tabs.uncontrolled-state.test.tsx +1 -1
- package/src/Tabs/hooks/useTabsContent.ts +1 -1
- package/src/Tabs/hooks/useTabsRoot.ts +1 -1
- package/src/Tabs/hooks/useTabsTrigger.ts +1 -1
- package/src/Tabs/types.ts +35 -1
- package/src/Tabs/utils.ts +1 -1
- package/src/Textarea/Textarea.tsx +6 -3
- package/src/Textarea/__tests__/Textarea.field-integration.test.tsx +1 -1
- package/src/Textarea/types.ts +4 -0
- package/src/Toggle/Toggle.tsx +11 -4
- package/src/Toggle/types.ts +7 -3
- package/src/ToggleGroup/ToggleGroup.tsx +23 -13
- package/src/ToggleGroup/ToggleGroupContext.ts +1 -1
- package/src/ToggleGroup/__tests__/ToggleGroup.reading-direction.test.tsx +1 -1
- package/src/ToggleGroup/hooks/useToggleGroupRoot.ts +1 -1
- package/src/ToggleGroup/types.ts +45 -5
- package/src/Tooltip/Tooltip.tsx +46 -15
- package/src/Tooltip/TooltipContext.ts +1 -1
- package/src/Tooltip/hooks/useTooltipContent.ts +1 -1
- package/src/Tooltip/hooks/useTooltipRoot.ts +1 -1
- package/src/Tooltip/hooks/useTooltipTrigger.ts +1 -1
- package/src/Tooltip/index.ts +1 -0
- package/src/Tooltip/types.ts +50 -2
- package/src/Tree/Tree.tsx +58 -12
- package/src/Tree/TreeContext.ts +1 -1
- package/src/Tree/__tests__/Tree.selection-path.test.tsx +2 -2
- package/src/Tree/hooks/useTreeItemKeyboard.ts +1 -1
- package/src/Tree/hooks/useTreeRoot.ts +1 -1
- package/src/Tree/index.ts +1 -1
- package/src/Tree/types.ts +39 -7
- package/src/VisuallyHidden/VisuallyHidden.tsx +4 -2
- package/src/VisuallyHidden/__tests__/VisuallyHidden.test.tsx +1 -1
- package/src/VisuallyHidden/types.ts +4 -0
- package/src/index.ts +39 -38
- package/src/types.ts +1 -0
- package/src/utils/createStrictContext.ts +9 -5
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
|
|
1
3
|
import { FieldsetLegendProps, FieldsetProps } from "./types";
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -27,7 +29,11 @@ import { FieldsetLegendProps, FieldsetProps } from "./types";
|
|
|
27
29
|
* </Fieldset.Root>
|
|
28
30
|
* ```
|
|
29
31
|
*/
|
|
30
|
-
function
|
|
32
|
+
export function FieldsetRoot({
|
|
33
|
+
disabled,
|
|
34
|
+
children,
|
|
35
|
+
...rest
|
|
36
|
+
}: FieldsetProps): ReactElement {
|
|
31
37
|
return (
|
|
32
38
|
<fieldset
|
|
33
39
|
{...rest}
|
|
@@ -39,7 +45,8 @@ function Fieldset({ disabled, children, ...rest }: FieldsetProps) {
|
|
|
39
45
|
);
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
/** @internal */
|
|
49
|
+
FieldsetRoot.displayName = "Fieldset";
|
|
43
50
|
|
|
44
51
|
/**
|
|
45
52
|
* The caption for a {@link Fieldset} — renders a native `<legend>`.
|
|
@@ -53,22 +60,25 @@ Fieldset.displayName = "Fieldset";
|
|
|
53
60
|
* <Fieldset.Legend>Shipping address</Fieldset.Legend>
|
|
54
61
|
* ```
|
|
55
62
|
*/
|
|
56
|
-
function FieldsetLegend({
|
|
63
|
+
export function FieldsetLegend({
|
|
64
|
+
children,
|
|
65
|
+
...rest
|
|
66
|
+
}: FieldsetLegendProps): ReactElement {
|
|
57
67
|
return <legend {...rest}>{children}</legend>;
|
|
58
68
|
}
|
|
59
69
|
|
|
70
|
+
/** @internal */
|
|
60
71
|
FieldsetLegend.displayName = "FieldsetLegend";
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
/**
|
|
74
|
+
* The shape of the exported `Fieldset` value — callable as
|
|
75
|
+
* `Fieldset.Root` and carrying `Root` and `Legend` as static properties.
|
|
76
|
+
*/
|
|
77
|
+
export type FieldsetCompound = typeof FieldsetRoot & {
|
|
78
|
+
Root: typeof FieldsetRoot;
|
|
64
79
|
Legend: typeof FieldsetLegend;
|
|
65
80
|
};
|
|
66
81
|
|
|
67
|
-
const FieldsetCompound: FieldsetCompound = Object.assign(Fieldset, {
|
|
68
|
-
Root: Fieldset,
|
|
69
|
-
Legend: FieldsetLegend,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
82
|
/**
|
|
73
83
|
* Headless, accessible **Fieldset** — a stateless compound component that
|
|
74
84
|
* groups related form controls, with zero styles.
|
|
@@ -99,6 +109,12 @@ const FieldsetCompound: FieldsetCompound = Object.assign(Fieldset, {
|
|
|
99
109
|
* </Fieldset.Root>
|
|
100
110
|
* ```
|
|
101
111
|
*/
|
|
112
|
+
const FieldsetCompound: FieldsetCompound = Object.assign(FieldsetRoot, {
|
|
113
|
+
Root: FieldsetRoot,
|
|
114
|
+
Legend: FieldsetLegend,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
/** @internal */
|
|
102
118
|
FieldsetCompound.displayName = "Fieldset";
|
|
103
119
|
|
|
104
120
|
export { FieldsetCompound as Fieldset };
|
package/src/Fieldset/types.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
|
|
3
|
+
/** Props for `Fieldset.Root` — the native `<fieldset>` attributes. */
|
|
3
4
|
export type FieldsetProps = ComponentProps<"fieldset">;
|
|
4
5
|
|
|
6
|
+
/** Props for `Fieldset.Legend` — the native `<legend>` attributes. */
|
|
5
7
|
export type FieldsetLegendProps = ComponentProps<"legend">;
|
package/src/Input/Input.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
import { useFieldProps } from "../Field/hooks/index.ts";
|
|
4
|
+
import { Slot } from "../Slot/index.ts";
|
|
3
5
|
import { InputProps } from "./types";
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -101,7 +103,7 @@ export function Input({
|
|
|
101
103
|
children,
|
|
102
104
|
ref,
|
|
103
105
|
...consumer
|
|
104
|
-
}: InputProps) {
|
|
106
|
+
}: InputProps): ReactElement {
|
|
105
107
|
const merged = useFieldProps(consumer);
|
|
106
108
|
|
|
107
109
|
const rootProps = {
|
|
@@ -117,4 +119,5 @@ export function Input({
|
|
|
117
119
|
return <input type={type} {...rootProps} />;
|
|
118
120
|
}
|
|
119
121
|
|
|
122
|
+
/** @internal */
|
|
120
123
|
Input.displayName = "Input";
|
package/src/Input/types.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode, Ref } from "react";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link Input} — all native `<input>` attributes plus the
|
|
5
|
+
* `asChild` escape hatch and a typed `ref`.
|
|
6
|
+
*/
|
|
3
7
|
export type InputProps = ComponentProps<"input"> & {
|
|
4
8
|
asChild?: boolean;
|
|
5
9
|
ref?: Ref<HTMLInputElement>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
import { Slot } from "../Slot/index.ts";
|
|
2
4
|
import { InputGroupAdornmentProps, InputGroupRootProps } from "./types";
|
|
3
5
|
|
|
4
6
|
/**
|
|
@@ -34,12 +36,12 @@ import { InputGroupAdornmentProps, InputGroupRootProps } from "./types";
|
|
|
34
36
|
* </InputGroup>
|
|
35
37
|
* ```
|
|
36
38
|
*/
|
|
37
|
-
function InputGroupRoot({
|
|
39
|
+
export function InputGroupRoot({
|
|
38
40
|
asChild = false,
|
|
39
41
|
children,
|
|
40
42
|
ref,
|
|
41
43
|
...rest
|
|
42
|
-
}: InputGroupRootProps) {
|
|
44
|
+
}: InputGroupRootProps): ReactElement {
|
|
43
45
|
const rootProps = {
|
|
44
46
|
...rest,
|
|
45
47
|
ref,
|
|
@@ -53,6 +55,7 @@ function InputGroupRoot({
|
|
|
53
55
|
return <div {...rootProps}>{children}</div>;
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
/** @internal */
|
|
56
59
|
InputGroupRoot.displayName = "InputGroupRoot";
|
|
57
60
|
|
|
58
61
|
/**
|
|
@@ -89,12 +92,12 @@ InputGroupRoot.displayName = "InputGroupRoot";
|
|
|
89
92
|
* </InputGroup.LeadingAdornment>
|
|
90
93
|
* ```
|
|
91
94
|
*/
|
|
92
|
-
function InputGroupLeadingAdornment({
|
|
95
|
+
export function InputGroupLeadingAdornment({
|
|
93
96
|
asChild = false,
|
|
94
97
|
children,
|
|
95
98
|
ref,
|
|
96
99
|
...rest
|
|
97
|
-
}: InputGroupAdornmentProps) {
|
|
100
|
+
}: InputGroupAdornmentProps): ReactElement {
|
|
98
101
|
const adornmentProps = {
|
|
99
102
|
...rest,
|
|
100
103
|
ref,
|
|
@@ -108,6 +111,7 @@ function InputGroupLeadingAdornment({
|
|
|
108
111
|
return <span {...adornmentProps}>{children}</span>;
|
|
109
112
|
}
|
|
110
113
|
|
|
114
|
+
/** @internal */
|
|
111
115
|
InputGroupLeadingAdornment.displayName = "InputGroupLeadingAdornment";
|
|
112
116
|
|
|
113
117
|
/**
|
|
@@ -136,12 +140,12 @@ InputGroupLeadingAdornment.displayName = "InputGroupLeadingAdornment";
|
|
|
136
140
|
* </InputGroup.TrailingAdornment>
|
|
137
141
|
* ```
|
|
138
142
|
*/
|
|
139
|
-
function InputGroupTrailingAdornment({
|
|
143
|
+
export function InputGroupTrailingAdornment({
|
|
140
144
|
asChild = false,
|
|
141
145
|
children,
|
|
142
146
|
ref,
|
|
143
147
|
...rest
|
|
144
|
-
}: InputGroupAdornmentProps) {
|
|
148
|
+
}: InputGroupAdornmentProps): ReactElement {
|
|
145
149
|
const adornmentProps = {
|
|
146
150
|
...rest,
|
|
147
151
|
ref,
|
|
@@ -155,9 +159,11 @@ function InputGroupTrailingAdornment({
|
|
|
155
159
|
return <span {...adornmentProps}>{children}</span>;
|
|
156
160
|
}
|
|
157
161
|
|
|
162
|
+
/** @internal */
|
|
158
163
|
InputGroupTrailingAdornment.displayName = "InputGroupTrailingAdornment";
|
|
159
164
|
|
|
160
|
-
|
|
165
|
+
/** Type of the {@link InputGroup} compound: the root callable plus its attached sub-components. */
|
|
166
|
+
export type TInputGroupCompound = typeof InputGroupRoot & {
|
|
161
167
|
Root: typeof InputGroupRoot;
|
|
162
168
|
LeadingAdornment: typeof InputGroupLeadingAdornment;
|
|
163
169
|
TrailingAdornment: typeof InputGroupTrailingAdornment;
|
|
@@ -223,6 +229,7 @@ const InputGroupCompound: TInputGroupCompound = Object.assign(InputGroupRoot, {
|
|
|
223
229
|
TrailingAdornment: InputGroupTrailingAdornment,
|
|
224
230
|
});
|
|
225
231
|
|
|
232
|
+
/** @internal */
|
|
226
233
|
InputGroupCompound.displayName = "InputGroup";
|
|
227
234
|
|
|
228
235
|
export { InputGroupCompound as InputGroup };
|
package/src/InputGroup/types.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode, Ref } from "react";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link InputGroup.Root} — all `<div>` attributes plus the
|
|
5
|
+
* `asChild` escape hatch and a typed `ref`.
|
|
6
|
+
*/
|
|
3
7
|
export type InputGroupRootProps = ComponentProps<"div"> & {
|
|
4
8
|
asChild?: boolean;
|
|
5
9
|
ref?: Ref<HTMLDivElement>;
|
|
6
10
|
children?: ReactNode;
|
|
7
11
|
};
|
|
8
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Props for {@link InputGroup.LeadingAdornment} and
|
|
15
|
+
* {@link InputGroup.TrailingAdornment} — all `<span>` attributes plus the
|
|
16
|
+
* `asChild` escape hatch and a typed `ref`.
|
|
17
|
+
*/
|
|
9
18
|
export type InputGroupAdornmentProps = ComponentProps<"span"> & {
|
|
10
19
|
asChild?: boolean;
|
|
11
20
|
ref?: Ref<HTMLSpanElement>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Ref } from "react";
|
|
2
|
+
import type { ReactElement, ReactPortal } from "react";
|
|
2
3
|
import { createPortal } from "react-dom";
|
|
3
4
|
|
|
4
|
-
import { Slot } from "../Slot";
|
|
5
|
+
import { Slot } from "../Slot/index.ts";
|
|
5
6
|
|
|
6
7
|
import {
|
|
7
8
|
MillerColumnsContext,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
useMillerColumnsItemContext,
|
|
16
17
|
useMillerColumnsResizeHandle,
|
|
17
18
|
useMillerColumnsRoot,
|
|
18
|
-
} from "./hooks";
|
|
19
|
+
} from "./hooks/index.ts";
|
|
19
20
|
|
|
20
21
|
import { partitionItemChildren } from "./utils";
|
|
21
22
|
|
|
@@ -53,7 +54,7 @@ export function MillerColumnsRoot({
|
|
|
53
54
|
value,
|
|
54
55
|
onValueChange,
|
|
55
56
|
...rest
|
|
56
|
-
}: MillerColumnsRootProps) {
|
|
57
|
+
}: MillerColumnsRootProps): ReactElement {
|
|
57
58
|
const { contextValue, columnCount, registerSlotRef, stripRef } =
|
|
58
59
|
useMillerColumnsRoot(value, defaultValue, onValueChange);
|
|
59
60
|
|
|
@@ -80,6 +81,7 @@ export function MillerColumnsRoot({
|
|
|
80
81
|
);
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
/** @internal */
|
|
83
85
|
MillerColumnsRoot.displayName = "MillerColumnsRoot";
|
|
84
86
|
|
|
85
87
|
/**
|
|
@@ -99,7 +101,7 @@ export function MillerColumnsColumn({
|
|
|
99
101
|
children,
|
|
100
102
|
style,
|
|
101
103
|
...rest
|
|
102
|
-
}: MillerColumnsColumnProps) {
|
|
104
|
+
}: MillerColumnsColumnProps): ReactPortal | null {
|
|
103
105
|
const { slot, depth, width, columnContextValue } = useMillerColumnsColumn();
|
|
104
106
|
|
|
105
107
|
if (!slot) {
|
|
@@ -122,6 +124,7 @@ export function MillerColumnsColumn({
|
|
|
122
124
|
);
|
|
123
125
|
}
|
|
124
126
|
|
|
127
|
+
/** @internal */
|
|
125
128
|
MillerColumnsColumn.displayName = "MillerColumnsColumn";
|
|
126
129
|
|
|
127
130
|
/**
|
|
@@ -166,7 +169,7 @@ export function MillerColumnsItem<T extends HTMLElement = HTMLDivElement>({
|
|
|
166
169
|
ref,
|
|
167
170
|
asChild = false,
|
|
168
171
|
...props
|
|
169
|
-
}: MillerColumnsItemProps<T>) {
|
|
172
|
+
}: MillerColumnsItemProps<T>): ReactElement {
|
|
170
173
|
const { cell, column } = partitionItemChildren(children);
|
|
171
174
|
const { itemProps, selected, itemContextValue } = useMillerColumnsItem(
|
|
172
175
|
{ ref: ref as Ref<HTMLDivElement>, ...props },
|
|
@@ -185,6 +188,7 @@ export function MillerColumnsItem<T extends HTMLElement = HTMLDivElement>({
|
|
|
185
188
|
);
|
|
186
189
|
}
|
|
187
190
|
|
|
191
|
+
/** @internal */
|
|
188
192
|
MillerColumnsItem.displayName = "MillerColumnsItem";
|
|
189
193
|
|
|
190
194
|
/**
|
|
@@ -212,7 +216,7 @@ MillerColumnsItem.displayName = "MillerColumnsItem";
|
|
|
212
216
|
export function MillerColumnsItemIndicator({
|
|
213
217
|
children,
|
|
214
218
|
...rest
|
|
215
|
-
}: MillerColumnsItemIndicatorProps) {
|
|
219
|
+
}: MillerColumnsItemIndicatorProps): ReactElement | null {
|
|
216
220
|
const { selected, hasChildren } = useMillerColumnsItemContext();
|
|
217
221
|
|
|
218
222
|
if (!hasChildren) {
|
|
@@ -231,6 +235,7 @@ export function MillerColumnsItemIndicator({
|
|
|
231
235
|
);
|
|
232
236
|
}
|
|
233
237
|
|
|
238
|
+
/** @internal */
|
|
234
239
|
MillerColumnsItemIndicator.displayName = "MillerColumnsItemIndicator";
|
|
235
240
|
|
|
236
241
|
/**
|
|
@@ -252,12 +257,13 @@ MillerColumnsItemIndicator.displayName = "MillerColumnsItemIndicator";
|
|
|
252
257
|
*/
|
|
253
258
|
export function MillerColumnsResizeHandle(
|
|
254
259
|
props: MillerColumnsResizeHandleProps,
|
|
255
|
-
) {
|
|
260
|
+
): ReactElement {
|
|
256
261
|
const { handleProps } = useMillerColumnsResizeHandle(props);
|
|
257
262
|
|
|
258
263
|
return <div {...handleProps} />;
|
|
259
264
|
}
|
|
260
265
|
|
|
266
|
+
/** @internal */
|
|
261
267
|
MillerColumnsResizeHandle.displayName = "MillerColumnsResizeHandle";
|
|
262
268
|
|
|
263
269
|
/**
|
|
@@ -291,7 +297,7 @@ MillerColumnsResizeHandle.displayName = "MillerColumnsResizeHandle";
|
|
|
291
297
|
export function MillerColumnsPreviewPanel({
|
|
292
298
|
children,
|
|
293
299
|
...rest
|
|
294
|
-
}: MillerColumnsPreviewPanelProps) {
|
|
300
|
+
}: MillerColumnsPreviewPanelProps): ReactElement {
|
|
295
301
|
useMillerColumnsContext();
|
|
296
302
|
|
|
297
303
|
return (
|
|
@@ -301,17 +307,31 @@ export function MillerColumnsPreviewPanel({
|
|
|
301
307
|
);
|
|
302
308
|
}
|
|
303
309
|
|
|
310
|
+
/** @internal */
|
|
304
311
|
MillerColumnsPreviewPanel.displayName = "MillerColumnsPreviewPanel";
|
|
305
312
|
|
|
313
|
+
/** Type of the {@link MillerColumns} compound — the Root callable plus its sub-components. */
|
|
306
314
|
type MillerColumnsCompound = typeof MillerColumnsRoot & {
|
|
315
|
+
/** The root strip, owning selection state and portal slots. */
|
|
307
316
|
Root: typeof MillerColumnsRoot;
|
|
317
|
+
/** A single vertical list within the strip. */
|
|
308
318
|
Column: typeof MillerColumnsColumn;
|
|
319
|
+
/** A selectable node within a column. */
|
|
309
320
|
Item: typeof MillerColumnsItem;
|
|
321
|
+
/** The branch-item chevron affordance. */
|
|
310
322
|
ItemIndicator: typeof MillerColumnsItemIndicator;
|
|
323
|
+
/** The drag-to-resize separator. */
|
|
311
324
|
ResizeHandle: typeof MillerColumnsResizeHandle;
|
|
325
|
+
/** The trailing preview pane. */
|
|
312
326
|
PreviewPanel: typeof MillerColumnsPreviewPanel;
|
|
313
327
|
};
|
|
314
328
|
|
|
329
|
+
/**
|
|
330
|
+
* MillerColumns — a horizontal strip of vertical lists where selecting a
|
|
331
|
+
* node reveals its children in the next column. Use as a namespace
|
|
332
|
+
* (`MillerColumns.Root`, `MillerColumns.Column`, `MillerColumns.Item`, …);
|
|
333
|
+
* the default export is also callable as the Root.
|
|
334
|
+
*/
|
|
315
335
|
const MillerColumnsCompound: MillerColumnsCompound = Object.assign(
|
|
316
336
|
MillerColumnsRoot,
|
|
317
337
|
{
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
useRef,
|
|
8
8
|
} from "react";
|
|
9
9
|
|
|
10
|
-
import { useRovingTabindex } from "../../hooks";
|
|
11
|
-
import { composeRefs } from "../../Slot";
|
|
10
|
+
import { useRovingTabindex } from "../../hooks/index.ts";
|
|
11
|
+
import { composeRefs } from "../../Slot/index.ts";
|
|
12
12
|
|
|
13
13
|
import type {
|
|
14
14
|
MillerColumnsItemContextValue,
|
|
Binary file
|
|
@@ -1,51 +1,80 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode, Ref } from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/** Props common to both controlled and uncontrolled `MillerColumns.Root` modes. */
|
|
4
|
+
export type MillerColumnsRootBaseProps = Omit<ComponentProps<"div">, "ref"> & {
|
|
5
|
+
/** The columns and panels that make up the strip. */
|
|
4
6
|
children: ReactNode;
|
|
5
7
|
};
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Props for `MillerColumns.Root` in uncontrolled mode — the component owns the
|
|
11
|
+
* selection path. Pass `defaultValue` to set the initial path.
|
|
12
|
+
*/
|
|
13
|
+
export type MillerColumnsRootUncontrolledProps = MillerColumnsRootBaseProps & {
|
|
14
|
+
/** Initial selection path when uncontrolled. */
|
|
8
15
|
defaultValue?: string[];
|
|
16
|
+
/** Forbidden in uncontrolled mode. */
|
|
9
17
|
value?: never;
|
|
18
|
+
/** Forbidden in uncontrolled mode. */
|
|
10
19
|
onValueChange?: never;
|
|
11
20
|
};
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Props for `MillerColumns.Root` in controlled mode — the parent owns the
|
|
24
|
+
* selection path. Pass `value` and `onValueChange` together.
|
|
25
|
+
*/
|
|
26
|
+
export type MillerColumnsRootControlledProps = MillerColumnsRootBaseProps & {
|
|
27
|
+
/** Forbidden in controlled mode. */
|
|
14
28
|
defaultValue?: never;
|
|
29
|
+
/** The controlled selection path, root column first. */
|
|
15
30
|
value: string[];
|
|
31
|
+
/** Called with the new path whenever the selection changes. */
|
|
16
32
|
onValueChange: (path: string[]) => void;
|
|
17
33
|
};
|
|
18
34
|
|
|
35
|
+
/** Props for `MillerColumns.Root` — discriminated controlled/uncontrolled union. */
|
|
19
36
|
export type MillerColumnsRootProps =
|
|
20
37
|
| MillerColumnsRootUncontrolledProps
|
|
21
38
|
| MillerColumnsRootControlledProps;
|
|
22
39
|
|
|
40
|
+
/** Props for `MillerColumns.Column`, a single vertical list within the strip. */
|
|
23
41
|
export type MillerColumnsColumnProps = ComponentProps<"div"> & {
|
|
42
|
+
/** The items (and optional resize handle) of this column. */
|
|
24
43
|
children: ReactNode;
|
|
25
44
|
};
|
|
26
45
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
/** Props for `MillerColumns.Item`, a single selectable node within a column. */
|
|
47
|
+
export type MillerColumnsItemProps<T extends HTMLElement = HTMLDivElement> =
|
|
48
|
+
Omit<ComponentProps<"div">, "ref"> & {
|
|
49
|
+
/** Stable identifier used to match this item against the selection path. */
|
|
50
|
+
value: string;
|
|
51
|
+
/** When `true`, the item cannot be selected or focused. */
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
/** Render the child element instead of the default `<div>`. */
|
|
54
|
+
asChild?: boolean;
|
|
55
|
+
/** Cell content and, for a branch, a nested `<MillerColumns.Column>`. */
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
/** Ref to the rendered element. Defaults to `HTMLDivElement`; when using
|
|
58
|
+
* `asChild`, specify the child's element type. */
|
|
59
|
+
ref?: Ref<T>;
|
|
60
|
+
};
|
|
38
61
|
|
|
62
|
+
/** Props for `MillerColumns.ItemIndicator`, the branch chevron affordance. */
|
|
39
63
|
export type MillerColumnsItemIndicatorProps = ComponentProps<"span"> & {
|
|
64
|
+
/** The glyph to render (defaults to none). */
|
|
40
65
|
children?: ReactNode;
|
|
41
66
|
};
|
|
42
67
|
|
|
68
|
+
/** Props for `MillerColumns.ResizeHandle`, the drag-to-resize separator. */
|
|
43
69
|
export type MillerColumnsResizeHandleProps = ComponentProps<"div">;
|
|
44
70
|
|
|
71
|
+
/** Props for `MillerColumns.PreviewPanel`, the trailing preview pane. */
|
|
45
72
|
export type MillerColumnsPreviewPanelProps = ComponentProps<"div"> & {
|
|
73
|
+
/** The preview content for the current selection. */
|
|
46
74
|
children?: ReactNode;
|
|
47
75
|
};
|
|
48
76
|
|
|
77
|
+
/** The current selection, as returned by `useMillerColumnsSelection`. */
|
|
49
78
|
export type MillerColumnsSelection = {
|
|
50
79
|
/** The full active path — selected item ids, root column first. */
|
|
51
80
|
path: string[];
|
|
@@ -53,41 +82,65 @@ export type MillerColumnsSelection = {
|
|
|
53
82
|
selectedValue: string | undefined;
|
|
54
83
|
};
|
|
55
84
|
|
|
85
|
+
/** Metadata recorded for each registered item, used for column navigation. */
|
|
56
86
|
export type MillerColumnsItemMeta = {
|
|
87
|
+
/** The item's stable identifier. */
|
|
57
88
|
value: string;
|
|
89
|
+
/** Whether the item is disabled. */
|
|
58
90
|
disabled: boolean;
|
|
59
91
|
};
|
|
60
92
|
|
|
93
|
+
/** A depth + value pair locating an item within the strip. */
|
|
61
94
|
export type MillerColumnsItemAddress = {
|
|
95
|
+
/** The zero-based column depth. */
|
|
62
96
|
depth: number;
|
|
97
|
+
/** The item's stable identifier. */
|
|
63
98
|
value: string;
|
|
64
99
|
};
|
|
65
100
|
|
|
101
|
+
/** Value shared through the root MillerColumns context. */
|
|
66
102
|
export type MillerColumnsContextValue = {
|
|
103
|
+
/** Portal slots keyed by column depth. */
|
|
67
104
|
slots: Map<number, HTMLElement>;
|
|
105
|
+
/** Per-depth column widths set via the resize handle. */
|
|
68
106
|
columnWidths: Map<number, number>;
|
|
107
|
+
/** Record a column's width at the given depth. */
|
|
69
108
|
setColumnWidth: (depth: number, width: number) => void;
|
|
109
|
+
/** The active selection path. */
|
|
70
110
|
activePath: string[];
|
|
111
|
+
/** Select the item at the given depth and value. */
|
|
71
112
|
select: (depth: number, value: string) => void;
|
|
113
|
+
/** Register (or unregister, with a `null` element) an item. */
|
|
72
114
|
registerItem: (
|
|
73
115
|
depth: number,
|
|
74
116
|
value: string,
|
|
75
117
|
element: HTMLElement | null,
|
|
76
118
|
disabled: boolean,
|
|
77
119
|
) => void;
|
|
120
|
+
/** Get the registered items for a column. */
|
|
78
121
|
getColumnItems: (depth: number) => MillerColumnsItemMeta[];
|
|
122
|
+
/** Move focus to the given item. */
|
|
79
123
|
focusItem: (depth: number, value: string) => void;
|
|
124
|
+
/** Focus the first item in a column; returns whether one was focused. */
|
|
80
125
|
focusFirstInColumn: (depth: number) => boolean;
|
|
126
|
+
/** Request that focus move into the given column. */
|
|
81
127
|
requestColumnFocus: (depth: number) => void;
|
|
128
|
+
/** The currently active (focused) item, if any. */
|
|
82
129
|
activeItem: MillerColumnsItemAddress | null;
|
|
130
|
+
/** Set the active (focused) item. */
|
|
83
131
|
setActiveItem: (item: MillerColumnsItemAddress) => void;
|
|
84
132
|
};
|
|
85
133
|
|
|
134
|
+
/** Value shared through a column's context. */
|
|
86
135
|
export type MillerColumnsColumnContextValue = {
|
|
136
|
+
/** The column's zero-based depth. */
|
|
87
137
|
depth: number;
|
|
88
138
|
};
|
|
89
139
|
|
|
140
|
+
/** Value shared through an item's context. */
|
|
90
141
|
export type MillerColumnsItemContextValue = {
|
|
142
|
+
/** Whether this item is on the active path. */
|
|
91
143
|
selected: boolean;
|
|
144
|
+
/** Whether this item has a nested child column. */
|
|
92
145
|
hasChildren: boolean;
|
|
93
146
|
};
|
package/src/Modal/Modal.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Ref, useEffect, useId } from "react";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
2
3
|
|
|
3
|
-
import { Portal } from "../Portal";
|
|
4
|
-
import { Slot, composeEventHandlers, composeRefs } from "../Slot";
|
|
4
|
+
import { Portal } from "../Portal/index.ts";
|
|
5
|
+
import { Slot, composeEventHandlers, composeRefs } from "../Slot/index.ts";
|
|
5
6
|
|
|
6
7
|
import { ModalProvider } from "./ModalContext";
|
|
7
8
|
import {
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
useModalContext,
|
|
10
11
|
useModalRoot,
|
|
11
12
|
useModalTrigger,
|
|
12
|
-
} from "./hooks";
|
|
13
|
+
} from "./hooks/index.ts";
|
|
13
14
|
import {
|
|
14
15
|
ModalCloseProps,
|
|
15
16
|
ModalContentProps,
|
|
@@ -73,7 +74,7 @@ function ModalRoot({
|
|
|
73
74
|
defaultOpen,
|
|
74
75
|
open,
|
|
75
76
|
onOpenChange,
|
|
76
|
-
}: ModalRootProps) {
|
|
77
|
+
}: ModalRootProps): ReactElement {
|
|
77
78
|
const { contextValue } = useModalRoot(
|
|
78
79
|
{ defaultOpen, open, onOpenChange },
|
|
79
80
|
ref,
|
|
@@ -110,7 +111,7 @@ function ModalTrigger({
|
|
|
110
111
|
type,
|
|
111
112
|
asChild = false,
|
|
112
113
|
...rest
|
|
113
|
-
}: ModalTriggerProps) {
|
|
114
|
+
}: ModalTriggerProps): ReactElement {
|
|
114
115
|
const { getTriggerProps } = useModalTrigger(onClick, rest);
|
|
115
116
|
|
|
116
117
|
if (asChild) {
|
|
@@ -141,7 +142,11 @@ ModalTrigger.displayName = "ModalTrigger";
|
|
|
141
142
|
* </Modal.Portal>
|
|
142
143
|
* ```
|
|
143
144
|
*/
|
|
144
|
-
function ModalPortal({
|
|
145
|
+
function ModalPortal({
|
|
146
|
+
children,
|
|
147
|
+
container,
|
|
148
|
+
forceMount,
|
|
149
|
+
}: ModalPortalProps): ReactElement | null {
|
|
145
150
|
const { open } = useModalContext();
|
|
146
151
|
|
|
147
152
|
if (!open && !forceMount) return null;
|
|
@@ -189,7 +194,7 @@ function ModalOverlay({
|
|
|
189
194
|
asChild = false,
|
|
190
195
|
forceMount,
|
|
191
196
|
...rest
|
|
192
|
-
}: ModalOverlayProps) {
|
|
197
|
+
}: ModalOverlayProps): ReactElement | null {
|
|
193
198
|
const { open } = useModalContext();
|
|
194
199
|
if (!open && !forceMount) return null;
|
|
195
200
|
const overlayProps = {
|
|
@@ -252,7 +257,7 @@ function ModalContent({
|
|
|
252
257
|
onPointerDownOutside,
|
|
253
258
|
ref: externalRef,
|
|
254
259
|
...rest
|
|
255
|
-
}: ModalContentProps & { ref?: Ref<HTMLDialogElement> }) {
|
|
260
|
+
}: ModalContentProps & { ref?: Ref<HTMLDialogElement> }): ReactElement {
|
|
256
261
|
const { ref: innerRef, open, contentId } = useModalContent();
|
|
257
262
|
const { contentCallbacksRef, titleId, descriptionId } = useModalContext();
|
|
258
263
|
// Keep the ref pointed at the latest callbacks so event handlers wired
|
|
@@ -297,7 +302,11 @@ ModalContent.displayName = "ModalContent";
|
|
|
297
302
|
* </Modal.Title>
|
|
298
303
|
* ```
|
|
299
304
|
*/
|
|
300
|
-
function ModalTitle({
|
|
305
|
+
function ModalTitle({
|
|
306
|
+
children,
|
|
307
|
+
asChild = false,
|
|
308
|
+
...rest
|
|
309
|
+
}: ModalTitleProps): ReactElement {
|
|
301
310
|
const { registerTitle } = useModalContext();
|
|
302
311
|
const id = useId();
|
|
303
312
|
|
|
@@ -342,7 +351,7 @@ function ModalDescription({
|
|
|
342
351
|
children,
|
|
343
352
|
asChild = false,
|
|
344
353
|
...rest
|
|
345
|
-
}: ModalDescriptionProps) {
|
|
354
|
+
}: ModalDescriptionProps): ReactElement {
|
|
346
355
|
const { registerDescription } = useModalContext();
|
|
347
356
|
const id = useId();
|
|
348
357
|
|
|
@@ -386,7 +395,11 @@ ModalDescription.displayName = "ModalDescription";
|
|
|
386
395
|
* </Modal.Close>
|
|
387
396
|
* ```
|
|
388
397
|
*/
|
|
389
|
-
function ModalClose({
|
|
398
|
+
function ModalClose({
|
|
399
|
+
onClick,
|
|
400
|
+
asChild = false,
|
|
401
|
+
...rest
|
|
402
|
+
}: ModalCloseProps): ReactElement {
|
|
390
403
|
const { setOpen } = useModalContext();
|
|
391
404
|
const closeProps = {
|
|
392
405
|
...rest,
|
|
@@ -402,6 +415,7 @@ function ModalClose({ onClick, asChild = false, ...rest }: ModalCloseProps) {
|
|
|
402
415
|
|
|
403
416
|
ModalClose.displayName = "ModalClose";
|
|
404
417
|
|
|
418
|
+
/** @internal */
|
|
405
419
|
type ModalCompound = typeof ModalRoot & {
|
|
406
420
|
Root: typeof ModalRoot;
|
|
407
421
|
Trigger: typeof ModalTrigger;
|