@tqc-solution/design-system 0.2.4

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 (130) hide show
  1. package/README.md +207 -0
  2. package/dist/assets/icon/IconAi.d.ts +3 -0
  3. package/dist/assets/icon/IconAlertTriangleSolid.d.ts +3 -0
  4. package/dist/assets/icon/IconAudio.d.ts +3 -0
  5. package/dist/assets/icon/IconCalendar.d.ts +3 -0
  6. package/dist/assets/icon/IconCaretDown.d.ts +3 -0
  7. package/dist/assets/icon/IconCheck.d.ts +3 -0
  8. package/dist/assets/icon/IconCheckCircleSolid.d.ts +3 -0
  9. package/dist/assets/icon/IconChevronLeft.d.ts +3 -0
  10. package/dist/assets/icon/IconChevronRight.d.ts +3 -0
  11. package/dist/assets/icon/IconCircleArrowLeftSolid.d.ts +3 -0
  12. package/dist/assets/icon/IconCircleArrowRightSolid.d.ts +3 -0
  13. package/dist/assets/icon/IconClock.d.ts +3 -0
  14. package/dist/assets/icon/IconClose.d.ts +3 -0
  15. package/dist/assets/icon/IconCloseCircleSolid.d.ts +3 -0
  16. package/dist/assets/icon/IconColumns.d.ts +3 -0
  17. package/dist/assets/icon/IconCopy.d.ts +3 -0
  18. package/dist/assets/icon/IconDelete.d.ts +3 -0
  19. package/dist/assets/icon/IconDocument.d.ts +3 -0
  20. package/dist/assets/icon/IconExcel.d.ts +3 -0
  21. package/dist/assets/icon/IconEye.d.ts +3 -0
  22. package/dist/assets/icon/IconEyeSlash.d.ts +3 -0
  23. package/dist/assets/icon/IconFile.d.ts +3 -0
  24. package/dist/assets/icon/IconFolder.d.ts +3 -0
  25. package/dist/assets/icon/IconImg.d.ts +3 -0
  26. package/dist/assets/icon/IconInfoSolid.d.ts +3 -0
  27. package/dist/assets/icon/IconPdf.d.ts +3 -0
  28. package/dist/assets/icon/IconPowerPoint.d.ts +3 -0
  29. package/dist/assets/icon/IconPts.d.ts +3 -0
  30. package/dist/assets/icon/IconSearch.d.ts +3 -0
  31. package/dist/assets/icon/IconSmallCaretRightSolid.d.ts +3 -0
  32. package/dist/assets/icon/IconTemplate.d.ts +3 -0
  33. package/dist/assets/icon/IconTxt.d.ts +3 -0
  34. package/dist/assets/icon/IconUpload.d.ts +3 -0
  35. package/dist/assets/icon/IconVideo.d.ts +3 -0
  36. package/dist/assets/icon/IconWord.d.ts +3 -0
  37. package/dist/assets/icon/IconZip.d.ts +3 -0
  38. package/dist/components/Alert/Alert.d.ts +13 -0
  39. package/dist/components/Alert/index.d.ts +2 -0
  40. package/dist/components/Avatar/Avatar.d.ts +37 -0
  41. package/dist/components/Avatar/index.d.ts +2 -0
  42. package/dist/components/Badge/Badge.d.ts +37 -0
  43. package/dist/components/Badge/index.d.ts +2 -0
  44. package/dist/components/Button/Button.d.ts +19 -0
  45. package/dist/components/Button/index.d.ts +2 -0
  46. package/dist/components/CardTable/CardTable.d.ts +87 -0
  47. package/dist/components/CardTable/index.d.ts +2 -0
  48. package/dist/components/Chart/BarChart/BarChart.d.ts +40 -0
  49. package/dist/components/Chart/BarChart/index.d.ts +2 -0
  50. package/dist/components/Chart/HorizontalBarChart/HorizontalBarChart.d.ts +32 -0
  51. package/dist/components/Chart/HorizontalBarChart/index.d.ts +2 -0
  52. package/dist/components/Chart/LineChart/LineChart.d.ts +48 -0
  53. package/dist/components/Chart/LineChart/index.d.ts +2 -0
  54. package/dist/components/Chart/MultiLineAndBarChart/MultiLineAndBarChart.d.ts +57 -0
  55. package/dist/components/Chart/MultiLineAndBarChart/index.d.ts +2 -0
  56. package/dist/components/Chart/MultilineChart/MultilineChart.d.ts +25 -0
  57. package/dist/components/Chart/MultilineChart/index.d.ts +2 -0
  58. package/dist/components/Chart/PieChart/PieChart.d.ts +20 -0
  59. package/dist/components/Chart/PieChart/index.d.ts +2 -0
  60. package/dist/components/Checkbox/Checkbox.d.ts +21 -0
  61. package/dist/components/Checkbox/index.d.ts +2 -0
  62. package/dist/components/DatePicker/DatePicker/DatePicker.d.ts +24 -0
  63. package/dist/components/DatePicker/DatePicker/index.d.ts +2 -0
  64. package/dist/components/DatePicker/DateRangePicker/DateRangePicker.d.ts +34 -0
  65. package/dist/components/DatePicker/DateRangePicker/index.d.ts +2 -0
  66. package/dist/components/DatePicker/MonthPicker/MonthPicker.d.ts +20 -0
  67. package/dist/components/DatePicker/MonthPicker/index.d.ts +2 -0
  68. package/dist/components/DatePicker/TimePicker/TimePicker.d.ts +20 -0
  69. package/dist/components/DatePicker/TimePicker/index.d.ts +2 -0
  70. package/dist/components/DatePicker/YearPicker/YearPicker.d.ts +20 -0
  71. package/dist/components/DatePicker/YearPicker/index.d.ts +2 -0
  72. package/dist/components/Editor/Editor.d.ts +16 -0
  73. package/dist/components/Editor/index.d.ts +2 -0
  74. package/dist/components/EditorHtml/EditorHtml.d.ts +35 -0
  75. package/dist/components/EditorHtml/index.d.ts +2 -0
  76. package/dist/components/EditorJs/EditorJs.d.ts +35 -0
  77. package/dist/components/EditorJs/index.d.ts +2 -0
  78. package/dist/components/Input/InputForm/InputForm.d.ts +42 -0
  79. package/dist/components/Input/InputForm/index.d.ts +2 -0
  80. package/dist/components/Input/InputFormSpecial/InputFormSpecial.d.ts +110 -0
  81. package/dist/components/Input/InputFormSpecial/index.d.ts +2 -0
  82. package/dist/components/Input/InputOTP/InputOTP.d.ts +29 -0
  83. package/dist/components/Input/InputOTP/index.d.ts +2 -0
  84. package/dist/components/Input/InputSearch/InputSearch.d.ts +34 -0
  85. package/dist/components/Input/InputSearch/index.d.ts +2 -0
  86. package/dist/components/InputText/InputText.d.ts +56 -0
  87. package/dist/components/InputText/index.d.ts +2 -0
  88. package/dist/components/Loading/Loading.d.ts +19 -0
  89. package/dist/components/Loading/index.d.ts +2 -0
  90. package/dist/components/Modal/Modal.d.ts +49 -0
  91. package/dist/components/Modal/index.d.ts +2 -0
  92. package/dist/components/Pagination/Pagination.d.ts +24 -0
  93. package/dist/components/Pagination/index.d.ts +2 -0
  94. package/dist/components/ProgressBar/ProgressBar.d.ts +21 -0
  95. package/dist/components/ProgressBar/index.d.ts +2 -0
  96. package/dist/components/RadioButton/RadioButton.d.ts +17 -0
  97. package/dist/components/RadioButton/index.d.ts +2 -0
  98. package/dist/components/Slider/Slider.d.ts +37 -0
  99. package/dist/components/Slider/index.d.ts +1 -0
  100. package/dist/components/TabBar/TabBar.d.ts +18 -0
  101. package/dist/components/TabBar/index.d.ts +2 -0
  102. package/dist/components/TabBarGroup/TabBarGroup.d.ts +32 -0
  103. package/dist/components/TabBarGroup/index.d.ts +2 -0
  104. package/dist/components/Tag/Tag.d.ts +45 -0
  105. package/dist/components/Tag/index.d.ts +2 -0
  106. package/dist/components/Toast/Toast.d.ts +9 -0
  107. package/dist/components/Toast/index.d.ts +2 -0
  108. package/dist/components/Toggle/Toggle.d.ts +17 -0
  109. package/dist/components/Toggle/index.d.ts +2 -0
  110. package/dist/components/Tooltip/Tooltip.d.ts +10 -0
  111. package/dist/components/Tooltip/index.d.ts +2 -0
  112. package/dist/components/Typography/Typography.d.ts +16 -0
  113. package/dist/components/Typography/index.d.ts +2 -0
  114. package/dist/components/Upload/Upload.d.ts +49 -0
  115. package/dist/components/Upload/index.d.ts +2 -0
  116. package/dist/index-BcEf-eHA.js +228 -0
  117. package/dist/index-BhBGF4B7.cjs +11 -0
  118. package/dist/index-DU1rSsif.js +548 -0
  119. package/dist/index-b5gz6Ifp.cjs +1 -0
  120. package/dist/index.cjs.js +58 -0
  121. package/dist/index.d.ts +74 -0
  122. package/dist/index.es.js +8045 -0
  123. package/dist/quill-CqfsVyV-.js +7529 -0
  124. package/dist/quill-DqFubOCp.cjs +49 -0
  125. package/dist/tailwind/index.d.ts +4 -0
  126. package/dist/tailwind/index.js +2 -0
  127. package/dist/tailwind/pubfuture.preset.d.ts +4 -0
  128. package/dist/tailwind/pubfuture.preset.js +217 -0
  129. package/dist/types.d.ts +6 -0
  130. package/package.json +98 -0
@@ -0,0 +1,49 @@
1
+ import { type InputHTMLAttributes } from 'react';
2
+ export type UploadStatus = 'default' | 'error' | 'disable';
3
+ export type UploadedFile = {
4
+ file: File;
5
+ progress: number;
6
+ status: 'uploading' | 'success' | 'error';
7
+ id: string;
8
+ previewUrl?: string;
9
+ };
10
+ export type UploadProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'multiple' | 'disabled'> & {
11
+ /** Upload mode: single or multiple files */
12
+ multiple?: boolean;
13
+ /** Status of the upload component */
14
+ status?: UploadStatus;
15
+ /** Callback when internal uploaded files state changes */
16
+ onUploadedFilesChange?: (files: UploadedFile[]) => void;
17
+ /** Additional CSS class name */
18
+ className?: string;
19
+ /** Custom label text */
20
+ label?: string;
21
+ /** Custom description text */
22
+ description?: string;
23
+ /** Error message text */
24
+ errorMessage?: string;
25
+ /** Callback when files are selected */
26
+ onChange?: (files: FileList | null) => void;
27
+ /** Callback when file is removed */
28
+ onRemove?: (fileId: string) => void;
29
+ };
30
+ export declare const Upload: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "disabled" | "multiple" | "type"> & {
31
+ /** Upload mode: single or multiple files */
32
+ multiple?: boolean;
33
+ /** Status of the upload component */
34
+ status?: UploadStatus;
35
+ /** Callback when internal uploaded files state changes */
36
+ onUploadedFilesChange?: (files: UploadedFile[]) => void;
37
+ /** Additional CSS class name */
38
+ className?: string;
39
+ /** Custom label text */
40
+ label?: string;
41
+ /** Custom description text */
42
+ description?: string;
43
+ /** Error message text */
44
+ errorMessage?: string;
45
+ /** Callback when files are selected */
46
+ onChange?: (files: FileList | null) => void;
47
+ /** Callback when file is removed */
48
+ onRemove?: (fileId: string) => void;
49
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,2 @@
1
+ export { Upload } from './Upload';
2
+ export type { UploadProps, UploadStatus } from './Upload';
@@ -0,0 +1,228 @@
1
+ import n, { createRef as l } from "react";
2
+ import { i as r, Q as u } from "./quill-CqfsVyV-.js";
3
+ class a extends n.Component {
4
+ constructor(t) {
5
+ super(t), this.editingAreaRef = l(), this.containerRef = l(), this.dirtyProps = [
6
+ "modules",
7
+ "formats",
8
+ "bounds",
9
+ "theme",
10
+ "children"
11
+ ], this.cleanProps = [
12
+ "id",
13
+ "className",
14
+ "style",
15
+ "placeholder",
16
+ "tabIndex",
17
+ "onChange",
18
+ "onChangeSelection",
19
+ "onFocus",
20
+ "onBlur",
21
+ "onKeyPress",
22
+ "onKeyDown",
23
+ "onKeyUp"
24
+ ], this.state = {
25
+ generation: 0
26
+ }, this.selection = null, this.onEditorChange = (i, o, s, h) => {
27
+ i === "text-change" ? this.onEditorChangeText?.(this.editor.getSemanticHTML(), o, h, this.unprivilegedEditor) : i === "selection-change" && this.onEditorChangeSelection?.(o, h, this.unprivilegedEditor);
28
+ };
29
+ const e = this.isControlled() ? t.value : t.defaultValue;
30
+ this.value = e ?? "";
31
+ }
32
+ validateProps(t) {
33
+ if (n.Children.count(t.children) > 1)
34
+ throw new Error("The Quill editing area can only be composed of a single React element.");
35
+ if (n.Children.count(t.children) && n.Children.only(t.children)?.type === "textarea")
36
+ throw new Error("Quill does not support editing on a <textarea>. Use a <div> instead.");
37
+ if (this.lastDeltaChangeSet && t.value === this.lastDeltaChangeSet)
38
+ throw new Error("You are passing the `delta` object from the `onChange` event back as `value`. You most probably want `editor.getContents()` instead. See: https://github.com/zenoamaro/react-quill#using-deltas");
39
+ }
40
+ shouldComponentUpdate(t, e) {
41
+ if (this.validateProps(t), !this.editor || this.state.generation !== e.generation)
42
+ return !0;
43
+ if ("value" in t) {
44
+ const i = this.getEditorContents(), o = t.value ?? "";
45
+ this.isEqualValue(o, i) || this.setEditorContents(this.editor, o);
46
+ }
47
+ return t.readOnly !== this.props.readOnly && this.setEditorReadOnly(this.editor, t.readOnly), [...this.cleanProps, ...this.dirtyProps].some((i) => !r(t[i], this.props[i]));
48
+ }
49
+ shouldComponentRegenerate(t) {
50
+ return this.dirtyProps.some((e) => !r(t[e], this.props[e]));
51
+ }
52
+ componentDidMount() {
53
+ this.instantiateEditor(), this.setEditorContents(this.editor, this.getEditorContents());
54
+ }
55
+ componentWillUnmount() {
56
+ this.destroyEditor();
57
+ }
58
+ componentDidUpdate(t, e) {
59
+ if (this.editor && this.shouldComponentRegenerate(t)) {
60
+ const i = this.editor.getContents(), o = this.editor.getSelection();
61
+ this.regenerationSnapshot = { delta: i, selection: o }, this.setState({ generation: this.state.generation + 1 }), this.destroyEditor();
62
+ }
63
+ if (this.editor && t.placeholder !== this.props.placeholder && (this.editor.root.dataset.placeholder = this.props.placeholder || ""), this.state.generation !== e.generation) {
64
+ const { delta: i, selection: o } = this.regenerationSnapshot;
65
+ delete this.regenerationSnapshot, this.instantiateEditor();
66
+ const s = this.editor;
67
+ s.setContents(i), c(() => this.setEditorSelection(s, o));
68
+ }
69
+ }
70
+ instantiateEditor() {
71
+ this.editor ? this.hookEditor(this.editor) : this.editor = this.createEditor(this.getEditingArea(), this.getEditorConfig());
72
+ }
73
+ destroyEditor() {
74
+ if (!this.editor)
75
+ return;
76
+ this.unhookEditor(this.editor);
77
+ const t = this.props.modules?.toolbar;
78
+ if (!(typeof t == "object" && t && "container" in t && typeof t.container == "string" || typeof t == "string")) {
79
+ const i = this.containerRef.current?.querySelector(".ql-toolbar");
80
+ i && i.remove();
81
+ }
82
+ delete this.editor;
83
+ }
84
+ /*
85
+ We consider the component to be controlled if `value` is being sent in props.
86
+ */
87
+ isControlled() {
88
+ return "value" in this.props;
89
+ }
90
+ getEditorConfig() {
91
+ return {
92
+ bounds: this.props.bounds,
93
+ formats: this.props.formats,
94
+ modules: this.props.modules,
95
+ placeholder: this.props.placeholder,
96
+ readOnly: this.props.readOnly,
97
+ tabIndex: this.props.tabIndex,
98
+ theme: this.props.theme
99
+ };
100
+ }
101
+ getEditor() {
102
+ if (!this.editor)
103
+ throw new Error("Accessing non-instantiated editor");
104
+ return this.editor;
105
+ }
106
+ /**
107
+ Creates an editor on the given element. The editor will be passed the
108
+ configuration, have its events bound,
109
+ */
110
+ createEditor(t, e) {
111
+ const i = new u(t, e);
112
+ return e.tabIndex != null && this.setEditorTabIndex(i, e.tabIndex), this.hookEditor(i), i;
113
+ }
114
+ hookEditor(t) {
115
+ this.unprivilegedEditor = this.makeUnprivilegedEditor(t), t.on("editor-change", this.onEditorChange);
116
+ }
117
+ unhookEditor(t) {
118
+ t.off("editor-change", this.onEditorChange);
119
+ }
120
+ getEditorContents() {
121
+ return this.value;
122
+ }
123
+ getEditorSelection() {
124
+ return this.selection;
125
+ }
126
+ /*
127
+ True if the value is a Delta instance or a Delta look-alike.
128
+ */
129
+ isDelta(t) {
130
+ return t && t.ops;
131
+ }
132
+ /*
133
+ Special comparison function that knows how to compare Deltas.
134
+ */
135
+ isEqualValue(t, e) {
136
+ return this.isDelta(t) && this.isDelta(e) ? r(t.ops, e.ops) : r(t, e);
137
+ }
138
+ /*
139
+ Replace the contents of the editor, but keep the previous selection hanging
140
+ around so that the cursor won't move.
141
+ */
142
+ setEditorContents(t, e) {
143
+ this.value = e;
144
+ const i = this.getEditorSelection();
145
+ typeof e == "string" ? t.setContents(t.clipboard.convert({ html: e })) : t.setContents(e), c(() => this.setEditorSelection(t, i));
146
+ }
147
+ setEditorSelection(t, e) {
148
+ if (this.selection = e, e) {
149
+ const i = t.getLength();
150
+ e.index = Math.max(0, Math.min(e.index, i - 1)), e.length = Math.max(0, Math.min(e.length, i - 1 - e.index)), t.setSelection(e);
151
+ }
152
+ }
153
+ setEditorTabIndex(t, e) {
154
+ t?.scroll?.domNode && (t.scroll.domNode.tabIndex = e);
155
+ }
156
+ setEditorReadOnly(t, e) {
157
+ e ? t.disable() : t.enable();
158
+ }
159
+ /*
160
+ Returns a weaker, unprivileged proxy object that only exposes read-only
161
+ accessors found on the editor instance, without any state-modifying methods.
162
+ */
163
+ makeUnprivilegedEditor(t) {
164
+ const e = t;
165
+ return {
166
+ getHTML: () => e.root.innerHTML,
167
+ getSemanticHTML: e.getSemanticHTML.bind(e),
168
+ getLength: e.getLength.bind(e),
169
+ getText: e.getText.bind(e),
170
+ getContents: e.getContents.bind(e),
171
+ getSelection: e.getSelection.bind(e),
172
+ getBounds: e.getBounds.bind(e)
173
+ };
174
+ }
175
+ getEditingArea() {
176
+ const t = this.editingAreaRef.current;
177
+ if (!t)
178
+ throw new Error("Cannot find element for editing area");
179
+ if (t.nodeType === 3)
180
+ throw new Error("Editing area cannot be a text node");
181
+ return t;
182
+ }
183
+ /*
184
+ Renders an editor area, unless it has been provided one to clone.
185
+ */
186
+ renderEditingArea() {
187
+ const { children: t, preserveWhitespace: e } = this.props, { generation: i } = this.state, o = {
188
+ key: i,
189
+ ref: this.editingAreaRef
190
+ };
191
+ return n.Children.count(t) ? n.cloneElement(n.Children.only(t), o) : e ? n.createElement("pre", { ...o }) : n.createElement("div", { ...o });
192
+ }
193
+ render() {
194
+ return n.createElement("div", { ref: this.containerRef, id: this.props.id, style: this.props.style, key: this.state.generation, className: `quill ${this.props.className ?? ""}`, onKeyPress: this.props.onKeyPress, onKeyDown: this.props.onKeyDown, onKeyUp: this.props.onKeyUp }, this.renderEditingArea());
195
+ }
196
+ onEditorChangeText(t, e, i, o) {
197
+ if (!this.editor)
198
+ return;
199
+ const s = this.isDelta(this.value) ? o.getContents() : o.getSemanticHTML();
200
+ s !== this.getEditorContents() && (this.lastDeltaChangeSet = e, this.value = s, this.props.onChange?.(t, e, i, o));
201
+ }
202
+ onEditorChangeSelection(t, e, i) {
203
+ if (!this.editor)
204
+ return;
205
+ const o = this.getEditorSelection(), s = !o && t, h = o && !t;
206
+ r(t, o) || (this.selection = t, this.props.onChangeSelection?.(t, e, i), s ? this.props.onFocus?.(t, e, i) : h && this.props.onBlur?.(o, e, i));
207
+ }
208
+ focus() {
209
+ this.editor && this.editor.focus();
210
+ }
211
+ blur() {
212
+ this.editor && (this.selection = null, this.editor.blur());
213
+ }
214
+ }
215
+ a.displayName = "React Quill";
216
+ a.Quill = u;
217
+ a.defaultProps = {
218
+ theme: "snow",
219
+ modules: {},
220
+ readOnly: !1
221
+ };
222
+ function c(d) {
223
+ Promise.resolve().then(d);
224
+ }
225
+ export {
226
+ u as Quill,
227
+ a as default
228
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react");function re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e){if(Array.isArray(e))return e}function be(e,t,r){return(t=Pe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,c,s=[],f=!0,g=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(f=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);f=!0);}catch(j){g=!0,o=j}finally{try{if(!f&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(g)throw o}}return s}}function we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ne(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oe(e,t){if(e==null)return{};var r,n,o=je(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function je(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Me(e,t){return me(e)||ye(e,t)||Ee(e,t)||we()}function Se(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pe(e){var t=Se(e,"string");return typeof t=="symbol"?t:t+""}function Ee(e,t){if(e){if(typeof e=="string")return re(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,t):void 0}}function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ie(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ie(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function L(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function z(e){return{}.toString.call(e).includes("Object")}function Te(e){return!Object.keys(e).length}function $(e){return typeof e=="function"}function Ce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Le(e,t){return z(t)||S("changeType"),Object.keys(t).some(function(r){return!Ce(e,r)})&&S("changeField"),t}function Ae(e){$(e)||S("selectorType")}function $e(e){$(e)||z(e)||S("handlerType"),z(e)&&Object.values(e).some(function(t){return!$(t)})&&S("handlersType")}function De(e){e||S("initialIsRequired"),z(e)||S("initialType"),Te(e)&&S("initialContent")}function Ve(e,t){throw new Error(e[t]||e.default)}var xe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},S=L(Ve)(xe),q={changes:Le,selector:Ae,handler:$e,initial:De};function qe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};q.initial(e),q.handler(t);var r={current:e},n=L(Ue)(r,t),o=L(ze)(r),i=L(q.changes)(e),c=L(Ne)(r);function s(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(j){return j};return q.selector(g),g(r.current)}function f(g){Ie(n,o,i,c)(g)}return[s,f]}function Ne(e,t){return $(t)?t(e.current):t}function ze(e,t){return e.current=ue(ue({},e.current),t),t}function Ue(e,t,r){return $(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Fe={create:qe},He={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function We(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function Ke(e){return{}.toString.call(e).includes("Object")}function Be(e){return e||ae("configIsRequired"),Ke(e)||ae("configType"),e.urls?(Ge(),{paths:{vs:e.urls.monacoBase}}):e}function Ge(){console.warn(ce.deprecation)}function Ye(e,t){throw new Error(e[t]||e.default)}var ce={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
+ You are using deprecated way of configuration.
4
+
5
+ Instead of using
6
+ monaco.config({ urls: { monacoBase: '...' } })
7
+ use
8
+ monaco.config({ paths: { vs: '...' } })
9
+
10
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
+ `},ae=We(Ye)(ce),_e={config:Be},Je=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(i,c){return c(i)},o)}};function le(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],le(e[r],t[r]))}),oe(oe({},e),t)}var Xe={type:"cancelation",msg:"operation is manually canceled"};function Z(e){var t=!1,r=new Promise(function(n,o){e.then(function(i){return t?o(Xe):n(i)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var Ze=["monaco"],ke=Fe.create({config:He,isInitialized:!1,resolve:null,reject:null,monaco:null}),se=Me(ke,2),D=se[0],U=se[1];function Qe(e){var t=_e.config(e),r=t.monaco,n=Oe(t,Ze);U(function(o){return{config:le(o.config,n),monaco:r}})}function et(){var e=D(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(U({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Z(k);if(window.monaco&&window.monaco.editor)return fe(window.monaco),e.resolve(window.monaco),Z(k);Je(tt,nt)(ot)}return Z(k)}function tt(e){return document.body.appendChild(e)}function rt(e){var t=document.createElement("script");return e&&(t.src=e),t}function nt(e){var t=D(function(n){var o=n.config,i=n.reject;return{config:o,reject:i}}),r=rt("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function ot(){var e=D(function(r){var n=r.config,o=r.resolve,i=r.reject;return{config:n,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var n=r.m||r;fe(n),e.resolve(n)},function(r){e.reject(r)})}function fe(e){D().monaco||U({monaco:e})}function it(){return D(function(e){var t=e.monaco;return t})}var k=new Promise(function(e,t){return U({resolve:e,reject:t})}),ee={config:Qe,init:et,__getMonacoInstance:it},ut={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Q=ut,at={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},ct=at;function lt({children:e}){return u.createElement("div",{style:ct.container},e)}var st=lt,ft=st;function dt({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:i,wrapperProps:c}){return u.createElement("section",{style:{...Q.wrapper,width:e,height:t},...c},!r&&u.createElement(ft,null,n),u.createElement("div",{ref:o,style:{...Q.fullWidth,...!r&&Q.hide},className:i}))}var pt=dt,de=u.memo(pt);function gt(e){u.useEffect(e,[])}var pe=gt;function vt(e,t,r=!0){let n=u.useRef(!0);u.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var w=vt;function A(){}function E(e,t,r,n){return ht(e,n)||mt(e,t,r,n)}function ht(e,t){return e.editor.getModel(ge(e,t))}function mt(e,t,r,n){return e.editor.createModel(t,r,n?ge(e,n):void 0)}function ge(e,t){return e.Uri.parse(t)}function bt({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:c,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:f=!1,theme:g="light",loading:j="Loading...",options:O={},height:F="100%",width:H="100%",className:W,wrapperProps:K={},beforeMount:B=A,onMount:G=A}){let[y,R]=u.useState(!1),[I,d]=u.useState(!0),v=u.useRef(null),p=u.useRef(null),T=u.useRef(null),m=u.useRef(G),a=u.useRef(B),P=u.useRef(!1);pe(()=>{let l=ee.init();return l.then(h=>(p.current=h)&&d(!1)).catch(h=>h?.type!=="cancelation"&&console.error("Monaco initialization: error:",h)),()=>v.current?C():l.cancel()}),w(()=>{if(v.current&&p.current){let l=v.current.getOriginalEditor(),h=E(p.current,e||"",n||r||"text",i||"");h!==l.getModel()&&l.setModel(h)}},[i],y),w(()=>{if(v.current&&p.current){let l=v.current.getModifiedEditor(),h=E(p.current,t||"",o||r||"text",c||"");h!==l.getModel()&&l.setModel(h)}},[c],y),w(()=>{let l=v.current.getModifiedEditor();l.getOption(p.current.editor.EditorOption.readOnly)?l.setValue(t||""):t!==l.getValue()&&(l.executeEdits("",[{range:l.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),l.pushUndoStop())},[t],y),w(()=>{v.current?.getModel()?.original.setValue(e||"")},[e],y),w(()=>{let{original:l,modified:h}=v.current.getModel();p.current.editor.setModelLanguage(l,n||r||"text"),p.current.editor.setModelLanguage(h,o||r||"text")},[r,n,o],y),w(()=>{p.current?.editor.setTheme(g)},[g],y),w(()=>{v.current?.updateOptions(O)},[O],y);let V=u.useCallback(()=>{if(!p.current)return;a.current(p.current);let l=E(p.current,e||"",n||r||"text",i||""),h=E(p.current,t||"",o||r||"text",c||"");v.current?.setModel({original:l,modified:h})},[r,t,o,e,n,i,c]),x=u.useCallback(()=>{!P.current&&T.current&&(v.current=p.current.editor.createDiffEditor(T.current,{automaticLayout:!0,...O}),V(),p.current?.editor.setTheme(g),R(!0),P.current=!0)},[O,g,V]);u.useEffect(()=>{y&&m.current(v.current,p.current)},[y]),u.useEffect(()=>{!I&&!y&&x()},[I,y,x]);function C(){let l=v.current?.getModel();s||l?.original?.dispose(),f||l?.modified?.dispose(),v.current?.dispose()}return u.createElement(de,{width:H,height:F,isEditorReady:y,loading:j,_ref:T,className:W,wrapperProps:K})}var yt=bt;u.memo(yt);function wt(e){let t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}var Ot=wt,N=new Map;function jt({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:i,theme:c="light",line:s,loading:f="Loading...",options:g={},overrideServices:j={},saveViewState:O=!0,keepCurrentModel:F=!1,width:H="100%",height:W="100%",className:K,wrapperProps:B={},beforeMount:G=A,onMount:y=A,onChange:R,onValidate:I=A}){let[d,v]=u.useState(!1),[p,T]=u.useState(!0),m=u.useRef(null),a=u.useRef(null),P=u.useRef(null),V=u.useRef(y),x=u.useRef(G),C=u.useRef(void 0),l=u.useRef(n),h=Ot(i),Y=u.useRef(!1),_=u.useRef(!1);pe(()=>{let b=ee.init();return b.then(M=>(m.current=M)&&T(!1)).catch(M=>M?.type!=="cancelation"&&console.error("Monaco initialization: error:",M)),()=>a.current?he():b.cancel()}),w(()=>{let b=E(m.current,e||n||"",t||o||"",i||r||"");b!==a.current?.getModel()&&(O&&N.set(h,a.current?.saveViewState()),a.current?.setModel(b),O&&a.current?.restoreViewState(N.get(i)))},[i],d),w(()=>{a.current?.updateOptions(g)},[g],d),w(()=>{!a.current||n===void 0||(a.current.getOption(m.current.editor.EditorOption.readOnly)?a.current.setValue(n):n!==a.current.getValue()&&(_.current=!0,a.current.executeEdits("",[{range:a.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),a.current.pushUndoStop(),_.current=!1))},[n],d),w(()=>{let b=a.current?.getModel();d&&b&&o&&m.current?.editor.setModelLanguage(b,o)},[o,d],d),w(()=>{s!==void 0&&a.current?.revealLine(s)},[s],d),w(()=>{m.current?.editor.setTheme(c)},[c],d);let te=u.useCallback(()=>{if(!(!P.current||!m.current)&&!Y.current){x.current(m.current);let b=i||r,M=E(m.current,n||e||"",t||o||"",b||"");a.current=m.current?.editor.create(P.current,{model:M,automaticLayout:!0,...g},j),O&&a.current.restoreViewState(N.get(b)),m.current.editor.setTheme(c),s!==void 0&&a.current.revealLine(s),v(!0),Y.current=!0}},[e,t,r,n,o,i,g,j,O,c,s]);u.useEffect(()=>{d&&V.current(a.current,m.current)},[d]),u.useEffect(()=>{!p&&!d&&te()},[p,d,te]),l.current=n,u.useEffect(()=>{d&&R&&(C.current?.dispose(),C.current=a.current?.onDidChangeModelContent(b=>{_.current||R(a.current.getValue(),b)}))},[d,R]),u.useEffect(()=>{if(d){let b=m.current.editor.onDidChangeMarkers(M=>{let J=a.current.getModel()?.uri;if(J&&M.find(X=>X.path===J.path)){let X=m.current.editor.getModelMarkers({resource:J});I?.(X)}});return()=>{b?.dispose()}}return()=>{}},[d,I]);function he(){C.current?.dispose(),F?O&&N.set(i,a.current.saveViewState()):a.current.getModel()?.dispose(),a.current.dispose(),a.current=null,Y.current=!1,v(!1)}return u.createElement(de,{width:H,height:W,isEditorReady:d,loading:f,_ref:P,className:K,wrapperProps:B})}var Mt=jt,ve=u.memo(Mt),St=ve;exports.Editor=ve;exports.default=St;exports.loader=ee;