ag-common 0.0.675 → 0.0.677
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.
|
@@ -10,4 +10,4 @@ export interface IImage {
|
|
|
10
10
|
/** if true is counted as a small image, and will be sized accordingly. default false */
|
|
11
11
|
small?: boolean;
|
|
12
12
|
}
|
|
13
|
-
export declare const Image: (p: ImgHTMLAttributes<HTMLImageElement> & IImage) => React.JSX.Element;
|
|
13
|
+
export declare const Image: (p: ImgHTMLAttributes<HTMLImageElement> & IImage) => React.JSX.Element | null;
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
3
26
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
4
27
|
var t = {};
|
|
5
28
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -17,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
41
|
exports.Image = void 0;
|
|
19
42
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
20
|
-
const react_1 =
|
|
43
|
+
const react_1 = __importStar(require("react"));
|
|
21
44
|
const media_1 = require("../../styles/media");
|
|
22
45
|
const Base = styled_1.default.img `
|
|
23
46
|
object-fit: contain;
|
|
@@ -62,6 +85,10 @@ const Base = styled_1.default.img `
|
|
|
62
85
|
`;
|
|
63
86
|
const Image = (p) => {
|
|
64
87
|
const { smalltop, bigonly, smallonly, small } = p, p1 = __rest(p, ["smalltop", "bigonly", "smallonly", "small"]);
|
|
65
|
-
|
|
88
|
+
const [display, setDisplay] = (0, react_1.useState)(true);
|
|
89
|
+
if (!display) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return (react_1.default.createElement(Base, Object.assign({}, p1, { "data-smalltop": smalltop, "data-bigonly": bigonly, "data-smallonly": smallonly, "data-small": small, onError: () => setDisplay(false) })));
|
|
66
93
|
};
|
|
67
94
|
exports.Image = Image;
|
|
@@ -6,20 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Markdown = void 0;
|
|
7
7
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const common_1 = require("../../../common");
|
|
9
10
|
const array_1 = require("../../../common/helpers/array");
|
|
10
11
|
const trim_1 = require("../../../common/helpers/string/trim");
|
|
11
|
-
const injectTable = ({ tableRows, preprocessText, }) => {
|
|
12
|
-
|
|
13
|
-
react_1.default.createElement("
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}))));
|
|
22
|
-
};
|
|
12
|
+
const injectTable = ({ tableRows, preprocessText, }) => (react_1.default.createElement("table", { key: (0, common_1.hashCode)(JSON.stringify(tableRows)) },
|
|
13
|
+
react_1.default.createElement("thead", null,
|
|
14
|
+
react_1.default.createElement("tr", null, tableRows[0]
|
|
15
|
+
.split('|')
|
|
16
|
+
.map((header) => header.trim())
|
|
17
|
+
.map((header) => (react_1.default.createElement("th", { key: header }, preprocessText(header)))))),
|
|
18
|
+
react_1.default.createElement("tbody", null, tableRows.slice(2).map((row) => {
|
|
19
|
+
const cells = row.split('|').map((cell) => cell.trim());
|
|
20
|
+
return (react_1.default.createElement("tr", { key: row }, cells.map((cell) => (react_1.default.createElement("td", { key: cell }, preprocessText(cell))))));
|
|
21
|
+
}))));
|
|
23
22
|
const injectGroup = ({ output, pos, wrap, }) => {
|
|
24
23
|
const outputEndIndex = output.length;
|
|
25
24
|
const sum = [];
|
|
@@ -40,11 +39,12 @@ function renderMarkdown({ markdown, preprocessText = (s) => s, }) {
|
|
|
40
39
|
let a = -1;
|
|
41
40
|
do {
|
|
42
41
|
a += 1;
|
|
43
|
-
const line = (_a = lines
|
|
42
|
+
const line = (_a = lines[a]) !== null && _a !== void 0 ? _a : '';
|
|
43
|
+
const la = line + a;
|
|
44
44
|
const star = /\*\*(.*?)\*\*/gim;
|
|
45
45
|
//handle inline **s
|
|
46
46
|
if (line.match(star)) {
|
|
47
|
-
output.push(react_1.default.createElement("p", { key:
|
|
47
|
+
output.push(react_1.default.createElement("p", { key: la, dangerouslySetInnerHTML: {
|
|
48
48
|
__html: line.replace(star, `<b>$1</b>`).trim(),
|
|
49
49
|
} }));
|
|
50
50
|
continue;
|
|
@@ -115,20 +115,20 @@ function renderMarkdown({ markdown, preprocessText = (s) => s, }) {
|
|
|
115
115
|
else if (line.startsWith('*') || line.startsWith('-')) {
|
|
116
116
|
const t = line.slice(2).trim();
|
|
117
117
|
if (t.length > 0) {
|
|
118
|
-
output.push(react_1.default.createElement("li",
|
|
118
|
+
output.push(react_1.default.createElement("li", { key: t }, preprocessText(t)));
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
//ol - li
|
|
122
122
|
else if (line.match(/^[0-9]+\./gim)) {
|
|
123
123
|
const t = line.slice(3).trim();
|
|
124
124
|
if (t.length > 0) {
|
|
125
|
-
output.push(react_1.default.createElement("li", { key:
|
|
125
|
+
output.push(react_1.default.createElement("li", { key: t }, preprocessText(t)));
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
//text
|
|
129
129
|
else {
|
|
130
130
|
if (line.length > 0) {
|
|
131
|
-
output.push(react_1.default.createElement("p", { key:
|
|
131
|
+
output.push(react_1.default.createElement("p", { key: la }, preprocessText(line)));
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
} while (a < lines.length);
|
|
@@ -126,17 +126,17 @@ const Toast = ({ toast, close, style, }) => {
|
|
|
126
126
|
return () => clearTimeout(timeout);
|
|
127
127
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
128
128
|
}, []);
|
|
129
|
+
const closeStyle = { color: style.color, '--bg': style.borderColor };
|
|
130
|
+
const toastStyle = Object.assign(Object.assign({}, style), { boxShadow: `hsl(from ${style.borderColor} h s 25%) 0px 7px 29px 0px` });
|
|
129
131
|
if (toast.type === 'standard') {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
react_1.default.createElement(CloseStyle, { onClick: () => close(toast.id), style: st }, "\u00D7"),
|
|
132
|
+
return (react_1.default.createElement(ToastStyle, { style: toastStyle },
|
|
133
|
+
react_1.default.createElement(CloseStyle, { onClick: () => close(toast.id), style: closeStyle }, "\u00D7"),
|
|
133
134
|
react_1.default.createElement(Icon, { style: { fill: style.color } }, icon),
|
|
134
135
|
toast.message,
|
|
135
136
|
closeMs !== undefined && (react_1.default.createElement(ProgressBarStyled, { max: 100, min: 0, dotPercentages: null, transitionToMs: closeMs }))));
|
|
136
137
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
react_1.default.createElement(CloseStyle, { onClick: () => close(toast.id), style: st }, "\u00D7"),
|
|
138
|
+
return (react_1.default.createElement(ToastStyle, { style: toastStyle },
|
|
139
|
+
react_1.default.createElement(CloseStyle, { onClick: () => close(toast.id), style: closeStyle }, "\u00D7"),
|
|
140
140
|
react_1.default.createElement(FlexRow_1.FlexRow, { noWrap: true, center: true },
|
|
141
141
|
toast.icon === undefined && react_1.default.createElement(Icon, null, icon),
|
|
142
142
|
toast.icon,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.677",
|
|
3
3
|
"name": "ag-common",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
@@ -45,25 +45,26 @@
|
|
|
45
45
|
"@emotion/react": "11.11.4",
|
|
46
46
|
"@emotion/styled": "11.11.0",
|
|
47
47
|
"@smithy/types": "2.12.0",
|
|
48
|
-
"@storybook/addon-actions": "
|
|
49
|
-
"@storybook/addon-docs": "
|
|
50
|
-
"@storybook/addon-essentials": "
|
|
51
|
-
"@storybook/addon-interactions": "
|
|
52
|
-
"@storybook/addon-links": "
|
|
48
|
+
"@storybook/addon-actions": "8.0.4",
|
|
49
|
+
"@storybook/addon-docs": "8.0.4",
|
|
50
|
+
"@storybook/addon-essentials": "8.0.4",
|
|
51
|
+
"@storybook/addon-interactions": "8.0.4",
|
|
52
|
+
"@storybook/addon-links": "8.0.4",
|
|
53
|
+
"@storybook/addon-webpack5-compiler-swc": "1.0.2",
|
|
53
54
|
"@storybook/addons": "7.6.17",
|
|
54
|
-
"@storybook/react": "
|
|
55
|
-
"@storybook/react-webpack5": "
|
|
56
|
-
"@storybook/theming": "
|
|
55
|
+
"@storybook/react": "8.0.4",
|
|
56
|
+
"@storybook/react-webpack5": "8.0.4",
|
|
57
|
+
"@storybook/theming": "8.0.4",
|
|
57
58
|
"@types/jsonwebtoken": "9.0.6",
|
|
58
59
|
"@types/node": "20.11.30",
|
|
59
60
|
"@types/react": "18.2.67",
|
|
60
61
|
"@types/react-dom": "18.2.22",
|
|
61
62
|
"cross-env": "7.0.3",
|
|
62
63
|
"eslint-config-e7npm": "0.0.93",
|
|
63
|
-
"globstar": "
|
|
64
|
+
"globstar": "1.0.0",
|
|
64
65
|
"rimraf": "5.0.5",
|
|
65
|
-
"storybook": "
|
|
66
|
-
"tsx": "
|
|
66
|
+
"storybook": "8.0.4",
|
|
67
|
+
"tsx": "4.7.0"
|
|
67
68
|
},
|
|
68
69
|
"files": [
|
|
69
70
|
"dist/**/*",
|