@haklex/rich-renderer-banner 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 +42 -11
- package/dist/BannerEditRenderer.d.ts +1 -1
- package/dist/BannerEditRenderer.d.ts.map +1 -1
- package/dist/{BannerRenderer-L8GV-X-_.js → BannerRenderer-CQJ0QF0E.js} +2 -8
- package/dist/BannerRenderer.d.ts +1 -1
- package/dist/BannerRenderer.d.ts.map +1 -1
- package/dist/index.mjs +5 -14
- package/dist/static.mjs +1 -1
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -1,31 +1,62 @@
|
|
|
1
1
|
# @haklex/rich-renderer-banner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Banner block renderer supporting info, success, warning, and error variants.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
pnpm add @haklex/rich-renderer-banner
|
|
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 { BannerRenderer } from '@haklex/rich-renderer-banner'
|
|
22
|
-
import type { RendererConfig } from '@haklex/rich-editor'
|
|
21
|
+
import { BannerRenderer } from '@haklex/rich-renderer-banner/static'
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
// Register in a static RendererConfig
|
|
24
|
+
const rendererConfig = {
|
|
25
|
+
// ...other renderers
|
|
25
26
|
Banner: BannerRenderer,
|
|
26
27
|
}
|
|
27
28
|
```
|
|
28
29
|
|
|
30
|
+
For edit mode:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { BannerEditRenderer } from '@haklex/rich-renderer-banner'
|
|
34
|
+
|
|
35
|
+
const editRendererConfig = {
|
|
36
|
+
// ...other renderers
|
|
37
|
+
Banner: BannerEditRenderer,
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Exports
|
|
42
|
+
|
|
43
|
+
### Components
|
|
44
|
+
|
|
45
|
+
- `BannerRenderer` — Static (read-only) renderer for banner blocks
|
|
46
|
+
- `BannerEditRenderer` — Edit (interactive) renderer with variant selection
|
|
47
|
+
|
|
48
|
+
### Sub-path Exports
|
|
49
|
+
|
|
50
|
+
| Path | Description |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `@haklex/rich-renderer-banner` | Full exports (edit + static) |
|
|
53
|
+
| `@haklex/rich-renderer-banner/static` | Static-only renderer |
|
|
54
|
+
| `@haklex/rich-renderer-banner/style.css` | Stylesheet |
|
|
55
|
+
|
|
56
|
+
## Part of Haklex
|
|
57
|
+
|
|
58
|
+
This package is part of the [Haklex](../../README.md) rich editor ecosystem.
|
|
59
|
+
|
|
29
60
|
## License
|
|
30
61
|
|
|
31
62
|
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BannerRendererProps } from '@haklex/rich-editor';
|
|
1
|
+
import { BannerRendererProps } from '@haklex/rich-editor/renderers';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
export declare const BannerEditRenderer: FC<BannerRendererProps>;
|
|
4
4
|
//# sourceMappingURL=BannerEditRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerEditRenderer.d.ts","sourceRoot":"","sources":["../src/BannerEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BannerEditRenderer.d.ts","sourceRoot":"","sources":["../src/BannerEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,mBAAmB,CA2BtD,CAAC"}
|
|
@@ -125,20 +125,14 @@ const BANNER_LABELS = {
|
|
|
125
125
|
warning: "Warning",
|
|
126
126
|
caution: "Caution"
|
|
127
127
|
};
|
|
128
|
-
const ALL_TYPES = [
|
|
129
|
-
"note",
|
|
130
|
-
"tip",
|
|
131
|
-
"important",
|
|
132
|
-
"warning",
|
|
133
|
-
"caution"
|
|
134
|
-
];
|
|
128
|
+
const ALL_TYPES = ["note", "tip", "important", "warning", "caution"];
|
|
135
129
|
const BannerRenderer = ({ type }) => {
|
|
136
130
|
const Icon = BANNER_ICONS[type];
|
|
137
131
|
return /* @__PURE__ */ jsx(
|
|
138
132
|
"span",
|
|
139
133
|
{
|
|
140
134
|
className: `${bannerIcon} ${bannerIconType({ type })} ${semanticClassNames.icon} ${semanticTypeClassNames.icon[type]}`,
|
|
141
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
135
|
+
children: /* @__PURE__ */ jsx(Icon, { height: "1em", width: "1em" })
|
|
142
136
|
}
|
|
143
137
|
);
|
|
144
138
|
};
|
package/dist/BannerRenderer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerRenderer.d.ts","sourceRoot":"","sources":["../src/BannerRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BannerRenderer.d.ts","sourceRoot":"","sources":["../src/BannerRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,UAAU,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,WAAW,CAAC,CAM5D,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAMpD,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,UAAU,EAAuD,CAAC;AAE1F,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CASlD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@haklex/rich-editor-ui";
|
|
3
|
-
import { B as BannerRenderer, b as bannerTrigger, a as bannerIcon, s as semanticClassNames, c as semanticTypeClassNames, d as BANNER_ICONS, e as bannerIconType, A as ALL_TYPES, f as bannerMenuIcon, g as BANNER_LABELS } from "./BannerRenderer-
|
|
4
|
-
const BannerEditRenderer = ({
|
|
5
|
-
type,
|
|
6
|
-
editable,
|
|
7
|
-
onTypeChange
|
|
8
|
-
}) => {
|
|
3
|
+
import { B as BannerRenderer, b as bannerTrigger, a as bannerIcon, s as semanticClassNames, c as semanticTypeClassNames, d as BANNER_ICONS, e as bannerIconType, A as ALL_TYPES, f as bannerMenuIcon, g as BANNER_LABELS } from "./BannerRenderer-CQJ0QF0E.js";
|
|
4
|
+
const BannerEditRenderer = ({ type, editable, onTypeChange }) => {
|
|
9
5
|
if (!editable || !onTypeChange) {
|
|
10
6
|
return /* @__PURE__ */ jsx(BannerRenderer, { type });
|
|
11
7
|
}
|
|
@@ -15,18 +11,13 @@ const BannerEditRenderer = ({
|
|
|
15
11
|
DropdownMenuTrigger,
|
|
16
12
|
{
|
|
17
13
|
className: `${bannerTrigger} ${bannerIcon} ${bannerIconType({ type })} ${semanticClassNames.icon} ${semanticTypeClassNames.icon[type]}`,
|
|
18
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
14
|
+
children: /* @__PURE__ */ jsx(Icon, { height: "1em", width: "1em" })
|
|
19
15
|
}
|
|
20
16
|
),
|
|
21
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
17
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", sideOffset: 6, children: ALL_TYPES.map((t) => {
|
|
22
18
|
const ItemIcon = BANNER_ICONS[t];
|
|
23
19
|
return /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => onTypeChange(t), children: [
|
|
24
|
-
/* @__PURE__ */ jsx(
|
|
25
|
-
ItemIcon,
|
|
26
|
-
{
|
|
27
|
-
className: `${bannerMenuIcon} ${bannerIconType({ type: t })}`
|
|
28
|
-
}
|
|
29
|
-
),
|
|
20
|
+
/* @__PURE__ */ jsx(ItemIcon, { className: `${bannerMenuIcon} ${bannerIconType({ type: t })}` }),
|
|
30
21
|
/* @__PURE__ */ jsx("span", { children: BANNER_LABELS[t] })
|
|
31
22
|
] }, t);
|
|
32
23
|
}) })
|
package/dist/static.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-renderer-banner",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.65",
|
|
3
|
+
"version": "0.0.67",
|
|
5
4
|
"description": "Banner renderer for haklex rich editor",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Innei/haklex.git",
|
|
8
|
+
"directory": "packages/rich-renderer-banner"
|
|
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-
|
|
30
|
-
"@haklex/rich-
|
|
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
|
},
|