@daoyi/nmtl-ui 2.0.1-beta.45 → 2.0.1-beta.47

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.
Files changed (72) hide show
  1. package/lib/components/Autocomplete-5439ff22.js +333 -1
  2. package/lib/components/Autocomplete.js +12 -1
  3. package/lib/components/Avatar.js +51 -1
  4. package/lib/components/BackTop.js +82 -1
  5. package/lib/components/BarChart.js +132 -1
  6. package/lib/components/Breadcrumbs.js +124 -1
  7. package/lib/components/Button-63c7e9f3.js +91 -1
  8. package/lib/components/Button.js +8 -1
  9. package/lib/components/Carousel.js +61 -1
  10. package/lib/components/Checkbox.js +37 -1
  11. package/lib/components/CollapseContent.js +181 -1
  12. package/lib/components/ContactModal-a59bc808.js +924 -0
  13. package/lib/components/ContactModal.js +17 -1
  14. package/lib/components/Drawer-af3ed21a.js +157 -1
  15. package/lib/components/Drawer.js +13 -1
  16. package/lib/components/Dropdown.js +135 -1
  17. package/lib/components/Empty-70f040a9.js +44 -1
  18. package/lib/components/Empty.js +7 -1
  19. package/lib/components/ExportButton.js +114 -1
  20. package/lib/components/ExtraTools-f10a66a8.js +818 -1
  21. package/lib/components/ExtraTools.js +11 -1
  22. package/lib/components/Filter.js +90 -1
  23. package/lib/components/Footer.js +266 -1
  24. package/lib/components/ForwardLink.js +106 -1
  25. package/lib/components/Header.js +186 -1
  26. package/lib/components/Image.js +58 -1
  27. package/lib/components/Input.js +79 -1
  28. package/lib/components/InputMethod.js +23106 -1
  29. package/lib/components/KeywordSearch-224f84c1.js +138 -1
  30. package/lib/components/KeywordSearch.js +14 -1
  31. package/lib/components/KeywordTicker.js +182 -1
  32. package/lib/components/Keywords.js +292 -1
  33. package/lib/components/Loading.js +30 -1
  34. package/lib/components/MUITheme.js +255 -1
  35. package/lib/components/Modal-a7591b98.js +107 -1
  36. package/lib/components/Modal.js +11 -1
  37. package/lib/components/MoreButton-f15ca38e.js +109 -1
  38. package/lib/components/MoreButton.js +8 -1
  39. package/lib/components/Radio.js +81 -1
  40. package/lib/components/SNA.js +324 -1
  41. package/lib/components/Select-98a8e973.js +114 -1
  42. package/lib/components/Select.js +10 -1
  43. package/lib/components/Spin-690a3597.js +74 -1
  44. package/lib/components/Spin.js +8 -1
  45. package/lib/components/Table.js +51 -1
  46. package/lib/components/Tooltip-b7eb966d.js +69 -1
  47. package/lib/components/Tooltip.js +9 -1
  48. package/lib/components/_rollupPluginBabelHelpers-fde6d1c6.js +491 -1
  49. package/lib/components/dataExport-f418e6fe.js +56 -1
  50. package/lib/components/globalConfig.js +186 -1
  51. package/lib/components/vendor-851c6356.js +41893 -16
  52. package/lib/index.d.ts +1 -3
  53. package/lib/index.js +1 -3
  54. package/lib/utils/_rollupPluginBabelHelpers-a6e0e6e3.js +139 -1
  55. package/lib/utils/arrayMerge.js +100 -1
  56. package/lib/utils/chunkArray.js +15 -1
  57. package/lib/utils/convert2HtmlEntities.js +42 -1
  58. package/lib/utils/domToImage.js +32 -1
  59. package/lib/utils/downloadGephi.js +106 -1
  60. package/lib/utils/exportXlsx.js +184 -1
  61. package/lib/utils/historyAppendSearch.js +23 -1
  62. package/lib/utils/isDevelopMode.js +5 -1
  63. package/lib/utils/parseYMD.js +36 -1
  64. package/lib/utils/removeDuplicateItem.js +11 -1
  65. package/lib/utils/sendEmail.js +39 -1
  66. package/lib/utils/snaDefine-6a2bcd94.js +5 -1
  67. package/lib/utils/snaDefine.js +1 -1
  68. package/lib/utils/snaPreProcess.js +84 -1
  69. package/lib/utils/vendor-3ec75cc9.js +1289 -1
  70. package/package.json +1 -1
  71. package/lib/components/ContactModal-d7e2f8bb.js +0 -1
  72. package/lib/components/globalConfig-40069b54.js +0 -1
@@ -1 +1,106 @@
1
- import{c as e}from"./_rollupPluginBabelHelpers-fde6d1c6.js";import t,{useMemo as r}from"react";import{s as a,E as i,c as n}from"./vendor-851c6356.js";import o from"prop-types";import{useHistory as s,Link as l}from"react-router-dom";import{Tooltip as c}from"@material-ui/core";import"react-is";import"@material-ui/styles";import"react-dom";a(".forwardLink {\n width: -moz-fit-content;\n width: fit-content; }\n .forwardLink__link {\n color: unset;\n text-decoration: none;\n cursor: pointer; }\n .forwardLink__link--disabled {\n cursor: not-allowed; }\n");var d=["className","title","target","disabled","children","tip","onClick"],m=function(a){var o=a.className,m=a.title,p=a.target,f=a.disabled,h=a.children,u=a.tip;a.onClick;var v=e(a,d),k=s(),g=r((function(){var e;if(f)return{};var t=null===(e=v.pathname)||void 0===e?void 0:e.indexOf("?");return t>-1?{pathname:v.pathname.substring(0,t),search:v.pathname.substring(t)}:{pathname:v.pathname||"/",search:"string"==typeof v.search?v.search:i.stringify(v.search)}}),[k,f,v.pathname,v.search]),_=g.pathname,b=void 0===_?"":_,w=g.search,N=void 0===w?"":w,y=t.createElement("div",{className:n("forwardLink",o)},f?t.createElement("div",{title:u?void 0:m,className:"forwardLink__link--disabled"},h):t.createElement(l,{className:"forwardLink__link",target:p,title:u?void 0:m,to:{pathname:"".concat("/zh-tw").concat(b),search:N}},h));return u?t.createElement(c,{title:u,placement:"top"},y):y};m.defaultProps={className:void 0,title:void 0,target:"_blank",disabled:void 0,children:void 0,search:void 0,tip:void 0,onClick:function(){return!0}},m.propTypes={className:o.string,title:o.string,target:o.oneOf(["_self","_blank","_parent","_top"]),disabled:o.bool,children:o.node,pathname:o.string.isRequired,search:o.oneOfType([o.object,o.string]),tip:o.string,onClick:o.func};export{m as default};
1
+ import { c as _objectWithoutProperties } from './_rollupPluginBabelHelpers-fde6d1c6.js';
2
+ import React__default, { useMemo } from 'react';
3
+ import { s as styleInject, E as queryString, c as classNames } from './vendor-851c6356.js';
4
+ import PropTypes from 'prop-types';
5
+ import { useHistory, Link } from 'react-router-dom';
6
+ import { Tooltip } from '@material-ui/core';
7
+ import 'react-is';
8
+ import '@material-ui/styles';
9
+ import 'react-dom';
10
+
11
+ var css_248z = ".forwardLink {\n width: -moz-fit-content;\n width: fit-content; }\n .forwardLink__link {\n color: unset;\n text-decoration: none;\n cursor: pointer; }\n .forwardLink__link--disabled {\n cursor: not-allowed; }\n";
12
+ styleInject(css_248z);
13
+
14
+ var _excluded = ["className", "title", "target", "disabled", "children", "tip", "onClick"];
15
+ var locale = '/zh-tw'; // 20230318 暫時寫死,若套件納入語系控制,可將其置換
16
+
17
+ var ForwardLink = function ForwardLink(_ref) {
18
+ var className = _ref.className,
19
+ title = _ref.title,
20
+ target = _ref.target,
21
+ disabled = _ref.disabled,
22
+ children = _ref.children,
23
+ tip = _ref.tip;
24
+ _ref.onClick;
25
+ var rest = _objectWithoutProperties(_ref, _excluded);
26
+ var history = useHistory();
27
+ var _useMemo = useMemo(function () {
28
+ var _rest$pathname;
29
+ if (disabled) return {};
30
+ /*
31
+ * 若將 search 寫在 pathname 中,意即 pathname=/asd?zxc=qwe
32
+ * 會導致換頁時 React route dom 無法匹配 => 空白畫面
33
+ * 若真有此情況發生 需把 search 提領出來
34
+ */
35
+ var foundIndex = (_rest$pathname = rest.pathname) === null || _rest$pathname === void 0 ? void 0 : _rest$pathname.indexOf('?');
36
+ if (foundIndex > -1) return {
37
+ pathname: rest.pathname.substring(0, foundIndex),
38
+ search: rest.pathname.substring(foundIndex)
39
+ };
40
+ return {
41
+ pathname: rest.pathname || '/',
42
+ search: typeof rest.search === 'string' ? rest.search : queryString.stringify(rest.search)
43
+ };
44
+ }, [history, disabled, rest.pathname, rest.search]),
45
+ _useMemo$pathname = _useMemo.pathname,
46
+ pathname = _useMemo$pathname === void 0 ? '' : _useMemo$pathname,
47
+ _useMemo$search = _useMemo.search,
48
+ search = _useMemo$search === void 0 ? '' : _useMemo$search;
49
+ var linkComponent = /*#__PURE__*/React__default.createElement("div", {
50
+ className: classNames('forwardLink', className)
51
+ }, disabled ? /*#__PURE__*/React__default.createElement("div", {
52
+ title: tip ? undefined : title,
53
+ className: "forwardLink__link--disabled"
54
+ }, children) : /*#__PURE__*/React__default.createElement(Link, {
55
+ className: "forwardLink__link",
56
+ target: target,
57
+ title: tip ? undefined : title,
58
+ to: {
59
+ pathname: "".concat(locale).concat(pathname),
60
+ search: search
61
+ }
62
+ }, children));
63
+ if (tip) {
64
+ return /*#__PURE__*/React__default.createElement(Tooltip, {
65
+ title: tip,
66
+ placement: "top"
67
+ }, linkComponent);
68
+ }
69
+ return linkComponent;
70
+ };
71
+ ForwardLink.defaultProps = {
72
+ className: undefined,
73
+ title: undefined,
74
+ target: '_blank',
75
+ disabled: undefined,
76
+ children: undefined,
77
+ search: undefined,
78
+ tip: undefined,
79
+ onClick: function onClick() {
80
+ return true;
81
+ }
82
+ };
83
+
84
+ /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
85
+ ForwardLink.propTypes = {
86
+ /** Css Name */
87
+ className: PropTypes.string,
88
+ /** DOM title */
89
+ title: PropTypes.string,
90
+ /** DOM title */
91
+ target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
92
+ /** 是否取消點擊 */
93
+ disabled: PropTypes.bool,
94
+ /** 子項目 */
95
+ children: PropTypes.node,
96
+ /** 欲前往的連結 */
97
+ pathname: PropTypes.string.isRequired,
98
+ /** 欲前往連結的參數 */
99
+ search: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
100
+ /** 彈跳提示文字 */
101
+ tip: PropTypes.string,
102
+ /** 元件被點即時的callback,返回false會停止元件導向 */
103
+ onClick: PropTypes.func
104
+ };
105
+
106
+ export { ForwardLink as default };
@@ -1 +1,186 @@
1
- import{a as e}from"./_rollupPluginBabelHelpers-fde6d1c6.js";import n,{useState as a,useRef as r,useEffect as t}from"react";import o from"prop-types";import{s as i,d as l,c as s}from"./vendor-851c6356.js";import{useHistory as c,useRouteMatch as d,NavLink as p}from"react-router-dom";import{Typography as m,IconButton as h}from"@material-ui/core";import{SearchOutlined as g}from"@material-ui/icons";import{K as u}from"./KeywordSearch-224f84c1.js";import{S as _}from"./Select-98a8e973.js";import{c as f,D as y,d as x}from"./Drawer-af3ed21a.js";import"react-is";import"@material-ui/styles";import"react-dom";import"axios";import"./Autocomplete-5439ff22.js";import"@material-ui/lab";import"./Empty-70f040a9.js";i("@charset \"UTF-8\";\n.header {\n display: flex;\n align-items: center;\n background: rgba(255, 255, 255, 0.6);\n background-color: rgba(255, 255, 255, 0.6);\n padding: 12px 36px !important;\n position: fixed;\n top: 0;\n z-index: 10;\n width: 100% !important;\n transition: top 0.3s ease-in-out;\n box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);\n -webkit-backdrop-filter: blur(4px);\n backdrop-filter: blur(4px); }\n .header__logo {\n display: flex;\n width: -moz-fit-content !important;\n width: fit-content !important;\n margin-right: 30px !important;\n cursor: pointer; }\n .header__logo__img {\n display: flex;\n align-items: center; }\n .header__logo__title {\n white-space: nowrap;\n margin-left: 1rem !important;\n font-size: 1.5rem !important;\n font-weight: 700 !important;\n font-family: 'Noto Sans TC' !important; }\n .header__links {\n display: flex;\n justify-content: flex-end;\n padding-right: 14px; }\n .header__links a {\n text-decoration: none; }\n .header__links--full {\n flex: 1; }\n .header__links__item {\n color: rgba(0, 0, 0, 0.85);\n font-size: 1.125rem !important;\n font-weight: 500 !important;\n white-space: nowrap;\n padding: 6px 14px;\n font-family: 'Noto Sans TC' !important; }\n .header__links__item--active .header__links__item {\n font-weight: 800 !important;\n background: transparent;\n border-radius: 45px; }\n .header__links__item:hover {\n font-weight: 800 !important; }\n .header__language {\n min-width: 100px !important; }\n .header__searchIcon {\n display: none !important; }\n @media screen and (max-width: 768px) {\n .header--smallUseSearchIcon .header__searchIcon {\n display: flex !important;\n margin-right: 10px !important; }\n .header--smallUseSearchIcon .keywordSearch {\n visibility: hidden;\n flex: 1;\n width: 0; } }\n .header--hide {\n top: -100px; }\n .header--focus .header__links {\n display: none; }\n .header .MuiTypography-root {\n width: 100%;\n display: flex;\n align-items: center; }\n .header .autocomplete {\n float: right; }\n .header .autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 1px 8px !important; }\n .header .keywordSearch {\n margin-right: 8px; }\n .header .keywordSearch--focus .autocomplete {\n width: 100% !important; }\n .header .keywordSearch--animation .autocomplete {\n width: 240px;\n transition: width 0.3s ease-in-out; }\n\n/* 避免寬度460以下炸版 */\n@media screen and (max-width: 460px) {\n .header .keywordSearch--animation .autocomplete {\n width: 100%; } }\n\n@media screen and (max-width: 768px) {\n .header {\n padding: 12px 15px !important; }\n .header__logo {\n margin-right: 16px !important; }\n .header__logo__title {\n display: none !important; }\n .header__links {\n display: none; }\n .header__links__item {\n font-size: 1rem !important; }\n .header__language {\n display: none !important; }\n .header--focus .header__logo {\n display: none !important; }\n .autocomplete__icon {\n display: none !important; } }\n");var k=function(o){var i=o.title,x=o.logo,k=o.locale,w=o.supportLanguages,v=o.pages;o.darkMode;var S=o.typographyColor,b=o.className,I=o.searchAPI,E=o.searchPlaceholder,C=o.smallUseSearchIcon,N=o.onSearch;o.setDarkMode;var L=o.onLanguageChange,M=o.onSearchIconClick,P=c(),A=P.location.search,j=d().url,O=a(!1),U=e(O,2),z=U[0],D=U[1],T=a(!1),H=e(T,2),K=H[0],R=H[1],q=r(l((function(){return D(window.scrollY>100)}),10)).current;return t((function(){return window.addEventListener("scroll",q),function(){window.removeEventListener("scroll",q)}}),[]),t((function(){R(!1)}),[A]),n.createElement("div",{className:s("MuiPaper-root","header",{"header--smallUseSearchIcon":C},{"header--hide":z},{"header--focus":K},b)},n.createElement("div",{className:"header__logo",onClick:function(){return P.push("/".concat(k))}},x&&n.createElement("div",{className:"header__logo__img"},x),!K&&i&&n.createElement(m,{color:S,className:"header__logo__title"},i)),I&&n.createElement(u,{animation:!0,searchAPI:I,placeholder:E,menuOpen:K,setMenuOpen:R,onSearch:N}),n.createElement("div",{className:s("header__links",{"header__links--full":!I})},(Array.isArray(v)?v:[]).filter((function(e){return e.showInHeader})).map((function(e,a){var r=e.path,t=void 0===r?"":r,o=e.name,i=n.createElement(m,{className:"header__links__item",color:S},o);return t.indexOf("http")>-1?n.createElement("a",{key:a.toString(),href:t,className:"header__links__item--active"},i):n.createElement(p,{key:a.toString(),to:"".concat(j).concat(t),activeClassName:"header__links__item--active"},i)}))),n.createElement(h,{className:"header__searchIcon",onClick:M},n.createElement(g,{fontSize:"large"})),false,Array.isArray(w)&&w.length>0&&n.createElement(_,{className:"header__language",defaultValue:f({language:k,supportLanguages:w}),onChange:function(e){return L(e)},options:w}),n.createElement(y,{title:i,logo:x,drawerList:v,supportLanguages:w}))};k.defaultProps={className:void 0,title:void 0,logo:void 0,locale:void 0,supportLanguages:x,darkMode:!1,typographyColor:"primary",searchAPI:void 0,searchPlaceholder:void 0,smallUseSearchIcon:void 0,onSearch:function(){},setDarkMode:function(){},onLanguageChange:function(){},onSearchIconClick:function(){}},k.propTypes={className:o.string,title:o.string,logo:o.node,locale:o.string,supportLanguages:o.arrayOf(o.any),pages:o.arrayOf(o.any).isRequired,darkMode:o.bool,typographyColor:o.oneOf(["initial","inherit","primary","secondary","textPrimary","textSecondary","error"]),searchAPI:o.string,searchPlaceholder:o.string,smallUseSearchIcon:o.bool,onSearch:o.func,setDarkMode:o.func,onLanguageChange:o.func,onSearchIconClick:o.func};export{k as default};
1
+ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-fde6d1c6.js';
2
+ import React__default, { useState, useRef, useEffect } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { s as styleInject, d as debounce_1, c as classNames } from './vendor-851c6356.js';
5
+ import { useHistory, useRouteMatch, NavLink } from 'react-router-dom';
6
+ import { Typography, IconButton } from '@material-ui/core';
7
+ import { SearchOutlined } from '@material-ui/icons';
8
+ import { K as KeywordSearch } from './KeywordSearch-224f84c1.js';
9
+ import { S as Select } from './Select-98a8e973.js';
10
+ import { c as checkLanguageSupport, D as Drawer, d as defaultSupportLanguage } from './Drawer-af3ed21a.js';
11
+ import 'react-is';
12
+ import '@material-ui/styles';
13
+ import 'react-dom';
14
+ import 'axios';
15
+ import './Autocomplete-5439ff22.js';
16
+ import '@material-ui/lab';
17
+ import './Empty-70f040a9.js';
18
+
19
+ var css_248z = "@charset \"UTF-8\";\n.header {\n display: flex;\n align-items: center;\n background: rgba(255, 255, 255, 0.6);\n background-color: rgba(255, 255, 255, 0.6);\n padding: 12px 36px !important;\n position: fixed;\n top: 0;\n z-index: 10;\n width: 100% !important;\n transition: top 0.3s ease-in-out;\n box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);\n -webkit-backdrop-filter: blur(4px);\n backdrop-filter: blur(4px); }\n .header__logo {\n display: flex;\n width: -moz-fit-content !important;\n width: fit-content !important;\n margin-right: 30px !important;\n cursor: pointer; }\n .header__logo__img {\n display: flex;\n align-items: center; }\n .header__logo__title {\n white-space: nowrap;\n margin-left: 1rem !important;\n font-size: 1.5rem !important;\n font-weight: 700 !important;\n font-family: 'Noto Sans TC' !important; }\n .header__links {\n display: flex;\n justify-content: flex-end;\n padding-right: 14px; }\n .header__links a {\n text-decoration: none; }\n .header__links--full {\n flex: 1; }\n .header__links__item {\n color: rgba(0, 0, 0, 0.85);\n font-size: 1.125rem !important;\n font-weight: 500 !important;\n white-space: nowrap;\n padding: 6px 14px;\n font-family: 'Noto Sans TC' !important; }\n .header__links__item--active .header__links__item {\n font-weight: 800 !important;\n background: transparent;\n border-radius: 45px; }\n .header__links__item:hover {\n font-weight: 800 !important; }\n .header__language {\n min-width: 100px !important; }\n .header__searchIcon {\n display: none !important; }\n @media screen and (max-width: 768px) {\n .header--smallUseSearchIcon .header__searchIcon {\n display: flex !important;\n margin-right: 10px !important; }\n .header--smallUseSearchIcon .keywordSearch {\n visibility: hidden;\n flex: 1;\n width: 0; } }\n .header--hide {\n top: -100px; }\n .header--focus .header__links {\n display: none; }\n .header .MuiTypography-root {\n width: 100%;\n display: flex;\n align-items: center; }\n .header .autocomplete {\n float: right; }\n .header .autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 1px 8px !important; }\n .header .keywordSearch {\n margin-right: 8px; }\n .header .keywordSearch--focus .autocomplete {\n width: 100% !important; }\n .header .keywordSearch--animation .autocomplete {\n width: 240px;\n transition: width 0.3s ease-in-out; }\n\n/* 避免寬度460以下炸版 */\n@media screen and (max-width: 460px) {\n .header .keywordSearch--animation .autocomplete {\n width: 100%; } }\n\n@media screen and (max-width: 768px) {\n .header {\n padding: 12px 15px !important; }\n .header__logo {\n margin-right: 16px !important; }\n .header__logo__title {\n display: none !important; }\n .header__links {\n display: none; }\n .header__links__item {\n font-size: 1rem !important; }\n .header__language {\n display: none !important; }\n .header--focus .header__logo {\n display: none !important; }\n .autocomplete__icon {\n display: none !important; } }\n";
20
+ styleInject(css_248z);
21
+
22
+ var showDarkModeSwitch = false;
23
+ var Header = function Header(props) {
24
+ var title = props.title,
25
+ logo = props.logo,
26
+ locale = props.locale,
27
+ supportLanguages = props.supportLanguages,
28
+ pages = props.pages;
29
+ props.darkMode;
30
+ var typographyColor = props.typographyColor,
31
+ className = props.className;
32
+ var searchAPI = props.searchAPI,
33
+ searchPlaceholder = props.searchPlaceholder,
34
+ smallUseSearchIcon = props.smallUseSearchIcon;
35
+ var onSearch = props.onSearch;
36
+ props.setDarkMode;
37
+ var onLanguageChange = props.onLanguageChange,
38
+ onSearchIconClick = props.onSearchIconClick;
39
+ var history = useHistory();
40
+ var search = history.location.search;
41
+ var _useRouteMatch = useRouteMatch(),
42
+ url = _useRouteMatch.url;
43
+ // const { keyword } = queryString.parse(search);
44
+ var _useState = useState(false),
45
+ _useState2 = _slicedToArray(_useState, 2),
46
+ hideHeader = _useState2[0],
47
+ setHideHeader = _useState2[1];
48
+ var _useState3 = useState(false),
49
+ _useState4 = _slicedToArray(_useState3, 2),
50
+ menuOpen = _useState4[0],
51
+ setMenuOpen = _useState4[1];
52
+ var handleScroll = useRef(debounce_1(function () {
53
+ return setHideHeader(window.scrollY > 100);
54
+ }, 10)).current;
55
+ useEffect(function () {
56
+ window.addEventListener('scroll', handleScroll);
57
+ return function () {
58
+ window.removeEventListener('scroll', handleScroll);
59
+ };
60
+ }, []);
61
+ useEffect(function () {
62
+ setMenuOpen(false);
63
+ }, [search]);
64
+ return /*#__PURE__*/React__default.createElement("div", {
65
+ className: classNames('MuiPaper-root', 'header', {
66
+ 'header--smallUseSearchIcon': smallUseSearchIcon
67
+ }, {
68
+ 'header--hide': hideHeader
69
+ }, {
70
+ 'header--focus': menuOpen
71
+ }, className)
72
+ }, /*#__PURE__*/React__default.createElement("div", {
73
+ className: "header__logo",
74
+ onClick: function onClick() {
75
+ return history.push("/".concat(locale));
76
+ }
77
+ }, logo && /*#__PURE__*/React__default.createElement("div", {
78
+ className: "header__logo__img"
79
+ }, logo), !menuOpen && title && /*#__PURE__*/React__default.createElement(Typography, {
80
+ color: typographyColor,
81
+ className: "header__logo__title"
82
+ }, title)), searchAPI && /*#__PURE__*/React__default.createElement(KeywordSearch, {
83
+ animation: true
84
+ // keyword={keyword}
85
+ ,
86
+ searchAPI: searchAPI,
87
+ placeholder: searchPlaceholder,
88
+ menuOpen: menuOpen,
89
+ setMenuOpen: setMenuOpen,
90
+ onSearch: onSearch
91
+ }), /*#__PURE__*/React__default.createElement("div", {
92
+ className: classNames('header__links', {
93
+ 'header__links--full': !searchAPI
94
+ })
95
+ }, (Array.isArray(pages) ? pages : []).filter(function (_ref) {
96
+ var showInHeader = _ref.showInHeader;
97
+ return showInHeader;
98
+ }).map(function (_ref2, i) {
99
+ var _ref2$path = _ref2.path,
100
+ path = _ref2$path === void 0 ? '' : _ref2$path,
101
+ name = _ref2.name;
102
+ var label = /*#__PURE__*/React__default.createElement(Typography, {
103
+ className: "header__links__item",
104
+ color: typographyColor
105
+ }, name);
106
+ return path.indexOf('http') > -1 ? /*#__PURE__*/React__default.createElement("a", {
107
+ key: i.toString(),
108
+ href: path,
109
+ className: "header__links__item--active"
110
+ }, label) : /*#__PURE__*/React__default.createElement(NavLink, {
111
+ key: i.toString(),
112
+ to: "".concat(url).concat(path),
113
+ activeClassName: "header__links__item--active"
114
+ }, label);
115
+ })), /*#__PURE__*/React__default.createElement(IconButton, {
116
+ className: "header__searchIcon",
117
+ onClick: onSearchIconClick
118
+ }, /*#__PURE__*/React__default.createElement(SearchOutlined, {
119
+ fontSize: "large"
120
+ })), showDarkModeSwitch , Array.isArray(supportLanguages) && supportLanguages.length > 0 && /*#__PURE__*/React__default.createElement(Select, {
121
+ className: "header__language",
122
+ defaultValue: checkLanguageSupport({
123
+ language: locale,
124
+ supportLanguages: supportLanguages
125
+ }),
126
+ onChange: function onChange(value) {
127
+ return onLanguageChange(value);
128
+ },
129
+ options: supportLanguages
130
+ }), /*#__PURE__*/React__default.createElement(Drawer, {
131
+ title: title,
132
+ logo: logo,
133
+ drawerList: pages,
134
+ supportLanguages: supportLanguages
135
+ }));
136
+ };
137
+ Header.defaultProps = {
138
+ className: undefined,
139
+ title: undefined,
140
+ logo: undefined,
141
+ locale: undefined,
142
+ supportLanguages: defaultSupportLanguage,
143
+ darkMode: false,
144
+ typographyColor: 'primary',
145
+ searchAPI: undefined,
146
+ searchPlaceholder: undefined,
147
+ smallUseSearchIcon: undefined,
148
+ onSearch: function onSearch() {},
149
+ setDarkMode: function setDarkMode() {},
150
+ onLanguageChange: function onLanguageChange() {},
151
+ onSearchIconClick: function onSearchIconClick() {}
152
+ };
153
+ Header.propTypes = {
154
+ /** Css Name */
155
+ className: PropTypes.string,
156
+ /** 標題(通常為網站名稱) */
157
+ title: PropTypes.string,
158
+ /** 網站Logo */
159
+ logo: PropTypes.node,
160
+ /** 語系 */
161
+ locale: PropTypes.string,
162
+ /** 支援的語系 */
163
+ supportLanguages: PropTypes.arrayOf(PropTypes.any),
164
+ /** 頁面列表 */
165
+ pages: PropTypes.arrayOf(PropTypes.any).isRequired,
166
+ /** 是否為黑暗模式 */
167
+ darkMode: PropTypes.bool,
168
+ /** 文字色系() */
169
+ typographyColor: PropTypes.oneOf(['initial', 'inherit', 'primary', 'secondary', 'textPrimary', 'textSecondary', 'error']),
170
+ /** SearchBar的API */
171
+ searchAPI: PropTypes.string,
172
+ /** SearchBar的提示字 */
173
+ searchPlaceholder: PropTypes.string,
174
+ /** 是否在小畫面的時候使用SearchIcon取代KeywordSearch */
175
+ smallUseSearchIcon: PropTypes.bool,
176
+ /** SearchBar啟動搜尋的callback */
177
+ onSearch: PropTypes.func,
178
+ /** 設定黑暗模式的callback */
179
+ setDarkMode: PropTypes.func,
180
+ /** 語系變動時的callback */
181
+ onLanguageChange: PropTypes.func,
182
+ /** SearchIcon點擊時的callback */
183
+ onSearchIconClick: PropTypes.func
184
+ };
185
+
186
+ export { Header as default };
@@ -1 +1,58 @@
1
- import{a as r}from"./_rollupPluginBabelHelpers-fde6d1c6.js";import e,{useState as t}from"react";import{s as i,c as a,b as s}from"./vendor-851c6356.js";import o from"prop-types";import"react-is";import"@material-ui/styles";import"react-dom";i(".image {\n cursor: pointer; }\n");var n=function(i){var o=i.className,n=i.src,l=i.width,m=i.thumbnailSrc,c=t(!1),p=r(c,2),u=p[0],d=p[1];return e.createElement("div",null,e.createElement("img",{src:m||n,className:a("image",o),style:{width:"".concat(l,"px")},alt:"preview",onClick:function(){return d(!0)}}),u?e.createElement(s,{image:n,showTitle:!1,onClose:function(){return d(!1)}}):null)};n.defaultProps={className:void 0,src:void 0,width:200,thumbnailSrc:void 0},n.propTypes={className:o.string,src:o.string,width:o.number,thumbnailSrc:o.string};export{n as default};
1
+ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-fde6d1c6.js';
2
+ import React__default, { useState } from 'react';
3
+ import { s as styleInject, c as classNames, b as build } from './vendor-851c6356.js';
4
+ import PropTypes from 'prop-types';
5
+ import 'react-is';
6
+ import '@material-ui/styles';
7
+ import 'react-dom';
8
+
9
+ var css_248z = ".image {\n cursor: pointer; }\n";
10
+ styleInject(css_248z);
11
+
12
+ var Image = function Image(_ref) {
13
+ var className = _ref.className,
14
+ src = _ref.src,
15
+ width = _ref.width,
16
+ thumbnailSrc = _ref.thumbnailSrc;
17
+ var _useState = useState(false),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ isOpen = _useState2[0],
20
+ setIsOpen = _useState2[1];
21
+ return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("img", {
22
+ src: thumbnailSrc || src,
23
+ className: classNames('image', className),
24
+ style: {
25
+ width: "".concat(width, "px")
26
+ },
27
+ alt: "preview",
28
+ onClick: function onClick() {
29
+ return setIsOpen(true);
30
+ }
31
+ }), isOpen ? /*#__PURE__*/React__default.createElement(build, {
32
+ image: src,
33
+ showTitle: false,
34
+ onClose: function onClose() {
35
+ return setIsOpen(false);
36
+ }
37
+ }) : null);
38
+ };
39
+ Image.defaultProps = {
40
+ className: undefined,
41
+ src: undefined,
42
+ width: 200,
43
+ thumbnailSrc: undefined
44
+ };
45
+
46
+ /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
47
+ Image.propTypes = {
48
+ /** Css Name */
49
+ className: PropTypes.string,
50
+ /** 圖片來源 */
51
+ src: PropTypes.string,
52
+ /** 預覽圖片寬度 */
53
+ width: PropTypes.number,
54
+ /** 縮圖來源 */
55
+ thumbnailSrc: PropTypes.string
56
+ };
57
+
58
+ export { Image as default };
@@ -1 +1,79 @@
1
- import e from"react";import t from"prop-types";import{s as r,c as a}from"./vendor-851c6356.js";import{OutlinedInput as n}from"@material-ui/core";import"react-is";import"@material-ui/styles";import"react-dom";r(".input {\n padding: 12px; }\n");var o=function(t){var r=t.className,o=t.placeholder,s=t.defaultValue,l=t.value,i=t.type,u=t.onChange,p=t.onKeyPress,d=t.onPressEnter,f=t.suffix,c={inputProps:{className:a("input",r)},placeholder:o,defaultValue:s,onChange:function(e){var t=e.target;u&&u(t.value)},onKeyPress:function(e){"Enter"===e.key&&d&&d(e.key,e.target.value),p&&p(e)},value:l,endAdornment:f&&e.isValidElement(f)?f:null,type:i};return e.createElement(n,c)};o.defaultProps={className:void 0,placeholder:"Please enter text",defaultValue:void 0,value:void 0,onChange:void 0,onKeyPress:void 0,onPressEnter:void 0,suffix:null,type:"text"},o.propTypes={className:t.string,placeholder:t.string,defaultValue:t.string,value:t.string,onChange:t.func,onKeyPress:t.func,onPressEnter:t.func,suffix:t.node,type:t.string};export{o as default};
1
+ import React__default from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { s as styleInject, c as classNames } from './vendor-851c6356.js';
4
+ import { OutlinedInput } from '@material-ui/core';
5
+ import 'react-is';
6
+ import '@material-ui/styles';
7
+ import 'react-dom';
8
+
9
+ var css_248z = ".input {\n padding: 12px; }\n";
10
+ styleInject(css_248z);
11
+
12
+ var Input = function Input(props) {
13
+ var className = props.className,
14
+ placeholder = props.placeholder,
15
+ defaultValue = props.defaultValue,
16
+ value = props.value,
17
+ type = props.type; // Attributes
18
+
19
+ var _onChange = props.onChange,
20
+ _onKeyPress = props.onKeyPress,
21
+ onPressEnter = props.onPressEnter; // Call Back Functions
22
+
23
+ var suffix = props.suffix; // Dom Status
24
+
25
+ var OutlinedInputProps = {
26
+ inputProps: {
27
+ className: classNames('input', className)
28
+ },
29
+ placeholder: placeholder,
30
+ defaultValue: defaultValue,
31
+ onChange: function onChange(_ref) {
32
+ var target = _ref.target;
33
+ if (_onChange) _onChange(target.value);
34
+ },
35
+ onKeyPress: function onKeyPress(e) {
36
+ if (e.key === 'Enter' && onPressEnter) onPressEnter(e.key, e.target.value);
37
+ if (_onKeyPress) _onKeyPress(e);
38
+ },
39
+ value: value,
40
+ endAdornment: suffix && /*#__PURE__*/React__default.isValidElement(suffix) ? suffix : null,
41
+ type: type
42
+ };
43
+ return /*#__PURE__*/React__default.createElement(OutlinedInput, OutlinedInputProps);
44
+ };
45
+ Input.defaultProps = {
46
+ className: undefined,
47
+ placeholder: 'Please enter text',
48
+ defaultValue: undefined,
49
+ value: undefined,
50
+ onChange: undefined,
51
+ onKeyPress: undefined,
52
+ onPressEnter: undefined,
53
+ suffix: null,
54
+ type: 'text'
55
+ };
56
+
57
+ /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
58
+ Input.propTypes = {
59
+ /** Css Name */
60
+ className: PropTypes.string,
61
+ /** Placeholder */
62
+ placeholder: PropTypes.string,
63
+ /** Default Value */
64
+ defaultValue: PropTypes.string,
65
+ /** Value */
66
+ value: PropTypes.string,
67
+ /** onChange Call Back */
68
+ onChange: PropTypes.func,
69
+ /** onKeyPress Call Back */
70
+ onKeyPress: PropTypes.func,
71
+ /** onPressEnter Call Back */
72
+ onPressEnter: PropTypes.func,
73
+ /** Custom Icon Area */
74
+ suffix: PropTypes.node,
75
+ /** HTML5 Input type */
76
+ type: PropTypes.string
77
+ };
78
+
79
+ export { Input as default };