UNPKG

@metroui/ribbon-menu

Version:

Ribbon Menu for React (Vite, TypeScript)

984 lines (980 loc) 47.3 kB
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(':root{--background-color: #f5f6f7;--background-active-color: #f5f6f7;--background-group-color: #ffffff;--textColor: #000000;--borderColor: #dadbdc;--itemBorderColor: #a4cef9;--itemActiveBorderColor: #1979ca;--itemActiveBackground: rgba(164, 206, 249, .8);--itemHoverBackground: rgba(164, 206, 249, .2);--dropdownBackground: #fbfcfd;--dropdownDividerColor: #f1f1f1;--dropdownShadowColor: rgba(227, 228, 229, .7);--dropdownToggleColor: #000000;--staticMenuColor: #1979ca;--staticTextColor: #ffffff;--scrollbar-thumb-color: rgba(0, 0, 0, .15);--scrollbar-track-color: rgba(0, 0, 0, .5)}.dark-mode{--background-color: #22272e;--background-active-color: #22272e;--background-group-color: #333a44;--textColor: #adadad;--textActiveColor: #ffffff;--borderColor: #444c56;--itemBorderColor: #a4cef9;--itemActiveBorderColor: #1979ca;--itemActiveBackground: rgba(164, 206, 249, .8);--itemHoverBackground: rgba(164, 206, 249, .2);--dropdownBackground: #22272e;--dropdownDividerColor: #444c56;--dropdownShadowColor: rgba(68, 76, 86, .7);--dropdownToggleColor: #ffffff;--staticMenuColor: #1979ca;--staticTextColor: #ffffff;--scrollbar-thumb-color: rgba(0, 0, 0, .15);--scrollbar-track-color: rgba(0, 0, 0, .5)}*,*:before,*:after{box-sizing:border-box}.no-overflow{overflow:hidden}.ribbon-menu{display:block;position:relative;background-color:var(--background-color);color:var(--textColor);overflow-x:scroll}.ribbon-menu div{position:relative}.ribbon-menu .tabs-holder{display:flex;justify-content:flex-start;align-items:center;list-style:none inside;margin:0;padding:0;position:relative;z-index:1;border-bottom:1px solid var(--borderColor)}.ribbon-menu .tabs-holder li,.ribbon-menu .tabs-holder a{display:block;height:24px;line-height:24px}.ribbon-menu .tabs-holder li{color:var(--textColor);background-color:var(--background-color);border-left:1px solid transparent;border-right:1px solid transparent;border-bottom:1px solid var(--borderColor);cursor:pointer}.ribbon-menu .tabs-holder li:hover{border-left-color:var(--borderColor);border-right-color:var(--borderColor);border-top-color:var(--borderColor)}.ribbon-menu .tabs-holder li+li{margin-left:3px}.ribbon-menu .tabs-holder a{text-decoration:none;padding:0 14px;font-size:12px;background-color:inherit;color:inherit}.ribbon-menu .tabs-holder .active{background-color:var(--background-active-color);border:1px solid var(--borderColor);border-bottom-color:transparent}.ribbon-menu .tabs-holder .static{background-color:var(--staticMenuColor);color:var(--staticTextColor)}.ribbon-menu .content-holder{display:block;position:relative;background-color:inherit;border-left:none;border-right:none}.ribbon-menu .content-holder .ribbon-section{display:none;padding:4px;border-bottom:1px solid var(--borderColor);justify-content:flex-start;flex-shrink:0}.ribbon-menu .content-holder .ribbon-section.active{display:flex}.ribbon-menu .content-holder .ribbon-divider{display:block;position:relative;margin:0 4px;height:100%!important;width:1px;background-color:var(--borderColor)}.ribbon-menu .content-holder .group{padding:0 4px 24px;display:flex;cursor:default;background-color:inherit;position:relative;align-items:flex-start;align-content:flex-start;flex-shrink:0}.ribbon-menu .content-holder .group:nth-child(1):last-child{flex-basis:100%}.ribbon-menu .content-holder .group .title{display:block;position:absolute;left:0;bottom:0;width:100%;line-height:24px;height:20px;font-size:11px;text-align:center;border-top:1px solid var(--borderColor);white-space:nowrap}.ribbon-menu .content-holder .group>*:not(.title){margin:2px}.ribbon-menu .content-holder .group+.group{border-left:1px solid var(--borderColor)}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background-color:var(--scrollbar-thumb-color)}::-webkit-scrollbar-thumb{background-color:var(--scrollbar-track-color)}*{scrollbar-width:thin;scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color)}.ribbon-button{cursor:pointer;min-width:0;text-align:center;border:1px solid transparent;background-color:var(--backgroundActiveColor);color:var(--textColor);outline:none;position:relative}.ribbon-button{height:auto;min-height:64px;width:auto;padding:4px 8px;margin:0}.ribbon-button .caption,.ribbon-button .ribbon-icon{display:block;text-align:center}.ribbon-button .caption{font-size:12px}.ribbon-button .ribbon-icon *{height:32px;max-width:32px;font-size:26px;line-height:32px}.ribbon-button.dropdown-toggle{padding-right:12px!important}.ribbon-button.dropdown-toggle:before{margin-left:-8px}.ribbon-button.drop-active{border-color:var(--itemBorderColor);background-color:var(--itemHoverBackground)}.ribbon-button:hover:enabled,.ribbon-button:not(.disabled):hover{border-color:var(--itemBorderColor);background-color:var(--itemHoverBackground)}.ribbon-button:active,.ribbon-button.active,.ribbon-menu .active-container .ribbon-button{border-color:var(--itemActiveBorderColor);background-color:var(--itemActiveBackground)!important;color:var(--textActiveColor)}.ribbon-tool-button{cursor:pointer;min-width:0;text-align:center;border:1px solid transparent;background-color:var(--backgroundActiveColor);color:var(--textColor);outline:none;position:relative}.ribbon-tool-button{width:24px;height:24px;padding:0 2px;margin:0;display:flex;align-items:center;justify-content:center}.ribbon-tool-button *{width:16px;height:16px;line-height:16px;font-size:14px}.ribbon-tool-button.dropdown-toggle{padding-right:2px!important}.ribbon-tool-button.dropdown-toggle:before{display:none}.ribbon-tool-button.dropdown-toggle:after{content:"";display:block;position:absolute;bottom:0;right:0;width:0;height:0;border-style:solid;border-width:0 0 4px 4px;border-color:transparent transparent var(--dropdownToggleColor) transparent!important;z-index:1}.ribbon-tool-button.drop-active{border-color:var(--itemBorderColor);background-color:var(--itemHoverBackground)}.ribbon-tool-button:hover:enabled,.ribbon-tool-button:not(.disabled):hover{border-color:var(--itemBorderColor);background-color:var(--itemHoverBackground)}.ribbon-tool-button:active,.ribbon-tool-button.active,.ribbon-menu .active-container .ribbon-tool-button{border-color:var(--itemActiveBorderColor);background-color:var(--itemActiveBackground)!important;color:var(--textActiveColor)}.ribbon-icon-button{cursor:pointer;min-width:0;text-align:center;border:1px solid transparent;background-color:var(--backgroundActiveColor);color:var(--textColor);outline:none;position:relative}.ribbon-icon-button{height:24px;width:auto;margin:0;display:inline-flex;flex-flow:row nowrap;align-items:center;padding:0 4px}.ribbon-icon-button .caption,.ribbon-icon-button .ribbon-icon{display:block}.ribbon-icon-button .caption{font-size:11px}.ribbon-icon-button .ribbon-icon{display:flex;justify-content:center;align-items:center}.ribbon-icon-button .ribbon-icon *{width:16px;height:16px;line-height:16px;font-size:14px}.ribbon-icon-button .ribbon-icon+.caption,.ribbon-icon-button .caption+.ribbon-icon{margin-left:4px}.ribbon-icon-button [class*=mif-]{vertical-align:inherit}.ribbon-icon-button.dropdown-toggle{padding-right:4px!important}.ribbon-icon-button.dropdown-toggle:before{display:none}.ribbon-icon-button.dropdown-toggle:after{content:"";display:block;position:absolute;bottom:0;right:0;width:0;height:0;border-style:solid;border-width:0 0 4px 4px;border-color:transparent transparent var(--dropdownToggleColor) transparent;z-index:1}.ribbon-icon-button.drop-active{border-color:var(--itemBorderColor);background-color:var(--itemHoverBackground)}.ribbon-icon-button:hover:enabled,.ribbon-icon-button:not(.disabled):hover{border-color:var(--itemBorderColor);background-color:var(--itemHoverBackground)}.ribbon-icon-button:active,.ribbon-icon-button.active,.ribbon-menu .active-container .ribbon-icon-button{border-color:var(--itemActiveBorderColor);background-color:var(--itemActiveBackground)!important;color:var(--textActiveColor)}.ribbon-toggle-group{background-color:var(--background-group-color);display:flex;flex-flow:column wrap;border:1px solid var(--borderColor);width:auto}.ribbon-toggle-group .ribbon-icon-button,.ribbon-toggle-group .ribbon-tool-button{height:20px;margin:1px;background-color:inherit;display:flex;align-items:center;justify-content:start;line-height:1.6}.ribbon-toggle-group .ribbon-icon-button>*,.ribbon-toggle-group .ribbon-tool-button>*{height:18px}.ribbon-dropdown .ribbon-toggle-group{background-color:inherit!important}.dropdown{display:block;float:left;width:auto;background:inherit;position:relative}.dropdown .drop-object{position:fixed;z-index:1000}.dropdown .drop-object .drop-object{position:absolute}.dropdown .drop-object.place-right{left:auto;right:0}.dropdown .dropdown{width:100%}.dropdown .dropdown .drop-object{top:-4px;left:100%}.dropdown .dropdown .dropdown-toggle{padding-right:2rem}.dropdown.dropped>.dropdown-toggle:before{transform:rotate(135deg);transition:all .15s ease-in-out}.dropdown.dropped .dropdown.dropped>.dropdown-toggle:before{transform:rotate(45deg);transition:all .15s ease-in-out}.dropdown-toggle{position:relative;cursor:pointer;padding-right:1.5rem;user-select:none}.dropdown-toggle:before{display:block;position:absolute;vertical-align:middle;color:transparent;font-size:0;content:"";height:5px;width:5px;background-color:transparent;border-left:1px solid;border-bottom:1px solid;border-color:var(--textColor);top:50%;left:100%;margin-left:-1rem;margin-top:-.1625rem;z-index:2;transform:rotate(-45deg);transition:all .15s ease-in-out;transform-origin:center center 1px}.dropdown-toggle.drop-marker-light:before,.dropdown-toggle.marker-light:before{border-color:var(--dropdownDividerColor)}.dropdown-toggle.no-marker:before{display:none}.dropdown-toggle.active-toggle:before,.dropdown-toggle.active-container:before{transform:rotate(135deg);transition:all .15s ease-in-out}.dropdown-toggle.marker-center:before{left:50%;top:50%;margin-left:0;margin-top:0;transform:translate(-50%) translateY(-50%) rotate(-45deg)}.dropdown-toggle.marker-center.active-toggle:before,.dropdown-toggle.marker-center.active-container:before{transform:translate(-50%) translateY(-50%) rotate(135deg);transition:all .15s ease-in-out}.drop-left{right:100%;top:0}.drop-right{left:100%;top:0}.drop-up{top:auto;bottom:100%}.drop-object{display:none}.drop-object.open{display:block!important}.ribbon-split-button{text-align:center;border:1px solid transparent;padding:0;margin:0}.ribbon-split-button:not([disabled]):hover,.ribbon-split-button:not(.disabled):hover{border-color:var(--itemBorderColor)}.ribbon-split-button:not([disabled]):hover .ribbon-split,.ribbon-split-button:not(.disabled):hover .ribbon-split{border-top-color:var(--itemBorderColor)}.ribbon-split-button .ribbon-main,.ribbon-split-button .ribbon-split{display:block;text-align:center;min-width:0;min-height:0;padding:2px 4px;width:100%;cursor:pointer}.ribbon-split-button .ribbon-main:hover,.ribbon-split-button .ribbon-split:hover{background-color:var(--itemHoverBackground)}.ribbon-split-button .ribbon-main{background-color:inherit;outline:none;position:relative;border:none}.ribbon-split-button .ribbon-icon *{height:32px;max-width:32px;font-size:26px;line-height:32px}.ribbon-split-button .ribbon-icon+.caption{margin-top:8px}.ribbon-split-button .ribbon-split{font-size:12px;border-top:1px solid transparent;padding-bottom:4px}.ribbon-split-button .ribbon-split.dropdown-toggle{padding-right:4px!important}.ribbon-split-button .ribbon-split.dropdown-toggle:before{display:none}.ribbon-split-button .ribbon-split.dropdown-toggle:after{content:"";display:block;position:absolute;bottom:2px;left:50%;transform:translate(-50%) rotate(45deg);width:0;height:0;border-style:solid;border-width:0 0 4px 4px;border-color:transparent transparent var(--dropdownToggleColor) transparent;z-index:1}.ribbon-split-button .ribbon-dropdown{text-align:left}.ribbon-dropdown{list-style:none inside;margin:0;width:auto;float:left;display:block;position:absolute;background-color:var(--dropdownBackground);color:var(--textColor);padding:2px;border:1px solid var(--borderColor);font-size:12px;box-shadow:2px 2px 2px 0 var(--dropdownShadowColor);z-index:1000;top:100%;left:0}.ribbon-dropdown li,.ribbon-dropdown a{display:block;position:relative;background-color:inherit;color:inherit;height:24px;cursor:pointer}.ribbon-dropdown li{border:1px solid transparent;padding-left:24px;user-select:none}.ribbon-dropdown li:not([disabled]):hover,.ribbon-dropdown li:not(.disabled):hover{border-color:var(--itemBorderColor);background-color:var(--itemHoverBackground)}.ribbon-dropdown a{line-height:24px;text-decoration:none;padding:0 8px;border-left:1px solid var(--dropdownDividerColor);white-space:nowrap}.ribbon-dropdown .divider{display:block;height:1px;width:100%;position:relative;background-color:var(--dropdownDividerColor);pointer-events:none}.ribbon-dropdown *+.divider{margin-top:4px}.ribbon-dropdown .divider+*{margin-top:4px}.ribbon-dropdown .checked:before,.ribbon-dropdown .active:before,.ribbon-dropdown .check-group .active:before,.ribbon-dropdown .checked:after,.ribbon-dropdown .active:after,.ribbon-dropdown .check-group .active:after{position:absolute;display:block;content:""}.ribbon-dropdown .checked:before,.ribbon-dropdown .active:before,.ribbon-dropdown .check-group .active:before{background-color:transparent;border-color:var(--textColor);border-left:2px solid;border-bottom:2px solid;height:.325rem;width:.5rem;left:.5rem;top:50%;transform:translateY(-50%) rotate(-45deg);z-index:2}.ribbon-dropdown .checked:after,.ribbon-dropdown .active:after,.ribbon-dropdown .check-group .active:after{width:23px;height:22px;top:0;left:0;z-index:1}.ribbon-dropdown .checked:after,.ribbon-dropdown .check-group .active:after{border:1px solid var(--itemBorderColor);background-color:var(--itemHoverBackground);color:var(--textActiveColor)}.ribbon-dropdown .active:before{width:.4rem;height:.4rem;background-color:var(--textColor)}.ribbon-dropdown .ribbon-dropdown{top:-4px;left:100%}.ribbon-dropdown .dropdown-toggle:before{transform:rotate(-135deg)!important}.ribbon-dropdown .dropdown-toggle.active-toggle:before{transform:rotate(45deg)!important}.ribbon-dropdown .ribbon-toggle-group{border:none!important}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})(); var ht = Object.defineProperty; var bt = (i, c, r) => c in i ? ht(i, c, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[c] = r; var A = (i, c, r) => (bt(i, typeof c != "symbol" ? c + "" : c, r), r); import O, { Children as M, cloneElement as De } from "react"; var K = {}, mt = { get exports() { return K; }, set exports(i) { K = i; } }, W = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var je; function gt() { if (je) return W; je = 1; var i = O, c = Symbol.for("react.element"), r = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, s = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 }; function u(h, f, w) { var g, T = {}, k = null, j = null; w !== void 0 && (k = "" + w), f.key !== void 0 && (k = "" + f.key), f.ref !== void 0 && (j = f.ref); for (g in f) a.call(f, g) && !o.hasOwnProperty(g) && (T[g] = f[g]); if (h && h.defaultProps) for (g in f = h.defaultProps, f) T[g] === void 0 && (T[g] = f[g]); return { $$typeof: c, type: h, key: k, ref: j, props: T, _owner: s.current }; } return W.Fragment = r, W.jsx = u, W.jsxs = u, W; } var Y = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Ne; function Rt() { return Ne || (Ne = 1, process.env.NODE_ENV !== "production" && function() { var i = O, c = Symbol.for("react.element"), r = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), h = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), V = Symbol.iterator, H = "@@iterator"; function Fe(e) { if (e === null || typeof e != "object") return null; var t = V && e[V] || e[H]; return typeof t == "function" ? t : null; } var F = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function _(e) { { for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), l = 1; l < t; l++) n[l - 1] = arguments[l]; Ie("error", e, n); } } function Ie(e, t, n) { { var l = F.ReactDebugCurrentFrame, b = l.getStackAddendum(); b !== "" && (t += "%s", n = n.concat([b])); var m = n.map(function(p) { return String(p); }); m.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, m); } } var Le = !1, $e = !1, Be = !1, We = !1, Ye = !1, ie; ie = Symbol.for("react.module.reference"); function Me(e) { return !!(typeof e == "string" || typeof e == "function" || e === a || e === o || Ye || e === s || e === w || e === g || We || e === j || Le || $e || Be || typeof e == "object" && e !== null && (e.$$typeof === k || e.$$typeof === T || e.$$typeof === u || e.$$typeof === h || e.$$typeof === f || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. e.$$typeof === ie || e.getModuleId !== void 0)); } function Ve(e, t, n) { var l = e.displayName; if (l) return l; var b = t.displayName || t.name || ""; return b !== "" ? n + "(" + b + ")" : n; } function ce(e) { return e.displayName || "Context"; } function x(e) { if (e == null) return null; if (typeof e.tag == "number" && _("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function") return e.displayName || e.name || null; if (typeof e == "string") return e; switch (e) { case a: return "Fragment"; case r: return "Portal"; case o: return "Profiler"; case s: return "StrictMode"; case w: return "Suspense"; case g: return "SuspenseList"; } if (typeof e == "object") switch (e.$$typeof) { case h: var t = e; return ce(t) + ".Consumer"; case u: var n = e; return ce(n._context) + ".Provider"; case f: return Ve(e, e.render, "ForwardRef"); case T: var l = e.displayName || null; return l !== null ? l : x(e.type) || "Memo"; case k: { var b = e, m = b._payload, p = b._init; try { return x(p(m)); } catch { return null; } } } return null; } var D = Object.assign, $ = 0, le, ue, fe, de, pe, ve, he; function be() { } be.__reactDisabledLog = !0; function Ue() { { if ($ === 0) { le = console.log, ue = console.info, fe = console.warn, de = console.error, pe = console.group, ve = console.groupCollapsed, he = console.groupEnd; var e = { configurable: !0, enumerable: !0, value: be, writable: !0 }; Object.defineProperties(console, { info: e, log: e, warn: e, error: e, group: e, groupCollapsed: e, groupEnd: e }); } $++; } } function ze() { { if ($--, $ === 0) { var e = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: D({}, e, { value: le }), info: D({}, e, { value: ue }), warn: D({}, e, { value: fe }), error: D({}, e, { value: de }), group: D({}, e, { value: pe }), groupCollapsed: D({}, e, { value: ve }), groupEnd: D({}, e, { value: he }) }); } $ < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var X = F.ReactCurrentDispatcher, Z; function U(e, t, n) { { if (Z === void 0) try { throw Error(); } catch (b) { var l = b.stack.trim().match(/\n( *(at )?)/); Z = l && l[1] || ""; } return ` ` + Z + e; } } var Q = !1, z; { var qe = typeof WeakMap == "function" ? WeakMap : Map; z = new qe(); } function me(e, t) { if (!e || Q) return ""; { var n = z.get(e); if (n !== void 0) return n; } var l; Q = !0; var b = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var m; m = X.current, X.current = null, Ue(); try { if (t) { var p = function() { throw Error(); }; if (Object.defineProperty(p.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(p, []); } catch (P) { l = P; } Reflect.construct(e, [], p); } else { try { p.call(); } catch (P) { l = P; } e.call(p.prototype); } } else { try { throw Error(); } catch (P) { l = P; } e(); } } catch (P) { if (P && l && typeof P.stack == "string") { for (var d = P.stack.split(` `), C = l.stack.split(` `), R = d.length - 1, y = C.length - 1; R >= 1 && y >= 0 && d[R] !== C[y]; ) y--; for (; R >= 1 && y >= 0; R--, y--) if (d[R] !== C[y]) { if (R !== 1 || y !== 1) do if (R--, y--, y < 0 || d[R] !== C[y]) { var S = ` ` + d[R].replace(" at new ", " at "); return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && z.set(e, S), S; } while (R >= 1 && y >= 0); break; } } } finally { Q = !1, X.current = m, ze(), Error.prepareStackTrace = b; } var L = e ? e.displayName || e.name : "", Pe = L ? U(L) : ""; return typeof e == "function" && z.set(e, Pe), Pe; } function Ge(e, t, n) { return me(e, !1); } function Je(e) { var t = e.prototype; return !!(t && t.isReactComponent); } function q(e, t, n) { if (e == null) return ""; if (typeof e == "function") return me(e, Je(e)); if (typeof e == "string") return U(e); switch (e) { case w: return U("Suspense"); case g: return U("SuspenseList"); } if (typeof e == "object") switch (e.$$typeof) { case f: return Ge(e.render); case T: return q(e.type, t, n); case k: { var l = e, b = l._payload, m = l._init; try { return q(m(b), t, n); } catch { } } } return ""; } var G = Object.prototype.hasOwnProperty, ge = {}, Re = F.ReactDebugCurrentFrame; function J(e) { if (e) { var t = e._owner, n = q(e.type, e._source, t ? t.type : null); Re.setExtraStackFrame(n); } else Re.setExtraStackFrame(null); } function Ke(e, t, n, l, b) { { var m = Function.call.bind(G); for (var p in e) if (m(e, p)) { var d = void 0; try { if (typeof e[p] != "function") { var C = Error((l || "React class") + ": " + n + " type `" + p + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[p] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw C.name = "Invariant Violation", C; } d = e[p](t, p, l, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (R) { d = R; } d && !(d instanceof Error) && (J(b), _("%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).", l || "React class", n, p, typeof d), J(null)), d instanceof Error && !(d.message in ge) && (ge[d.message] = !0, J(b), _("Failed %s type: %s", n, d.message), J(null)); } } } var He = Array.isArray; function ee(e) { return He(e); } function Xe(e) { { var t = typeof Symbol == "function" && Symbol.toStringTag, n = t && e[Symbol.toStringTag] || e.constructor.name || "Object"; return n; } } function Ze(e) { try { return ye(e), !1; } catch { return !0; } } function ye(e) { return "" + e; } function Ee(e) { if (Ze(e)) return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(e)), ye(e); } var B = F.ReactCurrentOwner, Qe = { key: !0, ref: !0, __self: !0, __source: !0 }, we, _e, te; te = {}; function et(e) { if (G.call(e, "ref")) { var t = Object.getOwnPropertyDescriptor(e, "ref").get; if (t && t.isReactWarning) return !1; } return e.ref !== void 0; } function tt(e) { if (G.call(e, "key")) { var t = Object.getOwnPropertyDescriptor(e, "key").get; if (t && t.isReactWarning) return !1; } return e.key !== void 0; } function rt(e, t) { if (typeof e.ref == "string" && B.current && t && B.current.stateNode !== t) { var n = x(B.current.type); te[n] || (_('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', x(B.current.type), e.ref), te[n] = !0); } } function nt(e, t) { { var n = function() { we || (we = !0, _("%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)", t)); }; n.isReactWarning = !0, Object.defineProperty(e, "key", { get: n, configurable: !0 }); } } function ot(e, t) { { var n = function() { _e || (_e = !0, _("%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)", t)); }; n.isReactWarning = !0, Object.defineProperty(e, "ref", { get: n, configurable: !0 }); } } var at = function(e, t, n, l, b, m, p) { var d = { // This tag allows us to uniquely identify this as a React Element $$typeof: c, // Built-in properties that belong on the element type: e, key: t, ref: n, props: p, // Record the component responsible for creating this element. _owner: m }; return d._store = {}, Object.defineProperty(d._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(d, "_self", { configurable: !1, enumerable: !1, writable: !1, value: l }), Object.defineProperty(d, "_source", { configurable: !1, enumerable: !1, writable: !1, value: b }), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d; }; function st(e, t, n, l, b) { { var m, p = {}, d = null, C = null; n !== void 0 && (Ee(n), d = "" + n), tt(t) && (Ee(t.key), d = "" + t.key), et(t) && (C = t.ref, rt(t, b)); for (m in t) G.call(t, m) && !Qe.hasOwnProperty(m) && (p[m] = t[m]); if (e && e.defaultProps) { var R = e.defaultProps; for (m in R) p[m] === void 0 && (p[m] = R[m]); } if (d || C) { var y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; d && nt(p, y), C && ot(p, y); } return at(e, d, C, b, l, B.current, p); } } var re = F.ReactCurrentOwner, Ce = F.ReactDebugCurrentFrame; function I(e) { if (e) { var t = e._owner, n = q(e.type, e._source, t ? t.type : null); Ce.setExtraStackFrame(n); } else Ce.setExtraStackFrame(null); } var ne; ne = !1; function oe(e) { return typeof e == "object" && e !== null && e.$$typeof === c; } function Te() { { if (re.current) { var e = x(re.current.type); if (e) return ` Check the render method of \`` + e + "`."; } return ""; } } function it(e) { { if (e !== void 0) { var t = e.fileName.replace(/^.*[\\\/]/, ""), n = e.lineNumber; return ` Check your code at ` + t + ":" + n + "."; } return ""; } } var Se = {}; function ct(e) { { var t = Te(); if (!t) { var n = typeof e == "string" ? e : e.displayName || e.name; n && (t = ` Check the top-level render call using <` + n + ">."); } return t; } } function Oe(e, t) { { if (!e._store || e._store.validated || e.key != null) return; e._store.validated = !0; var n = ct(t); if (Se[n]) return; Se[n] = !0; var l = ""; e && e._owner && e._owner !== re.current && (l = " It was passed a child from " + x(e._owner.type) + "."), I(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, l), I(null); } } function ke(e, t) { { if (typeof e != "object") return; if (ee(e)) for (var n = 0; n < e.length; n++) { var l = e[n]; oe(l) && Oe(l, t); } else if (oe(e)) e._store && (e._store.validated = !0); else if (e) { var b = Fe(e); if (typeof b == "function" && b !== e.entries) for (var m = b.call(e), p; !(p = m.next()).done; ) oe(p.value) && Oe(p.value, t); } } } function lt(e) { { var t = e.type; if (t == null || typeof t == "string") return; var n; if (typeof t == "function") n = t.propTypes; else if (typeof t == "object" && (t.$$typeof === f || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. t.$$typeof === T)) n = t.propTypes; else return; if (n) { var l = x(t); Ke(n, e.props, "prop", l, e); } else if (t.PropTypes !== void 0 && !ne) { ne = !0; var b = x(t); _("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", b || "Unknown"); } typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function ut(e) { { for (var t = Object.keys(e.props), n = 0; n < t.length; n++) { var l = t[n]; if (l !== "children" && l !== "key") { I(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), I(null); break; } } e.ref !== null && (I(e), _("Invalid attribute `ref` supplied to `React.Fragment`."), I(null)); } } function xe(e, t, n, l, b, m) { { var p = Me(e); if (!p) { var d = ""; (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (d += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var C = it(b); C ? d += C : d += Te(); var R; e === null ? R = "null" : ee(e) ? R = "array" : e !== void 0 && e.$$typeof === c ? (R = "<" + (x(e.type) || "Unknown") + " />", d = " Did you accidentally export a JSX literal instead of a component?") : R = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, d); } var y = st(e, t, n, b, m); if (y == null) return y; if (p) { var S = t.children; if (S !== void 0) if (l) if (ee(S)) { for (var L = 0; L < S.length; L++) ke(S[L], e); Object.freeze && Object.freeze(S); } else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else ke(S, e); } return e === a ? ut(y) : lt(y), y; } } function ft(e, t, n) { return xe(e, t, n, !0); } function dt(e, t, n) { return xe(e, t, n, !1); } var pt = dt, vt = ft; Y.Fragment = a, Y.jsx = pt, Y.jsxs = vt; }()), Y; } (function(i) { process.env.NODE_ENV === "production" ? i.exports = gt() : i.exports = Rt(); })(mt); const v = K.jsx, N = K.jsxs; var E = {}, yt = { get exports() { return E; }, set exports(i) { E = i; } }; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ (function(i) { (function() { var c = {}.hasOwnProperty; function r() { for (var a = [], s = 0; s < arguments.length; s++) { var o = arguments[s]; if (o) { var u = typeof o; if (u === "string" || u === "number") a.push(o); else if (Array.isArray(o)) { if (o.length) { var h = r.apply(null, o); h && a.push(h); } } else if (u === "object") { if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]")) { a.push(o.toString()); continue; } for (var f in o) c.call(o, f) && o[f] && a.push(f); } } } return a.join(" "); } i.exports ? (r.default = r, i.exports = r) : window.classNames = r; })(); })(yt); const Et = ({ hotkey: i = "", staticTab: c, label: r, active: a, className: s, onClick: o, index: u }) => { const h = E( s, { static: c }, { active: a } ); return /* @__PURE__ */ v("li", { className: h, onClick: o, children: /* @__PURE__ */ v( "a", { "data-label": r.toLowerCase(), "data-static": c, "data-key": u, href: `#${r.toLowerCase()}`, "data-hotkey": i, children: r } ) }); }, wt = ({ active: i, className: c, children: r }) => { const a = E( "ribbon-section", c, { active: i } ); return /* @__PURE__ */ v("div", { className: a, children: r }); }; class kt extends O.Component { constructor(r) { super(r); A(this, "myRef"); A(this, "state", { activeTab: "" }); const a = M.toArray(r.children); let s = -1; a.forEach((o, u) => { o.props.mode === "static" && s++; }), this.state = { activeTab: a[s + 1] ? a[s + 1].props.label.toLowerCase() : "" }, this.myRef = O.createRef(), this.onTabClick = this.onTabClick.bind(this), this.windowResize = this.windowResize.bind(this); } componentDidMount() { window.addEventListener("resize", this.windowResize); } componentWillUnmount() { window.removeEventListener("resize", this.windowResize); } windowResize() { const r = this.myRef.current, s = r.getBoundingClientRect().width; r.querySelectorAll(".ribbon-section.active").forEach((u) => { Array.from(u.querySelectorAll(".group")).filter((f, w) => { const { x: g, width: T } = f.getBoundingClientRect(); return !(s > g + T); }); }); } renderTabs() { const { children: r = [] } = this.props, { activeTab: a } = this.state; return M.map(r, (s, o) => { const { mode: u, label: h } = s.props; return /* @__PURE__ */ v( Et, { index: o, staticTab: u && u === "static", label: h, active: a.toLowerCase() === h.toLowerCase(), onClick: this.onTabClick }, o ); }); } renderSections() { const { children: r = [] } = this.props, { activeTab: a } = this.state; return M.map(r, (s, o) => { const { label: u, children: h } = s.props; return /* @__PURE__ */ v(wt, { label: u.toLowerCase(), active: a === u.toLowerCase(), children: h }, o); }); } onTabClick(r) { const a = r.target.getAttribute("data-static") === "true", s = r.target.getAttribute("data-label"); a || this.setState({ activeTab: s }); } render() { const { children: r, className: a, ...s } = this.props, o = E( "ribbon-menu", a ); return ( // @ts-ignore /* @__PURE__ */ N("nav", { className: o, ...s, ref: this.myRef, children: [ /* @__PURE__ */ v("ul", { className: "tabs-holder", children: this.renderTabs() }), /* @__PURE__ */ v("div", { className: "content-holder", children: this.renderSections() }) ] }) ); } } const xt = () => /* @__PURE__ */ v("div", { className: "ribbon-divider" }), Pt = ({ className: i, children: c, title: r, ...a }) => { const s = E( "group", i ); return /* @__PURE__ */ N("div", { className: s, ...a, children: [ c, r && /* @__PURE__ */ v("span", { className: "title", children: r }) ] }); }, jt = ({ children: i, ...c }) => /* @__PURE__ */ v("div", { className: "ribbon-sub-group", ...c, children: i }), ae = ({ name: i, className: c }) => { const r = E(c); return /* @__PURE__ */ v("span", { className: "ribbon-icon", children: /* @__PURE__ */ v("span", { className: `${i} ${r}` }) }); }, se = ({ src: i, className: c }) => { const r = E(c); return /* @__PURE__ */ v("span", { className: "icon", children: /* @__PURE__ */ v("img", { className: r, src: i }) }); }, Ae = ({ caption: i, className: c }) => { const r = E(c); return /* @__PURE__ */ v("span", { className: "caption", children: /* @__PURE__ */ v("span", { className: r, children: i }) }); }; const _t = ({ hotkey: i = "", children: c, className: r, icon: a, image: s, caption: o, onClick: u, ...h }) => { const f = E( "ribbon-button", r ); return /* @__PURE__ */ N("button", { className: f, onClick: u, "data-hotkey": i, ...h, children: [ c, a && /* @__PURE__ */ v(ae, { name: a }), s && /* @__PURE__ */ v(se, { src: s }), o && /* @__PURE__ */ v(Ae, { caption: o }) ] }); }; const Nt = ({ hotkey: i = "", children: c, className: r, title: a = "", icon: s, image: o, onClick: u, ...h }) => { const f = E( "ribbon-tool-button", r ); return /* @__PURE__ */ N("button", { className: f, title: a, ...h, onClick: u, "data-hotkey": i, children: [ c, s && /* @__PURE__ */ v(ae, { name: s }), o && /* @__PURE__ */ v(se, { src: o }) ] }); }; const Ct = ({ title: i, hotkey: c = "", children: r, className: a, icon: s, image: o, caption: u, onClick: h, ...f }) => { const w = E( "ribbon-icon-button", a ); return /* @__PURE__ */ N("button", { className: w, ...f, onClick: h, title: i, "data-hotkey": c, children: [ r, s && /* @__PURE__ */ v(ae, { name: s }), o && /* @__PURE__ */ v(se, { src: o }), u && /* @__PURE__ */ v(Ae, { caption: u }) ] }); }; class Dt extends O.Component { constructor(r) { super(r); A(this, "state", { radio: !1, buttons: [] }); const { active: a, radio: s = !1 } = r, o = []; typeof a < "u" && (Array.isArray(a) ? a.forEach((u) => { o.push(u); }) : o.push(a)), this.state = { radio: s, buttons: o || [] }, this.buttonClick = this.buttonClick.bind(this); } buttonClick(r) { const { children: a, onButtonClick: s = () => { } } = this.props, { buttons: o, radio: u } = this.state, h = o.includes(r), f = O.Children.toArray(a)[r - 1]; u ? this.setState({ buttons: [r] }) : (h ? o.splice(o.indexOf(r), 1) : o.push(r), this.setState({ buttons: o })), typeof s == "function" && s(f); } render() { const { children: r, className: a, classNameActive: s, classNameButton: o, style: u } = this.props, { buttons: h, radio: f } = this.state, w = E( "ribbon-toggle-group", "button-group", a, f ? "radio-group" : "check-group" ); return /* @__PURE__ */ v("div", { className: w, style: u, children: O.Children.map(r, (g, T) => { const k = g.props, j = T + 1, V = h.includes(j), H = E( k.className, o, V ? s || " active " : "" ); return O.cloneElement(g, { className: H, index: j, onClick: this.buttonClick.bind(this, j) }); }) }); } } class Tt extends O.Component { constructor(r) { super(r); A(this, "state", { isOpen: !1 }); A(this, "dropdown"); this.state = { isOpen: !1 }, this.dropdown = O.createRef(), this.toggleState = this.toggleState.bind(this), this.handleClickOutside = this.handleClickOutside.bind(this); } componentDidMount() { document.addEventListener("mousedown", this.handleClickOutside); } componentWillUnmount() { document.removeEventListener("mousedown", this.handleClickOutside); } handleClickOutside(r) { this.dropdown.current && !this.dropdown.current.contains(r.target) && this.setState({ isOpen: !1 }); } toggleState(r) { const a = this.state.isOpen, s = this.dropdown.current, o = s.querySelector(".drop-object"), u = s.getBoundingClientRect(); getComputedStyle(o).position === "fixed" && (o.style.top = u.top + u.height + "px", o.style.left = u.left + "px"), this.setState({ isOpen: !a }), r.preventDefault(); } render() { const { children: r } = this.props, [a, s] = M.toArray(r), { isOpen: o } = this.state, u = E( "dropdown", o ? "dropped" : "" ); return /* @__PURE__ */ N("div", { className: u, ref: this.dropdown, /*@ts-ignore*/ children: [ a && De(a, { /*@ts-ignore*/ className: ("props" in a && a.props.className ? a.props.className : "") + " dropdown-toggle " + (o ? " drop-active active-toggle " : ""), onClick: this.toggleState }), /* @__PURE__ */ v("nav", { className: "drop-object " + (o ? " open " : ""), children: s }) ] }); } } const At = ({ hotkey: i = "", children: c, caption: r, icon: a, image: s, onClick: o, buttonClassName: u, ...h }) => { const [f] = M.toArray(c), w = E("ribbon-split-button"), g = E("ribbon-main", u); return /* @__PURE__ */ N("div", { className: w, children: [ /* @__PURE__ */ v(_t, { icon: a, image: s, className: g, onClick: o, ...h, "data-hotkey": i }), /* @__PURE__ */ N(Tt, { children: [ /* @__PURE__ */ v(Ct, { caption: r, className: "ribbon-split dropdown-toggle" }), // @ts-ignore f && De(f, { className: "ribbon-dropdown" }) ] }) ] }); }, Ft = () => /* @__PURE__ */ v("li", { className: "divider" }), It = ({ hotkey: i = "", children: c, className: r, target: a, caption: s, onClick: o, ...u }) => /* @__PURE__ */ v("li", { className: r, ...u, children: /* @__PURE__ */ v("a", { href: a, onClick: o, "data-hotkey": i, children: s || c }) }); class Lt extends O.Component { constructor(r) { super(r); A(this, "state", { checked: !1 }); this.state = { checked: r.checked || !1 }; } render() { const { hotkey: r = "", className: a, target: s, caption: o, children: u, onClick: h, ...f } = this.props, { checked: w } = this.state, g = E(a, w ? " checked " : ""); return /* @__PURE__ */ v("li", { className: g, ...f, onClick: () => { this.setState({ checked: !w }); }, children: /* @__PURE__ */ v("a", { href: s, onClick: h, "data-hotkey": r, children: o || u }) }); } } const $t = ({ children: i, className: c }) => { const r = E("ribbon-dropdown", c); return /* @__PURE__ */ v("ul", { className: r, children: i }); }; export { _t as RibbonButton, Dt as RibbonButtonGroup, Tt as RibbonDropdown, Lt as RibbonDropdownCheckItem, Ft as RibbonDropdownDivider, It as RibbonDropdownItem, $t as RibbonDropdownMenu, Ct as RibbonIconButton, kt as RibbonMenu, At as RibbonSplitButton, wt as RibbonTab, xt as RibbonTabDivider, Pt as RibbonTabGroup, jt as RibbonTabSubGroup, Nt as RibbonToolButton };