@daoyi/nmtl-ui 2.0.1-beta.14 → 2.0.1-beta.141
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-e40d7145.js +494 -0
- package/lib/components/Autocomplete.js +20 -1
- package/lib/components/Avatar.js +59 -1
- package/lib/components/BackTop.js +124 -1
- package/lib/components/BarChart.js +764 -1
- package/lib/components/Breadcrumbs.js +146 -1
- package/lib/components/Button-8cf35bc0.js +114 -0
- package/lib/components/Button.js +7 -1
- package/lib/components/Carousel.js +4654 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +235 -1
- package/lib/components/ContactModal-af7fa280.js +12295 -0
- package/lib/components/ContactModal.js +24 -3
- package/lib/components/Drawer-b770014f.js +247 -0
- package/lib/components/Drawer.js +18 -1
- package/lib/components/Dropdown.js +134 -1
- package/lib/components/Empty-48685dd0.js +46 -0
- package/lib/components/Empty.js +5 -1
- package/lib/components/ExportButton.js +128 -1
- package/lib/components/ExtraTools-c46c1965.js +3676 -0
- package/lib/components/ExtraTools.js +11 -22
- package/lib/components/Filter.js +821 -12
- package/lib/components/Footer.js +317 -1
- package/lib/components/ForwardLink-2905563c.js +184 -0
- package/lib/components/ForwardLink.js +10 -0
- package/lib/components/Header.js +267 -1
- package/lib/components/Image.js +61 -1
- package/lib/components/Input.js +89 -1
- package/lib/components/InputMethod.js +33937 -10
- package/lib/components/KeywordSearch-4e621ded.js +156 -0
- package/lib/components/KeywordSearch.js +22 -1
- package/lib/components/KeywordTicker.js +224 -1
- package/lib/components/Keywords.js +383 -1
- package/lib/components/Loading.js +32 -1
- package/lib/components/MUITheme.js +2657 -1
- package/lib/components/Modal-aa77d4d8.js +171 -0
- package/lib/components/Modal.js +11 -1
- package/lib/components/MoreButton-0b5aaef3.js +148 -0
- package/lib/components/MoreButton.js +8 -1
- package/lib/components/Pagination.js +3702 -0
- package/lib/components/Radio.js +83 -1
- package/lib/components/SNA.js +1755 -22
- package/lib/components/SegmentedControl-804da0a6.js +113 -0
- package/lib/components/SegmentedControl.js +11 -0
- package/lib/components/Select-979f7e73.js +189 -0
- package/lib/components/Select.js +14 -1
- package/lib/components/Spin-07679812.js +79 -0
- package/lib/components/Spin.js +7 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-bbbaa9c7.js +70 -0
- package/lib/components/Tooltip.js +7 -1
- package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
- package/lib/components/_rollupPluginBabelHelpers-a52356f6.js +142 -0
- package/lib/components/createSvgIcon-370e163a.js +576 -0
- package/lib/components/dataExport-a9e3fae1.js +91 -0
- package/lib/components/debounce-127da66c.js +355 -0
- package/lib/components/defaultTheme-c5dd0f64.js +1661 -0
- package/lib/components/globalConfig.js +474 -0
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
- package/lib/components/index-c33afcb5.js +61 -0
- package/lib/components/index-ff95f719.js +481 -0
- package/lib/components/isObjectLike-e111475d.js +190 -0
- package/lib/components/style-inject.es-1f59c1d0.js +28 -1
- package/lib/components/toConsumableArray-c268c112.js +19 -0
- package/lib/components/transform-849a452c.js +5475 -0
- package/lib/components/useTheme-98b6cf17.js +11 -0
- package/lib/components/withTheme-3486f38b.js +6 -0
- package/lib/configs/config.selector.js +151 -0
- package/lib/configs/index.d.ts +1 -0
- package/lib/configs/index.js +1 -0
- package/lib/index.d.ts +6 -1
- package/lib/index.js +6 -1
- package/lib/utils/_rollupPluginBabelHelpers-9802e640.js +121 -0
- package/lib/utils/arrayMerge.js +4953 -1
- package/lib/utils/chunkArray.js +15 -1
- package/lib/utils/convert2HtmlEntities.js +57 -1
- package/lib/utils/domToImage.js +802 -1
- package/lib/utils/downloadGephi.js +106 -1
- package/lib/utils/exportXlsx.js +221 -1
- package/lib/utils/historyAppendSearch.js +502 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/isDevelopMode.js +5 -1
- package/lib/utils/newWindowHint-72ebfe3b.js +53 -0
- package/lib/utils/parseYMD.js +36 -1
- package/lib/utils/prepareTimelineData.js +100 -0
- package/lib/utils/removeDuplicateItem.js +11 -1
- package/lib/utils/sendEmail.js +39 -1
- package/lib/utils/snaDefine-6a2bcd94.js +5 -0
- package/lib/utils/snaDefine.js +1 -1
- package/lib/utils/snaPreProcess.js +84 -1
- package/lib/utils/syncTimelineA11y.js +327 -0
- package/package.json +141 -128
- package/lib/components/Empty-54b79907.js +0 -1
- package/lib/components/KeywordSearch-5a393f12.js +0 -1
- package/lib/components/Select-f2441b83.js +0 -1
- package/lib/components/_rollupPluginBabelHelpers-1b8c042f.js +0 -1
- package/lib/components/_rollupPluginBabelHelpers-ec4e2a53.js +0 -1
- package/lib/components/createSvgIcon-62b64929.js +0 -1
- package/lib/components/createSvgIcon-e24792d4.js +0 -1
- package/lib/components/createTheme-7fffa109.js +0 -1
- package/lib/components/dataExport-9fccd4f0.js +0 -1
- package/lib/components/debounce-c993109b.js +0 -1
- package/lib/components/hoist-non-react-statics.cjs-d6a9befd.js +0 -1
- package/lib/components/index-11391ca3.js +0 -7
- package/lib/components/index-b2745105.js +0 -7
- package/lib/components/isObjectLike-2f1983fe.js +0 -1
- package/lib/components/style-inject.es-c875d022.js +0 -1
- package/lib/components/transform-95ae0119.js +0 -1
- package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
- package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { b as _objectSpread2 } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import React__default, { useRef } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classNames } from './index-c33afcb5.js';
|
|
5
|
+
import { o as getContrastRatio } from './defaultTheme-c5dd0f64.js';
|
|
6
|
+
import 'react-is';
|
|
7
|
+
import '@material-ui/styles';
|
|
8
|
+
import { u as useTheme } from './useTheme-98b6cf17.js';
|
|
9
|
+
import './withTheme-3486f38b.js';
|
|
10
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
11
|
+
|
|
12
|
+
var css_248z = "@charset \"UTF-8\";\n.segmentedControl__label {\n display: block;\n margin-bottom: 0.5rem;\n font-size: 0.875rem;\n font-weight: 700;\n}\n.segmentedControl__group {\n display: flex;\n}\n.segmentedControl__btn {\n flex: 1 1 0;\n min-width: 0;\n /* 觸控目標 44px(WCAG 2.5.5) */\n min-height: 2.75rem;\n padding: 0.25rem 0.5rem;\n border: 1px solid;\n background: transparent;\n color: inherit;\n font-family: inherit;\n font-size: 1rem;\n line-height: 1.25;\n cursor: pointer;\n /* 相鄰框線疊成一條 */\n /* 焦點框顏色由元件以 outlineColor 給主題文字色;拉到上層避免被相鄰按鈕蓋住 */\n}\n.segmentedControl__btn + .segmentedControl__btn {\n margin-left: -1px;\n}\n.segmentedControl__btn:first-child {\n border-radius: 4px 0 0 4px;\n}\n.segmentedControl__btn:last-child {\n border-radius: 0 4px 4px 0;\n}\n.segmentedControl__btn:hover {\n background: rgba(0, 0, 0, 0.04);\n}\n.segmentedControl__btn:focus-visible {\n position: relative;\n z-index: 1;\n outline-width: 2px;\n outline-style: solid;\n outline-offset: 2px;\n}\n.segmentedControl__btn--active {\n font-weight: 700;\n}";
|
|
13
|
+
styleInject(css_248z);
|
|
14
|
+
|
|
15
|
+
/* 每個實例需要唯一 id 才能做 aria-labelledby 串接 */
|
|
16
|
+
var segmentedSeq = 0;
|
|
17
|
+
|
|
18
|
+
/* 選中底色優先用主題主色(與站台色調一致);主色配字對比不足 4.5:1(WCAG 1.4.3)
|
|
19
|
+
或主色框線對紙張不足 3:1(WCAG 1.4.11)時,退回「文字色/紙張色」反白,對比必然足夠 */
|
|
20
|
+
var pickColors = function pickColors(_ref) {
|
|
21
|
+
var primary = _ref.primary,
|
|
22
|
+
text = _ref.text,
|
|
23
|
+
background = _ref.background;
|
|
24
|
+
var primaryOk = getContrastRatio(primary.main, primary.contrastText) >= 4.5 && getContrastRatio(primary.main, background.paper) >= 3;
|
|
25
|
+
return primaryOk ? {
|
|
26
|
+
fill: primary.main,
|
|
27
|
+
onFill: primary.contrastText
|
|
28
|
+
} : {
|
|
29
|
+
fill: text.primary,
|
|
30
|
+
onFill: background.paper
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/* 分段按鈕(少量互斥選項並排,點一下即切換,如抽屜內的語言、字級)。
|
|
35
|
+
* - 可見標籤即群組名稱:role="group" + aria-labelledby 指向標籤(WCAG 1.3.1/2.5.3)
|
|
36
|
+
* - 每個選項是切換鈕,以 aria-pressed 表達目前選中者(WCAG 4.1.2)
|
|
37
|
+
* - 選中態反白(配色見 pickColors),另加粗體,不只靠顏色區分(WCAG 1.4.1) */
|
|
38
|
+
var SegmentedControl = function SegmentedControl(_ref2) {
|
|
39
|
+
var className = _ref2.className,
|
|
40
|
+
label = _ref2.label,
|
|
41
|
+
options = _ref2.options,
|
|
42
|
+
value = _ref2.value,
|
|
43
|
+
onChange = _ref2.onChange;
|
|
44
|
+
var theme = useTheme();
|
|
45
|
+
var _pickColors = pickColors(theme.palette),
|
|
46
|
+
fill = _pickColors.fill,
|
|
47
|
+
onFill = _pickColors.onFill;
|
|
48
|
+
var labelIdRef = useRef(null);
|
|
49
|
+
if (!labelIdRef.current) {
|
|
50
|
+
segmentedSeq += 1;
|
|
51
|
+
labelIdRef.current = "nmtl-segmented-".concat(segmentedSeq, "-label");
|
|
52
|
+
}
|
|
53
|
+
var labelId = labelIdRef.current;
|
|
54
|
+
/* 框線、焦點框與選中底色同色(站台若有全域焦點樣式會以 !important 蓋過焦點框色,屬預期) */
|
|
55
|
+
var baseStyle = {
|
|
56
|
+
borderColor: fill,
|
|
57
|
+
outlineColor: fill
|
|
58
|
+
};
|
|
59
|
+
var activeStyle = _objectSpread2(_objectSpread2({}, baseStyle), {}, {
|
|
60
|
+
backgroundColor: fill,
|
|
61
|
+
color: onFill
|
|
62
|
+
});
|
|
63
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
64
|
+
className: classNames('segmentedControl', className)
|
|
65
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
66
|
+
id: labelId,
|
|
67
|
+
className: "segmentedControl__label"
|
|
68
|
+
}, label), /*#__PURE__*/React__default.createElement("div", {
|
|
69
|
+
className: "segmentedControl__group",
|
|
70
|
+
role: "group",
|
|
71
|
+
"aria-labelledby": labelId
|
|
72
|
+
}, options.map(function (option) {
|
|
73
|
+
var active = option.value === value;
|
|
74
|
+
return /*#__PURE__*/React__default.createElement("button", {
|
|
75
|
+
key: option.value,
|
|
76
|
+
type: "button",
|
|
77
|
+
className: classNames('segmentedControl__btn', {
|
|
78
|
+
'segmentedControl__btn--active': active
|
|
79
|
+
}),
|
|
80
|
+
"aria-pressed": active,
|
|
81
|
+
"aria-label": option.ariaLabel,
|
|
82
|
+
lang: option.lang,
|
|
83
|
+
style: active ? activeStyle : baseStyle,
|
|
84
|
+
onClick: function onClick() {
|
|
85
|
+
if (!active) onChange(option.value);
|
|
86
|
+
}
|
|
87
|
+
}, option.label);
|
|
88
|
+
})));
|
|
89
|
+
};
|
|
90
|
+
SegmentedControl.defaultProps = {
|
|
91
|
+
className: undefined,
|
|
92
|
+
value: undefined,
|
|
93
|
+
onChange: function onChange() {}
|
|
94
|
+
};
|
|
95
|
+
SegmentedControl.propTypes = {
|
|
96
|
+
/** Css Name */
|
|
97
|
+
className: PropTypes.string,
|
|
98
|
+
/** 可見標籤,同時作為群組的可及名稱 */
|
|
99
|
+
label: PropTypes.string.isRequired,
|
|
100
|
+
/** 選項:label 為可見文字;ariaLabel 在可見文字對讀屏沒有意義時提供(如 A+);lang 標示與頁面不同的語言 */
|
|
101
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
102
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
103
|
+
label: PropTypes.string.isRequired,
|
|
104
|
+
ariaLabel: PropTypes.string,
|
|
105
|
+
lang: PropTypes.string
|
|
106
|
+
})).isRequired,
|
|
107
|
+
/** 目前選中的值 */
|
|
108
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
109
|
+
/** 選擇其他選項時的 callback(點選已選中的選項不會觸發) */
|
|
110
|
+
onChange: PropTypes.func
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export { SegmentedControl as S };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { S as default } from './SegmentedControl-804da0a6.js';
|
|
2
|
+
import './_rollupPluginBabelHelpers-a52356f6.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'prop-types';
|
|
5
|
+
import './index-c33afcb5.js';
|
|
6
|
+
import './defaultTheme-c5dd0f64.js';
|
|
7
|
+
import 'react-is';
|
|
8
|
+
import '@material-ui/styles';
|
|
9
|
+
import './useTheme-98b6cf17.js';
|
|
10
|
+
import './withTheme-3486f38b.js';
|
|
11
|
+
import './style-inject.es-1f59c1d0.js';
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { b as _objectSpread2, d as _typeof } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import React__default, { useRef } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classNames } from './index-c33afcb5.js';
|
|
5
|
+
import { FormControl, Select as Select$1, CircularProgress, MenuItem } from '@material-ui/core';
|
|
6
|
+
import './defaultTheme-c5dd0f64.js';
|
|
7
|
+
import 'react-is';
|
|
8
|
+
import '@material-ui/styles';
|
|
9
|
+
import { u as useTheme } from './useTheme-98b6cf17.js';
|
|
10
|
+
import './withTheme-3486f38b.js';
|
|
11
|
+
import { E as Empty } from './Empty-48685dd0.js';
|
|
12
|
+
import { getIntl } from './globalConfig';
|
|
13
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
14
|
+
|
|
15
|
+
var css_248z = ".select .MuiSelect-nativeInput {\n visibility: hidden;\n}\n.select__placeholder {\n color: #6b6130;\n}\n.select--small {\n width: 100%;\n}\n.select--small .MuiSelect-root {\n padding: 0.5rem 1.5rem 0.25rem;\n color: white;\n}\n.select--small .MuiSelect-root .select__placeholder {\n color: white;\n}\n.select--small .MuiSelect-root:hover, .select--small .MuiSelect-root:focus {\n background: transparent;\n}\n.select--small .MuiSvgIcon-root {\n color: white;\n}\n.select--small .MuiOutlinedInput-root {\n border-radius: 45px;\n}";
|
|
16
|
+
styleInject(css_248z);
|
|
17
|
+
|
|
18
|
+
/* 視覺隱藏的可及名稱容器(不依賴各站的 .visually-hidden) */
|
|
19
|
+
var hiddenLabelStyle = {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
width: 1,
|
|
22
|
+
height: 1,
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
25
|
+
whiteSpace: 'nowrap'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/* 每個 Select 實例需要唯一 id 才能做 aria-labelledby 串接 */
|
|
29
|
+
var selectSeq = 0;
|
|
30
|
+
var Select = function Select(props) {
|
|
31
|
+
var style = props.style,
|
|
32
|
+
className = props.className,
|
|
33
|
+
labelInValue = props.labelInValue,
|
|
34
|
+
disabled = props.disabled,
|
|
35
|
+
loading = props.loading,
|
|
36
|
+
placeholder = props.placeholder,
|
|
37
|
+
variantSmall = props.variantSmall,
|
|
38
|
+
background = props.background,
|
|
39
|
+
menuItemClass = props.menuItemClass;
|
|
40
|
+
/* 未指定 placeholder 時走套件 i18n(原本寫死英文 'Please select...',
|
|
41
|
+
中文語系也照唸英文,走查回饋 5a) */
|
|
42
|
+
var placeholderText = placeholder === undefined ? getIntl().formatMessage({
|
|
43
|
+
id: 'common.select.placeholder'
|
|
44
|
+
}) : placeholder;
|
|
45
|
+
var options = props.options,
|
|
46
|
+
value = props.value,
|
|
47
|
+
defaultValue = props.defaultValue,
|
|
48
|
+
_onChange = props.onChange,
|
|
49
|
+
ariaLabel = props.ariaLabel,
|
|
50
|
+
ariaLabelledby = props.ariaLabelledby;
|
|
51
|
+
/* WCAG 1.4.3 提示字顏色依主題深淺自動選色:select.scss 的 #6b6130 只適用淺底,
|
|
52
|
+
深色主題(palette.type=dark,如 ocean 深色 Modal)需改亮灰(WAVE 實測「請輸入 年齡」被抓) */
|
|
53
|
+
var theme = useTheme();
|
|
54
|
+
var placeholderStyle = theme && theme.palette && theme.palette.type === 'dark' ? {
|
|
55
|
+
color: '#bdbdbd'
|
|
56
|
+
} : undefined;
|
|
57
|
+
var itemFind = function itemFind(key) {
|
|
58
|
+
return (options || []).find(function (option) {
|
|
59
|
+
return _typeof(option) === 'object' ? key === option.value : key === option;
|
|
60
|
+
}) || key;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/* WCAG 4.1.2/3.3.2 可及名稱=「這個選單是做什麼的」+「目前選了什麼」。
|
|
64
|
+
直接掛 aria-label 會整個蓋掉顯示層的選中值文字(讀屏只唸得出用途、唸不出選了誰),
|
|
65
|
+
故改採 MUI 原生作法:把用途文字放進視覺隱藏的 label 元素,
|
|
66
|
+
再以 aria-labelledby="<label id> <顯示層 id>" 串起來(走查回饋 5a)。 */
|
|
67
|
+
var uidRef = useRef(null);
|
|
68
|
+
if (!uidRef.current) {
|
|
69
|
+
selectSeq += 1;
|
|
70
|
+
uidRef.current = "nmtl-select-".concat(selectSeq);
|
|
71
|
+
}
|
|
72
|
+
var uid = uidRef.current;
|
|
73
|
+
var buttonId = "".concat(uid, "-value");
|
|
74
|
+
var useHiddenLabel = Boolean(ariaLabel) && !ariaLabelledby;
|
|
75
|
+
// eslint-disable-next-line no-nested-ternary
|
|
76
|
+
var labelledby = ariaLabelledby ? "".concat(ariaLabelledby, " ").concat(buttonId) : useHiddenLabel ? "".concat(uid, "-label ").concat(buttonId) : undefined;
|
|
77
|
+
return /*#__PURE__*/React__default.createElement(FormControl, {
|
|
78
|
+
className: classNames('select', {
|
|
79
|
+
'select--small': variantSmall
|
|
80
|
+
}, className),
|
|
81
|
+
variant: "outlined"
|
|
82
|
+
}, useHiddenLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
83
|
+
id: "".concat(uid, "-label"),
|
|
84
|
+
style: hiddenLabelStyle
|
|
85
|
+
}, ariaLabel), /*#__PURE__*/React__default.createElement(Select$1, {
|
|
86
|
+
style: _objectSpread2(_objectSpread2({}, style || {}), {}, {
|
|
87
|
+
background: background
|
|
88
|
+
}),
|
|
89
|
+
displayEmpty: true,
|
|
90
|
+
disabled: disabled || loading
|
|
91
|
+
// WCAG 3.3.2 可及名稱:未提供 ariaLabel/ariaLabelledby 時,顯示層(role=button)
|
|
92
|
+
// 以其文字內容(選中值/placeholder)為名稱;有提供時改為「用途 + 選中值」(見上方 labelledby)。
|
|
93
|
+
// 隱藏原生 input 由 select.scss 的 visibility:hidden 讓檢測工具略過,無需再標 label。
|
|
94
|
+
,
|
|
95
|
+
SelectDisplayProps: {
|
|
96
|
+
id: buttonId,
|
|
97
|
+
'aria-labelledby': labelledby
|
|
98
|
+
},
|
|
99
|
+
renderValue: function renderValue(id) {
|
|
100
|
+
var finder = itemFind(id);
|
|
101
|
+
var content = _typeof(finder) === 'object' ? finder.label : finder;
|
|
102
|
+
/* WCAG 3.1.2 局部語言:選項可帶 lang(如語言選單的「English」),顯示值同步標註 */
|
|
103
|
+
if (_typeof(finder) === 'object' && finder.lang) {
|
|
104
|
+
content = /*#__PURE__*/React__default.createElement("span", {
|
|
105
|
+
lang: finder.lang
|
|
106
|
+
}, content);
|
|
107
|
+
}
|
|
108
|
+
if (!id && id !== 0 || id.length === 0) {
|
|
109
|
+
content = /*#__PURE__*/React__default.createElement("span", {
|
|
110
|
+
className: "select__placeholder",
|
|
111
|
+
style: placeholderStyle
|
|
112
|
+
}, placeholderText);
|
|
113
|
+
}
|
|
114
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, content, loading && /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
115
|
+
size: 16,
|
|
116
|
+
style: {
|
|
117
|
+
marginLeft: 8,
|
|
118
|
+
marginRight: 4
|
|
119
|
+
}
|
|
120
|
+
}));
|
|
121
|
+
},
|
|
122
|
+
value: value,
|
|
123
|
+
defaultValue: defaultValue,
|
|
124
|
+
onChange: function onChange(event) {
|
|
125
|
+
return _onChange(labelInValue ? itemFind(event.target.value) : event.target.value);
|
|
126
|
+
}
|
|
127
|
+
}, Array.isArray(options) && options.length > 0 ? options.map(function (option) {
|
|
128
|
+
var key = _typeof(option) === 'object' ? option.value : option;
|
|
129
|
+
var text = _typeof(option) === 'object' ? option.label : option;
|
|
130
|
+
var optionLang = _typeof(option) === 'object' ? option.lang : undefined;
|
|
131
|
+
return /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
132
|
+
key: key,
|
|
133
|
+
value: key,
|
|
134
|
+
lang: optionLang,
|
|
135
|
+
ListItemClasses: menuItemClass
|
|
136
|
+
}, text);
|
|
137
|
+
}) : /*#__PURE__*/React__default.createElement(Empty, null)));
|
|
138
|
+
};
|
|
139
|
+
Select.defaultProps = {
|
|
140
|
+
style: undefined,
|
|
141
|
+
className: undefined,
|
|
142
|
+
value: undefined,
|
|
143
|
+
defaultValue: undefined,
|
|
144
|
+
options: undefined,
|
|
145
|
+
labelInValue: undefined,
|
|
146
|
+
disabled: undefined,
|
|
147
|
+
loading: undefined,
|
|
148
|
+
placeholder: undefined,
|
|
149
|
+
variantSmall: undefined,
|
|
150
|
+
background: undefined,
|
|
151
|
+
menuItemClass: undefined,
|
|
152
|
+
onChange: function onChange() {},
|
|
153
|
+
ariaLabel: undefined,
|
|
154
|
+
ariaLabelledby: undefined
|
|
155
|
+
};
|
|
156
|
+
Select.propTypes = {
|
|
157
|
+
/** 樣式 */
|
|
158
|
+
style: PropTypes.objectOf(PropTypes.any),
|
|
159
|
+
/** Css Name */
|
|
160
|
+
className: PropTypes.string,
|
|
161
|
+
/** 選擇的id */
|
|
162
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
163
|
+
/** 預設選擇的id */
|
|
164
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
165
|
+
/** 下拉選單清單 */
|
|
166
|
+
options: PropTypes.arrayOf(PropTypes.any),
|
|
167
|
+
/** onChange時 label value 一起回傳 */
|
|
168
|
+
labelInValue: PropTypes.bool,
|
|
169
|
+
/** 是否禁止使用 */
|
|
170
|
+
disabled: PropTypes.bool,
|
|
171
|
+
/** 是否載入中 */
|
|
172
|
+
loading: PropTypes.bool,
|
|
173
|
+
/** 下拉選單提示字(不給則使用套件 i18n 的「請選擇…」) */
|
|
174
|
+
placeholder: PropTypes.string,
|
|
175
|
+
/** 是否使用小size */
|
|
176
|
+
variantSmall: PropTypes.bool,
|
|
177
|
+
/** 使用變體後的顏色 */
|
|
178
|
+
background: PropTypes.string,
|
|
179
|
+
/** override menuItem class */
|
|
180
|
+
menuItemClass: PropTypes.objectOf(PropTypes.any),
|
|
181
|
+
/** 點選後的返回 */
|
|
182
|
+
onChange: PropTypes.func,
|
|
183
|
+
/** 無障礙名稱(WCAG 3.3.2):說明「這個選單是做什麼的」,會與選中值一起被讀出 */
|
|
184
|
+
ariaLabel: PropTypes.string,
|
|
185
|
+
/** 以外部元素id作為無障礙名稱 */
|
|
186
|
+
ariaLabelledby: PropTypes.string
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export { Select as S };
|
package/lib/components/Select.js
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
export { S as default } from './Select-979f7e73.js';
|
|
2
|
+
import './_rollupPluginBabelHelpers-a52356f6.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'prop-types';
|
|
5
|
+
import './index-c33afcb5.js';
|
|
6
|
+
import '@material-ui/core';
|
|
7
|
+
import './defaultTheme-c5dd0f64.js';
|
|
8
|
+
import 'react-is';
|
|
9
|
+
import '@material-ui/styles';
|
|
10
|
+
import './useTheme-98b6cf17.js';
|
|
11
|
+
import './withTheme-3486f38b.js';
|
|
12
|
+
import './Empty-48685dd0.js';
|
|
13
|
+
import './style-inject.es-1f59c1d0.js';
|
|
14
|
+
import './globalConfig';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React__default, { useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { c as classNames } from './index-c33afcb5.js';
|
|
4
|
+
import { Fade, CircularProgress } from '@material-ui/core';
|
|
5
|
+
import { getIntl } from './globalConfig';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
7
|
+
|
|
8
|
+
var css_248z = ".customSpin {\n width: 100%;\n min-height: 100px;\n position: relative;\n}\n.customSpin__spin {\n width: 100%;\n height: 100%;\n position: absolute;\n z-index: 2;\n display: flex;\n justify-content: center;\n align-items: center;\n}";
|
|
9
|
+
styleInject(css_248z);
|
|
10
|
+
|
|
11
|
+
var stringSize = {
|
|
12
|
+
small: 16,
|
|
13
|
+
middle: 24,
|
|
14
|
+
large: 40
|
|
15
|
+
};
|
|
16
|
+
var Spin = function Spin(props) {
|
|
17
|
+
var className = props.className,
|
|
18
|
+
spinning = props.spinning,
|
|
19
|
+
children = props.children,
|
|
20
|
+
size = props.size,
|
|
21
|
+
style = props.style;
|
|
22
|
+
var maxValue = function maxValue(val) {
|
|
23
|
+
// 極大極小值限制 300/16
|
|
24
|
+
var min = val < 16 ? 16 : val;
|
|
25
|
+
var max = min > 300 ? 300 : min;
|
|
26
|
+
return max;
|
|
27
|
+
};
|
|
28
|
+
var matchSize = useMemo(function () {
|
|
29
|
+
if (typeof size === 'string') {
|
|
30
|
+
if (Number(size) && typeof Number(size) === 'number') {
|
|
31
|
+
return maxValue(Number(size));
|
|
32
|
+
}
|
|
33
|
+
return stringSize[size] || 40;
|
|
34
|
+
}
|
|
35
|
+
if (typeof size === 'number') {
|
|
36
|
+
return maxValue(size);
|
|
37
|
+
}
|
|
38
|
+
// default size is large
|
|
39
|
+
return 40;
|
|
40
|
+
}, [size]);
|
|
41
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
42
|
+
className: classNames('customSpin', className),
|
|
43
|
+
style: style || {}
|
|
44
|
+
}, /*#__PURE__*/React__default.createElement(Fade, {
|
|
45
|
+
in: spinning,
|
|
46
|
+
style: {
|
|
47
|
+
transitionDelay: '300ms'
|
|
48
|
+
},
|
|
49
|
+
unmountOnExit: true
|
|
50
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
51
|
+
className: "customSpin__spin"
|
|
52
|
+
}, /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
53
|
+
size: matchSize,
|
|
54
|
+
"aria-label": getIntl().formatMessage({
|
|
55
|
+
id: 'aria.loading'
|
|
56
|
+
})
|
|
57
|
+
}))), children);
|
|
58
|
+
};
|
|
59
|
+
Spin.defaultProps = {
|
|
60
|
+
className: undefined,
|
|
61
|
+
spinning: false,
|
|
62
|
+
children: null,
|
|
63
|
+
size: undefined,
|
|
64
|
+
style: undefined
|
|
65
|
+
};
|
|
66
|
+
Spin.propTypes = {
|
|
67
|
+
/** Css Name */
|
|
68
|
+
className: PropTypes.string,
|
|
69
|
+
/** 是否載入中 */
|
|
70
|
+
spinning: PropTypes.bool,
|
|
71
|
+
/** 內容 */
|
|
72
|
+
children: PropTypes.node,
|
|
73
|
+
/** 自訂尺寸 */
|
|
74
|
+
size: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(stringSize)), PropTypes.number]),
|
|
75
|
+
/** 自訂Style設置 */
|
|
76
|
+
style: PropTypes.objectOf(PropTypes.any)
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { Spin as S };
|
package/lib/components/Spin.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export { S as default } from './Spin-07679812.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'prop-types';
|
|
4
|
+
import './index-c33afcb5.js';
|
|
5
|
+
import '@material-ui/core';
|
|
6
|
+
import './globalConfig';
|
|
7
|
+
import './style-inject.es-1f59c1d0.js';
|
package/lib/components/Table.js
CHANGED
|
@@ -1 +1,51 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import { c as _objectWithoutProperties } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { TableContainer, Paper, Table as Table$1, TableHead, TableRow, TableCell, TableBody } from '@material-ui/core';
|
|
5
|
+
|
|
6
|
+
var _excluded = ["render"];
|
|
7
|
+
var Table = function Table(_ref) {
|
|
8
|
+
var className = _ref.className,
|
|
9
|
+
columns = _ref.columns,
|
|
10
|
+
data = _ref.data;
|
|
11
|
+
return /*#__PURE__*/React__default.createElement(TableContainer, {
|
|
12
|
+
className: className,
|
|
13
|
+
component: Paper
|
|
14
|
+
}, /*#__PURE__*/React__default.createElement(Table$1, {
|
|
15
|
+
className: "customTable"
|
|
16
|
+
}, /*#__PURE__*/React__default.createElement(TableHead, null, /*#__PURE__*/React__default.createElement(TableRow, null, Array.isArray(columns) && columns.map(function (_ref2) {
|
|
17
|
+
var field = _ref2.field,
|
|
18
|
+
headerName = _ref2.headerName;
|
|
19
|
+
return /*#__PURE__*/React__default.createElement(TableCell, {
|
|
20
|
+
key: field
|
|
21
|
+
}, headerName);
|
|
22
|
+
}))), /*#__PURE__*/React__default.createElement(TableBody, null, Array.isArray(data) && data.map(function (item, index) {
|
|
23
|
+
return /*#__PURE__*/React__default.createElement(TableRow, {
|
|
24
|
+
key: index.toString()
|
|
25
|
+
}, Array.isArray(columns) && columns.map(function (_ref3) {
|
|
26
|
+
var render = _ref3.render,
|
|
27
|
+
columnProps = _objectWithoutProperties(_ref3, _excluded);
|
|
28
|
+
var field = columnProps.field;
|
|
29
|
+
return /*#__PURE__*/React__default.createElement(TableCell, {
|
|
30
|
+
key: field,
|
|
31
|
+
component: "th",
|
|
32
|
+
scope: "row"
|
|
33
|
+
}, render && render(item) || item[field]);
|
|
34
|
+
}));
|
|
35
|
+
}))));
|
|
36
|
+
};
|
|
37
|
+
Table.defaultProps = {
|
|
38
|
+
className: undefined,
|
|
39
|
+
columns: [],
|
|
40
|
+
data: []
|
|
41
|
+
};
|
|
42
|
+
Table.propTypes = {
|
|
43
|
+
/** Css Name */
|
|
44
|
+
className: PropTypes.string,
|
|
45
|
+
/** 欄位列表 */
|
|
46
|
+
columns: PropTypes.arrayOf(PropTypes.any),
|
|
47
|
+
/** 表格內容 */
|
|
48
|
+
data: PropTypes.arrayOf(PropTypes.any)
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { Table as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Tooltip as Tooltip$1 } from '@material-ui/core';
|
|
4
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
5
|
+
import { c as classNames } from './index-c33afcb5.js';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
7
|
+
|
|
8
|
+
const TooltipContent = /*#__PURE__*/React__default.forwardRef((props, ref) => /*#__PURE__*/React__default.createElement("div", _extends({}, props, {
|
|
9
|
+
className: classNames('tooltip', props.className),
|
|
10
|
+
ref: ref
|
|
11
|
+
}), props.children));
|
|
12
|
+
TooltipContent.defaultProps = {
|
|
13
|
+
children: undefined,
|
|
14
|
+
className: undefined
|
|
15
|
+
};
|
|
16
|
+
TooltipContent.propTypes = {
|
|
17
|
+
children: PropTypes.node,
|
|
18
|
+
className: PropTypes.string
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var css_248z = ".tooltip {\n width: -moz-fit-content;\n width: fit-content;\n}";
|
|
22
|
+
styleInject(css_248z);
|
|
23
|
+
|
|
24
|
+
var placements = {
|
|
25
|
+
top: 'top',
|
|
26
|
+
left: 'left',
|
|
27
|
+
right: 'right',
|
|
28
|
+
bottom: 'bottom',
|
|
29
|
+
topLeft: 'top-start',
|
|
30
|
+
topRight: 'top-end',
|
|
31
|
+
bottomLeft: 'bottom-start',
|
|
32
|
+
bottomRight: 'bottom-end',
|
|
33
|
+
leftTop: 'left-start',
|
|
34
|
+
leftBottom: 'left-end',
|
|
35
|
+
rightTop: 'right-start',
|
|
36
|
+
rightBottom: 'right-end'
|
|
37
|
+
};
|
|
38
|
+
var Tooltip = function Tooltip(_ref) {
|
|
39
|
+
var title = _ref.title,
|
|
40
|
+
className = _ref.className,
|
|
41
|
+
placement = _ref.placement,
|
|
42
|
+
children = _ref.children;
|
|
43
|
+
return /*#__PURE__*/React__default.createElement(Tooltip$1, {
|
|
44
|
+
arrow: true,
|
|
45
|
+
title: title || '',
|
|
46
|
+
placement: placements[placement] || 'top'
|
|
47
|
+
}, /*#__PURE__*/React__default.createElement(TooltipContent, {
|
|
48
|
+
className: className
|
|
49
|
+
}, children));
|
|
50
|
+
};
|
|
51
|
+
Tooltip.defaultProps = {
|
|
52
|
+
className: undefined,
|
|
53
|
+
title: undefined,
|
|
54
|
+
children: 'Tooltip',
|
|
55
|
+
placement: undefined
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
59
|
+
Tooltip.propTypes = {
|
|
60
|
+
/** Css Name */
|
|
61
|
+
className: PropTypes.node,
|
|
62
|
+
/** 跳出的內容 */
|
|
63
|
+
title: PropTypes.node,
|
|
64
|
+
/** 子層 */
|
|
65
|
+
children: PropTypes.node,
|
|
66
|
+
/** 位置 */
|
|
67
|
+
placement: PropTypes.oneOf(Object.keys(placements))
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { Tooltip as T, placements as p };
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export { T as default, p as placements } from './Tooltip-bbbaa9c7.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'prop-types';
|
|
4
|
+
import '@material-ui/core';
|
|
5
|
+
import './_rollupPluginBabelHelpers-a52356f6.js';
|
|
6
|
+
import './index-c33afcb5.js';
|
|
7
|
+
import './style-inject.es-1f59c1d0.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
|
+
|
|
3
|
+
function getDefaultExportFromCjs (x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getAugmentedNamespace(n) {
|
|
8
|
+
var f = n.default;
|
|
9
|
+
if (typeof f == "function") {
|
|
10
|
+
var a = function () {
|
|
11
|
+
return f.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
a.prototype = f.prototype;
|
|
14
|
+
} else a = {};
|
|
15
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
16
|
+
Object.keys(n).forEach(function (k) {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
18
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return n[k];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return a;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { getDefaultExportFromCjs as a, commonjsGlobal as c, getAugmentedNamespace as g };
|