@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
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { DialogBodyProps, DialogCloseProps, DialogContentProps, DialogFooterProps, DialogHandle, DialogHeaderProps, DialogRootProps, DialogScrollAreaProps, DialogTitleProps, DialogTriggerProps } from "./Dialog.types";
|
|
3
|
+
import { DialogActions } from "./dialogComposableShared";
|
|
4
|
+
/**
|
|
5
|
+
* The Dialog root is a centered modal on
|
|
6
|
+
* desktop, a bottom sheet on mobile. Compose it with `Dialog.Trigger`,
|
|
7
|
+
* `Dialog.Content`, and the layout parts.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Dialog<Payload = unknown>({ onRequestClose, size, type, finalFocus, children, onOpenChange, ...rest }: DialogRootProps<Payload>): React.JSX.Element;
|
|
10
|
+
export declare namespace Dialog {
|
|
11
|
+
var Trigger: typeof DialogTrigger;
|
|
12
|
+
var Content: typeof DialogContent;
|
|
13
|
+
var Header: typeof DialogHeader;
|
|
14
|
+
var Title: typeof DialogTitle;
|
|
15
|
+
var Close: typeof DialogClose;
|
|
16
|
+
var Body: typeof DialogBody;
|
|
17
|
+
var Footer: typeof DialogFooter;
|
|
18
|
+
var Actions: typeof DialogActions;
|
|
19
|
+
var ScrollArea: typeof DialogScrollArea;
|
|
20
|
+
var createHandle: <Payload = unknown>() => DialogHandle<Payload>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Opens the dialog. Accepts an Atlantis `<Button>` (via `children` or `render`)
|
|
24
|
+
* or links a detached `Dialog` through a matching `handle`.
|
|
25
|
+
*/
|
|
26
|
+
declare function DialogTrigger<Payload = unknown>(props: DialogTriggerProps<Payload>): React.JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* The dialog popup surface. Holds the `Header`, `Body`, and `Footer`; renders as a
|
|
29
|
+
* centered modal on desktop and a bottom sheet on mobile.
|
|
30
|
+
*/
|
|
31
|
+
declare function DialogContent(props: DialogContentProps): React.JSX.Element;
|
|
32
|
+
/** Layout-only header row — typically a `Dialog.Title` and a `Dialog.Close`. */
|
|
33
|
+
declare function DialogHeader(props: DialogHeaderProps): React.JSX.Element;
|
|
34
|
+
/** The dialog's accessible title; wired to `aria-labelledby`. */
|
|
35
|
+
declare function DialogTitle(props: DialogTitleProps): React.JSX.Element;
|
|
36
|
+
/** A dismiss button that closes the dialog. */
|
|
37
|
+
declare function DialogClose(props: DialogCloseProps): React.JSX.Element;
|
|
38
|
+
/** The dialog body; wired to `aria-describedby`. */
|
|
39
|
+
declare function DialogBody(props: DialogBodyProps): React.JSX.Element;
|
|
40
|
+
/** Footer region for actions or supporting content. */
|
|
41
|
+
declare function DialogFooter(props: DialogFooterProps): React.JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* Advanced scroll region. Delegates to the shell: the modal uses a native
|
|
44
|
+
* scrollbar; the sheet uses the BottomSheet primitive's scroll area (with fade).
|
|
45
|
+
*/
|
|
46
|
+
declare function DialogScrollArea(props: DialogScrollAreaProps): React.JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties, ComponentPropsWithRef, ComponentPropsWithoutRef,
|
|
1
|
+
import type { CSSProperties, ComponentPropsWithRef, ComponentPropsWithoutRef, ReactElement, ReactNode } from "react";
|
|
2
2
|
import type { Dialog as BaseDialog } from "../unstyledPrimitives";
|
|
3
3
|
import type { ButtonProps } from "../Button";
|
|
4
4
|
type BaseUIPropsToExclude = "render" | "className" | "style" | "ref" | "children";
|
|
@@ -162,20 +162,6 @@ export interface DialogContextValue {
|
|
|
162
162
|
export interface DialogProviderProps extends DialogContextValue {
|
|
163
163
|
readonly children: ReactNode;
|
|
164
164
|
}
|
|
165
|
-
/** The assembled `Dialog` component: a root with the parts attached. */
|
|
166
|
-
export interface DialogComponent {
|
|
167
|
-
<Payload = unknown>(props: DialogRootProps<Payload>): ReactElement;
|
|
168
|
-
Trigger: <Payload = unknown>(props: DialogTriggerProps<Payload>) => ReactElement;
|
|
169
|
-
Content: FunctionComponent<DialogContentProps>;
|
|
170
|
-
Header: FunctionComponent<DialogHeaderProps>;
|
|
171
|
-
Title: FunctionComponent<DialogTitleProps>;
|
|
172
|
-
Close: FunctionComponent<DialogCloseProps>;
|
|
173
|
-
Body: FunctionComponent<DialogBodyProps>;
|
|
174
|
-
Footer: FunctionComponent<DialogFooterProps>;
|
|
175
|
-
Actions: FunctionComponent<DialogActionsProps>;
|
|
176
|
-
ScrollArea: FunctionComponent<DialogScrollAreaProps>;
|
|
177
|
-
createHandle: <Payload = unknown>() => DialogHandle<Payload>;
|
|
178
|
-
}
|
|
179
165
|
export type DialogActionsAlign = "left" | "right" | "fullWidth";
|
|
180
166
|
interface DialogActionsBaseProps extends DialogBaseProps, Omit<ComponentPropsWithoutRef<"div">, "className" | "style" | "children"> {
|
|
181
167
|
/** Primary action (right). */
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DialogBodyProps, DialogCloseProps, DialogContentProps, DialogScrollAreaProps, DialogShellRootProps, DialogTitleProps, DialogTriggerProps } from "./Dialog.types";
|
|
3
3
|
import { SharedDialogFooter, SharedDialogHeader } from "./dialogComposableShared";
|
|
4
|
-
declare function
|
|
4
|
+
export declare function DialogBottomSheet(props: DialogShellRootProps): React.JSX.Element;
|
|
5
|
+
export declare namespace DialogBottomSheet {
|
|
6
|
+
var Trigger: typeof DialogBottomSheetTrigger;
|
|
7
|
+
var Content: typeof DialogBottomSheetContent;
|
|
8
|
+
var Header: typeof SharedDialogHeader;
|
|
9
|
+
var Title: typeof DialogBottomSheetTitle;
|
|
10
|
+
var Close: typeof DialogBottomSheetClose;
|
|
11
|
+
var Body: typeof DialogBottomSheetBody;
|
|
12
|
+
var Footer: typeof SharedDialogFooter;
|
|
13
|
+
var ScrollArea: typeof DialogBottomSheetScrollArea;
|
|
14
|
+
}
|
|
5
15
|
declare function DialogBottomSheetTrigger<Payload = unknown>(props: DialogTriggerProps<Payload>): React.JSX.Element;
|
|
6
|
-
declare function DialogBottomSheetContent({ children, className, style, ...rest }: DialogContentProps): React.JSX.Element;
|
|
16
|
+
declare function DialogBottomSheetContent({ children, className, style, render, ...rest }: DialogContentProps): React.JSX.Element;
|
|
7
17
|
declare function DialogBottomSheetTitle({ children, ...rest }: DialogTitleProps): React.JSX.Element;
|
|
8
18
|
declare function DialogBottomSheetClose({ children, render, ...rest }: DialogCloseProps): React.JSX.Element;
|
|
9
19
|
/**
|
|
@@ -14,15 +24,4 @@ declare function DialogBottomSheetClose({ children, render, ...rest }: DialogClo
|
|
|
14
24
|
*/
|
|
15
25
|
declare function DialogBottomSheetScrollArea({ children, className, style, }: DialogScrollAreaProps): React.JSX.Element;
|
|
16
26
|
declare function DialogBottomSheetBody({ children, fullBleed, className, style, ...rest }: DialogBodyProps): React.JSX.Element;
|
|
17
|
-
/** Mobile shell: a bottom sheet built on the BottomSheet/Drawer primitives. */
|
|
18
|
-
export declare const DialogBottomSheet: typeof DialogBottomSheetRoot & {
|
|
19
|
-
Trigger: typeof DialogBottomSheetTrigger;
|
|
20
|
-
Content: typeof DialogBottomSheetContent;
|
|
21
|
-
Header: typeof SharedDialogHeader;
|
|
22
|
-
Title: typeof DialogBottomSheetTitle;
|
|
23
|
-
Close: typeof DialogBottomSheetClose;
|
|
24
|
-
Body: typeof DialogBottomSheetBody;
|
|
25
|
-
Footer: typeof SharedDialogFooter;
|
|
26
|
-
ScrollArea: typeof DialogBottomSheetScrollArea;
|
|
27
|
-
};
|
|
28
27
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DialogBodyProps, DialogCloseProps, DialogContentProps, DialogShellRootProps, DialogTitleProps, DialogTriggerProps } from "./Dialog.types";
|
|
3
3
|
import { DialogScrollArea, SharedDialogFooter, SharedDialogHeader } from "./dialogComposableShared";
|
|
4
|
-
declare function
|
|
4
|
+
export declare function DialogModal(props: DialogShellRootProps): React.JSX.Element;
|
|
5
|
+
export declare namespace DialogModal {
|
|
6
|
+
var Trigger: typeof DialogModalTrigger;
|
|
7
|
+
var Content: typeof DialogModalContent;
|
|
8
|
+
var Header: typeof SharedDialogHeader;
|
|
9
|
+
var Title: typeof DialogModalTitle;
|
|
10
|
+
var Close: typeof DialogModalClose;
|
|
11
|
+
var Body: typeof DialogModalBody;
|
|
12
|
+
var Footer: typeof SharedDialogFooter;
|
|
13
|
+
var ScrollArea: typeof DialogScrollArea;
|
|
14
|
+
}
|
|
5
15
|
declare function DialogModalTrigger<Payload = unknown>({ children, render, handle, payload, className, style, ...rest }: DialogTriggerProps<Payload>): React.JSX.Element;
|
|
6
16
|
declare function DialogModalContent({ children, className, style, ...rest }: DialogContentProps): React.JSX.Element;
|
|
7
17
|
declare function DialogModalTitle({ children, ...rest }: DialogTitleProps): React.JSX.Element;
|
|
8
18
|
declare function DialogModalClose({ children, render, ...rest }: DialogCloseProps): React.JSX.Element;
|
|
9
19
|
declare function DialogModalBody({ children, fullBleed, className, style, ...rest }: DialogBodyProps): React.JSX.Element;
|
|
10
|
-
export declare const DialogModal: typeof DialogModalRoot & {
|
|
11
|
-
Trigger: typeof DialogModalTrigger;
|
|
12
|
-
Content: typeof DialogModalContent;
|
|
13
|
-
Header: typeof SharedDialogHeader;
|
|
14
|
-
Title: typeof DialogModalTitle;
|
|
15
|
-
Close: typeof DialogModalClose;
|
|
16
|
-
Body: typeof DialogModalBody;
|
|
17
|
-
Footer: typeof SharedDialogFooter;
|
|
18
|
-
ScrollArea: typeof DialogScrollArea;
|
|
19
|
-
};
|
|
20
20
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
1
2
|
import React from "react";
|
|
2
|
-
import type { DialogActionsProps, DialogCloseRender, DialogContextValue, DialogFooterProps, DialogHeaderProps, DialogProviderProps, DialogScrollAreaProps, DialogTriggerRender } from "./Dialog.types";
|
|
3
|
+
import type { DialogActionsProps, DialogCloseRender, DialogContentProps, DialogContextValue, DialogFooterProps, DialogHeaderProps, DialogProviderProps, DialogScrollAreaProps, DialogTriggerRender } from "./Dialog.types";
|
|
4
|
+
import { type Drawer as BaseDrawer } from "../unstyledPrimitives";
|
|
3
5
|
/**
|
|
4
6
|
* Resolves the trigger element for `Dialog.Trigger`. Copied from Menu's
|
|
5
7
|
* `resolveMenuTriggerRender` so an Atlantis `<Button>` works as a trigger via
|
|
@@ -9,7 +11,7 @@ import type { DialogActionsProps, DialogCloseRender, DialogContextValue, DialogF
|
|
|
9
11
|
export declare function resolveComposableTriggerRender({ children, render, }: {
|
|
10
12
|
readonly children?: React.ReactNode;
|
|
11
13
|
readonly render?: DialogTriggerRender;
|
|
12
|
-
}):
|
|
14
|
+
}): ReactElement<unknown, string | React.JSXElementConstructor<any>> | ((props: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>) => React.JSX.Element);
|
|
13
15
|
/**
|
|
14
16
|
* Resolves the dismiss element for `Dialog.Close`, mirroring
|
|
15
17
|
* `resolveComposableTriggerRender` so a custom render works in both shells.
|
|
@@ -20,7 +22,15 @@ export declare function resolveComposableTriggerRender({ children, render, }: {
|
|
|
20
22
|
export declare function resolveComposableCloseRender({ children, render, }: {
|
|
21
23
|
readonly children?: React.ReactNode;
|
|
22
24
|
readonly render?: DialogCloseRender;
|
|
23
|
-
}):
|
|
25
|
+
}): ReactElement<unknown, string | React.JSXElementConstructor<any>> | ((props: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>) => React.JSX.Element);
|
|
26
|
+
/**
|
|
27
|
+
* Adapts a `Dialog.Content` `render` for the bottom sheet's drawer popup. A
|
|
28
|
+
* render element passes through; a render function is wrapped to receive the
|
|
29
|
+
* drawer's state re-shaped as the dialog popup's state (e.g. `nestedDrawerOpen`
|
|
30
|
+
* becomes `nestedDialogOpen`), so `render` sees the same shape as the desktop
|
|
31
|
+
* dialog.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveBottomSheetContentRender(render: DialogContentProps["render"]): React.ComponentProps<typeof BaseDrawer.Popup>["render"];
|
|
24
34
|
/** Supplies the static config (type/size/isMobile/finalFocus) to the parts. */
|
|
25
35
|
export declare function DialogProvider({ children, type, size, isMobile, finalFocus, }: DialogProviderProps): React.JSX.Element;
|
|
26
36
|
/** Reads the Dialog config; throws if a part is used outside `<Dialog>`. */
|
|
@@ -901,8 +901,9 @@ function useInputNumberExperimentalContext(consumer) {
|
|
|
901
901
|
}
|
|
902
902
|
return context;
|
|
903
903
|
}
|
|
904
|
-
function
|
|
905
|
-
|
|
904
|
+
function InputNumberExperimentalWrapper(_a) {
|
|
905
|
+
var { ref } = _a, props = tslib_es6.__rest(_a, ["ref"]);
|
|
906
|
+
const { align, autoComplete, children, className, disabled, format, id: idProp, inline, inputMode, invalid, loading, max, min, name, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, onValueCommitted, readOnly, showMiniLabel = true, size = "default", step = 1, style, value, } = props;
|
|
906
907
|
const generatedId = React.useId();
|
|
907
908
|
const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
|
|
908
909
|
const innerInputRef = React.useRef(null);
|
|
@@ -938,7 +939,6 @@ function InputNumberExperimentalWrapperInternal(props, ref) {
|
|
|
938
939
|
inputMode,
|
|
939
940
|
loading,
|
|
940
941
|
max,
|
|
941
|
-
maxLength,
|
|
942
942
|
min,
|
|
943
943
|
onBlur,
|
|
944
944
|
onFocus,
|
|
@@ -961,7 +961,6 @@ function InputNumberExperimentalWrapperInternal(props, ref) {
|
|
|
961
961
|
inputMode,
|
|
962
962
|
loading,
|
|
963
963
|
max,
|
|
964
|
-
maxLength,
|
|
965
964
|
min,
|
|
966
965
|
onBlur,
|
|
967
966
|
onFocus,
|
|
@@ -999,7 +998,7 @@ function InputNumberExperimentalInput({ children, className, style, }) {
|
|
|
999
998
|
className: classnames(styles.inputWrapper, !ctx.showMiniLabel && styles.hideLabel, ctx.size !== "default" && styles[ctx.size], ctx.disabled && styles.disabled),
|
|
1000
999
|
}, { className, style });
|
|
1001
1000
|
return (React.createElement("div", Object.assign({}, rootProps),
|
|
1002
|
-
React.createElement(NumberFieldInput.NumberFieldInput, { "aria-busy": ctx.loading || undefined, autoComplete: resolveAutoComplete(ctx.autoComplete), className: styles.input, inputMode: ctx.inputMode,
|
|
1001
|
+
React.createElement(NumberFieldInput.NumberFieldInput, { "aria-busy": ctx.loading || undefined, autoComplete: resolveAutoComplete(ctx.autoComplete), className: styles.input, inputMode: ctx.inputMode, onBlur: ctx.onBlur, onFocus: ctx.onFocus, onKeyDown: ctx.onKeyDown, onKeyUp: ctx.onKeyUp, placeholder: " ", ref: ctx.innerInputRef }),
|
|
1003
1002
|
children));
|
|
1004
1003
|
}
|
|
1005
1004
|
function InputNumberExperimentalLabel({ children, className, style, }) {
|
|
@@ -1099,10 +1098,11 @@ function resolveAutoComplete(autoComplete) {
|
|
|
1099
1098
|
* consumer would write by hand with `<InputNumberExperimental.Wrapper>` and the
|
|
1100
1099
|
* parts — to customize a single piece, copy this tree and swap that part.
|
|
1101
1100
|
*/
|
|
1102
|
-
function
|
|
1103
|
-
var
|
|
1101
|
+
function InputNumberExperimental(_a) {
|
|
1102
|
+
var _b;
|
|
1103
|
+
var { ref } = _a, props = tslib_es6.__rest(_a, ["ref"]);
|
|
1104
1104
|
const { label, description, error, prefix, suffix } = props, config = tslib_es6.__rest(props, ["label", "description", "error", "prefix", "suffix"]);
|
|
1105
|
-
const size = (
|
|
1105
|
+
const size = (_b = config.size) !== null && _b !== void 0 ? _b : "default";
|
|
1106
1106
|
return (React.createElement(InputNumberExperimentalWrapper, Object.assign({}, config, { invalid: config.invalid || Boolean(error), ref: ref }),
|
|
1107
1107
|
React.createElement(InputNumberExperimentalGroup, null,
|
|
1108
1108
|
prefix && renderDefaultAffix("prefix", prefix, size),
|
|
@@ -1114,10 +1114,8 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
1114
1114
|
React.createElement(InputNumberExperimentalDescription, null, description),
|
|
1115
1115
|
React.createElement(InputNumberExperimentalError, null, error)))));
|
|
1116
1116
|
}
|
|
1117
|
-
const InputNumberExperimentalWrapper = React.forwardRef(InputNumberExperimentalWrapperInternal);
|
|
1118
1117
|
InputNumberExperimentalWrapper.displayName = "InputNumberExperimental.Wrapper";
|
|
1119
|
-
|
|
1120
|
-
InputNumberExperimentalBase.displayName = "InputNumberExperimental";
|
|
1118
|
+
InputNumberExperimental.displayName = "InputNumberExperimental";
|
|
1121
1119
|
InputNumberExperimentalGroup.displayName = "InputNumberExperimental.Group";
|
|
1122
1120
|
InputNumberExperimentalFooter.displayName = "InputNumberExperimental.Footer";
|
|
1123
1121
|
InputNumberExperimentalInput.displayName = "InputNumberExperimental.Input";
|
|
@@ -1133,19 +1131,17 @@ InputNumberExperimentalDecrement.displayName =
|
|
|
1133
1131
|
"InputNumberExperimental.Decrement";
|
|
1134
1132
|
InputNumberExperimentalAffixCompound.displayName =
|
|
1135
1133
|
"InputNumberExperimental.Affix";
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
Affix: InputNumberExperimentalAffixCompound,
|
|
1149
|
-
});
|
|
1134
|
+
InputNumberExperimental.Wrapper = InputNumberExperimentalWrapper;
|
|
1135
|
+
InputNumberExperimental.Group = InputNumberExperimentalGroup;
|
|
1136
|
+
InputNumberExperimental.Footer = InputNumberExperimentalFooter;
|
|
1137
|
+
InputNumberExperimental.Input = InputNumberExperimentalInput;
|
|
1138
|
+
InputNumberExperimental.Label = InputNumberExperimentalLabel;
|
|
1139
|
+
InputNumberExperimental.Description = InputNumberExperimentalDescription;
|
|
1140
|
+
InputNumberExperimental.Error = InputNumberExperimentalError;
|
|
1141
|
+
InputNumberExperimental.Loading = InputNumberExperimentalLoading;
|
|
1142
|
+
InputNumberExperimental.Stepper = InputNumberExperimentalStepper;
|
|
1143
|
+
InputNumberExperimental.Increment = InputNumberExperimentalIncrement;
|
|
1144
|
+
InputNumberExperimental.Decrement = InputNumberExperimentalDecrement;
|
|
1145
|
+
InputNumberExperimental.Affix = InputNumberExperimentalAffixCompound;
|
|
1150
1146
|
|
|
1151
1147
|
exports.InputNumberExperimental = InputNumberExperimental;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { createContext,
|
|
3
|
+
import React__default, { createContext, useId, useRef, useImperativeHandle, useCallback, useMemo, useContext } from 'react';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { A as ActivityIndicator } from './ActivityIndicator-es.js';
|
|
6
6
|
import { B as Button } from './Button-es.js';
|
|
@@ -881,8 +881,9 @@ function useInputNumberExperimentalContext(consumer) {
|
|
|
881
881
|
}
|
|
882
882
|
return context;
|
|
883
883
|
}
|
|
884
|
-
function
|
|
885
|
-
|
|
884
|
+
function InputNumberExperimentalWrapper(_a) {
|
|
885
|
+
var { ref } = _a, props = __rest(_a, ["ref"]);
|
|
886
|
+
const { align, autoComplete, children, className, disabled, format, id: idProp, inline, inputMode, invalid, loading, max, min, name, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValueChange, onValueCommitted, readOnly, showMiniLabel = true, size = "default", step = 1, style, value, } = props;
|
|
886
887
|
const generatedId = useId();
|
|
887
888
|
const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
|
|
888
889
|
const innerInputRef = useRef(null);
|
|
@@ -918,7 +919,6 @@ function InputNumberExperimentalWrapperInternal(props, ref) {
|
|
|
918
919
|
inputMode,
|
|
919
920
|
loading,
|
|
920
921
|
max,
|
|
921
|
-
maxLength,
|
|
922
922
|
min,
|
|
923
923
|
onBlur,
|
|
924
924
|
onFocus,
|
|
@@ -941,7 +941,6 @@ function InputNumberExperimentalWrapperInternal(props, ref) {
|
|
|
941
941
|
inputMode,
|
|
942
942
|
loading,
|
|
943
943
|
max,
|
|
944
|
-
maxLength,
|
|
945
944
|
min,
|
|
946
945
|
onBlur,
|
|
947
946
|
onFocus,
|
|
@@ -979,7 +978,7 @@ function InputNumberExperimentalInput({ children, className, style, }) {
|
|
|
979
978
|
className: classnames(styles.inputWrapper, !ctx.showMiniLabel && styles.hideLabel, ctx.size !== "default" && styles[ctx.size], ctx.disabled && styles.disabled),
|
|
980
979
|
}, { className, style });
|
|
981
980
|
return (React__default.createElement("div", Object.assign({}, rootProps),
|
|
982
|
-
React__default.createElement(NumberFieldInput, { "aria-busy": ctx.loading || undefined, autoComplete: resolveAutoComplete(ctx.autoComplete), className: styles.input, inputMode: ctx.inputMode,
|
|
981
|
+
React__default.createElement(NumberFieldInput, { "aria-busy": ctx.loading || undefined, autoComplete: resolveAutoComplete(ctx.autoComplete), className: styles.input, inputMode: ctx.inputMode, onBlur: ctx.onBlur, onFocus: ctx.onFocus, onKeyDown: ctx.onKeyDown, onKeyUp: ctx.onKeyUp, placeholder: " ", ref: ctx.innerInputRef }),
|
|
983
982
|
children));
|
|
984
983
|
}
|
|
985
984
|
function InputNumberExperimentalLabel({ children, className, style, }) {
|
|
@@ -1079,10 +1078,11 @@ function resolveAutoComplete(autoComplete) {
|
|
|
1079
1078
|
* consumer would write by hand with `<InputNumberExperimental.Wrapper>` and the
|
|
1080
1079
|
* parts — to customize a single piece, copy this tree and swap that part.
|
|
1081
1080
|
*/
|
|
1082
|
-
function
|
|
1083
|
-
var
|
|
1081
|
+
function InputNumberExperimental(_a) {
|
|
1082
|
+
var _b;
|
|
1083
|
+
var { ref } = _a, props = __rest(_a, ["ref"]);
|
|
1084
1084
|
const { label, description, error, prefix, suffix } = props, config = __rest(props, ["label", "description", "error", "prefix", "suffix"]);
|
|
1085
|
-
const size = (
|
|
1085
|
+
const size = (_b = config.size) !== null && _b !== void 0 ? _b : "default";
|
|
1086
1086
|
return (React__default.createElement(InputNumberExperimentalWrapper, Object.assign({}, config, { invalid: config.invalid || Boolean(error), ref: ref }),
|
|
1087
1087
|
React__default.createElement(InputNumberExperimentalGroup, null,
|
|
1088
1088
|
prefix && renderDefaultAffix("prefix", prefix, size),
|
|
@@ -1094,10 +1094,8 @@ function InputNumberExperimentalInternal(props, ref) {
|
|
|
1094
1094
|
React__default.createElement(InputNumberExperimentalDescription, null, description),
|
|
1095
1095
|
React__default.createElement(InputNumberExperimentalError, null, error)))));
|
|
1096
1096
|
}
|
|
1097
|
-
const InputNumberExperimentalWrapper = forwardRef(InputNumberExperimentalWrapperInternal);
|
|
1098
1097
|
InputNumberExperimentalWrapper.displayName = "InputNumberExperimental.Wrapper";
|
|
1099
|
-
|
|
1100
|
-
InputNumberExperimentalBase.displayName = "InputNumberExperimental";
|
|
1098
|
+
InputNumberExperimental.displayName = "InputNumberExperimental";
|
|
1101
1099
|
InputNumberExperimentalGroup.displayName = "InputNumberExperimental.Group";
|
|
1102
1100
|
InputNumberExperimentalFooter.displayName = "InputNumberExperimental.Footer";
|
|
1103
1101
|
InputNumberExperimentalInput.displayName = "InputNumberExperimental.Input";
|
|
@@ -1113,19 +1111,17 @@ InputNumberExperimentalDecrement.displayName =
|
|
|
1113
1111
|
"InputNumberExperimental.Decrement";
|
|
1114
1112
|
InputNumberExperimentalAffixCompound.displayName =
|
|
1115
1113
|
"InputNumberExperimental.Affix";
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
Affix: InputNumberExperimentalAffixCompound,
|
|
1129
|
-
});
|
|
1114
|
+
InputNumberExperimental.Wrapper = InputNumberExperimentalWrapper;
|
|
1115
|
+
InputNumberExperimental.Group = InputNumberExperimentalGroup;
|
|
1116
|
+
InputNumberExperimental.Footer = InputNumberExperimentalFooter;
|
|
1117
|
+
InputNumberExperimental.Input = InputNumberExperimentalInput;
|
|
1118
|
+
InputNumberExperimental.Label = InputNumberExperimentalLabel;
|
|
1119
|
+
InputNumberExperimental.Description = InputNumberExperimentalDescription;
|
|
1120
|
+
InputNumberExperimental.Error = InputNumberExperimentalError;
|
|
1121
|
+
InputNumberExperimental.Loading = InputNumberExperimentalLoading;
|
|
1122
|
+
InputNumberExperimental.Stepper = InputNumberExperimentalStepper;
|
|
1123
|
+
InputNumberExperimental.Increment = InputNumberExperimentalIncrement;
|
|
1124
|
+
InputNumberExperimental.Decrement = InputNumberExperimentalDecrement;
|
|
1125
|
+
InputNumberExperimental.Affix = InputNumberExperimentalAffixCompound;
|
|
1130
1126
|
|
|
1131
1127
|
export { InputNumberExperimental as I };
|
|
@@ -7,10 +7,10 @@ var classnames = require('classnames');
|
|
|
7
7
|
var buttonRenderAdapter = require('./buttonRenderAdapter-cjs.js');
|
|
8
8
|
var Button = require('./Button-cjs.js');
|
|
9
9
|
var ScrollAreaViewport = require('./ScrollAreaViewport-cjs.js');
|
|
10
|
+
var useRenderElement = require('./useRenderElement-cjs.js');
|
|
10
11
|
var Heading = require('./Heading-cjs.js');
|
|
11
12
|
var BottomSheet = require('./BottomSheet-cjs.js');
|
|
12
13
|
var DrawerTitle = require('./DrawerTitle-cjs.js');
|
|
13
|
-
var useRenderElement = require('./useRenderElement-cjs.js');
|
|
14
14
|
var DrawerDescription = require('./DrawerDescription-cjs.js');
|
|
15
15
|
|
|
16
16
|
// Copied from Menu's constant so the two surfaces agree on what "mobile" means.
|
|
@@ -81,6 +81,24 @@ function resolveComposableCloseRender({ children, render, }) {
|
|
|
81
81
|
return buttonRenderAdapter.renderAtlantisButtonTarget(React.createElement(Button.Button, { type: "tertiary", variation: "subtle", ariaLabel: "Close dialog" },
|
|
82
82
|
React.createElement(Button.Button.Icon, { name: "remove" })));
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Adapts a `Dialog.Content` `render` for the bottom sheet's drawer popup. A
|
|
86
|
+
* render element passes through; a render function is wrapped to receive the
|
|
87
|
+
* drawer's state re-shaped as the dialog popup's state (e.g. `nestedDrawerOpen`
|
|
88
|
+
* becomes `nestedDialogOpen`), so `render` sees the same shape as the desktop
|
|
89
|
+
* dialog.
|
|
90
|
+
*/
|
|
91
|
+
function resolveBottomSheetContentRender(render) {
|
|
92
|
+
if (typeof render !== "function") {
|
|
93
|
+
return render;
|
|
94
|
+
}
|
|
95
|
+
return (props, drawerState) => render(props, {
|
|
96
|
+
open: drawerState.open,
|
|
97
|
+
transitionStatus: drawerState.transitionStatus,
|
|
98
|
+
nested: drawerState.nested,
|
|
99
|
+
nestedDialogOpen: drawerState.nestedDrawerOpen,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
84
102
|
const DialogContext = React.createContext({
|
|
85
103
|
type: "dialog",
|
|
86
104
|
size: "base",
|
|
@@ -134,15 +152,26 @@ function SharedDialogFooter(_a) {
|
|
|
134
152
|
const sticky = !useInsideDialogScrollArea();
|
|
135
153
|
return (React.createElement("div", Object.assign({}, rest, { className: classnames(styles.footer, className), style: style, "data-sticky": sticky || undefined, "data-testid": "ATL-Dialog-Footer" }), children));
|
|
136
154
|
}
|
|
155
|
+
function renderActionButton(action, defaults) {
|
|
156
|
+
if (!action)
|
|
157
|
+
return null;
|
|
158
|
+
return React.isValidElement(action) ? (action) : (React.createElement(Button.Button, Object.assign({}, useRenderElement.mergeProps(defaults, action))));
|
|
159
|
+
}
|
|
137
160
|
/**
|
|
138
161
|
* The action-button layout: tertiary on the left, primary/secondary grouped on
|
|
139
162
|
* the right. Drop it inside a `Dialog.Footer`.
|
|
140
163
|
*/
|
|
141
164
|
function DialogActions(_a) {
|
|
142
165
|
var { primary, secondary, tertiary, align = "right", className, style } = _a, rest = tslib_es6.__rest(_a, ["primary", "secondary", "tertiary", "align", "className", "style"]);
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
|
|
166
|
+
const primaryAction = renderActionButton(primary, { type: "primary" });
|
|
167
|
+
const secondaryAction = renderActionButton(secondary, {
|
|
168
|
+
type: "primary",
|
|
169
|
+
variation: "subtle",
|
|
170
|
+
});
|
|
171
|
+
const tertiaryAction = renderActionButton(tertiary, {
|
|
172
|
+
type: "secondary",
|
|
173
|
+
variation: "destructive",
|
|
174
|
+
});
|
|
146
175
|
return (React.createElement("div", Object.assign({}, rest, { className: classnames(actionsStyles.actions, [actionsStyles[`align-${align}`]], className), style: style, "data-testid": "ATL-Dialog-Actions" }),
|
|
147
176
|
tertiary && (React.createElement("div", { className: actionsStyles.leftActions }, tertiaryAction)),
|
|
148
177
|
React.createElement("div", { className: classnames(actionsStyles.buttonGroup, actionsStyles[`align-${align}`]) },
|
|
@@ -150,20 +179,23 @@ function DialogActions(_a) {
|
|
|
150
179
|
primary && primaryAction)));
|
|
151
180
|
}
|
|
152
181
|
|
|
153
|
-
function
|
|
182
|
+
function DialogBottomSheet(props) {
|
|
154
183
|
return (React.createElement(BottomSheet.BottomSheet.Root, Object.assign({}, props)));
|
|
155
184
|
}
|
|
156
185
|
function DialogBottomSheetTrigger(props) {
|
|
157
186
|
return (React.createElement(BottomSheet.BottomSheet.Trigger, Object.assign({}, props)));
|
|
158
187
|
}
|
|
159
188
|
function DialogBottomSheetContent(_a) {
|
|
160
|
-
var { children, className, style } = _a, rest = tslib_es6.__rest(_a, ["children", "className", "style"]);
|
|
189
|
+
var { children, className, style, render } = _a, rest = tslib_es6.__rest(_a, ["children", "className", "style", "render"]);
|
|
161
190
|
const { type, size, finalFocus } = useDialogContext();
|
|
162
191
|
return (
|
|
163
192
|
// Opt-out of the BottomSheet's built-in scroll area.
|
|
164
193
|
// Dialog will handle the scroll area itself.
|
|
165
194
|
React.createElement(BottomSheet.BottomSheetScrollAreaContext.Provider, { value: false },
|
|
166
|
-
React.createElement(BottomSheet.BottomSheet.Popup, Object.assign({}, rest, {
|
|
195
|
+
React.createElement(BottomSheet.BottomSheet.Popup, Object.assign({}, rest, {
|
|
196
|
+
// The bottom sheet is backed by a drawer popup, so re-shape its state
|
|
197
|
+
// into the dialog popup state the consumer's `render` is typed against.
|
|
198
|
+
render: resolveBottomSheetContentRender(render), className: classnames(styles.sheetSurface, className), style: style, role: type, finalFocus: finalFocus, "data-dialog-variant": "sheet", "data-size": size }), children)));
|
|
167
199
|
}
|
|
168
200
|
function DialogBottomSheetTitle(_a) {
|
|
169
201
|
var { children } = _a, rest = tslib_es6.__rest(_a, ["children"]);
|
|
@@ -194,18 +226,16 @@ function DialogBottomSheetBody(_a) {
|
|
|
194
226
|
return insideScrollArea ? (content) : (React.createElement(DialogBottomSheetScrollArea, null, content));
|
|
195
227
|
}
|
|
196
228
|
/** Mobile shell: a bottom sheet built on the BottomSheet/Drawer primitives. */
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
ScrollArea: DialogBottomSheetScrollArea,
|
|
206
|
-
});
|
|
229
|
+
DialogBottomSheet.Trigger = DialogBottomSheetTrigger;
|
|
230
|
+
DialogBottomSheet.Content = DialogBottomSheetContent;
|
|
231
|
+
DialogBottomSheet.Header = SharedDialogHeader;
|
|
232
|
+
DialogBottomSheet.Title = DialogBottomSheetTitle;
|
|
233
|
+
DialogBottomSheet.Close = DialogBottomSheetClose;
|
|
234
|
+
DialogBottomSheet.Body = DialogBottomSheetBody;
|
|
235
|
+
DialogBottomSheet.Footer = SharedDialogFooter;
|
|
236
|
+
DialogBottomSheet.ScrollArea = DialogBottomSheetScrollArea;
|
|
207
237
|
|
|
208
|
-
function
|
|
238
|
+
function DialogModal(props) {
|
|
209
239
|
return React.createElement(ScrollAreaViewport.DialogRoot, Object.assign({}, props));
|
|
210
240
|
}
|
|
211
241
|
function DialogModalTrigger(_a) {
|
|
@@ -238,17 +268,14 @@ function DialogModalBody(_a) {
|
|
|
238
268
|
const content = (React.createElement(DrawerDescription.DialogDescription, { render: descriptionProps => (React.createElement("div", Object.assign({}, rest, descriptionProps, { className: classnames(styles.body, { [styles.fullBleed]: fullBleed }, className), style: style }), children)) }));
|
|
239
269
|
return insideScrollArea ? (content) : (React.createElement(DialogScrollArea$1, null, content));
|
|
240
270
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
// The modal keeps the plain native-scrollbar scroll region.
|
|
250
|
-
ScrollArea: DialogScrollArea$1,
|
|
251
|
-
});
|
|
271
|
+
DialogModal.Trigger = DialogModalTrigger;
|
|
272
|
+
DialogModal.Content = DialogModalContent;
|
|
273
|
+
DialogModal.Header = SharedDialogHeader;
|
|
274
|
+
DialogModal.Title = DialogModalTitle;
|
|
275
|
+
DialogModal.Close = DialogModalClose;
|
|
276
|
+
DialogModal.Body = DialogModalBody;
|
|
277
|
+
DialogModal.Footer = SharedDialogFooter;
|
|
278
|
+
DialogModal.ScrollArea = DialogScrollArea$1;
|
|
252
279
|
|
|
253
280
|
/**
|
|
254
281
|
* Creates a handle that opens/closes a `Dialog` from detached triggers (e.g. an
|
|
@@ -273,7 +300,7 @@ function useDialogShell() {
|
|
|
273
300
|
* desktop, a bottom sheet on mobile. Compose it with `Dialog.Trigger`,
|
|
274
301
|
* `Dialog.Content`, and the layout parts.
|
|
275
302
|
*/
|
|
276
|
-
function
|
|
303
|
+
function Dialog(_a) {
|
|
277
304
|
var { onRequestClose, size = "base", type = "dialog", finalFocus, children, onOpenChange } = _a, rest = tslib_es6.__rest(_a, ["onRequestClose", "size", "type", "finalFocus", "children", "onOpenChange"]);
|
|
278
305
|
function handleOpenChange(nextOpen, eventDetails) {
|
|
279
306
|
if (!nextOpen) {
|
|
@@ -339,7 +366,6 @@ function DialogScrollArea(props) {
|
|
|
339
366
|
const Shell = useDialogShell();
|
|
340
367
|
return React.createElement(Shell.ScrollArea, Object.assign({}, props));
|
|
341
368
|
}
|
|
342
|
-
const Dialog = DialogRoot;
|
|
343
369
|
Dialog.Trigger = DialogTrigger;
|
|
344
370
|
Dialog.Content = DialogContent;
|
|
345
371
|
Dialog.Header = DialogHeader;
|