@jobber/components 8.25.0 → 8.25.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/dist/Dialog/Dialog.d.ts +47 -3
- package/dist/Dialog/Dialog.types.d.ts +1 -15
- package/dist/Dialog/DialogBottomSheet.d.ts +12 -13
- package/dist/Dialog/DialogModal.d.ts +11 -11
- package/dist/Dialog/dialogComposableShared.d.ts +13 -3
- package/dist/InputNumberExperimental-cjs.js +21 -25
- package/dist/InputNumberExperimental-es.js +22 -26
- package/dist/dialogReturnFocus-cjs.js +57 -31
- package/dist/dialogReturnFocus-es.js +59 -33
- package/dist/docs/Dialog/Dialog.md +953 -0
- package/dist/docs/InputNumberExperimental/InputNumberExperimental.md +519 -0
- package/dist/docs/index.md +2 -0
- package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +31 -15
- package/dist/primitives/InputNumberExperimental/types.d.ts +0 -1
- package/package.json +7 -2
|
@@ -4,11 +4,11 @@ import { useWindowDimensions } from '@jobber/hooks';
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { n as normalizeBaseUiButtonProps, i as isAtlantisButtonRenderTarget, s as stripNativeTypeFromButtonRenderTarget, r as renderAtlantisButtonTarget } from './buttonRenderAdapter-es.js';
|
|
6
6
|
import { B as Button } from './Button-es.js';
|
|
7
|
-
import { S as ScrollAreaRoot, e as ScrollAreaViewport, g as DialogRoot
|
|
7
|
+
import { S as ScrollAreaRoot, e as ScrollAreaViewport, g as DialogRoot, h as DialogTrigger$1, i as DialogPortal } from './ScrollAreaViewport-es.js';
|
|
8
|
+
import { m as mergeProps } from './useRenderElement-es.js';
|
|
8
9
|
import { H as Heading } from './Heading-es.js';
|
|
9
10
|
import { a as BottomSheet, B as BottomSheetScrollAreaContext } from './BottomSheet-es.js';
|
|
10
11
|
import { D as DrawerTitle, a as DrawerClose, b as DialogTitle$1, c as DialogClose$1 } from './DrawerTitle-es.js';
|
|
11
|
-
import { m as mergeProps } from './useRenderElement-es.js';
|
|
12
12
|
import { D as DrawerDescription, a as DialogBackdrop, b as DialogViewport, c as DialogPopup, d as DialogDescription, e as createDialogHandle } from './DrawerDescription-es.js';
|
|
13
13
|
|
|
14
14
|
// Copied from Menu's constant so the two surfaces agree on what "mobile" means.
|
|
@@ -79,6 +79,24 @@ function resolveComposableCloseRender({ children, render, }) {
|
|
|
79
79
|
return renderAtlantisButtonTarget(React__default.createElement(Button, { type: "tertiary", variation: "subtle", ariaLabel: "Close dialog" },
|
|
80
80
|
React__default.createElement(Button.Icon, { name: "remove" })));
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Adapts a `Dialog.Content` `render` for the bottom sheet's drawer popup. A
|
|
84
|
+
* render element passes through; a render function is wrapped to receive the
|
|
85
|
+
* drawer's state re-shaped as the dialog popup's state (e.g. `nestedDrawerOpen`
|
|
86
|
+
* becomes `nestedDialogOpen`), so `render` sees the same shape as the desktop
|
|
87
|
+
* dialog.
|
|
88
|
+
*/
|
|
89
|
+
function resolveBottomSheetContentRender(render) {
|
|
90
|
+
if (typeof render !== "function") {
|
|
91
|
+
return render;
|
|
92
|
+
}
|
|
93
|
+
return (props, drawerState) => render(props, {
|
|
94
|
+
open: drawerState.open,
|
|
95
|
+
transitionStatus: drawerState.transitionStatus,
|
|
96
|
+
nested: drawerState.nested,
|
|
97
|
+
nestedDialogOpen: drawerState.nestedDrawerOpen,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
82
100
|
const DialogContext = React__default.createContext({
|
|
83
101
|
type: "dialog",
|
|
84
102
|
size: "base",
|
|
@@ -132,15 +150,26 @@ function SharedDialogFooter(_a) {
|
|
|
132
150
|
const sticky = !useInsideDialogScrollArea();
|
|
133
151
|
return (React__default.createElement("div", Object.assign({}, rest, { className: classnames(styles.footer, className), style: style, "data-sticky": sticky || undefined, "data-testid": "ATL-Dialog-Footer" }), children));
|
|
134
152
|
}
|
|
153
|
+
function renderActionButton(action, defaults) {
|
|
154
|
+
if (!action)
|
|
155
|
+
return null;
|
|
156
|
+
return isValidElement(action) ? (action) : (React__default.createElement(Button, Object.assign({}, mergeProps(defaults, action))));
|
|
157
|
+
}
|
|
135
158
|
/**
|
|
136
159
|
* The action-button layout: tertiary on the left, primary/secondary grouped on
|
|
137
160
|
* the right. Drop it inside a `Dialog.Footer`.
|
|
138
161
|
*/
|
|
139
162
|
function DialogActions(_a) {
|
|
140
163
|
var { primary, secondary, tertiary, align = "right", className, style } = _a, rest = __rest(_a, ["primary", "secondary", "tertiary", "align", "className", "style"]);
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
|
|
164
|
+
const primaryAction = renderActionButton(primary, { type: "primary" });
|
|
165
|
+
const secondaryAction = renderActionButton(secondary, {
|
|
166
|
+
type: "primary",
|
|
167
|
+
variation: "subtle",
|
|
168
|
+
});
|
|
169
|
+
const tertiaryAction = renderActionButton(tertiary, {
|
|
170
|
+
type: "secondary",
|
|
171
|
+
variation: "destructive",
|
|
172
|
+
});
|
|
144
173
|
return (React__default.createElement("div", Object.assign({}, rest, { className: classnames(actionsStyles.actions, [actionsStyles[`align-${align}`]], className), style: style, "data-testid": "ATL-Dialog-Actions" }),
|
|
145
174
|
tertiary && (React__default.createElement("div", { className: actionsStyles.leftActions }, tertiaryAction)),
|
|
146
175
|
React__default.createElement("div", { className: classnames(actionsStyles.buttonGroup, actionsStyles[`align-${align}`]) },
|
|
@@ -148,20 +177,23 @@ function DialogActions(_a) {
|
|
|
148
177
|
primary && primaryAction)));
|
|
149
178
|
}
|
|
150
179
|
|
|
151
|
-
function
|
|
180
|
+
function DialogBottomSheet(props) {
|
|
152
181
|
return (React__default.createElement(BottomSheet.Root, Object.assign({}, props)));
|
|
153
182
|
}
|
|
154
183
|
function DialogBottomSheetTrigger(props) {
|
|
155
184
|
return (React__default.createElement(BottomSheet.Trigger, Object.assign({}, props)));
|
|
156
185
|
}
|
|
157
186
|
function DialogBottomSheetContent(_a) {
|
|
158
|
-
var { children, className, style } = _a, rest = __rest(_a, ["children", "className", "style"]);
|
|
187
|
+
var { children, className, style, render } = _a, rest = __rest(_a, ["children", "className", "style", "render"]);
|
|
159
188
|
const { type, size, finalFocus } = useDialogContext();
|
|
160
189
|
return (
|
|
161
190
|
// Opt-out of the BottomSheet's built-in scroll area.
|
|
162
191
|
// Dialog will handle the scroll area itself.
|
|
163
192
|
React__default.createElement(BottomSheetScrollAreaContext.Provider, { value: false },
|
|
164
|
-
React__default.createElement(BottomSheet.Popup, Object.assign({}, rest, {
|
|
193
|
+
React__default.createElement(BottomSheet.Popup, Object.assign({}, rest, {
|
|
194
|
+
// The bottom sheet is backed by a drawer popup, so re-shape its state
|
|
195
|
+
// into the dialog popup state the consumer's `render` is typed against.
|
|
196
|
+
render: resolveBottomSheetContentRender(render), className: classnames(styles.sheetSurface, className), style: style, role: type, finalFocus: finalFocus, "data-dialog-variant": "sheet", "data-size": size }), children)));
|
|
165
197
|
}
|
|
166
198
|
function DialogBottomSheetTitle(_a) {
|
|
167
199
|
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
@@ -192,19 +224,17 @@ function DialogBottomSheetBody(_a) {
|
|
|
192
224
|
return insideScrollArea ? (content) : (React__default.createElement(DialogBottomSheetScrollArea, null, content));
|
|
193
225
|
}
|
|
194
226
|
/** Mobile shell: a bottom sheet built on the BottomSheet/Drawer primitives. */
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
ScrollArea: DialogBottomSheetScrollArea,
|
|
204
|
-
});
|
|
227
|
+
DialogBottomSheet.Trigger = DialogBottomSheetTrigger;
|
|
228
|
+
DialogBottomSheet.Content = DialogBottomSheetContent;
|
|
229
|
+
DialogBottomSheet.Header = SharedDialogHeader;
|
|
230
|
+
DialogBottomSheet.Title = DialogBottomSheetTitle;
|
|
231
|
+
DialogBottomSheet.Close = DialogBottomSheetClose;
|
|
232
|
+
DialogBottomSheet.Body = DialogBottomSheetBody;
|
|
233
|
+
DialogBottomSheet.Footer = SharedDialogFooter;
|
|
234
|
+
DialogBottomSheet.ScrollArea = DialogBottomSheetScrollArea;
|
|
205
235
|
|
|
206
|
-
function
|
|
207
|
-
return React__default.createElement(DialogRoot
|
|
236
|
+
function DialogModal(props) {
|
|
237
|
+
return React__default.createElement(DialogRoot, Object.assign({}, props));
|
|
208
238
|
}
|
|
209
239
|
function DialogModalTrigger(_a) {
|
|
210
240
|
var { children, render, handle, payload, className, style } = _a, rest = __rest(_a, ["children", "render", "handle", "payload", "className", "style"]);
|
|
@@ -236,17 +266,14 @@ function DialogModalBody(_a) {
|
|
|
236
266
|
const content = (React__default.createElement(DialogDescription, { render: descriptionProps => (React__default.createElement("div", Object.assign({}, rest, descriptionProps, { className: classnames(styles.body, { [styles.fullBleed]: fullBleed }, className), style: style }), children)) }));
|
|
237
267
|
return insideScrollArea ? (content) : (React__default.createElement(DialogScrollArea$1, null, content));
|
|
238
268
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
// The modal keeps the plain native-scrollbar scroll region.
|
|
248
|
-
ScrollArea: DialogScrollArea$1,
|
|
249
|
-
});
|
|
269
|
+
DialogModal.Trigger = DialogModalTrigger;
|
|
270
|
+
DialogModal.Content = DialogModalContent;
|
|
271
|
+
DialogModal.Header = SharedDialogHeader;
|
|
272
|
+
DialogModal.Title = DialogModalTitle;
|
|
273
|
+
DialogModal.Close = DialogModalClose;
|
|
274
|
+
DialogModal.Body = DialogModalBody;
|
|
275
|
+
DialogModal.Footer = SharedDialogFooter;
|
|
276
|
+
DialogModal.ScrollArea = DialogScrollArea$1;
|
|
250
277
|
|
|
251
278
|
/**
|
|
252
279
|
* Creates a handle that opens/closes a `Dialog` from detached triggers (e.g. an
|
|
@@ -271,7 +298,7 @@ function useDialogShell() {
|
|
|
271
298
|
* desktop, a bottom sheet on mobile. Compose it with `Dialog.Trigger`,
|
|
272
299
|
* `Dialog.Content`, and the layout parts.
|
|
273
300
|
*/
|
|
274
|
-
function
|
|
301
|
+
function Dialog(_a) {
|
|
275
302
|
var { onRequestClose, size = "base", type = "dialog", finalFocus, children, onOpenChange } = _a, rest = __rest(_a, ["onRequestClose", "size", "type", "finalFocus", "children", "onOpenChange"]);
|
|
276
303
|
function handleOpenChange(nextOpen, eventDetails) {
|
|
277
304
|
if (!nextOpen) {
|
|
@@ -337,7 +364,6 @@ function DialogScrollArea(props) {
|
|
|
337
364
|
const Shell = useDialogShell();
|
|
338
365
|
return React__default.createElement(Shell.ScrollArea, Object.assign({}, props));
|
|
339
366
|
}
|
|
340
|
-
const Dialog = DialogRoot;
|
|
341
367
|
Dialog.Trigger = DialogTrigger;
|
|
342
368
|
Dialog.Content = DialogContent;
|
|
343
369
|
Dialog.Header = DialogHeader;
|