@jobber/components 8.21.1 → 8.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/Dialog.d.ts +1 -0
  2. package/Dialog.js +17 -0
  3. package/dist/BottomSheet-cjs.js +34 -7
  4. package/dist/BottomSheet-es.js +34 -8
  5. package/dist/CSPContext-cjs.js +69 -0
  6. package/dist/CSPContext-es.js +46 -0
  7. package/dist/Card/index.cjs +3 -0
  8. package/dist/Card/index.mjs +3 -0
  9. package/dist/ComboboxChipRemove-cjs.js +54 -211
  10. package/dist/ComboboxChipRemove-es.js +8 -164
  11. package/dist/DataDump/index.cjs +3 -0
  12. package/dist/DataDump/index.mjs +3 -0
  13. package/dist/Dialog/Dialog.d.ts +3 -0
  14. package/dist/Dialog/Dialog.types.d.ts +205 -0
  15. package/dist/Dialog/DialogBottomSheet.d.ts +28 -0
  16. package/dist/Dialog/DialogModal.d.ts +20 -0
  17. package/dist/Dialog/constants.d.ts +1 -0
  18. package/dist/Dialog/dialogComposableShared.d.ts +53 -0
  19. package/dist/Dialog/dialogReturnFocus.d.ts +43 -0
  20. package/dist/Dialog/index.cjs +33 -0
  21. package/dist/Dialog/index.d.ts +4 -0
  22. package/dist/Dialog/index.mjs +25 -0
  23. package/dist/DrawerDescription-cjs.js +410 -0
  24. package/dist/DrawerDescription-es.js +383 -0
  25. package/dist/DrawerTitle-cjs.js +116 -0
  26. package/dist/DrawerTitle-es.js +92 -0
  27. package/dist/InputNumberExperimental-cjs.js +24 -23
  28. package/dist/InputNumberExperimental-es.js +3 -2
  29. package/dist/InternalBackdrop-es.js +3 -3
  30. package/dist/Menu/index.cjs +3 -0
  31. package/dist/Menu/index.mjs +3 -0
  32. package/dist/Menu-cjs.js +6 -4
  33. package/dist/Menu-es.js +6 -4
  34. package/dist/MenuSubmenuTrigger-cjs.js +53 -103
  35. package/dist/MenuSubmenuTrigger-es.js +55 -103
  36. package/dist/NumberFieldInput-cjs.js +9 -9
  37. package/dist/NumberFieldInput-es.js +3 -3
  38. package/dist/Page/index.cjs +3 -0
  39. package/dist/Page/index.mjs +3 -0
  40. package/dist/ScrollAreaViewport-cjs.js +921 -960
  41. package/dist/ScrollAreaViewport-es.js +917 -958
  42. package/dist/SelectGroupLabel-cjs.js +1924 -0
  43. package/dist/SelectGroupLabel-es.js +1888 -0
  44. package/dist/SelectPrimitive-cjs.js +112 -0
  45. package/dist/SelectPrimitive-es.js +110 -0
  46. package/dist/ToolbarRootContext-cjs.js +35 -0
  47. package/dist/ToolbarRootContext-es.js +14 -0
  48. package/dist/dialogReturnFocus-cjs.js +427 -0
  49. package/dist/dialogReturnFocus-es.js +423 -0
  50. package/dist/docs/SelectPrimitive/SelectPrimitive.md +326 -0
  51. package/dist/docs/index.md +1 -0
  52. package/dist/floating-ui.react-dom-cjs.js +1 -0
  53. package/dist/floating-ui.react-dom-es.js +2 -2
  54. package/dist/floating-ui.utils.dom-es.js +1 -1
  55. package/dist/index.cjs +15 -7
  56. package/dist/index.d.mts +1 -0
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.mjs +12 -7
  59. package/dist/primitives/BottomSheet/BottomSheet.d.ts +19 -1
  60. package/dist/primitives/BottomSheet/BottomSheet.types.d.ts +8 -0
  61. package/dist/primitives/BottomSheet/index.cjs +2 -0
  62. package/dist/primitives/BottomSheet/index.d.ts +1 -1
  63. package/dist/primitives/BottomSheet/index.mjs +2 -1
  64. package/dist/primitives/ComboboxPrimitive/index.cjs +3 -1
  65. package/dist/primitives/ComboboxPrimitive/index.mjs +3 -1
  66. package/dist/primitives/InputNumberExperimental/index.cjs +2 -1
  67. package/dist/primitives/InputNumberExperimental/index.mjs +2 -1
  68. package/dist/primitives/SelectPrimitive/SelectPrimitive.d.ts +63 -0
  69. package/dist/primitives/SelectPrimitive/index.cjs +29 -0
  70. package/dist/primitives/SelectPrimitive/index.d.ts +2 -0
  71. package/dist/primitives/SelectPrimitive/index.mjs +23 -0
  72. package/dist/primitives/SelectPrimitive/types.d.ts +16 -0
  73. package/dist/primitives/index.cjs +9 -1
  74. package/dist/primitives/index.d.ts +1 -0
  75. package/dist/primitives/index.mjs +8 -2
  76. package/dist/primitives/mergeClassName.d.ts +12 -0
  77. package/dist/resolveAriaLabelledBy-cjs.js +195 -0
  78. package/dist/resolveAriaLabelledBy-es.js +162 -0
  79. package/dist/styles.css +685 -0
  80. package/dist/unstyledPrimitives/index.cjs +434 -259
  81. package/dist/unstyledPrimitives/index.d.ts +2 -0
  82. package/dist/unstyledPrimitives/index.mjs +425 -252
  83. package/dist/useButton-cjs.js +2 -0
  84. package/dist/useButton-es.js +3 -2
  85. package/dist/useCompositeListItem-es.js +4 -4
  86. package/dist/useLabel-cjs.js +3 -329
  87. package/dist/useLabel-es.js +4 -299
  88. package/dist/useLabelableId-cjs.js +332 -0
  89. package/dist/useLabelableId-es.js +300 -0
  90. package/dist/useRenderElement-cjs.js +3 -0
  91. package/dist/useRenderElement-es.js +4 -1
  92. package/dist/utils/meta/meta.json +11 -1
  93. package/package.json +2 -2
@@ -0,0 +1,383 @@
1
+ import * as React from 'react';
2
+ import { u as useDialogRootContext, j as useDialogPortalContext, k as DialogStore } from './ScrollAreaViewport-es.js';
3
+ import { u as useRenderElement } from './useRenderElement-es.js';
4
+ import { p as popupStateMapping, C as CommonPopupDataAttributes, F as FloatingFocusManager } from './InternalBackdrop-es.js';
5
+ import { t as transitionStatusMapping, u as useBaseUiId, f as useOpenChangeComplete, d as createChangeEventDetails, i as imperativeAction } from './useButton-es.js';
6
+ import { C as COMPOSITE_KEYS } from './CSPContext-es.js';
7
+ import { jsx } from 'react/jsx-runtime';
8
+
9
+ const stateAttributesMapping$2 = {
10
+ ...popupStateMapping,
11
+ ...transitionStatusMapping
12
+ };
13
+
14
+ /**
15
+ * An overlay displayed beneath the popup.
16
+ * Renders a `<div>` element.
17
+ *
18
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
19
+ */
20
+ const DialogBackdrop = /*#__PURE__*/React.forwardRef(function DialogBackdrop(componentProps, forwardedRef) {
21
+ const {
22
+ render,
23
+ className,
24
+ forceRender = false,
25
+ ...elementProps
26
+ } = componentProps;
27
+ const {
28
+ store
29
+ } = useDialogRootContext();
30
+ const open = store.useState('open');
31
+ const nested = store.useState('nested');
32
+ const mounted = store.useState('mounted');
33
+ const transitionStatus = store.useState('transitionStatus');
34
+ const state = {
35
+ open,
36
+ transitionStatus
37
+ };
38
+ return useRenderElement('div', componentProps, {
39
+ state,
40
+ ref: [store.context.backdropRef, forwardedRef],
41
+ stateAttributesMapping: stateAttributesMapping$2,
42
+ props: [{
43
+ role: 'presentation',
44
+ hidden: !mounted,
45
+ style: {
46
+ userSelect: 'none',
47
+ WebkitUserSelect: 'none'
48
+ }
49
+ }, elementProps],
50
+ enabled: forceRender || !nested
51
+ });
52
+ });
53
+ if (process.env.NODE_ENV !== "production") DialogBackdrop.displayName = "DialogBackdrop";
54
+
55
+ /**
56
+ * A paragraph with additional information about the dialog.
57
+ * Renders a `<p>` element.
58
+ *
59
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
60
+ */
61
+ const DialogDescription = /*#__PURE__*/React.forwardRef(function DialogDescription(componentProps, forwardedRef) {
62
+ const {
63
+ render,
64
+ className,
65
+ id: idProp,
66
+ ...elementProps
67
+ } = componentProps;
68
+ const {
69
+ store
70
+ } = useDialogRootContext();
71
+ const id = useBaseUiId(idProp);
72
+ store.useSyncedValueWithCleanup('descriptionElementId', id);
73
+ return useRenderElement('p', componentProps, {
74
+ ref: forwardedRef,
75
+ props: [{
76
+ id
77
+ }, elementProps]
78
+ });
79
+ });
80
+ if (process.env.NODE_ENV !== "production") DialogDescription.displayName = "DialogDescription";
81
+
82
+ let DialogPopupCssVars = /*#__PURE__*/function (DialogPopupCssVars) {
83
+ /**
84
+ * Indicates how many dialogs are nested within.
85
+ * @type {number}
86
+ */
87
+ DialogPopupCssVars["nestedDialogs"] = "--nested-dialogs";
88
+ return DialogPopupCssVars;
89
+ }({});
90
+
91
+ let DialogPopupDataAttributes = function (DialogPopupDataAttributes) {
92
+ /**
93
+ * Present when the dialog is open.
94
+ */
95
+ DialogPopupDataAttributes[DialogPopupDataAttributes["open"] = CommonPopupDataAttributes.open] = "open";
96
+ /**
97
+ * Present when the dialog is closed.
98
+ */
99
+ DialogPopupDataAttributes[DialogPopupDataAttributes["closed"] = CommonPopupDataAttributes.closed] = "closed";
100
+ /**
101
+ * Present when the dialog is animating in.
102
+ */
103
+ DialogPopupDataAttributes[DialogPopupDataAttributes["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
104
+ /**
105
+ * Present when the dialog is animating out.
106
+ */
107
+ DialogPopupDataAttributes[DialogPopupDataAttributes["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
108
+ /**
109
+ * Present when the dialog is nested within another dialog.
110
+ */
111
+ DialogPopupDataAttributes["nested"] = "data-nested";
112
+ /**
113
+ * Present when the dialog has other open dialogs nested within it.
114
+ */
115
+ DialogPopupDataAttributes["nestedDialogOpen"] = "data-nested-dialog-open";
116
+ return DialogPopupDataAttributes;
117
+ }({});
118
+
119
+ const stateAttributesMapping$1 = {
120
+ ...popupStateMapping,
121
+ ...transitionStatusMapping,
122
+ nestedDialogOpen(value) {
123
+ return value ? {
124
+ [DialogPopupDataAttributes.nestedDialogOpen]: ''
125
+ } : null;
126
+ }
127
+ };
128
+
129
+ /**
130
+ * A container for the dialog contents.
131
+ * Renders a `<div>` element.
132
+ *
133
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
134
+ */
135
+ const DialogPopup = /*#__PURE__*/React.forwardRef(function DialogPopup(componentProps, forwardedRef) {
136
+ const {
137
+ className,
138
+ finalFocus,
139
+ initialFocus,
140
+ render,
141
+ ...elementProps
142
+ } = componentProps;
143
+ const {
144
+ store
145
+ } = useDialogRootContext();
146
+ const descriptionElementId = store.useState('descriptionElementId');
147
+ const disablePointerDismissal = store.useState('disablePointerDismissal');
148
+ const floatingRootContext = store.useState('floatingRootContext');
149
+ const rootPopupProps = store.useState('popupProps');
150
+ const modal = store.useState('modal');
151
+ const mounted = store.useState('mounted');
152
+ const nested = store.useState('nested');
153
+ const nestedOpenDialogCount = store.useState('nestedOpenDialogCount');
154
+ const open = store.useState('open');
155
+ const openMethod = store.useState('openMethod');
156
+ const titleElementId = store.useState('titleElementId');
157
+ const transitionStatus = store.useState('transitionStatus');
158
+ const role = store.useState('role');
159
+ useDialogPortalContext();
160
+ useOpenChangeComplete({
161
+ open,
162
+ ref: store.context.popupRef,
163
+ onComplete() {
164
+ if (open) {
165
+ store.context.onOpenChangeComplete?.(true);
166
+ }
167
+ }
168
+ });
169
+
170
+ // Default initial focus logic:
171
+ // If opened by touch, focus the popup element to prevent the virtual keyboard from opening
172
+ // (this is required for Android specifically as iOS handles this automatically).
173
+ function defaultInitialFocus(interactionType) {
174
+ if (interactionType === 'touch') {
175
+ return store.context.popupRef.current;
176
+ }
177
+ return true;
178
+ }
179
+ const resolvedInitialFocus = initialFocus === undefined ? defaultInitialFocus : initialFocus;
180
+ const nestedDialogOpen = nestedOpenDialogCount > 0;
181
+ const state = {
182
+ open,
183
+ nested,
184
+ transitionStatus,
185
+ nestedDialogOpen
186
+ };
187
+ const element = useRenderElement('div', componentProps, {
188
+ state,
189
+ props: [rootPopupProps, {
190
+ 'aria-labelledby': titleElementId ?? undefined,
191
+ 'aria-describedby': descriptionElementId ?? undefined,
192
+ role,
193
+ tabIndex: -1,
194
+ hidden: !mounted,
195
+ onKeyDown(event) {
196
+ if (COMPOSITE_KEYS.has(event.key)) {
197
+ event.stopPropagation();
198
+ }
199
+ },
200
+ style: {
201
+ [DialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount
202
+ }
203
+ }, elementProps],
204
+ ref: [forwardedRef, store.context.popupRef, store.useStateSetter('popupElement')],
205
+ stateAttributesMapping: stateAttributesMapping$1
206
+ });
207
+ return /*#__PURE__*/jsx(FloatingFocusManager, {
208
+ context: floatingRootContext,
209
+ openInteractionType: openMethod,
210
+ disabled: !mounted,
211
+ closeOnFocusOut: !disablePointerDismissal,
212
+ initialFocus: resolvedInitialFocus,
213
+ returnFocus: finalFocus,
214
+ modal: modal !== false,
215
+ restoreFocus: "popup",
216
+ children: element
217
+ });
218
+ });
219
+ if (process.env.NODE_ENV !== "production") DialogPopup.displayName = "DialogPopup";
220
+
221
+ let DialogViewportDataAttributes = function (DialogViewportDataAttributes) {
222
+ /**
223
+ * Present when the dialog is open.
224
+ */
225
+ DialogViewportDataAttributes[DialogViewportDataAttributes["open"] = CommonPopupDataAttributes.open] = "open";
226
+ /**
227
+ * Present when the dialog is closed.
228
+ */
229
+ DialogViewportDataAttributes[DialogViewportDataAttributes["closed"] = CommonPopupDataAttributes.closed] = "closed";
230
+ /**
231
+ * Present when the dialog is animating in.
232
+ */
233
+ DialogViewportDataAttributes[DialogViewportDataAttributes["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
234
+ /**
235
+ * Present when the dialog is animating out.
236
+ */
237
+ DialogViewportDataAttributes[DialogViewportDataAttributes["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
238
+ /**
239
+ * Present when the dialog is nested within another dialog.
240
+ */
241
+ DialogViewportDataAttributes["nested"] = "data-nested";
242
+ /**
243
+ * Present when the dialog has other open dialogs nested within it.
244
+ */
245
+ DialogViewportDataAttributes["nestedDialogOpen"] = "data-nested-dialog-open";
246
+ return DialogViewportDataAttributes;
247
+ }({});
248
+
249
+ const stateAttributesMapping = {
250
+ ...popupStateMapping,
251
+ ...transitionStatusMapping,
252
+ nested(value) {
253
+ return value ? {
254
+ [DialogViewportDataAttributes.nested]: ''
255
+ } : null;
256
+ },
257
+ nestedDialogOpen(value) {
258
+ return value ? {
259
+ [DialogViewportDataAttributes.nestedDialogOpen]: ''
260
+ } : null;
261
+ }
262
+ };
263
+
264
+ /**
265
+ * A positioning container for the dialog popup that can be made scrollable.
266
+ * Renders a `<div>` element.
267
+ *
268
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
269
+ */
270
+ const DialogViewport = /*#__PURE__*/React.forwardRef(function DialogViewport(componentProps, forwardedRef) {
271
+ const {
272
+ className,
273
+ render,
274
+ children,
275
+ ...elementProps
276
+ } = componentProps;
277
+ const keepMounted = useDialogPortalContext();
278
+ const {
279
+ store
280
+ } = useDialogRootContext();
281
+ const open = store.useState('open');
282
+ const nested = store.useState('nested');
283
+ const transitionStatus = store.useState('transitionStatus');
284
+ const nestedOpenDialogCount = store.useState('nestedOpenDialogCount');
285
+ const mounted = store.useState('mounted');
286
+ const nestedDialogOpen = nestedOpenDialogCount > 0;
287
+ const state = {
288
+ open,
289
+ nested,
290
+ transitionStatus,
291
+ nestedDialogOpen
292
+ };
293
+ const shouldRender = keepMounted || mounted;
294
+ return useRenderElement('div', componentProps, {
295
+ enabled: shouldRender,
296
+ state,
297
+ ref: [forwardedRef, store.useStateSetter('viewportElement')],
298
+ stateAttributesMapping,
299
+ props: [{
300
+ role: 'presentation',
301
+ hidden: !mounted,
302
+ style: {
303
+ pointerEvents: !open ? 'none' : undefined
304
+ },
305
+ children
306
+ }, elementProps]
307
+ });
308
+ });
309
+ if (process.env.NODE_ENV !== "production") DialogViewport.displayName = "DialogViewport";
310
+
311
+ /**
312
+ * A handle to control a Dialog imperatively and to associate detached triggers with it.
313
+ */
314
+ class DialogHandle {
315
+ /**
316
+ * Internal store holding the dialog state.
317
+ * @internal
318
+ */
319
+
320
+ constructor(store) {
321
+ this.store = store ?? new DialogStore();
322
+ }
323
+
324
+ /**
325
+ * Opens the dialog and associates it with the trigger with the given id.
326
+ * The trigger, if provided, must be a Dialog.Trigger component with this handle passed as a prop.
327
+ *
328
+ * This method should only be called in an event handler or an effect (not during rendering).
329
+ *
330
+ * @param triggerId ID of the trigger to associate with the dialog. If null, the dialog will open without a trigger association.
331
+ */
332
+ open(triggerId) {
333
+ const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : undefined;
334
+ if (process.env.NODE_ENV !== 'production') {
335
+ if (triggerId && !triggerElement) {
336
+ console.warn(`Base UI: DialogHandle.open: No trigger found with id "${triggerId}". The dialog will open, but the trigger will not be associated with the dialog.`);
337
+ }
338
+ }
339
+ this.store.setOpen(true, createChangeEventDetails(imperativeAction, undefined, triggerElement));
340
+ }
341
+
342
+ /**
343
+ * Opens the dialog and sets the payload.
344
+ * Does not associate the dialog with any trigger.
345
+ *
346
+ * @param payload Payload to set when opening the dialog.
347
+ */
348
+ openWithPayload(payload) {
349
+ this.store.set('payload', payload);
350
+ this.store.setOpen(true, createChangeEventDetails(imperativeAction, undefined, undefined));
351
+ }
352
+
353
+ /**
354
+ * Closes the dialog.
355
+ */
356
+ close() {
357
+ this.store.setOpen(false, createChangeEventDetails(imperativeAction, undefined, undefined));
358
+ }
359
+
360
+ /**
361
+ * Indicates whether the dialog is currently open.
362
+ */
363
+ get isOpen() {
364
+ return this.store.state.open;
365
+ }
366
+ }
367
+
368
+ /**
369
+ * Creates a new handle to connect a Dialog.Root with detached Dialog.Trigger components.
370
+ */
371
+ function createDialogHandle() {
372
+ return new DialogHandle();
373
+ }
374
+
375
+ /**
376
+ * A paragraph with additional information about the drawer.
377
+ * Renders a `<p>` element.
378
+ *
379
+ * Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
380
+ */
381
+ const DrawerDescription = DialogDescription;
382
+
383
+ export { DrawerDescription as D, DialogBackdrop as a, DialogViewport as b, DialogPopup as c, DialogDescription as d, createDialogHandle as e, DialogHandle as f };
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var ScrollAreaViewport = require('./ScrollAreaViewport-cjs.js');
5
+ var useRenderElement = require('./useRenderElement-cjs.js');
6
+ var useButton = require('./useButton-cjs.js');
7
+
8
+ function _interopNamespaceDefault(e) {
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
26
+
27
+ /**
28
+ * A button that closes the dialog.
29
+ * Renders a `<button>` element.
30
+ *
31
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
32
+ */
33
+ const DialogClose = /*#__PURE__*/React__namespace.forwardRef(function DialogClose(componentProps, forwardedRef) {
34
+ const {
35
+ render,
36
+ className,
37
+ disabled = false,
38
+ nativeButton = true,
39
+ ...elementProps
40
+ } = componentProps;
41
+ const {
42
+ store
43
+ } = ScrollAreaViewport.useDialogRootContext();
44
+ const open = store.useState('open');
45
+ function handleClick(event) {
46
+ if (open) {
47
+ store.setOpen(false, useButton.createChangeEventDetails(useButton.closePress, event.nativeEvent));
48
+ }
49
+ }
50
+ const {
51
+ getButtonProps,
52
+ buttonRef
53
+ } = useButton.useButton({
54
+ disabled,
55
+ native: nativeButton
56
+ });
57
+ const state = {
58
+ disabled
59
+ };
60
+ return useRenderElement.useRenderElement('button', componentProps, {
61
+ state,
62
+ ref: [forwardedRef, buttonRef],
63
+ props: [{
64
+ onClick: handleClick
65
+ }, elementProps, getButtonProps]
66
+ });
67
+ });
68
+ if (process.env.NODE_ENV !== "production") DialogClose.displayName = "DialogClose";
69
+
70
+ /**
71
+ * A heading that labels the dialog.
72
+ * Renders an `<h2>` element.
73
+ *
74
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
75
+ */
76
+ const DialogTitle = /*#__PURE__*/React__namespace.forwardRef(function DialogTitle(componentProps, forwardedRef) {
77
+ const {
78
+ render,
79
+ className,
80
+ id: idProp,
81
+ ...elementProps
82
+ } = componentProps;
83
+ const {
84
+ store
85
+ } = ScrollAreaViewport.useDialogRootContext();
86
+ const id = useButton.useBaseUiId(idProp);
87
+ store.useSyncedValueWithCleanup('titleElementId', id);
88
+ return useRenderElement.useRenderElement('h2', componentProps, {
89
+ ref: forwardedRef,
90
+ props: [{
91
+ id
92
+ }, elementProps]
93
+ });
94
+ });
95
+ if (process.env.NODE_ENV !== "production") DialogTitle.displayName = "DialogTitle";
96
+
97
+ /**
98
+ * A button that closes the drawer.
99
+ * Renders a `<button>` element.
100
+ *
101
+ * Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
102
+ */
103
+ const DrawerClose = DialogClose;
104
+
105
+ /**
106
+ * A heading that labels the drawer.
107
+ * Renders an `<h2>` element.
108
+ *
109
+ * Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
110
+ */
111
+ const DrawerTitle = DialogTitle;
112
+
113
+ exports.DialogClose = DialogClose;
114
+ exports.DialogTitle = DialogTitle;
115
+ exports.DrawerClose = DrawerClose;
116
+ exports.DrawerTitle = DrawerTitle;
@@ -0,0 +1,92 @@
1
+ import * as React from 'react';
2
+ import { u as useDialogRootContext } from './ScrollAreaViewport-es.js';
3
+ import { u as useRenderElement } from './useRenderElement-es.js';
4
+ import { c as useButton, d as createChangeEventDetails, e as closePress, u as useBaseUiId } from './useButton-es.js';
5
+
6
+ /**
7
+ * A button that closes the dialog.
8
+ * Renders a `<button>` element.
9
+ *
10
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
11
+ */
12
+ const DialogClose = /*#__PURE__*/React.forwardRef(function DialogClose(componentProps, forwardedRef) {
13
+ const {
14
+ render,
15
+ className,
16
+ disabled = false,
17
+ nativeButton = true,
18
+ ...elementProps
19
+ } = componentProps;
20
+ const {
21
+ store
22
+ } = useDialogRootContext();
23
+ const open = store.useState('open');
24
+ function handleClick(event) {
25
+ if (open) {
26
+ store.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent));
27
+ }
28
+ }
29
+ const {
30
+ getButtonProps,
31
+ buttonRef
32
+ } = useButton({
33
+ disabled,
34
+ native: nativeButton
35
+ });
36
+ const state = {
37
+ disabled
38
+ };
39
+ return useRenderElement('button', componentProps, {
40
+ state,
41
+ ref: [forwardedRef, buttonRef],
42
+ props: [{
43
+ onClick: handleClick
44
+ }, elementProps, getButtonProps]
45
+ });
46
+ });
47
+ if (process.env.NODE_ENV !== "production") DialogClose.displayName = "DialogClose";
48
+
49
+ /**
50
+ * A heading that labels the dialog.
51
+ * Renders an `<h2>` element.
52
+ *
53
+ * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)
54
+ */
55
+ const DialogTitle = /*#__PURE__*/React.forwardRef(function DialogTitle(componentProps, forwardedRef) {
56
+ const {
57
+ render,
58
+ className,
59
+ id: idProp,
60
+ ...elementProps
61
+ } = componentProps;
62
+ const {
63
+ store
64
+ } = useDialogRootContext();
65
+ const id = useBaseUiId(idProp);
66
+ store.useSyncedValueWithCleanup('titleElementId', id);
67
+ return useRenderElement('h2', componentProps, {
68
+ ref: forwardedRef,
69
+ props: [{
70
+ id
71
+ }, elementProps]
72
+ });
73
+ });
74
+ if (process.env.NODE_ENV !== "production") DialogTitle.displayName = "DialogTitle";
75
+
76
+ /**
77
+ * A button that closes the drawer.
78
+ * Renders a `<button>` element.
79
+ *
80
+ * Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
81
+ */
82
+ const DrawerClose = DialogClose;
83
+
84
+ /**
85
+ * A heading that labels the drawer.
86
+ * Renders an `<h2>` element.
87
+ *
88
+ * Documentation: [Base UI Drawer](https://base-ui.com/react/components/drawer)
89
+ */
90
+ const DrawerTitle = DialogTitle;
91
+
92
+ export { DrawerTitle as D, DrawerClose as a, DialogTitle as b, DialogClose as c };