@instincthub/react-ui 0.1.37 → 0.1.39
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/src/assets/css/modals/modal-updates.css +2 -0
- package/dist/src/assets/css/modals.css +176 -0
- package/dist/src/assets/css/ui/content-viewer.css +0 -1
- package/dist/src/assets/css/ui/ihub-text-editor.css +22 -4
- package/dist/src/components/forms/FilterObjects.js +1 -1
- package/dist/src/components/lib/modals/modals.js +1 -1
- package/dist/src/components/lib/modals/modals.js.map +1 -1
- package/dist/src/components/ui/editor/ihub-editor/IHubTextEditor.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/BubbleToolbar.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/hooks/useIHubEditor.js +1 -1
- package/dist/src/types/components/lib/modals/modals.d.ts +134 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),i=require("../../../../../../node_modules/.pnpm/@tiptap_starter-kit@2.27.1/node_modules/@tiptap/starter-kit/dist/index.js"),p=require("../../../../../../node_modules/.pnpm/@tiptap_extension-image@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-image/dist/index.js"),n=require("../../../../../../node_modules/.pnpm/@tiptap_extension-link@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-link/dist/index.js"),o=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-table/dist/index.js"),s=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-row@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-row/dist/index.js"),a=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-cell@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-cell/dist/index.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),i=require("../../../../../../node_modules/.pnpm/@tiptap_starter-kit@2.27.1/node_modules/@tiptap/starter-kit/dist/index.js"),p=require("../../../../../../node_modules/.pnpm/@tiptap_extension-image@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-image/dist/index.js"),n=require("../../../../../../node_modules/.pnpm/@tiptap_extension-link@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-link/dist/index.js"),o=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-table/dist/index.js"),s=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-row@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-row/dist/index.js"),a=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-cell@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-cell/dist/index.js"),r=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-header@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-header/dist/index.js"),_=require("../../../../../../node_modules/.pnpm/@tiptap_extension-code-block@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-code-block/dist/index.js"),d=require("../../../../../../node_modules/.pnpm/@tiptap_extension-highlight@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-highlight/dist/index.js"),u=require("../../../../../../node_modules/.pnpm/@tiptap_extension-task-list@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-task-list/dist/index.js"),l=require("../../../../../../node_modules/.pnpm/@tiptap_extension-task-item@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-task-item/dist/index.js"),m=require("../../../../../../node_modules/.pnpm/@tiptap_extension-placeholder@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-placeholder/dist/index.js"),c=require("../../../../../../node_modules/.pnpm/@tiptap_extension-character-count@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-character-count/dist/index.js"),x=require("../../../../../../node_modules/.pnpm/@tiptap_extension-underline@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-underline/dist/index.js"),h=require("../../../../../../node_modules/.pnpm/@tiptap_extension-typography@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-typography/dist/index.js"),f=require("../../../../../../node_modules/.pnpm/@tiptap_extension-focus@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-focus/dist/index.js"),b=require("../../../../../../node_modules/.pnpm/@tiptap_extension-youtube@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-youtube/dist/index.js"),g=require("../../../../../../node_modules/.pnpm/@tiptap_extension-text-align@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-text-align/dist/index.js"),j=require("../../../../../../node_modules/.pnpm/@tiptap_extension-dropcursor@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-dropcursor/dist/index.js"),q=require("../../../../../../node_modules/.pnpm/@tiptap_extension-color@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_extension_3361c5fd95bc28ff82624b8eb98b2834/node_modules/@tiptap/extension-color/dist/index.js"),y=require("../../../../../../node_modules/.pnpm/@tiptap_extension-text-style@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-text-style/dist/index.js"),k=require("../types.js"),C=require("../extensions/PullQuoteExtension.js"),v=require("../extensions/SlashCommandExtension.js"),E=require("../extensions/ImageWithCaption.js"),T=require("../extensions/EmbedExtension.js"),S=require("../constants.js");exports.default=function(L){var w=L.content,A=void 0===w?"":w;L.placeholder;var H=L.charLimit,M=void 0===H?5e4:H,O=L.features,B=L.readOnly,D=void 0!==B&&B,P=L.onChange,U=L.onBlur,F=L.additionalExtensions,I=void 0===F?[]:F,K=L.onSlashCommandStart,N=L.onSlashCommandExit,Q=e.objectSpread2(e.objectSpread2({},k.DEFAULT_FEATURES),O),R=[i.StarterKit.configure({dropcursor:!1,codeBlock:!1}),n.Link.configure({openOnClick:!1,HTMLAttributes:{class:"ihub-te-link"}}),x.Underline,d.Highlight.configure({multicolor:!0}),y.TextStyle,q.Color,j.Dropcursor.configure({color:"var(--DarkCyan)",width:2}),g.TextAlign.configure({types:["heading","paragraph"]}),p.Image,E.default,m.Placeholder.configure({placeholder:function(e){var t=e.node;return"heading"===t.type.name?"Heading ".concat(t.attrs.level):"Press '/' for commands"},showOnlyCurrent:!0,emptyEditorClass:"ihub-te-empty"}),c.CharacterCount.configure({limit:M})];return Q.tables&&R.push(o.Table.configure({resizable:!0}),s.TableRow,a.TableCell,r.TableHeader),Q.codeBlocks&&R.push(_.CodeBlock.configure({exitOnTripleEnter:!0,exitOnArrowDown:!0})),Q.taskLists&&R.push(u.TaskList,l.TaskItem.configure({nested:!0})),Q.pullQuotes&&R.push(C.default),Q.mediaEmbeds&&R.push(b.Youtube.configure({HTMLAttributes:{class:"ihub-te-youtube"}}),T.default),Q.typography&&R.push(h.Typography),Q.focusMode&&R.push(f.FocusClasses.configure({className:"ihub-te-has-focus",mode:"deepest"})),Q.slashCommands&&R.push(v.default.configure({suggestion:{items:function(e){var t=e.query;return S.SLASH_COMMANDS.filter(function(e){return e.title.toLowerCase().includes(t.toLowerCase())}).slice(0,10)},render:function(){return{onStart:function(e){null==K||K(e)},onUpdate:function(e){null==K||K(e)},onKeyDown:function(e){return"Escape"===e.event.key&&(null==N||N(),!0)},onExit:function(){null==N||N()}}}}})),R.push.apply(R,e.toConsumableArray(I)),t.useEditor({extensions:R,content:A,editable:!D,editorProps:{attributes:{class:"ihub-te-content"}},onUpdate:function(e){var t=e.editor;null==P||P(t.getHTML())},onBlur:function(){null==U||U()}})};
|
|
2
2
|
//# sourceMappingURL=useIHubEditor.js.map
|
|
@@ -9,7 +9,141 @@ declare global {
|
|
|
9
9
|
handleCleanUpInput: () => void;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Opens a confirmation modal that returns a promise resolving to the user's choice.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { openConfirmModal } from "@instincthub/react-ui/lib";
|
|
18
|
+
*
|
|
19
|
+
* // Basic confirmation
|
|
20
|
+
* const handleAction = async () => {
|
|
21
|
+
* const confirmed = await openConfirmModal("Are you sure you want to proceed?");
|
|
22
|
+
* if (confirmed) {
|
|
23
|
+
* // User clicked "Ok"
|
|
24
|
+
* performAction();
|
|
25
|
+
* }
|
|
26
|
+
* };
|
|
27
|
+
*
|
|
28
|
+
* // With warning flag (red warning banner)
|
|
29
|
+
* const handleDangerousAction = async () => {
|
|
30
|
+
* const confirmed = await openConfirmModal(
|
|
31
|
+
* "This will permanently remove all data. Continue?",
|
|
32
|
+
* true // Shows red warning banner
|
|
33
|
+
* );
|
|
34
|
+
* if (confirmed) {
|
|
35
|
+
* deleteAllData();
|
|
36
|
+
* }
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* // In a form submission flow
|
|
40
|
+
* const handleSubmit = async (formData: FormData) => {
|
|
41
|
+
* const confirmed = await openConfirmModal(
|
|
42
|
+
* "You are about to submit this form. Please review your entries."
|
|
43
|
+
* );
|
|
44
|
+
* if (confirmed) {
|
|
45
|
+
* await submitForm(formData);
|
|
46
|
+
* openToast("Form submitted successfully!");
|
|
47
|
+
* }
|
|
48
|
+
* };
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param message - The confirmation message to display
|
|
52
|
+
* @param flag - If true, shows a red warning banner instead of the default purple one
|
|
53
|
+
* @returns Promise that resolves to `true` (Ok) or `false` (Cancel / overlay click)
|
|
54
|
+
*/
|
|
12
55
|
export declare const openConfirmModal: (message: string, flag?: boolean) => Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Displays an auto-dismissing toast notification with status-based styling,
|
|
58
|
+
* a countdown progress bar, and stacking support for multiple toasts.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* import { openToast } from "@instincthub/react-ui/lib";
|
|
63
|
+
*
|
|
64
|
+
* // Success notifications
|
|
65
|
+
* openToast("Profile updated successfully!");
|
|
66
|
+
* openToast("New item created!", 201);
|
|
67
|
+
*
|
|
68
|
+
* // Error notifications
|
|
69
|
+
* openToast("Please check your input.", 400);
|
|
70
|
+
* openToast("You don't have permission.", 403);
|
|
71
|
+
*
|
|
72
|
+
* // Server error
|
|
73
|
+
* openToast("Server error occurred.", 500);
|
|
74
|
+
*
|
|
75
|
+
* // Default messages (no custom message)
|
|
76
|
+
* openToast(); // "Awesome! The update was made."
|
|
77
|
+
* openToast(undefined, 400); // "Hmmm..., Something went wrong. Try again"
|
|
78
|
+
* openToast(undefined, 500); // "Sorry, the server can't process your request"
|
|
79
|
+
*
|
|
80
|
+
* // In async operations
|
|
81
|
+
* const handleSave = async () => {
|
|
82
|
+
* try {
|
|
83
|
+
* await saveData();
|
|
84
|
+
* openToast("Data saved successfully!");
|
|
85
|
+
* } catch (error) {
|
|
86
|
+
* openToast("Failed to save data.", 500);
|
|
87
|
+
* }
|
|
88
|
+
* };
|
|
89
|
+
*
|
|
90
|
+
* // After form validation
|
|
91
|
+
* if (!isValid) {
|
|
92
|
+
* openToast("Please fill in all required fields.", 400);
|
|
93
|
+
* return;
|
|
94
|
+
* }
|
|
95
|
+
*
|
|
96
|
+
* // After API delete
|
|
97
|
+
* openToast(`${itemName} was successfully deleted.`);
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @param message - Custom notification message. Falls back to a default based on status code.
|
|
101
|
+
* @param status - HTTP-style status code for styling (default: 200).
|
|
102
|
+
* - `200/201` → green success icon
|
|
103
|
+
* - `400-499` → red error icon
|
|
104
|
+
* - `500+` → red error icon
|
|
105
|
+
*/
|
|
13
106
|
export declare const openToast: (message?: React.ReactDOM | string, status?: StatusCode) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Opens a modal dialog to collect a user's email address with built-in validation.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* import { getUserEmailInputModal } from "@instincthub/react-ui/lib";
|
|
113
|
+
*
|
|
114
|
+
* // Collect email for course enrollment
|
|
115
|
+
* const handleEnroll = async () => {
|
|
116
|
+
* const email = await getUserEmailInputModal("Web Development Bootcamp");
|
|
117
|
+
* if (email) {
|
|
118
|
+
* // User entered a valid email and clicked "Proceed"
|
|
119
|
+
* await enrollUser(email, courseId);
|
|
120
|
+
* openToast("Enrollment successful!");
|
|
121
|
+
* } else {
|
|
122
|
+
* // User cancelled or closed the modal
|
|
123
|
+
* console.log("Enrollment cancelled");
|
|
124
|
+
* }
|
|
125
|
+
* };
|
|
126
|
+
*
|
|
127
|
+
* // Collect email for newsletter signup
|
|
128
|
+
* const handleNewsletter = async () => {
|
|
129
|
+
* const email = await getUserEmailInputModal("Weekly Newsletter");
|
|
130
|
+
* if (email) {
|
|
131
|
+
* await subscribeToNewsletter(email);
|
|
132
|
+
* }
|
|
133
|
+
* };
|
|
134
|
+
*
|
|
135
|
+
* // Collect email before downloading a resource
|
|
136
|
+
* const handleDownload = async () => {
|
|
137
|
+
* const email = await getUserEmailInputModal("Free E-Book: React Patterns");
|
|
138
|
+
* if (email) {
|
|
139
|
+
* await sendDownloadLink(email, resourceId);
|
|
140
|
+
* openToast("Download link sent to your email!", 200);
|
|
141
|
+
* }
|
|
142
|
+
* };
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @param title - The title displayed in the modal (e.g. course name, resource name)
|
|
146
|
+
* @returns Promise that resolves to the email string if valid, or `undefined` if cancelled
|
|
147
|
+
*/
|
|
14
148
|
export declare const getUserEmailInputModal: (title: string) => Promise<string | undefined>;
|
|
15
149
|
export {};
|