@daoyi/nmtl-ui 2.0.1-beta.37 → 2.0.1-beta.39
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/README.md +45 -45
- package/lib/components/Autocomplete.js +1 -1
- package/lib/components/BackTop.js +1 -1
- package/lib/components/ContactModal.js +2 -2
- package/lib/components/Footer.js +1 -1
- package/lib/components/Header.js +1 -1
- package/lib/components/KeywordSearch-494832fa.js +1 -0
- package/lib/components/KeywordSearch.js +1 -1
- package/lib/components/Keywords.js +1 -1
- package/lib/components/SNA.js +1 -1
- package/lib/components/{createSvgIcon-9c1645fc.js → createSvgIcon-65652f3a.js} +0 -0
- package/lib/components/{createSvgIcon-9244cfb8.js → createSvgIcon-a33739d1.js} +0 -0
- package/lib/utils/arrayMerge.js +1 -1
- package/package.json +126 -125
- package/lib/components/KeywordSearch-541c5ffd.js +0 -1
package/package.json
CHANGED
|
@@ -1,125 +1,126 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@daoyi/nmtl-ui",
|
|
3
|
-
"version": "2.0.1-beta.
|
|
4
|
-
"description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
|
|
5
|
-
"author": "daoyi",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"typings": "lib/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"lib"
|
|
10
|
-
],
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/HsunTsai/react-storybook-jsx-starter"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@geometricpanda/storybook-addon-badges": "0.2.2",
|
|
17
|
-
"@material-ui/core": "4.12.3",
|
|
18
|
-
"@material-ui/icons": "4.11.2",
|
|
19
|
-
"@material-ui/lab": "4.0.0-alpha.60",
|
|
20
|
-
"@material-ui/styles": "4.11.4",
|
|
21
|
-
"axios": "0.21.1",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"d3
|
|
25
|
-
"d3-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"react
|
|
41
|
-
"react-
|
|
42
|
-
"react-
|
|
43
|
-
"react-
|
|
44
|
-
"react-
|
|
45
|
-
"react-
|
|
46
|
-
"react-
|
|
47
|
-
"react-
|
|
48
|
-
"react-
|
|
49
|
-
"react-
|
|
50
|
-
"react-
|
|
51
|
-
"react-
|
|
52
|
-
"react-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"@babel/
|
|
63
|
-
"@babel/preset-
|
|
64
|
-
"@
|
|
65
|
-
"@rollup/plugin-
|
|
66
|
-
"@
|
|
67
|
-
"@storybook/addon-
|
|
68
|
-
"@storybook/addon-
|
|
69
|
-
"@storybook/
|
|
70
|
-
"@storybook/
|
|
71
|
-
"@storybook/
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"babel-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"eslint
|
|
78
|
-
"eslint-config-
|
|
79
|
-
"eslint-config-
|
|
80
|
-
"eslint-
|
|
81
|
-
"eslint-
|
|
82
|
-
"eslint-plugin-
|
|
83
|
-
"eslint-plugin-
|
|
84
|
-
"eslint-plugin-
|
|
85
|
-
"eslint-plugin-
|
|
86
|
-
"eslint-plugin-react
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"rollup
|
|
91
|
-
"rollup-plugin-
|
|
92
|
-
"rollup-plugin-
|
|
93
|
-
"rollup-plugin-
|
|
94
|
-
"rollup-plugin-
|
|
95
|
-
"rollup-plugin-
|
|
96
|
-
"rollup-plugin-
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
"not
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"last 1
|
|
109
|
-
"last 1
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"build
|
|
119
|
-
"build-
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"pub
|
|
123
|
-
"pub-
|
|
124
|
-
|
|
125
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@daoyi/nmtl-ui",
|
|
3
|
+
"version": "2.0.1-beta.39",
|
|
4
|
+
"description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
|
|
5
|
+
"author": "daoyi",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"typings": "lib/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"lib"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/HsunTsai/react-storybook-jsx-starter"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@geometricpanda/storybook-addon-badges": "0.2.2",
|
|
17
|
+
"@material-ui/core": "4.12.3",
|
|
18
|
+
"@material-ui/icons": "4.11.2",
|
|
19
|
+
"@material-ui/lab": "4.0.0-alpha.60",
|
|
20
|
+
"@material-ui/styles": "4.11.4",
|
|
21
|
+
"axios": "0.21.1",
|
|
22
|
+
"babel-eslint": "10.1.0",
|
|
23
|
+
"classnames": "2.3.1",
|
|
24
|
+
"d3": "5.16.0",
|
|
25
|
+
"d3-selection": "1.4.2",
|
|
26
|
+
"d3-transition": "1.3.2",
|
|
27
|
+
"dom-to-image": "2.6.0",
|
|
28
|
+
"formik": "2.2.9",
|
|
29
|
+
"html-to-react": "1.4.5",
|
|
30
|
+
"jquery": "3.6.0",
|
|
31
|
+
"js-file-download": "0.4.12",
|
|
32
|
+
"jszip": "3.7.1",
|
|
33
|
+
"lodash": "4.17.21",
|
|
34
|
+
"markdown-it": "12.0.6",
|
|
35
|
+
"moment": "^2.29.4",
|
|
36
|
+
"node-sass": "4.14.1",
|
|
37
|
+
"notistack": "1.0.10",
|
|
38
|
+
"prop-types": "15.7.2",
|
|
39
|
+
"query-string": "6.12.1",
|
|
40
|
+
"react": "16.14.0",
|
|
41
|
+
"react-awesome-lightbox": "^1.8.1",
|
|
42
|
+
"react-data-export": "0.6.0",
|
|
43
|
+
"react-dom": "16.14.0",
|
|
44
|
+
"react-dropzone": "11.3.2",
|
|
45
|
+
"react-facebook-login": "4.1.1",
|
|
46
|
+
"react-file-download": "0.3.5",
|
|
47
|
+
"react-font-size-changer": "0.2.0",
|
|
48
|
+
"react-google-login": "5.2.2",
|
|
49
|
+
"react-intl": "5.8.0",
|
|
50
|
+
"react-redux": "7.2.5",
|
|
51
|
+
"react-router-dom": "5.2.0",
|
|
52
|
+
"react-share": "4.4.0",
|
|
53
|
+
"react-slick": "^0.28.1",
|
|
54
|
+
"redux": "4.1.0",
|
|
55
|
+
"sass": "1.41.1",
|
|
56
|
+
"screenfull": "5.2.0",
|
|
57
|
+
"slick-carousel": "^1.8.1",
|
|
58
|
+
"styled-components": "5.3.5",
|
|
59
|
+
"xlsx": "0.18.5"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@babel/core": "7.15.5",
|
|
63
|
+
"@babel/preset-env": "7.19.4",
|
|
64
|
+
"@babel/preset-react": "7.18.6",
|
|
65
|
+
"@rollup/plugin-image": "2.1.1",
|
|
66
|
+
"@rollup/plugin-json": "4.1.0",
|
|
67
|
+
"@storybook/addon-essentials": "6.5.13",
|
|
68
|
+
"@storybook/addon-links": "6.5.13",
|
|
69
|
+
"@storybook/addon-notes": "6.0.0-alpha.6",
|
|
70
|
+
"@storybook/addons": "6.5.13",
|
|
71
|
+
"@storybook/preset-scss": "1.0.3",
|
|
72
|
+
"@storybook/react": "6.5.13",
|
|
73
|
+
"autoprefixer": "9.8.6",
|
|
74
|
+
"babel-loader": "8.2.2",
|
|
75
|
+
"babel-plugin-transform-imports": "2.0.0",
|
|
76
|
+
"css-loader": "1.0.1",
|
|
77
|
+
"eslint": "7.2.0",
|
|
78
|
+
"eslint-config-airbnb": "18.2.1",
|
|
79
|
+
"eslint-config-node": "4.1.0",
|
|
80
|
+
"eslint-config-prettier": "8.3.0",
|
|
81
|
+
"eslint-loader": "4.0.2",
|
|
82
|
+
"eslint-plugin-import": "2.22.1",
|
|
83
|
+
"eslint-plugin-jsx-a11y": "6.4.1",
|
|
84
|
+
"eslint-plugin-node": "11.1.0",
|
|
85
|
+
"eslint-plugin-prettier": "3.4.1",
|
|
86
|
+
"eslint-plugin-react": "7.21.5",
|
|
87
|
+
"eslint-plugin-react-hooks": "1.7.0",
|
|
88
|
+
"http-proxy-middleware": "1.3.1",
|
|
89
|
+
"prettier": "2.4.1",
|
|
90
|
+
"rollup": "2.56.3",
|
|
91
|
+
"rollup-plugin-babel": "4.4.0",
|
|
92
|
+
"rollup-plugin-cleaner": "1.0.0",
|
|
93
|
+
"rollup-plugin-commonjs": "10.1.0",
|
|
94
|
+
"rollup-plugin-node-resolve": "5.2.0",
|
|
95
|
+
"rollup-plugin-postcss": "4.0.1",
|
|
96
|
+
"rollup-plugin-replace": "2.2.0",
|
|
97
|
+
"rollup-plugin-terser": "7.0.2",
|
|
98
|
+
"sass-loader": "7.1.0",
|
|
99
|
+
"style-loader": "0.22.1"
|
|
100
|
+
},
|
|
101
|
+
"browserslist": {
|
|
102
|
+
"production": [
|
|
103
|
+
">0.2%",
|
|
104
|
+
"not dead",
|
|
105
|
+
"not op_mini all"
|
|
106
|
+
],
|
|
107
|
+
"development": [
|
|
108
|
+
"last 1 chrome version",
|
|
109
|
+
"last 1 firefox version",
|
|
110
|
+
"last 1 safari version"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"scripts": {
|
|
114
|
+
"start": "set NODE_OPTIONS=--max_old_space_size=16384 && yarn storybook",
|
|
115
|
+
"lint": "eslint ./src/**/*.{js,jsx}",
|
|
116
|
+
"format": "prettier --write --tab-width 4 --use-tabs true \"{,src/**/}*.{js,jsx}\"",
|
|
117
|
+
"storybook": "start-storybook -p 6006 --no-open",
|
|
118
|
+
"build": "rollup -c && npm run build-index",
|
|
119
|
+
"build-index": "node ./rollup.index.js",
|
|
120
|
+
"build-storybook": "build-storybook -c .storybook -o public",
|
|
121
|
+
"create": "node ./buildUtils/create.js",
|
|
122
|
+
"pub": "npm version patch -m Publish && npm publish",
|
|
123
|
+
"pub-alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
|
|
124
|
+
"pub-beta": "npm version prerelease --preid=beta && npm publish --tag beta"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e,{useCallback as n,useState as a,useRef as r,useEffect as t}from"react";import o from"prop-types";import{c as l}from"./index-11391ca3.js";import i from"axios";import{s as u}from"./style-inject.es-c875d022.js";import{_ as c,i as s,a as p,b as d}from"./isObjectLike-2f1983fe.js";import{Autocomplete as f}from"@material-ui/lab";import{_ as m}from"./_rollupPluginBabelHelpers-1fef267c.js";import{Chip as h,TextField as g,CircularProgress as v}from"@material-ui/core";import{Close as b,SearchOutlined as y}from"@material-ui/icons";import{E as I}from"./Empty-a053f253.js";u(".keywordSearch {\n border-radius: 4px;\n width: 100%;\n margin-right: 14px; }\n .keywordSearch--animation .autocomplete {\n transition: max-width 0.3s ease-out;\n max-width: 240px; }\n .keywordSearch--focus {\n flex: 1; }\n .keywordSearch--focus .autocomplete {\n max-width: 100%; }\n .keywordSearch .MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n border-radius: 10px;\n background-color: #ffffff66; }\n");var A=function(){return c.Date.now()},S=/\s/;var w=function(e){for(var n=e.length;n--&&S.test(e.charAt(n)););return n},x=/^\s+/;var k=function(e){return e?e.slice(0,w(e)+1).replace(x,""):e};var C=function(e){return"symbol"==typeof e||s(e)&&"[object Symbol]"==p(e)},E=/^[-+]0x[0-9a-f]+$/i,O=/^0b[01]+$/i,V=/^0o[0-7]+$/i,T=parseInt;var N=function(e){if("number"==typeof e)return e;if(C(e))return NaN;if(d(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=d(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=k(e);var a=O.test(e);return a||V.test(e)?T(e.slice(2),a?2:8):E.test(e)?NaN:+e},M=Math.max,j=Math.min;var _=function(e,n,a){var r,t,o,l,i,u,c=0,s=!1,p=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(n){var a=r,o=t;return r=t=void 0,c=n,l=e.apply(o,a)}function h(e){return c=e,i=setTimeout(v,n),s?m(e):l}function g(e){var a=e-u;return void 0===u||a>=n||a<0||p&&e-c>=o}function v(){var e=A();if(g(e))return b(e);i=setTimeout(v,function(e){var a=n-(e-u);return p?j(a,o-(e-c)):a}(e))}function b(e){return i=void 0,f&&r?m(e):(r=t=void 0,l)}function y(){var e=A(),a=g(e);if(r=arguments,t=this,u=e,a){if(void 0===i)return h(u);if(p)return clearTimeout(i),i=setTimeout(v,n),m(u)}return void 0===i&&(i=setTimeout(v,n)),l}return n=N(n)||0,d(a)&&(s=!!a.leading,o=(p="maxWait"in a)?M(N(a.maxWait)||0,n):o,f="trailing"in a?!!a.trailing:f),y.cancel=function(){void 0!==i&&clearTimeout(i),c=0,r=u=t=i=void 0},y.flush=function(){return void 0===i?l:b(A())},y};u(".autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 0px 8px; }\n\n.autocomplete .MuiChip-deleteIcon {\n width: 16px;\n height: 16px; }\n\n.autocomplete__icon {\n font-size: 1.25rem;\n margin-right: 8px;\n cursor: pointer; }\n\n.autocomplete--showSearchIcon .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n display: flex;\n flex-wrap: nowrap;\n padding: 4px 8px; }\n");const D=o=>{const{options:i,defaultValue:u,renderAfterDefaultValueChange:c,filterable:s,loading:p,labelInValue:d,disabled:A,onSearchIconClick:S}=o,{className:w,multiple:x,freeTyping:k,placeholder:C,searchIcon:E,renderInput:O,renderTags:V}=o,{onChange:T,onSearch:N,onFocus:M,onBlur:j,onEnter:D}=o,[P,F]=a(!0),[R,B]=a(),[L,$]=a(),[z,K]=a(),[W,H]=a(),{getValue:J,getValueFromOptions:U,defaultTag:q,defaultRenderInput:G}=(a=>{let{options:r,placeholder:t,loading:o,searchIcon:l,labelInValue:i,onSearchIconClick:u,onEnter:c,currentResult:s,setCurrentDefaultValue:p}=a;const d=n((e=>"object"==typeof e?e.value:e),[]),f=n((e=>{const n=(Array.isArray(r)?r:[]).find((n=>d(n)===d(e)));return n?"object"==typeof n?n.label:n:"object"==typeof e?e.label:e}),[r]),I=n((e=>{if(Array.isArray(r)){if(Array.isArray(e))return e.map((e=>r.find((n=>{let{value:a}=n;return e===a||e.value===a}))||e));const n=r.find((n=>{let{value:a}=n;return e===a}));return i?e:n||{label:e,value:e}}return e}),[r,i]),A=n(((n,a)=>n.map(((n,r)=>e.createElement(h,m({label:f(n),deleteIcon:e.createElement(b,null)},a({index:r})))))),[r]),S=n((n=>e.createElement(g,m({},n,{variant:"outlined",placeholder:t,InputProps:{...n.InputProps,endAdornment:e.createElement(e.Fragment,null,o&&e.createElement(v,{className:"autocomplete__icon",color:"inherit",size:20}),l&&e.createElement(y,{className:"autocomplete__icon",onClick:e=>(p({label:s,value:s}),c(e,{label:s,value:s}))}),n.InputProps.endAdornment)}}))),[o,l]);return{getValue:d,getValueFromOptions:I,defaultTag:A,defaultRenderInput:S}})({options:i,placeholder:C,loading:p,searchIcon:E,labelInValue:d,onSearchIconClick:S,currentResult:L,onEnter:D,setCurrentDefaultValue:H}),Q=r(_((e=>N(e)),500)).current;return t((()=>{H("string"==typeof u&&x?{label:R,value:R}:U(u))}),[JSON.stringify(u)]),t((()=>{c&&F(!1)}),[W]),t((()=>{P||F(!0)}),[P]),t((()=>{L&&(B(L),Q(L))}),[L]),e.createElement("div",{className:l("autocomplete",{"autocomplete--showSearchIcon":E},w)},P&&e.createElement(f,{className:"autocomplete__component",options:Array.isArray(i)&&(k&&R?[{label:R,value:R}].concat(i):i)||[],defaultValue:W,disabled:A,multiple:x,filterOptions:(e,n)=>{const{inputValue:a=""}=n;return(Array.isArray(e)?e:[]).filter((e=>{const{label:n=""}=e||{};return!s||n.toLowerCase().indexOf(a.toLowerCase())>-1}))},onChange:(e,n)=>{Array.isArray(n)?T(n.map((e=>d?e:J(e)))):n&&T(d?n:J(n))},onInputChange:(e,n,a)=>{n&&"string"==typeof n&&"input"===a&&$(n)},onKeyDown:e=>{switch(e.key){case"ArrowDown":case"ArrowUp":K(!0);break;case"Enter":if(!z){const n=k&&!x;D(e,n?{label:R,value:R}:void 0),n&&H({label:R,value:R})}break;default:K(!1)}},getOptionLabel:e=>e&&e.label||"",getOptionDisabled:e=>e.disabled,renderInput:e=>O&&O(e)||G(e),renderTags:(e,n)=>V&&V(e,n)||q(e,n),popupIcon:null,noOptionsText:e.createElement(I,null),onFocus:M,onBlur:j}))};D.defaultProps={className:void 0,defaultValue:void 0,renderAfterDefaultValueChange:!1,options:void 0,freeTyping:!1,loading:!1,disabled:!1,labelInValue:!0,searchIcon:!0,multiple:!1,placeholder:"Search...",filterable:!1,renderInput:void 0,renderTags:void 0,onChange:()=>{},onSearch:()=>{},onFocus:()=>{},onBlur:()=>{},onEnter:()=>{},onSearchIconClick:()=>{}},D.propTypes={className:o.string,defaultValue:o.any,renderAfterDefaultValueChange:o.bool,options:o.arrayOf(o.any),freeTyping:o.bool,loading:o.bool,disabled:o.bool,labelInValue:o.bool,searchIcon:o.bool,multiple:o.bool,placeholder:o.string,filterable:o.bool,renderInput:o.func,renderTags:o.func,onChange:o.func,onSearch:o.func,onFocus:o.func,onBlur:o.func,onEnter:o.func,onSearchIconClick:o.func};const P=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return Array.isArray(e)?e.filter(((e,a,r)=>r.findIndex((a=>a[n]===e[n]))===a)):[]},F=n=>{let{className:r,animation:o,filterSameName:u,keyword:c,searchAPI:s,placeholder:p,setMenuOpen:d,menuOpen:f,onSearch:m,onSearchIconClick:h}=n;const[g,v]=a(!1),[b,y]=a([]),[I,A]=a(c);return t((()=>{var e;(e=I)&&0!==e.length&&(v(!0),i.get(s,{params:{keyword:e}}).then((e=>{e.data&&e.data.data&&y(P(e.data.data,"id"))})).finally((()=>v(!1))))}),[I]),e.createElement("div",{className:l("keywordSearch",{"keywordSearch--animation":o},{"keywordSearch--focus":f},r)},e.createElement(D,{freeTyping:!0,renderAfterDefaultValueChange:!0,defaultValue:{label:c,value:c},loading:g,options:(u?P(b,"name"):b).map((e=>{let{name:n,id:a,value:r,label:t}=e;return{value:a||r||n,label:n||t}})),placeholder:p,onSearch:A,onChange:e=>{e&&m(b.find((n=>{let{id:a,value:r}=n;return a===e.value||r===e.value}))||e)},onEnter:(e,n)=>m(n),onFocus:()=>d(!0),onBlur:()=>d(!1),onSearchIconClick:h}))};F.defaultProps={className:void 0,animation:!1,filterSameName:!0,keyword:void 0,searchAPI:void 0,placeholder:void 0,menuOpen:!1,setMenuOpen:()=>{},onSearch:()=>{},onSearchIconClick:()=>{}},F.propTypes={className:o.string,animation:o.bool,filterSameName:o.bool,keyword:o.string,searchAPI:o.string,placeholder:o.string,menuOpen:o.bool,setMenuOpen:o.func,onSearch:o.func,onSearchIconClick:o.func};export{F as K,_ as d};
|