px-react-ui-components 1.0.0

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.
Files changed (75) hide show
  1. package/.babelrc +3 -0
  2. package/README.md +126 -0
  3. package/dist/components/MyAlert/MyAlert.css +113 -0
  4. package/dist/components/MyAlert/MyAlert.js +109 -0
  5. package/dist/components/MyContainer/MyContainer.js +59 -0
  6. package/dist/components/MyContainer/MyContainer.module.css +110 -0
  7. package/dist/components/MyContainer/MyContainerBody.js +9 -0
  8. package/dist/components/MyContainer/MyContainerFooter.js +9 -0
  9. package/dist/components/MyContainer/MyContainerRight.js +10 -0
  10. package/dist/components/MyEditor/MyEditor.js +292 -0
  11. package/dist/components/MyEditor/MyEditor.scss +277 -0
  12. package/dist/components/MyFileUpload/MyFileUpload.js +288 -0
  13. package/dist/components/MyFileUpload/MyFileUpload.module.css +86 -0
  14. package/dist/components/MyImageCropper/MyImageCropper.js +95 -0
  15. package/dist/components/MyInput/MyInput.js +768 -0
  16. package/dist/components/MyInput/MyInput.module.css +420 -0
  17. package/dist/components/MyMaps/YandexMaps.js +162 -0
  18. package/dist/components/MyMenu/MenuItem.js +55 -0
  19. package/dist/components/MyMenu/MyMenu.module.css +102 -0
  20. package/dist/components/MyModal/MyModal.css +83 -0
  21. package/dist/components/MyModal/MyModal.js +71 -0
  22. package/dist/components/MyModal/MyModalBody.js +9 -0
  23. package/dist/components/MyModal/MyModalFooter.js +9 -0
  24. package/dist/components/MyNotFound/MyNotFound.css +22 -0
  25. package/dist/components/MyNotFound/MyNotFound.js +20 -0
  26. package/dist/components/MyScrollableCard/MyScrollableCard.js +74 -0
  27. package/dist/components/MyTable/MyTable.js +310 -0
  28. package/dist/components/MyTable/MyTable.module.css +350 -0
  29. package/dist/components/MyTable/MyTableBody.js +9 -0
  30. package/dist/components/MyTable/MyTableHead.js +9 -0
  31. package/dist/components/MyTabs/MyTabPane.js +17 -0
  32. package/dist/components/MyTabs/MyTabs.css +105 -0
  33. package/dist/components/MyTabs/MyTabs.js +66 -0
  34. package/dist/components/MyWaiting/MyWaiting.css +28 -0
  35. package/dist/components/MyWaiting/MyWaiting.js +27 -0
  36. package/dist/components/MyZoomImage/MyZoomImage.css +0 -0
  37. package/dist/components/MyZoomImage/MyZoomImage.js +108 -0
  38. package/dist/index.js +15 -0
  39. package/package.json +44 -0
  40. package/src/components/MyAlert/MyAlert.css +113 -0
  41. package/src/components/MyAlert/MyAlert.jsx +96 -0
  42. package/src/components/MyContainer/MyContainer.jsx +90 -0
  43. package/src/components/MyContainer/MyContainer.module.css +110 -0
  44. package/src/components/MyContainer/MyContainerBody.jsx +8 -0
  45. package/src/components/MyContainer/MyContainerFooter.jsx +8 -0
  46. package/src/components/MyContainer/MyContainerRight.jsx +11 -0
  47. package/src/components/MyEditor/MyEditor.jsx +252 -0
  48. package/src/components/MyEditor/MyEditor.scss +277 -0
  49. package/src/components/MyFileUpload/MyFileUpload.jsx +373 -0
  50. package/src/components/MyFileUpload/MyFileUpload.module.css +86 -0
  51. package/src/components/MyImageCropper/MyImageCropper.jsx +108 -0
  52. package/src/components/MyInput/MyInput.jsx +896 -0
  53. package/src/components/MyInput/MyInput.module.css +420 -0
  54. package/src/components/MyMaps/YandexMaps.jsx +186 -0
  55. package/src/components/MyMenu/MenuItem.jsx +62 -0
  56. package/src/components/MyMenu/MyMenu.module.css +102 -0
  57. package/src/components/MyModal/MyModal.css +83 -0
  58. package/src/components/MyModal/MyModal.jsx +78 -0
  59. package/src/components/MyModal/MyModalBody.jsx +8 -0
  60. package/src/components/MyModal/MyModalFooter.jsx +8 -0
  61. package/src/components/MyNotFound/MyNotFound.css +22 -0
  62. package/src/components/MyNotFound/MyNotFound.jsx +11 -0
  63. package/src/components/MyScrollableCard/MyScrollableCard.jsx +86 -0
  64. package/src/components/MyTable/MyTable.jsx +458 -0
  65. package/src/components/MyTable/MyTable.module.css +350 -0
  66. package/src/components/MyTable/MyTableBody.jsx +8 -0
  67. package/src/components/MyTable/MyTableHead.jsx +10 -0
  68. package/src/components/MyTabs/MyTabPane.jsx +9 -0
  69. package/src/components/MyTabs/MyTabs.css +105 -0
  70. package/src/components/MyTabs/MyTabs.jsx +63 -0
  71. package/src/components/MyWaiting/MyWaiting.css +28 -0
  72. package/src/components/MyWaiting/MyWaiting.jsx +27 -0
  73. package/src/components/MyZoomImage/MyZoomImage.css +0 -0
  74. package/src/components/MyZoomImage/MyZoomImage.jsx +139 -0
  75. package/src/index.js +15 -0
@@ -0,0 +1,292 @@
1
+ import React, { useState, useEffect, useRef } from "react";
2
+ import ReactQuill from "react-quill";
3
+ import "react-quill/dist/quill.snow.css";
4
+ import ImageResize from "quill-image-resize";
5
+ import Quill from "quill";
6
+ import QuillTable from "quill-table";
7
+ import katex from "katex";
8
+ import "katex/dist/katex.min.css";
9
+ import "./MyEditor.scss";
10
+
11
+ // KaTeX'i global hale getir
12
+ window.katex = katex;
13
+
14
+ // Özel font listesini tanımla
15
+ const fonts = [{
16
+ label: "Arial",
17
+ value: "arial"
18
+ }, {
19
+ label: "Comic Sans MS",
20
+ value: "comic-sans"
21
+ }, {
22
+ label: "Courier New",
23
+ value: "courier-new"
24
+ }, {
25
+ label: "Georgia",
26
+ value: "georgia"
27
+ }, {
28
+ label: "Helvetica",
29
+ value: "helvetica"
30
+ }, {
31
+ label: "Times New Roman",
32
+ value: "times-new-roman"
33
+ }, {
34
+ label: "Verdana",
35
+ value: "verdana"
36
+ }, {
37
+ label: "Trebuchet MS",
38
+ value: "trebuchet-ms"
39
+ }, {
40
+ label: "Garamond",
41
+ value: "garamond"
42
+ }, {
43
+ label: "Palatino Linotype",
44
+ value: "palatino-linotype"
45
+ }, {
46
+ label: "Consolas",
47
+ value: "consolas"
48
+ }, {
49
+ label: "Lucida Console",
50
+ value: "lucida-console"
51
+ }, {
52
+ label: "Impact",
53
+ value: "impact"
54
+ }, {
55
+ label: "Brush Script MT",
56
+ value: "brush-script-mt"
57
+ }, {
58
+ label: "Tahoma",
59
+ value: "tahoma"
60
+ }, {
61
+ label: "Gill Sans",
62
+ value: "gill-sans"
63
+ }, {
64
+ label: "Franklin Gothic Medium",
65
+ value: "franklin-gothic-medium"
66
+ }, {
67
+ label: "Century Gothic",
68
+ value: "century-gothic"
69
+ }, {
70
+ label: "Bookman Old Style",
71
+ value: "bookman-old-style"
72
+ }, {
73
+ label: "Candara",
74
+ value: "candara"
75
+ }, {
76
+ label: "Didot",
77
+ value: "didot"
78
+ }, {
79
+ label: "Futura",
80
+ value: "futura"
81
+ }, {
82
+ label: "Rockwell",
83
+ value: "rockwell"
84
+ }, {
85
+ label: "Baskerville",
86
+ value: "baskerville"
87
+ }, {
88
+ label: "Bodoni MT",
89
+ value: "bodoni-mt"
90
+ }, {
91
+ label: "Copperplate",
92
+ value: "copperplate"
93
+ }, {
94
+ label: "Perpetua",
95
+ value: "perpetua"
96
+ }, {
97
+ label: "Monaco",
98
+ value: "monaco"
99
+ }, {
100
+ label: "Century Schoolbook",
101
+ value: "century-schoolbook"
102
+ }, {
103
+ label: "Segoe UI",
104
+ value: "segoe-ui"
105
+ }];
106
+
107
+ // Quill font formatını genişlet
108
+ const Font = Quill.import("formats/font");
109
+ Font.whitelist = fonts.map(f => f.value);
110
+ Quill.register(Font, true);
111
+
112
+ // Quill modüllerini kaydet
113
+ Quill.register("modules/imageResize", ImageResize);
114
+ Quill.register(QuillTable.TableCell);
115
+ Quill.register(QuillTable.TableRow);
116
+ Quill.register(QuillTable.Table);
117
+ Quill.register(QuillTable.Contain);
118
+ Quill.register("modules/table", QuillTable.TableModule);
119
+
120
+ // Formula Embed için düzeltme
121
+ const Embed = Quill.import("blots/embed");
122
+ class FormulaEmbed extends Embed {
123
+ static create(value) {
124
+ let node = super.create();
125
+ if (value) {
126
+ node.setAttribute("data-value", value);
127
+ try {
128
+ window.katex.render(value, node, {
129
+ throwOnError: false
130
+ });
131
+ } catch (err) {
132
+ console.error("KaTeX render error:", err);
133
+ }
134
+ }
135
+ return node;
136
+ }
137
+ static value(node) {
138
+ return node.getAttribute("data-value");
139
+ }
140
+ }
141
+ FormulaEmbed.blotName = "formula";
142
+ FormulaEmbed.tagName = "SPAN";
143
+ FormulaEmbed.className = "ql-formula";
144
+ Quill.register("formats/formula", FormulaEmbed);
145
+ function MyEditor({
146
+ value,
147
+ onChange,
148
+ style = {
149
+ height: "300px"
150
+ }
151
+ }) {
152
+ const [editorValue, setEditorValue] = useState("");
153
+ const [isFullscreen, setIsFullscreen] = useState(false);
154
+ const editorRef = useRef(null);
155
+ const timeoutRef = useRef(null);
156
+ const isFirstRender = useRef(true);
157
+ const handleFullscreen = () => {
158
+ setIsFullscreen(!isFullscreen);
159
+ };
160
+
161
+ // Custom buton tanımı
162
+ useEffect(() => {
163
+ const icons = Quill.import('ui/icons');
164
+ icons['fullscreen'] = `<svg viewbox="0 0 18 18">
165
+ <path d="M4,4H0v2h6V0H4V4z M14,4V0h-2v6h6V4H14z M6,14H0v2h4v4h2V14z M14,18h2v-4h4v-2h-6V18z"/>
166
+ </svg>`;
167
+ }, []);
168
+ useEffect(() => {
169
+ if (isFirstRender.current) {
170
+ isFirstRender.current = false;
171
+ setEditorValue(value || "");
172
+ } else if (value !== editorValue) {
173
+ const editor = editorRef.current?.getEditor();
174
+ if (editor) {
175
+ editor.setContents(editor.clipboard.convert(value || ""));
176
+ }
177
+ }
178
+ }, [value]);
179
+ const handleChange = (content, delta, source, editor) => {
180
+ const html = editor.getHTML();
181
+ setEditorValue(html);
182
+ if (timeoutRef.current) {
183
+ clearTimeout(timeoutRef.current);
184
+ }
185
+ timeoutRef.current = setTimeout(() => {
186
+ if (onChange) onChange({
187
+ value: html
188
+ });
189
+ }, 500);
190
+ };
191
+ const formats = ["header", "font", "size", "bold", "italic", "underline", "strike", "blockquote", "list", "bullet", "indent", "link", "image", "color", "background", "align", "script", "table", "table-cell", "table-row", "table-header", "table-body", "formula"];
192
+ const maxRows = 10;
193
+ const maxCols = 5;
194
+ const tableOptions = [];
195
+ for (let r = 1; r <= maxRows; r++) {
196
+ for (let c = 1; c <= maxCols; c++) {
197
+ tableOptions.push("newtable_" + r + "_" + c);
198
+ }
199
+ }
200
+ const modules = {
201
+ toolbar: {
202
+ container: [[{
203
+ font: fonts.map(f => f.value)
204
+ }], [{
205
+ header: [1, 2, 3, 4, 5, 6, false]
206
+ }], [{
207
+ size: ["small", "normal", "large", "huge"]
208
+ }], [{
209
+ list: "ordered"
210
+ }, {
211
+ list: "bullet"
212
+ }], ["bold", "italic", "underline", "strike"], [{
213
+ align: []
214
+ }], [{
215
+ color: []
216
+ }, {
217
+ background: []
218
+ }], [{
219
+ script: "sub"
220
+ }, {
221
+ script: "super"
222
+ }], ["image"]
223
+ // [{ table: tableOptions }, { table: "append-row" }, { table: "append-col" }],
224
+ // ["formula"]
225
+ ]
226
+ },
227
+ table: {
228
+ operationMenu: true,
229
+ resizable: true,
230
+ tableCellMinWidth: 50,
231
+ tableHeaderRows: 1
232
+ },
233
+ clipboard: {
234
+ matchVisual: false
235
+ },
236
+ imageResize: {
237
+ modules: ["Resize", "DisplaySize"],
238
+ displaySize: true,
239
+ handleStyles: {
240
+ backgroundColor: '#000',
241
+ border: 'none',
242
+ color: '#fff'
243
+ }
244
+ }
245
+ };
246
+
247
+ // Font adlarını gerçek isimleriyle göstermek için toolbar'ı güncelle
248
+ const fontPicker = document.querySelector(".ql-font");
249
+ if (fontPicker) {
250
+ const items = fontPicker.querySelectorAll(".ql-picker-item");
251
+ items.forEach((item, index) => {
252
+ if (fonts[index]) {
253
+ item.innerText = fonts[index].label; // Gerçek font adını göster
254
+ }
255
+ });
256
+ const pickerLabel = fontPicker.querySelector(".ql-picker-label");
257
+ if (pickerLabel) {
258
+ pickerLabel.innerText = fonts[0].label; // Varsayılan font ismi
259
+ }
260
+ }
261
+ return /*#__PURE__*/React.createElement("div", {
262
+ className: 'myEditorContainer ' + (isFullscreen ? 'fullscreen' : '')
263
+ }, /*#__PURE__*/React.createElement("div", {
264
+ className: "myEditorContainerContent"
265
+ }, /*#__PURE__*/React.createElement("button", {
266
+ onClick: handleFullscreen,
267
+ className: "myEditorContainerFullscreenButton",
268
+ title: isFullscreen ? "Minimize" : "Maximize"
269
+ }, isFullscreen ? /*#__PURE__*/React.createElement("svg", {
270
+ viewBox: "0 0 18 18",
271
+ width: "18",
272
+ height: "18"
273
+ }, /*#__PURE__*/React.createElement("path", {
274
+ d: "M4,4h2v6H0V8h4V4z M14,4v4h4v2h-6V4H14z M6,14H4v-4H0v-2h6V14z M14,14h-2v-6h6v2h-4V14z"
275
+ })) : /*#__PURE__*/React.createElement("svg", {
276
+ viewBox: "0 0 18 18",
277
+ width: "18",
278
+ height: "18"
279
+ }, /*#__PURE__*/React.createElement("path", {
280
+ d: "M4,4H0v2h6V0H4V4z M14,4V0h-2v6h6V4H14z M6,14H0v2h4v4h2V14z M14,18h2v-4h4v-2h-6V18z"
281
+ }))), /*#__PURE__*/React.createElement(ReactQuill, {
282
+ ref: editorRef,
283
+ theme: "snow",
284
+ value: editorValue,
285
+ onChange: handleChange,
286
+ modules: modules,
287
+ formats: formats,
288
+ style: style,
289
+ preserveWhitespace: true
290
+ })));
291
+ }
292
+ export default MyEditor;
@@ -0,0 +1,277 @@
1
+ .myEditorContainer {
2
+ &.fullscreen {
3
+ position: fixed;
4
+ z-index: 9999;
5
+ background: white;
6
+ left: 0;
7
+ top: 0;
8
+ width: 100%;
9
+ height: 100%;
10
+ background-color: #091624c0;
11
+
12
+ .myEditorContainerContent {
13
+ position: absolute;
14
+ top: 50%;
15
+ left: 50%;
16
+ transform: translate(-50%, -50%);
17
+ height: 90vh;
18
+ width: 95%;
19
+ background: #fff;
20
+ border-radius: 10px;
21
+ padding: 10px;
22
+
23
+ .myEditorContainerFullscreenButton{
24
+ right: 15px;
25
+ top: 15px;
26
+ background: #7096b1;
27
+ }
28
+
29
+ .quill {
30
+ height: calc(100% - 45px) !important;
31
+ }
32
+ }
33
+ }
34
+
35
+ .myEditorContainerContent {
36
+ position: relative;
37
+ height: 100%;
38
+ width: 100%;
39
+
40
+ .myEditorContainerFullscreenButton{
41
+ position: absolute;
42
+ right: 5px;
43
+ top: 5px;
44
+ z-index: 10000;
45
+ background: #b8c1cf;
46
+ border: none;
47
+ cursor: pointer;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ width: 33px;
52
+ height: 33px;
53
+ padding: 7px;
54
+ border-radius: 5px;
55
+
56
+ svg{
57
+ width: 100%;
58
+ height: 100%;
59
+ }
60
+ }
61
+
62
+ .quill {
63
+ display: inline-block;
64
+ width: 100%;
65
+
66
+ .ql-toolbar {
67
+ border-radius: 10px;
68
+ background: #eaebec;
69
+ // -webkit-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5);
70
+ // -moz-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5);
71
+ box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.1);
72
+ padding: 3px !important;
73
+
74
+ .ql-formats {
75
+ margin: 4px;
76
+ background: #d9dce1;
77
+ padding: 2px;
78
+ border-radius: 5px;
79
+ }
80
+ }
81
+
82
+ .ql-container {
83
+ border-radius: 0 0 10px 10px;
84
+ padding-right: 2px;
85
+ }
86
+
87
+ .ql-editor {
88
+ &::-webkit-scrollbar {
89
+ width: 8px;
90
+ height: 8px;
91
+ }
92
+
93
+ &::-webkit-scrollbar-track {
94
+ background: #f1f1f1;
95
+ border-radius: 4px;
96
+ }
97
+
98
+ &::-webkit-scrollbar-thumb {
99
+ background: #888;
100
+ border-radius: 4px;
101
+
102
+ &:hover {
103
+ background: #555;
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ .quill-editor-container .ql-formula {
110
+ display: inline-block;
111
+ vertical-align: middle;
112
+ padding: 0 2px;
113
+ }
114
+
115
+ .quill-editor-container .katex {
116
+ display: inline-block;
117
+ font-size: 1.1em;
118
+ }
119
+
120
+ .ql-snow .ql-picker.ql-font .ql-picker-label::before,
121
+ .ql-snow .ql-picker.ql-font .ql-picker-item::before {
122
+ content: "";
123
+ }
124
+
125
+ .ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options {
126
+ overflow: auto;
127
+ max-height: 300px;
128
+ }
129
+
130
+ .ql-font-arial {
131
+ font-family: Arial, sans-serif !important;
132
+ }
133
+
134
+ .ql-font-comic-sans {
135
+ font-family: "Comic Sans MS", cursive, sans-serif !important;
136
+ }
137
+
138
+ .ql-font-courier-new {
139
+ font-family: "Courier New", Courier, monospace !important;
140
+ }
141
+
142
+ .ql-font-georgia {
143
+ font-family: Georgia, serif !important;
144
+ }
145
+
146
+ .ql-font-helvetica {
147
+ font-family: Helvetica, sans-serif !important;
148
+ }
149
+
150
+ .ql-font-times-new-roman {
151
+ font-family: "Times New Roman", Times, serif !important;
152
+ }
153
+
154
+ .ql-font-verdana {
155
+ font-family: Verdana, sans-serif !important;
156
+ }
157
+
158
+ .ql-font-trebuchet-ms {
159
+ font-family: "Trebuchet MS", sans-serif !important;
160
+ }
161
+
162
+ .ql-font-garamond {
163
+ font-family: Garamond, serif !important;
164
+ }
165
+
166
+ .ql-font-palatino-linotype {
167
+ font-family: "Palatino Linotype", serif !important;
168
+ }
169
+
170
+ .ql-font-consolas {
171
+ font-family: Consolas, monospace !important;
172
+ }
173
+
174
+ .ql-font-lucida-console {
175
+ font-family: "Lucida Console", monospace !important;
176
+ }
177
+
178
+ .ql-font-impact {
179
+ font-family: Impact, sans-serif !important;
180
+ }
181
+
182
+ .ql-font-brush-script-mt {
183
+ font-family: "Brush Script MT", cursive !important;
184
+ }
185
+
186
+ .ql-font-tahoma {
187
+ font-family: Tahoma, sans-serif !important;
188
+ }
189
+
190
+ .ql-font-gill-sans {
191
+ font-family: "Gill Sans", sans-serif !important;
192
+ }
193
+
194
+ .ql-font-franklin-gothic-medium {
195
+ font-family: "Franklin Gothic Medium", sans-serif !important;
196
+ }
197
+
198
+ .ql-font-century-gothic {
199
+ font-family: "Century Gothic", sans-serif !important;
200
+ }
201
+
202
+ .ql-font-bookman-old-style {
203
+ font-family: "Bookman Old Style", serif !important;
204
+ }
205
+
206
+ .ql-font-candara {
207
+ font-family: Candara, sans-serif !important;
208
+ }
209
+
210
+ .ql-font-didot {
211
+ font-family: Didot, serif !important;
212
+ }
213
+
214
+ .ql-font-futura {
215
+ font-family: Futura, sans-serif !important;
216
+ }
217
+
218
+ .ql-font-rockwell {
219
+ font-family: Rockwell, serif !important;
220
+ }
221
+
222
+ .ql-font-baskerville {
223
+ font-family: Baskerville, serif !important;
224
+ }
225
+
226
+ .ql-font-bodoni-mt {
227
+ font-family: "Bodoni MT", serif !important;
228
+ }
229
+
230
+ .ql-font-copperplate {
231
+ font-family: Copperplate, serif !important;
232
+ }
233
+
234
+ .ql-font-perpetua {
235
+ font-family: Perpetua, serif !important;
236
+ }
237
+
238
+ .ql-font-monaco {
239
+ font-family: Monaco, monospace !important;
240
+ }
241
+
242
+ .ql-font-century-schoolbook {
243
+ font-family: "Century Schoolbook", serif !important;
244
+ }
245
+
246
+ .ql-font-segoe-ui {
247
+ font-family: "Segoe UI", sans-serif !important;
248
+ }
249
+
250
+ .ql-snow .ql-toolbar button.ql-fullscreen {
251
+ &:hover .ql-stroke {
252
+ stroke: #06c;
253
+ }
254
+
255
+ .ql-stroke {
256
+ stroke: #444;
257
+ }
258
+ }
259
+ }
260
+ }
261
+
262
+
263
+ .ql-editor table {
264
+ width: 100%;
265
+ border-collapse: collapse;
266
+ }
267
+
268
+ .ql-editor table td,
269
+ .ql-editor table th {
270
+ border: 1px solid #ddd;
271
+ padding: 8px;
272
+ }
273
+
274
+ .ql-editor table th {
275
+ background-color: #f2f2f2;
276
+ text-align: left;
277
+ }