@behivetech/molecules.confirm-dialog 1.0.0 → 1.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BEhive Tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -11,3 +11,7 @@ import { ConfirmDialog } from "@behivetech/molecules.confirm-dialog";
11
11
 
12
12
  <ConfirmDialog>Content</ConfirmDialog>;
13
13
  ```
14
+
15
+ ## On React Native
16
+
17
+ The same `ConfirmDialog` renders in an Expo app through the `react-native` export condition, built on the native `Modal` and `Button` with the same block and the same props (`open`, `onOpenChange`, `title`, `message`, `confirmLabel`, `cancelLabel`, `onConfirm`, `variant`). The Android back button and a tap on the backdrop call `onOpenChange(false)`; the dialog is an `alertdialog` (it interrupts to ask for an answer) named by its `title`. The `message` is drawn inside a `Text`, so pass text or inline nodes. The actions are the `Modal`'s footer, kept below the content while the content scrolls, and the message sits in the panel's `lg` padding. For safe-area insets see the `Modal` README.
@@ -0,0 +1,26 @@
1
+ /* GENERATED from confirm-dialog.block.ts by @behivetech/blocks.builder. Do not edit by hand: run `pnpm block:build`. */
2
+
3
+ @layer bht {
4
+ .BHT__ConfirmDialog__message {
5
+ font-family: var(
6
+ --md-sys-typescale-body-medium-font,
7
+ "Inter",
8
+ system-ui,
9
+ -apple-system,
10
+ sans-serif
11
+ );
12
+ font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
13
+ font-weight: var(--md-sys-typescale-body-medium-weight, 400);
14
+ line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
15
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
16
+ color: var(--md-sys-color-on-surface-variant, #474747);
17
+ margin: 0 0 var(--spacing-5, 1.25rem);
18
+ }
19
+
20
+ .BHT__ConfirmDialog__actions {
21
+ display: flex;
22
+ justify-content: flex-end;
23
+ gap: var(--spacing-3, 0.75rem);
24
+ --button-label-color: var(--md-sys-color-secondary, #615b71);
25
+ }
26
+ }
@@ -0,0 +1,59 @@
1
+ // GENERATED from confirm-dialog.block.ts by @behivetech/blocks.builder. Do not edit by hand: run `pnpm block:build`.
2
+ import { createNativeBlock as __bhtCreateNativeBlock } from "@behivetech/blocks.core/native";
3
+ import { StyleSheet as __bhtStyleSheet } from "react-native";
4
+ import type { confirmDialog as __bht0_source } from "./confirm-dialog.block";
5
+
6
+ // Entries that read no color token are one object in both schemes.
7
+ const __bht0_shared = __bhtStyleSheet.create({
8
+ __actions: {
9
+ display: "flex",
10
+ flexDirection: "row",
11
+ justifyContent: "flex-end",
12
+ rowGap: 12,
13
+ columnGap: 12,
14
+ },
15
+ });
16
+ const __bht0_light = __bhtStyleSheet.create({
17
+ __message: {
18
+ fontFamily: "Inter",
19
+ fontSize: 14,
20
+ fontWeight: "400",
21
+ lineHeight: 20,
22
+ letterSpacing: 0.2506,
23
+ color: "#474747",
24
+ marginTop: 0,
25
+ marginRight: 0,
26
+ marginBottom: 20,
27
+ marginLeft: 0,
28
+ },
29
+ });
30
+ const __bht0_dark = __bhtStyleSheet.create({
31
+ __message: {
32
+ fontFamily: "Inter",
33
+ fontSize: 14,
34
+ fontWeight: "400",
35
+ lineHeight: 20,
36
+ letterSpacing: 0.2506,
37
+ color: "#c6c6c6",
38
+ marginTop: 0,
39
+ marginRight: 0,
40
+ marginBottom: 20,
41
+ marginLeft: 0,
42
+ },
43
+ });
44
+ export const confirmDialog: typeof __bht0_source = __bhtCreateNativeBlock<
45
+ typeof __bht0_source
46
+ >("BHT__ConfirmDialog", {
47
+ structure: { children: { message: {}, actions: {} } },
48
+ sheets: {
49
+ light: { ...__bht0_shared, ...__bht0_light },
50
+ dark: { ...__bht0_shared, ...__bht0_dark },
51
+ },
52
+ plan: {
53
+ root: [],
54
+ children: {
55
+ message: [{ key: "__message" }],
56
+ actions: [{ key: "__actions" }],
57
+ },
58
+ },
59
+ });
@@ -0,0 +1,23 @@
1
+ // Converted from confirm-dialog.module.scss by `block convert`; this file is the source from here on.
2
+ import { defineBlock } from "@behivetech/blocks.core";
3
+ import { tokens } from "@behivetech/blocks.core/tokens";
4
+ const { color, spacing, type } = tokens;
5
+ export const confirmDialog = defineBlock("BHT__ConfirmDialog", {
6
+ children: {
7
+ message: {
8
+ fontFamily: type.bodyMedium.font,
9
+ fontSize: type.bodyMedium.size,
10
+ fontWeight: type.bodyMedium.weight,
11
+ lineHeight: type.bodyMedium.lineHeight,
12
+ letterSpacing: type.bodyMedium.tracking,
13
+ color: color.onSurfaceVariant,
14
+ margin: [0, 0, spacing[5]],
15
+ },
16
+ actions: {
17
+ display: "flex",
18
+ justifyContent: "flex-end",
19
+ gap: spacing[3],
20
+ web: { "--button-label-color": color.secondary },
21
+ },
22
+ },
23
+ });
@@ -0,0 +1,81 @@
1
+ import { Button } from "@behivetech/atoms.button";
2
+ import { Modal } from "@behivetech/atoms.modal";
3
+ import { useBlock, type StylesFor } from "@behivetech/blocks.core/native";
4
+ import { type ReactNode } from "react";
5
+ import { Text } from "react-native";
6
+ import { confirmDialog } from "./confirm-dialog.block";
7
+
8
+ export interface ConfirmDialogProps {
9
+ /** Whether the dialog is open */
10
+ open: boolean;
11
+ /** Called when the dialog should close (cancel, confirm, a tap on the backdrop, the Android back button) */
12
+ onOpenChange: (open: boolean) => void;
13
+ /** Dialog title; it names the dialog for a screen reader */
14
+ title: string;
15
+ /** Confirmation message/body content */
16
+ message: ReactNode;
17
+ /** Confirm button label; defaults to "Confirm" */
18
+ confirmLabel?: string;
19
+ /** Cancel button label; defaults to "Cancel" */
20
+ cancelLabel?: string;
21
+ /** Called when the confirm button is pressed, before the dialog closes */
22
+ onConfirm: () => void;
23
+ /** Renders the confirm button as a destructive action; defaults to "default" */
24
+ variant?: "default" | "danger";
25
+ /**
26
+ * An override block made with `defineBlock`, typed to this component's children and variants; it wins over the
27
+ * block's own styles. The dialog renders no element of its own around the `Modal`, so a rule on the override's
28
+ * root has nothing to style: restyle the `message` child.
29
+ */
30
+ styles?: StylesFor<typeof confirmDialog>;
31
+ }
32
+
33
+ /**
34
+ * The React Native renderer of ConfirmDialog: the same block and the same props as the web one, drawn in the
35
+ * native `Modal` (the Android back button and a tap on the backdrop close it) with the native `Button`s. It is
36
+ * an `alertdialog`: it interrupts to ask for an answer. The message is drawn inside a `Text`, so pass text or
37
+ * inline nodes.
38
+ */
39
+ export const ConfirmDialog = ({
40
+ open,
41
+ onOpenChange,
42
+ title,
43
+ message,
44
+ confirmLabel = "Confirm",
45
+ cancelLabel = "Cancel",
46
+ onConfirm,
47
+ variant = "default",
48
+ styles,
49
+ }: ConfirmDialogProps) => {
50
+ const [, childProps] = useBlock(confirmDialog, {}, { styles });
51
+
52
+ // the actions are the dialog's footer: it lays them out at the end, below the scrolling content
53
+ const actions = (
54
+ <>
55
+ <Button variant="ghost" onPress={() => onOpenChange(false)}>
56
+ {cancelLabel}
57
+ </Button>
58
+ <Button
59
+ variant={variant === "danger" ? "danger" : "primary"}
60
+ onPress={() => {
61
+ onConfirm();
62
+ onOpenChange(false);
63
+ }}
64
+ >
65
+ {confirmLabel}
66
+ </Button>
67
+ </>
68
+ );
69
+
70
+ return open ? (
71
+ <Modal
72
+ title={title}
73
+ role="alertdialog"
74
+ padding="lg"
75
+ footer={actions}
76
+ onClose={() => onOpenChange(false)}
77
+ >
78
+ <Text {...childProps("message")}>{message}</Text>
79
+ </Modal>
80
+ ) : null;
81
+ };
@@ -1,8 +1,10 @@
1
1
  import { type ReactNode } from "react";
2
- import { getClassName } from "@behivetech/get-class-name";
2
+
3
3
  import { Modal } from "@behivetech/atoms.modal";
4
4
  import { Button } from "@behivetech/atoms.button";
5
- import styles from "./confirm-dialog.module.scss";
5
+ import "./confirm-dialog.block.css";
6
+ import { useBlock, type StylesFor } from "@behivetech/blocks.core";
7
+ import { confirmDialog } from "./confirm-dialog.block";
6
8
 
7
9
  export interface ConfirmDialogProps {
8
10
  /** Whether the dialog is open */
@@ -21,6 +23,13 @@ export interface ConfirmDialogProps {
21
23
  onConfirm: () => void;
22
24
  /** Renders the confirm button as a destructive action; defaults to "default" */
23
25
  variant?: "default" | "danger";
26
+
27
+ /**
28
+ * An override block made with `defineBlock`, typed to this component's children and variants; it wins over the
29
+ * block's own styles. The dialog renders no element of its own around the `Modal`, so a rule on the override's
30
+ * root has nothing to style: restyle the `message` and `actions` children.
31
+ */
32
+ styles?: StylesFor<typeof confirmDialog>;
24
33
  }
25
34
 
26
35
  /**
@@ -36,18 +45,16 @@ export const ConfirmDialog = ({
36
45
  cancelLabel = "Cancel",
37
46
  onConfirm,
38
47
  variant = "default",
48
+ styles,
39
49
  }: ConfirmDialogProps) => {
40
- const [, getChildClass] = getClassName({
41
- rootClass: "BHT__ConfirmDialog",
42
- styles,
43
- });
50
+ const [, childProps] = useBlock(confirmDialog, {}, { styles });
44
51
 
45
52
  if (!open) return null;
46
53
 
47
54
  return (
48
55
  <Modal title={title} onClose={() => onOpenChange(false)}>
49
- <p className={getChildClass("message")}>{message}</p>
50
- <div className={getChildClass("actions")}>
56
+ <p {...childProps("message")}>{message}</p>
57
+ <div {...childProps("actions")}>
51
58
  <Button variant="ghost" onClick={() => onOpenChange(false)}>
52
59
  {cancelLabel}
53
60
  </Button>
package/dist/index.cjs CHANGED
@@ -26,15 +26,33 @@ __export(index_exports, {
26
26
  module.exports = __toCommonJS(index_exports);
27
27
 
28
28
  // confirm-dialog.tsx
29
- var import_get_class_name = require("@behivetech/get-class-name");
30
29
  var import_atoms = require("@behivetech/atoms.modal");
31
30
  var import_atoms2 = require("@behivetech/atoms.button");
31
+ var import_blocks2 = require("@behivetech/blocks.core");
32
32
 
33
- // confirm-dialog.module.scss
34
- var confirm_dialog_module_default = {
35
- "BHT__ConfirmDialog__message": "BHT__ConfirmDialog__message",
36
- "BHT__ConfirmDialog__actions": "BHT__ConfirmDialog__actions"
37
- };
33
+ // confirm-dialog.block.ts
34
+ var import_blocks = require("@behivetech/blocks.core");
35
+ var import_tokens = require("@behivetech/blocks.core/tokens");
36
+ var { color, spacing, type } = import_tokens.tokens;
37
+ var confirmDialog = (0, import_blocks.defineBlock)("BHT__ConfirmDialog", {
38
+ children: {
39
+ message: {
40
+ fontFamily: type.bodyMedium.font,
41
+ fontSize: type.bodyMedium.size,
42
+ fontWeight: type.bodyMedium.weight,
43
+ lineHeight: type.bodyMedium.lineHeight,
44
+ letterSpacing: type.bodyMedium.tracking,
45
+ color: color.onSurfaceVariant,
46
+ margin: [0, 0, spacing[5]]
47
+ },
48
+ actions: {
49
+ display: "flex",
50
+ justifyContent: "flex-end",
51
+ gap: spacing[3],
52
+ web: { "--button-label-color": color.secondary }
53
+ }
54
+ }
55
+ });
38
56
 
39
57
  // confirm-dialog.tsx
40
58
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -46,16 +64,14 @@ var ConfirmDialog = ({
46
64
  confirmLabel = "Confirm",
47
65
  cancelLabel = "Cancel",
48
66
  onConfirm,
49
- variant = "default"
67
+ variant = "default",
68
+ styles
50
69
  }) => {
51
- const [, getChildClass] = (0, import_get_class_name.getClassName)({
52
- rootClass: "BHT__ConfirmDialog",
53
- styles: confirm_dialog_module_default
54
- });
70
+ const [, childProps] = (0, import_blocks2.useBlock)(confirmDialog, {}, { styles });
55
71
  if (!open) return null;
56
72
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_atoms.Modal, { title, onClose: () => onOpenChange(false), children: [
57
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: getChildClass("message"), children: message }),
58
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: getChildClass("actions"), children: [
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { ...childProps("message"), children: message }),
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...childProps("actions"), children: [
59
75
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_atoms2.Button, { variant: "ghost", onClick: () => onOpenChange(false), children: cancelLabel }),
60
76
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
61
77
  import_atoms2.Button,
package/dist/index.css CHANGED
@@ -1,16 +1,18 @@
1
- /* esbuild-sass-plugin:css-chunkconfirm-dialog.module.scss */
2
- .BHT__ConfirmDialog__message {
3
- font-family: var(--md-sys-typescale-body-medium-font, var(--font-body));
4
- font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
5
- font-weight: var(--md-sys-typescale-body-medium-weight, 400);
6
- line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
7
- letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
8
- color: var(--md-sys-color-on-surface-variant, var(--color-text-muted));
9
- margin: 0 0 var(--spacing-5, 1.25rem);
10
- }
11
- .BHT__ConfirmDialog__actions {
12
- --button-label-color: var(--md-sys-color-secondary);
13
- display: flex;
14
- justify-content: flex-end;
15
- gap: var(--spacing-3, 0.75rem);
1
+ /* confirm-dialog.block.css */
2
+ @layer bht {
3
+ .BHT__ConfirmDialog__message {
4
+ font-family: var( --md-sys-typescale-body-medium-font, "Inter", system-ui, -apple-system, sans-serif );
5
+ font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
6
+ font-weight: var(--md-sys-typescale-body-medium-weight, 400);
7
+ line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
8
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
9
+ color: var(--md-sys-color-on-surface-variant, #474747);
10
+ margin: 0 0 var(--spacing-5, 1.25rem);
11
+ }
12
+ .BHT__ConfirmDialog__actions {
13
+ display: flex;
14
+ justify-content: flex-end;
15
+ gap: var(--spacing-3, 0.75rem);
16
+ --button-label-color: var(--md-sys-color-secondary, #615b71);
17
+ }
16
18
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,29 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
+ import * as _behivetech_blocks_core from '@behivetech/blocks.core';
4
+ import { StylesFor } from '@behivetech/blocks.core';
5
+
6
+ declare const confirmDialog: _behivetech_blocks_core.Block<"BHT__ConfirmDialog", {
7
+ readonly children: {
8
+ readonly message: {
9
+ readonly fontFamily: _behivetech_blocks_core.Token<"font">;
10
+ readonly fontSize: _behivetech_blocks_core.Token<"length">;
11
+ readonly fontWeight: _behivetech_blocks_core.Token<"weight">;
12
+ readonly lineHeight: _behivetech_blocks_core.Token<"length">;
13
+ readonly letterSpacing: _behivetech_blocks_core.Token<"tracking">;
14
+ readonly color: _behivetech_blocks_core.Token<"color">;
15
+ readonly margin: readonly [0, 0, _behivetech_blocks_core.Token<"length">];
16
+ };
17
+ readonly actions: {
18
+ readonly display: "flex";
19
+ readonly justifyContent: "flex-end";
20
+ readonly gap: _behivetech_blocks_core.Token<"length">;
21
+ readonly web: {
22
+ readonly "--button-label-color": _behivetech_blocks_core.Token<"color">;
23
+ };
24
+ };
25
+ };
26
+ }>;
3
27
 
4
28
  interface ConfirmDialogProps {
5
29
  /** Whether the dialog is open */
@@ -18,11 +42,17 @@ interface ConfirmDialogProps {
18
42
  onConfirm: () => void;
19
43
  /** Renders the confirm button as a destructive action; defaults to "default" */
20
44
  variant?: "default" | "danger";
45
+ /**
46
+ * An override block made with `defineBlock`, typed to this component's children and variants; it wins over the
47
+ * block's own styles. The dialog renders no element of its own around the `Modal`, so a rule on the override's
48
+ * root has nothing to style: restyle the `message` and `actions` children.
49
+ */
50
+ styles?: StylesFor<typeof confirmDialog>;
21
51
  }
22
52
  /**
23
53
  * A `Modal` pre-wired with a message and confirm/cancel actions, for "are you
24
54
  * sure?" moments — e.g. confirming a delete.
25
55
  */
26
- declare const ConfirmDialog: ({ open, onOpenChange, title, message, confirmLabel, cancelLabel, onConfirm, variant, }: ConfirmDialogProps) => react.JSX.Element | null;
56
+ declare const ConfirmDialog: ({ open, onOpenChange, title, message, confirmLabel, cancelLabel, onConfirm, variant, styles, }: ConfirmDialogProps) => react.JSX.Element | null;
27
57
 
28
58
  export { ConfirmDialog, type ConfirmDialogProps };
package/dist/index.js CHANGED
@@ -1,15 +1,33 @@
1
1
  "use client";
2
2
 
3
3
  // confirm-dialog.tsx
4
- import { getClassName } from "@behivetech/get-class-name";
5
4
  import { Modal } from "@behivetech/atoms.modal";
6
5
  import { Button } from "@behivetech/atoms.button";
6
+ import { useBlock } from "@behivetech/blocks.core";
7
7
 
8
- // confirm-dialog.module.scss
9
- var confirm_dialog_module_default = {
10
- "BHT__ConfirmDialog__message": "BHT__ConfirmDialog__message",
11
- "BHT__ConfirmDialog__actions": "BHT__ConfirmDialog__actions"
12
- };
8
+ // confirm-dialog.block.ts
9
+ import { defineBlock } from "@behivetech/blocks.core";
10
+ import { tokens } from "@behivetech/blocks.core/tokens";
11
+ var { color, spacing, type } = tokens;
12
+ var confirmDialog = defineBlock("BHT__ConfirmDialog", {
13
+ children: {
14
+ message: {
15
+ fontFamily: type.bodyMedium.font,
16
+ fontSize: type.bodyMedium.size,
17
+ fontWeight: type.bodyMedium.weight,
18
+ lineHeight: type.bodyMedium.lineHeight,
19
+ letterSpacing: type.bodyMedium.tracking,
20
+ color: color.onSurfaceVariant,
21
+ margin: [0, 0, spacing[5]]
22
+ },
23
+ actions: {
24
+ display: "flex",
25
+ justifyContent: "flex-end",
26
+ gap: spacing[3],
27
+ web: { "--button-label-color": color.secondary }
28
+ }
29
+ }
30
+ });
13
31
 
14
32
  // confirm-dialog.tsx
15
33
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -21,16 +39,14 @@ var ConfirmDialog = ({
21
39
  confirmLabel = "Confirm",
22
40
  cancelLabel = "Cancel",
23
41
  onConfirm,
24
- variant = "default"
42
+ variant = "default",
43
+ styles
25
44
  }) => {
26
- const [, getChildClass] = getClassName({
27
- rootClass: "BHT__ConfirmDialog",
28
- styles: confirm_dialog_module_default
29
- });
45
+ const [, childProps] = useBlock(confirmDialog, {}, { styles });
30
46
  if (!open) return null;
31
47
  return /* @__PURE__ */ jsxs(Modal, { title, onClose: () => onOpenChange(false), children: [
32
- /* @__PURE__ */ jsx("p", { className: getChildClass("message"), children: message }),
33
- /* @__PURE__ */ jsxs("div", { className: getChildClass("actions"), children: [
48
+ /* @__PURE__ */ jsx("p", { ...childProps("message"), children: message }),
49
+ /* @__PURE__ */ jsxs("div", { ...childProps("actions"), children: [
34
50
  /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => onOpenChange(false), children: cancelLabel }),
35
51
  /* @__PURE__ */ jsx(
36
52
  Button,
@@ -0,0 +1,104 @@
1
+ // confirm-dialog.native.tsx
2
+ import { Button } from "@behivetech/atoms.button";
3
+ import { Modal } from "@behivetech/atoms.modal";
4
+ import { useBlock } from "@behivetech/blocks.core/native";
5
+ import { Text } from "react-native";
6
+
7
+ // confirm-dialog.block.native.ts
8
+ import { createNativeBlock as __bhtCreateNativeBlock } from "@behivetech/blocks.core/native";
9
+ import { StyleSheet as __bhtStyleSheet } from "react-native";
10
+ var __bht0_shared = __bhtStyleSheet.create({
11
+ __actions: {
12
+ display: "flex",
13
+ flexDirection: "row",
14
+ justifyContent: "flex-end",
15
+ rowGap: 12,
16
+ columnGap: 12
17
+ }
18
+ });
19
+ var __bht0_light = __bhtStyleSheet.create({
20
+ __message: {
21
+ fontFamily: "Inter",
22
+ fontSize: 14,
23
+ fontWeight: "400",
24
+ lineHeight: 20,
25
+ letterSpacing: 0.2506,
26
+ color: "#474747",
27
+ marginTop: 0,
28
+ marginRight: 0,
29
+ marginBottom: 20,
30
+ marginLeft: 0
31
+ }
32
+ });
33
+ var __bht0_dark = __bhtStyleSheet.create({
34
+ __message: {
35
+ fontFamily: "Inter",
36
+ fontSize: 14,
37
+ fontWeight: "400",
38
+ lineHeight: 20,
39
+ letterSpacing: 0.2506,
40
+ color: "#c6c6c6",
41
+ marginTop: 0,
42
+ marginRight: 0,
43
+ marginBottom: 20,
44
+ marginLeft: 0
45
+ }
46
+ });
47
+ var confirmDialog = __bhtCreateNativeBlock("BHT__ConfirmDialog", {
48
+ structure: { children: { message: {}, actions: {} } },
49
+ sheets: {
50
+ light: { ...__bht0_shared, ...__bht0_light },
51
+ dark: { ...__bht0_shared, ...__bht0_dark }
52
+ },
53
+ plan: {
54
+ root: [],
55
+ children: {
56
+ message: [{ key: "__message" }],
57
+ actions: [{ key: "__actions" }]
58
+ }
59
+ }
60
+ });
61
+
62
+ // confirm-dialog.native.tsx
63
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
64
+ var ConfirmDialog = ({
65
+ open,
66
+ onOpenChange,
67
+ title,
68
+ message,
69
+ confirmLabel = "Confirm",
70
+ cancelLabel = "Cancel",
71
+ onConfirm,
72
+ variant = "default",
73
+ styles
74
+ }) => {
75
+ const [, childProps] = useBlock(confirmDialog, {}, { styles });
76
+ const actions = /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onPress: () => onOpenChange(false), children: cancelLabel }),
78
+ /* @__PURE__ */ jsx(
79
+ Button,
80
+ {
81
+ variant: variant === "danger" ? "danger" : "primary",
82
+ onPress: () => {
83
+ onConfirm();
84
+ onOpenChange(false);
85
+ },
86
+ children: confirmLabel
87
+ }
88
+ )
89
+ ] });
90
+ return open ? /* @__PURE__ */ jsx(
91
+ Modal,
92
+ {
93
+ title,
94
+ role: "alertdialog",
95
+ padding: "lg",
96
+ footer: actions,
97
+ onClose: () => onOpenChange(false),
98
+ children: /* @__PURE__ */ jsx(Text, { ...childProps("message"), children: message })
99
+ }
100
+ ) : null;
101
+ };
102
+ export {
103
+ ConfirmDialog
104
+ };
@@ -0,0 +1,21 @@
1
+ export declare const confirmDialog: import("@behivetech/blocks.core").Block<"BHT__ConfirmDialog", {
2
+ readonly children: {
3
+ readonly message: {
4
+ readonly fontFamily: import("@behivetech/blocks.core").Token<"font">;
5
+ readonly fontSize: import("@behivetech/blocks.core").Token<"length">;
6
+ readonly fontWeight: import("@behivetech/blocks.core").Token<"weight">;
7
+ readonly lineHeight: import("@behivetech/blocks.core").Token<"length">;
8
+ readonly letterSpacing: import("@behivetech/blocks.core").Token<"tracking">;
9
+ readonly color: import("@behivetech/blocks.core").Token<"color">;
10
+ readonly margin: readonly [0, 0, import("@behivetech/blocks.core").Token<"length">];
11
+ };
12
+ readonly actions: {
13
+ readonly display: "flex";
14
+ readonly justifyContent: "flex-end";
15
+ readonly gap: import("@behivetech/blocks.core").Token<"length">;
16
+ readonly web: {
17
+ readonly "--button-label-color": import("@behivetech/blocks.core").Token<"color">;
18
+ };
19
+ };
20
+ };
21
+ }>;
@@ -0,0 +1,2 @@
1
+ import type { confirmDialog as __bht0_source } from "./confirm-dialog.block";
2
+ export declare const confirmDialog: typeof __bht0_source;
@@ -0,0 +1,34 @@
1
+ import { type StylesFor } from "@behivetech/blocks.core/native";
2
+ import { type ReactNode } from "react";
3
+ import { confirmDialog } from "./confirm-dialog.block.native";
4
+ export interface ConfirmDialogProps {
5
+ /** Whether the dialog is open */
6
+ open: boolean;
7
+ /** Called when the dialog should close (cancel, confirm, a tap on the backdrop, the Android back button) */
8
+ onOpenChange: (open: boolean) => void;
9
+ /** Dialog title; it names the dialog for a screen reader */
10
+ title: string;
11
+ /** Confirmation message/body content */
12
+ message: ReactNode;
13
+ /** Confirm button label; defaults to "Confirm" */
14
+ confirmLabel?: string;
15
+ /** Cancel button label; defaults to "Cancel" */
16
+ cancelLabel?: string;
17
+ /** Called when the confirm button is pressed, before the dialog closes */
18
+ onConfirm: () => void;
19
+ /** Renders the confirm button as a destructive action; defaults to "default" */
20
+ variant?: "default" | "danger";
21
+ /**
22
+ * An override block made with `defineBlock`, typed to this component's children and variants; it wins over the
23
+ * block's own styles. The dialog renders no element of its own around the `Modal`, so a rule on the override's
24
+ * root has nothing to style: restyle the `message` child.
25
+ */
26
+ styles?: StylesFor<typeof confirmDialog>;
27
+ }
28
+ /**
29
+ * The React Native renderer of ConfirmDialog: the same block and the same props as the web one, drawn in the
30
+ * native `Modal` (the Android back button and a tap on the backdrop close it) with the native `Button`s. It is
31
+ * an `alertdialog`: it interrupts to ask for an answer. The message is drawn inside a `Text`, so pass text or
32
+ * inline nodes.
33
+ */
34
+ export declare const ConfirmDialog: ({ open, onOpenChange, title, message, confirmLabel, cancelLabel, onConfirm, variant, styles, }: ConfirmDialogProps) => import("react").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ export { ConfirmDialog } from "./confirm-dialog.native";
2
+ export type { ConfirmDialogProps } from "./confirm-dialog.native";
package/docs.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://github.com/behivetech/bht-component-registry/docs.schema.json",
3
3
  "version": 2,
4
- "generatedAt": "2026-11-17T07:20:16.411Z",
4
+ "generatedAt": "2026-11-26T18:11:09.543Z",
5
5
  "docs": [
6
6
  {
7
7
  "displayName": "ConfirmDialog",
@@ -57,6 +57,13 @@
57
57
  "defaultValue": "Confirm",
58
58
  "description": "Confirm button label; defaults to \"Confirm\""
59
59
  },
60
+ {
61
+ "name": "styles",
62
+ "type": "StylesFor<Block<\"BHT__ConfirmDialog\", { readonly children: { readonly message: { readonly fontFamily: Token<\"font\">; readonly fontSize: Token<\"length\">; readonly fontWeight: Token<\"weight\">; readonly lineHeight: Token<...>; readonly letterSpacing: Token<...>; readonly color: Token<...>; readonly margin: readonly [.....",
63
+ "required": false,
64
+ "defaultValue": null,
65
+ "description": "An override block made with `defineBlock`, typed to this component's children and variants; it wins over the\nblock's own styles. The dialog renders no element of its own around the `Modal`, so a rule on the override's\nroot has nothing to style: restyle the `message` and `actions` children."
66
+ },
60
67
  {
61
68
  "name": "variant",
62
69
  "type": "\"default\" | \"danger\"",
package/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { ConfirmDialog } from "./confirm-dialog.js";
2
- export type { ConfirmDialogProps } from "./confirm-dialog.js";
1
+ export { ConfirmDialog } from "./confirm-dialog";
2
+ export type { ConfirmDialogProps } from "./confirm-dialog";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@behivetech/molecules.confirm-dialog",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "description": "A `Modal` pre-wired with a message and confirm/cancel actions, for \"are you sure?\" moments such as confirming a delete.",
6
6
  "type": "module",
@@ -10,18 +10,26 @@
10
10
  ],
11
11
  "exports": {
12
12
  ".": {
13
+ "react-native": {
14
+ "types": "./dist/native/index.d.ts",
15
+ "default": "./dist/index.native.js"
16
+ },
13
17
  "types": "./dist/index.d.ts",
14
18
  "import": "./dist/index.js",
15
19
  "require": "./dist/index.cjs"
16
20
  },
17
21
  "./styles.css": "./dist/index.css"
18
22
  },
23
+ "react-native": "./dist/index.native.js",
19
24
  "files": [
20
25
  "dist",
21
26
  "README.md",
22
27
  "index.ts",
23
28
  "confirm-dialog.tsx",
24
- "confirm-dialog.module.scss",
29
+ "confirm-dialog.block.ts",
30
+ "confirm-dialog.block.css",
31
+ "confirm-dialog.native.tsx",
32
+ "confirm-dialog.block.native.ts",
25
33
  "*.example.tsx",
26
34
  "docs.json"
27
35
  ],
@@ -30,19 +38,29 @@
30
38
  "tags": []
31
39
  },
32
40
  "dependencies": {
33
- "@behivetech/atoms.button": "1.0.0",
34
- "@behivetech/atoms.modal": "1.0.0",
35
- "@behivetech/get-class-name": "1.0.0"
41
+ "@behivetech/atoms.button": "1.1.0",
42
+ "@behivetech/atoms.modal": "1.1.0",
43
+ "@behivetech/blocks.core": "0.1.0"
36
44
  },
37
45
  "peerDependencies": {
38
46
  "react": "^19.2.7",
39
- "react-dom": "^19.2.7"
47
+ "react-dom": "^19.2.7",
48
+ "react-native": "*"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "react-native": {
52
+ "optional": true
53
+ }
40
54
  },
41
55
  "devDependencies": {
42
- "@bht-component-registry/env": "0.2.0",
56
+ "@behivetech/blocks.builder": "0.1.0",
57
+ "@behivetech/blocks.native-test": "0.0.1",
58
+ "@bht-component-registry/env": "0.3.0",
43
59
  "@types/react": "19.2.17",
44
60
  "@types/react-dom": "19.2.3",
45
61
  "eslint": "^9.39.5",
62
+ "react": "19.2.8",
63
+ "react-dom": "19.2.8",
46
64
  "tsup": "^8.5.1",
47
65
  "typescript": "^6.0.3",
48
66
  "vitest": "^4.1.10"
@@ -50,18 +68,25 @@
50
68
  "repository": {
51
69
  "type": "git",
52
70
  "url": "https://github.com/behivetech/bht-galaxy.git",
53
- "directory": "registry/behivetech/molecules/confirm-dialog"
71
+ "directory": "packages/molecules/confirm-dialog"
54
72
  },
55
73
  "homepage": "https://platform.behivetech.com/behivetech/molecules/confirm-dialog",
56
74
  "publishConfig": {
57
75
  "registry": "https://registry.npmjs.org",
58
76
  "access": "public"
59
77
  },
78
+ "blocks": {
79
+ "a11y": {
80
+ "surface": [
81
+ "surface-container-high"
82
+ ]
83
+ }
84
+ },
60
85
  "scripts": {
61
- "build": "tsup && bht-registry-docgen",
86
+ "build": "block check && tsup && bht-registry-docgen",
62
87
  "dev": "tsup --watch",
63
88
  "lint": "eslint . --max-warnings 0",
64
- "check-types": "tsc --noEmit",
89
+ "check-types": "tsc --noEmit && tsc --noEmit -p tsconfig.native.json",
65
90
  "test": "vitest run"
66
91
  }
67
92
  }
@@ -1,24 +0,0 @@
1
- // Content of a Material Design 3 basic dialog; the dialog itself is Modal.
2
-
3
- .BHT__ConfirmDialog {
4
- &__message {
5
- font-family: var(--md-sys-typescale-body-medium-font, var(--font-body));
6
- font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
7
- font-weight: var(--md-sys-typescale-body-medium-weight, 400);
8
- line-height: var(--md-sys-typescale-body-medium-line-height, 1.25rem);
9
- letter-spacing: var(--md-sys-typescale-body-medium-tracking, 0.0179em);
10
- color: var(--md-sys-color-on-surface-variant, var(--color-text-muted));
11
- margin: 0 0 var(--spacing-5, 1.25rem);
12
- }
13
-
14
- &__actions {
15
- // Modal's panel is `surface-container-high`, where Button's default ghost
16
- // label (`primary`) is 4.02:1 in the-behive's Dark tokens (8.43:1 in the
17
- // defaults). `secondary` is 12.87:1 Dark and 5.40:1 Light there, so Cancel stays above the 4.5:1 small-text rule.
18
- --button-label-color: var(--md-sys-color-secondary);
19
-
20
- display: flex;
21
- justify-content: flex-end;
22
- gap: var(--spacing-3, 0.75rem);
23
- }
24
- }