@haklex/rich-renderer-alert 0.0.65 → 0.0.67
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 +40 -15
- package/dist/AlertEditRenderer.d.ts +1 -1
- package/dist/AlertEditRenderer.d.ts.map +1 -1
- package/dist/{AlertRenderer-Dx_WBahX.js → AlertRenderer-D578-dJz.js} +1 -7
- package/dist/AlertRenderer.d.ts +1 -1
- package/dist/AlertRenderer.d.ts.map +1 -1
- package/dist/index.mjs +4 -13
- package/dist/static.mjs +1 -1
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -1,37 +1,62 @@
|
|
|
1
1
|
# @haklex/rich-renderer-alert
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Alert/callout block renderer supporting five severity levels: note, tip, important, warning, and caution.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
pnpm add @haklex/rich-renderer-alert
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Peer Dependencies
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
| Package | Version |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `react` | `>=19` |
|
|
16
|
+
| `react-dom` | `>=19` |
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Usage
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
```tsx
|
|
21
|
+
import { AlertRenderer } from '@haklex/rich-renderer-alert/static'
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
// Register in a static RendererConfig
|
|
24
|
+
const rendererConfig = {
|
|
25
|
+
// ...other renderers
|
|
26
|
+
Alert: AlertRenderer,
|
|
27
|
+
}
|
|
28
|
+
```
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
For edit mode:
|
|
25
31
|
|
|
26
32
|
```tsx
|
|
27
|
-
import {
|
|
28
|
-
import type { RendererConfig } from '@haklex/rich-editor'
|
|
33
|
+
import { AlertEditRenderer } from '@haklex/rich-renderer-alert'
|
|
29
34
|
|
|
30
|
-
const
|
|
31
|
-
|
|
35
|
+
const editRendererConfig = {
|
|
36
|
+
// ...other renderers
|
|
37
|
+
Alert: AlertEditRenderer,
|
|
32
38
|
}
|
|
33
39
|
```
|
|
34
40
|
|
|
41
|
+
## Exports
|
|
42
|
+
|
|
43
|
+
### Components
|
|
44
|
+
|
|
45
|
+
- `AlertRenderer` — Static (read-only) renderer for alert/callout blocks
|
|
46
|
+
- `AlertEditRenderer` — Edit (interactive) renderer with severity selection
|
|
47
|
+
|
|
48
|
+
### Sub-path Exports
|
|
49
|
+
|
|
50
|
+
| Path | Description |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `@haklex/rich-renderer-alert` | Full exports (edit + static) |
|
|
53
|
+
| `@haklex/rich-renderer-alert/static` | Static-only renderer |
|
|
54
|
+
| `@haklex/rich-renderer-alert/style.css` | Stylesheet |
|
|
55
|
+
|
|
56
|
+
## Part of Haklex
|
|
57
|
+
|
|
58
|
+
This package is part of the [Haklex](../../README.md) rich editor ecosystem.
|
|
59
|
+
|
|
35
60
|
## License
|
|
36
61
|
|
|
37
62
|
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlertRendererProps } from '@haklex/rich-editor';
|
|
1
|
+
import { AlertRendererProps } from '@haklex/rich-editor/renderers';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
export declare const AlertEditRenderer: FC<AlertRendererProps>;
|
|
4
4
|
//# sourceMappingURL=AlertEditRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertEditRenderer.d.ts","sourceRoot":"","sources":["../src/AlertEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AlertEditRenderer.d.ts","sourceRoot":"","sources":["../src/AlertEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAQxE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,kBAAkB,CAgCpD,CAAC"}
|
|
@@ -127,13 +127,7 @@ const ALERT_LABELS = {
|
|
|
127
127
|
warning: "Warning",
|
|
128
128
|
caution: "Caution"
|
|
129
129
|
};
|
|
130
|
-
const ALL_TYPES = [
|
|
131
|
-
"note",
|
|
132
|
-
"tip",
|
|
133
|
-
"important",
|
|
134
|
-
"warning",
|
|
135
|
-
"caution"
|
|
136
|
-
];
|
|
130
|
+
const ALL_TYPES = ["note", "tip", "important", "warning", "caution"];
|
|
137
131
|
const AlertRenderer = ({ type }) => {
|
|
138
132
|
const Icon = ALERT_ICONS[type];
|
|
139
133
|
const label = ALERT_LABELS[type];
|
package/dist/AlertRenderer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertRenderer.d.ts","sourceRoot":"","sources":["../src/AlertRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AlertRenderer.d.ts","sourceRoot":"","sources":["../src/AlertRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAE5C,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,WAAW,CAAC,CAM1D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMlD,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAAS,EAAuD,CAAC;AAEzF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAYhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@haklex/rich-editor-ui";
|
|
3
3
|
import { ChevronDown } from "lucide-react";
|
|
4
|
-
import { A as AlertRenderer, a as alertHeader, s as semanticClassNames, b as semanticTypeClassNames, c as alertTrigger, d as ALERT_ICONS, e as alertIcon, f as ALERT_LABELS, g as alertLabel, h as alertChevron, i as ALL_TYPES, j as alertMenuIcon, k as alertType } from "./AlertRenderer-
|
|
5
|
-
const AlertEditRenderer = ({
|
|
6
|
-
type,
|
|
7
|
-
editable,
|
|
8
|
-
onTypeChange
|
|
9
|
-
}) => {
|
|
4
|
+
import { A as AlertRenderer, a as alertHeader, s as semanticClassNames, b as semanticTypeClassNames, c as alertTrigger, d as ALERT_ICONS, e as alertIcon, f as ALERT_LABELS, g as alertLabel, h as alertChevron, i as ALL_TYPES, j as alertMenuIcon, k as alertType } from "./AlertRenderer-D578-dJz.js";
|
|
5
|
+
const AlertEditRenderer = ({ type, editable, onTypeChange }) => {
|
|
10
6
|
if (!editable || !onTypeChange) {
|
|
11
7
|
return /* @__PURE__ */ jsx(AlertRenderer, { type });
|
|
12
8
|
}
|
|
@@ -22,15 +18,10 @@ const AlertEditRenderer = ({
|
|
|
22
18
|
/* @__PURE__ */ jsx("span", { className: `${alertLabel} ${semanticClassNames.label}`, children: label }),
|
|
23
19
|
/* @__PURE__ */ jsx(ChevronDown, { className: alertChevron })
|
|
24
20
|
] }),
|
|
25
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
21
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", sideOffset: 6, children: ALL_TYPES.map((t) => {
|
|
26
22
|
const ItemIcon = ALERT_ICONS[t];
|
|
27
23
|
return /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => onTypeChange(t), children: [
|
|
28
|
-
/* @__PURE__ */ jsx(
|
|
29
|
-
ItemIcon,
|
|
30
|
-
{
|
|
31
|
-
className: `${alertMenuIcon} ${alertType({ type: t })}`
|
|
32
|
-
}
|
|
33
|
-
),
|
|
24
|
+
/* @__PURE__ */ jsx(ItemIcon, { className: `${alertMenuIcon} ${alertType({ type: t })}` }),
|
|
34
25
|
/* @__PURE__ */ jsx("span", { children: ALERT_LABELS[t] })
|
|
35
26
|
] }, t);
|
|
36
27
|
}) })
|
package/dist/static.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-renderer-alert",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.65",
|
|
3
|
+
"version": "0.0.67",
|
|
5
4
|
"description": "Alert renderer for haklex rich editor",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Innei/haklex.git",
|
|
8
|
+
"directory": "packages/rich-renderer-alert"
|
|
9
|
+
},
|
|
6
10
|
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
7
12
|
"exports": {
|
|
8
13
|
".": {
|
|
9
14
|
"import": "./dist/index.mjs",
|
|
@@ -19,15 +24,11 @@
|
|
|
19
24
|
"files": [
|
|
20
25
|
"dist"
|
|
21
26
|
],
|
|
22
|
-
"peerDependencies": {
|
|
23
|
-
"react": ">=19",
|
|
24
|
-
"react-dom": ">=19"
|
|
25
|
-
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"lucide-react": "^0.577.0",
|
|
28
|
-
"@haklex/rich-editor
|
|
29
|
-
"@haklex/rich-editor": "0.0.
|
|
30
|
-
"@haklex/rich-style-token": "0.0.
|
|
29
|
+
"@haklex/rich-editor": "0.0.67",
|
|
30
|
+
"@haklex/rich-editor-ui": "0.0.67",
|
|
31
|
+
"@haklex/rich-style-token": "0.0.67"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/react": "^19.2.14",
|
|
@@ -41,6 +42,10 @@
|
|
|
41
42
|
"vite": "^7.3.1",
|
|
42
43
|
"vite-plugin-dts": "^4.5.4"
|
|
43
44
|
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": ">=19",
|
|
47
|
+
"react-dom": ">=19"
|
|
48
|
+
},
|
|
44
49
|
"publishConfig": {
|
|
45
50
|
"access": "public"
|
|
46
51
|
},
|