@bitrise/bitkit-v2 0.3.393 → 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/icons/IconCopilot.d.ts +8 -0
- package/dist/icons/IconCopilot.js +31 -0
- package/dist/icons/IconCopilot.js.map +1 -0
- package/dist/icons/IconCursor.d.ts +8 -0
- package/dist/icons/IconCursor.js +31 -0
- package/dist/icons/IconCursor.js.map +1 -0
- package/dist/icons/IconKiroColor.d.ts +9 -0
- package/dist/icons/IconKiroColor.js +31 -0
- package/dist/icons/IconKiroColor.js.map +1 -0
- package/dist/icons/IconMcp.d.ts +8 -0
- package/dist/icons/IconMcp.js +31 -0
- package/dist/icons/IconMcp.js.map +1 -0
- package/dist/icons/IconTabPlus.d.ts +8 -0
- package/dist/icons/IconTabPlus.js +31 -0
- package/dist/icons/IconTabPlus.js.map +1 -0
- package/dist/icons/IconTerminalFilled.d.ts +8 -0
- package/dist/icons/IconTerminalFilled.js +31 -0
- package/dist/icons/IconTerminalFilled.js.map +1 -0
- package/dist/icons/IconVsCode.d.ts +8 -0
- package/dist/icons/IconVsCode.js +31 -0
- package/dist/icons/IconVsCode.js.map +1 -0
- package/dist/icons/IconWindsurf.d.ts +8 -0
- package/dist/icons/IconWindsurf.js +31 -0
- package/dist/icons/IconWindsurf.js.map +1 -0
- package/dist/icons/index.d.ts +8 -0
- package/dist/main.js +11 -3
- package/dist/svgs/16x16/icon-copilot-16.js +25 -0
- package/dist/svgs/16x16/icon-copilot-16.js.map +1 -0
- package/dist/svgs/16x16/icon-cursor-16.js +23 -0
- package/dist/svgs/16x16/icon-cursor-16.js.map +1 -0
- package/dist/svgs/16x16/icon-kiro-color-16.js +31 -0
- package/dist/svgs/16x16/icon-kiro-color-16.js.map +1 -0
- package/dist/svgs/16x16/icon-mcp-16.js +21 -0
- package/dist/svgs/16x16/icon-mcp-16.js.map +1 -0
- package/dist/svgs/16x16/icon-more-horizontal-16.js +1 -1
- package/dist/svgs/16x16/icon-more-horizontal-16.js.map +1 -1
- package/dist/svgs/16x16/icon-more-vertical-16.js +1 -1
- package/dist/svgs/16x16/icon-more-vertical-16.js.map +1 -1
- package/dist/svgs/16x16/icon-tab-plus-16.js +21 -0
- package/dist/svgs/16x16/icon-tab-plus-16.js.map +1 -0
- package/dist/svgs/16x16/icon-terminal-filled-16.js +25 -0
- package/dist/svgs/16x16/icon-terminal-filled-16.js.map +1 -0
- package/dist/svgs/16x16/icon-vs-code-16.js +23 -0
- package/dist/svgs/16x16/icon-vs-code-16.js.map +1 -0
- package/dist/svgs/16x16/icon-windsurf-16.js +21 -0
- package/dist/svgs/16x16/icon-windsurf-16.js.map +1 -0
- package/dist/svgs/24x24/icon-copilot-24.js +25 -0
- package/dist/svgs/24x24/icon-copilot-24.js.map +1 -0
- package/dist/svgs/24x24/icon-cursor-24.js +23 -0
- package/dist/svgs/24x24/icon-cursor-24.js.map +1 -0
- package/dist/svgs/24x24/icon-kiro-color-24.js +31 -0
- package/dist/svgs/24x24/icon-kiro-color-24.js.map +1 -0
- package/dist/svgs/24x24/icon-mcp-24.js +21 -0
- package/dist/svgs/24x24/icon-mcp-24.js.map +1 -0
- package/dist/svgs/24x24/icon-more-horizontal-24.js +1 -1
- package/dist/svgs/24x24/icon-more-horizontal-24.js.map +1 -1
- package/dist/svgs/24x24/icon-more-vertical-24.js +1 -1
- package/dist/svgs/24x24/icon-more-vertical-24.js.map +1 -1
- package/dist/svgs/24x24/icon-tab-plus-24.js +21 -0
- package/dist/svgs/24x24/icon-tab-plus-24.js.map +1 -0
- package/dist/svgs/24x24/icon-terminal-filled-24.js +25 -0
- package/dist/svgs/24x24/icon-terminal-filled-24.js.map +1 -0
- package/dist/svgs/24x24/icon-vs-code-24.js +23 -0
- package/dist/svgs/24x24/icon-vs-code-24.js.map +1 -0
- package/dist/svgs/24x24/icon-windsurf-24.js +21 -0
- package/dist/svgs/24x24/icon-windsurf-24.js.map +1 -0
- 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,
|