@aristobyte-ui/message-box 2.3.5 → 2.4.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/es/src/main/components/MessageBox/index.js +25 -0
- package/es/src/main/components/index.js +1 -0
- package/es/src/main/index.js +1 -0
- package/lib/src/main/components/MessageBox/index.js +62 -0
- package/lib/src/main/components/index.js +17 -0
- package/lib/src/main/index.js +17 -0
- package/package.json +2 -2
- package/README.md +0 -87
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Icons } from '@aristobyte-ui/utils';
|
|
3
|
+
import './MessageBox.scss';
|
|
4
|
+
var renderIcon = function (variant) {
|
|
5
|
+
switch (variant) {
|
|
6
|
+
case 'warning':
|
|
7
|
+
return Icons.Warning;
|
|
8
|
+
case 'success':
|
|
9
|
+
return Icons.Success;
|
|
10
|
+
case 'error':
|
|
11
|
+
return Icons.Error;
|
|
12
|
+
case 'info':
|
|
13
|
+
default:
|
|
14
|
+
return Icons.Info;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export var MessageBox = function (_a) {
|
|
18
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.withIcon, withIcon = _c === void 0 ? false : _c, _d = _a.customIcon, customIcon = _d === void 0 ? null : _d, _e = _a.radius, radius = _e === void 0 ? 'md' : _e, _f = _a.type, type = _f === void 0 ? 'outline' : _f, _g = _a.className, className = _g === void 0 ? '' : _g, _h = _a.style, style = _h === void 0 ? {} : _h;
|
|
19
|
+
return (React.createElement("div", { className: "message-box ".concat("message-box-type--".concat(type), " ").concat("message-box-radius--".concat(radius), " ").concat("message-box--".concat(variant), " ").concat(className), style: style },
|
|
20
|
+
withIcon && (React.createElement("span", { className: "message-box__icon ".concat("message-box__icon--".concat(variant)) }, (customIcon === null || customIcon === void 0 ? void 0 : customIcon.component({
|
|
21
|
+
size: customIcon.size,
|
|
22
|
+
color: customIcon.color,
|
|
23
|
+
})) || renderIcon(variant)({}))),
|
|
24
|
+
React.createElement("p", { className: "message-box__content", dangerouslySetInnerHTML: { __html: children || '' } })));
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MessageBox';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MessageBox = void 0;
|
|
37
|
+
var React = __importStar(require("react"));
|
|
38
|
+
var utils_1 = require("@aristobyte-ui/utils");
|
|
39
|
+
require("./MessageBox.scss");
|
|
40
|
+
var renderIcon = function (variant) {
|
|
41
|
+
switch (variant) {
|
|
42
|
+
case 'warning':
|
|
43
|
+
return utils_1.Icons.Warning;
|
|
44
|
+
case 'success':
|
|
45
|
+
return utils_1.Icons.Success;
|
|
46
|
+
case 'error':
|
|
47
|
+
return utils_1.Icons.Error;
|
|
48
|
+
case 'info':
|
|
49
|
+
default:
|
|
50
|
+
return utils_1.Icons.Info;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var MessageBox = function (_a) {
|
|
54
|
+
var children = _a.children, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.withIcon, withIcon = _c === void 0 ? false : _c, _d = _a.customIcon, customIcon = _d === void 0 ? null : _d, _e = _a.radius, radius = _e === void 0 ? 'md' : _e, _f = _a.type, type = _f === void 0 ? 'outline' : _f, _g = _a.className, className = _g === void 0 ? '' : _g, _h = _a.style, style = _h === void 0 ? {} : _h;
|
|
55
|
+
return (React.createElement("div", { className: "message-box ".concat("message-box-type--".concat(type), " ").concat("message-box-radius--".concat(radius), " ").concat("message-box--".concat(variant), " ").concat(className), style: style },
|
|
56
|
+
withIcon && (React.createElement("span", { className: "message-box__icon ".concat("message-box__icon--".concat(variant)) }, (customIcon === null || customIcon === void 0 ? void 0 : customIcon.component({
|
|
57
|
+
size: customIcon.size,
|
|
58
|
+
color: customIcon.color,
|
|
59
|
+
})) || renderIcon(variant)({}))),
|
|
60
|
+
React.createElement("p", { className: "message-box__content", dangerouslySetInnerHTML: { __html: children || '' } })));
|
|
61
|
+
};
|
|
62
|
+
exports.MessageBox = MessageBox;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MessageBox"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components"), exports);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aristobyte-ui/message-box",
|
|
3
3
|
"description": "A fully-typed, modular, and flexible MessageBox component for AristoByteUI, supporting multiple variants, types, border-radius options, and optional icons.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"author": "AristoByte <info@aristobyte.com>",
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
"react-dom": "^19.1.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@aristobyte-ui/utils": "2.
|
|
51
|
+
"@aristobyte-ui/utils": "2.4.0"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/README.md
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# @aristobyte-ui/message-box
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="https://img.shields.io/badge/TypeScript-5.8-blue?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
|
|
5
|
-
<img src="https://img.shields.io/badge/Build-Turbo-green?style=for-the-badge&logo=turbo&logoColor=white" alt="TurboRepo" />
|
|
6
|
-
<img src="https://img.shields.io/badge/Lint-Strict-red?style=for-the-badge&logo=eslint&logoColor=white" alt="ESLint" />
|
|
7
|
-
<img src="https://img.shields.io/badge/License-MIT-black?style=for-the-badge&logo=open-source-initiative&logoColor=white" alt="License" />
|
|
8
|
-
<img src="https://img.shields.io/badge/AristoByte-UI-purple?style=for-the-badge&logo=react&logoColor=white" alt="AristoByte UI" />
|
|
9
|
-
<img src="https://img.shields.io/badge/Node-20.17.0+-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js >=20.17.0" />
|
|
10
|
-
<img src="https://img.shields.io/badge/Yarn-1.22+-2C8EBB?style=for-the-badge&logo=yarn&logoColor=white" alt="Yarn >=1.22" />
|
|
11
|
-
<img src="https://img.shields.io/badge/NPM-10.8+-CB3837?style=for-the-badge&logo=npm&logoColor=white" alt="NPM >=10.8" />
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
A fully typed, customizable MessageBox component for React, supporting multiple variants, types, border-radius options, and optional icons. Built with AristoByteUI design tokens and SCSS modules, leveraging the `@aristobyte-ui/utils` package for icons.
|
|
15
|
-
|
|
16
|
-
## 📦 Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# Install via Yarn
|
|
20
|
-
yarn add -D @aristobyte-ui/message-box
|
|
21
|
-
|
|
22
|
-
# Or via npm
|
|
23
|
-
npm install -D @aristobyte-ui/message-box
|
|
24
|
-
|
|
25
|
-
# Or via pnpm
|
|
26
|
-
pnpm add -D @aristobyte-ui/message-box
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## 🛠 Usage
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
import { MessageBox } from '@aristobyte-ui/message-box';
|
|
33
|
-
|
|
34
|
-
export default function App() {
|
|
35
|
-
return (
|
|
36
|
-
<div>
|
|
37
|
-
<MessageBox variant="success" type="solid" radius="md" withIcon>
|
|
38
|
-
This is a success message!
|
|
39
|
-
</MessageBox>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## 📂 Presets Available
|
|
46
|
-
|
|
47
|
-
- **Variants**: `default`, `info`, `warning`, `success`, `error`
|
|
48
|
-
- **Types**: `solid`, `outline`, `outline-dashed`, `no-outline`, `glowing`
|
|
49
|
-
- **Radius options**: `none`, `sm`, `md`, `lg`, `full`
|
|
50
|
-
- **Icons**: optional via `withIcon` or custom via `customIcon` prop
|
|
51
|
-
|
|
52
|
-
## 🔧 Example in a Package
|
|
53
|
-
|
|
54
|
-
```tsx
|
|
55
|
-
<MessageBox variant="warning" type="outline-dashed" radius="lg" withIcon>
|
|
56
|
-
Warning! Check your input.
|
|
57
|
-
</MessageBox>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## 📊 Why This Matters
|
|
61
|
-
|
|
62
|
-
- **Performance-first:** Lightweight CSS ensures fast rendering and smooth transitions.
|
|
63
|
-
- **Fully typed:** TypeScript-first API ensures predictable usage and IDE autocomplete.
|
|
64
|
-
- **AristoByteUI ready:** Seamlessly integrates with design tokens and SCSS modules.
|
|
65
|
-
- **Flexible:** Supports multiple variants, types, border-radius options, and optional icons.
|
|
66
|
-
|
|
67
|
-
## 🏆 Philosophy
|
|
68
|
-
|
|
69
|
-
- **Modular architecture:** MessageBox component is fully composable.
|
|
70
|
-
- **Declarative styling:** SCSS modules keep styles maintainable and scoped.
|
|
71
|
-
- **Strict typing & runtime flexibility:** Props fully typed while allowing runtime overrides.
|
|
72
|
-
- **Developer experience optimized:** Easy to use with predictable behavior and minimal boilerplate.
|
|
73
|
-
|
|
74
|
-
## 📜 License
|
|
75
|
-
|
|
76
|
-
[MIT](./LICENSE) © AristoByte
|
|
77
|
-
|
|
78
|
-
## 🛡 Shields Showcase
|
|
79
|
-
|
|
80
|
-
<p align="center">
|
|
81
|
-
<img src="https://img.shields.io/badge/Consistency-100%25-green?style=for-the-badge&logo=typescript" />
|
|
82
|
-
<img src="https://img.shields.io/badge/Maintained-Active-brightgreen?style=for-the-badge&logo=github" />
|
|
83
|
-
<img src="https://img.shields.io/badge/Strictness-High-critical?style=for-the-badge&logo=eslint" />
|
|
84
|
-
<img src="https://img.shields.io/badge/Declarations-Enabled-blue?style=for-the-badge&logo=typescript" />
|
|
85
|
-
<img src="https://img.shields.io/badge/Monorepo-Turbo-green?style=for-the-badge&logo=monorepo" />
|
|
86
|
-
<img src="https://img.shields.io/badge/Interop-ESM%2FCJS-orange?style=for-the-badge&logo=javascript" />
|
|
87
|
-
</p>
|