@bitrise/bitkit-v2 0.3.266 → 0.3.267-beta.1792

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.
Files changed (57) hide show
  1. package/AGENTS.md +15 -2
  2. package/dist/components/BitkitDialog/BitkitDialog.d.ts +3 -16
  3. package/dist/components/BitkitDialog/BitkitDialog.js +23 -46
  4. package/dist/components/BitkitDialog/BitkitDialog.js.map +1 -1
  5. package/dist/components/BitkitDialog/BitkitFormDialog.d.ts +9 -0
  6. package/dist/components/BitkitDialog/BitkitFormDialog.js +53 -0
  7. package/dist/components/BitkitDialog/BitkitFormDialog.js.map +1 -0
  8. package/dist/components/BitkitDialog/BitkitStepperDialog.d.ts +46 -0
  9. package/dist/components/BitkitDialog/BitkitStepperDialog.js +91 -0
  10. package/dist/components/BitkitDialog/BitkitStepperDialog.js.map +1 -0
  11. package/dist/components/BitkitDialog/BitkitStepperDialogStep.d.ts +20 -0
  12. package/dist/components/BitkitDialog/{BitkitDialogStep.js → BitkitStepperDialogStep.js} +9 -9
  13. package/dist/components/BitkitDialog/BitkitStepperDialogStep.js.map +1 -0
  14. package/dist/components/BitkitDialog/DialogBodyContext.d.ts +12 -0
  15. package/dist/components/BitkitDialog/{BitkitDialogBody.js → DialogBodyContext.js} +11 -12
  16. package/dist/components/BitkitDialog/DialogBodyContext.js.map +1 -0
  17. package/dist/components/BitkitDialog/DialogInner.d.ts +25 -0
  18. package/dist/components/BitkitDialog/DialogInner.js +66 -0
  19. package/dist/components/BitkitDialog/DialogInner.js.map +1 -0
  20. package/dist/components/BitkitDialog/DialogShell.d.ts +24 -0
  21. package/dist/components/BitkitDialog/DialogShell.js +32 -0
  22. package/dist/components/BitkitDialog/DialogShell.js.map +1 -0
  23. package/dist/components/BitkitDialog/StepperContext.d.ts +16 -0
  24. package/dist/components/BitkitDialog/StepperContext.js +11 -0
  25. package/dist/components/BitkitDialog/StepperContext.js.map +1 -0
  26. package/dist/components/BitkitOverflowContent/BitkitOverflowContent.js +1 -2
  27. package/dist/components/BitkitOverflowContent/BitkitOverflowContent.js.map +1 -1
  28. package/dist/components/index.d.ts +3 -7
  29. package/dist/main.js +5 -9
  30. package/dist/theme/slot-recipes/Dialog.recipe.d.ts +16 -2
  31. package/dist/theme/slot-recipes/Dialog.recipe.js +13 -1
  32. package/dist/theme/slot-recipes/Dialog.recipe.js.map +1 -1
  33. package/dist/theme/slot-recipes/MarkdownCard.recipe.d.ts +1 -1
  34. package/dist/theme/slot-recipes/index.d.ts +17 -3
  35. package/package.json +1 -1
  36. package/dist/components/BitkitDialog/BitkitDialogBody.d.ts +0 -9
  37. package/dist/components/BitkitDialog/BitkitDialogBody.js.map +0 -1
  38. package/dist/components/BitkitDialog/BitkitDialogButtons.d.ts +0 -4
  39. package/dist/components/BitkitDialog/BitkitDialogButtons.js +0 -17
  40. package/dist/components/BitkitDialog/BitkitDialogButtons.js.map +0 -1
  41. package/dist/components/BitkitDialog/BitkitDialogContent.d.ts +0 -27
  42. package/dist/components/BitkitDialog/BitkitDialogContent.js +0 -57
  43. package/dist/components/BitkitDialog/BitkitDialogContent.js.map +0 -1
  44. package/dist/components/BitkitDialog/BitkitDialogFormContent.d.ts +0 -6
  45. package/dist/components/BitkitDialog/BitkitDialogFormContent.js +0 -30
  46. package/dist/components/BitkitDialog/BitkitDialogFormContent.js.map +0 -1
  47. package/dist/components/BitkitDialog/BitkitDialogHeader.d.ts +0 -9
  48. package/dist/components/BitkitDialog/BitkitDialogHeader.js +0 -8
  49. package/dist/components/BitkitDialog/BitkitDialogHeader.js.map +0 -1
  50. package/dist/components/BitkitDialog/BitkitDialogRoot.d.ts +0 -6
  51. package/dist/components/BitkitDialog/BitkitDialogRoot.js +0 -12
  52. package/dist/components/BitkitDialog/BitkitDialogRoot.js.map +0 -1
  53. package/dist/components/BitkitDialog/BitkitDialogStep.d.ts +0 -11
  54. package/dist/components/BitkitDialog/BitkitDialogStep.js.map +0 -1
  55. package/dist/components/BitkitDialog/BitkitDialogStepContext.d.ts +0 -5
  56. package/dist/components/BitkitDialog/BitkitDialogStepContext.js +0 -7
  57. package/dist/components/BitkitDialog/BitkitDialogStepContext.js.map +0 -1
package/AGENTS.md CHANGED
@@ -113,7 +113,20 @@ Bitkit components use consistent prop names across the library:
113
113
  <BitkitActionMenu.Item href="https://example.com" isExternal value="docs">Open docs</BitkitActionMenu.Item>
114
114
  ```
115
115
  - **Form components are flat** — `BitkitTextInput`, `BitkitSelect`, `BitkitCombobox`, etc. expose `label`, `errorText`, `helperText`, etc. directly as props. No need to wrap in a separate field component.
116
- - **`BitkitDialog` non-dismissible + post-close callback** — pass `closable={false}` to make the dialog fully non-dismissible: the close button is rendered but disabled (kept for layout consistency), ESC is blocked, and outside clicks are ignored. The only way out is an explicit footer action. Pass `onExitComplete` to run code after the close animation finishes (navigation, focus restoration, cleanup):
116
+ - **Three dialog components, one shell** — pick by intent, never reach for low-level dialog primitives (there are none exported):
117
+ - `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.
118
+ - `BitkitFormDialog` — same API as `BitkitDialog`, but the whole content is a `<form>`, so a `type="submit"` button in `footerButtons` submits natively. Accepts form props (`onSubmit`, `method`, …).
119
+ - `BitkitStepperDialog` — a multi-step dialog. Pass `BitkitStepperDialog.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; wire footer navigation via the `useStepperDialog()` hook (`{ step, setStep, next, prev, goTo, isFirst, isLast, totalSteps }`) from a component rendered in the footer slot. Controlled via `step`/`onStepChange`, or uncontrolled via `defaultStep`.
120
+ ```tsx
121
+ <BitkitDialog footerButtons={<><Button variant="secondary">Cancel</Button><Button variant="primary">Save</Button></>} open={open} onOpenChange={…} title="Title">Body</BitkitDialog>
122
+ <BitkitFormDialog onSubmit={handleSubmit} open={open} onOpenChange={…} title="Edit" footerButtons={<Button type="submit">Save</Button>}>…fields…</BitkitFormDialog>
123
+ <BitkitStepperDialog footerContent={<StepperNav />} title="Wizard" trigger={<Button>Open</Button>}>
124
+ <BitkitStepperDialog.Step label="Account" title="Create account">…</BitkitStepperDialog.Step>
125
+ <BitkitStepperDialog.Step label="Confirm" title="Confirm">…</BitkitStepperDialog.Step>
126
+ </BitkitStepperDialog>
127
+ ```
128
+ For closing on click, use controlled `open`/`onOpenChange`, or wrap a button in Chakra's `Dialog.ActionTrigger`. For a fully custom dialog, compose raw Chakra `Dialog.*` atoms directly.
129
+ - **Dialog non-dismissible + post-close callback** — works on all three: pass `closable={false}` to make the dialog fully non-dismissible (the close button is rendered but disabled, ESC is blocked, outside clicks are ignored — the only way out is an explicit footer action). Pass `onExitComplete` to run code after the close animation finishes (navigation, focus restoration, cleanup):
117
130
  ```tsx
118
131
  <BitkitDialog closable={false} open={open} onOpenChange={…} title="Action required">…</BitkitDialog>
119
132
  <BitkitDialog open={open} onExitComplete={() => navigate('/next')} onOpenChange={…} title="…">…</BitkitDialog>
@@ -145,7 +158,7 @@ Bitkit components use consistent prop names across the library:
145
158
  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.
146
159
 
147
160
  **Exceptions** — a few component groups intentionally own their own layout and don't accept arbitrary style props from outside:
148
- - Page-level overlays: `BitkitDialog`, `BitkitDrawer`, `BitkitCalendar` — use the component's own sizing API (`size`, `maxHeight`, etc.).
161
+ - Page-level overlays: `BitkitDialog`, `BitkitFormDialog`, `BitkitStepperDialog`, `BitkitDrawer`, `BitkitCalendar` — use the component's own sizing API (`size`, `maxHeight`, etc.).
149
162
  - Floating positioned components: `BitkitTooltip`, `BitkitLabelTooltip`, `BitkitDefinitionTooltip`, `BitkitOverflowTooltip`, `BitkitToast`, `BitkitSelectMenu`, `BitkitMultiselectMenu` — their layout is positioned automatically; pass styling via the component's own props instead of a wrapper.
150
163
 
151
164
  > **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.
@@ -1,9 +1,10 @@
1
1
  import { Dialog } from '@chakra-ui/react/dialog';
2
2
  import { ReactNode } from 'react';
3
- import { BitkitDialogHeaderProps } from './BitkitDialogHeader';
4
3
  export interface BitkitDialogProps {
5
4
  children?: ReactNode;
6
5
  closable?: boolean;
6
+ footerButtons?: ReactNode;
7
+ footerContent?: ReactNode;
7
8
  headerLabel?: string;
8
9
  maxHeight?: string;
9
10
  onExitComplete?: () => void;
@@ -15,28 +16,14 @@ export interface BitkitDialogProps {
15
16
  scrollBehavior?: 'inside' | 'outside';
16
17
  showScrollGradient?: boolean;
17
18
  size?: 'sm' | 'md' | 'lg' | 'full';
18
- step?: number;
19
19
  title: ReactNode;
20
20
  trigger?: ReactNode;
21
21
  variant?: 'overflowContent';
22
22
  }
23
23
  declare const _default: {
24
- ({ children, closable, headerLabel, maxHeight, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior: scrollBehaviorProp, showScrollGradient, size, step, title, trigger, variant, }: BitkitDialogProps): import("react").JSX.Element;
24
+ ({ children, closable, footerButtons, footerContent, headerLabel, maxHeight, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior, showScrollGradient, size, title, trigger, variant, }: BitkitDialogProps): import("react").JSX.Element;
25
25
  displayName: string;
26
26
  } & {
27
27
  ActionTrigger: import('react').ForwardRefExoticComponent<Dialog.ActionTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
28
- Body: ({ children, ...rest }: import('./BitkitDialogBody').BitkitDialogBodyProps) => import("react").JSX.Element;
29
- Buttons: import('react').ForwardRefExoticComponent<import('@chakra-ui/react').BoxProps & import('react').RefAttributes<HTMLDivElement>>;
30
- Content: ({ maxHeight, ...inner }: import('./BitkitDialogContent').BitkitDialogContentProps) => import("react").JSX.Element;
31
- Footer: import('react').ForwardRefExoticComponent<Dialog.FooterProps & import('react').RefAttributes<HTMLDivElement>>;
32
- FormContent: import('react').ForwardRefExoticComponent<import('./BitkitDialogFormContent').BitkitDialogFormContentProps & import('react').RefAttributes<HTMLFormElement>>;
33
- Header: {
34
- ({ children }: BitkitDialogHeaderProps): import("react").JSX.Element;
35
- displayName: string;
36
- };
37
- Step: {
38
- (props: import('./BitkitDialogStep').BitkitDialogStepProps): import("react").JSX.Element | null;
39
- displayName: string;
40
- };
41
28
  };
42
29
  export default _default;
@@ -1,59 +1,36 @@
1
1
  import { withSubComponents } from "../../utilities/withSubComponents.js";
2
- import BitkitDialogStep from "./BitkitDialogStep.js";
3
- import BitkitDialogBody from "./BitkitDialogBody.js";
4
- import BitkitDialogButtons from "./BitkitDialogButtons.js";
5
- import BitkitDialogContent from "./BitkitDialogContent.js";
6
- import BitkitDialogFormContent from "./BitkitDialogFormContent.js";
7
- import BitkitDialogHeader from "./BitkitDialogHeader.js";
8
- import BitkitDialogRoot from "./BitkitDialogRoot.js";
9
- import { Children, isValidElement } from "react";
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
- import { Portal } from "@chakra-ui/react/portal";
2
+ import DialogInner from "./DialogInner.js";
3
+ import DialogShell from "./DialogShell.js";
4
+ import { jsx } from "react/jsx-runtime";
12
5
  import { Dialog } from "@chakra-ui/react/dialog";
13
6
  //#region lib/components/BitkitDialog/BitkitDialog.tsx
14
- var BitkitDialog = ({ children, closable = true, headerLabel, maxHeight, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior: scrollBehaviorProp, showScrollGradient, size, step = 0, title, trigger, variant }) => {
15
- const scrollBehavior = variant === "overflowContent" ? "inside" : scrollBehaviorProp;
16
- const childrenArray = Children.toArray(children);
17
- const headerChild = childrenArray.find((child) => isValidElement(child) && child.type === BitkitDialogHeader);
18
- const bodyChildren = childrenArray.filter((child) => !(isValidElement(child) && child.type === BitkitDialogHeader));
19
- const stepHeader = isValidElement(headerChild) ? headerChild.props.children : void 0;
20
- return /* @__PURE__ */ jsxs(BitkitDialogRoot, {
21
- closeOnEscape: closable,
22
- onExitComplete,
23
- onOpenChange,
24
- open,
25
- preventScroll,
26
- scrollBehavior,
27
- size,
28
- variant,
29
- children: [trigger && /* @__PURE__ */ jsx(Dialog.Trigger, {
30
- asChild: true,
31
- children: trigger
32
- }), /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {}), /* @__PURE__ */ jsx(Dialog.Positioner, { children: /* @__PURE__ */ jsx(BitkitDialogContent, {
7
+ var BitkitDialog = ({ children, closable = true, footerButtons, footerContent, headerLabel, maxHeight, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior, showScrollGradient, size, title, trigger, variant }) => /* @__PURE__ */ jsx(DialogShell, {
8
+ closable,
9
+ onExitComplete,
10
+ onOpenChange,
11
+ open,
12
+ preventScroll,
13
+ scrollBehavior,
14
+ size,
15
+ trigger,
16
+ variant,
17
+ children: /* @__PURE__ */ jsx(Dialog.Content, {
18
+ maxHeight,
19
+ children: /* @__PURE__ */ jsx(DialogInner, {
33
20
  closable,
21
+ footerButtons,
22
+ footerContent,
34
23
  headerLabel,
35
- maxHeight,
36
24
  scrollBehavior,
37
25
  showScrollGradient,
38
- step,
39
- stepHeader,
40
26
  title,
41
27
  variant,
42
- children: bodyChildren
43
- }) })] })]
44
- });
45
- };
46
- BitkitDialog.displayName = "BitkitDialog";
47
- var BitkitDialog_default = withSubComponents(BitkitDialog, {
48
- ActionTrigger: Dialog.ActionTrigger,
49
- Body: BitkitDialogBody,
50
- Buttons: BitkitDialogButtons,
51
- Content: BitkitDialogContent,
52
- Footer: Dialog.Footer,
53
- FormContent: BitkitDialogFormContent,
54
- Header: BitkitDialogHeader,
55
- Step: BitkitDialogStep
28
+ children
29
+ })
30
+ })
56
31
  });
32
+ BitkitDialog.displayName = "BitkitDialog";
33
+ var BitkitDialog_default = withSubComponents(BitkitDialog, { ActionTrigger: Dialog.ActionTrigger });
57
34
  //#endregion
58
35
  export { BitkitDialog_default as default };
59
36
 
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitDialog.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Children, isValidElement, type ReactNode } from 'react';\n\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitDialogBody from './BitkitDialogBody';\nimport BitkitDialogButtons from './BitkitDialogButtons';\nimport BitkitDialogContent from './BitkitDialogContent';\nimport BitkitDialogFormContent from './BitkitDialogFormContent';\nimport BitkitDialogHeader, { type BitkitDialogHeaderProps } from './BitkitDialogHeader';\nimport BitkitDialogRoot from './BitkitDialogRoot';\nimport BitkitDialogStep from './BitkitDialogStep';\n\nexport interface BitkitDialogProps {\n children?: ReactNode;\n closable?: boolean;\n headerLabel?: string;\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 step?: number;\n title: ReactNode;\n trigger?: ReactNode;\n variant?: 'overflowContent';\n}\n\nconst BitkitDialog = ({\n children,\n closable = true,\n headerLabel,\n maxHeight,\n onExitComplete,\n onOpenChange,\n open,\n preventScroll,\n scrollBehavior: scrollBehaviorProp,\n showScrollGradient,\n size,\n step = 0,\n title,\n trigger,\n variant,\n}: BitkitDialogProps) => {\n const scrollBehavior = variant === 'overflowContent' ? 'inside' : scrollBehaviorProp;\n\n const childrenArray = Children.toArray(children);\n const headerChild = childrenArray.find((child) => isValidElement(child) && child.type === BitkitDialogHeader);\n const bodyChildren = childrenArray.filter((child) => !(isValidElement(child) && child.type === BitkitDialogHeader));\n const stepHeader = isValidElement(headerChild) ? (headerChild.props as BitkitDialogHeaderProps).children : undefined;\n\n return (\n <BitkitDialogRoot\n closeOnEscape={closable}\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>\n <BitkitDialogContent\n closable={closable}\n headerLabel={headerLabel}\n maxHeight={maxHeight}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\n step={step}\n stepHeader={stepHeader}\n title={title}\n variant={variant}\n >\n {bodyChildren}\n </BitkitDialogContent>\n </Dialog.Positioner>\n </Portal>\n </BitkitDialogRoot>\n );\n};\n\nBitkitDialog.displayName = 'BitkitDialog';\n\nexport default withSubComponents(BitkitDialog, {\n ActionTrigger: Dialog.ActionTrigger,\n Body: BitkitDialogBody,\n Buttons: BitkitDialogButtons,\n Content: BitkitDialogContent,\n Footer: Dialog.Footer,\n FormContent: BitkitDialogFormContent,\n Header: BitkitDialogHeader,\n Step: BitkitDialogStep,\n});\n"],"mappings":";;;;;;;;;;;;;AA+BA,IAAM,gBAAgB,EACpB,UACA,WAAW,MACX,aACA,WACA,gBACA,cACA,MACA,eACA,gBAAgB,oBAChB,oBACA,MACA,OAAO,GACP,OACA,SACA,cACuB;CACvB,MAAM,iBAAiB,YAAY,oBAAoB,WAAW;CAElE,MAAM,gBAAgB,SAAS,QAAQ,QAAQ;CAC/C,MAAM,cAAc,cAAc,MAAM,UAAU,eAAe,KAAK,KAAK,MAAM,SAAS,kBAAkB;CAC5G,MAAM,eAAe,cAAc,QAAQ,UAAU,EAAE,eAAe,KAAK,KAAK,MAAM,SAAS,mBAAmB;CAClH,MAAM,aAAa,eAAe,WAAW,IAAK,YAAY,MAAkC,WAAW,KAAA;CAE3G,OACE,qBAAC,kBAAD;EACE,eAAe;EACC;EACF;EACR;EACS;EACC;EACV;EACG;YARX,CAUG,WAAW,oBAAC,OAAO,SAAR;GAAgB,SAAA;aAAS;EAAwB,CAAA,GAC7D,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,OAAO,UAAR,CAAkB,CAAA,GAClB,oBAAC,OAAO,YAAR,EAAA,UACE,oBAAC,qBAAD;GACY;GACG;GACF;GACK;GACI;GACd;GACM;GACL;GACE;aAER;EACkB,CAAA,EACJ,CAAA,CACb,EAAA,CAAA,CACQ;;AAEtB;AAEA,aAAa,cAAc;AAE3B,IAAA,uBAAe,kBAAkB,cAAc;CAC7C,eAAe,OAAO;CACtB,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ,OAAO;CACf,aAAa;CACb,QAAQ;CACR,MAAM;AACR,CAAC"}
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 { withSubComponents } from '../../utilities/withSubComponents';\nimport DialogInner from './DialogInner';\nimport DialogShell from './DialogShell';\n\nexport interface BitkitDialogProps {\n children?: ReactNode;\n closable?: boolean;\n footerButtons?: ReactNode;\n footerContent?: ReactNode;\n headerLabel?: string;\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 title: ReactNode;\n trigger?: ReactNode;\n variant?: 'overflowContent';\n}\n\nconst BitkitDialog = ({\n children,\n closable = true,\n footerButtons,\n footerContent,\n headerLabel,\n maxHeight,\n onExitComplete,\n onOpenChange,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n title,\n trigger,\n variant,\n}: BitkitDialogProps) => (\n <DialogShell\n closable={closable}\n onExitComplete={onExitComplete}\n onOpenChange={onOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content maxHeight={maxHeight}>\n <DialogInner\n closable={closable}\n footerButtons={footerButtons}\n footerContent={footerContent}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\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":";;;;;;AA0BA,IAAM,gBAAgB,EACpB,UACA,WAAW,MACX,eACA,eACA,aACA,WACA,gBACA,cACA,MACA,eACA,gBACA,oBACA,MACA,OACA,SACA,cAEA,oBAAC,aAAD;CACY;CACM;CACF;CACR;CACS;CACC;CACV;CACG;CACA;WAET,oBAAC,OAAO,SAAR;EAA2B;YACzB,oBAAC,aAAD;GACY;GACK;GACA;GACF;GACG;GACI;GACb;GACE;GAER;EACU,CAAA;CACC,CAAA;AACL,CAAA;AAGf,aAAa,cAAc;AAE3B,IAAA,uBAAe,kBAAkB,cAAc,EAAE,eAAe,OAAO,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Dialog } from '@chakra-ui/react/dialog';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ import { BitkitDialogProps } from './BitkitDialog';
4
+ export interface BitkitFormDialogProps extends BitkitDialogProps, Omit<ComponentPropsWithoutRef<'form'>, keyof BitkitDialogProps> {
5
+ }
6
+ declare const _default: import('react').ForwardRefExoticComponent<BitkitFormDialogProps & import('react').RefAttributes<HTMLFormElement>> & {
7
+ ActionTrigger: import('react').ForwardRefExoticComponent<Dialog.ActionTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
8
+ };
9
+ export default _default;
@@ -0,0 +1,53 @@
1
+ import { withSubComponents } from "../../utilities/withSubComponents.js";
2
+ import DialogInner from "./DialogInner.js";
3
+ import DialogShell from "./DialogShell.js";
4
+ import { chakra } from "@chakra-ui/react/styled-system";
5
+ import { forwardRef } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { Dialog } from "@chakra-ui/react/dialog";
8
+ //#region lib/components/BitkitDialog/BitkitFormDialog.tsx
9
+ /**
10
+ * A dialog whose entire content is a `<form>`, so a `type="submit"` button in the footer submits
11
+ * natively. Exposes native form attributes (`onSubmit`, `method`, `noValidate`, …) alongside the
12
+ * standard dialog props. Like the other dialog overlays it owns its own layout — it intentionally
13
+ * does NOT accept Chakra style props (`width`, `padding`, …), which would override the `size` variant.
14
+ */
15
+ var BitkitFormDialog = forwardRef((props, ref) => {
16
+ const { children, closable = true, footerButtons, footerContent, headerLabel, maxHeight, onExitComplete, onOpenChange, open, preventScroll, scrollBehavior, showScrollGradient, size, title, trigger, variant, ...formProps } = props;
17
+ return /* @__PURE__ */ jsx(DialogShell, {
18
+ closable,
19
+ onExitComplete,
20
+ onOpenChange,
21
+ open,
22
+ preventScroll,
23
+ scrollBehavior,
24
+ size,
25
+ trigger,
26
+ variant,
27
+ children: /* @__PURE__ */ jsx(Dialog.Content, {
28
+ asChild: true,
29
+ maxHeight,
30
+ children: /* @__PURE__ */ jsx(chakra.form, {
31
+ ref,
32
+ ...formProps,
33
+ children: /* @__PURE__ */ jsx(DialogInner, {
34
+ closable,
35
+ footerButtons,
36
+ footerContent,
37
+ headerLabel,
38
+ scrollBehavior,
39
+ showScrollGradient,
40
+ title,
41
+ variant,
42
+ children
43
+ })
44
+ })
45
+ })
46
+ });
47
+ });
48
+ BitkitFormDialog.displayName = "BitkitFormDialog";
49
+ var BitkitFormDialog_default = withSubComponents(BitkitFormDialog, { ActionTrigger: Dialog.ActionTrigger });
50
+ //#endregion
51
+ export { BitkitFormDialog_default as default };
52
+
53
+ //# sourceMappingURL=BitkitFormDialog.js.map
@@ -0,0 +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 ComponentPropsWithoutRef, forwardRef } from 'react';\n\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport { type BitkitDialogProps } from './BitkitDialog';\nimport DialogInner from './DialogInner';\nimport DialogShell from './DialogShell';\n\nexport interface BitkitFormDialogProps\n extends BitkitDialogProps, Omit<ComponentPropsWithoutRef<'form'>, keyof BitkitDialogProps> {}\n\n/**\n * A dialog whose entire content is a `<form>`, so a `type=\"submit\"` button in the footer submits\n * natively. Exposes native form attributes (`onSubmit`, `method`, `noValidate`, …) alongside the\n * standard dialog props. Like the other dialog overlays it owns its own layout — it intentionally\n * does NOT accept Chakra style props (`width`, `padding`, …), which would override the `size` variant.\n */\nconst BitkitFormDialog = forwardRef<HTMLFormElement, BitkitFormDialogProps>((props, ref) => {\n const {\n children,\n closable = true,\n footerButtons,\n footerContent,\n headerLabel,\n maxHeight,\n onExitComplete,\n onOpenChange,\n open,\n preventScroll,\n scrollBehavior,\n showScrollGradient,\n size,\n title,\n trigger,\n variant,\n ...formProps\n } = props;\n\n return (\n <DialogShell\n closable={closable}\n onExitComplete={onExitComplete}\n onOpenChange={onOpenChange}\n open={open}\n preventScroll={preventScroll}\n scrollBehavior={scrollBehavior}\n size={size}\n trigger={trigger}\n variant={variant}\n >\n <Dialog.Content asChild maxHeight={maxHeight}>\n <chakra.form ref={ref} {...formProps}>\n <DialogInner\n closable={closable}\n footerButtons={footerButtons}\n footerContent={footerContent}\n headerLabel={headerLabel}\n scrollBehavior={scrollBehavior}\n showScrollGradient={showScrollGradient}\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":";;;;;;;;;;;;;;AAkBA,IAAM,mBAAmB,YAAoD,OAAO,QAAQ;CAC1F,MAAM,EACJ,UACA,WAAW,MACX,eACA,eACA,aACA,WACA,gBACA,cACA,MACA,eACA,gBACA,oBACA,MACA,OACA,SACA,SACA,GAAG,cACD;CAEJ,OACE,oBAAC,aAAD;EACY;EACM;EACF;EACR;EACS;EACC;EACV;EACG;EACA;YAET,oBAAC,OAAO,SAAR;GAAgB,SAAA;GAAmB;aACjC,oBAAC,OAAO,MAAR;IAAkB;IAAK,GAAI;cACzB,oBAAC,aAAD;KACY;KACK;KACA;KACF;KACG;KACI;KACb;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"}
@@ -0,0 +1,46 @@
1
+ import { Dialog } from '@chakra-ui/react/dialog';
2
+ import { ReactNode } from 'react';
3
+ import { BitkitStepperDialogStepProps } from './BitkitStepperDialogStep';
4
+ export { useStepperDialog } from './StepperContext';
5
+ export interface BitkitStepperDialogProps {
6
+ /** `BitkitStepperDialog.Step` children, one per step. */
7
+ children: ReactNode;
8
+ closable?: boolean;
9
+ /** Initial step when uncontrolled. Resets to this when the dialog closes. */
10
+ defaultStep?: number;
11
+ /**
12
+ * Footer content rendered raw. Stepper footers are space-between (Cancel left, Prev/Next right),
13
+ * so build the nav row here with `useStepperDialog()` — there is no `footerButtons` slot, which
14
+ * would force right-alignment.
15
+ */
16
+ footerContent?: ReactNode;
17
+ headerLabel?: string;
18
+ maxHeight?: string;
19
+ onExitComplete?: () => void;
20
+ onOpenChange?: (details: {
21
+ open: boolean;
22
+ }) => void;
23
+ /** Called whenever the active step changes (controlled or uncontrolled). */
24
+ onStepChange?: (step: number) => void;
25
+ open?: boolean;
26
+ preventScroll?: boolean;
27
+ scrollBehavior?: 'inside' | 'outside';
28
+ showScrollGradient?: boolean;
29
+ size?: 'sm' | 'md' | 'lg' | 'full';
30
+ /** Controlled active step. Omit for uncontrolled (see `defaultStep`). */
31
+ step?: number;
32
+ title: ReactNode;
33
+ trigger?: ReactNode;
34
+ variant?: 'overflowContent';
35
+ }
36
+ declare const _default: {
37
+ ({ children, closable, defaultStep, footerContent, headerLabel, maxHeight, onExitComplete, onOpenChange, onStepChange, open, preventScroll, scrollBehavior, showScrollGradient, size, step: stepProp, title, trigger, variant, }: BitkitStepperDialogProps): import("react").JSX.Element;
38
+ displayName: string;
39
+ } & {
40
+ ActionTrigger: import('react').ForwardRefExoticComponent<Dialog.ActionTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
41
+ Step: {
42
+ ({ children, description, title }: BitkitStepperDialogStepProps): import("react").JSX.Element;
43
+ displayName: string;
44
+ };
45
+ };
46
+ export default _default;
@@ -0,0 +1,91 @@
1
+ import { withSubComponents } from "../../utilities/withSubComponents.js";
2
+ import DialogInner from "./DialogInner.js";
3
+ import DialogShell from "./DialogShell.js";
4
+ import BitkitSteps_default from "../BitkitSteps/BitkitSteps.js";
5
+ import BitkitStepperDialogStep from "./BitkitStepperDialogStep.js";
6
+ import { StepperDialogProvider } from "./StepperContext.js";
7
+ import { Children, isValidElement, useCallback, useMemo, useState } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import { Dialog } from "@chakra-ui/react/dialog";
10
+ //#region lib/components/BitkitDialog/BitkitStepperDialog.tsx
11
+ /**
12
+ * A dialog that walks through a sequence of `BitkitStepperDialog.Step` children. It owns the step
13
+ * state, auto-renders the steps header, and shows only the active step's body. Footer navigation is
14
+ * wired by the consumer through the `useStepperDialog()` hook.
15
+ */
16
+ var BitkitStepperDialog = ({ children, closable = true, defaultStep = 0, footerContent, headerLabel, maxHeight, onExitComplete, onOpenChange, onStepChange, open, preventScroll, scrollBehavior, showScrollGradient, size, step: stepProp, title, trigger, variant }) => {
17
+ const [internalStep, setInternalStep] = useState(defaultStep);
18
+ const isControlled = stepProp !== void 0;
19
+ const rawStep = (isControlled ? stepProp : internalStep) ?? 0;
20
+ const steps = Children.toArray(children).filter((child) => isValidElement(child) && child.type === BitkitStepperDialogStep);
21
+ const totalSteps = steps.length;
22
+ const step = Math.max(0, Math.min(rawStep, Math.max(0, totalSteps - 1)));
23
+ const setStep = useCallback((next) => {
24
+ const clamped = Math.max(0, Math.min(next, totalSteps - 1));
25
+ if (!isControlled) setInternalStep(clamped);
26
+ onStepChange?.(clamped);
27
+ }, [
28
+ isControlled,
29
+ onStepChange,
30
+ totalSteps
31
+ ]);
32
+ const ctx = useMemo(() => ({
33
+ goTo: setStep,
34
+ isFirst: step === 0,
35
+ isLast: step === totalSteps - 1,
36
+ next: () => setStep(step + 1),
37
+ prev: () => setStep(step - 1),
38
+ setStep,
39
+ step,
40
+ totalSteps
41
+ }), [
42
+ setStep,
43
+ step,
44
+ totalSteps
45
+ ]);
46
+ const handleOpenChange = (details) => {
47
+ if (!details.open && !isControlled) setInternalStep(defaultStep);
48
+ onOpenChange?.(details);
49
+ };
50
+ const stepsHeader = /* @__PURE__ */ jsx(BitkitSteps_default, {
51
+ step,
52
+ children: steps.map((child, index) => /* @__PURE__ */ jsx(BitkitSteps_default.Item, { label: child.props.label }, index))
53
+ });
54
+ return /* @__PURE__ */ jsx(StepperDialogProvider, {
55
+ value: ctx,
56
+ children: /* @__PURE__ */ jsx(DialogShell, {
57
+ closable,
58
+ onExitComplete,
59
+ onOpenChange: handleOpenChange,
60
+ open,
61
+ preventScroll,
62
+ scrollBehavior,
63
+ size,
64
+ trigger,
65
+ variant,
66
+ children: /* @__PURE__ */ jsx(Dialog.Content, {
67
+ maxHeight,
68
+ children: /* @__PURE__ */ jsx(DialogInner, {
69
+ closable,
70
+ footerContent,
71
+ headerExtra: stepsHeader,
72
+ headerLabel,
73
+ scrollBehavior,
74
+ showScrollGradient,
75
+ title,
76
+ variant,
77
+ children: steps[step]
78
+ })
79
+ })
80
+ })
81
+ });
82
+ };
83
+ BitkitStepperDialog.displayName = "BitkitStepperDialog";
84
+ var BitkitStepperDialog_default = withSubComponents(BitkitStepperDialog, {
85
+ ActionTrigger: Dialog.ActionTrigger,
86
+ Step: BitkitStepperDialogStep
87
+ });
88
+ //#endregion
89
+ export { BitkitStepperDialog_default as default };
90
+
91
+ //# sourceMappingURL=BitkitStepperDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitkitStepperDialog.js","names":[],"sources":["../../../lib/components/BitkitDialog/BitkitStepperDialog.tsx"],"sourcesContent":["import { Dialog } from '@chakra-ui/react/dialog';\nimport { Children, isValidElement, type ReactElement, type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport { withSubComponents } from '../../utilities/withSubComponents';\nimport BitkitSteps from '../BitkitSteps/BitkitSteps';\nimport BitkitStepperDialogStep, { type BitkitStepperDialogStepProps } from './BitkitStepperDialogStep';\nimport DialogInner from './DialogInner';\nimport DialogShell from './DialogShell';\nimport { StepperDialogProvider } from './StepperContext';\n\nexport { useStepperDialog } from './StepperContext';\n\nexport interface 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 /**\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}\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 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}: BitkitStepperDialogProps) => {\n const [internalStep, setInternalStep] = useState(defaultStep);\n const isControlled = stepProp !== undefined;\n const rawStep = (isControlled ? stepProp : internalStep) ?? 0;\n const steps = Children.toArray(children).filter(\n (child): child is ReactElement<BitkitStepperDialogStepProps> =>\n isValidElement(child) && 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 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}>\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":";;;;;;;;;;;;;;;AA+CA,IAAM,uBAAuB,EAC3B,UACA,WAAW,MACX,cAAc,GACd,eACA,aACA,WACA,gBACA,cACA,cACA,MACA,eACA,gBACA,oBACA,MACA,MAAM,UACN,OACA,SACA,cAC8B;CAC9B,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,eAAe,aAAa,KAAA;CAClC,MAAM,WAAW,eAAe,WAAW,iBAAiB;CAC5D,MAAM,QAAQ,SAAS,QAAQ,QAAQ,EAAE,QACtC,UACC,eAAe,KAAK,KAAK,MAAM,SAAS,uBAC5C;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;YAChB,MAAM,KAAK,OAAO,UACjB,oBAAC,oBAAY,MAAb,EAA8B,OAAO,MAAM,MAAM,MAAQ,GAAlC,KAAkC,CAC1D;CACU,CAAA;CAGf,OACE,oBAAC,uBAAD;EAAuB,OAAO;YAC5B,oBAAC,aAAD;GACY;GACM;GAChB,cAAc;GACR;GACS;GACC;GACV;GACG;GACA;aAET,oBAAC,OAAO,SAAR;IAA2B;cACzB,oBAAC,aAAD;KACY;KACK;KACf,aAAa;KACA;KACG;KACI;KACb;KACE;eAER,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"}
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ export interface BitkitStepperDialogStepProps {
3
+ /** Body content for this step. */
4
+ children?: ReactNode;
5
+ /** Optional subtitle shown under the step's body title. */
6
+ description?: string;
7
+ /** Short label shown in the steps header. */
8
+ label: string;
9
+ /** Heading shown at the top of the step's body. */
10
+ title: string;
11
+ }
12
+ /**
13
+ * A single step of a {@link BitkitStepperDialog}. Renders its `title`/`description` typography
14
+ * followed by `children`. The parent only mounts the active step, so this never self-gates.
15
+ */
16
+ declare const BitkitStepperDialogStep: {
17
+ ({ children, description, title }: BitkitStepperDialogStepProps): import("react").JSX.Element;
18
+ displayName: string;
19
+ };
20
+ export default BitkitStepperDialogStep;
@@ -1,13 +1,13 @@
1
- import { useBitkitDialogStepContext } from "./BitkitDialogStepContext.js";
2
1
  import { chakra } from "@chakra-ui/react/styled-system";
3
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
3
  import { useDialogStyles } from "@chakra-ui/react/dialog";
5
- //#region lib/components/BitkitDialog/BitkitDialogStep.tsx
6
- var BitkitDialogStep = (props) => {
7
- const { _index = 0, children, description, title } = props;
8
- const step = useBitkitDialogStepContext()?.step ?? 0;
4
+ //#region lib/components/BitkitDialog/BitkitStepperDialogStep.tsx
5
+ /**
6
+ * A single step of a {@link BitkitStepperDialog}. Renders its `title`/`description` typography
7
+ * followed by `children`. The parent only mounts the active step, so this never self-gates.
8
+ */
9
+ var BitkitStepperDialogStep = ({ children, description, title }) => {
9
10
  const styles = useDialogStyles();
10
- if (_index !== step) return null;
11
11
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(chakra.div, {
12
12
  css: styles.stepTitleGroup,
13
13
  children: [/* @__PURE__ */ jsx(chakra.p, {
@@ -19,8 +19,8 @@ var BitkitDialogStep = (props) => {
19
19
  })]
20
20
  }), children] });
21
21
  };
22
- BitkitDialogStep.displayName = "BitkitDialogStep";
22
+ BitkitStepperDialogStep.displayName = "BitkitStepperDialogStep";
23
23
  //#endregion
24
- export { BitkitDialogStep as default };
24
+ export { BitkitStepperDialogStep as default };
25
25
 
26
- //# sourceMappingURL=BitkitDialogStep.js.map
26
+ //# sourceMappingURL=BitkitStepperDialogStep.js.map
@@ -0,0 +1 @@
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;YAAxB,CACE,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;aAAY;EAAgB,CAAA,GACjD,eAAe,oBAAC,OAAO,GAAR;GAAU,KAAK,OAAO;aAAkB;EAAsB,CAAA,CACpE;KACX,QACD,EAAA,CAAA;AAEN;AAEA,wBAAwB,cAAc"}
@@ -0,0 +1,12 @@
1
+ import { Dialog } from '@chakra-ui/react/dialog';
2
+ interface DialogBodyContextValue {
3
+ scrollBehavior: 'inside' | 'outside';
4
+ showScrollGradient: boolean;
5
+ }
6
+ export declare const DialogBodyContext: import('react').Context<DialogBodyContextValue>;
7
+ /**
8
+ * Scroll-aware dialog body. Reads {@link DialogBodyContext} to decide whether the body scrolls
9
+ * internally (`inside` → scroll button + optional gradient) or the whole dialog scrolls (`outside`).
10
+ */
11
+ declare const DialogBody: ({ children, ...rest }: Dialog.BodyProps) => import("react").JSX.Element;
12
+ export default DialogBody;
@@ -1,11 +1,10 @@
1
1
  import IconArrowDown from "../../icons/IconArrowDown.js";
2
- import BitkitDialogStep from "./BitkitDialogStep.js";
3
2
  import { Box } from "@chakra-ui/react/box";
4
3
  import { chakra } from "@chakra-ui/react/styled-system";
5
- import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useRef, useState } from "react";
4
+ import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
6
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
6
  import { Dialog, useDialogContext, useDialogStyles } from "@chakra-ui/react/dialog";
8
- //#region lib/components/BitkitDialog/BitkitDialogBody.tsx
7
+ //#region lib/components/BitkitDialog/DialogBodyContext.tsx
9
8
  var DialogBodyContext = createContext({
10
9
  scrollBehavior: "outside",
11
10
  showScrollGradient: true
@@ -58,22 +57,22 @@ var ScrollableDialogBody = ({ children, ...props }) => {
58
57
  })] })]
59
58
  });
60
59
  };
61
- var BitkitDialogBody = ({ children, ...rest }) => {
60
+ /**
61
+ * Scroll-aware dialog body. Reads {@link DialogBodyContext} to decide whether the body scrolls
62
+ * internally (`inside` → scroll button + optional gradient) or the whole dialog scrolls (`outside`).
63
+ */
64
+ var DialogBody = ({ children, ...rest }) => {
62
65
  const { scrollBehavior } = useContext(DialogBodyContext);
63
- const mappedChildren = Children.map(children, (child, index) => {
64
- if (isValidElement(child) && child.type === BitkitDialogStep) return cloneElement(child, { _index: index });
65
- return child;
66
- });
67
66
  if (scrollBehavior === "inside") return /* @__PURE__ */ jsx(ScrollableDialogBody, {
68
67
  ...rest,
69
- children: mappedChildren
68
+ children
70
69
  });
71
70
  return /* @__PURE__ */ jsx(Dialog.Body, {
72
71
  ...rest,
73
- children: mappedChildren
72
+ children
74
73
  });
75
74
  };
76
75
  //#endregion
77
- export { DialogBodyContext, BitkitDialogBody as default };
76
+ export { DialogBodyContext, DialogBody as default };
78
77
 
79
- //# sourceMappingURL=BitkitDialogBody.js.map
78
+ //# sourceMappingURL=DialogBodyContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogBodyContext.js","names":[],"sources":["../../../lib/components/BitkitDialog/DialogBodyContext.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { Dialog, useDialogContext, useDialogStyles } from '@chakra-ui/react/dialog';\nimport { chakra } from '@chakra-ui/react/styled-system';\nimport { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\n\nimport { IconArrowDown } from '../../icons';\n\ninterface DialogBodyContextValue {\n scrollBehavior: 'inside' | 'outside';\n showScrollGradient: boolean;\n}\n\nexport const DialogBodyContext = createContext<DialogBodyContextValue>({\n scrollBehavior: 'outside',\n showScrollGradient: true,\n});\n\nconst ScrollableDialogBody = ({ children, ...props }: Dialog.BodyProps) => {\n const { showScrollGradient } = useContext(DialogBodyContext);\n const styles = useDialogStyles();\n const { open } = useDialogContext();\n const contentRef = useRef<HTMLDivElement>(null);\n const [isScrollButtonVisible, setIsScrollButtonVisible] = useState(false);\n\n const updateScrollButtonVisibility = useCallback(() => {\n const content = contentRef.current;\n if (!content) {\n setIsScrollButtonVisible(false);\n return;\n }\n const didScrollToBottom = content.scrollTop >= content.scrollHeight - content.offsetHeight - 1;\n setIsScrollButtonVisible(!didScrollToBottom);\n }, []);\n\n useEffect(() => {\n const content = contentRef.current;\n if (!open || !content) return;\n\n content.addEventListener('scroll', updateScrollButtonVisibility);\n const resizeObserver = new ResizeObserver(updateScrollButtonVisibility);\n resizeObserver.observe(content);\n\n return () => {\n content.removeEventListener('scroll', updateScrollButtonVisibility);\n resizeObserver.disconnect();\n };\n }, [open, updateScrollButtonVisibility]);\n\n return (\n <Box css={styles.scrollBody}>\n <Dialog.Body ref={contentRef} {...props}>\n {children}\n </Dialog.Body>\n {isScrollButtonVisible && (\n <>\n {showScrollGradient && <Box css={styles.scrollGradient} />}\n <chakra.button\n aria-label=\"Scroll to bottom\"\n css={styles.scrollButton}\n type=\"button\"\n onClick={() => {\n contentRef.current?.scrollTo({ top: contentRef.current.scrollHeight, behavior: 'smooth' });\n }}\n >\n <IconArrowDown color=\"icon/tertiary\" size=\"16\" />\n </chakra.button>\n </>\n )}\n </Box>\n );\n};\n\n/**\n * Scroll-aware dialog body. Reads {@link DialogBodyContext} to decide whether the body scrolls\n * internally (`inside` → scroll button + optional gradient) or the whole dialog scrolls (`outside`).\n */\nconst DialogBody = ({ children, ...rest }: Dialog.BodyProps) => {\n const { scrollBehavior } = useContext(DialogBodyContext);\n\n if (scrollBehavior === 'inside') {\n return <ScrollableDialogBody {...rest}>{children}</ScrollableDialogBody>;\n }\n return <Dialog.Body {...rest}>{children}</Dialog.Body>;\n};\n\nexport default DialogBody;\n"],"mappings":";;;;;;;AAYA,IAAa,oBAAoB,cAAsC;CACrE,gBAAgB;CAChB,oBAAoB;AACtB,CAAC;AAED,IAAM,wBAAwB,EAAE,UAAU,GAAG,YAA8B;CACzE,MAAM,EAAE,uBAAuB,WAAW,iBAAiB;CAC3D,MAAM,SAAS,gBAAgB;CAC/B,MAAM,EAAE,SAAS,iBAAiB;CAClC,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,uBAAuB,4BAA4B,SAAS,KAAK;CAExE,MAAM,+BAA+B,kBAAkB;EACrD,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;GACZ,yBAAyB,KAAK;GAC9B;EACF;EAEA,yBAAyB,EADC,QAAQ,aAAa,QAAQ,eAAe,QAAQ,eAAe,EAClD;CAC7C,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS;EAEvB,QAAQ,iBAAiB,UAAU,4BAA4B;EAC/D,MAAM,iBAAiB,IAAI,eAAe,4BAA4B;EACtE,eAAe,QAAQ,OAAO;EAE9B,aAAa;GACX,QAAQ,oBAAoB,UAAU,4BAA4B;GAClE,eAAe,WAAW;EAC5B;CACF,GAAG,CAAC,MAAM,4BAA4B,CAAC;CAEvC,OACE,qBAAC,KAAD;EAAK,KAAK,OAAO;YAAjB,CACE,oBAAC,OAAO,MAAR;GAAa,KAAK;GAAY,GAAI;GAC/B;EACU,CAAA,GACZ,yBACC,qBAAA,YAAA,EAAA,UAAA,CACG,sBAAsB,oBAAC,KAAD,EAAK,KAAK,OAAO,eAAiB,CAAA,GACzD,oBAAC,OAAO,QAAR;GACE,cAAW;GACX,KAAK,OAAO;GACZ,MAAK;GACL,eAAe;IACb,WAAW,SAAS,SAAS;KAAE,KAAK,WAAW,QAAQ;KAAc,UAAU;IAAS,CAAC;GAC3F;aAEA,oBAAC,eAAD;IAAe,OAAM;IAAgB,MAAK;GAAM,CAAA;EACnC,CAAA,CACf,EAAA,CAAA,CAED;;AAET;;;;;AAMA,IAAM,cAAc,EAAE,UAAU,GAAG,WAA6B;CAC9D,MAAM,EAAE,mBAAmB,WAAW,iBAAiB;CAEvD,IAAI,mBAAmB,UACrB,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAO;CAA+B,CAAA;CAEzE,OAAO,oBAAC,OAAO,MAAR;EAAa,GAAI;EAAO;CAAsB,CAAA;AACvD"}
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ export interface DialogInnerProps {
3
+ /** Body content. */
4
+ children?: ReactNode;
5
+ closable?: boolean;
6
+ /** Action buttons, auto-wrapped in the standard right-aligned button row inside the footer. */
7
+ footerButtons?: ReactNode;
8
+ /** Arbitrary content rendered raw inside the footer, before any `footerButtons`. */
9
+ footerContent?: ReactNode;
10
+ /** Extra header content below the title (e.g. the stepper's steps header). */
11
+ headerExtra?: ReactNode;
12
+ headerLabel?: string;
13
+ scrollBehavior?: 'inside' | 'outside';
14
+ showScrollGradient?: boolean;
15
+ title: ReactNode;
16
+ variant?: 'overflowContent';
17
+ }
18
+ /**
19
+ * Header + body + footer rendered inside a `Dialog.Content`. Shared by every Bitkit dialog
20
+ * flavour. Footer rules: `footerContent` renders raw; `footerButtons` is auto-wrapped in the
21
+ * standard right-aligned button row; both render in the same `Dialog.Footer` (content first); if
22
+ * neither is set, no footer renders.
23
+ */
24
+ declare const DialogInner: ({ children, closable, footerButtons, footerContent, headerExtra, headerLabel, scrollBehavior: scrollBehaviorProp, showScrollGradient, title, variant, }: DialogInnerProps) => import("react").JSX.Element;
25
+ export default DialogInner;