react-cosmos-ui 6.2.2-canary.09cec11.0 → 6.2.3

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.
@@ -353,7 +353,7 @@
353
353
  text-align: left;
354
354
  `,Ll=Le.div`
355
355
  padding: 0 4px;
356
- `;var Dl=o(892);function Bl(e,t,n){e.children||(e.children={}),e.children[t]=n}function Ul(e){const{children:t}=e;if(!t)return e;const n=Object.keys(t),r=n.filter((e=>t[e].children)),o=n.filter((e=>!t[e].children));return{...e,children:[...r.sort(),...o.sort()].reduce(((e,n)=>({...e,[n]:Ul(t[n])})),{})}}function Wl(e,t){const{data:n,children:r}=e;if("fileDir"!==n.type||!r)return e;const o=r[t];if(o&&"fileDir"===o.data.type){const e=rl(r,t),n=o.children;if(n&&Object.keys(e).every((e=>!n[e])))return{data:{type:"fileDir"},children:{...Vl(e,t),...n}}}return{...e,children:Vl(r,t)}}function Vl(e,t){return Object.keys(e).reduce(((n,r)=>({...n,[r]:Wl(e[r],t)})),{})}function Hl(e){const{data:t,children:n}=e;if("fileDir"!==t.type||!n)return e;const r=1===Object.keys(n).length&&n.index;return r&&"fileDir"!==r.data.type?n.index:{...e,children:Object.keys(n).reduce(((e,t)=>({...e,[t]:Hl(n[t])})),{})}}function ql(e){const{data:t,children:n}=e;return"fileDir"===t.type&&n?{...e,children:Object.keys(n).reduce(((e,t)=>{const r=n[t],o=()=>({...e,[t]:ql(r)}),a=r.children;if("fileDir"!==r.data.type||!a)return o();const i=Object.keys(a);if(1!==i.length)return o();const[l]=i,u=a[l],c="fixture"===l;return"fileDir"!==u.data.type&&(function(e,t){return e.toUpperCase()===t.toUpperCase()}(t,l)||c)?{...e,[c?t:l]:u}:o()}),{})}:e}function Zl(e){const{children:t}=e;if(!t)return e;const n=Object.keys(t);if(1===Object.keys(t).length){const e=t[n[0]];if("fileDir"===e.data.type)return Zl(e)}return e}const Gl=function(e,t,n){return null==e?e:Jt(e,t,n)};function Ql(e,t,n,r){if(0===t.length)return Bl(e,n,r);let o,a=1;do{const n=t.slice(0,a).map((e=>`children["${e}"]`)).join(".");o=ao(e,n),o||(o={data:{type:"fileDir"}},Gl(e,n,o)),a+=1}while(a<=t.length);Bl(o,n,r)}function Kl(e,t){const{children:n}=e;return n?{...e,children:Object.keys(n).reduce(((e,r)=>{const o=n[r];if("fileDir"===o.data.type)return{...e,[r]:Kl(o,t)};const a=function(e,t){return e.replace(new RegExp(`\\.${t}$`),"")}(r,t);return{...e,[a]:Kl(o,t)}}),{})}:e}function Yl({fixtures:e,fixturesDir:t,fixtureFileSuffix:n}){let r=function(e){const t={data:{type:"fileDir"}};return Object.keys(e).forEach((n=>function(e,t,n){const{parents:r,fileName:o}=function(e){const t=e.split("/"),n=t.pop();if(!n)throw new Error("Fixture name is empty");return{parents:t,fileName:(r=n,r.replace(/\.(js|jsx|ts|tsx|md|mdx)$/,""))};var r}(t);"single"==n.type?Ql(e,r,o,{data:{type:"fixture",path:t}}):"multi"==n.type&&Ql(e,r,o,{data:{type:"multiFixture",path:t,names:n.fixtureNames}})}(t,n,e[n]))),t}(e);return r=Wl(r,t),r=Kl(r,n),r=Hl(r),r=ql(r),r=Zl(r),Ul(r)}function Xl(e,t=[]){const{data:n,children:r}=e;if("fixture"===n.type||!r)return[];const o=[];return r&&Object.keys(r).forEach((e=>{const n=r[e],{data:a}=n;"fileDir"===a.type&&o.push(...Xl(n,[...t,e])),"multiFixture"===a.type&&a.names.forEach((n=>o.push({fileName:e,fixtureId:{path:a.path,name:n},parents:t,name:n}))),"fixture"===a.type&&o.push({fileName:e,fixtureId:{path:a.path},parents:t,name:null})})),o}function Jl({active:t,cleanFixturePath:n,fixtureItem:r,onSelect:o}){const{fixtureId:a,fileName:i,name:l,parents:u}=r,c=function(t,n){const r=e.useRef(null);return e.useLayoutEffect((()=>{const e=r.current;var t;n&&e&&"function"==typeof(t=e).scrollIntoView&&t.scrollIntoView({block:"center"})}),[t,n]),r}(n,t),s=e.useCallback((()=>o(a,!0)),[a,o]);return e.createElement(eu,{ref:c,selected:t,onClick:s},e.createElement(tu,null,e.createElement(nu,{selected:t},l?`${i} ${l}`:i),u.length>0&&e.createElement(ru,null,u.join("/"))))}const eu=Le.div`
356
+ `;var Dl=o(892);function Bl(e,t,n){e.children||(e.children={}),e.children[t]=n}function Ul(e){const{children:t}=e;if(!t)return e;const n=Object.keys(t),r=n.filter((e=>t[e].children)),o=n.filter((e=>!t[e].children));return{...e,children:[...r.sort(),...o.sort()].reduce(((e,n)=>({...e,[n]:Ul(t[n])})),{})}}function Wl(e,t){const{data:n,children:r}=e;if("fileDir"!==n.type||!r)return e;const o=r[t];if(o&&"fileDir"===o.data.type){const e=rl(r,t),n=o.children;if(n&&Object.keys(e).every((e=>!n[e])))return{data:{type:"fileDir"},children:{...Vl(e,t),...n}}}return{...e,children:Vl(r,t)}}function Vl(e,t){return Object.keys(e).reduce(((n,r)=>({...n,[r]:Wl(e[r],t)})),{})}function Hl(e){const{data:t,children:n}=e;if("fileDir"!==t.type||!n)return e;const r=1===Object.keys(n).length&&n.index;return r&&"fileDir"!==r.data.type?n.index:{...e,children:Object.keys(n).reduce(((e,t)=>({...e,[t]:Hl(n[t])})),{})}}function ql(e){const{data:t,children:n}=e;return"fileDir"===t.type&&n?{...e,children:Object.keys(n).reduce(((e,t)=>{const r=n[t],o=()=>({...e,[t]:ql(r)}),a=r.children;if("fileDir"!==r.data.type||!a)return o();const i=Object.keys(a);if(1!==i.length)return o();const[l]=i,u=a[l],c="fixture"===l;return"fileDir"!==u.data.type&&(s=l,t.toUpperCase()===s.toUpperCase()||c)?{...e,[c?t:l]:u}:o();var s}),{})}:e}function Zl(e){const{children:t}=e;if(!t)return e;const n=Object.keys(t);if(1===Object.keys(t).length){const e=t[n[0]];if("fileDir"===e.data.type)return Zl(e)}return e}const Gl=function(e,t,n){return null==e?e:Jt(e,t,n)};function Ql(e,t,n,r){if(0===t.length)return Bl(e,n,r);let o,a=1;do{const n=t.slice(0,a).map((e=>`children["${e}"]`)).join(".");o=ao(e,n),o||(o={data:{type:"fileDir"}},Gl(e,n,o)),a+=1}while(a<=t.length);Bl(o,n,r)}function Kl(e,t){const{children:n}=e;return n?{...e,children:Object.keys(n).reduce(((e,r)=>{const o=n[r];if("fileDir"===o.data.type)return{...e,[r]:Kl(o,t)};const a=function(e,t){return e.replace(new RegExp(`\\.${t}$`),"")}(r,t);return{...e,[a]:Kl(o,t)}}),{})}:e}function Yl({fixtures:e,fixturesDir:t,fixtureFileSuffix:n}){let r=function(e){const t={data:{type:"fileDir"}};return Object.keys(e).forEach((n=>function(e,t,n){const{parents:r,fileName:o}=function(e){const t=e.split("/"),n=t.pop();if(!n)throw new Error("Fixture name is empty");return{parents:t,fileName:(r=n,r.replace(/\.(js|jsx|ts|tsx|md|mdx)$/,""))};var r}(t);"single"==n.type?Ql(e,r,o,{data:{type:"fixture",path:t}}):"multi"==n.type&&Ql(e,r,o,{data:{type:"multiFixture",path:t,names:n.fixtureNames}})}(t,n,e[n]))),t}(e);return r=Wl(r,t),r=Kl(r,n),r=Hl(r),r=ql(r),r=Zl(r),Ul(r)}function Xl(e,t=[]){const{data:n,children:r}=e;if("fixture"===n.type||!r)return[];const o=[];return r&&Object.keys(r).forEach((e=>{const n=r[e],{data:a}=n;"fileDir"===a.type&&o.push(...Xl(n,[...t,e])),"multiFixture"===a.type&&a.names.forEach((n=>o.push({fileName:e,fixtureId:{path:a.path,name:n},parents:t,name:n}))),"fixture"===a.type&&o.push({fileName:e,fixtureId:{path:a.path},parents:t,name:null})})),o}function Jl({active:t,cleanFixturePath:n,fixtureItem:r,onSelect:o}){const{fixtureId:a,fileName:i,name:l,parents:u}=r,c=function(t,n){const r=e.useRef(null);return e.useLayoutEffect((()=>{const e=r.current;var t;n&&e&&"function"==typeof(t=e).scrollIntoView&&t.scrollIntoView({block:"center"})}),[t,n]),r}(n,t),s=e.useCallback((()=>o(a,!0)),[a,o]);return e.createElement(eu,{ref:c,selected:t,"data-testid":t?"activeFixtureSearchResult":void 0,onClick:s},e.createElement(tu,null,e.createElement(nu,{selected:t},l?`${i} ${l}`:i),u.length>0&&e.createElement(ru,null,u.join("/"))))}const eu=Le.div`
357
357
  padding: 0 24px 0 48px;
358
358
  background: ${na("transparent",Go)};
359
359
  color: ${na(oa(64,.64),oa(255,.64))};