@ui-sdk/react 0.0.0-stage → 0.1.0-beta.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 +202 -0
- package/README.md +10 -2
- package/dist/accordion.d.ts +331 -0
- package/dist/accordion.js +25 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +8 -0
- package/dist/alert-dialog.d.ts +56 -0
- package/dist/alert-dialog.js +45 -0
- package/dist/async-options.d.ts +22 -0
- package/dist/async-options.js +56 -0
- package/dist/autocomplete.d.ts +102 -0
- package/dist/autocomplete.js +195 -0
- package/dist/avatar.d.ts +301 -0
- package/dist/avatar.js +17 -0
- package/dist/button.d.ts +21 -0
- package/dist/button.js +45 -0
- package/dist/calendar-context.d.ts +10 -0
- package/dist/calendar-context.js +9 -0
- package/dist/calendar.d.ts +80 -0
- package/dist/calendar.js +257 -0
- package/dist/carousel.d.ts +52 -0
- package/dist/carousel.js +151 -0
- package/dist/checkbox.d.ts +24 -0
- package/dist/checkbox.js +98 -0
- package/dist/children.d.ts +38 -0
- package/dist/children.js +63 -0
- package/dist/collapsible.d.ts +302 -0
- package/dist/collapsible.js +19 -0
- package/dist/color-picker.d.ts +72 -0
- package/dist/color-picker.js +133 -0
- package/dist/color.d.ts +2 -0
- package/dist/color.js +22 -0
- package/dist/combobox.d.ts +152 -0
- package/dist/combobox.js +338 -0
- package/dist/command.d.ts +88 -0
- package/dist/command.js +233 -0
- package/dist/controller-target.d.ts +3 -0
- package/dist/controller-target.js +59 -0
- package/dist/date-input.d.ts +19 -0
- package/dist/date-input.js +58 -0
- package/dist/date-picker.d.ts +47 -0
- package/dist/date-picker.js +310 -0
- package/dist/date.d.ts +2 -0
- package/dist/date.js +60 -0
- package/dist/dialog-parts.d.ts +23 -0
- package/dist/dialog-parts.js +142 -0
- package/dist/dialog.d.ts +57 -0
- package/dist/dialog.js +32 -0
- package/dist/drawer.d.ts +70 -0
- package/dist/drawer.js +158 -0
- package/dist/editor-context.d.ts +4 -0
- package/dist/editor-context.js +9 -0
- package/dist/field-context.d.ts +47 -0
- package/dist/field-context.js +87 -0
- package/dist/field.d.ts +49 -0
- package/dist/field.js +169 -0
- package/dist/file-input.d.ts +46 -0
- package/dist/file-input.js +170 -0
- package/dist/form-inputs.d.ts +5 -0
- package/dist/form-inputs.js +22 -0
- package/dist/gesture.d.ts +1 -0
- package/dist/gesture.js +16 -0
- package/dist/history.d.ts +2 -0
- package/dist/history.js +12 -0
- package/dist/hover-card.d.ts +33 -0
- package/dist/hover-card.js +84 -0
- package/dist/image-cropper.d.ts +333 -0
- package/dist/image-cropper.js +37 -0
- package/dist/image.d.ts +2 -0
- package/dist/image.js +6 -0
- package/dist/input.d.ts +22 -0
- package/dist/input.js +51 -0
- package/dist/label.d.ts +294 -0
- package/dist/label.js +9 -0
- package/dist/list-items.d.ts +15 -0
- package/dist/list-items.js +39 -0
- package/dist/list-text.d.ts +4 -0
- package/dist/list-text.js +15 -0
- package/dist/listbox.d.ts +56 -0
- package/dist/listbox.js +122 -0
- package/dist/menu.d.ts +116 -0
- package/dist/menu.js +426 -0
- package/dist/menubar-context.d.ts +4 -0
- package/dist/menubar-context.js +7 -0
- package/dist/menubar.d.ts +11 -0
- package/dist/menubar.js +32 -0
- package/dist/meter.d.ts +312 -0
- package/dist/meter.js +30 -0
- package/dist/navigation-menu.d.ts +61 -0
- package/dist/navigation-menu.js +169 -0
- package/dist/number-input.d.ts +44 -0
- package/dist/number-input.js +185 -0
- package/dist/number.d.ts +2 -0
- package/dist/number.js +40 -0
- package/dist/observe.d.ts +2 -0
- package/dist/observe.js +8 -0
- package/dist/otp-input.d.ts +29 -0
- package/dist/otp-input.js +94 -0
- package/dist/overlays.d.ts +26 -0
- package/dist/overlays.js +82 -0
- package/dist/pagination.d.ts +336 -0
- package/dist/pagination.js +71 -0
- package/dist/password-input.d.ts +23 -0
- package/dist/password-input.js +65 -0
- package/dist/popover.d.ts +54 -0
- package/dist/popover.js +151 -0
- package/dist/popup.d.ts +41 -0
- package/dist/popup.js +180 -0
- package/dist/preferences.d.ts +35 -0
- package/dist/preferences.js +93 -0
- package/dist/primitive.d.ts +2 -0
- package/dist/primitive.js +14 -0
- package/dist/progress.d.ts +312 -0
- package/dist/progress.js +30 -0
- package/dist/radio.d.ts +22 -0
- package/dist/radio.js +86 -0
- package/dist/rating.d.ts +20 -0
- package/dist/rating.js +94 -0
- package/dist/render-element.d.ts +35 -0
- package/dist/render-element.js +103 -0
- package/dist/resizable.d.ts +302 -0
- package/dist/resizable.js +23 -0
- package/dist/scroll-area.d.ts +324 -0
- package/dist/scroll-area.js +49 -0
- package/dist/segmented-control.d.ts +24 -0
- package/dist/segmented-control.js +78 -0
- package/dist/segmented-input.d.ts +15 -0
- package/dist/segmented-input.js +48 -0
- package/dist/select.d.ts +125 -0
- package/dist/select.js +330 -0
- package/dist/separator.d.ts +290 -0
- package/dist/separator.js +9 -0
- package/dist/shortcuts.d.ts +32 -0
- package/dist/shortcuts.js +61 -0
- package/dist/slider.d.ts +38 -0
- package/dist/slider.js +163 -0
- package/dist/switch.d.ts +15 -0
- package/dist/switch.js +39 -0
- package/dist/tabs.d.ts +331 -0
- package/dist/tabs.js +28 -0
- package/dist/text-control.d.ts +22 -0
- package/dist/text-control.js +24 -0
- package/dist/text-match.d.ts +2 -0
- package/dist/text-match.js +8 -0
- package/dist/textarea.d.ts +10 -0
- package/dist/textarea.js +48 -0
- package/dist/time-input.d.ts +19 -0
- package/dist/time-input.js +63 -0
- package/dist/timeline.d.ts +327 -0
- package/dist/timeline.js +31 -0
- package/dist/toast-parts.d.ts +63 -0
- package/dist/toast-parts.js +144 -0
- package/dist/toast.d.ts +2 -0
- package/dist/toast.js +22 -0
- package/dist/toggle.d.ts +23 -0
- package/dist/toggle.js +76 -0
- package/dist/token-input.d.ts +35 -0
- package/dist/token-input.js +100 -0
- package/dist/toolbar-context.d.ts +6 -0
- package/dist/toolbar-context.js +16 -0
- package/dist/toolbar.d.ts +38 -0
- package/dist/toolbar.js +63 -0
- package/dist/tooltip.d.ts +39 -0
- package/dist/tooltip.js +108 -0
- package/dist/tree.d.ts +51 -0
- package/dist/tree.js +150 -0
- package/dist/trigger-menu.d.ts +83 -0
- package/dist/trigger-menu.js +167 -0
- package/dist/use-primitive.d.ts +178 -0
- package/dist/use-primitive.js +674 -0
- package/dist/waterfall.d.ts +80 -0
- package/dist/waterfall.js +108 -0
- package/docs/README.md +89 -0
- package/docs/agents.md +1523 -0
- package/docs/components/accordion.md +1391 -0
- package/docs/components/alert-dialog.md +850 -0
- package/docs/components/autocomplete.md +1963 -0
- package/docs/components/avatar.md +252 -0
- package/docs/components/button.md +444 -0
- package/docs/components/calendar.md +1687 -0
- package/docs/components/carousel.md +1244 -0
- package/docs/components/checkbox.md +1069 -0
- package/docs/components/collapsible.md +567 -0
- package/docs/components/color-picker.md +736 -0
- package/docs/components/combobox.md +3647 -0
- package/docs/components/command.md +1573 -0
- package/docs/components/date-input.md +608 -0
- package/docs/components/date-picker.md +1266 -0
- package/docs/components/dialog.md +1469 -0
- package/docs/components/drawer.md +1197 -0
- package/docs/components/field.md +549 -0
- package/docs/components/file-input.md +609 -0
- package/docs/components/hover-card.md +514 -0
- package/docs/components/image-cropper.md +579 -0
- package/docs/components/input.md +301 -0
- package/docs/components/label.md +217 -0
- package/docs/components/listbox.md +1130 -0
- package/docs/components/menu.md +1286 -0
- package/docs/components/menubar.md +455 -0
- package/docs/components/meter.md +304 -0
- package/docs/components/navigation-menu.md +1581 -0
- package/docs/components/number-input.md +1086 -0
- package/docs/components/otp-input.md +565 -0
- package/docs/components/pagination.md +648 -0
- package/docs/components/password-input.md +737 -0
- package/docs/components/popover.md +1552 -0
- package/docs/components/preferences.md +220 -0
- package/docs/components/progress.md +443 -0
- package/docs/components/radio.md +846 -0
- package/docs/components/rating.md +458 -0
- package/docs/components/resizable.md +982 -0
- package/docs/components/scroll-area.md +980 -0
- package/docs/components/segmented-control.md +465 -0
- package/docs/components/select.md +2133 -0
- package/docs/components/separator.md +243 -0
- package/docs/components/slider.md +1169 -0
- package/docs/components/switch.md +613 -0
- package/docs/components/tabs.md +1014 -0
- package/docs/components/textarea.md +318 -0
- package/docs/components/time-input.md +231 -0
- package/docs/components/timeline.md +677 -0
- package/docs/components/toast.md +1395 -0
- package/docs/components/toggle.md +541 -0
- package/docs/components/token-input.md +1007 -0
- package/docs/components/toolbar.md +787 -0
- package/docs/components/tooltip.md +884 -0
- package/docs/components/tree.md +1346 -0
- package/docs/components/trigger-menu.md +1257 -0
- package/docs/components/waterfall.md +754 -0
- package/docs/controllers.md +89 -0
- package/docs/core.md +8027 -0
- package/docs/custom-parts.md +120 -0
- package/docs/first-component.md +83 -0
- package/docs/forms.md +148 -0
- package/docs/hooks/async-options.md +366 -0
- package/docs/hooks/shortcuts.md +221 -0
- package/docs/installation.md +45 -0
- package/docs/introduction.md +32 -0
- package/docs/lists-and-menus.md +170 -0
- package/docs/llms.txt +1844 -0
- package/docs/parts-and-composition.md +93 -0
- package/docs/popups.md +117 -0
- package/docs/rendering.md +121 -0
- package/docs/server-rendering.md +253 -0
- package/docs/state-and-events.md +105 -0
- package/docs/styling-and-animation.md +176 -0
- package/package.json +333 -3
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/date-picker.tsx
|
|
3
|
+
import {
|
|
4
|
+
datePicker as datePickerPrimitive
|
|
5
|
+
} from "@ui-sdk/core/date-picker";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import {
|
|
8
|
+
CalendarHeading,
|
|
9
|
+
CalendarGrid,
|
|
10
|
+
CalendarNext,
|
|
11
|
+
CalendarPrevious
|
|
12
|
+
} from "./calendar.js";
|
|
13
|
+
import { CalendarContext } from "./calendar-context.js";
|
|
14
|
+
import { ownDescription, useFieldControl } from "./field-context.js";
|
|
15
|
+
import {
|
|
16
|
+
renderPopup,
|
|
17
|
+
sheetViewport,
|
|
18
|
+
useOwnContainer,
|
|
19
|
+
usePopupContainer
|
|
20
|
+
} from "./popup.js";
|
|
21
|
+
import {
|
|
22
|
+
createParts,
|
|
23
|
+
extendHandle,
|
|
24
|
+
renderElement,
|
|
25
|
+
slotIn,
|
|
26
|
+
usePart,
|
|
27
|
+
usePrimitive
|
|
28
|
+
} from "./use-primitive.js";
|
|
29
|
+
import {
|
|
30
|
+
CalendarDay,
|
|
31
|
+
CalendarGrid as CalendarGrid2,
|
|
32
|
+
CalendarHeading as CalendarHeading2,
|
|
33
|
+
CalendarMonthSelect,
|
|
34
|
+
CalendarNext as CalendarNext2,
|
|
35
|
+
CalendarPrevious as CalendarPrevious2,
|
|
36
|
+
CalendarWeekday,
|
|
37
|
+
CalendarWeekdays,
|
|
38
|
+
CalendarWeeks,
|
|
39
|
+
CalendarYearSelect
|
|
40
|
+
} from "./calendar.js";
|
|
41
|
+
import { createDatePickerController } from "@ui-sdk/core/date-picker";
|
|
42
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
43
|
+
var parts = createParts(datePickerPrimitive, { clear: "button" });
|
|
44
|
+
var DatePickerContext = React.createContext(
|
|
45
|
+
null
|
|
46
|
+
);
|
|
47
|
+
var ContainerContext = React.createContext(void 0);
|
|
48
|
+
function useDatePicker(part) {
|
|
49
|
+
const context = React.useContext(DatePickerContext);
|
|
50
|
+
if (!context) {
|
|
51
|
+
throw new Error(`${part} must be used inside <DatePicker>.`);
|
|
52
|
+
}
|
|
53
|
+
return context;
|
|
54
|
+
}
|
|
55
|
+
function DatePicker({
|
|
56
|
+
mode,
|
|
57
|
+
value,
|
|
58
|
+
defaultValue,
|
|
59
|
+
onValueChange,
|
|
60
|
+
month,
|
|
61
|
+
defaultMonth,
|
|
62
|
+
onMonthChange,
|
|
63
|
+
open,
|
|
64
|
+
defaultOpen,
|
|
65
|
+
onOpenChange,
|
|
66
|
+
onOpenChangeComplete,
|
|
67
|
+
closeOnSelect,
|
|
68
|
+
presentation,
|
|
69
|
+
dismissible,
|
|
70
|
+
onDismissAttempt,
|
|
71
|
+
min,
|
|
72
|
+
max,
|
|
73
|
+
unavailable,
|
|
74
|
+
disabled,
|
|
75
|
+
readOnly,
|
|
76
|
+
months,
|
|
77
|
+
pageBy,
|
|
78
|
+
locale,
|
|
79
|
+
weekStartsOn,
|
|
80
|
+
weekdayFormat,
|
|
81
|
+
monthFormat,
|
|
82
|
+
fixedWeeks,
|
|
83
|
+
showOutsideDays,
|
|
84
|
+
today,
|
|
85
|
+
timeZone,
|
|
86
|
+
minDays,
|
|
87
|
+
maxDays,
|
|
88
|
+
allowUnavailable,
|
|
89
|
+
name,
|
|
90
|
+
startName,
|
|
91
|
+
endName,
|
|
92
|
+
form,
|
|
93
|
+
required,
|
|
94
|
+
container,
|
|
95
|
+
controller,
|
|
96
|
+
debug,
|
|
97
|
+
children,
|
|
98
|
+
...props
|
|
99
|
+
}) {
|
|
100
|
+
const field = useFieldControl();
|
|
101
|
+
const picker = usePrimitive(datePickerPrimitive, {
|
|
102
|
+
mode,
|
|
103
|
+
value,
|
|
104
|
+
defaultValue,
|
|
105
|
+
onValueChange,
|
|
106
|
+
month,
|
|
107
|
+
defaultMonth,
|
|
108
|
+
onMonthChange,
|
|
109
|
+
open,
|
|
110
|
+
defaultOpen,
|
|
111
|
+
onOpenChange,
|
|
112
|
+
onOpenChangeComplete,
|
|
113
|
+
closeOnSelect,
|
|
114
|
+
presentation,
|
|
115
|
+
dismissible,
|
|
116
|
+
onDismissAttempt,
|
|
117
|
+
min,
|
|
118
|
+
max,
|
|
119
|
+
unavailable,
|
|
120
|
+
disabled: disabled || field?.disabled,
|
|
121
|
+
readOnly,
|
|
122
|
+
months,
|
|
123
|
+
pageBy,
|
|
124
|
+
locale,
|
|
125
|
+
weekStartsOn,
|
|
126
|
+
weekdayFormat,
|
|
127
|
+
monthFormat,
|
|
128
|
+
fixedWeeks,
|
|
129
|
+
showOutsideDays,
|
|
130
|
+
today,
|
|
131
|
+
timeZone,
|
|
132
|
+
minDays,
|
|
133
|
+
maxDays,
|
|
134
|
+
allowUnavailable,
|
|
135
|
+
name: name ?? field?.name,
|
|
136
|
+
startName,
|
|
137
|
+
endName,
|
|
138
|
+
form,
|
|
139
|
+
required,
|
|
140
|
+
controller,
|
|
141
|
+
debug
|
|
142
|
+
});
|
|
143
|
+
const context = React.useMemo(
|
|
144
|
+
() => extendHandle(picker, { field }),
|
|
145
|
+
[picker, field]
|
|
146
|
+
);
|
|
147
|
+
const content = (state) => {
|
|
148
|
+
const range = state.mode === "range";
|
|
149
|
+
const submitsStart = range ? startName ?? name ?? field?.name : name ?? field?.name;
|
|
150
|
+
const submitsEnd = range && (endName ?? name ?? field?.name);
|
|
151
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
152
|
+
children === void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
153
|
+
/* @__PURE__ */ jsx(DatePickerInput, {}),
|
|
154
|
+
range && /* @__PURE__ */ jsx(DatePickerInput, { end: true }),
|
|
155
|
+
/* @__PURE__ */ jsx(DatePickerTrigger, {}),
|
|
156
|
+
/* @__PURE__ */ jsx(DatePickerContent, {})
|
|
157
|
+
] }) : typeof children === "function" ? children(state) : children,
|
|
158
|
+
submitsStart && /* @__PURE__ */ jsx("input", { ...slotIn(picker, "hidden-input", { id: "start" }) }),
|
|
159
|
+
submitsEnd && /* @__PURE__ */ jsx(
|
|
160
|
+
"input",
|
|
161
|
+
{
|
|
162
|
+
...slotIn(picker, "hidden-input", { end: true, id: "end" })
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] });
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ jsx(DatePickerContext.Provider, { value: context, children: /* @__PURE__ */ jsx(CalendarContext.Provider, { value: picker, children: /* @__PURE__ */ jsx(ContainerContext.Provider, { value: container, children: usePart(picker, "root", {}, { ...props, children: content }) }) }) });
|
|
168
|
+
}
|
|
169
|
+
function DatePickerInput({
|
|
170
|
+
end,
|
|
171
|
+
render,
|
|
172
|
+
...props
|
|
173
|
+
}) {
|
|
174
|
+
const picker = useDatePicker("DatePickerInput");
|
|
175
|
+
const input = (merged, state) => {
|
|
176
|
+
const field = picker.field && !end ? picker.field : void 0;
|
|
177
|
+
const [own, element] = field ? ownDescription(merged, render) : [merged, render];
|
|
178
|
+
const { value, ...rest } = field ? field.props(own) : own;
|
|
179
|
+
return renderElement(
|
|
180
|
+
"input",
|
|
181
|
+
{ ...rest, defaultValue: value },
|
|
182
|
+
element,
|
|
183
|
+
state
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
return usePart(
|
|
187
|
+
picker,
|
|
188
|
+
"input",
|
|
189
|
+
{ end, id: end ? "end" : "start" },
|
|
190
|
+
{ ...props, render: input },
|
|
191
|
+
"input"
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
var calendarIcon = /* @__PURE__ */ jsxs(
|
|
195
|
+
"svg",
|
|
196
|
+
{
|
|
197
|
+
width: "16",
|
|
198
|
+
height: "16",
|
|
199
|
+
viewBox: "0 0 16 16",
|
|
200
|
+
fill: "none",
|
|
201
|
+
stroke: "currentColor",
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
children: [
|
|
204
|
+
/* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "12", height: "11", rx: "1.5" }),
|
|
205
|
+
/* @__PURE__ */ jsx("path", { d: "M2 6.5h12M5.5 1.5v3M10.5 1.5v3" })
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
function DatePickerTrigger({
|
|
210
|
+
children = calendarIcon,
|
|
211
|
+
...props
|
|
212
|
+
}) {
|
|
213
|
+
return usePart(
|
|
214
|
+
useDatePicker("DatePickerTrigger"),
|
|
215
|
+
"trigger",
|
|
216
|
+
{},
|
|
217
|
+
{ ...props, children },
|
|
218
|
+
"button"
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
function DatePickerContent({
|
|
222
|
+
side,
|
|
223
|
+
align,
|
|
224
|
+
sideOffset,
|
|
225
|
+
alignOffset,
|
|
226
|
+
collisionPadding,
|
|
227
|
+
arrowPadding,
|
|
228
|
+
anchor,
|
|
229
|
+
finalFocus,
|
|
230
|
+
keepMounted,
|
|
231
|
+
container,
|
|
232
|
+
render,
|
|
233
|
+
children,
|
|
234
|
+
...props
|
|
235
|
+
}) {
|
|
236
|
+
const picker = useDatePicker("DatePickerContent");
|
|
237
|
+
const target = usePopupContainer(useOwnContainer(container, ContainerContext));
|
|
238
|
+
const content = {
|
|
239
|
+
side,
|
|
240
|
+
align,
|
|
241
|
+
sideOffset,
|
|
242
|
+
alignOffset,
|
|
243
|
+
collisionPadding,
|
|
244
|
+
arrowPadding,
|
|
245
|
+
anchor,
|
|
246
|
+
finalFocus,
|
|
247
|
+
keepMounted
|
|
248
|
+
};
|
|
249
|
+
const { months } = picker.state;
|
|
250
|
+
const body = children === void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
251
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
252
|
+
/* @__PURE__ */ jsx(CalendarPrevious, {}),
|
|
253
|
+
/* @__PURE__ */ jsx(CalendarHeading, {}),
|
|
254
|
+
/* @__PURE__ */ jsx(CalendarNext, {})
|
|
255
|
+
] }),
|
|
256
|
+
Array.from({ length: months }, (_, offset) => /* @__PURE__ */ jsx(CalendarGrid, { offset }, offset))
|
|
257
|
+
] }) : children;
|
|
258
|
+
const element = usePart(picker, "content", content, {
|
|
259
|
+
...props,
|
|
260
|
+
children: body,
|
|
261
|
+
render: sheetViewport(picker, render)
|
|
262
|
+
});
|
|
263
|
+
return element && renderPopup(element, target);
|
|
264
|
+
}
|
|
265
|
+
function DatePickerHint({
|
|
266
|
+
children = placeholder,
|
|
267
|
+
...props
|
|
268
|
+
}) {
|
|
269
|
+
return usePart(
|
|
270
|
+
useDatePicker("DatePickerHint"),
|
|
271
|
+
"hint",
|
|
272
|
+
{},
|
|
273
|
+
{ ...props, children },
|
|
274
|
+
"span"
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
var placeholder = (state) => state.placeholder;
|
|
278
|
+
var DatePickerClear = parts.Clear;
|
|
279
|
+
function DatePickerPreset({
|
|
280
|
+
value,
|
|
281
|
+
...props
|
|
282
|
+
}) {
|
|
283
|
+
return usePart(
|
|
284
|
+
datePickerPrimitive,
|
|
285
|
+
"preset",
|
|
286
|
+
{ value, id: JSON.stringify(value) },
|
|
287
|
+
props,
|
|
288
|
+
"button"
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
export {
|
|
292
|
+
CalendarDay,
|
|
293
|
+
CalendarGrid2 as CalendarGrid,
|
|
294
|
+
CalendarHeading2 as CalendarHeading,
|
|
295
|
+
CalendarMonthSelect,
|
|
296
|
+
CalendarNext2 as CalendarNext,
|
|
297
|
+
CalendarPrevious2 as CalendarPrevious,
|
|
298
|
+
CalendarWeekday,
|
|
299
|
+
CalendarWeekdays,
|
|
300
|
+
CalendarWeeks,
|
|
301
|
+
CalendarYearSelect,
|
|
302
|
+
DatePicker,
|
|
303
|
+
DatePickerClear,
|
|
304
|
+
DatePickerContent,
|
|
305
|
+
DatePickerHint,
|
|
306
|
+
DatePickerInput,
|
|
307
|
+
DatePickerPreset,
|
|
308
|
+
DatePickerTrigger,
|
|
309
|
+
createDatePickerController
|
|
310
|
+
};
|
package/dist/date.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { addDays, addMonths, addYears, clampDate, dateFormatter, dateParts, datePattern, daysBetween, daysInMonth, endOfMonth, endOfWeek, firstDayOfWeek, formatDate, formatDateRange, formatDateToParts, isISODate, isSameMonth, isoDate, monthGrid, monthNames, parseDate, startOfMonth, startOfWeek, toISODate, todayDate, weekday, weekdayNames, } from "@ui-sdk/core/date";
|
|
2
|
+
export type { DateField, DateParts, DatePattern, ISODate, } from "@ui-sdk/core/date";
|
package/dist/date.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/date.ts
|
|
3
|
+
import {
|
|
4
|
+
addDays,
|
|
5
|
+
addMonths,
|
|
6
|
+
addYears,
|
|
7
|
+
clampDate,
|
|
8
|
+
dateFormatter,
|
|
9
|
+
dateParts,
|
|
10
|
+
datePattern,
|
|
11
|
+
daysBetween,
|
|
12
|
+
daysInMonth,
|
|
13
|
+
endOfMonth,
|
|
14
|
+
endOfWeek,
|
|
15
|
+
firstDayOfWeek,
|
|
16
|
+
formatDate,
|
|
17
|
+
formatDateRange,
|
|
18
|
+
formatDateToParts,
|
|
19
|
+
isISODate,
|
|
20
|
+
isSameMonth,
|
|
21
|
+
isoDate,
|
|
22
|
+
monthGrid,
|
|
23
|
+
monthNames,
|
|
24
|
+
parseDate,
|
|
25
|
+
startOfMonth,
|
|
26
|
+
startOfWeek,
|
|
27
|
+
toISODate,
|
|
28
|
+
todayDate,
|
|
29
|
+
weekday,
|
|
30
|
+
weekdayNames
|
|
31
|
+
} from "@ui-sdk/core/date";
|
|
32
|
+
export {
|
|
33
|
+
addDays,
|
|
34
|
+
addMonths,
|
|
35
|
+
addYears,
|
|
36
|
+
clampDate,
|
|
37
|
+
dateFormatter,
|
|
38
|
+
dateParts,
|
|
39
|
+
datePattern,
|
|
40
|
+
daysBetween,
|
|
41
|
+
daysInMonth,
|
|
42
|
+
endOfMonth,
|
|
43
|
+
endOfWeek,
|
|
44
|
+
firstDayOfWeek,
|
|
45
|
+
formatDate,
|
|
46
|
+
formatDateRange,
|
|
47
|
+
formatDateToParts,
|
|
48
|
+
isISODate,
|
|
49
|
+
isSameMonth,
|
|
50
|
+
isoDate,
|
|
51
|
+
monthGrid,
|
|
52
|
+
monthNames,
|
|
53
|
+
parseDate,
|
|
54
|
+
startOfMonth,
|
|
55
|
+
startOfWeek,
|
|
56
|
+
toISODate,
|
|
57
|
+
todayDate,
|
|
58
|
+
weekday,
|
|
59
|
+
weekdayNames
|
|
60
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AlertDialogController, dialog as dialogPrimitive, DialogBackdropState, DialogCloseProps, DialogCloseState, DialogContentProps, DialogContentState, DialogController, DialogOptions, DialogShortcutProps, DialogShortcutState, DialogTriggerProps, DialogTriggerState } from "@ui-sdk/core/dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type sheetViewport } from "./popup.js";
|
|
4
|
+
import { type PartProps } from "./use-primitive.js";
|
|
5
|
+
type TriggerPartProps = Omit<PartProps<"button", DialogTriggerState>, "value" | "defaultValue" | "onChange"> & Omit<DialogTriggerProps, "controller">;
|
|
6
|
+
type ContentPartProps<Payload = unknown> = PartProps<"div", DialogContentState<Payload>> & DialogContentProps;
|
|
7
|
+
type ClosePartProps = Omit<PartProps<"button", DialogCloseState>, "value" | "action"> & DialogCloseProps;
|
|
8
|
+
type ShortcutPartProps = PartProps<"span", DialogShortcutState> & DialogShortcutProps;
|
|
9
|
+
declare function dialogParts(primitive: typeof dialogPrimitive, name: string, viewport?: typeof sheetViewport): {
|
|
10
|
+
Root: ({ children, container, ...options }: DialogOptions & {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}) => React.JSX.Element;
|
|
13
|
+
Trigger: ({ controller, ...props }: TriggerPartProps & {
|
|
14
|
+
controller?: DialogController<any, any> | AlertDialogController<any, any>;
|
|
15
|
+
}) => React.JSX.Element;
|
|
16
|
+
Backdrop: (props: PartProps<"div", DialogBackdropState>) => React.JSX.Element | null;
|
|
17
|
+
Content: <Payload = unknown>({ initialFocus, finalFocus, keepMounted, container, render, ...props }: ContentPartProps<Payload>) => React.JSX.Element | null;
|
|
18
|
+
Title: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/dialog").DialogPrimitive, "title", "h2">;
|
|
19
|
+
Description: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/dialog").DialogPrimitive, "description", "p">;
|
|
20
|
+
Close: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/dialog").DialogPrimitive, "close", "button">;
|
|
21
|
+
Shortcut: (props: ShortcutPartProps) => React.JSX.Element | null;
|
|
22
|
+
};
|
|
23
|
+
export { type ClosePartProps, type ContentPartProps, dialogParts, type ShortcutPartProps, type TriggerPartProps, };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/dialog-parts.tsx
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
Connected,
|
|
6
|
+
renderPopup,
|
|
7
|
+
useOwnContainer,
|
|
8
|
+
usePopupContainer,
|
|
9
|
+
useControllerEntry
|
|
10
|
+
} from "./popup.js";
|
|
11
|
+
import {
|
|
12
|
+
createParts,
|
|
13
|
+
HandleScope,
|
|
14
|
+
renderElement,
|
|
15
|
+
useHandle,
|
|
16
|
+
useNearest,
|
|
17
|
+
usePart,
|
|
18
|
+
usePrimitive
|
|
19
|
+
} from "./use-primitive.js";
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
var TriggerContext = React.createContext(null);
|
|
22
|
+
var text = (state) => state.text;
|
|
23
|
+
function dialogParts(primitive, name, viewport) {
|
|
24
|
+
const parts = createParts(primitive, {
|
|
25
|
+
title: "h2",
|
|
26
|
+
description: "p",
|
|
27
|
+
close: "button",
|
|
28
|
+
trigger: "button"
|
|
29
|
+
});
|
|
30
|
+
const ContainerContext = React.createContext(void 0);
|
|
31
|
+
function Root({
|
|
32
|
+
children,
|
|
33
|
+
container,
|
|
34
|
+
...options
|
|
35
|
+
}) {
|
|
36
|
+
const handle = usePrimitive(primitive, options);
|
|
37
|
+
useControllerEntry(options.controller, handle);
|
|
38
|
+
return /* @__PURE__ */ jsx(HandleScope, { handle, children: /* @__PURE__ */ jsx(ContainerContext.Provider, { value: container, children }) });
|
|
39
|
+
}
|
|
40
|
+
function Trigger({
|
|
41
|
+
controller,
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
const {
|
|
45
|
+
disabled,
|
|
46
|
+
focusableWhenDisabled,
|
|
47
|
+
payload: _,
|
|
48
|
+
shortcut,
|
|
49
|
+
render,
|
|
50
|
+
...rest
|
|
51
|
+
} = props;
|
|
52
|
+
const unconnected = () => renderElement(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
disabled: disabled && !focusableWhenDisabled,
|
|
57
|
+
"aria-disabled": disabled && focusableWhenDisabled || void 0,
|
|
58
|
+
...rest
|
|
59
|
+
},
|
|
60
|
+
render,
|
|
61
|
+
{
|
|
62
|
+
open: false,
|
|
63
|
+
disabled: !!disabled
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
return /* @__PURE__ */ jsx(TriggerContext.Provider, { value: { shortcut }, children: /* @__PURE__ */ jsx(
|
|
67
|
+
Connected,
|
|
68
|
+
{
|
|
69
|
+
primitive,
|
|
70
|
+
controller,
|
|
71
|
+
fallback: unconnected,
|
|
72
|
+
children: /* @__PURE__ */ jsx(parts.Trigger, { ...props })
|
|
73
|
+
}
|
|
74
|
+
) });
|
|
75
|
+
}
|
|
76
|
+
function Backdrop(props) {
|
|
77
|
+
const target = usePopupContainer(React.useContext(ContainerContext));
|
|
78
|
+
const element = usePart(primitive, "backdrop", {}, props);
|
|
79
|
+
return element && renderPopup(element, target);
|
|
80
|
+
}
|
|
81
|
+
function Content({
|
|
82
|
+
initialFocus,
|
|
83
|
+
finalFocus,
|
|
84
|
+
keepMounted,
|
|
85
|
+
container,
|
|
86
|
+
render,
|
|
87
|
+
...props
|
|
88
|
+
}) {
|
|
89
|
+
const handle = useHandle(primitive);
|
|
90
|
+
const target = usePopupContainer(
|
|
91
|
+
useOwnContainer(container, ContainerContext)
|
|
92
|
+
);
|
|
93
|
+
const partProps = {
|
|
94
|
+
...props,
|
|
95
|
+
render: viewport ? viewport(handle, render) : render
|
|
96
|
+
};
|
|
97
|
+
const element = usePart(
|
|
98
|
+
handle,
|
|
99
|
+
"content",
|
|
100
|
+
{ initialFocus, finalFocus, keepMounted },
|
|
101
|
+
partProps
|
|
102
|
+
);
|
|
103
|
+
return element && renderPopup(element, target);
|
|
104
|
+
}
|
|
105
|
+
function Shortcut(props) {
|
|
106
|
+
const trigger = React.useContext(TriggerContext);
|
|
107
|
+
if (useNearest(primitive)) {
|
|
108
|
+
return /* @__PURE__ */ jsx(ShortcutPart, { inherited: trigger?.shortcut, ...props });
|
|
109
|
+
}
|
|
110
|
+
if (trigger) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
throw new Error(`${name} parts must be used inside <${name}>.`);
|
|
114
|
+
}
|
|
115
|
+
function ShortcutPart({
|
|
116
|
+
inherited,
|
|
117
|
+
shortcut,
|
|
118
|
+
children = text,
|
|
119
|
+
...props
|
|
120
|
+
}) {
|
|
121
|
+
return usePart(
|
|
122
|
+
primitive,
|
|
123
|
+
"shortcut",
|
|
124
|
+
{ shortcut: shortcut ?? inherited },
|
|
125
|
+
{ ...props, children },
|
|
126
|
+
"span"
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
Root,
|
|
131
|
+
Trigger,
|
|
132
|
+
Backdrop,
|
|
133
|
+
Content,
|
|
134
|
+
Title: parts.Title,
|
|
135
|
+
Description: parts.Description,
|
|
136
|
+
Close: parts.Close,
|
|
137
|
+
Shortcut
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
dialogParts
|
|
142
|
+
};
|
package/dist/dialog.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type DialogOptions, type DialogTriggerProps } from "@ui-sdk/core/dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type TriggerPartProps } from "./dialog-parts.js";
|
|
4
|
+
/**
|
|
5
|
+
* The props of `Dialog`.
|
|
6
|
+
* @stable
|
|
7
|
+
*/
|
|
8
|
+
type DialogProps = DialogOptions & {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A window over the page that asks for the user's attention. Put its trigger, backdrop and content inside.
|
|
13
|
+
* @stable
|
|
14
|
+
*/
|
|
15
|
+
declare const Dialog: ({ children, container, ...options }: DialogOptions & {
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}) => React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* The button that opens the dialog. A trigger outside the dialog, like one per table row, connects through
|
|
20
|
+
* `controller`.
|
|
21
|
+
* @stable
|
|
22
|
+
*/
|
|
23
|
+
declare function DialogTrigger(props: TriggerPartProps & Pick<DialogTriggerProps, "controller">): React.JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* A dim behind the dialog. It's optional: without it, style the content's `::backdrop`.
|
|
26
|
+
* @stable
|
|
27
|
+
*/
|
|
28
|
+
declare const DialogBackdrop: (props: import("./use-primitive.js").PartProps<"div", import("@ui-sdk/core/dialog").DialogBackdropState>) => React.JSX.Element | null;
|
|
29
|
+
/**
|
|
30
|
+
* The dialog itself, named by its title and described by its description.
|
|
31
|
+
* @stable
|
|
32
|
+
*/
|
|
33
|
+
declare const DialogContent: <Payload = unknown>({ initialFocus, finalFocus, keepMounted, container, render, ...props }: import("./dialog-parts.js").ContentPartProps<Payload>) => React.JSX.Element | null;
|
|
34
|
+
/**
|
|
35
|
+
* The dialog's title, which names it. A level 2 heading by default.
|
|
36
|
+
* @stable
|
|
37
|
+
*/
|
|
38
|
+
declare const DialogTitle: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/dialog").DialogPrimitive, "title", "h2">;
|
|
39
|
+
/**
|
|
40
|
+
* Describes the dialog while it's rendered. A paragraph by default.
|
|
41
|
+
* @stable
|
|
42
|
+
*/
|
|
43
|
+
declare const DialogDescription: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/dialog").DialogPrimitive, "description", "p">;
|
|
44
|
+
/**
|
|
45
|
+
* A button that closes the dialog. An `action` runs first, and a Promise it returns keeps the dialog open
|
|
46
|
+
* until it settles.
|
|
47
|
+
* @stable
|
|
48
|
+
*/
|
|
49
|
+
declare const DialogClose: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/dialog").DialogPrimitive, "close", "button">;
|
|
50
|
+
/**
|
|
51
|
+
* Shows a trigger's shortcut, like `⌘K`, inside the trigger. Hidden from screen readers, which hear `aria-keyshortcuts`.
|
|
52
|
+
* @stable
|
|
53
|
+
*/
|
|
54
|
+
declare const DialogShortcut: (props: import("./dialog-parts.js").ShortcutPartProps) => React.JSX.Element | null;
|
|
55
|
+
export { createDialogController } from "@ui-sdk/core/dialog";
|
|
56
|
+
export type { AlertDialogBackdropState, AlertDialogCloseActionDetails, AlertDialogCloseProps, AlertDialogCloseState, AlertDialogContentProps, AlertDialogContentState, AlertDialogController, AlertDialogOpenChangeReason, AlertDialogOptions, AlertDialogPayloadChangeReason, AlertDialogPrimitive, AlertDialogShortcutProps, AlertDialogShortcutState, AlertDialogTriggerProps, AlertDialogTriggerState, ConfirmEntry, ConfirmOptions, DialogApi, DialogBackdropState, DialogCloseActionDetails, DialogCloseProps, DialogCloseState, DialogContentProps, DialogContentState, DialogController, DialogDismissAttemptDetails, DialogDismissReason, DialogFinalFocus, DialogInitialFocus, DialogOpenChangeDetails, DialogOpenChangeReason, DialogOptions, DialogPayloadChangeReason, DialogPrimitive, DialogSharedOptions, DialogShortcutProps, DialogShortcutState, DialogTriggerProps, DialogTriggerState, } from "@ui-sdk/core/dialog";
|
|
57
|
+
export { Dialog, DialogBackdrop, DialogClose, DialogContent, DialogDescription, type DialogProps, DialogShortcut, DialogTitle, DialogTrigger, };
|
package/dist/dialog.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/dialog.tsx
|
|
3
|
+
import {
|
|
4
|
+
dialog as dialogPrimitive
|
|
5
|
+
} from "@ui-sdk/core/dialog";
|
|
6
|
+
import "react";
|
|
7
|
+
import { dialogParts } from "./dialog-parts.js";
|
|
8
|
+
import { sheetViewport } from "./popup.js";
|
|
9
|
+
import { createDialogController } from "@ui-sdk/core/dialog";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var parts = dialogParts(dialogPrimitive, "Dialog", sheetViewport);
|
|
12
|
+
var Dialog = parts.Root;
|
|
13
|
+
function DialogTrigger(props) {
|
|
14
|
+
return /* @__PURE__ */ jsx(parts.Trigger, { ...props });
|
|
15
|
+
}
|
|
16
|
+
var DialogBackdrop = parts.Backdrop;
|
|
17
|
+
var DialogContent = parts.Content;
|
|
18
|
+
var DialogTitle = parts.Title;
|
|
19
|
+
var DialogDescription = parts.Description;
|
|
20
|
+
var DialogClose = parts.Close;
|
|
21
|
+
var DialogShortcut = parts.Shortcut;
|
|
22
|
+
export {
|
|
23
|
+
Dialog,
|
|
24
|
+
DialogBackdrop,
|
|
25
|
+
DialogClose,
|
|
26
|
+
DialogContent,
|
|
27
|
+
DialogDescription,
|
|
28
|
+
DialogShortcut,
|
|
29
|
+
DialogTitle,
|
|
30
|
+
DialogTrigger,
|
|
31
|
+
createDialogController
|
|
32
|
+
};
|
package/dist/drawer.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { DialogShortcutProps, DialogShortcutState, DialogTriggerState } from "@ui-sdk/core/dialog";
|
|
2
|
+
import { type DrawerBackdropState, type DrawerContentProps, type DrawerContentState, type DrawerOptions, type DrawerOutletProps, type DrawerTriggerProps, type DrawerOutletState } from "@ui-sdk/core/drawer";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { type PartProps } from "./use-primitive.js";
|
|
5
|
+
type TriggerPartProps = Omit<PartProps<"button", DialogTriggerState>, "value" | "defaultValue" | "onChange"> & DrawerTriggerProps;
|
|
6
|
+
type ShortcutPartProps = PartProps<"span", DialogShortcutState> & DialogShortcutProps;
|
|
7
|
+
/**
|
|
8
|
+
* The props of `Drawer`.
|
|
9
|
+
* @stable
|
|
10
|
+
*/
|
|
11
|
+
type DrawerProps = DrawerOptions & {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A dialog presented as a sheet that slides in from an edge. Put its trigger, backdrop and content inside.
|
|
16
|
+
* @stable
|
|
17
|
+
*/
|
|
18
|
+
declare function Drawer({ children, container, ...options }: DrawerProps): React.JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* The button that opens the drawer. A trigger outside the drawer, like one per table row, connects through
|
|
21
|
+
* `controller`.
|
|
22
|
+
* @stable
|
|
23
|
+
*/
|
|
24
|
+
declare function DrawerTrigger({ controller, ...props }: TriggerPartProps): React.JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* A dim behind the drawer. Its opacity follows the drawer, so give it a color like `bg-black/20`.
|
|
27
|
+
* @stable
|
|
28
|
+
*/
|
|
29
|
+
declare function DrawerBackdrop(props: PartProps<"div", DrawerBackdropState>): React.JSX.Element | null;
|
|
30
|
+
/**
|
|
31
|
+
* The sheet itself, a dialog. It renders inside a full-screen viewport the drawer positions it in.
|
|
32
|
+
* @stable
|
|
33
|
+
*/
|
|
34
|
+
declare function DrawerContent<Payload = unknown>({ initialFocus, finalFocus, keepMounted, container, render, ...props }: PartProps<"div", DrawerContentState<Payload>> & DrawerContentProps): React.JSX.Element | null;
|
|
35
|
+
/**
|
|
36
|
+
* The grabber. Pressing it moves to the next snap point; arrow keys, Home and End step. Name it, like `aria-label="Resize"`.
|
|
37
|
+
* @stable
|
|
38
|
+
*/
|
|
39
|
+
declare const DrawerHandle: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/drawer").DrawerPrimitive, "handle", "button">;
|
|
40
|
+
/**
|
|
41
|
+
* The drawer's title, which names it. A level 2 heading by default.
|
|
42
|
+
* @stable
|
|
43
|
+
*/
|
|
44
|
+
declare const DrawerTitle: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/drawer").DrawerPrimitive, "title", "h2">;
|
|
45
|
+
/**
|
|
46
|
+
* Describes the drawer while it's rendered. A paragraph by default.
|
|
47
|
+
* @stable
|
|
48
|
+
*/
|
|
49
|
+
declare const DrawerDescription: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/drawer").DrawerPrimitive, "description", "p">;
|
|
50
|
+
/**
|
|
51
|
+
* A button that closes the drawer. An `action` runs first, and a Promise it returns keeps the drawer open
|
|
52
|
+
* until it settles.
|
|
53
|
+
* @stable
|
|
54
|
+
*/
|
|
55
|
+
declare const DrawerClose: import("./use-primitive.js").PartComponent<import("@ui-sdk/core/drawer").DrawerPrimitive, "close", "button">;
|
|
56
|
+
/**
|
|
57
|
+
* Shows a trigger's shortcut, like `⌘K`, inside the trigger. Hidden from screen readers, which hear `aria-keyshortcuts`.
|
|
58
|
+
* @stable
|
|
59
|
+
*/
|
|
60
|
+
declare function DrawerShortcut(props: ShortcutPartProps): React.JSX.Element | null;
|
|
61
|
+
/**
|
|
62
|
+
* An element that follows the drawer, like the page behind it: it plays its
|
|
63
|
+
* `keyframes` as the drawer expands and gets the `--drawer-*` variables.
|
|
64
|
+
* Outside the drawer, pass the drawer's `controller`.
|
|
65
|
+
* @stable
|
|
66
|
+
*/
|
|
67
|
+
declare function DrawerOutlet({ controller, ...props }: PartProps<"div", DrawerOutletState> & DrawerOutletProps): React.JSX.Element;
|
|
68
|
+
export { createDrawerController, sheetPhysics } from "@ui-sdk/core/drawer";
|
|
69
|
+
export type { DrawerApi, DrawerBackdropState, DrawerContentProps, DrawerContentState, DrawerController, DrawerDismissAttemptDetails, DrawerDismissReason, DrawerDriver, DrawerHandleState, DrawerKeyframes, DrawerOpenChangeReason, DrawerOptions, DrawerOutletProps, DrawerOutletState, DrawerPayloadChangeReason, DrawerPrimitive, DrawerSide, DrawerSnapPointChangeReason, DrawerTriggerProps, SheetPhysics, SnapPoint, } from "@ui-sdk/core/drawer";
|
|
70
|
+
export { Drawer, DrawerBackdrop, DrawerClose, DrawerContent, DrawerDescription, DrawerHandle, DrawerOutlet, type DrawerProps, DrawerShortcut, DrawerTitle, DrawerTrigger, };
|