@cgi-learning-hub/ui 0.0.1-dev.1708941839 → 0.0.1-dev.1708959157
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/{Button-X7eWZQfX.js → Button-C5ROgtyW.js} +12 -12
- package/dist/{Button-Tkz5NkF_.cjs → Button-wMPAZpnO.cjs} +1 -1
- package/dist/ButtonBase-C5_-KI-D.js +831 -0
- package/dist/ButtonBase-XPViWbp_.cjs +75 -0
- package/dist/DefaultButton-BD9W4fvr.cjs +28 -0
- package/dist/DefaultButton-BlGFPRC7.js +439 -0
- package/dist/{Input-CbYjsRHK.js → Input-CGU1Xw4s.js} +10 -10
- package/dist/Input-DHic6dYE.cjs +1 -0
- package/dist/{InputBase-B13Nzzhk.js → InputBase-D8YZOKOt.js} +138 -157
- package/dist/InputBase-WBNJQn8V.cjs +4 -0
- package/dist/Tab-C2Tmr8Sv.cjs +1 -0
- package/dist/Tab-Dgd9jYEq.js +237 -0
- package/dist/TransitionGroupContext-C7wWJ6l7.js +14 -0
- package/dist/TransitionGroupContext-g4tmk10h.cjs +1 -0
- package/dist/Typography-CO64FVmw.cjs +1 -0
- package/dist/Typography-Di0hlj32.js +177 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/AnotherComponent/AnotherComponent.cjs.js +1 -1
- package/dist/components/AnotherComponent/AnotherComponent.es.js +3 -3
- package/dist/components/BasicButtons/BasicButtons.cjs.js +1 -1
- package/dist/components/BasicButtons/BasicButtons.es.js +10 -10
- package/dist/components/BasicButtons/BasicButtons.stories.cjs.js +1 -1
- package/dist/components/Dropzone/Dropzone.cjs.js +5 -0
- package/dist/components/Dropzone/Dropzone.d.ts +9 -0
- package/dist/components/Dropzone/Dropzone.es.js +1209 -0
- package/dist/components/Dropzone/index.cjs.js +1 -0
- package/dist/components/Dropzone/index.d.ts +2 -0
- package/dist/components/Dropzone/index.es.js +4 -0
- package/dist/components/buttons/DefaultButton/DefaultButton.cjs.js +1 -28
- package/dist/components/buttons/DefaultButton/DefaultButton.es.js +7 -436
- package/dist/components/buttons/DefaultButton/DefaultButtonIcon.cjs.js +1 -1
- package/dist/components/buttons/DefaultButton/DefaultButtonIcon.es.js +8 -8
- package/dist/components/buttons/DefaultButton/index.cjs.js +1 -1
- package/dist/components/buttons/DefaultButton/index.es.js +2 -2
- package/dist/components/buttons/IconButton/IconButton.cjs.js +2 -0
- package/dist/components/buttons/IconButton/IconButton.d.ts +5 -0
- package/dist/components/buttons/IconButton/IconButton.es.js +187 -0
- package/dist/components/buttons/IconButton/index.cjs.js +1 -0
- package/dist/components/buttons/IconButton/index.d.ts +2 -0
- package/dist/components/buttons/IconButton/index.es.js +4 -0
- package/dist/components/buttons/PrimaryButton/PrimaryButton.cjs.js +1 -1
- package/dist/components/buttons/PrimaryButton/PrimaryButton.es.js +4 -4
- package/dist/components/buttons/PrimaryButton/PrimaryButton.stories.cjs.js +1 -1
- package/dist/components/buttons/PrimaryButton/PrimaryButton.stories.es.js +1 -1
- package/dist/components/buttons/SecondaryButton/SecondaryButton.cjs.js +1 -1
- package/dist/components/buttons/SecondaryButton/SecondaryButton.es.js +2 -2
- package/dist/components/buttons/SecondaryButton/SecondaryButton.stories.cjs.js +1 -1
- package/dist/components/buttons/SecondaryButton/SecondaryButton.stories.es.js +1 -1
- package/dist/components/buttons/index.cjs.js +1 -1
- package/dist/components/buttons/index.d.ts +1 -0
- package/dist/components/buttons/index.es.js +8 -6
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.es.js +22 -12
- package/dist/components/inputs/SearchInput/SearchInput.cjs.js +1 -1
- package/dist/components/inputs/SearchInput/SearchInput.es.js +77 -247
- package/dist/components/inputs/TextInput/TextInput.cjs.js +11 -13
- package/dist/components/inputs/TextInput/TextInput.es.js +367 -404
- package/dist/components/lists/FileList/FileList.cjs.js +1 -0
- package/dist/components/lists/FileList/FileList.d.ts +7 -0
- package/dist/components/lists/FileList/FileList.es.js +19 -0
- package/dist/components/lists/FileList/FileListItem.cjs.js +1 -0
- package/dist/components/lists/FileList/FileListItem.d.ts +13 -0
- package/dist/components/lists/FileList/FileListItem.es.js +40 -0
- package/dist/components/lists/FileList/index.cjs.js +1 -0
- package/dist/components/lists/FileList/index.d.ts +4 -0
- package/dist/components/lists/FileList/index.es.js +6 -0
- package/dist/components/lists/index.cjs.js +1 -0
- package/dist/components/lists/index.d.ts +1 -0
- package/dist/components/lists/index.es.js +6 -0
- package/dist/createSvgIcon-B7HVs3ZC.cjs +2 -0
- package/dist/{createSvgIcon-jvI3LIfI.cjs → createSvgIcon-BivvPRyr.cjs} +1 -1
- package/dist/createSvgIcon-D3HDfwCm.js +143 -0
- package/dist/{createSvgIcon-qXNZi4k1.js → createSvgIcon-D4Mxh_r9.js} +14 -14
- package/dist/{extendSxProp-CvhhU9Vb.cjs → extendSxProp-D5gpnasP.cjs} +1 -1
- package/dist/{extendSxProp-BRHiEwyk.js → extendSxProp-DCdWqtQk.js} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +20 -10
- package/dist/ownerWindow-BoRkeomM.js +23 -0
- package/dist/ownerWindow-Dk_4aaak.cjs +1 -0
- package/dist/refType-dllUCpD8.cjs +1 -0
- package/dist/refType-hKctx4k0.js +29 -0
- package/dist/useControlled-BsLcOmhe.js +48 -0
- package/dist/useControlled-jN3fqFfv.cjs +3 -0
- package/dist/useForkRef-CGd3Nhyb.cjs +1 -0
- package/dist/useForkRef-DwN_Iz9R.js +17 -0
- package/dist/useIsFocusVisible-BF0lT08B.cjs +1 -0
- package/dist/useIsFocusVisible-D8ksiuhS.js +69 -0
- package/dist/useTheme-BZek68TX.js +9 -0
- package/dist/useTheme-C-LTLVMt.cjs +1 -0
- package/dist/{useThemeProps-CDriK9TK.cjs → useThemeProps-C6ClLEqN.cjs} +14 -14
- package/dist/{useThemeProps-B6yTTpAe.js → useThemeProps-CHytz5pp.js} +741 -714
- package/dist/useTimeout-KN97abZR.js +47 -0
- package/dist/useTimeout-qjxkiZZn.cjs +1 -0
- package/package.json +2 -1
- package/dist/ButtonBase-CKfcGhaU.js +0 -892
- package/dist/ButtonBase-Cg8cBMzO.cjs +0 -75
- package/dist/Input-CAb0EFzc.cjs +0 -1
- package/dist/InputBase-CKlCw9fj.cjs +0 -4
- package/dist/useForkRef-82uiK71d.cjs +0 -1
- package/dist/useForkRef-CLcOhrzI.js +0 -44
- package/dist/useTheme-BWRyHzdn.js +0 -65
- package/dist/useTheme-BpLcDNG1.cjs +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const A=require("react/jsx-runtime"),q=require("../../createSvgIcon-B7HVs3ZC.cjs"),f=require("react"),p=require("../../useThemeProps-C6ClLEqN.cjs"),me=require("../../Typography-CO64FVmw.cjs");var Ae={},br=q.interopRequireDefaultExports;Object.defineProperty(Ae,"__esModule",{value:!0});var Ze=Ae.default=void 0,hr=br(q.requireCreateSvgIcon()),Dr=A;Ze=Ae.default=(0,hr.default)((0,Dr.jsx)("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload");var xe={},wr=q.interopRequireDefaultExports;Object.defineProperty(xe,"__esModule",{value:!0});var er=xe.default=void 0,Ar=wr(q.requireCreateSvgIcon()),xr=A;er=xe.default=(0,Ar.default)((0,xr.jsx)("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"}),"UploadFile");function C(e,r,t,n){function i(o){return o instanceof t?o:new t(function(c){c(o)})}return new(t||(t=Promise))(function(o,c){function l(m){try{s(n.next(m))}catch(b){c(b)}}function g(m){try{s(n.throw(m))}catch(b){c(b)}}function s(m){m.done?o(m.value):i(m.value).then(l,g)}s((n=n.apply(e,r||[])).next())})}function I(e,r){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(s){return function(m){return g([s,m])}}function g(s){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(t=0)),t;)try{if(n=1,i&&(o=s[0]&2?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[s[0]&2,o.value]),s[0]){case 0:case 1:o=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,i=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){t.label=s[1];break}if(s[0]===6&&t.label<o[1]){t.label=o[1],o=s;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(s);break}o[2]&&t.ops.pop(),t.trys.pop();continue}s=r.call(e,t)}catch(m){s=[6,m],i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function He(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var n=t.call(e),i,o=[],c;try{for(;(r===void 0||r-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return o}function qe(e,r,t){if(t||arguments.length===2)for(var n=0,i=r.length,o;n<i;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return e.concat(o||Array.prototype.slice.call(r))}var Er=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function B(e,r){var t=Or(e);if(typeof t.path!="string"){var n=e.webkitRelativePath;Object.defineProperty(t,"path",{value:typeof r=="string"?r:typeof n=="string"&&n.length>0?n:e.name,writable:!1,configurable:!1,enumerable:!0})}return t}function Or(e){var r=e.name,t=r&&r.lastIndexOf(".")!==-1;if(t&&!e.type){var n=r.split(".").pop().toLowerCase(),i=Er.get(n);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var Fr=[".DS_Store","Thumbs.db"];function Pr(e){return C(this,void 0,void 0,function(){return I(this,function(r){return X(e)&&_r(e.dataTransfer)?[2,Cr(e.dataTransfer,e.type)]:jr(e)?[2,Tr(e)]:Array.isArray(e)&&e.every(function(t){return"getFile"in t&&typeof t.getFile=="function"})?[2,Sr(e)]:[2,[]]})})}function _r(e){return X(e)}function jr(e){return X(e)&&X(e.target)}function X(e){return typeof e=="object"&&e!==null}function Tr(e){return ve(e.target.files).map(function(r){return B(r)})}function Sr(e){return C(this,void 0,void 0,function(){var r;return I(this,function(t){switch(t.label){case 0:return[4,Promise.all(e.map(function(n){return n.getFile()}))];case 1:return r=t.sent(),[2,r.map(function(n){return B(n)})]}})})}function Cr(e,r){return C(this,void 0,void 0,function(){var t,n;return I(this,function(i){switch(i.label){case 0:return e.items?(t=ve(e.items).filter(function(o){return o.kind==="file"}),r!=="drop"?[2,t]:[4,Promise.all(t.map(Ir))]):[3,2];case 1:return n=i.sent(),[2,Be(rr(n))];case 2:return[2,Be(ve(e.files).map(function(o){return B(o)}))]}})})}function Be(e){return e.filter(function(r){return Fr.indexOf(r.name)===-1})}function ve(e){if(e===null)return[];for(var r=[],t=0;t<e.length;t++){var n=e[t];r.push(n)}return r}function Ir(e){if(typeof e.webkitGetAsEntry!="function")return We(e);var r=e.webkitGetAsEntry();return r&&r.isDirectory?tr(r):We(e)}function rr(e){return e.reduce(function(r,t){return qe(qe([],He(r),!1),He(Array.isArray(t)?rr(t):[t]),!1)},[])}function We(e){var r=e.getAsFile();if(!r)return Promise.reject("".concat(e," is not a File"));var t=B(r);return Promise.resolve(t)}function Rr(e){return C(this,void 0,void 0,function(){return I(this,function(r){return[2,e.isDirectory?tr(e):kr(e)]})})}function tr(e){var r=e.createReader();return new Promise(function(t,n){var i=[];function o(){var c=this;r.readEntries(function(l){return C(c,void 0,void 0,function(){var g,s,m;return I(this,function(b){switch(b.label){case 0:if(l.length)return[3,5];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,Promise.all(i)];case 2:return g=b.sent(),t(g),[3,4];case 3:return s=b.sent(),n(s),[3,4];case 4:return[3,6];case 5:m=Promise.all(l.map(Rr)),i.push(m),o(),b.label=6;case 6:return[2]}})})},function(l){n(l)})}o()})}function kr(e){return C(this,void 0,void 0,function(){return I(this,function(r){return[2,new Promise(function(t,n){e.file(function(i){var o=B(i,e.fullPath);t(o)},function(i){n(i)})})]})})}var zr=function(e,r){if(e&&r){var t=Array.isArray(r)?r:r.split(","),n=e.name||"",i=(e.type||"").toLowerCase(),o=i.replace(/\/.*$/,"");return t.some(function(c){var l=c.trim().toLowerCase();return l.charAt(0)==="."?n.toLowerCase().endsWith(l):l.endsWith("/*")?o===l.replace(/\/.*$/,""):i===l})}return!0};function Ue(e){return $r(e)||Lr(e)||or(e)||Mr()}function Mr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $r(e){if(Array.isArray(e))return be(e)}function Ne(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function Ge(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Ne(Object(t),!0).forEach(function(n){nr(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ne(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function nr(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function H(e,r){return qr(e)||Hr(e,r)||or(e,r)||Kr()}function Kr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function or(e,r){if(e){if(typeof e=="string")return be(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return be(e,r)}}function be(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Hr(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],i=!0,o=!1,c,l;try{for(t=t.call(e);!(i=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));i=!0);}catch(g){o=!0,l=g}finally{try{!i&&t.return!=null&&t.return()}finally{if(o)throw l}}return n}}function qr(e){if(Array.isArray(e))return e}var Br="file-invalid-type",Wr="file-too-large",Ur="file-too-small",Nr="too-many-files",Gr=function(r){r=Array.isArray(r)&&r.length===1?r[0]:r;var t=Array.isArray(r)?"one of ".concat(r.join(", ")):r;return{code:Br,message:"File type must be ".concat(t)}},Ye=function(r){return{code:Wr,message:"File is larger than ".concat(r," ").concat(r===1?"byte":"bytes")}},Ve=function(r){return{code:Ur,message:"File is smaller than ".concat(r," ").concat(r===1?"byte":"bytes")}},Yr={code:Nr,message:"Too many files"};function ir(e,r){var t=e.type==="application/x-moz-file"||zr(e,r);return[t,t?null:Gr(r)]}function ar(e,r,t){if(P(e.size))if(P(r)&&P(t)){if(e.size>t)return[!1,Ye(t)];if(e.size<r)return[!1,Ve(r)]}else{if(P(r)&&e.size<r)return[!1,Ve(r)];if(P(t)&&e.size>t)return[!1,Ye(t)]}return[!0,null]}function P(e){return e!=null}function Vr(e){var r=e.files,t=e.accept,n=e.minSize,i=e.maxSize,o=e.multiple,c=e.maxFiles,l=e.validator;return!o&&r.length>1||o&&c>=1&&r.length>c?!1:r.every(function(g){var s=ir(g,t),m=H(s,1),b=m[0],R=ar(g,n,i),k=H(R,1),z=k[0],M=l?l(g):null;return b&&z&&!M})}function Z(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Q(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(r){return r==="Files"||r==="application/x-moz-file"}):!!e.target&&!!e.target.files}function Je(e){e.preventDefault()}function Jr(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Qr(e){return e.indexOf("Edge/")!==-1}function Xr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Jr(e)||Qr(e)}function E(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return function(n){for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];return r.some(function(l){return!Z(n)&&l&&l.apply(void 0,[n].concat(o)),Z(n)})}}function Zr(){return"showOpenFilePicker"in window}function et(e){if(P(e)){var r=Object.entries(e).filter(function(t){var n=H(t,2),i=n[0],o=n[1],c=!0;return ur(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),c=!1),(!Array.isArray(o)||!o.every(cr))&&(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),c=!1),c}).reduce(function(t,n){var i=H(n,2),o=i[0],c=i[1];return Ge(Ge({},t),{},nr({},o,c))},{});return[{description:"Files",accept:r}]}return e}function rt(e){if(P(e))return Object.entries(e).reduce(function(r,t){var n=H(t,2),i=n[0],o=n[1];return[].concat(Ue(r),[i],Ue(o))},[]).filter(function(r){return ur(r)||cr(r)}).join(",")}function tt(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function nt(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function ur(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function cr(e){return/^.*\.[\w]+$/.test(e)}var ot=["children"],it=["open"],at=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],ut=["refKey","onChange","onClick"];function ct(e){return ft(e)||lt(e)||sr(e)||st()}function st(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ft(e){if(Array.isArray(e))return he(e)}function ye(e,r){return gt(e)||dt(e,r)||sr(e,r)||pt()}function pt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
5
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sr(e,r){if(e){if(typeof e=="string")return he(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return he(e,r)}}function he(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function dt(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],i=!0,o=!1,c,l;try{for(t=t.call(e);!(i=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));i=!0);}catch(g){o=!0,l=g}finally{try{!i&&t.return!=null&&t.return()}finally{if(o)throw l}}return n}}function gt(e){if(Array.isArray(e))return e}function Qe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Qe(Object(t),!0).forEach(function(n){De(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Qe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function De(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ee(e,r){if(e==null)return{};var t=mt(e,r),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function mt(e,r){if(e==null)return{};var t={},n=Object.keys(e),i,o;for(o=0;o<n.length;o++)i=n[o],!(r.indexOf(i)>=0)&&(t[i]=e[i]);return t}var Ee=f.forwardRef(function(e,r){var t=e.children,n=ee(e,ot),i=fr(n),o=i.open,c=ee(i,it);return f.useImperativeHandle(r,function(){return{open:o}},[o]),f.createElement(f.Fragment,null,t(d(d({},c),{},{open:o})))});Ee.displayName="Dropzone";var lr={disabled:!1,getFilesFromEvent:Pr,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Ee.defaultProps=lr;Ee.propTypes={children:p.PropTypes.func,accept:p.PropTypes.objectOf(p.PropTypes.arrayOf(p.PropTypes.string)),multiple:p.PropTypes.bool,preventDropOnDocument:p.PropTypes.bool,noClick:p.PropTypes.bool,noKeyboard:p.PropTypes.bool,noDrag:p.PropTypes.bool,noDragEventsBubbling:p.PropTypes.bool,minSize:p.PropTypes.number,maxSize:p.PropTypes.number,maxFiles:p.PropTypes.number,disabled:p.PropTypes.bool,getFilesFromEvent:p.PropTypes.func,onFileDialogCancel:p.PropTypes.func,onFileDialogOpen:p.PropTypes.func,useFsAccessApi:p.PropTypes.bool,autoFocus:p.PropTypes.bool,onDragEnter:p.PropTypes.func,onDragLeave:p.PropTypes.func,onDragOver:p.PropTypes.func,onDrop:p.PropTypes.func,onDropAccepted:p.PropTypes.func,onDropRejected:p.PropTypes.func,onError:p.PropTypes.func,validator:p.PropTypes.func};var we={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function fr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=d(d({},lr),e),t=r.accept,n=r.disabled,i=r.getFilesFromEvent,o=r.maxSize,c=r.minSize,l=r.multiple,g=r.maxFiles,s=r.onDragEnter,m=r.onDragLeave,b=r.onDragOver,R=r.onDrop,k=r.onDropAccepted,z=r.onDropRejected,M=r.onFileDialogCancel,re=r.onFileDialogOpen,Oe=r.useFsAccessApi,Fe=r.autoFocus,te=r.preventDropOnDocument,Pe=r.noClick,ne=r.noKeyboard,_e=r.noDrag,O=r.noDragEventsBubbling,oe=r.onError,L=r.validator,$=f.useMemo(function(){return rt(t)},[t]),je=f.useMemo(function(){return et(t)},[t]),ie=f.useMemo(function(){return typeof re=="function"?re:Xe},[re]),W=f.useMemo(function(){return typeof M=="function"?M:Xe},[M]),h=f.useRef(null),x=f.useRef(null),pr=f.useReducer(yt,we),Te=ye(pr,2),ae=Te[0],D=Te[1],dr=ae.isFocused,Se=ae.isFileDialogActive,U=f.useRef(typeof window<"u"&&window.isSecureContext&&Oe&&Zr()),Ce=function(){!U.current&&Se&&setTimeout(function(){if(x.current){var u=x.current.files;u.length||(D({type:"closeDialog"}),W())}},300)};f.useEffect(function(){return window.addEventListener("focus",Ce,!1),function(){window.removeEventListener("focus",Ce,!1)}},[x,Se,W,U]);var _=f.useRef([]),Ie=function(u){h.current&&h.current.contains(u.target)||(u.preventDefault(),_.current=[])};f.useEffect(function(){return te&&(document.addEventListener("dragover",Je,!1),document.addEventListener("drop",Ie,!1)),function(){te&&(document.removeEventListener("dragover",Je),document.removeEventListener("drop",Ie))}},[h,te]),f.useEffect(function(){return!n&&Fe&&h.current&&h.current.focus(),function(){}},[h,Fe,n]);var F=f.useCallback(function(a){oe?oe(a):console.error(a)},[oe]),Re=f.useCallback(function(a){a.preventDefault(),a.persist(),V(a),_.current=[].concat(ct(_.current),[a.target]),Q(a)&&Promise.resolve(i(a)).then(function(u){if(!(Z(a)&&!O)){var y=u.length,v=y>0&&Vr({files:u,accept:$,minSize:c,maxSize:o,multiple:l,maxFiles:g,validator:L}),w=y>0&&!v;D({isDragAccept:v,isDragReject:w,isDragActive:!0,type:"setDraggedFiles"}),s&&s(a)}}).catch(function(u){return F(u)})},[i,s,F,O,$,c,o,l,g,L]),ke=f.useCallback(function(a){a.preventDefault(),a.persist(),V(a);var u=Q(a);if(u&&a.dataTransfer)try{a.dataTransfer.dropEffect="copy"}catch{}return u&&b&&b(a),!1},[b,O]),ze=f.useCallback(function(a){a.preventDefault(),a.persist(),V(a);var u=_.current.filter(function(v){return h.current&&h.current.contains(v)}),y=u.indexOf(a.target);y!==-1&&u.splice(y,1),_.current=u,!(u.length>0)&&(D({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Q(a)&&m&&m(a))},[h,m,O]),N=f.useCallback(function(a,u){var y=[],v=[];a.forEach(function(w){var K=ir(w,$),S=ye(K,2),ce=S[0],se=S[1],le=ar(w,c,o),J=ye(le,2),fe=J[0],pe=J[1],de=L?L(w):null;if(ce&&fe&&!de)y.push(w);else{var ge=[se,pe];de&&(ge=ge.concat(de)),v.push({file:w,errors:ge.filter(function(vr){return vr})})}}),(!l&&y.length>1||l&&g>=1&&y.length>g)&&(y.forEach(function(w){v.push({file:w,errors:[Yr]})}),y.splice(0)),D({acceptedFiles:y,fileRejections:v,type:"setFiles"}),R&&R(y,v,u),v.length>0&&z&&z(v,u),y.length>0&&k&&k(y,u)},[D,l,$,c,o,g,R,k,z,L]),G=f.useCallback(function(a){a.preventDefault(),a.persist(),V(a),_.current=[],Q(a)&&Promise.resolve(i(a)).then(function(u){Z(a)&&!O||N(u,a)}).catch(function(u){return F(u)}),D({type:"reset"})},[i,N,F,O]),j=f.useCallback(function(){if(U.current){D({type:"openDialog"}),ie();var a={multiple:l,types:je};window.showOpenFilePicker(a).then(function(u){return i(u)}).then(function(u){N(u,null),D({type:"closeDialog"})}).catch(function(u){tt(u)?(W(u),D({type:"closeDialog"})):nt(u)?(U.current=!1,x.current?(x.current.value=null,x.current.click()):F(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):F(u)});return}x.current&&(D({type:"openDialog"}),ie(),x.current.value=null,x.current.click())},[D,ie,W,Oe,N,F,je,l]),Me=f.useCallback(function(a){!h.current||!h.current.isEqualNode(a.target)||(a.key===" "||a.key==="Enter"||a.keyCode===32||a.keyCode===13)&&(a.preventDefault(),j())},[h,j]),Le=f.useCallback(function(){D({type:"focus"})},[]),$e=f.useCallback(function(){D({type:"blur"})},[]),Ke=f.useCallback(function(){Pe||(Xr()?setTimeout(j,0):j())},[Pe,j]),T=function(u){return n?null:u},ue=function(u){return ne?null:T(u)},Y=function(u){return _e?null:T(u)},V=function(u){O&&u.stopPropagation()},gr=f.useMemo(function(){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.refKey,y=u===void 0?"ref":u,v=a.role,w=a.onKeyDown,K=a.onFocus,S=a.onBlur,ce=a.onClick,se=a.onDragEnter,le=a.onDragOver,J=a.onDragLeave,fe=a.onDrop,pe=ee(a,at);return d(d(De({onKeyDown:ue(E(w,Me)),onFocus:ue(E(K,Le)),onBlur:ue(E(S,$e)),onClick:T(E(ce,Ke)),onDragEnter:Y(E(se,Re)),onDragOver:Y(E(le,ke)),onDragLeave:Y(E(J,ze)),onDrop:Y(E(fe,G)),role:typeof v=="string"&&v!==""?v:"presentation"},y,h),!n&&!ne?{tabIndex:0}:{}),pe)}},[h,Me,Le,$e,Ke,Re,ke,ze,G,ne,_e,n]),mr=f.useCallback(function(a){a.stopPropagation()},[]),yr=f.useMemo(function(){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.refKey,y=u===void 0?"ref":u,v=a.onChange,w=a.onClick,K=ee(a,ut),S=De({accept:$,multiple:l,type:"file",style:{display:"none"},onChange:T(E(v,G)),onClick:T(E(w,mr)),tabIndex:-1},y,x);return d(d({},S),K)}},[x,t,l,G,n]);return d(d({},ae),{},{isFocused:dr&&!n,getRootProps:gr,getInputProps:yr,rootRef:h,inputRef:x,open:T(j)})}function yt(e,r){switch(r.type){case"focus":return d(d({},e),{},{isFocused:!0});case"blur":return d(d({},e),{},{isFocused:!1});case"openDialog":return d(d({},we),{},{isFileDialogActive:!0});case"closeDialog":return d(d({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return d(d({},e),{},{isDragActive:r.isDragActive,isDragAccept:r.isDragAccept,isDragReject:r.isDragReject});case"setFiles":return d(d({},e),{},{acceptedFiles:r.acceptedFiles,fileRejections:r.fileRejections});case"reset":return d({},we);default:return e}}function Xe(){}const vt=p.styled(q.Box)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.5rem",padding:"0.5rem",width:"20rem",height:"10rem",border:"1px dashed",borderColor:e.palette.grey[500],borderRadius:4,cursor:"pointer"})),bt=e=>{const{getRootProps:r,getInputProps:t,isDragActive:n}=fr({onDrop:e.onDrop}),{information:i}=e;return A.jsxs(vt,{...r(),children:[A.jsx("input",{...t()}),n?A.jsxs(A.Fragment,{children:[A.jsx(Ze,{color:"primary"}),A.jsx(me.Typography,{children:"Déposer les fichiers ici"})]}):A.jsxs(A.Fragment,{children:[A.jsx(er,{color:"primary"}),A.jsx(me.Typography,{children:"Glisser et déposer des fichiers ici, ou cliquer pour sélectionner des fichiers"}),i?A.jsx(me.Typography,{fontSize:"0.875rem",color:"grey",children:i}):null]})]})};module.exports=bt;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type DropzoneProps as ReactDropzoneProps, type FileWithPath } from "react-dropzone";
|
|
3
|
+
export interface File extends FileWithPath {
|
|
4
|
+
}
|
|
5
|
+
export interface DropzoneProps extends ReactDropzoneProps {
|
|
6
|
+
information?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Dropzone: React.FunctionComponent<DropzoneProps>;
|
|
9
|
+
export default Dropzone;
|