publish-list-widget 0.0.1
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/demo/App.d.ts +1 -0
- package/dist/demo/main.d.ts +1 -0
- package/dist/index.cjs +30 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +776 -0
- package/dist/src/PublishListWidget.d.ts +34 -0
- package/dist/src/index.d.ts +2 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function App(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react");var ge={exports:{}},N={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ie;function cr(){if(Ie)return N;Ie=1;var F=m,k=Symbol.for("react.element"),W=Symbol.for("react.fragment"),P=Object.prototype.hasOwnProperty,D=F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,I={key:!0,ref:!0,__self:!0,__source:!0};function C(T,h,g){var y,b={},_=null,O=null;g!==void 0&&(_=""+g),h.key!==void 0&&(_=""+h.key),h.ref!==void 0&&(O=h.ref);for(y in h)P.call(h,y)&&!I.hasOwnProperty(y)&&(b[y]=h[y]);if(T&&T.defaultProps)for(y in h=T.defaultProps,h)b[y]===void 0&&(b[y]=h[y]);return{$$typeof:k,type:T,key:_,ref:O,props:b,_owner:D.current}}return N.Fragment=W,N.jsx=C,N.jsxs=C,N}var B={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var $e;function fr(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){var F=m,k=Symbol.for("react.element"),W=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),T=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),L=Symbol.iterator,V="@@iterator";function z(e){if(e===null||typeof e!="object")return null;var r=L&&e[L]||e[V];return typeof r=="function"?r:null}var w=F.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),a=1;a<r;a++)t[a-1]=arguments[a];J("error",e,t)}}function J(e,r,t){{var a=w.ReactDebugCurrentFrame,s=a.getStackAddendum();s!==""&&(r+="%s",t=t.concat([s]));var l=t.map(function(o){return String(o)});l.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,l)}}var A=!1,ne=!1,ae=!1,q=!1,K=!1,G;G=Symbol.for("react.module.reference");function ie(e){return!!(typeof e=="string"||typeof e=="function"||e===P||e===I||K||e===D||e===g||e===y||q||e===O||A||ne||ae||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===b||e.$$typeof===C||e.$$typeof===T||e.$$typeof===h||e.$$typeof===G||e.getModuleId!==void 0))}function oe(e,r,t){var a=e.displayName;if(a)return a;var s=r.displayName||r.name||"";return s!==""?t+"("+s+")":t}function X(e){return e.displayName||"Context"}function S(e){if(e==null)return null;if(typeof e.tag=="number"&&v("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 P:return"Fragment";case W:return"Portal";case I:return"Profiler";case D:return"StrictMode";case g:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:var r=e;return X(r)+".Consumer";case C:var t=e;return X(t._context)+".Provider";case h:return oe(e,e.render,"ForwardRef");case b:var a=e.displayName||null;return a!==null?a:S(e.type)||"Memo";case _:{var s=e,l=s._payload,o=s._init;try{return S(o(l))}catch{return null}}}return null}var j=Object.assign,n=0,u,c,H,se,Z,ye,be;function Ee(){}Ee.__reactDisabledLog=!0;function We(){{if(n===0){u=console.log,c=console.info,H=console.warn,se=console.error,Z=console.group,ye=console.groupCollapsed,be=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}n++}}function Me(){{if(n--,n===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},e,{value:u}),info:j({},e,{value:c}),warn:j({},e,{value:H}),error:j({},e,{value:se}),group:j({},e,{value:Z}),groupCollapsed:j({},e,{value:ye}),groupEnd:j({},e,{value:be})})}n<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var le=w.ReactCurrentDispatcher,ue;function Q(e,r,t){{if(ue===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);ue=a&&a[1]||""}return`
|
|
18
|
+
`+ue+e}}var ce=!1,ee;{var Ye=typeof WeakMap=="function"?WeakMap:Map;ee=new Ye}function me(e,r){if(!e||ce)return"";{var t=ee.get(e);if(t!==void 0)return t}var a;ce=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var l;l=le.current,le.current=null,We();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(R){a=R}Reflect.construct(e,[],o)}else{try{o.call()}catch(R){a=R}e.call(o.prototype)}}else{try{throw Error()}catch(R){a=R}e()}}catch(R){if(R&&a&&typeof R.stack=="string"){for(var i=R.stack.split(`
|
|
19
|
+
`),E=a.stack.split(`
|
|
20
|
+
`),d=i.length-1,p=E.length-1;d>=1&&p>=0&&i[d]!==E[p];)p--;for(;d>=1&&p>=0;d--,p--)if(i[d]!==E[p]){if(d!==1||p!==1)do if(d--,p--,p<0||i[d]!==E[p]){var x=`
|
|
21
|
+
`+i[d].replace(" at new "," at ");return e.displayName&&x.includes("<anonymous>")&&(x=x.replace("<anonymous>",e.displayName)),typeof e=="function"&&ee.set(e,x),x}while(d>=1&&p>=0);break}}}finally{ce=!1,le.current=l,Me(),Error.prepareStackTrace=s}var Y=e?e.displayName||e.name:"",$=Y?Q(Y):"";return typeof e=="function"&&ee.set(e,$),$}function Le(e,r,t){return me(e,!1)}function Ve(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function re(e,r,t){if(e==null)return"";if(typeof e=="function")return me(e,Ve(e));if(typeof e=="string")return Q(e);switch(e){case g:return Q("Suspense");case y:return Q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case h:return Le(e.render);case b:return re(e.type,r,t);case _:{var a=e,s=a._payload,l=a._init;try{return re(l(s),r,t)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,Re={},_e=w.ReactDebugCurrentFrame;function te(e){if(e){var r=e._owner,t=re(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}function Ue(e,r,t,a,s){{var l=Function.call.bind(U);for(var o in e)if(l(e,o)){var i=void 0;try{if(typeof e[o]!="function"){var E=Error((a||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw E.name="Invariant Violation",E}i=e[o](r,o,a,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){i=d}i&&!(i instanceof Error)&&(te(s),v("%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).",a||"React class",t,o,typeof i),te(null)),i instanceof Error&&!(i.message in Re)&&(Re[i.message]=!0,te(s),v("Failed %s type: %s",t,i.message),te(null))}}}var Ne=Array.isArray;function fe(e){return Ne(e)}function Be(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ze(e){try{return xe(e),!1}catch{return!0}}function xe(e){return""+e}function Se(e){if(ze(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Be(e)),xe(e)}var Te=w.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0},we,Pe;function qe(e){if(U.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ke(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ge(e,r){typeof e.ref=="string"&&Te.current}function Xe(e,r){{var t=function(){we||(we=!0,v("%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))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function He(e,r){{var t=function(){Pe||(Pe=!0,v("%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))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var Ze=function(e,r,t,a,s,l,o){var i={$$typeof:k,type:e,key:r,ref:t,props:o,_owner:l};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function Qe(e,r,t,a,s){{var l,o={},i=null,E=null;t!==void 0&&(Se(t),i=""+t),Ke(r)&&(Se(r.key),i=""+r.key),qe(r)&&(E=r.ref,Ge(r,s));for(l in r)U.call(r,l)&&!Je.hasOwnProperty(l)&&(o[l]=r[l]);if(e&&e.defaultProps){var d=e.defaultProps;for(l in d)o[l]===void 0&&(o[l]=d[l])}if(i||E){var p=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&Xe(o,p),E&&He(o,p)}return Ze(e,i,E,s,a,Te.current,o)}}var de=w.ReactCurrentOwner,Ce=w.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=re(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(t)}else Ce.setExtraStackFrame(null)}var ve;ve=!1;function pe(e){return typeof e=="object"&&e!==null&&e.$$typeof===k}function Oe(){{if(de.current){var e=S(de.current.type);if(e)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function er(e){return""}var je={};function rr(e){{var r=Oe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=rr(r);if(je[t])return;je[t]=!0;var a="";e&&e._owner&&e._owner!==de.current&&(a=" It was passed a child from "+S(e._owner.type)+"."),M(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,a),M(null)}}function Ae(e,r){{if(typeof e!="object")return;if(fe(e))for(var t=0;t<e.length;t++){var a=e[t];pe(a)&&ke(a,r)}else if(pe(e))e._store&&(e._store.validated=!0);else if(e){var s=z(e);if(typeof s=="function"&&s!==e.entries)for(var l=s.call(e),o;!(o=l.next()).done;)pe(o.value)&&ke(o.value,r)}}}function tr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===h||r.$$typeof===b))t=r.propTypes;else return;if(t){var a=S(r);Ue(t,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!ve){ve=!0;var s=S(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function nr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var a=r[t];if(a!=="children"&&a!=="key"){M(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),M(null);break}}e.ref!==null&&(M(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}var Fe={};function De(e,r,t,a,s,l){{var o=ie(e);if(!o){var i="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(i+=" 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 E=er();E?i+=E:i+=Oe();var d;e===null?d="null":fe(e)?d="array":e!==void 0&&e.$$typeof===k?(d="<"+(S(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,i)}var p=Qe(e,r,t,s,l);if(p==null)return p;if(o){var x=r.children;if(x!==void 0)if(a)if(fe(x)){for(var Y=0;Y<x.length;Y++)Ae(x[Y],e);Object.freeze&&Object.freeze(x)}else v("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 Ae(x,e)}if(U.call(r,"key")){var $=S(e),R=Object.keys(r).filter(function(ur){return ur!=="key"}),he=R.length>0?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}";if(!Fe[$+he]){var lr=R.length>0?"{"+R.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,he,$,lr,$),Fe[$+he]=!0}}return e===P?nr(p):tr(p),p}}function ar(e,r,t){return De(e,r,t,!0)}function ir(e,r,t){return De(e,r,t,!1)}var or=ir,sr=ar;B.Fragment=P,B.jsx=or,B.jsxs=sr}()),B}process.env.NODE_ENV==="production"?ge.exports=cr():ge.exports=fr();var f=ge.exports;function dr({endpoint:F,selectItems:k,getLabel:W,getKey:P,requestInit:D,limit:I=10,onPublish:C,actions:T,title:h="Publish List Widget"}){const[g,y]=m.useState([]),[b,_]=m.useState(new Set),[O,L]=m.useState(!1),[V,z]=m.useState(null),[w,v]=m.useState(null),[J,A]=m.useState(null),ne=m.useMemo(()=>W??((n,u)=>String((n==null?void 0:n.title)??(n==null?void 0:n.name)??(n==null?void 0:n.label)??(n==null?void 0:n.id)??`Item ${u+1}`)),[W]),ae=m.useMemo(()=>P??((n,u)=>(n==null?void 0:n.id)??u),[P]),q=m.useMemo(()=>k??(n=>{if(Array.isArray(n))return n;const u=[n==null?void 0:n.data,n==null?void 0:n.items,n==null?void 0:n.results];for(const c of u)if(Array.isArray(c))return c;return[]}),[k]),K=m.useMemo(()=>Array.from(b).map(n=>g[n]).filter(Boolean),[b,g]);m.useEffect(()=>{let n=!1;async function u(){L(!0),v(null),A(null),_(new Set);try{const c=await fetch(F,D);if(!c.ok)throw new Error(`Fetch failed: ${c.status} ${c.statusText}`);const H=await c.json(),Z=q(H).slice(0,Math.max(0,I));n||y(Z)}catch(c){n||v((c==null?void 0:c.message)??"Failed to load data")}finally{n||L(!1)}}return u(),()=>{n=!0}},[F,D,q,I]);function G(n){A(null),_(u=>{const c=new Set(u);return c.has(n)?c.delete(n):c.add(n),c})}function ie(){A(null),_(new Set(g.map((n,u)=>u)))}function oe(){A(null),_(new Set)}async function X(n,u){z(n),v(null),A(null);try{await u(),A(`${n} completed ✅`)}catch(c){v((c==null?void 0:c.message)??`${n} failed`)}finally{z(null)}}const S=m.useMemo(()=>({key:"Publish",label:V==="Publish"?"Publishing...":"Publish",variant:"primary",disabled:({selectedItems:n})=>n.length===0,onClick:async({selectedItems:n})=>{if(C){await C(n);return}await new Promise(u=>setTimeout(u,700))}}),[C,V]),j=m.useMemo(()=>[S,...T??[]],[T,S]);return f.jsxs("div",{style:{fontFamily:"system-ui, Arial",maxWidth:760},children:[f.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,alignItems:"center"},children:[f.jsxs("div",{children:[f.jsx("h3",{style:{margin:0},children:h}),f.jsxs("div",{style:{fontSize:12,color:"#666",marginTop:4},children:["Endpoint: ",f.jsx("code",{children:F})]})]}),f.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",justifyContent:"flex-end"},children:[f.jsx("button",{onClick:ie,disabled:O||g.length===0,style:{padding:"8px 10px",borderRadius:8,border:"1px solid #ccc"},children:"Select all"}),f.jsx("button",{onClick:oe,disabled:b.size===0,style:{padding:"8px 10px",borderRadius:8,border:"1px solid #ccc"},children:"Clear"}),j.map(n=>{const u=O||g.length===0||V!==null||(n.disabled?n.disabled({selectedItems:K,items:g}):!1),c=n.variant==="primary";return f.jsx("button",{onClick:()=>X(n.key,()=>n.onClick({selectedItems:K,items:g})),disabled:u,style:{padding:"8px 12px",borderRadius:8,border:"1px solid #ccc",fontWeight:c?700:500,cursor:u?"not-allowed":"pointer"},children:n.label},n.key)})]})]}),f.jsxs("div",{style:{marginTop:10,fontSize:14,color:"#333"},children:["Selected: ",f.jsx("b",{children:b.size})," / ",g.length]}),f.jsxs("div",{style:{marginTop:10},children:[O&&f.jsx("div",{children:"Loading…"}),w&&f.jsxs("div",{style:{color:"crimson"},children:["Error: ",w]}),J&&f.jsx("div",{style:{color:"green"},children:J})]}),f.jsxs("div",{style:{marginTop:12,border:"1px solid #eee",borderRadius:12,padding:12},children:[g.length===0&&!O&&!w&&f.jsx("div",{children:"No items found."}),f.jsx("ul",{style:{margin:0,paddingLeft:18},children:g.map((n,u)=>f.jsx("li",{style:{marginBottom:10},children:f.jsxs("label",{style:{display:"flex",gap:10,alignItems:"center"},children:[f.jsx("input",{type:"checkbox",checked:b.has(u),onChange:()=>G(u)}),f.jsx("span",{children:ne(n,u)})]})},String(ae(n,u))))})]})]})}exports.PublishListWidget=dr;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/index'
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
import Ye, { useState as L, useMemo as M, useEffect as dr } from "react";
|
|
2
|
+
var ye = { exports: {} }, B = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.min.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var $e;
|
|
13
|
+
function vr() {
|
|
14
|
+
if ($e) return B;
|
|
15
|
+
$e = 1;
|
|
16
|
+
var A = Ye, j = Symbol.for("react.element"), $ = Symbol.for("react.fragment"), w = Object.prototype.hasOwnProperty, F = A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, D = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
+
function C(T, h, g) {
|
|
18
|
+
var y, b = {}, R = null, P = null;
|
|
19
|
+
g !== void 0 && (R = "" + g), h.key !== void 0 && (R = "" + h.key), h.ref !== void 0 && (P = h.ref);
|
|
20
|
+
for (y in h) w.call(h, y) && !D.hasOwnProperty(y) && (b[y] = h[y]);
|
|
21
|
+
if (T && T.defaultProps) for (y in h = T.defaultProps, h) b[y] === void 0 && (b[y] = h[y]);
|
|
22
|
+
return { $$typeof: j, type: T, key: R, ref: P, props: b, _owner: F.current };
|
|
23
|
+
}
|
|
24
|
+
return B.Fragment = $, B.jsx = C, B.jsxs = C, B;
|
|
25
|
+
}
|
|
26
|
+
var z = {};
|
|
27
|
+
/**
|
|
28
|
+
* @license React
|
|
29
|
+
* react-jsx-runtime.development.js
|
|
30
|
+
*
|
|
31
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the MIT license found in the
|
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
var We;
|
|
37
|
+
function pr() {
|
|
38
|
+
return We || (We = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
+
var A = Ye, j = Symbol.for("react.element"), $ = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), C = Symbol.for("react.provider"), T = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), V = Symbol.iterator, U = "@@iterator";
|
|
40
|
+
function J(e) {
|
|
41
|
+
if (e === null || typeof e != "object")
|
|
42
|
+
return null;
|
|
43
|
+
var r = V && e[V] || e[U];
|
|
44
|
+
return typeof r == "function" ? r : null;
|
|
45
|
+
}
|
|
46
|
+
var S = A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
+
function v(e) {
|
|
48
|
+
{
|
|
49
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
|
|
50
|
+
t[a - 1] = arguments[a];
|
|
51
|
+
q("error", e, t);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function q(e, r, t) {
|
|
55
|
+
{
|
|
56
|
+
var a = S.ReactDebugCurrentFrame, s = a.getStackAddendum();
|
|
57
|
+
s !== "" && (r += "%s", t = t.concat([s]));
|
|
58
|
+
var l = t.map(function(o) {
|
|
59
|
+
return String(o);
|
|
60
|
+
});
|
|
61
|
+
l.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, l);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var k = !1, ae = !1, ie = !1, K = !1, G = !1, X;
|
|
65
|
+
X = Symbol.for("react.module.reference");
|
|
66
|
+
function oe(e) {
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === w || e === D || G || e === F || e === g || e === y || K || e === P || k || ae || ie || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === b || e.$$typeof === C || e.$$typeof === T || e.$$typeof === h || // This needs to include all possible module reference object
|
|
68
|
+
// types supported by any Flight configuration anywhere since
|
|
69
|
+
// we don't know which Flight build this will end up being used
|
|
70
|
+
// with.
|
|
71
|
+
e.$$typeof === X || e.getModuleId !== void 0));
|
|
72
|
+
}
|
|
73
|
+
function se(e, r, t) {
|
|
74
|
+
var a = e.displayName;
|
|
75
|
+
if (a)
|
|
76
|
+
return a;
|
|
77
|
+
var s = r.displayName || r.name || "";
|
|
78
|
+
return s !== "" ? t + "(" + s + ")" : t;
|
|
79
|
+
}
|
|
80
|
+
function H(e) {
|
|
81
|
+
return e.displayName || "Context";
|
|
82
|
+
}
|
|
83
|
+
function x(e) {
|
|
84
|
+
if (e == null)
|
|
85
|
+
return null;
|
|
86
|
+
if (typeof e.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
87
|
+
return e.displayName || e.name || null;
|
|
88
|
+
if (typeof e == "string")
|
|
89
|
+
return e;
|
|
90
|
+
switch (e) {
|
|
91
|
+
case w:
|
|
92
|
+
return "Fragment";
|
|
93
|
+
case $:
|
|
94
|
+
return "Portal";
|
|
95
|
+
case D:
|
|
96
|
+
return "Profiler";
|
|
97
|
+
case F:
|
|
98
|
+
return "StrictMode";
|
|
99
|
+
case g:
|
|
100
|
+
return "Suspense";
|
|
101
|
+
case y:
|
|
102
|
+
return "SuspenseList";
|
|
103
|
+
}
|
|
104
|
+
if (typeof e == "object")
|
|
105
|
+
switch (e.$$typeof) {
|
|
106
|
+
case T:
|
|
107
|
+
var r = e;
|
|
108
|
+
return H(r) + ".Consumer";
|
|
109
|
+
case C:
|
|
110
|
+
var t = e;
|
|
111
|
+
return H(t._context) + ".Provider";
|
|
112
|
+
case h:
|
|
113
|
+
return se(e, e.render, "ForwardRef");
|
|
114
|
+
case b:
|
|
115
|
+
var a = e.displayName || null;
|
|
116
|
+
return a !== null ? a : x(e.type) || "Memo";
|
|
117
|
+
case R: {
|
|
118
|
+
var s = e, l = s._payload, o = s._init;
|
|
119
|
+
try {
|
|
120
|
+
return x(o(l));
|
|
121
|
+
} catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
var O = Object.assign, n = 0, u, c, Z, le, Q, be, Ee;
|
|
129
|
+
function me() {
|
|
130
|
+
}
|
|
131
|
+
me.__reactDisabledLog = !0;
|
|
132
|
+
function Le() {
|
|
133
|
+
{
|
|
134
|
+
if (n === 0) {
|
|
135
|
+
u = console.log, c = console.info, Z = console.warn, le = console.error, Q = console.group, be = console.groupCollapsed, Ee = console.groupEnd;
|
|
136
|
+
var e = {
|
|
137
|
+
configurable: !0,
|
|
138
|
+
enumerable: !0,
|
|
139
|
+
value: me,
|
|
140
|
+
writable: !0
|
|
141
|
+
};
|
|
142
|
+
Object.defineProperties(console, {
|
|
143
|
+
info: e,
|
|
144
|
+
log: e,
|
|
145
|
+
warn: e,
|
|
146
|
+
error: e,
|
|
147
|
+
group: e,
|
|
148
|
+
groupCollapsed: e,
|
|
149
|
+
groupEnd: e
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
n++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function Me() {
|
|
156
|
+
{
|
|
157
|
+
if (n--, n === 0) {
|
|
158
|
+
var e = {
|
|
159
|
+
configurable: !0,
|
|
160
|
+
enumerable: !0,
|
|
161
|
+
writable: !0
|
|
162
|
+
};
|
|
163
|
+
Object.defineProperties(console, {
|
|
164
|
+
log: O({}, e, {
|
|
165
|
+
value: u
|
|
166
|
+
}),
|
|
167
|
+
info: O({}, e, {
|
|
168
|
+
value: c
|
|
169
|
+
}),
|
|
170
|
+
warn: O({}, e, {
|
|
171
|
+
value: Z
|
|
172
|
+
}),
|
|
173
|
+
error: O({}, e, {
|
|
174
|
+
value: le
|
|
175
|
+
}),
|
|
176
|
+
group: O({}, e, {
|
|
177
|
+
value: Q
|
|
178
|
+
}),
|
|
179
|
+
groupCollapsed: O({}, e, {
|
|
180
|
+
value: be
|
|
181
|
+
}),
|
|
182
|
+
groupEnd: O({}, e, {
|
|
183
|
+
value: Ee
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
n < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var ue = S.ReactCurrentDispatcher, ce;
|
|
191
|
+
function ee(e, r, t) {
|
|
192
|
+
{
|
|
193
|
+
if (ce === void 0)
|
|
194
|
+
try {
|
|
195
|
+
throw Error();
|
|
196
|
+
} catch (s) {
|
|
197
|
+
var a = s.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
+
ce = a && a[1] || "";
|
|
199
|
+
}
|
|
200
|
+
return `
|
|
201
|
+
` + ce + e;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
var fe = !1, re;
|
|
205
|
+
{
|
|
206
|
+
var Ve = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
re = new Ve();
|
|
208
|
+
}
|
|
209
|
+
function Re(e, r) {
|
|
210
|
+
if (!e || fe)
|
|
211
|
+
return "";
|
|
212
|
+
{
|
|
213
|
+
var t = re.get(e);
|
|
214
|
+
if (t !== void 0)
|
|
215
|
+
return t;
|
|
216
|
+
}
|
|
217
|
+
var a;
|
|
218
|
+
fe = !0;
|
|
219
|
+
var s = Error.prepareStackTrace;
|
|
220
|
+
Error.prepareStackTrace = void 0;
|
|
221
|
+
var l;
|
|
222
|
+
l = ue.current, ue.current = null, Le();
|
|
223
|
+
try {
|
|
224
|
+
if (r) {
|
|
225
|
+
var o = function() {
|
|
226
|
+
throw Error();
|
|
227
|
+
};
|
|
228
|
+
if (Object.defineProperty(o.prototype, "props", {
|
|
229
|
+
set: function() {
|
|
230
|
+
throw Error();
|
|
231
|
+
}
|
|
232
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
|
+
try {
|
|
234
|
+
Reflect.construct(o, []);
|
|
235
|
+
} catch (m) {
|
|
236
|
+
a = m;
|
|
237
|
+
}
|
|
238
|
+
Reflect.construct(e, [], o);
|
|
239
|
+
} else {
|
|
240
|
+
try {
|
|
241
|
+
o.call();
|
|
242
|
+
} catch (m) {
|
|
243
|
+
a = m;
|
|
244
|
+
}
|
|
245
|
+
e.call(o.prototype);
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
try {
|
|
249
|
+
throw Error();
|
|
250
|
+
} catch (m) {
|
|
251
|
+
a = m;
|
|
252
|
+
}
|
|
253
|
+
e();
|
|
254
|
+
}
|
|
255
|
+
} catch (m) {
|
|
256
|
+
if (m && a && typeof m.stack == "string") {
|
|
257
|
+
for (var i = m.stack.split(`
|
|
258
|
+
`), E = a.stack.split(`
|
|
259
|
+
`), d = i.length - 1, p = E.length - 1; d >= 1 && p >= 0 && i[d] !== E[p]; )
|
|
260
|
+
p--;
|
|
261
|
+
for (; d >= 1 && p >= 0; d--, p--)
|
|
262
|
+
if (i[d] !== E[p]) {
|
|
263
|
+
if (d !== 1 || p !== 1)
|
|
264
|
+
do
|
|
265
|
+
if (d--, p--, p < 0 || i[d] !== E[p]) {
|
|
266
|
+
var _ = `
|
|
267
|
+
` + i[d].replace(" at new ", " at ");
|
|
268
|
+
return e.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, _), _;
|
|
269
|
+
}
|
|
270
|
+
while (d >= 1 && p >= 0);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} finally {
|
|
275
|
+
fe = !1, ue.current = l, Me(), Error.prepareStackTrace = s;
|
|
276
|
+
}
|
|
277
|
+
var Y = e ? e.displayName || e.name : "", I = Y ? ee(Y) : "";
|
|
278
|
+
return typeof e == "function" && re.set(e, I), I;
|
|
279
|
+
}
|
|
280
|
+
function Ue(e, r, t) {
|
|
281
|
+
return Re(e, !1);
|
|
282
|
+
}
|
|
283
|
+
function Ne(e) {
|
|
284
|
+
var r = e.prototype;
|
|
285
|
+
return !!(r && r.isReactComponent);
|
|
286
|
+
}
|
|
287
|
+
function te(e, r, t) {
|
|
288
|
+
if (e == null)
|
|
289
|
+
return "";
|
|
290
|
+
if (typeof e == "function")
|
|
291
|
+
return Re(e, Ne(e));
|
|
292
|
+
if (typeof e == "string")
|
|
293
|
+
return ee(e);
|
|
294
|
+
switch (e) {
|
|
295
|
+
case g:
|
|
296
|
+
return ee("Suspense");
|
|
297
|
+
case y:
|
|
298
|
+
return ee("SuspenseList");
|
|
299
|
+
}
|
|
300
|
+
if (typeof e == "object")
|
|
301
|
+
switch (e.$$typeof) {
|
|
302
|
+
case h:
|
|
303
|
+
return Ue(e.render);
|
|
304
|
+
case b:
|
|
305
|
+
return te(e.type, r, t);
|
|
306
|
+
case R: {
|
|
307
|
+
var a = e, s = a._payload, l = a._init;
|
|
308
|
+
try {
|
|
309
|
+
return te(l(s), r, t);
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
var N = Object.prototype.hasOwnProperty, _e = {}, xe = S.ReactDebugCurrentFrame;
|
|
317
|
+
function ne(e) {
|
|
318
|
+
if (e) {
|
|
319
|
+
var r = e._owner, t = te(e.type, e._source, r ? r.type : null);
|
|
320
|
+
xe.setExtraStackFrame(t);
|
|
321
|
+
} else
|
|
322
|
+
xe.setExtraStackFrame(null);
|
|
323
|
+
}
|
|
324
|
+
function Be(e, r, t, a, s) {
|
|
325
|
+
{
|
|
326
|
+
var l = Function.call.bind(N);
|
|
327
|
+
for (var o in e)
|
|
328
|
+
if (l(e, o)) {
|
|
329
|
+
var i = void 0;
|
|
330
|
+
try {
|
|
331
|
+
if (typeof e[o] != "function") {
|
|
332
|
+
var E = Error((a || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
+
throw E.name = "Invariant Violation", E;
|
|
334
|
+
}
|
|
335
|
+
i = e[o](r, o, a, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
|
+
} catch (d) {
|
|
337
|
+
i = d;
|
|
338
|
+
}
|
|
339
|
+
i && !(i instanceof Error) && (ne(s), v("%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).", a || "React class", t, o, typeof i), ne(null)), i instanceof Error && !(i.message in _e) && (_e[i.message] = !0, ne(s), v("Failed %s type: %s", t, i.message), ne(null));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
var ze = Array.isArray;
|
|
344
|
+
function de(e) {
|
|
345
|
+
return ze(e);
|
|
346
|
+
}
|
|
347
|
+
function Je(e) {
|
|
348
|
+
{
|
|
349
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
350
|
+
return t;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function qe(e) {
|
|
354
|
+
try {
|
|
355
|
+
return Te(e), !1;
|
|
356
|
+
} catch {
|
|
357
|
+
return !0;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function Te(e) {
|
|
361
|
+
return "" + e;
|
|
362
|
+
}
|
|
363
|
+
function Se(e) {
|
|
364
|
+
if (qe(e))
|
|
365
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Je(e)), Te(e);
|
|
366
|
+
}
|
|
367
|
+
var we = S.ReactCurrentOwner, Ke = {
|
|
368
|
+
key: !0,
|
|
369
|
+
ref: !0,
|
|
370
|
+
__self: !0,
|
|
371
|
+
__source: !0
|
|
372
|
+
}, Ce, Pe;
|
|
373
|
+
function Ge(e) {
|
|
374
|
+
if (N.call(e, "ref")) {
|
|
375
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
|
+
if (r && r.isReactWarning)
|
|
377
|
+
return !1;
|
|
378
|
+
}
|
|
379
|
+
return e.ref !== void 0;
|
|
380
|
+
}
|
|
381
|
+
function Xe(e) {
|
|
382
|
+
if (N.call(e, "key")) {
|
|
383
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
|
+
if (r && r.isReactWarning)
|
|
385
|
+
return !1;
|
|
386
|
+
}
|
|
387
|
+
return e.key !== void 0;
|
|
388
|
+
}
|
|
389
|
+
function He(e, r) {
|
|
390
|
+
typeof e.ref == "string" && we.current;
|
|
391
|
+
}
|
|
392
|
+
function Ze(e, r) {
|
|
393
|
+
{
|
|
394
|
+
var t = function() {
|
|
395
|
+
Ce || (Ce = !0, v("%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));
|
|
396
|
+
};
|
|
397
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
|
+
get: t,
|
|
399
|
+
configurable: !0
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function Qe(e, r) {
|
|
404
|
+
{
|
|
405
|
+
var t = function() {
|
|
406
|
+
Pe || (Pe = !0, v("%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));
|
|
407
|
+
};
|
|
408
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
|
+
get: t,
|
|
410
|
+
configurable: !0
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
var er = function(e, r, t, a, s, l, o) {
|
|
415
|
+
var i = {
|
|
416
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
417
|
+
$$typeof: j,
|
|
418
|
+
// Built-in properties that belong on the element
|
|
419
|
+
type: e,
|
|
420
|
+
key: r,
|
|
421
|
+
ref: t,
|
|
422
|
+
props: o,
|
|
423
|
+
// Record the component responsible for creating this element.
|
|
424
|
+
_owner: l
|
|
425
|
+
};
|
|
426
|
+
return i._store = {}, Object.defineProperty(i._store, "validated", {
|
|
427
|
+
configurable: !1,
|
|
428
|
+
enumerable: !1,
|
|
429
|
+
writable: !0,
|
|
430
|
+
value: !1
|
|
431
|
+
}), Object.defineProperty(i, "_self", {
|
|
432
|
+
configurable: !1,
|
|
433
|
+
enumerable: !1,
|
|
434
|
+
writable: !1,
|
|
435
|
+
value: a
|
|
436
|
+
}), Object.defineProperty(i, "_source", {
|
|
437
|
+
configurable: !1,
|
|
438
|
+
enumerable: !1,
|
|
439
|
+
writable: !1,
|
|
440
|
+
value: s
|
|
441
|
+
}), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
|
|
442
|
+
};
|
|
443
|
+
function rr(e, r, t, a, s) {
|
|
444
|
+
{
|
|
445
|
+
var l, o = {}, i = null, E = null;
|
|
446
|
+
t !== void 0 && (Se(t), i = "" + t), Xe(r) && (Se(r.key), i = "" + r.key), Ge(r) && (E = r.ref, He(r, s));
|
|
447
|
+
for (l in r)
|
|
448
|
+
N.call(r, l) && !Ke.hasOwnProperty(l) && (o[l] = r[l]);
|
|
449
|
+
if (e && e.defaultProps) {
|
|
450
|
+
var d = e.defaultProps;
|
|
451
|
+
for (l in d)
|
|
452
|
+
o[l] === void 0 && (o[l] = d[l]);
|
|
453
|
+
}
|
|
454
|
+
if (i || E) {
|
|
455
|
+
var p = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
+
i && Ze(o, p), E && Qe(o, p);
|
|
457
|
+
}
|
|
458
|
+
return er(e, i, E, s, a, we.current, o);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
var ve = S.ReactCurrentOwner, Oe = S.ReactDebugCurrentFrame;
|
|
462
|
+
function W(e) {
|
|
463
|
+
if (e) {
|
|
464
|
+
var r = e._owner, t = te(e.type, e._source, r ? r.type : null);
|
|
465
|
+
Oe.setExtraStackFrame(t);
|
|
466
|
+
} else
|
|
467
|
+
Oe.setExtraStackFrame(null);
|
|
468
|
+
}
|
|
469
|
+
var pe;
|
|
470
|
+
pe = !1;
|
|
471
|
+
function he(e) {
|
|
472
|
+
return typeof e == "object" && e !== null && e.$$typeof === j;
|
|
473
|
+
}
|
|
474
|
+
function je() {
|
|
475
|
+
{
|
|
476
|
+
if (ve.current) {
|
|
477
|
+
var e = x(ve.current.type);
|
|
478
|
+
if (e)
|
|
479
|
+
return `
|
|
480
|
+
|
|
481
|
+
Check the render method of \`` + e + "`.";
|
|
482
|
+
}
|
|
483
|
+
return "";
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function tr(e) {
|
|
487
|
+
return "";
|
|
488
|
+
}
|
|
489
|
+
var ke = {};
|
|
490
|
+
function nr(e) {
|
|
491
|
+
{
|
|
492
|
+
var r = je();
|
|
493
|
+
if (!r) {
|
|
494
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
495
|
+
t && (r = `
|
|
496
|
+
|
|
497
|
+
Check the top-level render call using <` + t + ">.");
|
|
498
|
+
}
|
|
499
|
+
return r;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function Ae(e, r) {
|
|
503
|
+
{
|
|
504
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
505
|
+
return;
|
|
506
|
+
e._store.validated = !0;
|
|
507
|
+
var t = nr(r);
|
|
508
|
+
if (ke[t])
|
|
509
|
+
return;
|
|
510
|
+
ke[t] = !0;
|
|
511
|
+
var a = "";
|
|
512
|
+
e && e._owner && e._owner !== ve.current && (a = " It was passed a child from " + x(e._owner.type) + "."), W(e), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, a), W(null);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function Fe(e, r) {
|
|
516
|
+
{
|
|
517
|
+
if (typeof e != "object")
|
|
518
|
+
return;
|
|
519
|
+
if (de(e))
|
|
520
|
+
for (var t = 0; t < e.length; t++) {
|
|
521
|
+
var a = e[t];
|
|
522
|
+
he(a) && Ae(a, r);
|
|
523
|
+
}
|
|
524
|
+
else if (he(e))
|
|
525
|
+
e._store && (e._store.validated = !0);
|
|
526
|
+
else if (e) {
|
|
527
|
+
var s = J(e);
|
|
528
|
+
if (typeof s == "function" && s !== e.entries)
|
|
529
|
+
for (var l = s.call(e), o; !(o = l.next()).done; )
|
|
530
|
+
he(o.value) && Ae(o.value, r);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function ar(e) {
|
|
535
|
+
{
|
|
536
|
+
var r = e.type;
|
|
537
|
+
if (r == null || typeof r == "string")
|
|
538
|
+
return;
|
|
539
|
+
var t;
|
|
540
|
+
if (typeof r == "function")
|
|
541
|
+
t = r.propTypes;
|
|
542
|
+
else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here.
|
|
543
|
+
// Inner props are checked in the reconciler.
|
|
544
|
+
r.$$typeof === b))
|
|
545
|
+
t = r.propTypes;
|
|
546
|
+
else
|
|
547
|
+
return;
|
|
548
|
+
if (t) {
|
|
549
|
+
var a = x(r);
|
|
550
|
+
Be(t, e.props, "prop", a, e);
|
|
551
|
+
} else if (r.PropTypes !== void 0 && !pe) {
|
|
552
|
+
pe = !0;
|
|
553
|
+
var s = x(r);
|
|
554
|
+
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
|
|
555
|
+
}
|
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function ir(e) {
|
|
560
|
+
{
|
|
561
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
562
|
+
var a = r[t];
|
|
563
|
+
if (a !== "children" && a !== "key") {
|
|
564
|
+
W(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), W(null);
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
e.ref !== null && (W(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), W(null));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
var De = {};
|
|
572
|
+
function Ie(e, r, t, a, s, l) {
|
|
573
|
+
{
|
|
574
|
+
var o = oe(e);
|
|
575
|
+
if (!o) {
|
|
576
|
+
var i = "";
|
|
577
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
578
|
+
var E = tr();
|
|
579
|
+
E ? i += E : i += je();
|
|
580
|
+
var d;
|
|
581
|
+
e === null ? d = "null" : de(e) ? d = "array" : e !== void 0 && e.$$typeof === j ? (d = "<" + (x(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, i);
|
|
582
|
+
}
|
|
583
|
+
var p = rr(e, r, t, s, l);
|
|
584
|
+
if (p == null)
|
|
585
|
+
return p;
|
|
586
|
+
if (o) {
|
|
587
|
+
var _ = r.children;
|
|
588
|
+
if (_ !== void 0)
|
|
589
|
+
if (a)
|
|
590
|
+
if (de(_)) {
|
|
591
|
+
for (var Y = 0; Y < _.length; Y++)
|
|
592
|
+
Fe(_[Y], e);
|
|
593
|
+
Object.freeze && Object.freeze(_);
|
|
594
|
+
} else
|
|
595
|
+
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
596
|
+
else
|
|
597
|
+
Fe(_, e);
|
|
598
|
+
}
|
|
599
|
+
if (N.call(r, "key")) {
|
|
600
|
+
var I = x(e), m = Object.keys(r).filter(function(fr) {
|
|
601
|
+
return fr !== "key";
|
|
602
|
+
}), ge = m.length > 0 ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
+
if (!De[I + ge]) {
|
|
604
|
+
var cr = m.length > 0 ? "{" + m.join(": ..., ") + ": ...}" : "{}";
|
|
605
|
+
v(`A props object containing a "key" prop is being spread into JSX:
|
|
606
|
+
let props = %s;
|
|
607
|
+
<%s {...props} />
|
|
608
|
+
React keys must be passed directly to JSX without using spread:
|
|
609
|
+
let props = %s;
|
|
610
|
+
<%s key={someKey} {...props} />`, ge, I, cr, I), De[I + ge] = !0;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return e === w ? ir(p) : ar(p), p;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
function or(e, r, t) {
|
|
617
|
+
return Ie(e, r, t, !0);
|
|
618
|
+
}
|
|
619
|
+
function sr(e, r, t) {
|
|
620
|
+
return Ie(e, r, t, !1);
|
|
621
|
+
}
|
|
622
|
+
var lr = sr, ur = or;
|
|
623
|
+
z.Fragment = w, z.jsx = lr, z.jsxs = ur;
|
|
624
|
+
}()), z;
|
|
625
|
+
}
|
|
626
|
+
process.env.NODE_ENV === "production" ? ye.exports = vr() : ye.exports = pr();
|
|
627
|
+
var f = ye.exports;
|
|
628
|
+
function gr({
|
|
629
|
+
endpoint: A,
|
|
630
|
+
selectItems: j,
|
|
631
|
+
getLabel: $,
|
|
632
|
+
getKey: w,
|
|
633
|
+
requestInit: F,
|
|
634
|
+
limit: D = 10,
|
|
635
|
+
onPublish: C,
|
|
636
|
+
actions: T,
|
|
637
|
+
title: h = "Publish List Widget"
|
|
638
|
+
}) {
|
|
639
|
+
const [g, y] = L([]), [b, R] = L(/* @__PURE__ */ new Set()), [P, V] = L(!1), [U, J] = L(null), [S, v] = L(null), [q, k] = L(null), ae = M(() => $ ?? ((n, u) => String((n == null ? void 0 : n.title) ?? (n == null ? void 0 : n.name) ?? (n == null ? void 0 : n.label) ?? (n == null ? void 0 : n.id) ?? `Item ${u + 1}`)), [$]), ie = M(() => w ?? ((n, u) => (n == null ? void 0 : n.id) ?? u), [w]), K = M(() => j ?? ((n) => {
|
|
640
|
+
if (Array.isArray(n)) return n;
|
|
641
|
+
const u = [n == null ? void 0 : n.data, n == null ? void 0 : n.items, n == null ? void 0 : n.results];
|
|
642
|
+
for (const c of u) if (Array.isArray(c)) return c;
|
|
643
|
+
return [];
|
|
644
|
+
}), [j]), G = M(() => Array.from(b).map((n) => g[n]).filter(Boolean), [b, g]);
|
|
645
|
+
dr(() => {
|
|
646
|
+
let n = !1;
|
|
647
|
+
async function u() {
|
|
648
|
+
V(!0), v(null), k(null), R(/* @__PURE__ */ new Set());
|
|
649
|
+
try {
|
|
650
|
+
const c = await fetch(A, F);
|
|
651
|
+
if (!c.ok) throw new Error(`Fetch failed: ${c.status} ${c.statusText}`);
|
|
652
|
+
const Z = await c.json(), Q = K(Z).slice(0, Math.max(0, D));
|
|
653
|
+
n || y(Q);
|
|
654
|
+
} catch (c) {
|
|
655
|
+
n || v((c == null ? void 0 : c.message) ?? "Failed to load data");
|
|
656
|
+
} finally {
|
|
657
|
+
n || V(!1);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
return u(), () => {
|
|
661
|
+
n = !0;
|
|
662
|
+
};
|
|
663
|
+
}, [A, F, K, D]);
|
|
664
|
+
function X(n) {
|
|
665
|
+
k(null), R((u) => {
|
|
666
|
+
const c = new Set(u);
|
|
667
|
+
return c.has(n) ? c.delete(n) : c.add(n), c;
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
function oe() {
|
|
671
|
+
k(null), R(new Set(g.map((n, u) => u)));
|
|
672
|
+
}
|
|
673
|
+
function se() {
|
|
674
|
+
k(null), R(/* @__PURE__ */ new Set());
|
|
675
|
+
}
|
|
676
|
+
async function H(n, u) {
|
|
677
|
+
J(n), v(null), k(null);
|
|
678
|
+
try {
|
|
679
|
+
await u(), k(`${n} completed ✅`);
|
|
680
|
+
} catch (c) {
|
|
681
|
+
v((c == null ? void 0 : c.message) ?? `${n} failed`);
|
|
682
|
+
} finally {
|
|
683
|
+
J(null);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const x = M(
|
|
687
|
+
() => ({
|
|
688
|
+
key: "Publish",
|
|
689
|
+
label: U === "Publish" ? "Publishing..." : "Publish",
|
|
690
|
+
variant: "primary",
|
|
691
|
+
disabled: ({ selectedItems: n }) => n.length === 0,
|
|
692
|
+
onClick: async ({ selectedItems: n }) => {
|
|
693
|
+
if (C) {
|
|
694
|
+
await C(n);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
await new Promise((u) => setTimeout(u, 700));
|
|
698
|
+
}
|
|
699
|
+
}),
|
|
700
|
+
[C, U]
|
|
701
|
+
), O = M(() => [x, ...T ?? []], [T, x]);
|
|
702
|
+
return /* @__PURE__ */ f.jsxs("div", { style: { fontFamily: "system-ui, Arial", maxWidth: 760 }, children: [
|
|
703
|
+
/* @__PURE__ */ f.jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 12, alignItems: "center" }, children: [
|
|
704
|
+
/* @__PURE__ */ f.jsxs("div", { children: [
|
|
705
|
+
/* @__PURE__ */ f.jsx("h3", { style: { margin: 0 }, children: h }),
|
|
706
|
+
/* @__PURE__ */ f.jsxs("div", { style: { fontSize: 12, color: "#666", marginTop: 4 }, children: [
|
|
707
|
+
"Endpoint: ",
|
|
708
|
+
/* @__PURE__ */ f.jsx("code", { children: A })
|
|
709
|
+
] })
|
|
710
|
+
] }),
|
|
711
|
+
/* @__PURE__ */ f.jsxs("div", { style: { display: "flex", gap: 8, flexWrap: "wrap", justifyContent: "flex-end" }, children: [
|
|
712
|
+
/* @__PURE__ */ f.jsx(
|
|
713
|
+
"button",
|
|
714
|
+
{
|
|
715
|
+
onClick: oe,
|
|
716
|
+
disabled: P || g.length === 0,
|
|
717
|
+
style: { padding: "8px 10px", borderRadius: 8, border: "1px solid #ccc" },
|
|
718
|
+
children: "Select all"
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
/* @__PURE__ */ f.jsx(
|
|
722
|
+
"button",
|
|
723
|
+
{
|
|
724
|
+
onClick: se,
|
|
725
|
+
disabled: b.size === 0,
|
|
726
|
+
style: { padding: "8px 10px", borderRadius: 8, border: "1px solid #ccc" },
|
|
727
|
+
children: "Clear"
|
|
728
|
+
}
|
|
729
|
+
),
|
|
730
|
+
O.map((n) => {
|
|
731
|
+
const u = P || g.length === 0 || U !== null || (n.disabled ? n.disabled({ selectedItems: G, items: g }) : !1), c = n.variant === "primary";
|
|
732
|
+
return /* @__PURE__ */ f.jsx(
|
|
733
|
+
"button",
|
|
734
|
+
{
|
|
735
|
+
onClick: () => H(n.key, () => n.onClick({ selectedItems: G, items: g })),
|
|
736
|
+
disabled: u,
|
|
737
|
+
style: {
|
|
738
|
+
padding: "8px 12px",
|
|
739
|
+
borderRadius: 8,
|
|
740
|
+
border: "1px solid #ccc",
|
|
741
|
+
fontWeight: c ? 700 : 500,
|
|
742
|
+
cursor: u ? "not-allowed" : "pointer"
|
|
743
|
+
},
|
|
744
|
+
children: n.label
|
|
745
|
+
},
|
|
746
|
+
n.key
|
|
747
|
+
);
|
|
748
|
+
})
|
|
749
|
+
] })
|
|
750
|
+
] }),
|
|
751
|
+
/* @__PURE__ */ f.jsxs("div", { style: { marginTop: 10, fontSize: 14, color: "#333" }, children: [
|
|
752
|
+
"Selected: ",
|
|
753
|
+
/* @__PURE__ */ f.jsx("b", { children: b.size }),
|
|
754
|
+
" / ",
|
|
755
|
+
g.length
|
|
756
|
+
] }),
|
|
757
|
+
/* @__PURE__ */ f.jsxs("div", { style: { marginTop: 10 }, children: [
|
|
758
|
+
P && /* @__PURE__ */ f.jsx("div", { children: "Loading…" }),
|
|
759
|
+
S && /* @__PURE__ */ f.jsxs("div", { style: { color: "crimson" }, children: [
|
|
760
|
+
"Error: ",
|
|
761
|
+
S
|
|
762
|
+
] }),
|
|
763
|
+
q && /* @__PURE__ */ f.jsx("div", { style: { color: "green" }, children: q })
|
|
764
|
+
] }),
|
|
765
|
+
/* @__PURE__ */ f.jsxs("div", { style: { marginTop: 12, border: "1px solid #eee", borderRadius: 12, padding: 12 }, children: [
|
|
766
|
+
g.length === 0 && !P && !S && /* @__PURE__ */ f.jsx("div", { children: "No items found." }),
|
|
767
|
+
/* @__PURE__ */ f.jsx("ul", { style: { margin: 0, paddingLeft: 18 }, children: g.map((n, u) => /* @__PURE__ */ f.jsx("li", { style: { marginBottom: 10 }, children: /* @__PURE__ */ f.jsxs("label", { style: { display: "flex", gap: 10, alignItems: "center" }, children: [
|
|
768
|
+
/* @__PURE__ */ f.jsx("input", { type: "checkbox", checked: b.has(u), onChange: () => X(u) }),
|
|
769
|
+
/* @__PURE__ */ f.jsx("span", { children: ae(n, u) })
|
|
770
|
+
] }) }, String(ie(n, u)))) })
|
|
771
|
+
] })
|
|
772
|
+
] });
|
|
773
|
+
}
|
|
774
|
+
export {
|
|
775
|
+
gr as PublishListWidget
|
|
776
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type ActionSpec<TItem> = {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
variant?: "primary" | "secondary";
|
|
5
|
+
disabled?: (ctx: {
|
|
6
|
+
selectedItems: TItem[];
|
|
7
|
+
items: TItem[];
|
|
8
|
+
}) => boolean;
|
|
9
|
+
onClick: (ctx: {
|
|
10
|
+
selectedItems: TItem[];
|
|
11
|
+
items: TItem[];
|
|
12
|
+
}) => Promise<void> | void;
|
|
13
|
+
};
|
|
14
|
+
export type PublishListWidgetProps<TItem = any> = {
|
|
15
|
+
/** Endpoint returning JSON. Can be array OR object containing an array. */
|
|
16
|
+
endpoint: string;
|
|
17
|
+
/** Optional: pick the array out of the response if response is not an array. */
|
|
18
|
+
selectItems?: (json: any) => TItem[];
|
|
19
|
+
/** How to render item label */
|
|
20
|
+
getLabel?: (item: TItem, index: number) => string;
|
|
21
|
+
/** Stable key for list rendering (defaults to item.id or index) */
|
|
22
|
+
getKey?: (item: TItem, index: number) => string | number;
|
|
23
|
+
/** Optional: customize fetch request */
|
|
24
|
+
requestInit?: RequestInit;
|
|
25
|
+
/** Show first N items only (default 10) */
|
|
26
|
+
limit?: number;
|
|
27
|
+
/** Default “Publish” action callback (shortcut) */
|
|
28
|
+
onPublish?: (selectedItems: TItem[]) => Promise<void> | void;
|
|
29
|
+
/** Additional actions (e.g., Archive, Export) */
|
|
30
|
+
actions?: ActionSpec<TItem>[];
|
|
31
|
+
/** UI text */
|
|
32
|
+
title?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function PublishListWidget<TItem = any>({ endpoint, selectItems, getLabel, getKey, requestInit, limit, onPublish, actions, title }: PublishListWidgetProps<TItem>): import("react/jsx-runtime").JSX.Element;
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "publish-list-widget",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": ">=18",
|
|
21
|
+
"react-dom": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"react": ">=18",
|
|
25
|
+
"react-dom": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/react": "^19.2.10",
|
|
29
|
+
"@types/react-dom": "^19.2.3",
|
|
30
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
31
|
+
"typescript": "^5.4.0",
|
|
32
|
+
"vite": "^5.4.0",
|
|
33
|
+
"vite-plugin-dts": "^3.9.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "vite",
|
|
37
|
+
"build": "vite build",
|
|
38
|
+
"prepublishOnly": "npm run build"
|
|
39
|
+
}
|
|
40
|
+
}
|