@jobber/components 8.24.1 → 8.25.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/ProgressIndicator.d.ts +1 -0
- package/ProgressIndicator.js +17 -0
- 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/ProgressBar/ProgressBar.d.ts +7 -0
- package/dist/ProgressBar-cjs.js +4 -0
- package/dist/ProgressBar-es.js +4 -0
- package/dist/ProgressIndicator/ProgressIndicator.d.ts +60 -0
- package/dist/ProgressIndicator/index.cjs +9 -0
- package/dist/ProgressIndicator/index.d.ts +1 -0
- package/dist/ProgressIndicator/index.mjs +3 -0
- package/dist/ProgressIndicator-cjs.js +43 -0
- package/dist/ProgressIndicator-es.js +41 -0
- 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/ProgressBar/ProgressBar.md +9 -0
- package/dist/docs/ProgressIndicator/ProgressIndicator.md +105 -0
- package/dist/docs/index.md +2 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/styles.css +101 -0
- package/dist/utils/meta/meta.json +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/ProgressIndicator";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var ProgressIndicator = require("./dist/ProgressIndicator");
|
|
8
|
+
|
|
9
|
+
Object.keys(ProgressIndicator).forEach(function(key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return ProgressIndicator[key];
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|
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>`. */
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import sizes from "./ProgressBarSizes.module.css";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `ProgressIndicator` instead.
|
|
5
|
+
*/
|
|
3
6
|
interface ProgressBarProps {
|
|
4
7
|
/**
|
|
5
8
|
* The current step that the progress bar is on.
|
|
@@ -30,5 +33,9 @@ interface ProgressBarProps {
|
|
|
30
33
|
*/
|
|
31
34
|
readonly UNSAFE_style?: React.CSSProperties;
|
|
32
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `ProgressIndicator` from
|
|
38
|
+
* `@jobber/components/ProgressIndicator` instead.
|
|
39
|
+
*/
|
|
33
40
|
export declare function ProgressBar({ currentStep, totalSteps, size, variation, UNSAFE_className, UNSAFE_style, }: ProgressBarProps): React.JSX.Element;
|
|
34
41
|
export {};
|
package/dist/ProgressBar-cjs.js
CHANGED
|
@@ -19,6 +19,10 @@ function ProgressBarStepped({ currentStep, totalSteps, percentage, size = "base"
|
|
|
19
19
|
})));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `ProgressIndicator` from
|
|
24
|
+
* `@jobber/components/ProgressIndicator` instead.
|
|
25
|
+
*/
|
|
22
26
|
function ProgressBar({ currentStep, totalSteps, size = "base", variation = "progress", UNSAFE_className, UNSAFE_style, }) {
|
|
23
27
|
const percentage = (currentStep / totalSteps) * 100;
|
|
24
28
|
const progressBarClassName = classnames(styles.ProgressBar, sizes[size]);
|
package/dist/ProgressBar-es.js
CHANGED
|
@@ -17,6 +17,10 @@ function ProgressBarStepped({ currentStep, totalSteps, percentage, size = "base"
|
|
|
17
17
|
})));
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `ProgressIndicator` from
|
|
22
|
+
* `@jobber/components/ProgressIndicator` instead.
|
|
23
|
+
*/
|
|
20
24
|
function ProgressBar({ currentStep, totalSteps, size = "base", variation = "progress", UNSAFE_className, UNSAFE_style, }) {
|
|
21
25
|
const percentage = (currentStep / totalSteps) * 100;
|
|
22
26
|
const progressBarClassName = classnames(styles.ProgressBar, sizes[size]);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
export interface ProgressIndicatorProps {
|
|
4
|
+
/**
|
|
5
|
+
* Current progress. Expected to be in the range `0..max` inclusive.
|
|
6
|
+
*/
|
|
7
|
+
readonly value: number;
|
|
8
|
+
/**
|
|
9
|
+
* Maximum value. Pass `max={4}` with `value={2}` for "2 of 4 steps"; pass
|
|
10
|
+
* `value={75}` for "75%".
|
|
11
|
+
*
|
|
12
|
+
* @default 100
|
|
13
|
+
*/
|
|
14
|
+
readonly max?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Visual variation:
|
|
17
|
+
* - `continuous` renders a single fill bar driven by `value / max`.
|
|
18
|
+
* - `stepped` renders `max` segments, the first `value` of which are filled.
|
|
19
|
+
*
|
|
20
|
+
* @default "continuous"
|
|
21
|
+
*/
|
|
22
|
+
readonly variation?: "continuous" | "stepped";
|
|
23
|
+
/**
|
|
24
|
+
* Visual size. `smaller` renders at 4px tall, `small` at 8px, `base` at 16px.
|
|
25
|
+
*
|
|
26
|
+
* @default "base"
|
|
27
|
+
*/
|
|
28
|
+
readonly size?: "smaller" | "small" | "base";
|
|
29
|
+
/**
|
|
30
|
+
* Accessible label exposed via `aria-label` on the root element. When
|
|
31
|
+
* omitted, defaults to `"{value}%"` when `max === 100` (or `max` is
|
|
32
|
+
* omitted), and `"{value} / {max}"` otherwise.
|
|
33
|
+
*
|
|
34
|
+
* Override to localize or to describe the specific activity (e.g.
|
|
35
|
+
* `"Uploading file"`).
|
|
36
|
+
*/
|
|
37
|
+
readonly ariaLabel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Custom class name merged onto the root element alongside the component's
|
|
40
|
+
* own classes.
|
|
41
|
+
*/
|
|
42
|
+
readonly className?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Custom inline styles applied to the root element.
|
|
45
|
+
*/
|
|
46
|
+
readonly style?: CSSProperties;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `ProgressIndicator` communicates **determinate** progress — a known fraction
|
|
50
|
+
* of a task that has been completed. Use it when you can express progress as
|
|
51
|
+
* `value / max`, such as a multi-step setup wizard or a file upload with a
|
|
52
|
+
* known total size.
|
|
53
|
+
*
|
|
54
|
+
* For indeterminate activity (loading time or fraction unknown), use
|
|
55
|
+
* `ActivityIndicator` instead.
|
|
56
|
+
*
|
|
57
|
+
* For now, the legacy `ProgressBar` component also remains available; new code
|
|
58
|
+
* should prefer `ProgressIndicator`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ProgressIndicator({ value, max, variation, size, ariaLabel, className, style, }: ProgressIndicatorProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressIndicator } from "./ProgressIndicator";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
|
|
6
|
+
var styles = {"indicator":"-TBRV1VUsfc-","smaller":"MStgN8AhV3s-","small":"iAlYWHjs6JQ-","base":"WWEzA1-OjSM-","continuous":"r9ShSj58V6w-","fill":"Hsuq8zT-KzY-","stepped":"FB1e9bL90tI-","segment":"bpLIiDGlsCs-","filled":"_0FxmImvY-04-","spinning":"_2aJghEPvl14-"};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `ProgressIndicator` communicates **determinate** progress — a known fraction
|
|
10
|
+
* of a task that has been completed. Use it when you can express progress as
|
|
11
|
+
* `value / max`, such as a multi-step setup wizard or a file upload with a
|
|
12
|
+
* known total size.
|
|
13
|
+
*
|
|
14
|
+
* For indeterminate activity (loading time or fraction unknown), use
|
|
15
|
+
* `ActivityIndicator` instead.
|
|
16
|
+
*
|
|
17
|
+
* For now, the legacy `ProgressBar` component also remains available; new code
|
|
18
|
+
* should prefer `ProgressIndicator`.
|
|
19
|
+
*/
|
|
20
|
+
function ProgressIndicator({ value, max = 100, variation = "continuous", size = "base", ariaLabel, className, style, }) {
|
|
21
|
+
const clampedValue = Math.min(value, max);
|
|
22
|
+
const resolvedAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : defaultAriaLabel(clampedValue, max);
|
|
23
|
+
return (React.createElement("div", { role: "progressbar", "aria-valuenow": clampedValue, "aria-valuemin": 0, "aria-valuemax": max, "aria-label": resolvedAriaLabel, className: classnames(styles.indicator, styles[size], variation === "stepped" ? styles.stepped : styles.continuous, className), style: style }, variation === "stepped"
|
|
24
|
+
? SteppedSegments({ value: clampedValue, max })
|
|
25
|
+
: ContinuousFill({ value: clampedValue, max })));
|
|
26
|
+
}
|
|
27
|
+
function ContinuousFill({ value, max, }) {
|
|
28
|
+
const percentage = max === 0 ? 0 : (value / max) * 100;
|
|
29
|
+
return (React.createElement("div", { className: styles.fill, style: { "--progress-indicator--fill-amount": percentage } }));
|
|
30
|
+
}
|
|
31
|
+
function SteppedSegments({ value, max, }) {
|
|
32
|
+
return (React.createElement(React.Fragment, null, Array.from({ length: max }).map((_, index) => {
|
|
33
|
+
const step = index + 1;
|
|
34
|
+
return (React.createElement("div", { key: step, className: classnames(styles.segment, step <= value && styles.filled) }));
|
|
35
|
+
})));
|
|
36
|
+
}
|
|
37
|
+
function defaultAriaLabel(value, max) {
|
|
38
|
+
if (max === 100)
|
|
39
|
+
return `${value}%`;
|
|
40
|
+
return `${value} / ${max}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.ProgressIndicator = ProgressIndicator;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
var styles = {"indicator":"-TBRV1VUsfc-","smaller":"MStgN8AhV3s-","small":"iAlYWHjs6JQ-","base":"WWEzA1-OjSM-","continuous":"r9ShSj58V6w-","fill":"Hsuq8zT-KzY-","stepped":"FB1e9bL90tI-","segment":"bpLIiDGlsCs-","filled":"_0FxmImvY-04-","spinning":"_2aJghEPvl14-"};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `ProgressIndicator` communicates **determinate** progress — a known fraction
|
|
8
|
+
* of a task that has been completed. Use it when you can express progress as
|
|
9
|
+
* `value / max`, such as a multi-step setup wizard or a file upload with a
|
|
10
|
+
* known total size.
|
|
11
|
+
*
|
|
12
|
+
* For indeterminate activity (loading time or fraction unknown), use
|
|
13
|
+
* `ActivityIndicator` instead.
|
|
14
|
+
*
|
|
15
|
+
* For now, the legacy `ProgressBar` component also remains available; new code
|
|
16
|
+
* should prefer `ProgressIndicator`.
|
|
17
|
+
*/
|
|
18
|
+
function ProgressIndicator({ value, max = 100, variation = "continuous", size = "base", ariaLabel, className, style, }) {
|
|
19
|
+
const clampedValue = Math.min(value, max);
|
|
20
|
+
const resolvedAriaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : defaultAriaLabel(clampedValue, max);
|
|
21
|
+
return (React__default.createElement("div", { role: "progressbar", "aria-valuenow": clampedValue, "aria-valuemin": 0, "aria-valuemax": max, "aria-label": resolvedAriaLabel, className: classnames(styles.indicator, styles[size], variation === "stepped" ? styles.stepped : styles.continuous, className), style: style }, variation === "stepped"
|
|
22
|
+
? SteppedSegments({ value: clampedValue, max })
|
|
23
|
+
: ContinuousFill({ value: clampedValue, max })));
|
|
24
|
+
}
|
|
25
|
+
function ContinuousFill({ value, max, }) {
|
|
26
|
+
const percentage = max === 0 ? 0 : (value / max) * 100;
|
|
27
|
+
return (React__default.createElement("div", { className: styles.fill, style: { "--progress-indicator--fill-amount": percentage } }));
|
|
28
|
+
}
|
|
29
|
+
function SteppedSegments({ value, max, }) {
|
|
30
|
+
return (React__default.createElement(React__default.Fragment, null, Array.from({ length: max }).map((_, index) => {
|
|
31
|
+
const step = index + 1;
|
|
32
|
+
return (React__default.createElement("div", { key: step, className: classnames(styles.segment, step <= value && styles.filled) }));
|
|
33
|
+
})));
|
|
34
|
+
}
|
|
35
|
+
function defaultAriaLabel(value, max) {
|
|
36
|
+
if (max === 100)
|
|
37
|
+
return `${value}%`;
|
|
38
|
+
return `${value} / ${max}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { ProgressIndicator as P };
|
|
@@ -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;
|