@daoyi/nmtl-ui 1.1.43-beta.61 → 1.1.43-beta.62
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useState as o,useEffect as
|
|
1
|
+
import e,{useState as o,useEffect as t}from"react";import r from"prop-types";import{c as n}from"./index-11391ca3.js";import{Typography as i,Box as a}from"@material-ui/core";import{i as l,a as d,r as s,M as c}from"./createSvgIcon-fd7bb768.js";import{u as m,c as _,s as k}from"./style-inject.es-c875d022.js";import"@material-ui/icons";import"./withStyles-12e04256.js";import"@material-ui/styles";import"react-dom";var y=m(_((function(o,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=l(e),n=(0,d(s).default)(r.createElement("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");t.default=n})));k(".keywordList {\n display: flex;\n flex-wrap: wrap;\n margin-top: 0.8rem; }\n .keywordList__item {\n font-size: 1.125rem !important;\n border-radius: 5px;\n margin-right: 0.5rem !important;\n margin-bottom: 0.5rem !important;\n cursor: pointer; }\n .keywordList__item__hover {\n border-radius: 5px;\n line-height: normal;\n padding: 0.125rem 0.625rem;\n background: transparent;\n transition: 0.3s background ease-in-out; }\n .keywordList__item__hover:hover {\n background: rgba(0, 0, 0, 0.1); }\n .keywordList__icon svg {\n font-size: 1rem;\n line-height: 1rem; }\n .keywordList__icon .keywordList__item__hover {\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0.125rem 0.875rem; }\n\n@media screen and (max-width: 484px) {\n .keywordList__item {\n font-size: 0.75rem !important; } }\n");const w=({className:o,keywords:t,backgroundColor:r,textColor:a,limit:l,onMoreClick:d,onKeywordClick:s})=>Array.isArray(t)&&e.createElement("div",{className:n("keywordList",o)},(l?t.slice(0,l):t).map(((o,t)=>e.createElement(i,{color:"textSecondary",className:"keywordList__item",key:t.toString(),onClick:()=>s(o)},e.createElement("div",{style:{color:a,background:r},className:"keywordList__item__hover"},o)))),l&&t.length>l&&e.createElement("div",{className:n("keywordList__item","keywordList__icon"),style:{backgroundColor:r},onClick:d},e.createElement("div",{className:"keywordList__item__hover"},e.createElement(y,null))));w.defaultProps={className:void 0,keywords:void 0,backgroundColor:void 0,textColor:void 0,limit:void 0,onMoreClick:()=>{},onKeywordClick:()=>{}},w.propTypes={className:r.string,backgroundColor:r.string,textColor:r.string,keywords:r.arrayOf(r.any),limit:r.number,onMoreClick:r.func,onKeywordClick:r.func};k(".keywordModal__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 5px; }\n .keywordModal__content__image {\n display: flex;\n justify-content: center;\n width: 100%; }\n .keywordModal__content__image__img {\n height: 7.75rem;\n object-fit: scale-down; }\n .keywordModal__content__detail {\n width: 100%;\n padding: 1rem 1.25rem;\n border-radius: 5px; }\n .keywordModal__content__detail__title {\n font-weight: bold;\n font-size: 1.5rem;\n text-decoration: underline;\n cursor: pointer; }\n .keywordModal__content__detail__desc {\n margin-top: 0.8rem;\n font-size: 1rem;\n display: -webkit-box;\n overflow: hidden;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical; }\n .keywordModal__content__detail__author {\n margin-top: 0.8rem;\n font-size: 1.25rem;\n cursor: pointer; }\n .keywordModal__content__detail__author:hover {\n text-decoration: underline; }\n\n.keywordModal p {\n font-family: 'Noto Sans TC', 'Arial', sans-serif !important; }\n\n.keywordModal .MuiPaper-root {\n min-width: initial !important; }\n");const u=o=>{const{visible:t,setVisible:r,cardData:n}=o,{titleColor:i,backgroundColor:l,textColor:d,onKeywordClick:s,onAuthorClick:m}=o,{author:_,imgUrl:k,title:y}=n||{},u=n&&n.keywords&&n.keywords.split("\n")||[];return e.createElement(c,{transparent:!0,size:"small",className:"keywordModal",visible:t,footer:null,onCancel:()=>r(!1)},e.createElement("div",{className:"keywordModal__content",style:{backgroundColor:l}},k&&e.createElement(a,{className:"keywordModal__content__image",sx:{bgcolor:"background.default"}},e.createElement("img",{className:"keywordModal__content__image__img",src:k,alt:""})),e.createElement("div",{className:"keywordModal__content__detail"},e.createElement("div",{title:y,className:"keywordModal__content__detail__title",style:{color:i||d}},y),_&&e.createElement("div",{className:"keywordModal__content__detail__author",title:_,onClick:m,style:{color:d}},_),e.createElement(w,{keywords:u,textColor:d,backgroundColor:l,onKeywordClick:s}))))};u.defaultProps={visible:void 0,setVisible:()=>{},titleColor:void 0,backgroundColor:void 0,textColor:void 0,cardData:void 0,onKeywordClick:()=>{},onAuthorClick:()=>{}},u.propTypes={visible:r.bool,setVisible:r.func,cardData:r.objectOf(r.any),titleColor:r.string,backgroundColor:r.string,textColor:r.string,onKeywordClick:r.func,onAuthorClick:r.func};k(".keywords p {\n font-family: 'Noto Sans TC', 'Arial', sans-serif !important; }\n");const C=r=>{const{className:i,keywords:a,cardData:l,limit:d}=r,{titleColor:s,backgroundColor:c,textColor:m}=r,{onKeywordClick:_,onMoreClick:k,onAuthorClick:y}=r,C=l&&l.keywords&&l.keywords.split("\n")||a||[];if(0===C.filter((e=>e&&e.length>0)).length)return null;const[p,g]=o(),f=(()=>{const[e,r]=o("PC"),n=()=>{window.innerWidth>768?r("PC"):window.innerWidth>576?r("tablet"):r("mobile")};return t((()=>(n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)})),[]),e})();return e.createElement("div",{className:n("keywords",i)},e.createElement(w,{limit:d||("mobile"===f?1:void 0),keywords:C,backgroundColor:c,textColor:m,onMoreClick:()=>l?g(!0):k(),onKeywordClick:_}),e.createElement(u,{visible:p,setVisible:g,cardData:l,titleColor:s,backgroundColor:c,textColor:m,onKeywordClick:_,onAuthorClick:y}))};C.defaultProps={className:void 0,keywords:void 0,cardData:void 0,limit:void 0,titleColor:void 0,backgroundColor:void 0,textColor:void 0,onKeywordClick:()=>{},onMoreClick:()=>{},onAuthorClick:()=>{}},C.propTypes={className:r.string,keywords:r.arrayOf(r.any),cardData:r.objectOf(r.any),limit:r.number,titleColor:r.string,backgroundColor:r.string,textColor:r.string,onKeywordClick:r.func,onMoreClick:r.func,onAuthorClick:r.func};export{C as default};
|
package/package.json
CHANGED