@haklex/rich-renderer-alert 0.0.40 → 0.0.41
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/dist/AlertRenderer-Dx_WBahX.js +165 -0
- package/dist/index.mjs +3 -150
- package/dist/static.mjs +5 -0
- package/package.json +4 -4
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { OctagonAlert, TriangleAlert, MessageSquareWarning, Lightbulb, Info } from "lucide-react";
|
|
3
|
+
function toPrimitive(t, r) {
|
|
4
|
+
if ("object" != typeof t || !t) return t;
|
|
5
|
+
var e = t[Symbol.toPrimitive];
|
|
6
|
+
if (void 0 !== e) {
|
|
7
|
+
var i = e.call(t, r);
|
|
8
|
+
if ("object" != typeof i) return i;
|
|
9
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
+
}
|
|
11
|
+
return ("string" === r ? String : Number)(t);
|
|
12
|
+
}
|
|
13
|
+
function toPropertyKey(t) {
|
|
14
|
+
var i = toPrimitive(t, "string");
|
|
15
|
+
return "symbol" == typeof i ? i : String(i);
|
|
16
|
+
}
|
|
17
|
+
function _defineProperty(obj, key, value) {
|
|
18
|
+
key = toPropertyKey(key);
|
|
19
|
+
if (key in obj) {
|
|
20
|
+
Object.defineProperty(obj, key, {
|
|
21
|
+
value,
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
obj[key] = value;
|
|
28
|
+
}
|
|
29
|
+
return obj;
|
|
30
|
+
}
|
|
31
|
+
function ownKeys(e, r) {
|
|
32
|
+
var t = Object.keys(e);
|
|
33
|
+
if (Object.getOwnPropertySymbols) {
|
|
34
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
35
|
+
r && (o = o.filter(function(r2) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
37
|
+
})), t.push.apply(t, o);
|
|
38
|
+
}
|
|
39
|
+
return t;
|
|
40
|
+
}
|
|
41
|
+
function _objectSpread2(e) {
|
|
42
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
43
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
44
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
45
|
+
_defineProperty(e, r2, t[r2]);
|
|
46
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
47
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return e;
|
|
51
|
+
}
|
|
52
|
+
function mapValues(input, fn) {
|
|
53
|
+
var result = {};
|
|
54
|
+
for (var _key in input) {
|
|
55
|
+
result[_key] = fn(input[_key], _key);
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
60
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
61
|
+
var _selections$key;
|
|
62
|
+
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
var createRuntimeFn = (config) => {
|
|
69
|
+
var runtimeFn = (options) => {
|
|
70
|
+
var className = config.defaultClassName;
|
|
71
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
72
|
+
for (var variantName in selections) {
|
|
73
|
+
var _selections$variantNa;
|
|
74
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
75
|
+
if (variantSelection != null) {
|
|
76
|
+
var selection = variantSelection;
|
|
77
|
+
if (typeof selection === "boolean") {
|
|
78
|
+
selection = selection === true ? "true" : "false";
|
|
79
|
+
}
|
|
80
|
+
var selectionClassName = (
|
|
81
|
+
// @ts-expect-error
|
|
82
|
+
config.variantClassNames[variantName][selection]
|
|
83
|
+
);
|
|
84
|
+
if (selectionClassName) {
|
|
85
|
+
className += " " + selectionClassName;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
90
|
+
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
91
|
+
className += " " + compoundClassName;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return className;
|
|
95
|
+
};
|
|
96
|
+
runtimeFn.variants = () => Object.keys(config.variantClassNames);
|
|
97
|
+
runtimeFn.classNames = {
|
|
98
|
+
get base() {
|
|
99
|
+
return config.defaultClassName.split(" ")[0];
|
|
100
|
+
},
|
|
101
|
+
get variants() {
|
|
102
|
+
return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return runtimeFn;
|
|
106
|
+
};
|
|
107
|
+
var semanticClassNames = { header: "rich-alert-header", icon: "rich-alert-icon", label: "rich-alert-label" };
|
|
108
|
+
var semanticTypeClassNames = { header: { note: "rich-alert-header-note", tip: "rich-alert-header-tip", important: "rich-alert-header-important", warning: "rich-alert-header-warning", caution: "rich-alert-header-caution" } };
|
|
109
|
+
var alertType = createRuntimeFn({ defaultClassName: "pq4lod1", variantClassNames: { type: { note: "pq4lod2", tip: "pq4lod3", important: "pq4lod4", warning: "pq4lod5", caution: "pq4lod6" } }, defaultVariants: {}, compoundVariants: [] });
|
|
110
|
+
var alertHeader = "pq4lod7";
|
|
111
|
+
var alertTrigger = "pq4lod8";
|
|
112
|
+
var alertChevron = "pq4lod9";
|
|
113
|
+
var alertIcon = "pq4loda";
|
|
114
|
+
var alertLabel = "pq4lodb";
|
|
115
|
+
var alertMenuIcon = "pq4lodc";
|
|
116
|
+
const ALERT_ICONS = {
|
|
117
|
+
note: Info,
|
|
118
|
+
tip: Lightbulb,
|
|
119
|
+
important: MessageSquareWarning,
|
|
120
|
+
warning: TriangleAlert,
|
|
121
|
+
caution: OctagonAlert
|
|
122
|
+
};
|
|
123
|
+
const ALERT_LABELS = {
|
|
124
|
+
note: "Note",
|
|
125
|
+
tip: "Tip",
|
|
126
|
+
important: "Important",
|
|
127
|
+
warning: "Warning",
|
|
128
|
+
caution: "Caution"
|
|
129
|
+
};
|
|
130
|
+
const ALL_TYPES = [
|
|
131
|
+
"note",
|
|
132
|
+
"tip",
|
|
133
|
+
"important",
|
|
134
|
+
"warning",
|
|
135
|
+
"caution"
|
|
136
|
+
];
|
|
137
|
+
const AlertRenderer = ({ type }) => {
|
|
138
|
+
const Icon = ALERT_ICONS[type];
|
|
139
|
+
const label = ALERT_LABELS[type];
|
|
140
|
+
return /* @__PURE__ */ jsxs(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
className: `${alertHeader} ${alertType({ type })} ${semanticClassNames.header} ${semanticTypeClassNames.header[type]}`,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Icon, { className: `${alertIcon} ${semanticClassNames.icon}` }),
|
|
146
|
+
/* @__PURE__ */ jsx("span", { className: `${alertLabel} ${semanticClassNames.label}`, children: label })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
export {
|
|
152
|
+
AlertRenderer as A,
|
|
153
|
+
alertHeader as a,
|
|
154
|
+
semanticTypeClassNames as b,
|
|
155
|
+
alertTrigger as c,
|
|
156
|
+
ALERT_ICONS as d,
|
|
157
|
+
alertIcon as e,
|
|
158
|
+
ALERT_LABELS as f,
|
|
159
|
+
alertLabel as g,
|
|
160
|
+
alertChevron as h,
|
|
161
|
+
ALL_TYPES as i,
|
|
162
|
+
alertMenuIcon as j,
|
|
163
|
+
alertType as k,
|
|
164
|
+
semanticClassNames as s
|
|
165
|
+
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,154 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@haklex/rich-editor-ui";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
if ("object" != typeof t || !t) return t;
|
|
6
|
-
var e = t[Symbol.toPrimitive];
|
|
7
|
-
if (void 0 !== e) {
|
|
8
|
-
var i = e.call(t, r);
|
|
9
|
-
if ("object" != typeof i) return i;
|
|
10
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
|
-
}
|
|
12
|
-
return ("string" === r ? String : Number)(t);
|
|
13
|
-
}
|
|
14
|
-
function toPropertyKey(t) {
|
|
15
|
-
var i = toPrimitive(t, "string");
|
|
16
|
-
return "symbol" == typeof i ? i : String(i);
|
|
17
|
-
}
|
|
18
|
-
function _defineProperty(obj, key, value) {
|
|
19
|
-
key = toPropertyKey(key);
|
|
20
|
-
if (key in obj) {
|
|
21
|
-
Object.defineProperty(obj, key, {
|
|
22
|
-
value,
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
obj[key] = value;
|
|
29
|
-
}
|
|
30
|
-
return obj;
|
|
31
|
-
}
|
|
32
|
-
function ownKeys(e, r) {
|
|
33
|
-
var t = Object.keys(e);
|
|
34
|
-
if (Object.getOwnPropertySymbols) {
|
|
35
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
36
|
-
r && (o = o.filter(function(r2) {
|
|
37
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
38
|
-
})), t.push.apply(t, o);
|
|
39
|
-
}
|
|
40
|
-
return t;
|
|
41
|
-
}
|
|
42
|
-
function _objectSpread2(e) {
|
|
43
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
44
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
45
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
46
|
-
_defineProperty(e, r2, t[r2]);
|
|
47
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
48
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
return e;
|
|
52
|
-
}
|
|
53
|
-
function mapValues(input, fn) {
|
|
54
|
-
var result = {};
|
|
55
|
-
for (var _key in input) {
|
|
56
|
-
result[_key] = fn(input[_key], _key);
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
61
|
-
for (var key of Object.keys(compoundCheck)) {
|
|
62
|
-
var _selections$key;
|
|
63
|
-
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
};
|
|
69
|
-
var createRuntimeFn = (config) => {
|
|
70
|
-
var runtimeFn = (options) => {
|
|
71
|
-
var className = config.defaultClassName;
|
|
72
|
-
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
73
|
-
for (var variantName in selections) {
|
|
74
|
-
var _selections$variantNa;
|
|
75
|
-
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
76
|
-
if (variantSelection != null) {
|
|
77
|
-
var selection = variantSelection;
|
|
78
|
-
if (typeof selection === "boolean") {
|
|
79
|
-
selection = selection === true ? "true" : "false";
|
|
80
|
-
}
|
|
81
|
-
var selectionClassName = (
|
|
82
|
-
// @ts-expect-error
|
|
83
|
-
config.variantClassNames[variantName][selection]
|
|
84
|
-
);
|
|
85
|
-
if (selectionClassName) {
|
|
86
|
-
className += " " + selectionClassName;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
91
|
-
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
92
|
-
className += " " + compoundClassName;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return className;
|
|
96
|
-
};
|
|
97
|
-
runtimeFn.variants = () => Object.keys(config.variantClassNames);
|
|
98
|
-
runtimeFn.classNames = {
|
|
99
|
-
get base() {
|
|
100
|
-
return config.defaultClassName.split(" ")[0];
|
|
101
|
-
},
|
|
102
|
-
get variants() {
|
|
103
|
-
return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
return runtimeFn;
|
|
107
|
-
};
|
|
108
|
-
var semanticClassNames = { header: "rich-alert-header", icon: "rich-alert-icon", label: "rich-alert-label" };
|
|
109
|
-
var semanticTypeClassNames = { header: { note: "rich-alert-header-note", tip: "rich-alert-header-tip", important: "rich-alert-header-important", warning: "rich-alert-header-warning", caution: "rich-alert-header-caution" } };
|
|
110
|
-
var alertType = createRuntimeFn({ defaultClassName: "pq4lod1", variantClassNames: { type: { note: "pq4lod2", tip: "pq4lod3", important: "pq4lod4", warning: "pq4lod5", caution: "pq4lod6" } }, defaultVariants: {}, compoundVariants: [] });
|
|
111
|
-
var alertHeader = "pq4lod7";
|
|
112
|
-
var alertTrigger = "pq4lod8";
|
|
113
|
-
var alertChevron = "pq4lod9";
|
|
114
|
-
var alertIcon = "pq4loda";
|
|
115
|
-
var alertLabel = "pq4lodb";
|
|
116
|
-
var alertMenuIcon = "pq4lodc";
|
|
117
|
-
const ALERT_ICONS = {
|
|
118
|
-
note: Info,
|
|
119
|
-
tip: Lightbulb,
|
|
120
|
-
important: MessageSquareWarning,
|
|
121
|
-
warning: TriangleAlert,
|
|
122
|
-
caution: OctagonAlert
|
|
123
|
-
};
|
|
124
|
-
const ALERT_LABELS = {
|
|
125
|
-
note: "Note",
|
|
126
|
-
tip: "Tip",
|
|
127
|
-
important: "Important",
|
|
128
|
-
warning: "Warning",
|
|
129
|
-
caution: "Caution"
|
|
130
|
-
};
|
|
131
|
-
const ALL_TYPES = [
|
|
132
|
-
"note",
|
|
133
|
-
"tip",
|
|
134
|
-
"important",
|
|
135
|
-
"warning",
|
|
136
|
-
"caution"
|
|
137
|
-
];
|
|
138
|
-
const AlertRenderer = ({ type }) => {
|
|
139
|
-
const Icon = ALERT_ICONS[type];
|
|
140
|
-
const label = ALERT_LABELS[type];
|
|
141
|
-
return /* @__PURE__ */ jsxs(
|
|
142
|
-
"div",
|
|
143
|
-
{
|
|
144
|
-
className: `${alertHeader} ${alertType({ type })} ${semanticClassNames.header} ${semanticTypeClassNames.header[type]}`,
|
|
145
|
-
children: [
|
|
146
|
-
/* @__PURE__ */ jsx(Icon, { className: `${alertIcon} ${semanticClassNames.icon}` }),
|
|
147
|
-
/* @__PURE__ */ jsx("span", { className: `${alertLabel} ${semanticClassNames.label}`, children: label })
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
};
|
|
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-Dx_WBahX.js";
|
|
152
5
|
const AlertEditRenderer = ({
|
|
153
6
|
type,
|
|
154
7
|
editable,
|
package/dist/static.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-renderer-alert",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "Alert renderer for haklex rich editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lucide-react": "^0.574.0",
|
|
24
|
-
"@haklex/rich-editor": "0.0.
|
|
25
|
-
"@haklex/rich-style-token": "0.0.
|
|
26
|
-
"@haklex/rich-editor
|
|
24
|
+
"@haklex/rich-editor-ui": "0.0.41",
|
|
25
|
+
"@haklex/rich-style-token": "0.0.41",
|
|
26
|
+
"@haklex/rich-editor": "0.0.41"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/react": "^19.2.14",
|