@bitrise/bitkit-v2 0.3.394 → 0.3.395
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/AGENTS.md +10 -9
- package/dist/components/BitkitDialog/BitkitDialog.d.ts +8 -2
- package/dist/components/BitkitDialog/BitkitDialog.js +6 -3
- package/dist/components/BitkitDialog/BitkitDialog.js.map +1 -1
- package/dist/components/BitkitDialog/BitkitFormDialog.d.ts +2 -1
- package/dist/components/BitkitDialog/BitkitFormDialog.js +6 -3
- package/dist/components/BitkitDialog/BitkitFormDialog.js.map +1 -1
- package/dist/components/BitkitDialog/{BitkitStepperDialog.d.ts → BitkitStepsDialog.d.ts} +17 -10
- package/dist/components/BitkitDialog/{BitkitStepperDialog.js → BitkitStepsDialog.js} +27 -16
- package/dist/components/BitkitDialog/BitkitStepsDialog.js.map +1 -0
- package/dist/components/BitkitDialog/{BitkitStepperDialogStep.d.ts → BitkitStepsDialogStep.d.ts} +5 -5
- package/dist/components/BitkitDialog/{BitkitStepperDialogStep.js → BitkitStepsDialogStep.js} +6 -6
- package/dist/components/BitkitDialog/BitkitStepsDialogStep.js.map +1 -0
- package/dist/components/BitkitDialog/DialogInner.d.ts +6 -5
- package/dist/components/BitkitDialog/DialogInner.js +9 -6
- package/dist/components/BitkitDialog/DialogInner.js.map +1 -1
- package/dist/components/BitkitDialog/DialogShell.d.ts +7 -4
- package/dist/components/BitkitDialog/DialogShell.js +6 -4
- package/dist/components/BitkitDialog/DialogShell.js.map +1 -1
- package/dist/components/BitkitDialog/{StepperContext.d.ts → StepsDialogContext.d.ts} +3 -3
- package/dist/components/BitkitDialog/StepsDialogContext.js +11 -0
- package/dist/components/BitkitDialog/StepsDialogContext.js.map +1 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/main.js +3 -3
- package/docs/v1-to-v2-migration-guide.md +27 -3
- package/package.json +1 -1
- package/dist/components/BitkitDialog/BitkitStepperDialog.js.map +0 -1
- package/dist/components/BitkitDialog/BitkitStepperDialogStep.js.map +0 -1
- package/dist/components/BitkitDialog/StepperContext.js +0 -11
- package/dist/components/BitkitDialog/StepperContext.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -138,22 +138,23 @@ Bitkit components use consistent prop names across the library:
|
|
|
138
138
|
- **Three dialog components, one shell** — pick by intent, never reach for low-level dialog primitives (there are none exported):
|
|
139
139
|
- `BitkitDialog` — header (title + close) + body (`children`) + footer. The body is the dialog's `children`. The footer is two slot props: `footerButtons` (action buttons, auto-wrapped in the standard right-aligned row — no manual wrapper) and `footerContent` (arbitrary content rendered raw, e.g. an inline `BitkitAlert`). Both can be combined (content first, then buttons); omit both for a passive dialog with no footer.
|
|
140
140
|
- `BitkitFormDialog` — same API as `BitkitDialog`, but the whole content is a `<form>`, so a `type="submit"` button in `footerButtons` submits natively. On top of the shared dialog props it takes `onSubmit` (correctly typed as `FormEvent<HTMLFormElement>`) and `noValidate`, and nothing else off the native `<form>`.
|
|
141
|
-
- `
|
|
141
|
+
- `BitkitStepsDialog` — a multi-step dialog. Pass `BitkitStepsDialog.Step` children (each with `label` for the steps header, `title`/`description` for the step body). It owns the step state and auto-renders the steps header; build the step navigation with the `useStepsDialog()` hook (`{ step, setStep, next, prev, goTo, isFirst, isLast, totalSteps }`) and pass it as `footerButtons`, which the dialog lays out with the leading action opposite the step navigation. `footerContent` still renders raw above it. Controlled via `step`/`onStepChange`, or uncontrolled via `defaultStep`.
|
|
142
142
|
- All three expose `.ActionTrigger` (a thin re-export of Chakra's `Dialog.ActionTrigger`): wrap a footer button in it to close the dialog on click — the default way to dismiss a trigger-based (uncontrolled) dialog without wiring `open` state.
|
|
143
143
|
```tsx
|
|
144
144
|
<BitkitDialog footerButtons={<><Button variant="secondary">Cancel</Button><Button variant="primary">Save</Button></>} open={open} onOpenChange={…} title="Title">Body</BitkitDialog>
|
|
145
145
|
<BitkitFormDialog onSubmit={handleSubmit} open={open} onOpenChange={…} title="Edit" footerButtons={<Button type="submit">Save</Button>}>…fields…</BitkitFormDialog>
|
|
146
|
-
<
|
|
147
|
-
<
|
|
148
|
-
<
|
|
149
|
-
</
|
|
146
|
+
<BitkitStepsDialog footerButtons={<StepsNav />} title="Wizard" trigger={<Button>Open</Button>}>
|
|
147
|
+
<BitkitStepsDialog.Step label="Account" title="Create account">…</BitkitStepsDialog.Step>
|
|
148
|
+
<BitkitStepsDialog.Step label="Confirm" title="Confirm">…</BitkitStepsDialog.Step>
|
|
149
|
+
</BitkitStepsDialog>
|
|
150
150
|
```
|
|
151
|
-
For closing on click, use controlled `open`/`onOpenChange`, or wrap a button in `BitkitDialog.ActionTrigger` (and the `BitkitFormDialog.ActionTrigger` / `
|
|
151
|
+
For closing on click, use controlled `open`/`onOpenChange`, or wrap a button in `BitkitDialog.ActionTrigger` (and the `BitkitFormDialog.ActionTrigger` / `BitkitStepsDialog.ActionTrigger` equivalents). For a fully custom dialog, compose raw Chakra `Dialog.*` atoms directly.
|
|
152
152
|
|
|
153
153
|
All three forward `data-*` attributes to the element carrying `role="dialog"` (`data-testid`, `data-clarity-unmask`), and nothing else — style props, `className` and `id` don't pass through.
|
|
154
|
-
- **Dialog non-dismissible + post-close callback** — works on all three: pass `
|
|
154
|
+
- **Dialog non-dismissible + post-close callback** — works on all three: pass `dismissible={false}` to remove every route out that skips a decision (no close button, ESC blocked, outside clicks ignored — the only way out is an explicit footer action). Outside clicks never dismiss a Bitkit dialog, `dismissible` or not. While a footer action is in flight, pass `state="loading"` on the dialog next to the button's own `state="loading"`: the close button stays in place but goes disabled, ESC is blocked, and the dialog gets `aria-busy`. Pass `onExitComplete` to run code after the close animation finishes (navigation, focus restoration, cleanup):
|
|
155
155
|
```tsx
|
|
156
|
-
<BitkitDialog
|
|
156
|
+
<BitkitDialog dismissible={false} open={open} onOpenChange={…} title="Action required">…</BitkitDialog>
|
|
157
|
+
<BitkitDialog state={isSaving ? 'loading' : undefined} open={open} onOpenChange={…} title="Save changes">…</BitkitDialog>
|
|
157
158
|
<BitkitDialog open={open} onExitComplete={() => navigate('/next')} onOpenChange={…} title="…">…</BitkitDialog>
|
|
158
159
|
```
|
|
159
160
|
|
|
@@ -227,7 +228,7 @@ Bitkit components use consistent prop names across the library:
|
|
|
227
228
|
This holds for form fields (`BitkitTextInput`, `BitkitSelect`, `BitkitNativeSelect`, `BitkitCombobox`, etc.), buttons (`BitkitButton`, `BitkitIconButton`, etc.), and most other components — they all forward Chakra style props through to the rendered root element.
|
|
228
229
|
|
|
229
230
|
**Exceptions** — a few component groups intentionally own their own layout and don't accept arbitrary style props from outside:
|
|
230
|
-
- Page-level overlays: `BitkitDialog`, `BitkitFormDialog`, `
|
|
231
|
+
- Page-level overlays: `BitkitDialog`, `BitkitFormDialog`, `BitkitStepsDialog`, `BitkitDrawer`, `BitkitCalendar`, `BitkitTour` — they own their layout; where it's configurable at all, it's through their own props (`size`, `maxHeight`, …), not style props from outside.
|
|
231
232
|
- Floating positioned components: `BitkitTooltip`, `BitkitLabelTooltip`, `BitkitDefinitionTooltip`, `BitkitOverflowTooltip`, `BitkitToast`, `BitkitActionMenu`, `BitkitSelectMenu`, `BitkitMultiselectMenu` — their layout is positioned automatically; pass styling via the component's own props instead of a wrapper.
|
|
232
233
|
|
|
233
234
|
> **For everything else, if a style prop doesn't take effect on a Bitkit component, that's a bug in the component, not a styling task.** Stop, tell the user something looks off in Bitkit so they can flag it to the Bitkit team — don't quietly add a `<Box>` workaround. Each silent workaround hides a regression and bakes the wrapper pattern into the codebase.
|
|
@@ -4,7 +4,8 @@ import { BitkitDataAttributes } from '../../utilities/dataAttributes';
|
|
|
4
4
|
import { DialogShellProps } from './DialogShell';
|
|
5
5
|
export type BitkitDialogProps = {
|
|
6
6
|
children?: ReactNode;
|
|
7
|
-
|
|
7
|
+
/** Set to `false` to remove every dismiss route that skips a decision: no close button, no ESC. */
|
|
8
|
+
dismissible?: boolean;
|
|
8
9
|
footerButtons?: ReactNode;
|
|
9
10
|
footerContent?: ReactNode;
|
|
10
11
|
headerLabel?: string;
|
|
@@ -20,12 +21,17 @@ export type BitkitDialogProps = {
|
|
|
20
21
|
scrollBehavior?: 'inside' | 'outside';
|
|
21
22
|
showScrollGradient?: boolean;
|
|
22
23
|
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
24
|
+
/**
|
|
25
|
+
* `loading` locks the dialog while a background action runs: the close button stays in place but
|
|
26
|
+
* disabled, and ESC is blocked. Use it alongside the footer button's own `state="loading"`.
|
|
27
|
+
*/
|
|
28
|
+
state?: 'loading';
|
|
23
29
|
title: ReactNode;
|
|
24
30
|
trigger?: ReactNode;
|
|
25
31
|
variant?: 'overflowContent';
|
|
26
32
|
} & BitkitDataAttributes;
|
|
27
33
|
declare const _default: {
|
|
28
|
-
({ children,
|
|
34
|
+
({ children, dismissible, footerButtons, footerContent, headerLabel, initialFocusEl, maxHeight, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior, showScrollGradient, size, state, title, trigger, variant, ...dataAttributes }: BitkitDialogProps): import("react").JSX.Element;
|
|
29
35
|
displayName: string;
|
|
30
36
|
} & {
|
|
31
37
|
ActionTrigger: import('react').ForwardRefExoticComponent<Dialog.ActionTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -4,8 +4,8 @@ import DialogShell from "./DialogShell.js";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { Dialog } from "@chakra-ui/react/dialog";
|
|
6
6
|
//#region lib/components/BitkitDialog/BitkitDialog.tsx
|
|
7
|
-
var BitkitDialog = ({ children,
|
|
8
|
-
|
|
7
|
+
var BitkitDialog = ({ children, dismissible = true, footerButtons, footerContent, headerLabel, initialFocusEl, maxHeight, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior, showScrollGradient, size, state, title, trigger, variant, ...dataAttributes }) => /* @__PURE__ */ jsx(DialogShell, {
|
|
8
|
+
dismissible,
|
|
9
9
|
initialFocusEl,
|
|
10
10
|
onExitComplete,
|
|
11
11
|
onOpenChange,
|
|
@@ -13,18 +13,21 @@ var BitkitDialog = ({ children, closable = true, footerButtons, footerContent, h
|
|
|
13
13
|
preventScroll,
|
|
14
14
|
scrollBehavior,
|
|
15
15
|
size,
|
|
16
|
+
state,
|
|
16
17
|
trigger,
|
|
17
18
|
variant,
|
|
18
19
|
children: /* @__PURE__ */ jsx(Dialog.Content, {
|
|
20
|
+
"aria-busy": state === "loading" || void 0,
|
|
19
21
|
maxHeight,
|
|
20
22
|
...dataAttributes,
|
|
21
23
|
children: /* @__PURE__ */ jsx(DialogInner, {
|
|
22
|
-
|
|
24
|
+
dismissible,
|
|
23
25
|
footerButtons,
|
|
24
26
|
footerContent,
|
|
25
27
|
headerLabel,
|
|
26
28
|
scrollBehavior,
|
|
27
29
|
showScrollGradient,
|
|
30
|
+
state,
|
|
28
31
|
title,
|
|
29
32
|
variant,
|
|
30
33
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitDialog.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { type ReactNode } from 'react';\n\nimport { type BitkitDataAttributes } from '../../utilities/dataAttributes';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport DialogInner from './DialogInner';\nimport DialogShell, { type DialogShellProps } from './DialogShell';\n\nexport type BitkitDialogProps = {\n children?: ReactNode;\n
|
|
1
|
+
{"version":3,"file":"BitkitDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitDialog.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { type ReactNode } from 'react';\n\nimport { type BitkitDataAttributes } from '../../utilities/dataAttributes';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport DialogInner from './DialogInner';\nimport DialogShell, { type DialogShellProps } from './DialogShell';\n\nexport type BitkitDialogProps = {\n children?: ReactNode;\n /** Set to `false` to remove every dismiss route that skips a decision: no close button, no ESC. */\n dismissible?: boolean;\n footerButtons?: ReactNode;\n footerContent?: ReactNode;\n headerLabel?: string;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: DialogShellProps['initialFocusEl'];\n maxHeight?: string;\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n showScrollGradient?: boolean;\n size?: 'sm' | 'md' | 'lg' | 'full';\n /**\n * `loading` locks the dialog while a background action runs: the close button stays in place but\n * disabled, and ESC is blocked. Use it alongside the footer button's own `state=\"loading\"`.\n */\n state?: 'loading';\n title: ReactNode;\n trigger?: ReactNode;\n variant?: 'overflowContent';\n // Data attributes are forwarded to the element carrying `role=\"dialog\"`, and nothing else is —\n // style props, `className` and `id` don't pass through.\n} & BitkitDataAttributes;\n\nconst BitkitDialog = ({\n children,\n dismissible = true,\n footerButtons,\n footerContent,\n headerLabel,\n initialFocusEl,\n maxHeight,\n onExitComplete,\n onOpenChange,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n state,\n title,\n trigger,\n variant,\n ...dataAttributes\n}: BitkitDialogProps) => (\n <DialogShell\n dismissible={dismissible}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={onOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n state={state}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content aria-busy={state === 'loading' || undefined} maxHeight={maxHeight} {...dataAttributes}>\n <DialogInner\n dismissible={dismissible}\n footerButtons={footerButtons}\n footerContent={footerContent}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\n state={state}\n title={title}\n variant={variant}\n >\n {children}\n </DialogInner>\n </Dialog.Content>\n </DialogShell>\n);\n\nBitkitDialog.displayName = 'BitkitDialog';\n\nexport default withSubComponents(BitkitDialog, { ActionTrigger: Dialog.ActionTrigger });\n"],"mappings":";;;;;;AAqCA,IAAM,gBAAgB,EACpB,UACA,cAAc,MACd,eACA,eACA,aACA,gBACA,WACA,gBACA,cACA,MACA,eACA,gBACA,oBACA,MACA,OACA,OACA,SACA,SACA,GAAG,qBAEH,oBAAC,aAAD;CACe;CACG;CACA;CACF;CACR;CACS;CACC;CACV;CACC;CACE;CACA;CAET,UAAA,oBAAC,OAAO,SAAR;EAAgB,aAAW,UAAU,aAAa,KAAA;EAAsB;EAAW,GAAI;EACrF,UAAA,oBAAC,aAAD;GACe;GACE;GACA;GACF;GACG;GACI;GACb;GACA;GACE;GAER;EACU,CAAA;CACC,CAAA;AACL,CAAA;AAGf,aAAa,cAAc;AAE3B,IAAA,uBAAe,kBAAkB,cAAc,EAAE,eAAe,OAAO,cAAc,CAAC"}
|
|
@@ -8,7 +8,7 @@ export type BitkitFormDialogProps = BitkitDialogProps & {
|
|
|
8
8
|
};
|
|
9
9
|
declare const _default: import('react').ForwardRefExoticComponent<{
|
|
10
10
|
children?: import('react').ReactNode;
|
|
11
|
-
|
|
11
|
+
dismissible?: boolean;
|
|
12
12
|
footerButtons?: import('react').ReactNode;
|
|
13
13
|
footerContent?: import('react').ReactNode;
|
|
14
14
|
headerLabel?: string;
|
|
@@ -23,6 +23,7 @@ declare const _default: import('react').ForwardRefExoticComponent<{
|
|
|
23
23
|
scrollBehavior?: "inside" | "outside";
|
|
24
24
|
showScrollGradient?: boolean;
|
|
25
25
|
size?: "sm" | "md" | "lg" | "full";
|
|
26
|
+
state?: "loading";
|
|
26
27
|
title: import('react').ReactNode;
|
|
27
28
|
trigger?: import('react').ReactNode;
|
|
28
29
|
variant?: "overflowContent";
|
|
@@ -12,9 +12,9 @@ import { Dialog } from "@chakra-ui/react/dialog";
|
|
|
12
12
|
* `onSubmit` and `noValidate` — no Chakra style props, no `className`, no `id`.
|
|
13
13
|
*/
|
|
14
14
|
var BitkitFormDialog = forwardRef((props, ref) => {
|
|
15
|
-
const { children,
|
|
15
|
+
const { children, dismissible = true, footerButtons, footerContent, headerLabel, initialFocusEl, maxHeight, noValidate, onExitComplete, onOpenChange, onSubmit, open, preventScroll, scrollBehavior, showScrollGradient, size, state, title, trigger, variant, ...dataAttributes } = props;
|
|
16
16
|
return /* @__PURE__ */ jsx(DialogShell, {
|
|
17
|
-
|
|
17
|
+
dismissible,
|
|
18
18
|
initialFocusEl,
|
|
19
19
|
onExitComplete,
|
|
20
20
|
onOpenChange,
|
|
@@ -22,9 +22,11 @@ var BitkitFormDialog = forwardRef((props, ref) => {
|
|
|
22
22
|
preventScroll,
|
|
23
23
|
scrollBehavior,
|
|
24
24
|
size,
|
|
25
|
+
state,
|
|
25
26
|
trigger,
|
|
26
27
|
variant,
|
|
27
28
|
children: /* @__PURE__ */ jsx(Dialog.Content, {
|
|
29
|
+
"aria-busy": state === "loading" || void 0,
|
|
28
30
|
asChild: true,
|
|
29
31
|
maxHeight,
|
|
30
32
|
...dataAttributes,
|
|
@@ -33,12 +35,13 @@ var BitkitFormDialog = forwardRef((props, ref) => {
|
|
|
33
35
|
noValidate,
|
|
34
36
|
onSubmit,
|
|
35
37
|
children: /* @__PURE__ */ jsx(DialogInner, {
|
|
36
|
-
|
|
38
|
+
dismissible,
|
|
37
39
|
footerButtons,
|
|
38
40
|
footerContent,
|
|
39
41
|
headerLabel,
|
|
40
42
|
scrollBehavior,
|
|
41
43
|
showScrollGradient,
|
|
44
|
+
state,
|
|
42
45
|
title,
|
|
43
46
|
variant,
|
|
44
47
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitFormDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitFormDialog.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type FormEventHandler, forwardRef } from 'react';\n\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport { type BitkitDialogProps } from './BitkitDialog';\nimport DialogInner from './DialogInner';\nimport DialogShell from './DialogShell';\n\nexport type BitkitFormDialogProps = BitkitDialogProps & {\n /** Skips the browser's native constraint validation on submit. */\n noValidate?: boolean;\n onSubmit?: FormEventHandler<HTMLFormElement>;\n};\n\n/**\n * A dialog whose entire content is a `<form>`, so a `type=\"submit\"` button in the footer submits\n * natively. Like the other dialog overlays it owns its own layout, so the form surface is just\n * `onSubmit` and `noValidate` — no Chakra style props, no `className`, no `id`.\n */\nconst BitkitFormDialog = forwardRef<HTMLFormElement, BitkitFormDialogProps>((props, ref) => {\n const {\n children,\n
|
|
1
|
+
{"version":3,"file":"BitkitFormDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitFormDialog.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type FormEventHandler, forwardRef } from 'react';\n\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport { type BitkitDialogProps } from './BitkitDialog';\nimport DialogInner from './DialogInner';\nimport DialogShell from './DialogShell';\n\nexport type BitkitFormDialogProps = BitkitDialogProps & {\n /** Skips the browser's native constraint validation on submit. */\n noValidate?: boolean;\n onSubmit?: FormEventHandler<HTMLFormElement>;\n};\n\n/**\n * A dialog whose entire content is a `<form>`, so a `type=\"submit\"` button in the footer submits\n * natively. Like the other dialog overlays it owns its own layout, so the form surface is just\n * `onSubmit` and `noValidate` — no Chakra style props, no `className`, no `id`.\n */\nconst BitkitFormDialog = forwardRef<HTMLFormElement, BitkitFormDialogProps>((props, ref) => {\n const {\n children,\n dismissible = true,\n footerButtons,\n footerContent,\n headerLabel,\n initialFocusEl,\n maxHeight,\n noValidate,\n onExitComplete,\n onOpenChange,\n onSubmit,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n state,\n title,\n trigger,\n variant,\n ...dataAttributes\n } = props;\n\n return (\n <DialogShell\n dismissible={dismissible}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={onOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n state={state}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content aria-busy={state === 'loading' || undefined} asChild maxHeight={maxHeight} {...dataAttributes}>\n <chakra.form ref={ref} noValidate={noValidate} onSubmit={onSubmit}>\n <DialogInner\n dismissible={dismissible}\n footerButtons={footerButtons}\n footerContent={footerContent}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\n state={state}\n title={title}\n variant={variant}\n >\n {children}\n </DialogInner>\n </chakra.form>\n </Dialog.Content>\n </DialogShell>\n );\n});\n\nBitkitFormDialog.displayName = 'BitkitFormDialog';\n\nexport default withSubComponents(BitkitFormDialog, { ActionTrigger: Dialog.ActionTrigger });\n"],"mappings":";;;;;;;;;;;;;AAoBA,IAAM,mBAAmB,YAAoD,OAAO,QAAQ;CAC1F,MAAM,EACJ,UACA,cAAc,MACd,eACA,eACA,aACA,gBACA,WACA,YACA,gBACA,cACA,UACA,MACA,eACA,gBACA,oBACA,MACA,OACA,OACA,SACA,SACA,GAAG,mBACD;CAEJ,OACE,oBAAC,aAAD;EACe;EACG;EACA;EACF;EACR;EACS;EACC;EACV;EACC;EACE;EACA;EAET,UAAA,oBAAC,OAAO,SAAR;GAAgB,aAAW,UAAU,aAAa,KAAA;GAAW,SAAA;GAAmB;GAAW,GAAI;GAC7F,UAAA,oBAAC,OAAO,MAAR;IAAkB;IAAiB;IAAsB;IACvD,UAAA,oBAAC,aAAD;KACe;KACE;KACA;KACF;KACG;KACI;KACb;KACA;KACE;KAER;IACU,CAAA;GACF,CAAA;EACC,CAAA;CACL,CAAA;AAEjB,CAAC;AAED,iBAAiB,cAAc;AAE/B,IAAA,2BAAe,kBAAkB,kBAAkB,EAAE,eAAe,OAAO,cAAc,CAAC"}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { Dialog } from '@chakra-ui/react/dialog';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { BitkitDataAttributes } from '../../utilities/dataAttributes';
|
|
4
|
-
import {
|
|
4
|
+
import { BitkitStepsDialogStepProps } from './BitkitStepsDialogStep';
|
|
5
5
|
import { DialogShellProps } from './DialogShell';
|
|
6
|
-
export {
|
|
7
|
-
export type
|
|
8
|
-
/** `
|
|
6
|
+
export { useStepsDialog } from './StepsDialogContext';
|
|
7
|
+
export type BitkitStepsDialogProps = {
|
|
8
|
+
/** `BitkitStepsDialog.Step` children, one per step. */
|
|
9
9
|
children: ReactNode;
|
|
10
|
-
closable?: boolean;
|
|
11
10
|
/** Initial step when uncontrolled. Resets to this when the dialog closes. */
|
|
12
11
|
defaultStep?: number;
|
|
12
|
+
/** Set to `false` to remove every dismiss route that skips a decision: no close button, no ESC. */
|
|
13
|
+
dismissible?: boolean;
|
|
13
14
|
/** Element to focus when the dialog opens, instead of the first focusable one. */
|
|
14
15
|
initialFocusEl?: DialogShellProps['initialFocusEl'];
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* would force right-alignment.
|
|
17
|
+
* The step navigation, built with `useStepsDialog()`. Pass the buttons themselves: the dialog lays
|
|
18
|
+
* them out the way the design asks for, leading action on the left, the step navigation opposite.
|
|
19
19
|
*/
|
|
20
|
+
footerButtons?: ReactNode;
|
|
21
|
+
/** Arbitrary content rendered raw inside the footer, above `footerButtons` (e.g. a `BitkitAlert`). */
|
|
20
22
|
footerContent?: ReactNode;
|
|
21
23
|
headerLabel?: string;
|
|
22
24
|
maxHeight?: string;
|
|
@@ -31,6 +33,11 @@ export type BitkitStepperDialogProps = {
|
|
|
31
33
|
scrollBehavior?: 'inside' | 'outside';
|
|
32
34
|
showScrollGradient?: boolean;
|
|
33
35
|
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
36
|
+
/**
|
|
37
|
+
* `loading` locks the dialog while a background action runs: the close button stays in place but
|
|
38
|
+
* disabled, and ESC is blocked. Use it alongside the footer button's own `state="loading"`.
|
|
39
|
+
*/
|
|
40
|
+
state?: 'loading';
|
|
34
41
|
/** Controlled active step. Omit for uncontrolled (see `defaultStep`). */
|
|
35
42
|
step?: number;
|
|
36
43
|
title: ReactNode;
|
|
@@ -38,12 +45,12 @@ export type BitkitStepperDialogProps = {
|
|
|
38
45
|
variant?: 'overflowContent';
|
|
39
46
|
} & BitkitDataAttributes;
|
|
40
47
|
declare const _default: {
|
|
41
|
-
({ children,
|
|
48
|
+
({ children, defaultStep, dismissible, initialFocusEl, footerButtons, footerContent, headerLabel, maxHeight, onExitComplete, onOpenChange, onStepChange, open, preventScroll, scrollBehavior, showScrollGradient, size, state, step: stepProp, title, trigger, variant, ...dataAttributes }: BitkitStepsDialogProps): import("react").JSX.Element;
|
|
42
49
|
displayName: string;
|
|
43
50
|
} & {
|
|
44
51
|
ActionTrigger: import('react').ForwardRefExoticComponent<Dialog.ActionTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
45
52
|
Step: {
|
|
46
|
-
({ children, description, title }:
|
|
53
|
+
({ children, description, title }: BitkitStepsDialogStepProps): import("react").JSX.Element;
|
|
47
54
|
displayName: string;
|
|
48
55
|
};
|
|
49
56
|
};
|
|
@@ -3,22 +3,23 @@ import { flattenChildren } from "../../utilities/flattenChildren.js";
|
|
|
3
3
|
import DialogInner from "./DialogInner.js";
|
|
4
4
|
import DialogShell from "./DialogShell.js";
|
|
5
5
|
import BitkitSteps_default from "../BitkitSteps/BitkitSteps.js";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
6
|
+
import BitkitStepsDialogStep from "./BitkitStepsDialogStep.js";
|
|
7
|
+
import { StepsDialogProvider, useStepsDialog } from "./StepsDialogContext.js";
|
|
8
|
+
import { Box } from "@chakra-ui/react/box";
|
|
8
9
|
import { useCallback, useMemo, useState } from "react";
|
|
9
10
|
import { jsx } from "react/jsx-runtime";
|
|
10
11
|
import { Dialog } from "@chakra-ui/react/dialog";
|
|
11
|
-
//#region lib/components/BitkitDialog/
|
|
12
|
+
//#region lib/components/BitkitDialog/BitkitStepsDialog.tsx
|
|
12
13
|
/**
|
|
13
|
-
* A dialog that walks through a sequence of `
|
|
14
|
-
* state, auto-renders the steps header, and shows only the active step's body.
|
|
15
|
-
*
|
|
14
|
+
* A dialog that walks through a sequence of `BitkitStepsDialog.Step` children. It owns the step
|
|
15
|
+
* state, auto-renders the steps header, and shows only the active step's body. The consumer builds
|
|
16
|
+
* the step navigation with the `useStepsDialog()` hook and passes it in as `footerButtons`.
|
|
16
17
|
*/
|
|
17
|
-
var
|
|
18
|
+
var BitkitStepsDialog = ({ children, defaultStep = 0, dismissible = true, initialFocusEl, footerButtons, footerContent, headerLabel, maxHeight, onExitComplete, onOpenChange, onStepChange, open, preventScroll, scrollBehavior, showScrollGradient, size, state, step: stepProp, title, trigger, variant, ...dataAttributes }) => {
|
|
18
19
|
const [internalStep, setInternalStep] = useState(defaultStep);
|
|
19
20
|
const isControlled = stepProp !== void 0;
|
|
20
21
|
const rawStep = (isControlled ? stepProp : internalStep) ?? 0;
|
|
21
|
-
const steps = flattenChildren(children).filter((child) => child.type ===
|
|
22
|
+
const steps = flattenChildren(children).filter((child) => child.type === BitkitStepsDialogStep);
|
|
22
23
|
const totalSteps = steps.length;
|
|
23
24
|
const step = Math.max(0, Math.min(rawStep, Math.max(0, totalSteps - 1)));
|
|
24
25
|
const setStep = useCallback((next) => {
|
|
@@ -48,14 +49,20 @@ var BitkitStepperDialog = ({ children, closable = true, defaultStep = 0, initial
|
|
|
48
49
|
if (!details.open && !isControlled) setInternalStep(defaultStep);
|
|
49
50
|
onOpenChange?.(details);
|
|
50
51
|
};
|
|
52
|
+
const footerNav = footerButtons && /* @__PURE__ */ jsx(Box, {
|
|
53
|
+
display: "flex",
|
|
54
|
+
justifyContent: "space-between",
|
|
55
|
+
width: "100%",
|
|
56
|
+
children: footerButtons
|
|
57
|
+
});
|
|
51
58
|
const stepsHeader = /* @__PURE__ */ jsx(BitkitSteps_default, {
|
|
52
59
|
step,
|
|
53
60
|
children: steps.map((child, index) => /* @__PURE__ */ jsx(BitkitSteps_default.Item, { label: child.props.label }, index))
|
|
54
61
|
});
|
|
55
|
-
return /* @__PURE__ */ jsx(
|
|
62
|
+
return /* @__PURE__ */ jsx(StepsDialogProvider, {
|
|
56
63
|
value: ctx,
|
|
57
64
|
children: /* @__PURE__ */ jsx(DialogShell, {
|
|
58
|
-
|
|
65
|
+
dismissible,
|
|
59
66
|
initialFocusEl,
|
|
60
67
|
onExitComplete,
|
|
61
68
|
onOpenChange: handleOpenChange,
|
|
@@ -63,18 +70,22 @@ var BitkitStepperDialog = ({ children, closable = true, defaultStep = 0, initial
|
|
|
63
70
|
preventScroll,
|
|
64
71
|
scrollBehavior,
|
|
65
72
|
size,
|
|
73
|
+
state,
|
|
66
74
|
trigger,
|
|
67
75
|
variant,
|
|
68
76
|
children: /* @__PURE__ */ jsx(Dialog.Content, {
|
|
77
|
+
"aria-busy": state === "loading" || void 0,
|
|
69
78
|
maxHeight,
|
|
70
79
|
...dataAttributes,
|
|
71
80
|
children: /* @__PURE__ */ jsx(DialogInner, {
|
|
72
|
-
|
|
81
|
+
dismissible,
|
|
82
|
+
footerButtons: footerNav,
|
|
73
83
|
footerContent,
|
|
74
84
|
headerExtra: stepsHeader,
|
|
75
85
|
headerLabel,
|
|
76
86
|
scrollBehavior,
|
|
77
87
|
showScrollGradient,
|
|
88
|
+
state,
|
|
78
89
|
title,
|
|
79
90
|
variant,
|
|
80
91
|
children: steps[step]
|
|
@@ -83,12 +94,12 @@ var BitkitStepperDialog = ({ children, closable = true, defaultStep = 0, initial
|
|
|
83
94
|
})
|
|
84
95
|
});
|
|
85
96
|
};
|
|
86
|
-
|
|
87
|
-
var
|
|
97
|
+
BitkitStepsDialog.displayName = "BitkitStepsDialog";
|
|
98
|
+
var BitkitStepsDialog_default = withSubComponents(BitkitStepsDialog, {
|
|
88
99
|
ActionTrigger: Dialog.ActionTrigger,
|
|
89
|
-
Step:
|
|
100
|
+
Step: BitkitStepsDialogStep
|
|
90
101
|
});
|
|
91
102
|
//#endregion
|
|
92
|
-
export {
|
|
103
|
+
export { BitkitStepsDialog_default as default, useStepsDialog };
|
|
93
104
|
|
|
94
|
-
//# sourceMappingURL=
|
|
105
|
+
//# sourceMappingURL=BitkitStepsDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitkitStepsDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitStepsDialog.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog } from '@chakra-ui/react/dialog';\nimport { type ReactElement, type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport { type BitkitDataAttributes } from '../../utilities/dataAttributes';\nimport { flattenChildren } from '../../utilities/flattenChildren';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitSteps from '../BitkitSteps/BitkitSteps';\nimport BitkitStepsDialogStep, { type BitkitStepsDialogStepProps } from './BitkitStepsDialogStep';\nimport DialogInner from './DialogInner';\nimport DialogShell, { type DialogShellProps } from './DialogShell';\nimport { StepsDialogProvider } from './StepsDialogContext';\n\nexport { useStepsDialog } from './StepsDialogContext';\n\nexport type BitkitStepsDialogProps = {\n /** `BitkitStepsDialog.Step` children, one per step. */\n children: ReactNode;\n /** Initial step when uncontrolled. Resets to this when the dialog closes. */\n defaultStep?: number;\n /** Set to `false` to remove every dismiss route that skips a decision: no close button, no ESC. */\n dismissible?: boolean;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: DialogShellProps['initialFocusEl'];\n /**\n * The step navigation, built with `useStepsDialog()`. Pass the buttons themselves: the dialog lays\n * them out the way the design asks for, leading action on the left, the step navigation opposite.\n */\n footerButtons?: ReactNode;\n /** Arbitrary content rendered raw inside the footer, above `footerButtons` (e.g. a `BitkitAlert`). */\n footerContent?: ReactNode;\n headerLabel?: string;\n maxHeight?: string;\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n /** Called whenever the active step changes (controlled or uncontrolled). */\n onStepChange?: (step: number) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n showScrollGradient?: boolean;\n size?: 'sm' | 'md' | 'lg' | 'full';\n /**\n * `loading` locks the dialog while a background action runs: the close button stays in place but\n * disabled, and ESC is blocked. Use it alongside the footer button's own `state=\"loading\"`.\n */\n state?: 'loading';\n /** Controlled active step. Omit for uncontrolled (see `defaultStep`). */\n step?: number;\n title: ReactNode;\n trigger?: ReactNode;\n variant?: 'overflowContent';\n // Data attributes are forwarded to the element carrying `role=\"dialog\"`, and nothing else is —\n // style props, `className` and `id` don't pass through.\n} & BitkitDataAttributes;\n\n/**\n * A dialog that walks through a sequence of `BitkitStepsDialog.Step` children. It owns the step\n * state, auto-renders the steps header, and shows only the active step's body. The consumer builds\n * the step navigation with the `useStepsDialog()` hook and passes it in as `footerButtons`.\n */\nconst BitkitStepsDialog = ({\n children,\n defaultStep = 0,\n dismissible = true,\n initialFocusEl,\n footerButtons,\n footerContent,\n headerLabel,\n maxHeight,\n onExitComplete,\n onOpenChange,\n onStepChange,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n state,\n step: stepProp,\n title,\n trigger,\n variant,\n ...dataAttributes\n}: BitkitStepsDialogProps) => {\n const [internalStep, setInternalStep] = useState(defaultStep);\n const isControlled = stepProp !== undefined;\n const rawStep = (isControlled ? stepProp : internalStep) ?? 0;\n const steps = flattenChildren(children).filter(\n (child): child is ReactElement<BitkitStepsDialogStepProps> => child.type === BitkitStepsDialogStep,\n );\n const totalSteps = steps.length;\n const step = Math.max(0, Math.min(rawStep, Math.max(0, totalSteps - 1)));\n\n const setStep = useCallback(\n (next: number) => {\n const clamped = Math.max(0, Math.min(next, totalSteps - 1));\n if (!isControlled) setInternalStep(clamped);\n onStepChange?.(clamped);\n },\n [isControlled, onStepChange, totalSteps],\n );\n\n const ctx = useMemo(\n () => ({\n goTo: setStep,\n isFirst: step === 0,\n isLast: step === totalSteps - 1,\n next: () => setStep(step + 1),\n prev: () => setStep(step - 1),\n setStep,\n step,\n totalSteps,\n }),\n [setStep, step, totalSteps],\n );\n\n const handleOpenChange = (details: { open: boolean }) => {\n if (!details.open && !isControlled) setInternalStep(defaultStep);\n onOpenChange?.(details);\n };\n\n // The design splits this row: the leading action sits opposite the step navigation. Laying it out\n // here rather than in `DialogInner` keeps the shared action block right-aligned for every other\n // dialog, and keeps the split off every call site.\n const footerNav = footerButtons && (\n <Box display=\"flex\" justifyContent=\"space-between\" width=\"100%\">\n {footerButtons}\n </Box>\n );\n\n const stepsHeader = (\n <BitkitSteps step={step}>\n {steps.map((child, index) => (\n <BitkitSteps.Item key={index} label={child.props.label} />\n ))}\n </BitkitSteps>\n );\n\n return (\n <StepsDialogProvider value={ctx}>\n <DialogShell\n dismissible={dismissible}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n state={state}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content aria-busy={state === 'loading' || undefined} maxHeight={maxHeight} {...dataAttributes}>\n <DialogInner\n dismissible={dismissible}\n footerButtons={footerNav}\n footerContent={footerContent}\n headerExtra={stepsHeader}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\n state={state}\n title={title}\n variant={variant}\n >\n {steps[step]}\n </DialogInner>\n </Dialog.Content>\n </DialogShell>\n </StepsDialogProvider>\n );\n};\n\nBitkitStepsDialog.displayName = 'BitkitStepsDialog';\n\nexport default withSubComponents(BitkitStepsDialog, {\n ActionTrigger: Dialog.ActionTrigger,\n Step: BitkitStepsDialogStep,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA6DA,IAAM,qBAAqB,EACzB,UACA,cAAc,GACd,cAAc,MACd,gBACA,eACA,eACA,aACA,WACA,gBACA,cACA,cACA,MACA,eACA,gBACA,oBACA,MACA,OACA,MAAM,UACN,OACA,SACA,SACA,GAAG,qBACyB;CAC5B,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,WAAW,eAAe,WAAW,iBAAiB;CAC5D,MAAM,QAAQ,gBAAgB,QAAQ,CAAC,CAAC,QACrC,UAA6D,MAAM,SAAS,qBAC/E;CACA,MAAM,aAAa,MAAM;CACzB,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,KAAK,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC;CAEvE,MAAM,UAAU,aACb,SAAiB;EAChB,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,aAAa,CAAC,CAAC;EAC1D,IAAI,CAAC,cAAc,gBAAgB,OAAO;EAC1C,eAAe,OAAO;CACxB,GACA;EAAC;EAAc;EAAc;CAAU,CACzC;CAEA,MAAM,MAAM,eACH;EACL,MAAM;EACN,SAAS,SAAS;EAClB,QAAQ,SAAS,aAAa;EAC9B,YAAY,QAAQ,OAAO,CAAC;EAC5B,YAAY,QAAQ,OAAO,CAAC;EAC5B;EACA;EACA;CACF,IACA;EAAC;EAAS;EAAM;CAAU,CAC5B;CAEA,MAAM,oBAAoB,YAA+B;EACvD,IAAI,CAAC,QAAQ,QAAQ,CAAC,cAAc,gBAAgB,WAAW;EAC/D,eAAe,OAAO;CACxB;CAKA,MAAM,YAAY,iBAChB,oBAAC,KAAD;EAAK,SAAQ;EAAO,gBAAe;EAAgB,OAAM;EACtD,UAAA;CACE,CAAA;CAGP,MAAM,cACJ,oBAAC,qBAAD;EAAmB;EAChB,UAAA,MAAM,KAAK,OAAO,UACjB,oBAAC,oBAAY,MAAb,EAA8B,OAAO,MAAM,MAAM,MAAQ,GAAlC,KAAkC,CAC1D;CACU,CAAA;CAGf,OACE,oBAAC,qBAAD;EAAqB,OAAO;EAC1B,UAAA,oBAAC,aAAD;GACe;GACG;GACA;GAChB,cAAc;GACR;GACS;GACC;GACV;GACC;GACE;GACA;GAET,UAAA,oBAAC,OAAO,SAAR;IAAgB,aAAW,UAAU,aAAa,KAAA;IAAsB;IAAW,GAAI;IACrF,UAAA,oBAAC,aAAD;KACe;KACb,eAAe;KACA;KACf,aAAa;KACA;KACG;KACI;KACb;KACA;KACE;KAER,UAAA,MAAM;IACI,CAAA;GACC,CAAA;EACL,CAAA;CACM,CAAA;AAEzB;AAEA,kBAAkB,cAAc;AAEhC,IAAA,4BAAe,kBAAkB,mBAAmB;CAClD,eAAe,OAAO;CACtB,MAAM;AACR,CAAC"}
|
package/dist/components/BitkitDialog/{BitkitStepperDialogStep.d.ts → BitkitStepsDialogStep.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface BitkitStepsDialogStepProps {
|
|
3
3
|
/** Body content for this step. */
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
/** Optional subtitle shown under the step's body title. */
|
|
@@ -10,11 +10,11 @@ export interface BitkitStepperDialogStepProps {
|
|
|
10
10
|
title: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* A single step of a {@link
|
|
13
|
+
* A single step of a {@link BitkitStepsDialog}. Renders its `title`/`description` typography
|
|
14
14
|
* followed by `children`. The parent only mounts the active step, so this never self-gates.
|
|
15
15
|
*/
|
|
16
|
-
declare const
|
|
17
|
-
({ children, description, title }:
|
|
16
|
+
declare const BitkitStepsDialogStep: {
|
|
17
|
+
({ children, description, title }: BitkitStepsDialogStepProps): import("react").JSX.Element;
|
|
18
18
|
displayName: string;
|
|
19
19
|
};
|
|
20
|
-
export default
|
|
20
|
+
export default BitkitStepsDialogStep;
|
package/dist/components/BitkitDialog/{BitkitStepperDialogStep.js → BitkitStepsDialogStep.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { chakra } from "@chakra-ui/react/styled-system";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useDialogStyles } from "@chakra-ui/react/dialog";
|
|
4
|
-
//#region lib/components/BitkitDialog/
|
|
4
|
+
//#region lib/components/BitkitDialog/BitkitStepsDialogStep.tsx
|
|
5
5
|
/**
|
|
6
|
-
* A single step of a {@link
|
|
6
|
+
* A single step of a {@link BitkitStepsDialog}. Renders its `title`/`description` typography
|
|
7
7
|
* followed by `children`. The parent only mounts the active step, so this never self-gates.
|
|
8
8
|
*/
|
|
9
|
-
var
|
|
9
|
+
var BitkitStepsDialogStep = ({ children, description, title }) => {
|
|
10
10
|
const styles = useDialogStyles();
|
|
11
11
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(chakra.div, {
|
|
12
12
|
css: styles.stepTitleGroup,
|
|
@@ -19,8 +19,8 @@ var BitkitStepperDialogStep = ({ children, description, title }) => {
|
|
|
19
19
|
})]
|
|
20
20
|
}), children] });
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
BitkitStepsDialogStep.displayName = "BitkitStepsDialogStep";
|
|
23
23
|
//#endregion
|
|
24
|
-
export {
|
|
24
|
+
export { BitkitStepsDialogStep as default };
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=BitkitStepsDialogStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitkitStepsDialogStep.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitStepsDialogStep.tsx"],"sourcesContent":["import { useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type ReactNode } from 'react';\n\nexport interface BitkitStepsDialogStepProps {\n /** Body content for this step. */\n children?: ReactNode;\n /** Optional subtitle shown under the step's body title. */\n description?: string;\n /** Short label shown in the steps header. */\n label: string;\n /** Heading shown at the top of the step's body. */\n title: string;\n}\n\n/**\n * A single step of a {@link BitkitStepsDialog}. Renders its `title`/`description` typography\n * followed by `children`. The parent only mounts the active step, so this never self-gates.\n */\nconst BitkitStepsDialogStep = ({ children, description, title }: BitkitStepsDialogStepProps) => {\n const styles = useDialogStyles();\n\n return (\n <>\n <chakra.div css={styles.stepTitleGroup}>\n <chakra.p css={styles.stepTitle}>{title}</chakra.p>\n {description && <chakra.p css={styles.stepDescription}>{description}</chakra.p>}\n </chakra.div>\n {children}\n </>\n );\n};\n\nBitkitStepsDialogStep.displayName = 'BitkitStepsDialogStep';\n\nexport default BitkitStepsDialogStep;\n"],"mappings":";;;;;;;;AAmBA,IAAM,yBAAyB,EAAE,UAAU,aAAa,YAAwC;CAC9F,MAAM,SAAS,gBAAgB;CAE/B,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,OAAO,KAAR;EAAY,KAAK,OAAO;EAAxB,UAAA,CACE,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;GAAY,UAAA;EAAgB,CAAA,GACjD,eAAe,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;GAAkB,UAAA;EAAsB,CAAA,CACpE;CACX,CAAA,GAAA,QACD,EAAA,CAAA;AAEN;AAEA,sBAAsB,cAAc"}
|
|
@@ -2,24 +2,25 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
export interface DialogInnerProps {
|
|
3
3
|
/** Body content. */
|
|
4
4
|
children?: ReactNode;
|
|
5
|
-
|
|
5
|
+
dismissible?: boolean;
|
|
6
6
|
/** Action buttons, auto-wrapped in the standard right-aligned button row inside the footer. */
|
|
7
7
|
footerButtons?: ReactNode;
|
|
8
8
|
/** Arbitrary content rendered raw inside the footer, before any `footerButtons`. */
|
|
9
9
|
footerContent?: ReactNode;
|
|
10
|
-
/** Extra header content below the title (e.g. the
|
|
10
|
+
/** Extra header content below the title (e.g. the steps dialog's steps header). */
|
|
11
11
|
headerExtra?: ReactNode;
|
|
12
12
|
headerLabel?: string;
|
|
13
13
|
scrollBehavior?: 'inside' | 'outside';
|
|
14
14
|
showScrollGradient?: boolean;
|
|
15
|
+
state?: 'loading';
|
|
15
16
|
title: ReactNode;
|
|
16
17
|
variant?: 'overflowContent';
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Header + body + footer rendered inside a `Dialog.Content`. Shared by every Bitkit dialog
|
|
20
21
|
* flavour. Footer rules: `footerContent` renders raw; `footerButtons` is auto-wrapped in the
|
|
21
|
-
* standard right-aligned button row
|
|
22
|
-
* neither is set, no footer renders.
|
|
22
|
+
* standard right-aligned button row, which carries the design's 24px gap above the actions; both
|
|
23
|
+
* render in the same `Dialog.Footer` (content first); if neither is set, no footer renders.
|
|
23
24
|
*/
|
|
24
|
-
declare const DialogInner: ({ children,
|
|
25
|
+
declare const DialogInner: ({ children, dismissible, footerButtons, footerContent, headerExtra, headerLabel, scrollBehavior: scrollBehaviorProp, showScrollGradient, state, title, variant, }: DialogInnerProps) => import("react").JSX.Element;
|
|
25
26
|
export default DialogInner;
|
|
@@ -10,10 +10,10 @@ var PORTAL_DISABLED = { disablePortal: true };
|
|
|
10
10
|
/**
|
|
11
11
|
* Header + body + footer rendered inside a `Dialog.Content`. Shared by every Bitkit dialog
|
|
12
12
|
* flavour. Footer rules: `footerContent` renders raw; `footerButtons` is auto-wrapped in the
|
|
13
|
-
* standard right-aligned button row
|
|
14
|
-
* neither is set, no footer renders.
|
|
13
|
+
* standard right-aligned button row, which carries the design's 24px gap above the actions; both
|
|
14
|
+
* render in the same `Dialog.Footer` (content first); if neither is set, no footer renders.
|
|
15
15
|
*/
|
|
16
|
-
var DialogInner = ({ children,
|
|
16
|
+
var DialogInner = ({ children, dismissible = true, footerButtons, footerContent, headerExtra, headerLabel, scrollBehavior: scrollBehaviorProp, showScrollGradient = true, state, title, variant }) => {
|
|
17
17
|
const scrollBehavior = resolveScrollBehavior(variant, scrollBehaviorProp) ?? "outside";
|
|
18
18
|
const styles = useDialogStyles();
|
|
19
19
|
const hasFooter = !!footerContent || !!footerButtons;
|
|
@@ -33,16 +33,19 @@ var DialogInner = ({ children, closable = true, footerButtons, footerContent, he
|
|
|
33
33
|
children: [headerLabel && /* @__PURE__ */ jsx(chakra.p, {
|
|
34
34
|
css: styles.label,
|
|
35
35
|
children: headerLabel
|
|
36
|
-
}), /* @__PURE__ */ jsx(Dialog.Title, {
|
|
36
|
+
}), /* @__PURE__ */ jsx(Dialog.Title, {
|
|
37
|
+
paddingInlineEnd: dismissible ? void 0 : "0",
|
|
38
|
+
children: title
|
|
39
|
+
})]
|
|
37
40
|
}),
|
|
38
41
|
!!headerExtra && /* @__PURE__ */ jsx(Box, {
|
|
39
42
|
css: styles.stepHeader,
|
|
40
43
|
children: headerExtra
|
|
41
44
|
}),
|
|
42
|
-
/* @__PURE__ */ jsx(Dialog.CloseTrigger, {
|
|
45
|
+
dismissible && /* @__PURE__ */ jsx(Dialog.CloseTrigger, {
|
|
43
46
|
asChild: true,
|
|
44
47
|
children: /* @__PURE__ */ jsx(BitkitCloseButton, {
|
|
45
|
-
disabled:
|
|
48
|
+
disabled: state === "loading",
|
|
46
49
|
size: variant === "overflowContent" ? "xs" : "md",
|
|
47
50
|
type: "button"
|
|
48
51
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogInner.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogInner.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog, useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type ReactNode } from 'react';\n\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport BitkitCloseButton from '../BitkitCloseButton/BitkitCloseButton';\nimport DialogBody, { DialogBodyContext, resolveScrollBehavior } from './DialogBodyContext';\n\nconst PORTAL_DISABLED = { disablePortal: true };\n\nexport interface DialogInnerProps {\n /** Body content. */\n children?: ReactNode;\n
|
|
1
|
+
{"version":3,"file":"DialogInner.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogInner.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog, useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type ReactNode } from 'react';\n\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport BitkitCloseButton from '../BitkitCloseButton/BitkitCloseButton';\nimport DialogBody, { DialogBodyContext, resolveScrollBehavior } from './DialogBodyContext';\n\nconst PORTAL_DISABLED = { disablePortal: true };\n\nexport interface DialogInnerProps {\n /** Body content. */\n children?: ReactNode;\n dismissible?: boolean;\n /** Action buttons, auto-wrapped in the standard right-aligned button row inside the footer. */\n footerButtons?: ReactNode;\n /** Arbitrary content rendered raw inside the footer, before any `footerButtons`. */\n footerContent?: ReactNode;\n /** Extra header content below the title (e.g. the steps dialog's steps header). */\n headerExtra?: ReactNode;\n headerLabel?: string;\n scrollBehavior?: 'inside' | 'outside';\n showScrollGradient?: boolean;\n state?: 'loading';\n title: ReactNode;\n variant?: 'overflowContent';\n}\n\n/**\n * Header + body + footer rendered inside a `Dialog.Content`. Shared by every Bitkit dialog\n * flavour. Footer rules: `footerContent` renders raw; `footerButtons` is auto-wrapped in the\n * standard right-aligned button row, which carries the design's 24px gap above the actions; both\n * render in the same `Dialog.Footer` (content first); if neither is set, no footer renders.\n */\nconst DialogInner = ({\n children,\n dismissible = true,\n footerButtons,\n footerContent,\n headerExtra,\n headerLabel,\n scrollBehavior: scrollBehaviorProp,\n showScrollGradient = true,\n state,\n title,\n variant,\n}: DialogInnerProps) => {\n const scrollBehavior = resolveScrollBehavior(variant, scrollBehaviorProp) ?? 'outside';\n const styles = useDialogStyles();\n const hasFooter = !!footerContent || !!footerButtons;\n\n return (\n <BitkitPortalContext.Provider value={PORTAL_DISABLED}>\n <DialogBodyContext.Provider value={{ scrollBehavior, showScrollGradient }}>\n <Dialog.Header>\n <Box display=\"flex\" flexDirection=\"column\" gap=\"4\">\n {headerLabel && <chakra.p css={styles.label}>{headerLabel}</chakra.p>}\n <Dialog.Title paddingInlineEnd={dismissible ? undefined : '0'}>{title}</Dialog.Title>\n </Box>\n {!!headerExtra && <Box css={styles.stepHeader}>{headerExtra}</Box>}\n {dismissible && (\n <Dialog.CloseTrigger asChild>\n <BitkitCloseButton\n disabled={state === 'loading'}\n size={variant === 'overflowContent' ? 'xs' : 'md'}\n type=\"button\"\n />\n </Dialog.CloseTrigger>\n )}\n </Dialog.Header>\n <DialogBody>{children}</DialogBody>\n {hasFooter && (\n <Dialog.Footer>\n {footerContent}\n {footerButtons && (\n <Box display=\"flex\" gap=\"16\" justifyContent=\"flex-end\" paddingBlockStart=\"24\">\n {footerButtons}\n </Box>\n )}\n </Dialog.Footer>\n )}\n </DialogBodyContext.Provider>\n </BitkitPortalContext.Provider>\n );\n};\n\nexport default DialogInner;\n"],"mappings":";;;;;;;;AASA,IAAM,kBAAkB,EAAE,eAAe,KAAK;;;;;;;AA0B9C,IAAM,eAAe,EACnB,UACA,cAAc,MACd,eACA,eACA,aACA,aACA,gBAAgB,oBAChB,qBAAqB,MACrB,OACA,OACA,cACsB;CACtB,MAAM,iBAAiB,sBAAsB,SAAS,kBAAkB,KAAK;CAC7E,MAAM,SAAS,gBAAgB;CAC/B,MAAM,YAAY,CAAC,CAAC,iBAAiB,CAAC,CAAC;CAEvC,OACE,oBAAC,oBAAoB,UAArB;EAA8B,OAAO;EACnC,UAAA,qBAAC,kBAAkB,UAAnB;GAA4B,OAAO;IAAE;IAAgB;GAAmB;GAAxE,UAAA;IACE,qBAAC,OAAO,QAAR,EAAA,UAAA;KACE,qBAAC,KAAD;MAAK,SAAQ;MAAO,eAAc;MAAS,KAAI;MAA/C,UAAA,CACG,eAAe,oBAAC,OAAO,GAAR;OAAU,KAAK,OAAO;OAAQ,UAAA;MAAsB,CAAA,GACpE,oBAAC,OAAO,OAAR;OAAc,kBAAkB,cAAc,KAAA,IAAY;OAAM,UAAA;MAAoB,CAAA,CACjF;;KACJ,CAAC,CAAC,eAAe,oBAAC,KAAD;MAAK,KAAK,OAAO;MAAa,UAAA;KAAiB,CAAA;KAChE,eACC,oBAAC,OAAO,cAAR;MAAqB,SAAA;MACnB,UAAA,oBAAC,mBAAD;OACE,UAAU,UAAU;OACpB,MAAM,YAAY,oBAAoB,OAAO;OAC7C,MAAK;MACN,CAAA;KACkB,CAAA;IAEV,EAAA,CAAA;IACf,oBAAC,YAAD,EAAa,SAAqB,CAAA;IACjC,aACC,qBAAC,OAAO,QAAR,EAAA,UAAA,CACG,eACA,iBACC,oBAAC,KAAD;KAAK,SAAQ;KAAO,KAAI;KAAK,gBAAe;KAAW,mBAAkB;KACtE,UAAA;IACE,CAAA,CAEM,EAAA,CAAA;GAES;;CACA,CAAA;AAElC"}
|
|
@@ -3,7 +3,7 @@ import { ComponentProps, ReactNode } from 'react';
|
|
|
3
3
|
export interface DialogShellProps {
|
|
4
4
|
/** The `Dialog.Content` element (rendered inside the positioner). */
|
|
5
5
|
children: ReactNode;
|
|
6
|
-
|
|
6
|
+
dismissible?: boolean;
|
|
7
7
|
/** Element to focus when the dialog opens, instead of the first focusable one. */
|
|
8
8
|
initialFocusEl?: ComponentProps<typeof Dialog.Root>['initialFocusEl'];
|
|
9
9
|
onExitComplete?: () => void;
|
|
@@ -14,16 +14,19 @@ export interface DialogShellProps {
|
|
|
14
14
|
preventScroll?: boolean;
|
|
15
15
|
scrollBehavior?: 'inside' | 'outside';
|
|
16
16
|
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
17
|
+
state?: 'loading';
|
|
17
18
|
trigger?: ReactNode;
|
|
18
19
|
variant?: 'overflowContent';
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Shared overlay shell for every Bitkit dialog flavour: `Dialog.Root` + optional trigger + portal +
|
|
22
|
-
* backdrop + positioner.
|
|
23
|
-
*
|
|
23
|
+
* backdrop + positioner. `dismissible={false}` removes every route out that skips a decision: the
|
|
24
|
+
* close button is not rendered (see `DialogInner`) and ESC is blocked. `state="loading"` blocks the
|
|
25
|
+
* same routes for as long as it is set, but keeps the close button in place, disabled. Outside clicks never dismiss a
|
|
26
|
+
* Bitkit dialog either way (`closeOnInteractOutside={false}`). Note that `dismissible` does not reach
|
|
24
27
|
* `ActionTrigger` -- a footer button wired to it closes the dialog either way, so a caller that has
|
|
25
28
|
* to block every route out disables that button itself.
|
|
26
29
|
* The caller passes the `Dialog.Content` (or a `Dialog.Content asChild` wrapper) as children.
|
|
27
30
|
**/
|
|
28
|
-
declare const DialogShell: ({ children,
|
|
31
|
+
declare const DialogShell: ({ children, dismissible, initialFocusEl, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior: scrollBehaviorProp, size, state, trigger, variant, }: DialogShellProps) => import("react").JSX.Element;
|
|
29
32
|
export default DialogShell;
|
|
@@ -5,16 +5,18 @@ import { Dialog } from "@chakra-ui/react/dialog";
|
|
|
5
5
|
//#region lib/components/BitkitDialog/DialogShell.tsx
|
|
6
6
|
/**
|
|
7
7
|
* Shared overlay shell for every Bitkit dialog flavour: `Dialog.Root` + optional trigger + portal +
|
|
8
|
-
* backdrop + positioner.
|
|
9
|
-
*
|
|
8
|
+
* backdrop + positioner. `dismissible={false}` removes every route out that skips a decision: the
|
|
9
|
+
* close button is not rendered (see `DialogInner`) and ESC is blocked. `state="loading"` blocks the
|
|
10
|
+
* same routes for as long as it is set, but keeps the close button in place, disabled. Outside clicks never dismiss a
|
|
11
|
+
* Bitkit dialog either way (`closeOnInteractOutside={false}`). Note that `dismissible` does not reach
|
|
10
12
|
* `ActionTrigger` -- a footer button wired to it closes the dialog either way, so a caller that has
|
|
11
13
|
* to block every route out disables that button itself.
|
|
12
14
|
* The caller passes the `Dialog.Content` (or a `Dialog.Content asChild` wrapper) as children.
|
|
13
15
|
**/
|
|
14
|
-
var DialogShell = ({ children,
|
|
16
|
+
var DialogShell = ({ children, dismissible = true, initialFocusEl, onExitComplete, onOpenChange, open, preventScroll = true, scrollBehavior: scrollBehaviorProp, size, state, trigger, variant }) => {
|
|
15
17
|
const scrollBehavior = resolveScrollBehavior(variant, scrollBehaviorProp);
|
|
16
18
|
return /* @__PURE__ */ jsxs(Dialog.Root, {
|
|
17
|
-
closeOnEscape:
|
|
19
|
+
closeOnEscape: dismissible && state !== "loading",
|
|
18
20
|
closeOnInteractOutside: false,
|
|
19
21
|
initialFocusEl,
|
|
20
22
|
onExitComplete,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogShell.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogShell.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ComponentProps, type ReactNode } from 'react';\n\nimport { resolveScrollBehavior } from './DialogBodyContext';\n\nexport interface DialogShellProps {\n /** The `Dialog.Content` element (rendered inside the positioner). */\n children: ReactNode;\n
|
|
1
|
+
{"version":3,"file":"DialogShell.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogShell.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { type ComponentProps, type ReactNode } from 'react';\n\nimport { resolveScrollBehavior } from './DialogBodyContext';\n\nexport interface DialogShellProps {\n /** The `Dialog.Content` element (rendered inside the positioner). */\n children: ReactNode;\n dismissible?: boolean;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: ComponentProps<typeof Dialog.Root>['initialFocusEl'];\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n size?: 'sm' | 'md' | 'lg' | 'full';\n state?: 'loading';\n trigger?: ReactNode;\n variant?: 'overflowContent';\n}\n\n/**\n * Shared overlay shell for every Bitkit dialog flavour: `Dialog.Root` + optional trigger + portal +\n * backdrop + positioner. `dismissible={false}` removes every route out that skips a decision: the\n * close button is not rendered (see `DialogInner`) and ESC is blocked. `state=\"loading\"` blocks the\n * same routes for as long as it is set, but keeps the close button in place, disabled. Outside clicks never dismiss a\n * Bitkit dialog either way (`closeOnInteractOutside={false}`). Note that `dismissible` does not reach\n * `ActionTrigger` -- a footer button wired to it closes the dialog either way, so a caller that has\n * to block every route out disables that button itself.\n * The caller passes the `Dialog.Content` (or a `Dialog.Content asChild` wrapper) as children.\n **/\n\nconst DialogShell = ({\n children,\n dismissible = true,\n initialFocusEl,\n onExitComplete,\n onOpenChange,\n open,\n preventScroll = true,\n scrollBehavior: scrollBehaviorProp,\n size,\n state,\n trigger,\n variant,\n}: DialogShellProps) => {\n const scrollBehavior = resolveScrollBehavior(variant, scrollBehaviorProp);\n\n return (\n <Dialog.Root\n closeOnEscape={dismissible && state !== 'loading'}\n closeOnInteractOutside={false}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={onOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n variant={variant}\n >\n {trigger && <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>}\n <Portal>\n <Dialog.Backdrop />\n <Dialog.Positioner>{children}</Dialog.Positioner>\n </Portal>\n </Dialog.Root>\n );\n};\n\nexport default DialogShell;\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,IAAM,eAAe,EACnB,UACA,cAAc,MACd,gBACA,gBACA,cACA,MACA,gBAAgB,MAChB,gBAAgB,oBAChB,MACA,OACA,SACA,cACsB;CACtB,MAAM,iBAAiB,sBAAsB,SAAS,kBAAkB;CAExE,OACE,qBAAC,OAAO,MAAR;EACE,eAAe,eAAe,UAAU;EACxC,wBAAwB;EACR;EACA;EACF;EACR;EACS;EACC;EACV;EACG;EAVX,UAAA,CAYG,WAAW,oBAAC,OAAO,SAAR;GAAgB,SAAA;GAAS,UAAA;EAAwB,CAAA,GAC7D,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAO,UAAR,CAAkB,CAAA,GAClB,oBAAC,OAAO,YAAR,EAAoB,SAA4B,CAAA,CAC1C,EAAA,CAAA,CACG;;AAEjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface StepsDialogContextValue {
|
|
2
2
|
/** Jump to an arbitrary (clamped) step. */
|
|
3
3
|
goTo: (step: number) => void;
|
|
4
4
|
isFirst: boolean;
|
|
@@ -12,5 +12,5 @@ export interface StepperDialogContextValue {
|
|
|
12
12
|
step: number;
|
|
13
13
|
totalSteps: number;
|
|
14
14
|
}
|
|
15
|
-
declare const
|
|
16
|
-
export {
|
|
15
|
+
declare const StepsDialogProvider: import('react').Provider<StepsDialogContextValue>, useStepsDialog: () => StepsDialogContextValue;
|
|
16
|
+
export { StepsDialogProvider, useStepsDialog };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from "@chakra-ui/react";
|
|
2
|
+
//#region lib/components/BitkitDialog/StepsDialogContext.ts
|
|
3
|
+
var [StepsDialogProvider, useStepsDialog] = createContext({
|
|
4
|
+
hookName: "useStepsDialog",
|
|
5
|
+
name: "StepsDialogContext",
|
|
6
|
+
providerName: "<BitkitStepsDialog />"
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { StepsDialogProvider, useStepsDialog };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=StepsDialogContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepsDialogContext.js","names":[],"sources":["../../../lib/components/BitkitDialog/StepsDialogContext.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\n\nexport interface StepsDialogContextValue {\n /** Jump to an arbitrary (clamped) step. */\n goTo: (step: number) => void;\n isFirst: boolean;\n isLast: boolean;\n /** Advance to the next step (clamped to the last). */\n next: () => void;\n /** Go back to the previous step (clamped to the first). */\n prev: () => void;\n /** Alias of {@link goTo}. */\n setStep: (step: number) => void;\n step: number;\n totalSteps: number;\n}\n\nconst [StepsDialogProvider, useStepsDialog] = createContext<StepsDialogContextValue>({\n hookName: 'useStepsDialog',\n name: 'StepsDialogContext',\n providerName: '<BitkitStepsDialog />',\n});\n\nexport { StepsDialogProvider, useStepsDialog };\n"],"mappings":";;AAkBA,IAAM,CAAC,qBAAqB,kBAAkB,cAAuC;CACnF,UAAU;CACV,MAAM;CACN,cAAc;AAChB,CAAC"}
|
|
@@ -20,8 +20,8 @@ export { default as BitkitDatePicker, type BitkitDatePickerProps } from './Bitki
|
|
|
20
20
|
export { default as BitkitDefinitionTooltip, type BitkitDefinitionTooltipProps, } from './BitkitDefinitionTooltip/BitkitDefinitionTooltip';
|
|
21
21
|
export { default as BitkitDialog, type BitkitDialogProps } from './BitkitDialog/BitkitDialog';
|
|
22
22
|
export { default as BitkitFormDialog, type BitkitFormDialogProps } from './BitkitDialog/BitkitFormDialog';
|
|
23
|
-
export { default as
|
|
24
|
-
export { type
|
|
23
|
+
export { default as BitkitStepsDialog, type BitkitStepsDialogProps, useStepsDialog, } from './BitkitDialog/BitkitStepsDialog';
|
|
24
|
+
export { type BitkitStepsDialogStepProps } from './BitkitDialog/BitkitStepsDialogStep';
|
|
25
25
|
export { default as BitkitDraggableCard, type BitkitDraggableCardProps, } from './BitkitDraggableCard/BitkitDraggableCard';
|
|
26
26
|
export { default as BitkitDrawer, type BitkitDrawerActionTriggerProps, type BitkitDrawerBackdropProps, type BitkitDrawerBodyProps, type BitkitDrawerCloseButtonProps, type BitkitDrawerContentProps, type BitkitDrawerDescriptionProps, type BitkitDrawerFooterProps, type BitkitDrawerHeaderProps, type BitkitDrawerPositionerProps, type BitkitDrawerRootProps, type BitkitDrawerTitleProps, type BitkitDrawerTriggerProps, } from './BitkitDrawer/BitkitDrawer';
|
|
27
27
|
export { default as BitkitEmptyState, type BitkitEmptyStateProps } from './BitkitEmptyState/BitkitEmptyState';
|
package/dist/main.js
CHANGED
|
@@ -321,8 +321,8 @@ import BitkitDefinitionTooltip from "./components/BitkitDefinitionTooltip/Bitkit
|
|
|
321
321
|
import BitkitDialog_default from "./components/BitkitDialog/BitkitDialog.js";
|
|
322
322
|
import BitkitFormDialog_default from "./components/BitkitDialog/BitkitFormDialog.js";
|
|
323
323
|
import BitkitSteps_default from "./components/BitkitSteps/BitkitSteps.js";
|
|
324
|
-
import {
|
|
325
|
-
import
|
|
324
|
+
import { useStepsDialog } from "./components/BitkitDialog/StepsDialogContext.js";
|
|
325
|
+
import BitkitStepsDialog_default from "./components/BitkitDialog/BitkitStepsDialog.js";
|
|
326
326
|
import BitkitDraggableCard from "./components/BitkitDraggableCard/BitkitDraggableCard.js";
|
|
327
327
|
import BitkitDrawer from "./components/BitkitDrawer/BitkitDrawer.js";
|
|
328
328
|
import BitkitEmptyState from "./components/BitkitEmptyState/BitkitEmptyState.js";
|
|
@@ -387,4 +387,4 @@ import BitkitTreeView, { createTreeCollection } from "./components/BitkitTreeVie
|
|
|
387
387
|
import useResponsive, { ResponsiveProvider } from "./hooks/useResponsive.js";
|
|
388
388
|
import bitkitTheme from "./theme/index.js";
|
|
389
389
|
import Provider from "./providers/BitkitProvider.js";
|
|
390
|
-
export { BitkitAccordion_default as BitkitAccordion, BitkitActionBar, BitkitActionMenu_default as BitkitActionMenu, BitkitAlert, BitkitAvatar, BitkitBadge, BitkitBreadcrumb, BitkitBulkActionsRow, BitkitButton, BitkitCalendar, BitkitCheckbox, BitkitCheckboxGroup, BitkitCloseButton, BitkitCodeSnippet, BitkitCollapsible, BitkitColorButton, BitkitCombobox_default as BitkitCombobox, BitkitControlButton, BitkitDataWidget, BitkitDatePicker, BitkitDefinitionColumnHeader, BitkitDefinitionTooltip, BitkitDialog_default as BitkitDialog, BitkitDraggableCard, BitkitDrawer, BitkitEmptyState, BitkitExpandableCard, BitkitExpandableRow, BitkitField, BitkitFileInput, BitkitFilterRow, BitkitFormDialog_default as BitkitFormDialog, BitkitGroupHeading, BitkitHeading, BitkitIconButton, BitkitInlineLoading, BitkitLabel, BitkitLabelTooltip, BitkitLabeledData, BitkitLightbox, BitkitLink, BitkitLinkButton, BitkitLinkedRow_default as BitkitLinkedRow, BitkitList_default as BitkitList, BitkitMarkdown, BitkitMarkdownCard, BitkitMultiselect_default as BitkitMultiselect, BitkitMultiselectMenu, BitkitNativeSelect, BitkitNoteCard, BitkitNumberInput, BitkitOverflowContent, BitkitOverflowTooltip, BitkitPageFooter_default as BitkitPageFooter, BitkitPagination, BitkitPaginationLoadMore, BitkitPopover, BitkitProgressBar, BitkitPromoBanner, Provider as BitkitProvider, BitkitRadio, BitkitRadioGroup, BitkitRibbon, BitkitRowActionsCell, BitkitSearchInput, BitkitSectionHeading, BitkitSegmentedControl_default as BitkitSegmentedControl, BitkitSelect_default as BitkitSelect, BitkitSelectMenu, BitkitSelectMenuAction, BitkitSelectableTag_default as BitkitSelectableTag, BitkitSettingsCard_default as BitkitSettingsCard, BitkitSidebar_default as BitkitSidebar, BitkitSkeletonGroup, BitkitSortableColumnHeader, BitkitSpinner, BitkitSplitButton_default as BitkitSplitButton, BitkitStat,
|
|
390
|
+
export { BitkitAccordion_default as BitkitAccordion, BitkitActionBar, BitkitActionMenu_default as BitkitActionMenu, BitkitAlert, BitkitAvatar, BitkitBadge, BitkitBreadcrumb, BitkitBulkActionsRow, BitkitButton, BitkitCalendar, BitkitCheckbox, BitkitCheckboxGroup, BitkitCloseButton, BitkitCodeSnippet, BitkitCollapsible, BitkitColorButton, BitkitCombobox_default as BitkitCombobox, BitkitControlButton, BitkitDataWidget, BitkitDatePicker, BitkitDefinitionColumnHeader, BitkitDefinitionTooltip, BitkitDialog_default as BitkitDialog, BitkitDraggableCard, BitkitDrawer, BitkitEmptyState, BitkitExpandableCard, BitkitExpandableRow, BitkitField, BitkitFileInput, BitkitFilterRow, BitkitFormDialog_default as BitkitFormDialog, BitkitGroupHeading, BitkitHeading, BitkitIconButton, BitkitInlineLoading, BitkitLabel, BitkitLabelTooltip, BitkitLabeledData, BitkitLightbox, BitkitLink, BitkitLinkButton, BitkitLinkedRow_default as BitkitLinkedRow, BitkitList_default as BitkitList, BitkitMarkdown, BitkitMarkdownCard, BitkitMultiselect_default as BitkitMultiselect, BitkitMultiselectMenu, BitkitNativeSelect, BitkitNoteCard, BitkitNumberInput, BitkitOverflowContent, BitkitOverflowTooltip, BitkitPageFooter_default as BitkitPageFooter, BitkitPagination, BitkitPaginationLoadMore, BitkitPopover, BitkitProgressBar, BitkitPromoBanner, Provider as BitkitProvider, BitkitRadio, BitkitRadioGroup, BitkitRibbon, BitkitRowActionsCell, BitkitSearchInput, BitkitSectionHeading, BitkitSegmentedControl_default as BitkitSegmentedControl, BitkitSelect_default as BitkitSelect, BitkitSelectMenu, BitkitSelectMenuAction, BitkitSelectableTag_default as BitkitSelectableTag, BitkitSettingsCard_default as BitkitSettingsCard, BitkitSidebar_default as BitkitSidebar, BitkitSkeletonGroup, BitkitSortableColumnHeader, BitkitSpinner, BitkitSplitButton_default as BitkitSplitButton, BitkitStat, BitkitSteps_default as BitkitSteps, BitkitStepsCard_default as BitkitStepsCard, BitkitStepsDialog_default as BitkitStepsDialog, BitkitSwitch, BitkitTableCard, BitkitTabs, BitkitTag, BitkitTagsInput, BitkitTextArea, BitkitTextInput, BitkitToggleButton, BitkitTooltip, BitkitTour, BitkitTreeView, IconAbortCircle, IconAbortCircleFilled, IconAddons, IconAgent, IconAnchor, IconAndroid, IconApp, IconAppSettings, IconAppStore, IconAppStoreColor, IconApple, IconArchive, IconArchiveDelete, IconArchiveRestore, IconArrowBackAndDown, IconArrowBackAndUp, IconArrowDown, IconArrowForwardAndDown, IconArrowForwardAndUp, IconArrowLeft, IconArrowNortheast, IconArrowNorthwest, IconArrowRight, IconArrowUp, IconArrowsHorizontal, IconArrowsVertical, IconAutomation, IconAws, IconAwsColor, IconBadge3RdParty, IconBadgeBitrise, IconBadgeUpgrade, IconBadgeVersionOk, IconBazel, IconBell, IconBitbot, IconBitbotError, IconBitbucket, IconBitbucketColor, IconBitbucketNeutral, IconBitbucketWhite, IconBlockCircle, IconBook, IconBoxArrowDown, IconBoxDot, IconBoxLinesOverflow, IconBoxLinesWrap, IconBranch, IconBrowserstackColor, IconBug, IconBuild, IconBuildCache, IconBuildCacheFilled, IconBuildEnvSetup, IconBuildHub, IconBuildHubFilled, IconCalendar, IconChangePlan, IconChat, IconCheck, IconCheckCircle, IconCheckCircleFilled, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconCi, IconCiFilled, IconCircle, IconCircleDashed, IconCircleHalfFilled, IconClaude, IconClaudeColor, IconClock, IconCode, IconCodePush, IconCodeSigning, IconCoffee, IconCommit, IconConfigure, IconConnectedAccounts, IconContainer, IconCopilot, IconCopy, IconCordova, IconCpu, IconCreditcard, IconCredits, IconCross, IconCrossCircle, IconCrossCircleFilled, IconCrown, IconCursor, IconCycle, IconDashboard, IconDashboardFilled, IconDeployment, IconDetails, IconDoc, IconDollar, IconDot, IconDotnet, IconDotnetColor, IconDotnetText, IconDotnetTextColor, IconDoubleCircle, IconDownload, IconDragHandle, IconEc2Ami, IconEnterprise, IconErrorCircle, IconErrorCircleFilled, IconExpand, IconExtraBuildCapacity, IconEye, IconEyeSlash, IconFastlane, IconFileDoc, IconFilePdf, IconFilePlist, IconFileYml, IconFileZip, IconFilter, IconFlag, IconFlutter, IconFolder, IconFullscreen, IconFullscreenExit, IconGauge, IconGit, IconGithub, IconGitlab, IconGitlabColor, IconGitlabWhite, IconGlobe, IconGo, IconGoogleColor, IconGooglePlay, IconGooglePlayColor, IconGradle, IconGroup, IconHashtag, IconHeadset, IconHeart, IconHistory, IconHourglass, IconImage, IconInfoCircle, IconInfoCircleFilled, IconInsights, IconInsightsFilled, IconInstall, IconInteraction, IconInvoice, IconIonic, IconJapanese, IconJava, IconJavaColor, IconJavaDuke, IconJavaDukeColor, IconKey, IconKiroColor, IconKotlin, IconKotlinColor, IconKotlinWhite, IconLaptop, IconLaunchdarkly, IconLegacyApp, IconLightbulb, IconLink, IconLinux, IconLock, IconLockOpen, IconLogin, IconLogout, IconMacos, IconMagicWand, IconMagnifier, IconMail, IconMcp, IconMedal, IconMemory, IconMenuGrid, IconMenuHamburger, IconMessage, IconMessageAlert, IconMessageQuestion, IconMicrophone, IconMinus, IconMinusCircle, IconMinusCircleFilled, IconMobile, IconMobileLandscape, IconMonitorChart, IconMoreHorizontal, IconMoreVertical, IconNews, IconNextjs, IconNodejs, IconOpenInNew, IconOther, IconOutsideContributor, IconOverview, IconPause, IconPencil, IconPeople, IconPercent, IconPerson, IconPersonWithDesk, IconPlay, IconPlus, IconPlusCircle, IconPlusCircleFilled, IconPower, IconProject, IconProjectSettings, IconPull, IconPush, IconPuzzle, IconPython, IconPythonColor, IconQuestionCircle, IconQuestionCircleFilled, IconReact, IconRefresh, IconRegex, IconRelease, IconReleaseFilled, IconRemoteAccess, IconReplace, IconResponsiveness, IconReviewerApproved, IconReviewerAssigned, IconReviewerRejected, IconRuby, IconRubyColor, IconSave, IconSecurityShield, IconSettings, IconSettingsFilled, IconShuffle, IconSiren, IconSkip, IconSkipCircle, IconSkipCircleFilled, IconSlack, IconSlackColor, IconSparkle, IconSparkleFilled, IconSpinnerOnDisabled, IconSpinnerPurple, IconSpinnerPurpleDouble, IconSpinnerWhite, IconStability, IconStack, IconStar, IconStep, IconStop, IconStopwatch, IconTabPlus, IconTag, IconTasks, IconTeams, IconTeamsColor, IconTemplateCode, IconTerminal, IconTerminalFilled, IconTestQuarantine, IconThemeDarkToggle, IconThumbDown, IconThumbUp, IconTools, IconTrash, IconTrigger, IconUbuntu, IconUbuntuColor, IconUnity3D, IconUpload, IconValidateShield, IconVideo, IconVsCode, IconWarning, IconWarningYellow, IconWebUi, IconWebhooks, IconWindsurf, IconWorkflow, IconWorkflowFlow, IconXTwitter, IconXamarin, IconXcode, ResponsiveProvider, bitkitIcon, bitkitTheme as bitriseTheme, createBitkitToast, createTreeCollection, dismissBitkitToast, rem, useBitkitTour, useResponsive, useStepsDialog };
|
|
@@ -154,14 +154,38 @@ Other prop mappings:
|
|
|
154
154
|
|
|
155
155
|
| v1 | v2 |
|
|
156
156
|
|----|----|
|
|
157
|
-
| `isClosable={false}` | `
|
|
157
|
+
| `isClosable={false}` | `dismissible={false}` |
|
|
158
|
+
| `isClosable={!isLoading}` (toggled during an async action) | `state="loading"` |
|
|
158
159
|
| `onCloseComplete={fn}` | `onExitComplete={fn}` (fires when the close animation finishes) |
|
|
159
160
|
|
|
160
|
-
`
|
|
161
|
+
`dismissible={false}` goes one step further than v1: the header close button is **not rendered at all** (v1 kept it in place, disabled) and **ESC is blocked**. Overlay/outside clicks are ignored regardless of `dismissible`, because the dialog always sets `closeOnInteractOutside={false}` internally. With `dismissible={false}` the only way to dismiss the dialog is through an explicit footer action.
|
|
162
|
+
|
|
163
|
+
**Which of the two you want.** v1 had a single `isClosable`, so a dialog that merely had to survive an in-flight request used the same flag as one that can never be dismissed. v2 splits them:
|
|
164
|
+
|
|
165
|
+
- `dismissible={false}` is a property of the dialog itself: it can never be dismissed, so it carries no close button at all. Use it when the only way out is an explicit footer action, e.g. an acknowledgement or a forced choice.
|
|
166
|
+
- `state="loading"` is temporary: something is running and the dialog must not be abandoned halfway. The close button stays where it is but goes disabled, ESC is blocked, and the dialog gets `aria-busy`. Set it together with the footer button's own `state="loading"`, and disable the other footer buttons for as long as it runs.
|
|
167
|
+
|
|
168
|
+
A v1 `isClosable={!isLoading}` is the second case, not the first. Mapping it to `dismissible` would make the close button vanish when the request starts and reappear when it finishes, where v1 only greyed it out.
|
|
161
169
|
|
|
162
170
|
```tsx
|
|
163
171
|
// Acknowledge-only dialog
|
|
164
|
-
<BitkitDialog
|
|
172
|
+
<BitkitDialog dismissible={false} open={open} onOpenChange={…} title="Action required">…</BitkitDialog>
|
|
173
|
+
|
|
174
|
+
// Locked while a request is in flight (v1: isClosable={!isSaving})
|
|
175
|
+
<BitkitDialog
|
|
176
|
+
footerButtons={
|
|
177
|
+
<>
|
|
178
|
+
<BitkitButton state={isSaving ? 'disabled' : undefined} variant="secondary" onClick={close}>Cancel</BitkitButton>
|
|
179
|
+
<BitkitButton state={isSaving ? 'loading' : undefined} variant="primary" onClick={save}>Save</BitkitButton>
|
|
180
|
+
</>
|
|
181
|
+
}
|
|
182
|
+
open={open}
|
|
183
|
+
state={isSaving ? 'loading' : undefined}
|
|
184
|
+
title="Save changes"
|
|
185
|
+
onOpenChange={…}
|
|
186
|
+
>
|
|
187
|
+
…
|
|
188
|
+
</BitkitDialog>
|
|
165
189
|
|
|
166
190
|
// Run code after the close animation completes (e.g. navigation, focus restoration)
|
|
167
191
|
<BitkitDialog open={open} onOpenChange={…} onExitComplete={() => navigate('/next')} title="…">
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitStepperDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitStepperDialog.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { type ReactElement, type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport { type BitkitDataAttributes } from '../../utilities/dataAttributes';\nimport { flattenChildren } from '../../utilities/flattenChildren';\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitSteps from '../BitkitSteps/BitkitSteps';\nimport BitkitStepperDialogStep, { type BitkitStepperDialogStepProps } from './BitkitStepperDialogStep';\nimport DialogInner from './DialogInner';\nimport DialogShell, { type DialogShellProps } from './DialogShell';\nimport { StepperDialogProvider } from './StepperContext';\n\nexport { useStepperDialog } from './StepperContext';\n\nexport type BitkitStepperDialogProps = {\n /** `BitkitStepperDialog.Step` children, one per step. */\n children: ReactNode;\n closable?: boolean;\n /** Initial step when uncontrolled. Resets to this when the dialog closes. */\n defaultStep?: number;\n /** Element to focus when the dialog opens, instead of the first focusable one. */\n initialFocusEl?: DialogShellProps['initialFocusEl'];\n /**\n * Footer content rendered raw. Stepper footers are space-between (Cancel left, Prev/Next right),\n * so build the nav row here with `useStepperDialog()` — there is no `footerButtons` slot, which\n * would force right-alignment.\n */\n footerContent?: ReactNode;\n headerLabel?: string;\n maxHeight?: string;\n onExitComplete?: () => void;\n onOpenChange?: (details: { open: boolean }) => void;\n /** Called whenever the active step changes (controlled or uncontrolled). */\n onStepChange?: (step: number) => void;\n open?: boolean;\n preventScroll?: boolean;\n scrollBehavior?: 'inside' | 'outside';\n showScrollGradient?: boolean;\n size?: 'sm' | 'md' | 'lg' | 'full';\n /** Controlled active step. Omit for uncontrolled (see `defaultStep`). */\n step?: number;\n title: ReactNode;\n trigger?: ReactNode;\n variant?: 'overflowContent';\n // Data attributes are forwarded to the element carrying `role=\"dialog\"`, and nothing else is —\n // style props, `className` and `id` don't pass through.\n} & BitkitDataAttributes;\n\n/**\n * A dialog that walks through a sequence of `BitkitStepperDialog.Step` children. It owns the step\n * state, auto-renders the steps header, and shows only the active step's body. Footer navigation is\n * wired by the consumer through the `useStepperDialog()` hook.\n */\nconst BitkitStepperDialog = ({\n children,\n closable = true,\n defaultStep = 0,\n initialFocusEl,\n footerContent,\n headerLabel,\n maxHeight,\n onExitComplete,\n onOpenChange,\n onStepChange,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n step: stepProp,\n title,\n trigger,\n variant,\n ...dataAttributes\n}: BitkitStepperDialogProps) => {\n const [internalStep, setInternalStep] = useState(defaultStep);\n const isControlled = stepProp !== undefined;\n const rawStep = (isControlled ? stepProp : internalStep) ?? 0;\n const steps = flattenChildren(children).filter(\n (child): child is ReactElement<BitkitStepperDialogStepProps> => child.type === BitkitStepperDialogStep,\n );\n const totalSteps = steps.length;\n const step = Math.max(0, Math.min(rawStep, Math.max(0, totalSteps - 1)));\n\n const setStep = useCallback(\n (next: number) => {\n const clamped = Math.max(0, Math.min(next, totalSteps - 1));\n if (!isControlled) setInternalStep(clamped);\n onStepChange?.(clamped);\n },\n [isControlled, onStepChange, totalSteps],\n );\n\n const ctx = useMemo(\n () => ({\n goTo: setStep,\n isFirst: step === 0,\n isLast: step === totalSteps - 1,\n next: () => setStep(step + 1),\n prev: () => setStep(step - 1),\n setStep,\n step,\n totalSteps,\n }),\n [setStep, step, totalSteps],\n );\n\n const handleOpenChange = (details: { open: boolean }) => {\n if (!details.open && !isControlled) setInternalStep(defaultStep);\n onOpenChange?.(details);\n };\n\n const stepsHeader = (\n <BitkitSteps step={step}>\n {steps.map((child, index) => (\n <BitkitSteps.Item key={index} label={child.props.label} />\n ))}\n </BitkitSteps>\n );\n\n return (\n <StepperDialogProvider value={ctx}>\n <DialogShell\n closable={closable}\n initialFocusEl={initialFocusEl}\n onExitComplete={onExitComplete}\n onOpenChange={handleOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content maxHeight={maxHeight} {...dataAttributes}>\n <DialogInner\n closable={closable}\n footerContent={footerContent}\n headerExtra={stepsHeader}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\n title={title}\n variant={variant}\n >\n {steps[step]}\n </DialogInner>\n </Dialog.Content>\n </DialogShell>\n </StepperDialogProvider>\n );\n};\n\nBitkitStepperDialog.displayName = 'BitkitStepperDialog';\n\nexport default withSubComponents(BitkitStepperDialog, {\n ActionTrigger: Dialog.ActionTrigger,\n Step: BitkitStepperDialogStep,\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAqDA,IAAM,uBAAuB,EAC3B,UACA,WAAW,MACX,cAAc,GACd,gBACA,eACA,aACA,WACA,gBACA,cACA,cACA,MACA,eACA,gBACA,oBACA,MACA,MAAM,UACN,OACA,SACA,SACA,GAAG,qBAC2B;CAC9B,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,WAAW,eAAe,WAAW,iBAAiB;CAC5D,MAAM,QAAQ,gBAAgB,QAAQ,CAAC,CAAC,QACrC,UAA+D,MAAM,SAAS,uBACjF;CACA,MAAM,aAAa,MAAM;CACzB,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,SAAS,KAAK,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC;CAEvE,MAAM,UAAU,aACb,SAAiB;EAChB,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,aAAa,CAAC,CAAC;EAC1D,IAAI,CAAC,cAAc,gBAAgB,OAAO;EAC1C,eAAe,OAAO;CACxB,GACA;EAAC;EAAc;EAAc;CAAU,CACzC;CAEA,MAAM,MAAM,eACH;EACL,MAAM;EACN,SAAS,SAAS;EAClB,QAAQ,SAAS,aAAa;EAC9B,YAAY,QAAQ,OAAO,CAAC;EAC5B,YAAY,QAAQ,OAAO,CAAC;EAC5B;EACA;EACA;CACF,IACA;EAAC;EAAS;EAAM;CAAU,CAC5B;CAEA,MAAM,oBAAoB,YAA+B;EACvD,IAAI,CAAC,QAAQ,QAAQ,CAAC,cAAc,gBAAgB,WAAW;EAC/D,eAAe,OAAO;CACxB;CAEA,MAAM,cACJ,oBAAC,qBAAD;EAAmB;EAChB,UAAA,MAAM,KAAK,OAAO,UACjB,oBAAC,oBAAY,MAAb,EAA8B,OAAO,MAAM,MAAM,MAAQ,GAAlC,KAAkC,CAC1D;CACU,CAAA;CAGf,OACE,oBAAC,uBAAD;EAAuB,OAAO;EAC5B,UAAA,oBAAC,aAAD;GACY;GACM;GACA;GAChB,cAAc;GACR;GACS;GACC;GACV;GACG;GACA;GAET,UAAA,oBAAC,OAAO,SAAR;IAA2B;IAAW,GAAI;IACxC,UAAA,oBAAC,aAAD;KACY;KACK;KACf,aAAa;KACA;KACG;KACI;KACb;KACE;KAER,UAAA,MAAM;IACI,CAAA;GACC,CAAA;EACL,CAAA;CACQ,CAAA;AAE3B;AAEA,oBAAoB,cAAc;AAElC,IAAA,8BAAe,kBAAkB,qBAAqB;CACpD,eAAe,OAAO;CACtB,MAAM;AACR,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitStepperDialogStep.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitStepperDialogStep.tsx"],"sourcesContent":["import { useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { type ReactNode } from 'react';\n\nexport interface BitkitStepperDialogStepProps {\n /** Body content for this step. */\n children?: ReactNode;\n /** Optional subtitle shown under the step's body title. */\n description?: string;\n /** Short label shown in the steps header. */\n label: string;\n /** Heading shown at the top of the step's body. */\n title: string;\n}\n\n/**\n * A single step of a {@link BitkitStepperDialog}. Renders its `title`/`description` typography\n * followed by `children`. The parent only mounts the active step, so this never self-gates.\n */\nconst BitkitStepperDialogStep = ({ children, description, title }: BitkitStepperDialogStepProps) => {\n const styles = useDialogStyles();\n\n return (\n <>\n <chakra.div css={styles.stepTitleGroup}>\n <chakra.p css={styles.stepTitle}>{title}</chakra.p>\n {description && <chakra.p css={styles.stepDescription}>{description}</chakra.p>}\n </chakra.div>\n {children}\n </>\n );\n};\n\nBitkitStepperDialogStep.displayName = 'BitkitStepperDialogStep';\n\nexport default BitkitStepperDialogStep;\n"],"mappings":";;;;;;;;AAmBA,IAAM,2BAA2B,EAAE,UAAU,aAAa,YAA0C;CAClG,MAAM,SAAS,gBAAgB;CAE/B,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,OAAO,KAAR;EAAY,KAAK,OAAO;EAAxB,UAAA,CACE,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;GAAY,UAAA;EAAgB,CAAA,GACjD,eAAe,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;GAAkB,UAAA;EAAsB,CAAA,CACpE;CACX,CAAA,GAAA,QACD,EAAA,CAAA;AAEN;AAEA,wBAAwB,cAAc"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createContext } from "@chakra-ui/react";
|
|
2
|
-
//#region lib/components/BitkitDialog/StepperContext.ts
|
|
3
|
-
var [StepperDialogProvider, useStepperDialog] = createContext({
|
|
4
|
-
hookName: "useStepperDialog",
|
|
5
|
-
name: "StepperDialogContext",
|
|
6
|
-
providerName: "<BitkitStepperDialog />"
|
|
7
|
-
});
|
|
8
|
-
//#endregion
|
|
9
|
-
export { StepperDialogProvider, useStepperDialog };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=StepperContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StepperContext.js","names":[],"sources":["../../../lib/components/BitkitDialog/StepperContext.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { createContext } from '@chakra-ui/react';\n\nexport interface StepperDialogContextValue {\n /** Jump to an arbitrary (clamped) step. */\n goTo: (step: number) => void;\n isFirst: boolean;\n isLast: boolean;\n /** Advance to the next step (clamped to the last). */\n next: () => void;\n /** Go back to the previous step (clamped to the first). */\n prev: () => void;\n /** Alias of {@link goTo}. */\n setStep: (step: number) => void;\n step: number;\n totalSteps: number;\n}\n\nconst [StepperDialogProvider, useStepperDialog] = createContext<StepperDialogContextValue>({\n hookName: 'useStepperDialog',\n name: 'StepperDialogContext',\n providerName: '<BitkitStepperDialog />',\n});\n\nexport { StepperDialogProvider, useStepperDialog };\n"],"mappings":";;AAkBA,IAAM,CAAC,uBAAuB,oBAAoB,cAAyC;CACzF,UAAU;CACV,MAAM;CACN,cAAc;AAChB,CAAC"}
|