@blocknote/ariakit 0.13.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 (52) hide show
  1. package/LICENSE +373 -0
  2. package/dist/blocknote-ariakit.js +1146 -0
  3. package/dist/blocknote-ariakit.js.map +1 -0
  4. package/dist/blocknote-ariakit.umd.cjs +28 -0
  5. package/dist/blocknote-ariakit.umd.cjs.map +1 -0
  6. package/dist/style.css +1 -0
  7. package/dist/webpack-stats.json +1 -0
  8. package/package.json +84 -0
  9. package/src/ariakitStyles.css +1005 -0
  10. package/src/index.tsx +103 -0
  11. package/src/input/Form.tsx +12 -0
  12. package/src/input/TextInput.tsx +48 -0
  13. package/src/menu/Menu.tsx +130 -0
  14. package/src/panel/Panel.tsx +55 -0
  15. package/src/panel/PanelButton.tsx +24 -0
  16. package/src/panel/PanelFileInput.tsx +28 -0
  17. package/src/panel/PanelTab.tsx +18 -0
  18. package/src/panel/PanelTextInput.tsx +29 -0
  19. package/src/popover/Popover.tsx +47 -0
  20. package/src/sideMenu/SideMenu.tsx +20 -0
  21. package/src/sideMenu/SideMenuButton.tsx +44 -0
  22. package/src/style.css +136 -0
  23. package/src/suggestionMenu/SuggestionMenu.tsx +24 -0
  24. package/src/suggestionMenu/SuggestionMenuEmptyItem.tsx +20 -0
  25. package/src/suggestionMenu/SuggestionMenuItem.tsx +43 -0
  26. package/src/suggestionMenu/SuggestionMenuLabel.tsx +20 -0
  27. package/src/suggestionMenu/SuggestionMenuLoader.tsx +18 -0
  28. package/src/tableHandle/TableHandle.tsx +42 -0
  29. package/src/toolbar/Toolbar.tsx +26 -0
  30. package/src/toolbar/ToolbarButton.tsx +73 -0
  31. package/src/toolbar/ToolbarSelect.tsx +47 -0
  32. package/types/src/index.d.ts +6 -0
  33. package/types/src/input/Form.d.ts +2 -0
  34. package/types/src/input/TextInput.d.ts +13 -0
  35. package/types/src/menu/Menu.d.ts +24 -0
  36. package/types/src/panel/Panel.d.ts +12 -0
  37. package/types/src/panel/PanelButton.d.ts +11 -0
  38. package/types/src/panel/PanelFileInput.d.ts +7 -0
  39. package/types/src/panel/PanelTab.d.ts +5 -0
  40. package/types/src/panel/PanelTextInput.d.ts +8 -0
  41. package/types/src/popover/Popover.d.ts +11 -0
  42. package/types/src/sideMenu/SideMenu.d.ts +5 -0
  43. package/types/src/sideMenu/SideMenuButton.d.ts +15 -0
  44. package/types/src/suggestionMenu/SuggestionMenu.d.ts +6 -0
  45. package/types/src/suggestionMenu/SuggestionMenuEmptyItem.d.ts +5 -0
  46. package/types/src/suggestionMenu/SuggestionMenuItem.d.ts +8 -0
  47. package/types/src/suggestionMenu/SuggestionMenuLabel.d.ts +5 -0
  48. package/types/src/suggestionMenu/SuggestionMenuLoader.d.ts +5 -0
  49. package/types/src/tableHandle/TableHandle.d.ts +14 -0
  50. package/types/src/toolbar/Toolbar.d.ts +10 -0
  51. package/types/src/toolbar/ToolbarButton.d.ts +8 -0
  52. package/types/src/toolbar/ToolbarSelect.d.ts +12 -0
@@ -0,0 +1,1146 @@
1
+ import we, { forwardRef as E } from "react";
2
+ import { ComponentsContext as vr, BlockNoteViewRaw as mr } from "@blocknote/react";
3
+ import * as f from "@ariakit/react";
4
+ import { assertEmpty as y, mergeCSSClasses as _, isSafari as pr } from "@blocknote/core";
5
+ var re = { exports: {} }, $ = {};
6
+ /**
7
+ * @license React
8
+ * react-jsx-runtime.production.min.js
9
+ *
10
+ * Copyright (c) Facebook, Inc. and its affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var Se;
16
+ function br() {
17
+ if (Se)
18
+ return $;
19
+ Se = 1;
20
+ var a = we, s = Symbol.for("react.element"), i = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, l = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
21
+ function p(g, d, h) {
22
+ var R, k = {}, N = null, W = null;
23
+ h !== void 0 && (N = "" + h), d.key !== void 0 && (N = "" + d.key), d.ref !== void 0 && (W = d.ref);
24
+ for (R in d)
25
+ n.call(d, R) && !u.hasOwnProperty(R) && (k[R] = d[R]);
26
+ if (g && g.defaultProps)
27
+ for (R in d = g.defaultProps, d)
28
+ k[R] === void 0 && (k[R] = d[R]);
29
+ return { $$typeof: s, type: g, key: N, ref: W, props: k, _owner: l.current };
30
+ }
31
+ return $.Fragment = i, $.jsx = p, $.jsxs = p, $;
32
+ }
33
+ var B = {};
34
+ /**
35
+ * @license React
36
+ * react-jsx-runtime.development.js
37
+ *
38
+ * Copyright (c) Facebook, Inc. and its affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */
43
+ var Pe;
44
+ function hr() {
45
+ return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && function() {
46
+ var a = we, s = Symbol.for("react.element"), i = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), l = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), p = Symbol.for("react.provider"), g = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), W = Symbol.for("react.offscreen"), te = Symbol.iterator, Oe = "@@iterator";
47
+ function Ie(e) {
48
+ if (e === null || typeof e != "object")
49
+ return null;
50
+ var r = te && e[te] || e[Oe];
51
+ return typeof r == "function" ? r : null;
52
+ }
53
+ var D = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
54
+ function S(e) {
55
+ {
56
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), c = 1; c < r; c++)
57
+ t[c - 1] = arguments[c];
58
+ De("error", e, t);
59
+ }
60
+ }
61
+ function De(e, r, t) {
62
+ {
63
+ var c = D.ReactDebugCurrentFrame, b = c.getStackAddendum();
64
+ b !== "" && (r += "%s", t = t.concat([b]));
65
+ var x = t.map(function(m) {
66
+ return String(m);
67
+ });
68
+ x.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, x);
69
+ }
70
+ }
71
+ var Fe = !1, Me = !1, Ae = !1, Le = !1, $e = !1, ne;
72
+ ne = Symbol.for("react.module.reference");
73
+ function Be(e) {
74
+ return !!(typeof e == "string" || typeof e == "function" || e === n || e === u || $e || e === l || e === h || e === R || Le || e === W || Fe || Me || Ae || typeof e == "object" && e !== null && (e.$$typeof === N || e.$$typeof === k || e.$$typeof === p || e.$$typeof === g || e.$$typeof === d || // This needs to include all possible module reference object
75
+ // types supported by any Flight configuration anywhere since
76
+ // we don't know which Flight build this will end up being used
77
+ // with.
78
+ e.$$typeof === ne || e.getModuleId !== void 0));
79
+ }
80
+ function We(e, r, t) {
81
+ var c = e.displayName;
82
+ if (c)
83
+ return c;
84
+ var b = r.displayName || r.name || "";
85
+ return b !== "" ? t + "(" + b + ")" : t;
86
+ }
87
+ function ae(e) {
88
+ return e.displayName || "Context";
89
+ }
90
+ function w(e) {
91
+ if (e == null)
92
+ return null;
93
+ if (typeof e.tag == "number" && S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
94
+ return e.displayName || e.name || null;
95
+ if (typeof e == "string")
96
+ return e;
97
+ switch (e) {
98
+ case n:
99
+ return "Fragment";
100
+ case i:
101
+ return "Portal";
102
+ case u:
103
+ return "Profiler";
104
+ case l:
105
+ return "StrictMode";
106
+ case h:
107
+ return "Suspense";
108
+ case R:
109
+ return "SuspenseList";
110
+ }
111
+ if (typeof e == "object")
112
+ switch (e.$$typeof) {
113
+ case g:
114
+ var r = e;
115
+ return ae(r) + ".Consumer";
116
+ case p:
117
+ var t = e;
118
+ return ae(t._context) + ".Provider";
119
+ case d:
120
+ return We(e, e.render, "ForwardRef");
121
+ case k:
122
+ var c = e.displayName || null;
123
+ return c !== null ? c : w(e.type) || "Memo";
124
+ case N: {
125
+ var b = e, x = b._payload, m = b._init;
126
+ try {
127
+ return w(m(x));
128
+ } catch {
129
+ return null;
130
+ }
131
+ }
132
+ }
133
+ return null;
134
+ }
135
+ var I = Object.assign, A = 0, oe, se, ie, le, ce, ue, fe;
136
+ function de() {
137
+ }
138
+ de.__reactDisabledLog = !0;
139
+ function Ye() {
140
+ {
141
+ if (A === 0) {
142
+ oe = console.log, se = console.info, ie = console.warn, le = console.error, ce = console.group, ue = console.groupCollapsed, fe = console.groupEnd;
143
+ var e = {
144
+ configurable: !0,
145
+ enumerable: !0,
146
+ value: de,
147
+ writable: !0
148
+ };
149
+ Object.defineProperties(console, {
150
+ info: e,
151
+ log: e,
152
+ warn: e,
153
+ error: e,
154
+ group: e,
155
+ groupCollapsed: e,
156
+ groupEnd: e
157
+ });
158
+ }
159
+ A++;
160
+ }
161
+ }
162
+ function Ve() {
163
+ {
164
+ if (A--, A === 0) {
165
+ var e = {
166
+ configurable: !0,
167
+ enumerable: !0,
168
+ writable: !0
169
+ };
170
+ Object.defineProperties(console, {
171
+ log: I({}, e, {
172
+ value: oe
173
+ }),
174
+ info: I({}, e, {
175
+ value: se
176
+ }),
177
+ warn: I({}, e, {
178
+ value: ie
179
+ }),
180
+ error: I({}, e, {
181
+ value: le
182
+ }),
183
+ group: I({}, e, {
184
+ value: ce
185
+ }),
186
+ groupCollapsed: I({}, e, {
187
+ value: ue
188
+ }),
189
+ groupEnd: I({}, e, {
190
+ value: fe
191
+ })
192
+ });
193
+ }
194
+ A < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
195
+ }
196
+ }
197
+ var J = D.ReactCurrentDispatcher, K;
198
+ function Y(e, r, t) {
199
+ {
200
+ if (K === void 0)
201
+ try {
202
+ throw Error();
203
+ } catch (b) {
204
+ var c = b.stack.trim().match(/\n( *(at )?)/);
205
+ K = c && c[1] || "";
206
+ }
207
+ return `
208
+ ` + K + e;
209
+ }
210
+ }
211
+ var z = !1, V;
212
+ {
213
+ var Ue = typeof WeakMap == "function" ? WeakMap : Map;
214
+ V = new Ue();
215
+ }
216
+ function ve(e, r) {
217
+ if (!e || z)
218
+ return "";
219
+ {
220
+ var t = V.get(e);
221
+ if (t !== void 0)
222
+ return t;
223
+ }
224
+ var c;
225
+ z = !0;
226
+ var b = Error.prepareStackTrace;
227
+ Error.prepareStackTrace = void 0;
228
+ var x;
229
+ x = J.current, J.current = null, Ye();
230
+ try {
231
+ if (r) {
232
+ var m = function() {
233
+ throw Error();
234
+ };
235
+ if (Object.defineProperty(m.prototype, "props", {
236
+ set: function() {
237
+ throw Error();
238
+ }
239
+ }), typeof Reflect == "object" && Reflect.construct) {
240
+ try {
241
+ Reflect.construct(m, []);
242
+ } catch (O) {
243
+ c = O;
244
+ }
245
+ Reflect.construct(e, [], m);
246
+ } else {
247
+ try {
248
+ m.call();
249
+ } catch (O) {
250
+ c = O;
251
+ }
252
+ e.call(m.prototype);
253
+ }
254
+ } else {
255
+ try {
256
+ throw Error();
257
+ } catch (O) {
258
+ c = O;
259
+ }
260
+ e();
261
+ }
262
+ } catch (O) {
263
+ if (O && c && typeof O.stack == "string") {
264
+ for (var v = O.stack.split(`
265
+ `), P = c.stack.split(`
266
+ `), j = v.length - 1, T = P.length - 1; j >= 1 && T >= 0 && v[j] !== P[T]; )
267
+ T--;
268
+ for (; j >= 1 && T >= 0; j--, T--)
269
+ if (v[j] !== P[T]) {
270
+ if (j !== 1 || T !== 1)
271
+ do
272
+ if (j--, T--, T < 0 || v[j] !== P[T]) {
273
+ var C = `
274
+ ` + v[j].replace(" at new ", " at ");
275
+ return e.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, C), C;
276
+ }
277
+ while (j >= 1 && T >= 0);
278
+ break;
279
+ }
280
+ }
281
+ } finally {
282
+ z = !1, J.current = x, Ve(), Error.prepareStackTrace = b;
283
+ }
284
+ var M = e ? e.displayName || e.name : "", ke = M ? Y(M) : "";
285
+ return typeof e == "function" && V.set(e, ke), ke;
286
+ }
287
+ function Ge(e, r, t) {
288
+ return ve(e, !1);
289
+ }
290
+ function qe(e) {
291
+ var r = e.prototype;
292
+ return !!(r && r.isReactComponent);
293
+ }
294
+ function U(e, r, t) {
295
+ if (e == null)
296
+ return "";
297
+ if (typeof e == "function")
298
+ return ve(e, qe(e));
299
+ if (typeof e == "string")
300
+ return Y(e);
301
+ switch (e) {
302
+ case h:
303
+ return Y("Suspense");
304
+ case R:
305
+ return Y("SuspenseList");
306
+ }
307
+ if (typeof e == "object")
308
+ switch (e.$$typeof) {
309
+ case d:
310
+ return Ge(e.render);
311
+ case k:
312
+ return U(e.type, r, t);
313
+ case N: {
314
+ var c = e, b = c._payload, x = c._init;
315
+ try {
316
+ return U(x(b), r, t);
317
+ } catch {
318
+ }
319
+ }
320
+ }
321
+ return "";
322
+ }
323
+ var G = Object.prototype.hasOwnProperty, me = {}, pe = D.ReactDebugCurrentFrame;
324
+ function q(e) {
325
+ if (e) {
326
+ var r = e._owner, t = U(e.type, e._source, r ? r.type : null);
327
+ pe.setExtraStackFrame(t);
328
+ } else
329
+ pe.setExtraStackFrame(null);
330
+ }
331
+ function Je(e, r, t, c, b) {
332
+ {
333
+ var x = Function.call.bind(G);
334
+ for (var m in e)
335
+ if (x(e, m)) {
336
+ var v = void 0;
337
+ try {
338
+ if (typeof e[m] != "function") {
339
+ var P = Error((c || "React class") + ": " + t + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
340
+ throw P.name = "Invariant Violation", P;
341
+ }
342
+ v = e[m](r, m, c, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
343
+ } catch (j) {
344
+ v = j;
345
+ }
346
+ v && !(v instanceof Error) && (q(b), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", c || "React class", t, m, typeof v), q(null)), v instanceof Error && !(v.message in me) && (me[v.message] = !0, q(b), S("Failed %s type: %s", t, v.message), q(null));
347
+ }
348
+ }
349
+ }
350
+ var Ke = Array.isArray;
351
+ function H(e) {
352
+ return Ke(e);
353
+ }
354
+ function ze(e) {
355
+ {
356
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
357
+ return t;
358
+ }
359
+ }
360
+ function He(e) {
361
+ try {
362
+ return be(e), !1;
363
+ } catch {
364
+ return !0;
365
+ }
366
+ }
367
+ function be(e) {
368
+ return "" + e;
369
+ }
370
+ function he(e) {
371
+ if (He(e))
372
+ return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ze(e)), be(e);
373
+ }
374
+ var L = D.ReactCurrentOwner, Xe = {
375
+ key: !0,
376
+ ref: !0,
377
+ __self: !0,
378
+ __source: !0
379
+ }, ge, xe, X;
380
+ X = {};
381
+ function Ze(e) {
382
+ if (G.call(e, "ref")) {
383
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
384
+ if (r && r.isReactWarning)
385
+ return !1;
386
+ }
387
+ return e.ref !== void 0;
388
+ }
389
+ function Qe(e) {
390
+ if (G.call(e, "key")) {
391
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
392
+ if (r && r.isReactWarning)
393
+ return !1;
394
+ }
395
+ return e.key !== void 0;
396
+ }
397
+ function er(e, r) {
398
+ if (typeof e.ref == "string" && L.current && r && L.current.stateNode !== r) {
399
+ var t = w(L.current.type);
400
+ X[t] || (S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', w(L.current.type), e.ref), X[t] = !0);
401
+ }
402
+ }
403
+ function rr(e, r) {
404
+ {
405
+ var t = function() {
406
+ ge || (ge = !0, S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
407
+ };
408
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
409
+ get: t,
410
+ configurable: !0
411
+ });
412
+ }
413
+ }
414
+ function tr(e, r) {
415
+ {
416
+ var t = function() {
417
+ xe || (xe = !0, S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
418
+ };
419
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
420
+ get: t,
421
+ configurable: !0
422
+ });
423
+ }
424
+ }
425
+ var nr = function(e, r, t, c, b, x, m) {
426
+ var v = {
427
+ // This tag allows us to uniquely identify this as a React Element
428
+ $$typeof: s,
429
+ // Built-in properties that belong on the element
430
+ type: e,
431
+ key: r,
432
+ ref: t,
433
+ props: m,
434
+ // Record the component responsible for creating this element.
435
+ _owner: x
436
+ };
437
+ return v._store = {}, Object.defineProperty(v._store, "validated", {
438
+ configurable: !1,
439
+ enumerable: !1,
440
+ writable: !0,
441
+ value: !1
442
+ }), Object.defineProperty(v, "_self", {
443
+ configurable: !1,
444
+ enumerable: !1,
445
+ writable: !1,
446
+ value: c
447
+ }), Object.defineProperty(v, "_source", {
448
+ configurable: !1,
449
+ enumerable: !1,
450
+ writable: !1,
451
+ value: b
452
+ }), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
453
+ };
454
+ function ar(e, r, t, c, b) {
455
+ {
456
+ var x, m = {}, v = null, P = null;
457
+ t !== void 0 && (he(t), v = "" + t), Qe(r) && (he(r.key), v = "" + r.key), Ze(r) && (P = r.ref, er(r, b));
458
+ for (x in r)
459
+ G.call(r, x) && !Xe.hasOwnProperty(x) && (m[x] = r[x]);
460
+ if (e && e.defaultProps) {
461
+ var j = e.defaultProps;
462
+ for (x in j)
463
+ m[x] === void 0 && (m[x] = j[x]);
464
+ }
465
+ if (v || P) {
466
+ var T = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
467
+ v && rr(m, T), P && tr(m, T);
468
+ }
469
+ return nr(e, v, P, b, c, L.current, m);
470
+ }
471
+ }
472
+ var Z = D.ReactCurrentOwner, ye = D.ReactDebugCurrentFrame;
473
+ function F(e) {
474
+ if (e) {
475
+ var r = e._owner, t = U(e.type, e._source, r ? r.type : null);
476
+ ye.setExtraStackFrame(t);
477
+ } else
478
+ ye.setExtraStackFrame(null);
479
+ }
480
+ var Q;
481
+ Q = !1;
482
+ function ee(e) {
483
+ return typeof e == "object" && e !== null && e.$$typeof === s;
484
+ }
485
+ function Re() {
486
+ {
487
+ if (Z.current) {
488
+ var e = w(Z.current.type);
489
+ if (e)
490
+ return `
491
+
492
+ Check the render method of \`` + e + "`.";
493
+ }
494
+ return "";
495
+ }
496
+ }
497
+ function or(e) {
498
+ {
499
+ if (e !== void 0) {
500
+ var r = e.fileName.replace(/^.*[\\\/]/, ""), t = e.lineNumber;
501
+ return `
502
+
503
+ Check your code at ` + r + ":" + t + ".";
504
+ }
505
+ return "";
506
+ }
507
+ }
508
+ var Ee = {};
509
+ function sr(e) {
510
+ {
511
+ var r = Re();
512
+ if (!r) {
513
+ var t = typeof e == "string" ? e : e.displayName || e.name;
514
+ t && (r = `
515
+
516
+ Check the top-level render call using <` + t + ">.");
517
+ }
518
+ return r;
519
+ }
520
+ }
521
+ function je(e, r) {
522
+ {
523
+ if (!e._store || e._store.validated || e.key != null)
524
+ return;
525
+ e._store.validated = !0;
526
+ var t = sr(r);
527
+ if (Ee[t])
528
+ return;
529
+ Ee[t] = !0;
530
+ var c = "";
531
+ e && e._owner && e._owner !== Z.current && (c = " It was passed a child from " + w(e._owner.type) + "."), F(e), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, c), F(null);
532
+ }
533
+ }
534
+ function Te(e, r) {
535
+ {
536
+ if (typeof e != "object")
537
+ return;
538
+ if (H(e))
539
+ for (var t = 0; t < e.length; t++) {
540
+ var c = e[t];
541
+ ee(c) && je(c, r);
542
+ }
543
+ else if (ee(e))
544
+ e._store && (e._store.validated = !0);
545
+ else if (e) {
546
+ var b = Ie(e);
547
+ if (typeof b == "function" && b !== e.entries)
548
+ for (var x = b.call(e), m; !(m = x.next()).done; )
549
+ ee(m.value) && je(m.value, r);
550
+ }
551
+ }
552
+ }
553
+ function ir(e) {
554
+ {
555
+ var r = e.type;
556
+ if (r == null || typeof r == "string")
557
+ return;
558
+ var t;
559
+ if (typeof r == "function")
560
+ t = r.propTypes;
561
+ else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
562
+ // Inner props are checked in the reconciler.
563
+ r.$$typeof === k))
564
+ t = r.propTypes;
565
+ else
566
+ return;
567
+ if (t) {
568
+ var c = w(r);
569
+ Je(t, e.props, "prop", c, e);
570
+ } else if (r.PropTypes !== void 0 && !Q) {
571
+ Q = !0;
572
+ var b = w(r);
573
+ S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", b || "Unknown");
574
+ }
575
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
576
+ }
577
+ }
578
+ function lr(e) {
579
+ {
580
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
581
+ var c = r[t];
582
+ if (c !== "children" && c !== "key") {
583
+ F(e), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), F(null);
584
+ break;
585
+ }
586
+ }
587
+ e.ref !== null && (F(e), S("Invalid attribute `ref` supplied to `React.Fragment`."), F(null));
588
+ }
589
+ }
590
+ function _e(e, r, t, c, b, x) {
591
+ {
592
+ var m = Be(e);
593
+ if (!m) {
594
+ var v = "";
595
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
596
+ var P = or(b);
597
+ P ? v += P : v += Re();
598
+ var j;
599
+ e === null ? j = "null" : H(e) ? j = "array" : e !== void 0 && e.$$typeof === s ? (j = "<" + (w(e.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : j = typeof e, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", j, v);
600
+ }
601
+ var T = ar(e, r, t, b, x);
602
+ if (T == null)
603
+ return T;
604
+ if (m) {
605
+ var C = r.children;
606
+ if (C !== void 0)
607
+ if (c)
608
+ if (H(C)) {
609
+ for (var M = 0; M < C.length; M++)
610
+ Te(C[M], e);
611
+ Object.freeze && Object.freeze(C);
612
+ } else
613
+ S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
614
+ else
615
+ Te(C, e);
616
+ }
617
+ return e === n ? lr(T) : ir(T), T;
618
+ }
619
+ }
620
+ function cr(e, r, t) {
621
+ return _e(e, r, t, !0);
622
+ }
623
+ function ur(e, r, t) {
624
+ return _e(e, r, t, !1);
625
+ }
626
+ var fr = ur, dr = cr;
627
+ B.Fragment = n, B.jsx = fr, B.jsxs = dr;
628
+ }()), B;
629
+ }
630
+ process.env.NODE_ENV === "production" ? re.exports = br() : re.exports = hr();
631
+ var o = re.exports;
632
+ const gr = (a) => {
633
+ const { children: s, ...i } = a;
634
+ return y(i), /* @__PURE__ */ o.jsx(f.FormProvider, { children: s });
635
+ }, xr = E((a, s) => {
636
+ const {
637
+ className: i,
638
+ name: n,
639
+ label: l,
640
+ icon: u,
641
+ value: p,
642
+ autoFocus: g,
643
+ placeholder: d,
644
+ onKeyDown: h,
645
+ onChange: R,
646
+ onSubmit: k,
647
+ ...N
648
+ } = a;
649
+ return y(N), /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
650
+ a.label && /* @__PURE__ */ o.jsx(f.FormLabel, { name: n, children: l }),
651
+ /* @__PURE__ */ o.jsxs("div", { className: "bn-ak-input-wrapper", children: [
652
+ u,
653
+ /* @__PURE__ */ o.jsx(
654
+ f.FormInput,
655
+ {
656
+ className: _("bn-ak-input", i || ""),
657
+ ref: s,
658
+ name: n,
659
+ value: p,
660
+ autoFocus: g,
661
+ placeholder: d,
662
+ onKeyDown: h,
663
+ onChange: R,
664
+ onSubmit: k
665
+ }
666
+ )
667
+ ] })
668
+ ] });
669
+ }), yr = (a) => {
670
+ const {
671
+ children: s,
672
+ onOpenChange: i,
673
+ position: n,
674
+ sub: l,
675
+ // unused
676
+ ...u
677
+ } = a;
678
+ return y(u), /* @__PURE__ */ o.jsx(
679
+ f.MenuProvider,
680
+ {
681
+ placement: n,
682
+ setOpen: i,
683
+ virtualFocus: !0,
684
+ children: s
685
+ }
686
+ );
687
+ }, Rr = E((a, s) => {
688
+ const {
689
+ className: i,
690
+ children: n,
691
+ sub: l,
692
+ // unused
693
+ ...u
694
+ } = a;
695
+ return y(u), /* @__PURE__ */ o.jsx(
696
+ f.Menu,
697
+ {
698
+ className: _("bn-ak-menu", i || ""),
699
+ ref: s,
700
+ children: n
701
+ }
702
+ );
703
+ }), Er = E((a, s) => {
704
+ const { className: i, children: n, icon: l, checked: u, subTrigger: p, onClick: g, ...d } = a;
705
+ return y(d), p ? /* @__PURE__ */ o.jsxs(
706
+ f.MenuButton,
707
+ {
708
+ render: /* @__PURE__ */ o.jsx(f.MenuItem, {}),
709
+ className: _("bn-ak-menu-item", i || ""),
710
+ ref: s,
711
+ onClick: g,
712
+ children: [
713
+ l,
714
+ n,
715
+ /* @__PURE__ */ o.jsx(f.MenuButtonArrow, {}),
716
+ u !== void 0 && /* @__PURE__ */ o.jsx(f.CheckboxCheck, { checked: u })
717
+ ]
718
+ }
719
+ ) : /* @__PURE__ */ o.jsxs(
720
+ f.MenuItem,
721
+ {
722
+ className: _("bn-ak-menu-item", i || ""),
723
+ ref: s,
724
+ onClick: g,
725
+ children: [
726
+ l,
727
+ n,
728
+ u !== void 0 && /* @__PURE__ */ o.jsx(f.CheckboxCheck, { checked: u })
729
+ ]
730
+ }
731
+ );
732
+ }), jr = E((a, s) => {
733
+ const { className: i, children: n, ...l } = a;
734
+ return y(l), /* @__PURE__ */ o.jsx(
735
+ f.MenuGroupLabel,
736
+ {
737
+ className: _("bn-ak-group-label", i || ""),
738
+ ref: s,
739
+ children: n
740
+ }
741
+ );
742
+ }), Tr = (a) => {
743
+ const { children: s, sub: i, ...n } = a;
744
+ return y(n), i ? s : /* @__PURE__ */ o.jsx(f.MenuButton, { render: s });
745
+ }, _r = E((a, s) => {
746
+ const { className: i, ...n } = a;
747
+ return y(n), /* @__PURE__ */ o.jsx(
748
+ f.MenuSeparator,
749
+ {
750
+ className: _("bn-ak-separator", i || ""),
751
+ ref: s
752
+ }
753
+ );
754
+ }), kr = E((a, s) => {
755
+ const {
756
+ className: i,
757
+ tabs: n,
758
+ defaultOpenTab: l,
759
+ openTab: u,
760
+ setOpenTab: p,
761
+ loading: g,
762
+ // TODO: implement loading
763
+ ...d
764
+ } = a;
765
+ return y(d), /* @__PURE__ */ o.jsx(
766
+ "div",
767
+ {
768
+ className: _("bn-ak-wrapper", i || ""),
769
+ ref: s,
770
+ children: /* @__PURE__ */ o.jsxs(
771
+ f.TabProvider,
772
+ {
773
+ defaultSelectedId: l,
774
+ selectedId: u,
775
+ setActiveId: (h) => {
776
+ h && p(h);
777
+ },
778
+ children: [
779
+ /* @__PURE__ */ o.jsx(f.TabList, { className: "bn-ak-tab-list", children: n.map((h) => /* @__PURE__ */ o.jsx(f.Tab, { className: "bn-ak-tab", id: h.name, children: h.name }, h.name)) }),
780
+ /* @__PURE__ */ o.jsx("div", { className: "bn-ak-panels", children: n.map((h) => /* @__PURE__ */ o.jsx(f.TabPanel, { tabId: h.name, children: h.tabPanel }, h.name)) })
781
+ ]
782
+ }
783
+ )
784
+ }
785
+ );
786
+ }), Sr = E((a, s) => {
787
+ const { className: i, children: n, onClick: l, label: u, ...p } = a;
788
+ return y(p), /* @__PURE__ */ o.jsx(
789
+ f.Button,
790
+ {
791
+ className: _("bn-ak-button", i || ""),
792
+ onClick: l,
793
+ "aria-label": u,
794
+ ref: s,
795
+ children: n
796
+ }
797
+ );
798
+ }), Pr = E((a, s) => {
799
+ const { className: i, value: n, placeholder: l, onChange: u, ...p } = a;
800
+ return y(p), /* @__PURE__ */ o.jsx(f.FormProvider, { children: /* @__PURE__ */ o.jsx(
801
+ f.FormInput,
802
+ {
803
+ className: i,
804
+ ref: s,
805
+ name: "panel-input",
806
+ type: "file",
807
+ value: n ? n.name : void 0,
808
+ onChange: async (g) => u == null ? void 0 : u(g.target.files[0]),
809
+ placeholder: l
810
+ }
811
+ ) });
812
+ }), Cr = E((a, s) => {
813
+ const { className: i, children: n, ...l } = a;
814
+ return y(l), /* @__PURE__ */ o.jsx("div", { className: i, ref: s, children: n });
815
+ }), Nr = E((a, s) => {
816
+ const { className: i, value: n, placeholder: l, onKeyDown: u, onChange: p, ...g } = a;
817
+ return y(g), /* @__PURE__ */ o.jsx(f.FormProvider, { children: /* @__PURE__ */ o.jsx(
818
+ f.FormInput,
819
+ {
820
+ className: _("bn-ak-input", i || ""),
821
+ name: "panel-input",
822
+ value: n,
823
+ placeholder: l,
824
+ onChange: p,
825
+ onKeyDown: u,
826
+ "data-test": "embed-input",
827
+ ref: s
828
+ }
829
+ ) });
830
+ }), wr = E((a, s) => {
831
+ const { children: i, ...n } = a;
832
+ return y(n), /* @__PURE__ */ o.jsx(f.PopoverDisclosure, { render: i, ref: s });
833
+ }), Or = E((a, s) => {
834
+ const { className: i, children: n, variant: l, ...u } = a;
835
+ return y(u), /* @__PURE__ */ o.jsx(
836
+ f.Popover,
837
+ {
838
+ className: _("bn-ak-popover", i || ""),
839
+ ref: s,
840
+ children: n
841
+ }
842
+ );
843
+ }), Ir = (a) => {
844
+ const { children: s, opened: i, position: n, ...l } = a;
845
+ return y(l), /* @__PURE__ */ o.jsx(f.PopoverProvider, { open: i, placement: n, children: s });
846
+ }, Dr = E((a, s) => {
847
+ const { className: i, children: n, ...l } = a;
848
+ return y(l), /* @__PURE__ */ o.jsx(f.Group, { className: i, ref: s, children: n });
849
+ }), Fr = E((a, s) => {
850
+ const {
851
+ className: i,
852
+ children: n,
853
+ icon: l,
854
+ onClick: u,
855
+ label: p,
856
+ onDragEnd: g,
857
+ onDragStart: d,
858
+ draggable: h,
859
+ ...R
860
+ } = a;
861
+ return y(R, !1), /* @__PURE__ */ o.jsxs(
862
+ f.Button,
863
+ {
864
+ onDragEnd: g,
865
+ onDragStart: d,
866
+ draggable: h,
867
+ "aria-label": p,
868
+ className: _(
869
+ "bn-ak-button bn-ak-secondary",
870
+ i || ""
871
+ ),
872
+ ref: s,
873
+ onClick: u,
874
+ ...R,
875
+ children: [
876
+ l,
877
+ n
878
+ ]
879
+ }
880
+ );
881
+ }), Mr = E((a, s) => {
882
+ const { className: i, children: n, id: l, ...u } = a;
883
+ return y(u), /* @__PURE__ */ o.jsx(
884
+ f.Group,
885
+ {
886
+ className: _("bn-ak-menu", i || ""),
887
+ id: l,
888
+ role: "listbox",
889
+ ref: s,
890
+ children: n
891
+ }
892
+ );
893
+ }), Ar = E((a, s) => {
894
+ const { className: i, item: n, isSelected: l, onClick: u, id: p, ...g } = a;
895
+ return y(g), /* @__PURE__ */ o.jsxs(
896
+ "div",
897
+ {
898
+ className: _("bn-ak-menu-item", i || ""),
899
+ ref: s,
900
+ id: p,
901
+ onClick: u,
902
+ role: "option",
903
+ "aria-selected": l || void 0,
904
+ children: [
905
+ n.icon && /* @__PURE__ */ o.jsx(
906
+ "div",
907
+ {
908
+ className: "bn-ak-suggestion-menu-item-section",
909
+ "data-position": "left",
910
+ children: n.icon
911
+ }
912
+ ),
913
+ /* @__PURE__ */ o.jsxs("div", { className: "bn-ak-suggestion-menu-item-body", children: [
914
+ /* @__PURE__ */ o.jsx("div", { className: "bn-ak-suggestion-menu-item-title", children: n.title }),
915
+ /* @__PURE__ */ o.jsx("div", { className: "bn-ak-suggestion-menu-item-subtitle", children: n.subtext })
916
+ ] }),
917
+ n.badge && /* @__PURE__ */ o.jsx(
918
+ "div",
919
+ {
920
+ "data-position": "right",
921
+ className: "bn-ak-suggestion-menu-item-section",
922
+ children: /* @__PURE__ */ o.jsx("div", { children: n.badge })
923
+ }
924
+ )
925
+ ]
926
+ }
927
+ );
928
+ }), Lr = E((a, s) => {
929
+ const { className: i, children: n, ...l } = a;
930
+ return y(l), /* @__PURE__ */ o.jsx(
931
+ "div",
932
+ {
933
+ className: _("bn-ak-menu-item", i || ""),
934
+ ref: s,
935
+ children: /* @__PURE__ */ o.jsx("div", { className: "bn-ak-suggestion-menu-item-label", children: n })
936
+ }
937
+ );
938
+ }), $r = E((a, s) => {
939
+ const { className: i, children: n, ...l } = a;
940
+ return y(l), /* @__PURE__ */ o.jsx(
941
+ "div",
942
+ {
943
+ className: _("bn-ak-group-label", i || ""),
944
+ ref: s,
945
+ children: n
946
+ }
947
+ );
948
+ }), Br = E((a, s) => {
949
+ const { className: i, children: n, ...l } = a;
950
+ return y(l), /* @__PURE__ */ o.jsx("div", { className: i, ref: s, children: n });
951
+ }), Wr = E((a, s) => {
952
+ const {
953
+ className: i,
954
+ children: n,
955
+ draggable: l,
956
+ onDragStart: u,
957
+ onDragEnd: p,
958
+ style: g,
959
+ label: d,
960
+ ...h
961
+ } = a;
962
+ return y(h, !1), /* @__PURE__ */ o.jsx(
963
+ f.Button,
964
+ {
965
+ className: _(
966
+ "bn-ak-button bn-ak-secondary",
967
+ i || ""
968
+ ),
969
+ ref: s,
970
+ "aria-label": d,
971
+ draggable: l,
972
+ onDragStart: u,
973
+ onDragEnd: p,
974
+ style: g,
975
+ ...h,
976
+ children: n
977
+ }
978
+ );
979
+ }), Ce = E(
980
+ (a, s) => {
981
+ const { className: i, children: n, onMouseEnter: l, onMouseLeave: u, ...p } = a;
982
+ return y(p), /* @__PURE__ */ o.jsx(
983
+ f.Toolbar,
984
+ {
985
+ className: _("bn-ak-toolbar", i || ""),
986
+ ref: s,
987
+ onMouseEnter: l,
988
+ onMouseLeave: u,
989
+ children: n
990
+ }
991
+ );
992
+ }
993
+ ), Ne = E(
994
+ (a, s) => {
995
+ const {
996
+ className: i,
997
+ children: n,
998
+ mainTooltip: l,
999
+ secondaryTooltip: u,
1000
+ icon: p,
1001
+ isSelected: g,
1002
+ isDisabled: d,
1003
+ onClick: h,
1004
+ label: R,
1005
+ ...k
1006
+ } = a;
1007
+ return y(k, !1), /* @__PURE__ */ o.jsxs(f.TooltipProvider, { children: [
1008
+ /* @__PURE__ */ o.jsx(
1009
+ f.TooltipAnchor,
1010
+ {
1011
+ className: "link",
1012
+ render: /* @__PURE__ */ o.jsxs(
1013
+ f.ToolbarItem,
1014
+ {
1015
+ "aria-label": R,
1016
+ className: _(
1017
+ "bn-ak-button bn-ak-secondary",
1018
+ i || ""
1019
+ ),
1020
+ onMouseDown: (N) => {
1021
+ pr() && N.currentTarget.focus();
1022
+ },
1023
+ onClick: h,
1024
+ "aria-pressed": g,
1025
+ "data-selected": g ? "true" : void 0,
1026
+ "data-test": a.mainTooltip.slice(0, 1).toLowerCase() + a.mainTooltip.replace(/\s+/g, "").slice(1),
1027
+ disabled: d || !1,
1028
+ ref: s,
1029
+ ...k,
1030
+ children: [
1031
+ p,
1032
+ n
1033
+ ]
1034
+ }
1035
+ )
1036
+ }
1037
+ ),
1038
+ /* @__PURE__ */ o.jsxs(f.Tooltip, { className: "bn-ak-tooltip", children: [
1039
+ /* @__PURE__ */ o.jsx("span", { children: l }),
1040
+ u && /* @__PURE__ */ o.jsx("span", { children: u })
1041
+ ] })
1042
+ ] });
1043
+ }
1044
+ ), Yr = E((a, s) => {
1045
+ const { className: i, items: n, isDisabled: l, ...u } = a;
1046
+ y(u);
1047
+ const p = a.items.filter((d) => d.isSelected)[0], g = (d) => {
1048
+ var h, R;
1049
+ (R = (h = n.find((k) => k.text === d)).onClick) == null || R.call(h);
1050
+ };
1051
+ return /* @__PURE__ */ o.jsxs(f.SelectProvider, { value: p.text, setValue: g, children: [
1052
+ /* @__PURE__ */ o.jsxs(
1053
+ f.Select,
1054
+ {
1055
+ className: "bn-ak-button bn-ak-secondary",
1056
+ disabled: l,
1057
+ "aria-label": "Text alignment",
1058
+ render: /* @__PURE__ */ o.jsx(f.ToolbarItem, {}),
1059
+ children: [
1060
+ p.icon,
1061
+ " ",
1062
+ p.text,
1063
+ " ",
1064
+ /* @__PURE__ */ o.jsx(f.SelectArrow, {})
1065
+ ]
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ o.jsx(
1069
+ f.SelectPopover,
1070
+ {
1071
+ className: _("bn-ak-popover", i || ""),
1072
+ ref: s,
1073
+ gutter: 4,
1074
+ children: n.map((d) => /* @__PURE__ */ o.jsxs(
1075
+ f.SelectItem,
1076
+ {
1077
+ className: "bn-ak-select-item",
1078
+ value: d.text,
1079
+ children: [
1080
+ d.icon,
1081
+ d.text,
1082
+ d.text === p.text && /* @__PURE__ */ o.jsx(f.SelectItemCheck, {})
1083
+ ]
1084
+ },
1085
+ d.text
1086
+ ))
1087
+ }
1088
+ )
1089
+ ] });
1090
+ });
1091
+ const Vr = {
1092
+ FormattingToolbar: {
1093
+ Root: Ce,
1094
+ Button: Ne,
1095
+ Select: Yr
1096
+ },
1097
+ ImagePanel: {
1098
+ Root: kr,
1099
+ Button: Sr,
1100
+ FileInput: Pr,
1101
+ TabPanel: Cr,
1102
+ TextInput: Nr
1103
+ },
1104
+ LinkToolbar: {
1105
+ Root: Ce,
1106
+ Button: Ne
1107
+ },
1108
+ SideMenu: {
1109
+ Root: Dr,
1110
+ Button: Fr
1111
+ },
1112
+ SuggestionMenu: {
1113
+ Root: Mr,
1114
+ Item: Ar,
1115
+ EmptyItem: Lr,
1116
+ Label: $r,
1117
+ Loader: Br
1118
+ },
1119
+ TableHandle: {
1120
+ Root: Wr
1121
+ },
1122
+ Generic: {
1123
+ Form: {
1124
+ Root: gr,
1125
+ TextInput: xr
1126
+ },
1127
+ Menu: {
1128
+ Root: yr,
1129
+ Trigger: Tr,
1130
+ Dropdown: Rr,
1131
+ Divider: _r,
1132
+ Label: jr,
1133
+ Item: Er
1134
+ },
1135
+ Popover: {
1136
+ Root: Ir,
1137
+ Trigger: wr,
1138
+ Content: Or
1139
+ }
1140
+ }
1141
+ }, Jr = (a) => /* @__PURE__ */ o.jsx(vr.Provider, { value: Vr, children: /* @__PURE__ */ o.jsx(mr, { ...a }) });
1142
+ export {
1143
+ Jr as BlockNoteView,
1144
+ Vr as components
1145
+ };
1146
+ //# sourceMappingURL=blocknote-ariakit.js.map