@behivetech/molecules.confirm-dialog 0.2.7 → 0.2.10
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/README.md +1 -1
- package/confirm-dialog.tsx +1 -1
- package/dist/index.cjs +2 -120
- package/dist/index.js +1 -132
- package/docs.json +71 -0
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A `Modal` pre-wired with a message and confirm/cancel actions, for "are you sure?" moments such as confirming a delete.
|
|
4
4
|
|
|
5
|
-
Docs: https://
|
|
5
|
+
Docs: https://platform.behivetech.com/behivetech/molecules/confirm-dialog
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
package/confirm-dialog.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { getClassName } from "@
|
|
2
|
+
import { getClassName } from "@behivetech/get-class-name";
|
|
3
3
|
import { Modal } from "@behivetech/atoms.modal";
|
|
4
4
|
import { Button } from "@behivetech/atoms.button";
|
|
5
5
|
import styles from "./confirm-dialog.module.scss";
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
6
|
var __export = (target, all) => {
|
|
12
7
|
for (var name in all)
|
|
13
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -20,77 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
15
|
}
|
|
21
16
|
return to;
|
|
22
17
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
19
|
|
|
33
|
-
// ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
34
|
-
var require_classnames = __commonJS({
|
|
35
|
-
"../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports2, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
(function() {
|
|
38
|
-
"use strict";
|
|
39
|
-
var hasOwn = {}.hasOwnProperty;
|
|
40
|
-
function classNames() {
|
|
41
|
-
var classes = "";
|
|
42
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
43
|
-
var arg = arguments[i];
|
|
44
|
-
if (arg) {
|
|
45
|
-
classes = appendClass(classes, parseValue(arg));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return classes;
|
|
49
|
-
}
|
|
50
|
-
function parseValue(arg) {
|
|
51
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
52
|
-
return arg;
|
|
53
|
-
}
|
|
54
|
-
if (typeof arg !== "object") {
|
|
55
|
-
return "";
|
|
56
|
-
}
|
|
57
|
-
if (Array.isArray(arg)) {
|
|
58
|
-
return classNames.apply(null, arg);
|
|
59
|
-
}
|
|
60
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
61
|
-
return arg.toString();
|
|
62
|
-
}
|
|
63
|
-
var classes = "";
|
|
64
|
-
for (var key in arg) {
|
|
65
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
66
|
-
classes = appendClass(classes, key);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return classes;
|
|
70
|
-
}
|
|
71
|
-
function appendClass(value, newClass) {
|
|
72
|
-
if (!newClass) {
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
if (value) {
|
|
76
|
-
return value + " " + newClass;
|
|
77
|
-
}
|
|
78
|
-
return value + newClass;
|
|
79
|
-
}
|
|
80
|
-
if (typeof module2 !== "undefined" && module2.exports) {
|
|
81
|
-
classNames.default = classNames;
|
|
82
|
-
module2.exports = classNames;
|
|
83
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
84
|
-
define("classnames", [], function() {
|
|
85
|
-
return classNames;
|
|
86
|
-
});
|
|
87
|
-
} else {
|
|
88
|
-
window.classNames = classNames;
|
|
89
|
-
}
|
|
90
|
-
})();
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
20
|
// index.ts
|
|
95
21
|
var index_exports = {};
|
|
96
22
|
__export(index_exports, {
|
|
@@ -98,43 +24,8 @@ __export(index_exports, {
|
|
|
98
24
|
});
|
|
99
25
|
module.exports = __toCommonJS(index_exports);
|
|
100
26
|
|
|
101
|
-
// ../../../../packages/registry/class-names/dist/index.js
|
|
102
|
-
var import_classnames = __toESM(require_classnames(), 1);
|
|
103
|
-
var getClassName = ({
|
|
104
|
-
className,
|
|
105
|
-
modifiers = {},
|
|
106
|
-
rootClass,
|
|
107
|
-
styles = {}
|
|
108
|
-
}) => {
|
|
109
|
-
function getModifiers() {
|
|
110
|
-
const updatedModifiers = {};
|
|
111
|
-
const modifierKeys = Object.keys(modifiers);
|
|
112
|
-
if (modifierKeys.length) {
|
|
113
|
-
modifierKeys.forEach((modKey) => {
|
|
114
|
-
const classKey = `${rootClass}--${modKey}`;
|
|
115
|
-
const newClassName = styles[classKey] || classKey;
|
|
116
|
-
updatedModifiers[newClassName] = modifiers[modKey] ?? false;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return updatedModifiers;
|
|
120
|
-
}
|
|
121
|
-
function getChildClass(childClassName) {
|
|
122
|
-
const classKey = `${rootClass}__${childClassName}`;
|
|
123
|
-
return styles[classKey] || classKey;
|
|
124
|
-
}
|
|
125
|
-
function getRootStyles() {
|
|
126
|
-
return (0, import_classnames.default)(
|
|
127
|
-
className,
|
|
128
|
-
{
|
|
129
|
-
...getModifiers()
|
|
130
|
-
},
|
|
131
|
-
styles[rootClass] || rootClass
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
return [getRootStyles(), getChildClass];
|
|
135
|
-
};
|
|
136
|
-
|
|
137
27
|
// confirm-dialog.tsx
|
|
28
|
+
var import_get_class_name = require("@behivetech/get-class-name");
|
|
138
29
|
var import_atoms = require("@behivetech/atoms.modal");
|
|
139
30
|
var import_atoms2 = require("@behivetech/atoms.button");
|
|
140
31
|
|
|
@@ -156,7 +47,7 @@ var ConfirmDialog = ({
|
|
|
156
47
|
onConfirm,
|
|
157
48
|
variant = "default"
|
|
158
49
|
}) => {
|
|
159
|
-
const [, getChildClass] = getClassName({
|
|
50
|
+
const [, getChildClass] = (0, import_get_class_name.getClassName)({
|
|
160
51
|
rootClass: "BHT__ConfirmDialog",
|
|
161
52
|
styles: confirm_dialog_module_default
|
|
162
53
|
});
|
|
@@ -183,12 +74,3 @@ var ConfirmDialog = ({
|
|
|
183
74
|
0 && (module.exports = {
|
|
184
75
|
ConfirmDialog
|
|
185
76
|
});
|
|
186
|
-
/*! Bundled license information:
|
|
187
|
-
|
|
188
|
-
classnames/index.js:
|
|
189
|
-
(*!
|
|
190
|
-
Copyright (c) 2018 Jed Watson.
|
|
191
|
-
Licensed under the MIT License (MIT), see
|
|
192
|
-
http://jedwatson.github.io/classnames
|
|
193
|
-
*)
|
|
194
|
-
*/
|
package/dist/index.js
CHANGED
|
@@ -1,127 +1,5 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
28
|
-
var require_classnames = __commonJS({
|
|
29
|
-
"../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
(function() {
|
|
32
|
-
"use strict";
|
|
33
|
-
var hasOwn = {}.hasOwnProperty;
|
|
34
|
-
function classNames() {
|
|
35
|
-
var classes = "";
|
|
36
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
37
|
-
var arg = arguments[i];
|
|
38
|
-
if (arg) {
|
|
39
|
-
classes = appendClass(classes, parseValue(arg));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return classes;
|
|
43
|
-
}
|
|
44
|
-
function parseValue(arg) {
|
|
45
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
46
|
-
return arg;
|
|
47
|
-
}
|
|
48
|
-
if (typeof arg !== "object") {
|
|
49
|
-
return "";
|
|
50
|
-
}
|
|
51
|
-
if (Array.isArray(arg)) {
|
|
52
|
-
return classNames.apply(null, arg);
|
|
53
|
-
}
|
|
54
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
55
|
-
return arg.toString();
|
|
56
|
-
}
|
|
57
|
-
var classes = "";
|
|
58
|
-
for (var key in arg) {
|
|
59
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
60
|
-
classes = appendClass(classes, key);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return classes;
|
|
64
|
-
}
|
|
65
|
-
function appendClass(value, newClass) {
|
|
66
|
-
if (!newClass) {
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
if (value) {
|
|
70
|
-
return value + " " + newClass;
|
|
71
|
-
}
|
|
72
|
-
return value + newClass;
|
|
73
|
-
}
|
|
74
|
-
if (typeof module !== "undefined" && module.exports) {
|
|
75
|
-
classNames.default = classNames;
|
|
76
|
-
module.exports = classNames;
|
|
77
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
78
|
-
define("classnames", [], function() {
|
|
79
|
-
return classNames;
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
window.classNames = classNames;
|
|
83
|
-
}
|
|
84
|
-
})();
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// ../../../../packages/registry/class-names/dist/index.js
|
|
89
|
-
var import_classnames = __toESM(require_classnames(), 1);
|
|
90
|
-
var getClassName = ({
|
|
91
|
-
className,
|
|
92
|
-
modifiers = {},
|
|
93
|
-
rootClass,
|
|
94
|
-
styles = {}
|
|
95
|
-
}) => {
|
|
96
|
-
function getModifiers() {
|
|
97
|
-
const updatedModifiers = {};
|
|
98
|
-
const modifierKeys = Object.keys(modifiers);
|
|
99
|
-
if (modifierKeys.length) {
|
|
100
|
-
modifierKeys.forEach((modKey) => {
|
|
101
|
-
const classKey = `${rootClass}--${modKey}`;
|
|
102
|
-
const newClassName = styles[classKey] || classKey;
|
|
103
|
-
updatedModifiers[newClassName] = modifiers[modKey] ?? false;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return updatedModifiers;
|
|
107
|
-
}
|
|
108
|
-
function getChildClass(childClassName) {
|
|
109
|
-
const classKey = `${rootClass}__${childClassName}`;
|
|
110
|
-
return styles[classKey] || classKey;
|
|
111
|
-
}
|
|
112
|
-
function getRootStyles() {
|
|
113
|
-
return (0, import_classnames.default)(
|
|
114
|
-
className,
|
|
115
|
-
{
|
|
116
|
-
...getModifiers()
|
|
117
|
-
},
|
|
118
|
-
styles[rootClass] || rootClass
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
return [getRootStyles(), getChildClass];
|
|
122
|
-
};
|
|
123
|
-
|
|
124
1
|
// confirm-dialog.tsx
|
|
2
|
+
import { getClassName } from "@behivetech/get-class-name";
|
|
125
3
|
import { Modal } from "@behivetech/atoms.modal";
|
|
126
4
|
import { Button } from "@behivetech/atoms.button";
|
|
127
5
|
|
|
@@ -169,12 +47,3 @@ var ConfirmDialog = ({
|
|
|
169
47
|
export {
|
|
170
48
|
ConfirmDialog
|
|
171
49
|
};
|
|
172
|
-
/*! Bundled license information:
|
|
173
|
-
|
|
174
|
-
classnames/index.js:
|
|
175
|
-
(*!
|
|
176
|
-
Copyright (c) 2018 Jed Watson.
|
|
177
|
-
Licensed under the MIT License (MIT), see
|
|
178
|
-
http://jedwatson.github.io/classnames
|
|
179
|
-
*)
|
|
180
|
-
*/
|
package/docs.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://github.com/behivetech/bht-component-registry/docs.schema.json",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"generatedAt": "2026-11-11T04:42:39.488Z",
|
|
5
|
+
"docs": [
|
|
6
|
+
{
|
|
7
|
+
"displayName": "ConfirmDialog",
|
|
8
|
+
"description": "A `Modal` pre-wired with a message and confirm/cancel actions, for \"are you\nsure?\" moments — e.g. confirming a delete.",
|
|
9
|
+
"extendsNative": false,
|
|
10
|
+
"props": [
|
|
11
|
+
{
|
|
12
|
+
"name": "message",
|
|
13
|
+
"type": "ReactNode",
|
|
14
|
+
"required": true,
|
|
15
|
+
"defaultValue": null,
|
|
16
|
+
"description": "Confirmation message/body content"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "onConfirm",
|
|
20
|
+
"type": "() => void",
|
|
21
|
+
"required": true,
|
|
22
|
+
"defaultValue": null,
|
|
23
|
+
"description": "Called when the confirm button is clicked, before the dialog closes"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "onOpenChange",
|
|
27
|
+
"type": "(open: boolean) => void",
|
|
28
|
+
"required": true,
|
|
29
|
+
"defaultValue": null,
|
|
30
|
+
"description": "Called when the dialog should close (cancel, confirm, backdrop click, Escape)"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "open",
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"required": true,
|
|
36
|
+
"defaultValue": null,
|
|
37
|
+
"description": "Whether the dialog is open"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "title",
|
|
41
|
+
"type": "string",
|
|
42
|
+
"required": true,
|
|
43
|
+
"defaultValue": null,
|
|
44
|
+
"description": "Dialog title"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "cancelLabel",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"required": false,
|
|
50
|
+
"defaultValue": "Cancel",
|
|
51
|
+
"description": "Cancel button label; defaults to \"Cancel\""
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "confirmLabel",
|
|
55
|
+
"type": "string",
|
|
56
|
+
"required": false,
|
|
57
|
+
"defaultValue": "Confirm",
|
|
58
|
+
"description": "Confirm button label; defaults to \"Confirm\""
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "variant",
|
|
62
|
+
"type": "\"default\" | \"danger\"",
|
|
63
|
+
"required": false,
|
|
64
|
+
"defaultValue": "default",
|
|
65
|
+
"description": "Renders the confirm button as a destructive action; defaults to \"default\""
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"functions": []
|
|
71
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@behivetech/molecules.confirm-dialog",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
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",
|
|
7
7
|
"private": false,
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"types": "./dist/index.d.ts",
|
|
@@ -27,33 +30,32 @@
|
|
|
27
30
|
"tags": []
|
|
28
31
|
},
|
|
29
32
|
"dependencies": {
|
|
30
|
-
"@behivetech/atoms.button": "0.5.
|
|
31
|
-
"@behivetech/atoms.modal": "0.4.
|
|
33
|
+
"@behivetech/atoms.button": "0.5.2",
|
|
34
|
+
"@behivetech/atoms.modal": "0.4.3",
|
|
35
|
+
"@behivetech/get-class-name": "0.1.0"
|
|
32
36
|
},
|
|
33
37
|
"peerDependencies": {
|
|
34
38
|
"react": "^19.2.7",
|
|
35
39
|
"react-dom": "^19.2.7"
|
|
36
40
|
},
|
|
37
41
|
"devDependencies": {
|
|
42
|
+
"@bht-component-registry/env": "0.1.0",
|
|
38
43
|
"@types/react": "19.2.17",
|
|
39
44
|
"@types/react-dom": "19.2.3",
|
|
40
45
|
"eslint": "^9.39.5",
|
|
41
46
|
"tsup": "^8.5.1",
|
|
42
47
|
"typescript": "^6.0.3",
|
|
43
|
-
"vitest": "^4.1.10"
|
|
44
|
-
"@bht-component-registry/class-names": "0.0.6",
|
|
45
|
-
"@bht-component-registry/env": "0.1.0"
|
|
48
|
+
"vitest": "^4.1.10"
|
|
46
49
|
},
|
|
47
50
|
"repository": {
|
|
48
51
|
"type": "git",
|
|
49
52
|
"url": "https://github.com/behivetech/bht-galaxy.git",
|
|
50
53
|
"directory": "registry/behivetech/molecules/confirm-dialog"
|
|
51
54
|
},
|
|
52
|
-
"homepage": "https://
|
|
55
|
+
"homepage": "https://platform.behivetech.com/behivetech/molecules/confirm-dialog",
|
|
53
56
|
"publishConfig": {
|
|
54
|
-
"registry": "https://
|
|
55
|
-
"access": "public"
|
|
56
|
-
"provenance": true
|
|
57
|
+
"registry": "https://npm.pkg.github.com",
|
|
58
|
+
"access": "public"
|
|
57
59
|
},
|
|
58
60
|
"scripts": {
|
|
59
61
|
"build": "tsup && bht-registry-docgen",
|