@daoyi/nmtl-ui 2.0.1-beta.1 → 2.0.1-beta.100

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 (88) hide show
  1. package/lib/components/Autocomplete-9e392b0c.js +470 -0
  2. package/lib/components/Autocomplete.js +20 -0
  3. package/lib/components/Avatar.js +53 -0
  4. package/lib/components/BackTop.js +111 -0
  5. package/lib/components/BarChart.js +762 -0
  6. package/lib/components/Breadcrumbs.js +122 -0
  7. package/lib/components/Button-305b69a0.js +92 -0
  8. package/lib/components/Button.js +6 -0
  9. package/lib/components/Carousel.js +4654 -0
  10. package/lib/components/Checkbox.js +37 -0
  11. package/lib/components/CollapseContent.js +180 -0
  12. package/lib/components/ContactModal-90b95c63.js +12188 -0
  13. package/lib/components/ContactModal.js +24 -0
  14. package/lib/components/Drawer-2cbcec04.js +163 -0
  15. package/lib/components/Drawer.js +17 -0
  16. package/lib/components/Dropdown.js +134 -0
  17. package/lib/components/Empty-bf77164f.js +45 -0
  18. package/lib/components/Empty.js +5 -0
  19. package/lib/components/ExportButton.js +128 -0
  20. package/lib/components/ExtraTools-55f66039.js +3619 -0
  21. package/lib/components/ExtraTools.js +10 -0
  22. package/lib/components/Filter.js +814 -0
  23. package/lib/components/Footer.js +317 -0
  24. package/lib/components/ForwardLink-83a7eea9.js +125 -0
  25. package/lib/components/ForwardLink.js +10 -0
  26. package/lib/components/Header.js +220 -0
  27. package/lib/components/Image.js +61 -0
  28. package/lib/components/Input.js +82 -0
  29. package/lib/components/InputMethod.js +33963 -0
  30. package/lib/components/KeywordSearch-d378ca7f.js +151 -0
  31. package/lib/components/KeywordSearch.js +22 -0
  32. package/lib/components/KeywordTicker.js +224 -0
  33. package/lib/components/Keywords.js +343 -0
  34. package/lib/components/Loading.js +28 -0
  35. package/lib/components/MUITheme.js +2639 -0
  36. package/lib/components/Modal-777fe87d.js +116 -0
  37. package/lib/components/Modal.js +10 -0
  38. package/lib/components/MoreButton-493f7c82.js +148 -0
  39. package/lib/components/MoreButton.js +8 -0
  40. package/lib/components/Pagination.js +3632 -0
  41. package/lib/components/Radio.js +78 -0
  42. package/lib/components/SNA.js +1691 -0
  43. package/lib/components/Select-e0790135.js +145 -0
  44. package/lib/components/Select.js +13 -0
  45. package/lib/components/Spin-8dc60bfe.js +75 -0
  46. package/lib/components/Spin.js +6 -0
  47. package/lib/components/Table.js +51 -0
  48. package/lib/components/Tooltip-6ebfa9c1.js +70 -0
  49. package/lib/components/Tooltip.js +7 -0
  50. package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
  51. package/lib/components/_rollupPluginBabelHelpers-a52356f6.js +142 -0
  52. package/lib/components/createSvgIcon-e3803ee1.js +576 -0
  53. package/lib/components/dataExport-d55d6fa3.js +92 -0
  54. package/lib/components/debounce-127da66c.js +355 -0
  55. package/lib/components/defaultTheme-ed7746fe.js +1661 -0
  56. package/lib/components/globalConfig.js +248 -0
  57. package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
  58. package/lib/components/index-b47819f3.js +481 -0
  59. package/lib/components/index-b76a85f4.js +61 -0
  60. package/lib/components/isObjectLike-e111475d.js +190 -0
  61. package/lib/components/style-inject.es-1f59c1d0.js +28 -0
  62. package/lib/components/toConsumableArray-dbe8af76.js +19 -0
  63. package/lib/components/transform-3a04288b.js +5475 -0
  64. package/lib/components/useTheme-d16d02d9.js +11 -0
  65. package/lib/components/withTheme-2d778133.js +6 -0
  66. package/lib/configs/config.selector.js +151 -0
  67. package/lib/configs/index.d.ts +1 -0
  68. package/lib/configs/index.js +1 -0
  69. package/lib/index.d.ts +37 -0
  70. package/lib/index.js +37 -0
  71. package/lib/utils/_rollupPluginBabelHelpers-8dd26e1a.js +121 -0
  72. package/lib/utils/arrayMerge.js +4953 -0
  73. package/lib/utils/chunkArray.js +15 -0
  74. package/lib/utils/convert2HtmlEntities.js +42 -0
  75. package/lib/utils/domToImage.js +802 -0
  76. package/lib/utils/downloadGephi.js +106 -0
  77. package/lib/utils/exportXlsx.js +219 -0
  78. package/lib/utils/historyAppendSearch.js +502 -0
  79. package/lib/utils/index.d.ts +13 -0
  80. package/lib/utils/index.js +13 -0
  81. package/lib/utils/isDevelopMode.js +5 -0
  82. package/lib/utils/parseYMD.js +36 -0
  83. package/lib/utils/removeDuplicateItem.js +11 -0
  84. package/lib/utils/sendEmail.js +39 -0
  85. package/lib/utils/snaDefine-6a2bcd94.js +5 -0
  86. package/lib/utils/snaDefine.js +1 -0
  87. package/lib/utils/snaPreProcess.js +84 -0
  88. package/package.json +125 -128
@@ -0,0 +1,116 @@
1
+ import React__default from 'react';
2
+ import { c as classNames } from './index-b76a85f4.js';
3
+ import PropTypes from 'prop-types';
4
+ import { Dialog, DialogTitle, IconButton, DialogContent, DialogActions, CircularProgress } from '@material-ui/core';
5
+ import { CloseSharp } from '@material-ui/icons';
6
+ import { B as Button } from './Button-305b69a0.js';
7
+ import { S as Spin } from './Spin-8dc60bfe.js';
8
+ import { getIntl } from './globalConfig';
9
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
+
11
+ var css_248z = ".modal__title h2 {\n display: flex;\n align-items: center;\n}\n.modal__title__text {\n flex: 1;\n font-size: 16px;\n padding: 8px 0;\n color: inherit;\n}\n.modal__title__close {\n cursor: pointer;\n color: inherit;\n}\n.modal--transparent .MuiPaper-root {\n background: transparent !important;\n box-shadow: none;\n}\n.modal--transparent .modal__title {\n background: transparent !important;\n}";
12
+ styleInject(css_248z);
13
+
14
+ var Modal = function Modal(props) {
15
+ var className = props.className,
16
+ title = props.title,
17
+ children = props.children,
18
+ footer = props.footer,
19
+ cancelText = props.cancelText,
20
+ okText = props.okText,
21
+ visible = props.visible,
22
+ onOk = props.onOk,
23
+ onCancel = props.onCancel;
24
+ var closable = props.closable,
25
+ loading = props.loading,
26
+ fullWidth = props.fullWidth,
27
+ transparent = props.transparent;
28
+ var endIcon = loading && /*#__PURE__*/React__default.createElement(CircularProgress, {
29
+ size: 14
30
+ });
31
+ return /*#__PURE__*/React__default.createElement(Dialog, {
32
+ className: classNames('modal', {
33
+ 'modal--transparent': transparent
34
+ }, className),
35
+ fullWidth: fullWidth,
36
+ open: visible || false,
37
+ onClose: function onClose() {
38
+ return closable && onCancel();
39
+ }
40
+ // WCAG 4.1.2 對話框需有可及名稱
41
+ ,
42
+ "aria-label": typeof title === 'string' ? title : undefined
43
+ }, /*#__PURE__*/React__default.createElement(DialogTitle, {
44
+ className: "modal__title"
45
+ }, /*#__PURE__*/React__default.createElement("span", {
46
+ className: "modal__title__text"
47
+ }, title), closable && /*#__PURE__*/React__default.createElement(IconButton, {
48
+ "aria-label": getIntl().formatMessage({
49
+ id: 'aria.modal.close'
50
+ }),
51
+ onClick: onCancel
52
+ }, /*#__PURE__*/React__default.createElement(CloseSharp, {
53
+ className: "modal__title__close",
54
+ "aria-hidden": "true"
55
+ }))), /*#__PURE__*/React__default.createElement(DialogContent, null, /*#__PURE__*/React__default.createElement(Spin, {
56
+ spinning: loading
57
+ }, children)), footer !== null && /*#__PURE__*/React__default.createElement(DialogActions, null, footer === undefined && (cancelText || okText) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, cancelText && /*#__PURE__*/React__default.createElement(Button, {
58
+ onClick: onCancel,
59
+ color: "default",
60
+ endIcon: endIcon,
61
+ disabled: loading
62
+ }, cancelText), okText && /*#__PURE__*/React__default.createElement(Button, {
63
+ onClick: onOk,
64
+ color: "primary",
65
+ endIcon: endIcon,
66
+ disabled: loading,
67
+ autoFocus: true
68
+ }, okText)) : footer));
69
+ };
70
+ Modal.defaultProps = {
71
+ className: undefined,
72
+ loading: undefined,
73
+ transparent: undefined,
74
+ closable: true,
75
+ title: undefined,
76
+ children: undefined,
77
+ fullWidth: undefined,
78
+ footer: undefined,
79
+ cancelText: 'Cancel',
80
+ okText: 'Ok',
81
+ visible: undefined,
82
+ onOk: function onOk() {},
83
+ onCancel: function onCancel() {}
84
+ };
85
+
86
+ /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
87
+ Modal.propTypes = {
88
+ /** Css Name */
89
+ className: PropTypes.string,
90
+ /** 是否正在載入中 */
91
+ loading: PropTypes.bool,
92
+ /** 是否正透明模式 */
93
+ transparent: PropTypes.bool,
94
+ /** 是否可以取消關閉(含close icon) */
95
+ closable: PropTypes.bool,
96
+ /** Modal Title */
97
+ title: PropTypes.node,
98
+ /** Modal 內容 */
99
+ children: PropTypes.node,
100
+ /** 版面是否滿版 */
101
+ fullWidth: PropTypes.bool,
102
+ /** Footer */
103
+ footer: PropTypes.node,
104
+ /** 取消文字 */
105
+ cancelText: PropTypes.string,
106
+ /** 確認文字 */
107
+ okText: PropTypes.string,
108
+ /** 是否出現 */
109
+ visible: PropTypes.bool,
110
+ /** 完成的callback */
111
+ onOk: PropTypes.func,
112
+ /** 關閉Modal */
113
+ onCancel: PropTypes.func
114
+ };
115
+
116
+ export { Modal as M };
@@ -0,0 +1,10 @@
1
+ export { M as default } from './Modal-777fe87d.js';
2
+ import 'react';
3
+ import './index-b76a85f4.js';
4
+ import 'prop-types';
5
+ import '@material-ui/core';
6
+ import '@material-ui/icons';
7
+ import './Button-305b69a0.js';
8
+ import './style-inject.es-1f59c1d0.js';
9
+ import './Spin-8dc60bfe.js';
10
+ import './globalConfig';
@@ -0,0 +1,148 @@
1
+ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
+ import React__default, { useState } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { c as classNames } from './index-b76a85f4.js';
5
+ import { ExpandLess, ExpandMore } from '@material-ui/icons';
6
+ import { getIntl } from './globalConfig';
7
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
8
+
9
+ var css_248z = ".moreButton {\n width: -moz-fit-content;\n width: fit-content;\n display: flex;\n align-items: center;\n position: relative;\n margin: 1rem 0rem;\n border-radius: 8px;\n padding: 1rem 2.5rem;\n -webkit-user-select: none;\n user-select: none;\n cursor: pointer;\n}\n.moreButton__mask {\n transition: all 0.3s ease-in-out;\n position: absolute;\n left: 0;\n top: 0;\n border-radius: 8px;\n width: 100%;\n height: 100%;\n opacity: 0;\n}\n.moreButton:hover .moreButton__mask {\n opacity: 1;\n}\n.moreButton--shadow {\n transition: all 0.3s ease-in-out;\n border: 3px solid #ffffff;\n position: relative;\n left: 0px;\n top: 0px;\n}\n.moreButton--shadow:hover {\n box-shadow: initial !important;\n left: 3px;\n top: 3px;\n}\n.moreButton--small {\n border: 0;\n padding: 0;\n left: 0px !important;\n top: 0px !important;\n background: transparent !important;\n box-shadow: initial !important;\n}\n.moreButton--small .moreButton__mask {\n opacity: 0 !important;\n}\n.moreButton__icon {\n display: flex;\n z-index: 1;\n}\n.moreButton__icon--small {\n font-size: 1.5rem;\n border-radius: 45px;\n color: white !important;\n}\n.moreButton__text {\n z-index: 1;\n font-size: 1.5rem;\n line-height: 1.5rem;\n transition: color 0.3s ease-in-out;\n}\n.moreButton__text--small {\n margin-left: 0.75rem;\n font-size: 1.5rem;\n color: #0c2a4d;\n}\n.moreButton__text--small:hover {\n text-decoration: underline;\n}";
10
+ styleInject(css_248z);
11
+
12
+ var MoreButton = function MoreButton(props) {
13
+ var primaryColor = props.primaryColor,
14
+ secondaryColor = props.secondaryColor,
15
+ shadowColor = props.shadowColor;
16
+ var small = props.small,
17
+ enableShadow = props.enableShadow,
18
+ customExpandIcon = props.customExpandIcon;
19
+ var expand = props.expand,
20
+ setExpand = props.setExpand,
21
+ onClick = props.onClick,
22
+ formatMessage = props.formatMessage;
23
+ /* WCAG 4.1.3 點選後結果在原頁面更新,需播報(實測回饋 R9) */
24
+ var _useState = useState(''),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ liveMessage = _useState2[0],
27
+ setLiveMessage = _useState2[1];
28
+ var smallIcon = expand ? /*#__PURE__*/React__default.createElement(ExpandLess, {
29
+ className: "moreButton__icon--small",
30
+ style: {
31
+ background: shadowColor || primaryColor
32
+ }
33
+ }) : /*#__PURE__*/React__default.createElement(ExpandMore, {
34
+ className: "moreButton__icon--small",
35
+ style: {
36
+ background: shadowColor || primaryColor
37
+ }
38
+ });
39
+ var smallMessage = expand ? 'common.show.less' : 'common.show.more';
40
+ var message = small ? smallMessage : 'common.watch.more';
41
+ var largeIcon = customExpandIcon && /*#__PURE__*/React__default.createElement("img", {
42
+ src: customExpandIcon,
43
+ alt: "",
44
+ "aria-hidden": "true"
45
+ });
46
+ var icon = small ? smallIcon : largeIcon;
47
+ var handleAction = function handleAction() {
48
+ setExpand(!expand);
49
+ onClick();
50
+ setLiveMessage(getIntl().formatMessage({
51
+ id: expand ? 'aria.moreButton.collapsed' : 'aria.moreButton.loaded'
52
+ }));
53
+ setTimeout(function () {
54
+ return setLiveMessage('');
55
+ }, 3000);
56
+ };
57
+ var messageText = formatMessage ? formatMessage({
58
+ id: message
59
+ }) : message;
60
+ return (
61
+ /*#__PURE__*/
62
+ /* WCAG 2.1.1/4.1.2 看更多為互動元件:role="button" + tabIndex + 鍵盤操作,
63
+ 報讀補「點選後載入更多結果」預先提示、aria-expanded 表達展開狀態 */
64
+ React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
65
+ "aria-live": "polite",
66
+ "aria-atomic": "true",
67
+ role: "status",
68
+ className: "visually-hidden"
69
+ }, liveMessage), /*#__PURE__*/React__default.createElement("div", {
70
+ className: classNames('moreButton', {
71
+ 'moreButton--shadow': enableShadow
72
+ }, {
73
+ 'moreButton--small': small
74
+ }),
75
+ role: "button",
76
+ tabIndex: 0,
77
+ "aria-expanded": expand,
78
+ "aria-label": "".concat(messageText).concat(getIntl().formatMessage({
79
+ id: 'aria.moreButton.hint'
80
+ })),
81
+ style: {
82
+ color: shadowColor || 'white',
83
+ background: primaryColor,
84
+ boxShadow: enableShadow ? "3px 3px 0 0 ".concat(shadowColor) : undefined
85
+ },
86
+ onClick: handleAction,
87
+ onKeyDown: function onKeyDown(event) {
88
+ if (event.key === 'Enter' || event.key === ' ') {
89
+ event.preventDefault();
90
+ handleAction();
91
+ }
92
+ }
93
+ }, !enableShadow && /*#__PURE__*/React__default.createElement("div", {
94
+ className: "moreButton__mask",
95
+ style: {
96
+ background: secondaryColor
97
+ }
98
+ }), /*#__PURE__*/React__default.createElement("div", {
99
+ className: "moreButton__icon"
100
+ }, icon), /*#__PURE__*/React__default.createElement("div", {
101
+ className: classNames('moreButton__text', {
102
+ 'moreButton__text--small': small
103
+ }),
104
+ style: {
105
+ color: small ? shadowColor || primaryColor : undefined,
106
+ marginLeft: icon ? '0.5rem' : undefined
107
+ }
108
+ }, messageText)))
109
+ );
110
+ };
111
+ MoreButton.defaultProps = {
112
+ primaryColor: '#271702',
113
+ // default為文學網站的主色系
114
+ secondaryColor: '#aa8859',
115
+ // default為文學網站的次色系
116
+ shadowColor: undefined,
117
+ small: false,
118
+ enableShadow: false,
119
+ expand: false,
120
+ customExpandIcon: undefined,
121
+ formatMessage: undefined,
122
+ setExpand: function setExpand() {},
123
+ onClick: function onClick() {}
124
+ };
125
+ MoreButton.propTypes = {
126
+ /** 按鈕主色系顏色 */
127
+ primaryColor: PropTypes.string,
128
+ /** 按鈕次色系顏色 */
129
+ secondaryColor: PropTypes.string,
130
+ /** 按鈕影子顏色 */
131
+ shadowColor: PropTypes.string,
132
+ /** 展開是否為小圖示 */
133
+ small: PropTypes.bool,
134
+ /** 是否啟動陰影模式 */
135
+ enableShadow: PropTypes.bool,
136
+ /** 客製化自己的大圖標 */
137
+ customExpandIcon: PropTypes.node,
138
+ /** 是否展開(僅有在small=true作動) */
139
+ expand: PropTypes.bool,
140
+ /** 語系翻譯的formateMessag(useIntl) */
141
+ formatMessage: PropTypes.func,
142
+ /** 設定是否展開 */
143
+ setExpand: PropTypes.func,
144
+ /** 點擊的callback */
145
+ onClick: PropTypes.func
146
+ };
147
+
148
+ export { MoreButton as M };
@@ -0,0 +1,8 @@
1
+ export { M as default } from './MoreButton-493f7c82.js';
2
+ import './_rollupPluginBabelHelpers-a52356f6.js';
3
+ import 'react';
4
+ import 'prop-types';
5
+ import './index-b76a85f4.js';
6
+ import '@material-ui/icons';
7
+ import './globalConfig';
8
+ import './style-inject.es-1f59c1d0.js';