@raketa-builder/markdown-input 1.3.9 → 1.3.11

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.
@@ -0,0 +1,99 @@
1
+ import { __objRest, __spreadValues } from './chunk-Q2LW34XU.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import React from 'react';
4
+ import { FormGroup, Label, Textarea, Hint, cn } from '@raketa-builder/ui';
5
+ import { toHTML } from '@raketa-builder/support';
6
+
7
+ const IconButton = (_a) => {
8
+ var _b = _a, { as = "button", className } = _b, props = __objRest(_b, ["as", "className"]);
9
+ const Component = as;
10
+ return /* @__PURE__ */ jsx(
11
+ Component,
12
+ __spreadValues({
13
+ className: cn("r-reset-button", "r-md-icon-btn", className)
14
+ }, props)
15
+ );
16
+ };
17
+ const TextareaWrapper = (_c) => {
18
+ var _d = _c, { className } = _d, props = __objRest(_d, ["className"]);
19
+ return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("r-reset", "r-md-textarea", className) }, props));
20
+ };
21
+ const ButtonToolbar = (_e) => {
22
+ var _f = _e, { className } = _f, props = __objRest(_f, ["className"]);
23
+ return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("r-reset", "r-md-btn-toolbar", className) }, props));
24
+ };
25
+ const PreviewPane = (_g) => {
26
+ var _h = _g, { className } = _h, props = __objRest(_h, ["className"]);
27
+ return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("r-reset", "r-md-preview-pane", className) }, props));
28
+ };
29
+ const MarkdownInput = (_i) => {
30
+ var _j = _i, {
31
+ label = "Text",
32
+ height = "200px",
33
+ hint = "",
34
+ documentationLink = "https://guides.github.com/features/mastering-markdown/",
35
+ value,
36
+ onChange
37
+ } = _j, props = __objRest(_j, [
38
+ "label",
39
+ "height",
40
+ "hint",
41
+ "documentationLink",
42
+ "value",
43
+ "onChange"
44
+ ]);
45
+ const [open, setOpen] = React.useState(false);
46
+ return /* @__PURE__ */ jsxs(FormGroup, { children: [
47
+ label && /* @__PURE__ */ jsx(Label, { children: label }),
48
+ /* @__PURE__ */ jsxs(TextareaWrapper, { children: [
49
+ !open && /* @__PURE__ */ jsx(
50
+ Textarea,
51
+ __spreadValues({
52
+ value,
53
+ style: {
54
+ height,
55
+ resize: "vertical"
56
+ },
57
+ onChange: (e) => onChange(e.target.value, e)
58
+ }, props)
59
+ ),
60
+ open && /* @__PURE__ */ jsx(
61
+ PreviewPane,
62
+ {
63
+ style: {
64
+ height
65
+ },
66
+ children: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: toHTML(value) } })
67
+ }
68
+ ),
69
+ /* @__PURE__ */ jsxs(ButtonToolbar, { children: [
70
+ /* @__PURE__ */ jsx(
71
+ IconButton,
72
+ {
73
+ type: "button",
74
+ style: { backgroundImage: `var(--icon-eye)` },
75
+ onClick: () => setOpen(!open),
76
+ children: "Preview"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsx(
80
+ IconButton,
81
+ {
82
+ as: "a",
83
+ style: {
84
+ backgroundImage: `var(--icon-question-mark)`,
85
+ backgroundSize: "30%"
86
+ },
87
+ href: documentationLink,
88
+ target: "_blank",
89
+ children: "Help"
90
+ }
91
+ )
92
+ ] })
93
+ ] }),
94
+ /* @__PURE__ */ jsx(Hint, { children: hint })
95
+ ] });
96
+ };
97
+ var MarkdownInput_default = MarkdownInput;
98
+
99
+ export { MarkdownInput_default as default };
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+
30
+ export { __objRest, __spreadValues };
package/dist/index.js CHANGED
@@ -1,14 +1,2 @@
1
- 'use strict';
2
-
3
- var MarkdownInput = require('./MarkdownInput');
4
-
5
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
-
7
- var MarkdownInput__default = /*#__PURE__*/_interopDefault(MarkdownInput);
8
-
9
-
10
-
11
- Object.defineProperty(exports, "MarkdownInput", {
12
- enumerable: true,
13
- get: function () { return MarkdownInput__default.default; }
14
- });
1
+ import './chunk-Q2LW34XU.js';
2
+ export { default as MarkdownInput } from './MarkdownInput';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/markdown-input",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -8,19 +8,20 @@
8
8
  "sideEffects": false,
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./dist/index.js"
11
+ "import": {
12
+ "types": "./dist/index.d.js",
13
+ "default": "./dist/index.js"
14
+ }
12
15
  },
13
- "./*": {
14
- "import": "./dist/*.js"
15
- }
16
+ "./*": "./*"
16
17
  },
17
18
  "files": [
18
19
  "dist"
19
20
  ],
20
21
  "license": "MIT",
21
22
  "scripts": {
22
- "build": "tsup src/index.js --format cjs --loader \".js=jsx\"",
23
- "dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch",
23
+ "build": "tsup",
24
+ "dev": "tsup --watch",
24
25
  "format": "prettier --write .",
25
26
  "lint": "biome lint --max-diagnostics=5000 ."
26
27
  },
@@ -29,8 +30,8 @@
29
30
  "react-dom": "19.1.0"
30
31
  },
31
32
  "dependencies": {
32
- "@raketa-builder/support": "1.3.9",
33
- "@raketa-builder/ui": "1.3.9"
33
+ "@raketa-builder/support": "1.3.11",
34
+ "@raketa-builder/ui": "1.3.11"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@biomejs/biome": "1.9.4",