@raketa-builder/markdown-input 1.3.6 → 1.3.9

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/index.js CHANGED
@@ -1,162 +1,14 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __objRest = (source, exclude) => {
23
- var target = {};
24
- for (var prop in source)
25
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
- target[prop] = source[prop];
27
- if (source != null && __getOwnPropSymbols)
28
- for (var prop of __getOwnPropSymbols(source)) {
29
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
- target[prop] = source[prop];
31
- }
32
- return target;
33
- };
34
- var __export = (target, all) => {
35
- for (var name in all)
36
- __defProp(target, name, { get: all[name], enumerable: true });
37
- };
38
- var __copyProps = (to, from, except, desc) => {
39
- if (from && typeof from === "object" || typeof from === "function") {
40
- for (let key of __getOwnPropNames(from))
41
- if (!__hasOwnProp.call(to, key) && key !== except)
42
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
43
- }
44
- return to;
45
- };
46
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
47
- // If the importer is in node compatibility mode or this is not an ESM
48
- // file that has been converted to a CommonJS file using a Babel-
49
- // compatible transform (i.e. "__esModule" has not been set), then set
50
- // "default" to the CommonJS "module.exports" for node compatibility.
51
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
52
- mod
53
- ));
54
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
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
+
55
9
 
56
- // src/index.js
57
- var index_exports = {};
58
- __export(index_exports, {
59
- MarkdownInput: () => MarkdownInput_default
60
- });
61
- module.exports = __toCommonJS(index_exports);
62
10
 
63
- // src/MarkdownInput.js
64
- var import_react = __toESM(require("react"));
65
- var import_ui = require("@raketa-builder/ui");
66
- var import_support = require("@raketa-builder/support");
67
- var import_jsx_runtime = require("react/jsx-runtime");
68
- var IconButton = (_a) => {
69
- var _b = _a, { as = "button", className } = _b, props = __objRest(_b, ["as", "className"]);
70
- const Component = as;
71
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
- Component,
73
- __spreadValues({
74
- className: (0, import_ui.cn)("r-reset-button", "r-md-icon-btn", className)
75
- }, props)
76
- );
77
- };
78
- var TextareaWrapper = (_a) => {
79
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
80
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", __spreadValues({ className: (0, import_ui.cn)("r-reset", "r-md-textarea", className) }, props));
81
- };
82
- var ButtonToolbar = (_a) => {
83
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
84
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", __spreadValues({ className: (0, import_ui.cn)("r-reset", "r-md-btn-toolbar", className) }, props));
85
- };
86
- var PreviewPane = (_a) => {
87
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
88
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", __spreadValues({ className: (0, import_ui.cn)("r-reset", "r-md-preview-pane", className) }, props));
89
- };
90
- var MarkdownInput = (_a) => {
91
- var _b = _a, {
92
- label = "Text",
93
- height = "200px",
94
- hint = "",
95
- documentationLink = "https://guides.github.com/features/mastering-markdown/",
96
- value,
97
- onChange
98
- } = _b, props = __objRest(_b, [
99
- "label",
100
- "height",
101
- "hint",
102
- "documentationLink",
103
- "value",
104
- "onChange"
105
- ]);
106
- const [open, setOpen] = import_react.default.useState(false);
107
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.FormGroup, { children: [
108
- label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Label, { children: label }),
109
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TextareaWrapper, { children: [
110
- !open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
- import_ui.Textarea,
112
- __spreadValues({
113
- value,
114
- style: {
115
- height,
116
- resize: "vertical"
117
- },
118
- onChange: (e) => onChange(e.target.value, e)
119
- }, props)
120
- ),
121
- open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
- PreviewPane,
123
- {
124
- style: {
125
- height
126
- },
127
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { dangerouslySetInnerHTML: { __html: (0, import_support.toHTML)(value) } })
128
- }
129
- ),
130
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ButtonToolbar, { children: [
131
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
132
- IconButton,
133
- {
134
- type: "button",
135
- style: { backgroundImage: `var(--icon-eye)` },
136
- onClick: () => setOpen(!open),
137
- children: "Preview"
138
- }
139
- ),
140
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
141
- IconButton,
142
- {
143
- as: "a",
144
- style: {
145
- backgroundImage: `var(--icon-question-mark)`,
146
- backgroundSize: "30%"
147
- },
148
- href: documentationLink,
149
- target: "_blank",
150
- children: "Help"
151
- }
152
- )
153
- ] })
154
- ] }),
155
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Hint, { children: hint })
156
- ] });
157
- };
158
- var MarkdownInput_default = MarkdownInput;
159
- // Annotate the CommonJS export names for ESM import in node:
160
- 0 && (module.exports = {
161
- MarkdownInput
11
+ Object.defineProperty(exports, "MarkdownInput", {
12
+ enumerable: true,
13
+ get: function () { return MarkdownInput__default.default; }
162
14
  });
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
2
  "name": "@raketa-builder/markdown-input",
3
- "version": "1.3.6",
3
+ "version": "1.3.9",
4
+ "type": "module",
4
5
  "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
5
7
  "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./*": {
14
+ "import": "./dist/*.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
6
20
  "license": "MIT",
7
21
  "scripts": {
8
22
  "build": "tsup src/index.js --format cjs --loader \".js=jsx\"",
@@ -15,8 +29,8 @@
15
29
  "react-dom": "19.1.0"
16
30
  },
17
31
  "dependencies": {
18
- "@raketa-builder/support": "1.3.6",
19
- "@raketa-builder/ui": "1.3.6"
32
+ "@raketa-builder/support": "1.3.9",
33
+ "@raketa-builder/ui": "1.3.9"
20
34
  },
21
35
  "devDependencies": {
22
36
  "@biomejs/biome": "1.9.4",
package/CHANGELOG.md DELETED
@@ -1,7 +0,0 @@
1
- # @raketa-builder/markdown-input
2
-
3
- ## 0.2.0
4
-
5
- ### Minor Changes
6
-
7
- - First release of @raketa-builder/markdown-input
package/biome.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["../../biome.json"]
3
- }
@@ -1,93 +0,0 @@
1
- import React from "react";
2
- import { FormGroup, Label, Textarea, Hint, cn } from "@raketa-builder/ui";
3
- import { toHTML } from "@raketa-builder/support";
4
-
5
- const IconButton = ({ as = "button", className, ...props }) => {
6
- const Component = as;
7
-
8
- return (
9
- <Component
10
- className={cn("r-reset-button", "r-md-icon-btn", className)}
11
- {...props}
12
- />
13
- );
14
- };
15
-
16
- const TextareaWrapper = ({ className, ...props }) => (
17
- <div className={cn("r-reset", "r-md-textarea", className)} {...props} />
18
- );
19
-
20
- const ButtonToolbar = ({ className, ...props }) => (
21
- <div className={cn("r-reset", "r-md-btn-toolbar", className)} {...props} />
22
- );
23
-
24
- const PreviewPane = ({ className, ...props }) => (
25
- <div className={cn("r-reset", "r-md-preview-pane", className)} {...props} />
26
- );
27
-
28
- const MarkdownInput = ({
29
- label = "Text",
30
- height = "200px",
31
- hint = "",
32
- documentationLink = "https://guides.github.com/features/mastering-markdown/",
33
- value,
34
- onChange,
35
- ...props
36
- }) => {
37
- const [open, setOpen] = React.useState(false);
38
-
39
- return (
40
- <FormGroup>
41
- {label && <Label>{label}</Label>}
42
-
43
- <TextareaWrapper>
44
- {!open && (
45
- <Textarea
46
- value={value}
47
- style={{
48
- height,
49
- resize: "vertical",
50
- }}
51
- onChange={(e) => onChange(e.target.value, e)}
52
- {...props}
53
- />
54
- )}
55
-
56
- {open && (
57
- <PreviewPane
58
- style={{
59
- height,
60
- }}
61
- >
62
- <div dangerouslySetInnerHTML={{ __html: toHTML(value) }} />
63
- </PreviewPane>
64
- )}
65
-
66
- <ButtonToolbar>
67
- <IconButton
68
- type="button"
69
- style={{ backgroundImage: `var(--icon-eye)` }}
70
- onClick={() => setOpen(!open)}
71
- >
72
- Preview
73
- </IconButton>
74
- <IconButton
75
- as="a"
76
- style={{
77
- backgroundImage: `var(--icon-question-mark)`,
78
- backgroundSize: "30%",
79
- }}
80
- href={documentationLink}
81
- target="_blank"
82
- >
83
- Help
84
- </IconButton>
85
- </ButtonToolbar>
86
- </TextareaWrapper>
87
-
88
- <Hint>{hint}</Hint>
89
- </FormGroup>
90
- );
91
- };
92
-
93
- export default MarkdownInput;
package/src/index.js DELETED
@@ -1,3 +0,0 @@
1
- import MarkdownInput from "./MarkdownInput";
2
-
3
- export { MarkdownInput };
package/src/styles.css DELETED
@@ -1,47 +0,0 @@
1
- @layer raketa-builder {
2
- .r-md-icon-btn {
3
- width: 2em;
4
- height: 2em;
5
- border-radius: 50%;
6
- background-color: var(--r-black);
7
- background-repeat: no-repeat;
8
- background-position: center;
9
- background-size: 50%;
10
- color: var(--r-white);
11
- font-weight: 700;
12
- text-align: center;
13
- text-decoration: none;
14
- line-height: 1.5;
15
- text-indent: -9999px;
16
- overflow: hidden;
17
- transition: all 0.3s ease-in-out;
18
- }
19
-
20
- .r-md-icon-btn:hover {
21
- background-color: var(--r-primary);
22
- }
23
-
24
- .r-md-textarea {
25
- position: relative;
26
- }
27
-
28
- .r-md-btn-toolbar {
29
- position: absolute;
30
- right: 0.5em;
31
- bottom: 1em;
32
- display: flex;
33
- gap: 0.5em;
34
- }
35
-
36
- .r-md-preview-pane {
37
- padding: 1em;
38
- overflow-y: auto;
39
- border: 1px dashed var(--r-primary);
40
- background-color: var(--r-true-white);
41
- }
42
-
43
- :root {
44
- --icon-eye: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAuNzUgOUMwLjc1IDkgMy43NSAzIDkgM0MxNC4yNSAzIDE3LjI1IDkgMTcuMjUgOUMxNy4yNSA5IDE0LjI1IDE1IDkgMTVDMy43NSAxNSAwLjc1IDkgMC43NSA5WiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2F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S13aWR0aD0iMS41IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==);
46
- }
47
- }
package/tsconfig.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "tsconfig/react-library.json",
3
- "include": ["src"],
4
- "exclude": ["dist", "build", "node_modules"],
5
- }