@daoyi/nmtl-ui 2.0.1-beta.131 → 2.0.1-beta.133

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 (28) hide show
  1. package/lib/components/{Autocomplete-3b418e5f.js → Autocomplete-0ea4a31c.js} +3 -3
  2. package/lib/components/Autocomplete.js +4 -4
  3. package/lib/components/BackTop.js +2 -2
  4. package/lib/components/{ContactModal-eaed02b8.js → ContactModal-159de99c.js} +5 -5
  5. package/lib/components/ContactModal.js +6 -6
  6. package/lib/components/Drawer-a5be9257.js +245 -0
  7. package/lib/components/Drawer.js +6 -5
  8. package/lib/components/Footer.js +6 -6
  9. package/lib/components/Header.js +17 -12
  10. package/lib/components/{KeywordSearch-fec33a2c.js → KeywordSearch-db9c45d9.js} +1 -1
  11. package/lib/components/KeywordSearch.js +5 -5
  12. package/lib/components/Keywords.js +2 -2
  13. package/lib/components/MUITheme.js +2 -2
  14. package/lib/components/Pagination.js +5 -5
  15. package/lib/components/SegmentedControl-81f63afc.js +113 -0
  16. package/lib/components/SegmentedControl.js +11 -0
  17. package/lib/components/{Select-cb3e1ba1.js → Select-89841c71.js} +3 -3
  18. package/lib/components/Select.js +4 -4
  19. package/lib/components/{createSvgIcon-e3803ee1.js → createSvgIcon-dc603596.js} +1 -1
  20. package/lib/components/{defaultTheme-ed7746fe.js → defaultTheme-c5dd0f64.js} +1 -1
  21. package/lib/components/globalConfig.js +6 -0
  22. package/lib/components/{toConsumableArray-dbe8af76.js → toConsumableArray-c268c112.js} +1 -1
  23. package/lib/components/{useTheme-d16d02d9.js → useTheme-98b6cf17.js} +1 -1
  24. package/lib/components/{withTheme-2d778133.js → withTheme-3486f38b.js} +1 -1
  25. package/lib/index.d.ts +1 -0
  26. package/lib/index.js +1 -0
  27. package/package.json +7 -1
  28. package/lib/components/Drawer-629e59c7.js +0 -176
@@ -6,10 +6,10 @@ import { d as debounce_1 } from './debounce-127da66c.js';
6
6
  import { Autocomplete as Autocomplete$1 } from '@material-ui/lab';
7
7
  import { Chip, TextField, CircularProgress } from '@material-ui/core';
8
8
  import { Close, SearchOutlined } from '@material-ui/icons';
9
- import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
10
- import { _ as _extends, m as merge, d as defaultTheme, c as compose, b as borders, a as display, f as flexbox, g as grid, p as positions, e as palette, h as boxShadow, s as sizing, i as spacing, t as typography } from './defaultTheme-ed7746fe.js';
9
+ import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-dc603596.js';
10
+ import { _ as _extends, m as merge, d as defaultTheme, c as compose, b as borders, a as display, f as flexbox, g as grid, p as positions, e as palette, h as boxShadow, s as sizing, i as spacing, t as typography } from './defaultTheme-c5dd0f64.js';
11
11
  import 'react-is';
12
- import { _ as _toConsumableArray } from './toConsumableArray-dbe8af76.js';
12
+ import { _ as _toConsumableArray } from './toConsumableArray-c268c112.js';
13
13
  import { styled as styled$1 } from '@material-ui/styles';
14
14
  import { getIntl } from './globalConfig';
15
15
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
@@ -1,4 +1,4 @@
1
- export { A as default } from './Autocomplete-3b418e5f.js';
1
+ export { A as default } from './Autocomplete-0ea4a31c.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
@@ -9,12 +9,12 @@ import './_commonjsHelpers-70de2c37.js';
9
9
  import '@material-ui/lab';
10
10
  import '@material-ui/core';
11
11
  import '@material-ui/icons';
12
- import './createSvgIcon-e3803ee1.js';
13
- import './defaultTheme-ed7746fe.js';
12
+ import './createSvgIcon-dc603596.js';
13
+ import './defaultTheme-c5dd0f64.js';
14
14
  import 'react-is';
15
15
  import '@material-ui/styles';
16
16
  import 'react-dom';
17
- import './toConsumableArray-dbe8af76.js';
17
+ import './toConsumableArray-c268c112.js';
18
18
  import './globalConfig';
19
19
  import './style-inject.es-1f59c1d0.js';
20
20
  import './Empty-c6a44967.js';
@@ -4,12 +4,12 @@ import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
5
  import { d as debounce_1 } from './debounce-127da66c.js';
6
6
  import { Fade, NoSsr, Box } from '@material-ui/core';
7
- import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
7
+ import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-dc603596.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
  import './isObjectLike-e111475d.js';
11
11
  import './_commonjsHelpers-70de2c37.js';
12
- import './defaultTheme-ed7746fe.js';
12
+ import './defaultTheme-c5dd0f64.js';
13
13
  import 'react-is';
14
14
  import '@material-ui/styles';
15
15
  import 'react-dom';
@@ -2,21 +2,21 @@ import { _ as _extends$1, a as _slicedToArray$2, b as _objectSpread2, e as _defi
2
2
  import React__default, { createContext, forwardRef, createElement, useContext, useRef, useEffect, useReducer, useCallback, useMemo, useLayoutEffect, useState, useImperativeHandle, Fragment } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import './hoist-non-react-statics.cjs-3f408ad2.js';
5
- import './defaultTheme-ed7746fe.js';
5
+ import './defaultTheme-c5dd0f64.js';
6
6
  import 'react-is';
7
7
  import '@material-ui/styles';
8
- import { u as useTheme } from './useTheme-d16d02d9.js';
9
- import './withTheme-2d778133.js';
8
+ import { u as useTheme } from './useTheme-98b6cf17.js';
9
+ import './withTheme-3486f38b.js';
10
10
  import axios from 'axios';
11
11
  import { M as Modal } from './Modal-e04532fa.js';
12
12
  import { c as commonjsGlobal, a as getDefaultExportFromCjs } from './_commonjsHelpers-70de2c37.js';
13
13
  import { c as classNames } from './index-b76a85f4.js';
14
14
  import { Input, IconButton, Button, Box, Typography, FormControl, RadioGroup, FormControlLabel, Radio, TextField, TextareaAutosize } from '@material-ui/core';
15
- import { S as Select } from './Select-cb3e1ba1.js';
15
+ import { S as Select } from './Select-89841c71.js';
16
16
  import { VolumeUp } from '@material-ui/icons';
17
17
  import { getIntl } from './globalConfig';
18
18
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
19
- import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
19
+ import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-dc603596.js';
20
20
 
21
21
  var isArray$1 = Array.isArray;
22
22
  var keyList = Object.keys;
@@ -1,13 +1,13 @@
1
- export { C as default } from './ContactModal-eaed02b8.js';
1
+ export { C as default } from './ContactModal-159de99c.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
5
  import './hoist-non-react-statics.cjs-3f408ad2.js';
6
6
  import 'react-is';
7
- import './defaultTheme-ed7746fe.js';
7
+ import './defaultTheme-c5dd0f64.js';
8
8
  import '@material-ui/styles';
9
- import './useTheme-d16d02d9.js';
10
- import './withTheme-2d778133.js';
9
+ import './useTheme-98b6cf17.js';
10
+ import './withTheme-3486f38b.js';
11
11
  import 'axios';
12
12
  import './Modal-e04532fa.js';
13
13
  import './index-b76a85f4.js';
@@ -18,7 +18,7 @@ import './style-inject.es-1f59c1d0.js';
18
18
  import './Spin-8f87eadc.js';
19
19
  import './globalConfig';
20
20
  import './_commonjsHelpers-70de2c37.js';
21
- import './Select-cb3e1ba1.js';
21
+ import './Select-89841c71.js';
22
22
  import './Empty-c6a44967.js';
23
- import './createSvgIcon-e3803ee1.js';
23
+ import './createSvgIcon-dc603596.js';
24
24
  import 'react-dom';
@@ -0,0 +1,245 @@
1
+ import { _ as _extends, a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
+ import React__default, { useState } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { List, ListItem, ListItemIcon, ListItemText, IconButton, Drawer as Drawer$1, Divider } from '@material-ui/core';
5
+ import { DehazeRounded, CloseRounded } from '@material-ui/icons';
6
+ import { S as Select } from './Select-89841c71.js';
7
+ import { S as SegmentedControl } from './SegmentedControl-81f63afc.js';
8
+ import { useRouteMatch, NavLink } from 'react-router-dom';
9
+ import { getIntl } from './globalConfig';
10
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
11
+
12
+ var defaultSupportLanguage = [
13
+ // { value: 'en', label: 'English' },
14
+ {
15
+ value: 'zh-tw',
16
+ label: '繁體中文'
17
+ }
18
+ // { value: 'zh-cn', label: '簡體中文' },
19
+ ];
20
+
21
+ /* [檢查-語系]本系統是否支援該語系 並回傳語系 */
22
+ var checkLanguageSupport = function checkLanguageSupport(_ref) {
23
+ var language = _ref.language,
24
+ supportLanguages = _ref.supportLanguages;
25
+ var isSupport = supportLanguages.some(function (_ref2) {
26
+ var value = _ref2.value;
27
+ return value === language;
28
+ });
29
+ return isSupport ? language : supportLanguages[0].value;
30
+ };
31
+
32
+ /* 抽屜內的主選單:與桌機頁首一致用真連結(可長按另開、讀屏唸「連結」)。
33
+ * 保留 MUI List/ListItem/ListItemText 結構:各站以主題或 app.scss 覆蓋了這些 class
34
+ * (ada 的 MuiList 深底白字、tahl 的 hover 色),換成自訂標記會讓那些樣式失效。
35
+ * - ListItem 以 NavLink 渲染成 <a href>;目前所在頁由 NavLink 自動加 aria-current="page",
36
+ * 並掛上 Mui-selected(沿用各站既有的選中底色)與 drawer__link--active(左側色條+粗體)
37
+ * - ButtonBase 對非 <button> 元件會補 role="button",須明確清掉,否則讀屏仍唸成按鈕 */
38
+ const DrawerList = _ref => {
39
+ let {
40
+ drawerList,
41
+ setOpen
42
+ } = _ref;
43
+ const {
44
+ url
45
+ } = useRouteMatch();
46
+ return /*#__PURE__*/React__default.createElement("nav", null, /*#__PURE__*/React__default.createElement(List, {
47
+ className: "drawer__list"
48
+ }, Array.isArray(drawerList) && drawerList.map((_ref2, index) => {
49
+ let {
50
+ name,
51
+ icon,
52
+ path = ''
53
+ } = _ref2;
54
+ const internalProps = {
55
+ component: NavLink,
56
+ to: `${url}${path}`,
57
+ activeClassName: 'Mui-selected drawer__link--active'
58
+ };
59
+ /* 外部連結比照桌機頁首另開新視窗,並預先提示(WCAG 3.2.2) */
60
+ const externalProps = {
61
+ component: 'a',
62
+ href: path,
63
+ target: '_blank',
64
+ rel: 'noopener noreferrer',
65
+ 'aria-label': `${name}${getIntl().formatMessage({
66
+ id: 'aria.newWindow'
67
+ })}`
68
+ };
69
+ const linkProps = path.indexOf('http') > -1 ? externalProps : internalProps;
70
+ return /*#__PURE__*/React__default.createElement("li", {
71
+ key: index.toString()
72
+ }, /*#__PURE__*/React__default.createElement(ListItem, _extends({
73
+ button: true,
74
+ className: "drawer__link",
75
+ role: undefined,
76
+ onClick: () => setOpen(false)
77
+ }, linkProps), icon && /*#__PURE__*/React__default.createElement(ListItemIcon, {
78
+ style: {
79
+ marginRight: 24
80
+ }
81
+ }, icon), /*#__PURE__*/React__default.createElement(ListItemText, {
82
+ primary: name
83
+ })));
84
+ })));
85
+ };
86
+ DrawerList.defaultProps = {};
87
+ DrawerList.propTypes = {
88
+ drawerList: PropTypes.arrayOf(PropTypes.any).isRequired,
89
+ setOpen: PropTypes.func.isRequired
90
+ };
91
+
92
+ var css_248z = "@charset \"UTF-8\";\n/* 抽屜內容統一靠左對齊在同一條線上(選單文字、工具區標籤都從 1.5rem 起排) */\n.drawer {\n /* 兩層 class 提高權重,蓋過 MUI 主題注入的 .MuiIconButton-root */\n /* ListItem(渲染成 <a>)。hover/選中底色沿用 MUI 與各站主題的 MuiListItem、Mui-selected 設定 */\n /* 目前所在頁:左側色條+粗體,不只靠底色(WCAG 1.4.1)。\n 色條畫在文字元素上取 currentColor:各站常以 !important 改抽屜文字色(ada 白字、tahl 藍綠),\n 色條才會與文字同色;ListItem 本身是 position:relative,色條貼齊整列左緣 */\n /* 語系超過 3 種時退回下拉:撐滿工具區寬度 */\n}\n.drawer__icon {\n display: none !important;\n}\n.drawer__paper {\n width: 20rem;\n max-width: 90vw;\n /* 開啟時 MUI 把焦點放在紙面本身(tabindex=-1 的容器,非操作元件),不畫焦點框;\n 須 !important 才蓋得過各站 a11y.scss 的全域 :focus-visible */\n}\n.drawer__paper:focus {\n outline: none !important;\n}\n.drawer__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n padding: 0.75rem 0.5rem 0.75rem 1.5rem;\n}\n.drawer__header-brand {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n.drawer__header-title {\n font-size: 1.125rem;\n font-weight: bold;\n}\n.drawer__header .drawer__close {\n flex-shrink: 0;\n /* 觸控目標 48px(WCAG 2.5.5):共用主題把 IconButton padding 改成 8(只剩 40px),\n 部分子站手機版又把根字級縮到 70%,故用 px 保底 */\n min-width: 48px;\n min-height: 48px;\n margin-left: auto;\n /* 深色主題(palette.type=dark,如 ada、tahl)的 IconButton 預設白色,在淺色抽屜上看不見 → 沿用抽屜文字色 */\n color: inherit;\n}\n.drawer__header .drawer__close.Mui-focusVisible {\n outline: 2px solid currentColor;\n}\n.drawer__list > li {\n list-style: none;\n}\n.drawer__list .drawer__link {\n /* 觸控目標 48px(WCAG 2.5.5) */\n min-height: 3rem;\n /* 文字與工具區標籤對齊 1.5rem(蓋過 MuiListItem-gutters 的 16px) */\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n color: inherit;\n text-decoration: none;\n /* 連結撐滿抽屜寬度,紙面又會捲動(overflow:auto),外凸的焦點框左右會被裁掉 → 內縮完整框。\n 各站 a11y.scss 的全域 :focus-visible 以 !important 設 outline-offset,這裡也須 !important 才蓋得過 */\n}\n.drawer__list .drawer__link:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: -4px !important;\n}\n.drawer__link--active .MuiTypography-root {\n font-weight: 700;\n}\n.drawer__link--active .MuiTypography-root::before {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 0.25rem;\n background: currentColor;\n}\n.drawer__tools {\n display: flex;\n flex-direction: column;\n gap: 1.25rem;\n padding: 1.25rem 1.5rem;\n}\n.drawer__lang.select {\n width: 100%;\n}\n\n@media screen and (max-width: 768px) {\n .drawer {\n display: flex;\n justify-content: flex-end;\n }\n .drawer__icon {\n display: flex !important;\n }\n}";
93
+ styleInject(css_248z);
94
+
95
+ /* 語系不多時並排成分段按鈕(點一下即切換),太多才退回下拉 */
96
+ var MAX_SEGMENTED_LANGUAGES = 3;
97
+ var Drawer = function Drawer(_ref) {
98
+ var title = _ref.title,
99
+ logo = _ref.logo,
100
+ locale = _ref.locale,
101
+ supportLanguages = _ref.supportLanguages,
102
+ drawerList = _ref.drawerList,
103
+ onLanguageChange = _ref.onLanguageChange,
104
+ languageSelectLabel = _ref.languageSelectLabel,
105
+ extraTools = _ref.extraTools;
106
+ var _useState = useState(false),
107
+ _useState2 = _slicedToArray(_useState, 2),
108
+ open = _useState2[0],
109
+ setOpen = _useState2[1];
110
+ var languages = Array.isArray(supportLanguages) ? supportLanguages : [];
111
+ var currentLanguage = languages.length > 0 ? checkLanguageSupport({
112
+ language: locale,
113
+ supportLanguages: languages
114
+ }) : undefined;
115
+ /* extraTools 可傳函式,依擺放位置(header/drawer)給不同版面 */
116
+ var tools = typeof extraTools === 'function' ? extraTools({
117
+ placement: 'drawer'
118
+ }) : extraTools;
119
+ return /*#__PURE__*/React__default.createElement("div", {
120
+ className: "drawer"
121
+ }, /*#__PURE__*/React__default.createElement(IconButton, {
122
+ className: "drawer__icon",
123
+ "aria-label": getIntl().formatMessage({
124
+ id: 'aria.header.menuOpen'
125
+ }),
126
+ "aria-haspopup": "dialog",
127
+ "aria-expanded": open,
128
+ onClick: function onClick() {
129
+ return setOpen(true);
130
+ }
131
+ }, /*#__PURE__*/React__default.createElement(DehazeRounded, {
132
+ fontSize: "large",
133
+ "aria-hidden": "true"
134
+ })), /*#__PURE__*/React__default.createElement(Drawer$1, {
135
+ anchor: "right",
136
+ open: open,
137
+ onClose: function onClose() {
138
+ return setOpen(false);
139
+ },
140
+ onKeyDown: function onKeyDown(event) {
141
+ if (event.key === 'Escape') setOpen(false);
142
+ }
143
+ /* 抽屜是強制回應的浮層(背景不可操作),以 dialog 語意讓讀屏在開啟時唸出名稱(WCAG 4.1.2) */,
144
+ PaperProps: {
145
+ className: 'drawer__paper',
146
+ role: 'dialog',
147
+ 'aria-modal': true,
148
+ 'aria-label': getIntl().formatMessage({
149
+ id: 'aria.header.navigation'
150
+ })
151
+ }
152
+ }, /*#__PURE__*/React__default.createElement("div", {
153
+ className: "drawer__header"
154
+ }, (logo || title) && /*#__PURE__*/React__default.createElement("div", {
155
+ className: "drawer__header-brand"
156
+ }, logo && /*#__PURE__*/React__default.createElement("div", {
157
+ className: "drawer__header-logo"
158
+ }, logo), title && /*#__PURE__*/React__default.createElement("div", {
159
+ className: "drawer__header-title"
160
+ }, title)), /*#__PURE__*/React__default.createElement(IconButton, {
161
+ className: "drawer__close",
162
+ "aria-label": getIntl().formatMessage({
163
+ id: 'aria.header.menuClose'
164
+ }),
165
+ onClick: function onClick() {
166
+ return setOpen(false);
167
+ }
168
+ }, /*#__PURE__*/React__default.createElement(CloseRounded, {
169
+ "aria-hidden": "true"
170
+ }))), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(DrawerList, {
171
+ drawerList: (Array.isArray(drawerList) ? drawerList : []).filter(function (_ref2) {
172
+ var showInHeader = _ref2.showInHeader;
173
+ return showInHeader;
174
+ }),
175
+ setOpen: setOpen
176
+ }), (languages.length > 0 || tools) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement("div", {
177
+ className: "drawer__tools"
178
+ }, languages.length > 0 && languages.length <= MAX_SEGMENTED_LANGUAGES && /*#__PURE__*/React__default.createElement(SegmentedControl, {
179
+ className: "drawer__lang",
180
+ label: getIntl().formatMessage({
181
+ id: 'header.language'
182
+ }),
183
+ options: languages.map(function (_ref3) {
184
+ var value = _ref3.value,
185
+ label = _ref3.label,
186
+ lang = _ref3.lang;
187
+ return {
188
+ value: value,
189
+ label: label,
190
+ lang: lang
191
+ };
192
+ }),
193
+ value: currentLanguage,
194
+ onChange: function onChange(value) {
195
+ return onLanguageChange(value);
196
+ }
197
+ }), languages.length > MAX_SEGMENTED_LANGUAGES && /*#__PURE__*/React__default.createElement(Select, {
198
+ className: "drawer__lang",
199
+ ariaLabel: languageSelectLabel || getIntl().formatMessage({
200
+ id: 'aria.header.languageSelect'
201
+ }),
202
+ defaultValue: currentLanguage,
203
+ onChange: function onChange(value) {
204
+ return onLanguageChange(value);
205
+ },
206
+ options: languages
207
+ }), tools && /*#__PURE__*/React__default.createElement("div", {
208
+ className: "drawer__extraTools"
209
+ }, tools)))));
210
+ };
211
+ Drawer.defaultProps = {
212
+ title: undefined,
213
+ logo: undefined,
214
+ locale: undefined,
215
+ supportLanguages: [
216
+ // { value: 'en', label: 'English' },
217
+ {
218
+ value: 'zh-tw',
219
+ label: '繁體中文'
220
+ }
221
+ // { value: 'zh-cn', label: '簡體中文' },
222
+ ],
223
+
224
+ drawerList: undefined,
225
+ onLanguageChange: function onLanguageChange() {},
226
+ languageSelectLabel: undefined,
227
+ extraTools: undefined
228
+ };
229
+ Drawer.propTypes = {
230
+ title: PropTypes.string,
231
+ logo: PropTypes.node,
232
+ /** 目前語系(決定語言切換鈕的選中狀態) */
233
+ locale: PropTypes.string,
234
+ /** 支援的語系;3 種以內並排成分段按鈕,超過改用下拉 */
235
+ supportLanguages: PropTypes.arrayOf(PropTypes.any),
236
+ drawerList: PropTypes.arrayOf(PropTypes.any),
237
+ onLanguageChange: PropTypes.func,
238
+ /** 語言下拉的無障礙名稱(WCAG 3.3.2);未提供時使用套件內 aria.header.languageSelect */
239
+ languageSelectLabel: PropTypes.string,
240
+ /** 呼叫端自訂的工具區(如字級縮放);由 Header 一併傳入,窄畫面時顯示於抽屜內。
241
+ 傳函式時以 ({ placement: 'drawer' }) 呼叫,可給抽屜專用的版面 */
242
+ extraTools: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
243
+ };
244
+
245
+ export { Drawer as D, checkLanguageSupport as c, defaultSupportLanguage as d };
@@ -1,17 +1,18 @@
1
- export { D as default } from './Drawer-629e59c7.js';
1
+ export { D as default } from './Drawer-a5be9257.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
5
  import '@material-ui/core';
6
6
  import '@material-ui/icons';
7
- import './Select-cb3e1ba1.js';
7
+ import './Select-89841c71.js';
8
8
  import './index-b76a85f4.js';
9
- import './defaultTheme-ed7746fe.js';
9
+ import './defaultTheme-c5dd0f64.js';
10
10
  import 'react-is';
11
11
  import '@material-ui/styles';
12
- import './useTheme-d16d02d9.js';
13
- import './withTheme-2d778133.js';
12
+ import './useTheme-98b6cf17.js';
13
+ import './withTheme-3486f38b.js';
14
14
  import './Empty-c6a44967.js';
15
15
  import './style-inject.es-1f59c1d0.js';
16
16
  import './globalConfig';
17
+ import './SegmentedControl-81f63afc.js';
17
18
  import 'react-router-dom';
@@ -3,24 +3,24 @@ import React__default, { useState, useEffect } from 'react';
3
3
  import { c as classNames } from './index-b76a85f4.js';
4
4
  import PropTypes from 'prop-types';
5
5
  import axios from 'axios';
6
- import { C as ContactModal } from './ContactModal-eaed02b8.js';
6
+ import { C as ContactModal } from './ContactModal-159de99c.js';
7
7
  import { S as Spin } from './Spin-8f87eadc.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
  import './hoist-non-react-statics.cjs-3f408ad2.js';
11
11
  import 'react-is';
12
- import './defaultTheme-ed7746fe.js';
12
+ import './defaultTheme-c5dd0f64.js';
13
13
  import '@material-ui/styles';
14
- import './useTheme-d16d02d9.js';
15
- import './withTheme-2d778133.js';
14
+ import './useTheme-98b6cf17.js';
15
+ import './withTheme-3486f38b.js';
16
16
  import './Modal-e04532fa.js';
17
17
  import '@material-ui/core';
18
18
  import '@material-ui/icons';
19
19
  import './Button-7bd5aa09.js';
20
20
  import './_commonjsHelpers-70de2c37.js';
21
- import './Select-cb3e1ba1.js';
21
+ import './Select-89841c71.js';
22
22
  import './Empty-c6a44967.js';
23
- import './createSvgIcon-e3803ee1.js';
23
+ import './createSvgIcon-dc603596.js';
24
24
  import 'react-dom';
25
25
 
26
26
  /* eslint-disable max-len */
@@ -6,25 +6,26 @@ import { d as debounce_1 } from './debounce-127da66c.js';
6
6
  import { useHistory, useRouteMatch, NavLink } from 'react-router-dom';
7
7
  import { Typography, IconButton } from '@material-ui/core';
8
8
  import { SearchOutlined } from '@material-ui/icons';
9
- import { K as KeywordSearch } from './KeywordSearch-fec33a2c.js';
10
- import { S as Select } from './Select-cb3e1ba1.js';
11
- import { c as checkLanguageSupport, D as Drawer, d as defaultSupportLanguage } from './Drawer-629e59c7.js';
9
+ import { K as KeywordSearch } from './KeywordSearch-db9c45d9.js';
10
+ import { S as Select } from './Select-89841c71.js';
11
+ import { c as checkLanguageSupport, D as Drawer, d as defaultSupportLanguage } from './Drawer-a5be9257.js';
12
12
  import { getIntl } from './globalConfig';
13
13
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
14
14
  import './isObjectLike-e111475d.js';
15
15
  import './_commonjsHelpers-70de2c37.js';
16
16
  import 'axios';
17
- import './Autocomplete-3b418e5f.js';
17
+ import './Autocomplete-0ea4a31c.js';
18
18
  import '@material-ui/lab';
19
- import './createSvgIcon-e3803ee1.js';
20
- import './defaultTheme-ed7746fe.js';
19
+ import './createSvgIcon-dc603596.js';
20
+ import './defaultTheme-c5dd0f64.js';
21
21
  import 'react-is';
22
22
  import '@material-ui/styles';
23
23
  import 'react-dom';
24
- import './toConsumableArray-dbe8af76.js';
24
+ import './toConsumableArray-c268c112.js';
25
25
  import './Empty-c6a44967.js';
26
- import './useTheme-d16d02d9.js';
27
- import './withTheme-2d778133.js';
26
+ import './useTheme-98b6cf17.js';
27
+ import './withTheme-3486f38b.js';
28
+ import './SegmentedControl-81f63afc.js';
28
29
 
29
30
  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 /* 呼叫端自訂工具區(如字級縮放):與語系選單同屬右側工具列 */\n}\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 text-decoration: none;\n}\n.header__logo__img {\n display: flex;\n align-items: center;\n}\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}\n.header__links {\n display: flex;\n justify-content: flex-end;\n padding-right: 14px;\n}\n.header__links a {\n text-decoration: none;\n}\n.header__links--full {\n flex: 1;\n}\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}\n.header__links__item--active .header__links__item {\n font-weight: 800 !important;\n background: transparent;\n border-radius: 45px;\n}\n.header__links__item:hover {\n font-weight: 800 !important;\n}\n.header__language {\n min-width: 100px !important;\n}\n.header__extraTools {\n display: flex;\n align-items: center;\n margin-right: 8px;\n}\n.header__searchIcon {\n display: none !important;\n}\n@media screen and (max-width: 768px) {\n .header--smallUseSearchIcon .header__searchIcon {\n display: flex !important;\n margin-right: 10px !important;\n }\n .header--smallUseSearchIcon .keywordSearch {\n visibility: hidden;\n flex: 1;\n width: 0;\n }\n}\n.header--hide {\n top: -100px;\n}\n.header--focus .header__links {\n display: none;\n}\n.header .MuiTypography-root {\n width: 100%;\n display: flex;\n align-items: center;\n}\n.header .autocomplete {\n float: right;\n}\n.header .autocomplete .MuiAutocomplete-inputRoot[class*=MuiOutlinedInput-root] {\n padding: 1px 8px !important;\n}\n.header .keywordSearch {\n margin-right: 8px;\n}\n.header .keywordSearch--focus .autocomplete {\n width: 100% !important;\n}\n.header .keywordSearch--animation .autocomplete {\n width: 240px;\n transition: width 0.3s ease-in-out;\n}\n\n/* 避免寬度460以下炸版 */\n@media screen and (max-width: 460px) {\n .header .keywordSearch--animation .autocomplete {\n width: 100%;\n }\n}\n@media screen and (max-width: 768px) {\n .header {\n padding: 12px 15px !important;\n /* 窄畫面比照語系選單收進抽屜,避免擠壓搜尋框 */\n }\n .header__logo {\n margin-right: 16px !important;\n }\n .header__logo__title {\n display: none !important;\n }\n .header__links {\n display: none;\n }\n .header__links__item {\n font-size: 1rem !important;\n }\n .header__language {\n display: none !important;\n }\n .header__extraTools {\n display: none !important;\n }\n .header--focus .header__logo {\n display: none !important;\n }\n\n .autocomplete__icon {\n display: none !important;\n }\n}";
30
31
  styleInject(css_248z);
@@ -152,7 +153,9 @@ var Header = function Header(props) {
152
153
  "aria-hidden": "true"
153
154
  })), showDarkModeSwitch , extraTools && /*#__PURE__*/React__default.createElement("div", {
154
155
  className: "header__extraTools"
155
- }, extraTools), Array.isArray(supportLanguages) && supportLanguages.length > 0 && /*#__PURE__*/React__default.createElement(Select, {
156
+ }, typeof extraTools === 'function' ? extraTools({
157
+ placement: 'header'
158
+ }) : extraTools), Array.isArray(supportLanguages) && supportLanguages.length > 0 && /*#__PURE__*/React__default.createElement(Select, {
156
159
  className: "header__language",
157
160
  ariaLabel: languageSelectLabel || getIntl().formatMessage({
158
161
  id: 'aria.header.languageSelect'
@@ -168,6 +171,7 @@ var Header = function Header(props) {
168
171
  }), /*#__PURE__*/React__default.createElement(Drawer, {
169
172
  title: title,
170
173
  logo: logo,
174
+ locale: locale,
171
175
  drawerList: pages,
172
176
  supportLanguages: supportLanguages,
173
177
  onLanguageChange: onLanguageChange,
@@ -226,8 +230,9 @@ Header.propTypes = {
226
230
  onSearchIconClick: PropTypes.func,
227
231
  /** 語言下拉的無障礙名稱(WCAG 3.3.2);未提供時使用套件內 aria.header.languageSelect */
228
232
  languageSelectLabel: PropTypes.string,
229
- /** 呼叫端自訂的工具區(如字級縮放):寬畫面顯示於語系選單之前,窄畫面隨語系一起收進抽屜 */
230
- extraTools: PropTypes.node
233
+ /** 呼叫端自訂的工具區(如字級縮放):寬畫面顯示於語系選單之前,窄畫面隨語系一起收進抽屜。
234
+ 傳函式時以 ({ placement: 'header' | 'drawer' }) 呼叫,可依位置給不同版面 */
235
+ extraTools: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
231
236
  };
232
237
 
233
238
  export { Header as default };
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
5
  import axios from 'axios';
6
6
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
- import { A as Autocomplete } from './Autocomplete-3b418e5f.js';
7
+ import { A as Autocomplete } from './Autocomplete-0ea4a31c.js';
8
8
 
9
9
  var css_248z = ".keywordSearch {\n border-radius: 4px;\n width: 100%;\n margin-right: 14px;\n}\n.keywordSearch--animation .autocomplete {\n transition: max-width 0.3s ease-out;\n max-width: 240px;\n}\n.keywordSearch--focus {\n flex: 1;\n}\n.keywordSearch--focus .autocomplete {\n max-width: 100%;\n}\n.keywordSearch .MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon .MuiAutocomplete-inputRoot[class*=MuiOutlinedInput-root] {\n border-radius: 10px;\n background-color: #ffffff66;\n}";
10
10
  styleInject(css_248z);
@@ -1,22 +1,22 @@
1
- export { K as default } from './KeywordSearch-fec33a2c.js';
1
+ export { K as default } from './KeywordSearch-db9c45d9.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
5
  import './index-b76a85f4.js';
6
6
  import 'axios';
7
7
  import './style-inject.es-1f59c1d0.js';
8
- import './Autocomplete-3b418e5f.js';
8
+ import './Autocomplete-0ea4a31c.js';
9
9
  import './debounce-127da66c.js';
10
10
  import './isObjectLike-e111475d.js';
11
11
  import './_commonjsHelpers-70de2c37.js';
12
12
  import '@material-ui/lab';
13
13
  import '@material-ui/core';
14
14
  import '@material-ui/icons';
15
- import './createSvgIcon-e3803ee1.js';
16
- import './defaultTheme-ed7746fe.js';
15
+ import './createSvgIcon-dc603596.js';
16
+ import './defaultTheme-c5dd0f64.js';
17
17
  import 'react-is';
18
18
  import '@material-ui/styles';
19
19
  import 'react-dom';
20
- import './toConsumableArray-dbe8af76.js';
20
+ import './toConsumableArray-c268c112.js';
21
21
  import './globalConfig';
22
22
  import './Empty-c6a44967.js';
@@ -4,14 +4,14 @@ import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
5
  import { M as Modal } from './Modal-e04532fa.js';
6
6
  import { Typography } from '@material-ui/core';
7
- import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
7
+ import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-dc603596.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
  import '@material-ui/icons';
11
11
  import './Button-7bd5aa09.js';
12
12
  import './Spin-8f87eadc.js';
13
13
  import './_commonjsHelpers-70de2c37.js';
14
- import './defaultTheme-ed7746fe.js';
14
+ import './defaultTheme-c5dd0f64.js';
15
15
  import 'react-is';
16
16
  import '@material-ui/styles';
17
17
  import 'react-dom';
@@ -2,10 +2,10 @@ import React__default from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { a as _baseGetTag, b as isObject_1, _ as _root, i as isObjectLike_1, c as _freeGlobal } from './isObjectLike-e111475d.js';
4
4
  import { CssBaseline } from '@material-ui/core';
5
- import { u as createTheme } from './defaultTheme-ed7746fe.js';
5
+ import { v as createTheme } from './defaultTheme-c5dd0f64.js';
6
6
  import 'react-is';
7
7
  import { ThemeProvider } from '@material-ui/styles';
8
- import './withTheme-2d778133.js';
8
+ import './withTheme-3486f38b.js';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
  import './_commonjsHelpers-70de2c37.js';
11
11
 
@@ -2,13 +2,13 @@ import { c as _objectWithoutProperties$1, a as _slicedToArray$1 } from './_rollu
2
2
  import * as React$2 from 'react';
3
3
  import React__default, { Children, isValidElement, cloneElement, useState, useRef, useEffect } from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import { k as _objectWithoutProperties, o as _slicedToArray, _ as _extends, q as _objectWithoutPropertiesLoose, r as alpha, j as formatMuiErrorMessage } from './defaultTheme-ed7746fe.js';
6
- import { u as useControlled, c as clsx, b as useEventCallback, w as withStyles, d as useIsFocusVisible, e as useForkRef, f as createSvgIcon, g as capitalize, h as debounce, r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
5
+ import { k as _objectWithoutProperties, q as _slicedToArray, _ as _extends, r as _objectWithoutPropertiesLoose, u as alpha, j as formatMuiErrorMessage } from './defaultTheme-c5dd0f64.js';
6
+ import { u as useControlled, c as clsx, b as useEventCallback, w as withStyles, d as useIsFocusVisible, e as useForkRef, f as createSvgIcon, g as capitalize, h as debounce, r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-dc603596.js';
7
7
  import 'react-is';
8
8
  import '@material-ui/styles';
9
- import './withTheme-2d778133.js';
10
- import { _ as _toConsumableArray } from './toConsumableArray-dbe8af76.js';
11
- import { u as useTheme } from './useTheme-d16d02d9.js';
9
+ import './withTheme-3486f38b.js';
10
+ import { _ as _toConsumableArray } from './toConsumableArray-c268c112.js';
11
+ import { u as useTheme } from './useTheme-98b6cf17.js';
12
12
  import * as ReactDOM from 'react-dom';
13
13
  import ReactDOM__default from 'react-dom';
14
14
  import { c as classNames } from './index-b76a85f4.js';
@@ -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-b76a85f4.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-81f63afc.js';
2
+ import './_rollupPluginBabelHelpers-a52356f6.js';
3
+ import 'react';
4
+ import 'prop-types';
5
+ import './index-b76a85f4.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';
@@ -3,11 +3,11 @@ import React__default, { useRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
5
  import { FormControl, Select as Select$1, CircularProgress, MenuItem } from '@material-ui/core';
6
- import './defaultTheme-ed7746fe.js';
6
+ import './defaultTheme-c5dd0f64.js';
7
7
  import 'react-is';
8
8
  import '@material-ui/styles';
9
- import { u as useTheme } from './useTheme-d16d02d9.js';
10
- import './withTheme-2d778133.js';
9
+ import { u as useTheme } from './useTheme-98b6cf17.js';
10
+ import './withTheme-3486f38b.js';
11
11
  import { E as Empty } from './Empty-c6a44967.js';
12
12
  import { getIntl } from './globalConfig';
13
13
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
@@ -1,14 +1,14 @@
1
- export { S as default } from './Select-cb3e1ba1.js';
1
+ export { S as default } from './Select-89841c71.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
5
  import './index-b76a85f4.js';
6
6
  import '@material-ui/core';
7
- import './defaultTheme-ed7746fe.js';
7
+ import './defaultTheme-c5dd0f64.js';
8
8
  import 'react-is';
9
9
  import '@material-ui/styles';
10
- import './useTheme-d16d02d9.js';
11
- import './withTheme-2d778133.js';
10
+ import './useTheme-98b6cf17.js';
11
+ import './withTheme-3486f38b.js';
12
12
  import './Empty-c6a44967.js';
13
13
  import './style-inject.es-1f59c1d0.js';
14
14
  import './globalConfig';
@@ -1,5 +1,5 @@
1
1
  import { g as getAugmentedNamespace } from './_commonjsHelpers-70de2c37.js';
2
- import { j as formatMuiErrorMessage, _ as _extends, d as defaultTheme, k as _objectWithoutProperties } from './defaultTheme-ed7746fe.js';
2
+ import { j as formatMuiErrorMessage, _ as _extends, d as defaultTheme, k as _objectWithoutProperties } from './defaultTheme-c5dd0f64.js';
3
3
  import 'prop-types';
4
4
  import 'react-is';
5
5
  import * as React from 'react';
@@ -1658,4 +1658,4 @@ function createTheme() {
1658
1658
 
1659
1659
  var defaultTheme = createTheme();
1660
1660
 
1661
- export { _extends as _, display as a, borders as b, compose as c, defaultTheme as d, palette as e, flexbox as f, grid as g, boxShadow as h, spacing as i, formatMuiErrorMessage as j, _objectWithoutProperties as k, _arrayLikeToArray as l, merge as m, _unsupportedIterableToArray as n, _slicedToArray as o, positions as p, _objectWithoutPropertiesLoose as q, alpha as r, sizing as s, typography as t, createTheme as u };
1661
+ export { _extends as _, display as a, borders as b, compose as c, defaultTheme as d, palette as e, flexbox as f, grid as g, boxShadow as h, spacing as i, formatMuiErrorMessage as j, _objectWithoutProperties as k, _arrayLikeToArray as l, merge as m, _unsupportedIterableToArray as n, getContrastRatio as o, positions as p, _slicedToArray as q, _objectWithoutPropertiesLoose as r, sizing as s, typography as t, alpha as u, createTheme as v };
@@ -59,6 +59,8 @@ var zhtw = {
59
59
  "common.sna.reset": "回到原來位置與大小",
60
60
  "aria.header.searchOpen": "開啟搜尋",
61
61
  "aria.header.menuOpen": "開啟主選單",
62
+ "aria.header.menuClose": "關閉主選單",
63
+ "header.language": "語言",
62
64
  "aria.header.logoHome": "回首頁",
63
65
  "aria.header.logoHomeWithTitle": "{title},回首頁",
64
66
  "aria.header.navigation": "主選單",
@@ -184,6 +186,8 @@ var zhcn = {
184
186
  "common.form.errorSummary": "表单有 {count} 个字段需要修正,点击下列项目可前往该字段:",
185
187
  "aria.header.searchOpen": "开启搜寻",
186
188
  "aria.header.menuOpen": "开启主选单",
189
+ "aria.header.menuClose": "关闭主选单",
190
+ "header.language": "语言",
187
191
  "aria.header.logoHome": "回首页",
188
192
  "aria.header.logoHomeWithTitle": "{title},回首页",
189
193
  "aria.header.navigation": "主选单",
@@ -311,6 +315,8 @@ var enus = {
311
315
  "common.form.errorSummary": "{count} field(s) need to be corrected. Select an item below to go to that field:",
312
316
  "aria.header.searchOpen": "Open search",
313
317
  "aria.header.menuOpen": "Open main menu",
318
+ "aria.header.menuClose": "Close main menu",
319
+ "header.language": "Language",
314
320
  "aria.header.logoHome": "Back to home",
315
321
  "aria.header.logoHomeWithTitle": "{title}, back to home",
316
322
  "aria.header.navigation": "Main menu",
@@ -1,4 +1,4 @@
1
- import { l as _arrayLikeToArray, n as _unsupportedIterableToArray } from './defaultTheme-ed7746fe.js';
1
+ import { l as _arrayLikeToArray, n as _unsupportedIterableToArray } from './defaultTheme-c5dd0f64.js';
2
2
 
3
3
  function _arrayWithoutHoles(arr) {
4
4
  if (Array.isArray(arr)) return _arrayLikeToArray(arr);
@@ -1,6 +1,6 @@
1
1
  import { useTheme as useTheme$1 } from '@material-ui/styles';
2
2
  import 'react';
3
- import { d as defaultTheme } from './defaultTheme-ed7746fe.js';
3
+ import { d as defaultTheme } from './defaultTheme-c5dd0f64.js';
4
4
 
5
5
  function useTheme() {
6
6
  var theme = useTheme$1() || defaultTheme;
@@ -1,5 +1,5 @@
1
1
  import { withThemeCreator } from '@material-ui/styles';
2
- import { d as defaultTheme } from './defaultTheme-ed7746fe.js';
2
+ import { d as defaultTheme } from './defaultTheme-c5dd0f64.js';
3
3
 
4
4
  withThemeCreator({
5
5
  defaultTheme: defaultTheme
package/lib/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export { default as SNA } from './components/SNA';
23
23
  export { default as BarChart } from './components/BarChart';
24
24
  export { default as ForwardLink } from './components/ForwardLink';
25
25
  export { default as Pagination } from './components/Pagination';
26
+ export { default as SegmentedControl } from './components/SegmentedControl';
26
27
 
27
28
  export { default as ContactModal } from './components/ContactModal';
28
29
  export { default as KeywordSearch } from './components/KeywordSearch';
package/lib/index.js CHANGED
@@ -23,6 +23,7 @@ export { default as SNA } from './components/SNA';
23
23
  export { default as BarChart } from './components/BarChart';
24
24
  export { default as ForwardLink } from './components/ForwardLink';
25
25
  export { default as Pagination } from './components/Pagination';
26
+ export { default as SegmentedControl } from './components/SegmentedControl';
26
27
 
27
28
  export { default as ContactModal } from './components/ContactModal';
28
29
  export { default as KeywordSearch } from './components/KeywordSearch';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@daoyi/nmtl-ui",
3
3
  "packageManager": "pnpm@10.34.5",
4
- "version": "2.0.1-beta.131",
4
+ "version": "2.0.1-beta.133",
5
5
  "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
6
6
  "author": "daoyi",
7
7
  "main": "lib/index.js",
@@ -123,6 +123,12 @@
123
123
  "pub-alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
124
124
  "pub-beta": "npm version prerelease --preid=beta && npm publish --tag beta"
125
125
  },
126
+ "volta": {
127
+ "node": "24.20.0"
128
+ },
129
+ "engines": {
130
+ "node": "24.x"
131
+ },
126
132
  "pnpm": {
127
133
  "onlyBuiltDependencies": [
128
134
  "core-js",
@@ -1,176 +0,0 @@
1
- import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
- import React__default, { useState } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { List, ListItem, ListItemIcon, ListItemText, IconButton, Drawer as Drawer$1, Divider } from '@material-ui/core';
5
- import { DehazeRounded } from '@material-ui/icons';
6
- import { S as Select } from './Select-cb3e1ba1.js';
7
- import { useHistory, useRouteMatch } from 'react-router-dom';
8
- import { getIntl } from './globalConfig';
9
- import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
-
11
- var defaultSupportLanguage = [
12
- // { value: 'en', label: 'English' },
13
- {
14
- value: 'zh-tw',
15
- label: '繁體中文'
16
- }
17
- // { value: 'zh-cn', label: '簡體中文' },
18
- ];
19
-
20
- /* [檢查-語系]本系統是否支援該語系 並回傳語系 */
21
- var checkLanguageSupport = function checkLanguageSupport(_ref) {
22
- var language = _ref.language,
23
- supportLanguages = _ref.supportLanguages;
24
- var isSupport = supportLanguages.some(function (_ref2) {
25
- var value = _ref2.value;
26
- return value === language;
27
- });
28
- return isSupport ? language : supportLanguages[0].value;
29
- };
30
-
31
- const DrawerList = _ref => {
32
- let {
33
- drawerList,
34
- setOpen
35
- } = _ref;
36
- const history = useHistory();
37
- const {
38
- url
39
- } = useRouteMatch();
40
- return /*#__PURE__*/React__default.createElement(List, {
41
- className: "drawer__list"
42
- }, Array.isArray(drawerList) && drawerList.map((_ref2, index) => {
43
- let {
44
- name,
45
- icon,
46
- path
47
- } = _ref2;
48
- return /*#__PURE__*/React__default.createElement(ListItem, {
49
- button: true,
50
- key: index.toString(),
51
- onClick: () => {
52
- if (path.indexOf('http') > -1) {
53
- window.location = path;
54
- } else {
55
- history.push({
56
- pathname: `${url}${path}`
57
- });
58
- }
59
- setOpen(false);
60
- }
61
- }, icon && /*#__PURE__*/React__default.createElement(ListItemIcon, {
62
- style: {
63
- marginRight: 24
64
- }
65
- }, icon), /*#__PURE__*/React__default.createElement(ListItemText, {
66
- primary: name
67
- }));
68
- }));
69
- };
70
- DrawerList.defaultProps = {};
71
- DrawerList.propTypes = {
72
- drawerList: PropTypes.arrayOf(PropTypes.any).isRequired,
73
- setOpen: PropTypes.func.isRequired
74
- };
75
-
76
- var css_248z = "@charset \"UTF-8\";\n.drawer__icon {\n display: none !important;\n}\n.drawer__header {\n display: flex;\n align-items: center;\n padding: 20px;\n}\n.drawer__header-title {\n font-size: 1.125rem;\n font-weight: bold;\n}\n.drawer__list {\n padding: 10px !important;\n}\n.drawer__list .MuiSvgIcon-root {\n margin-left: 8px;\n}\n.drawer__lang {\n margin: 24px 36px !important;\n}\n\n@media screen and (max-width: 768px) {\n .drawer {\n display: flex;\n justify-content: flex-end;\n }\n .drawer__icon {\n display: flex !important;\n }\n}\n/* 呼叫端自訂工具區(如字級縮放):窄畫面時由 Header 收進抽屜 */\n.drawer__extraTools {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n}";
77
- styleInject(css_248z);
78
-
79
- var Drawer = function Drawer(_ref) {
80
- var title = _ref.title,
81
- logo = _ref.logo,
82
- locale = _ref.locale,
83
- supportLanguages = _ref.supportLanguages,
84
- drawerList = _ref.drawerList,
85
- onLanguageChange = _ref.onLanguageChange,
86
- languageSelectLabel = _ref.languageSelectLabel,
87
- extraTools = _ref.extraTools;
88
- var _useState = useState(false),
89
- _useState2 = _slicedToArray(_useState, 2),
90
- open = _useState2[0],
91
- setOpen = _useState2[1];
92
- return /*#__PURE__*/React__default.createElement("div", {
93
- className: "drawer"
94
- }, /*#__PURE__*/React__default.createElement(IconButton, {
95
- className: "drawer__icon",
96
- "aria-label": getIntl().formatMessage({
97
- id: 'aria.header.menuOpen'
98
- }),
99
- "aria-haspopup": "menu",
100
- "aria-expanded": open,
101
- onClick: function onClick() {
102
- return setOpen(true);
103
- }
104
- }, /*#__PURE__*/React__default.createElement(DehazeRounded, {
105
- fontSize: "large",
106
- "aria-hidden": "true"
107
- })), /*#__PURE__*/React__default.createElement(Drawer$1, {
108
- anchor: "right",
109
- open: open,
110
- onClose: function onClose() {
111
- return setOpen(false);
112
- },
113
- onKeyDown: function onKeyDown(event) {
114
- if (event.key === 'Escape') setOpen(false);
115
- }
116
- }, (logo || title) && /*#__PURE__*/React__default.createElement("div", {
117
- className: "drawer__header"
118
- }, /*#__PURE__*/React__default.createElement("div", {
119
- className: "drawer__header-logo"
120
- }, logo), /*#__PURE__*/React__default.createElement("div", {
121
- className: "drawer__header-title"
122
- }, title)), /*#__PURE__*/React__default.createElement(Divider, null), /*#__PURE__*/React__default.createElement(DrawerList, {
123
- drawerList: (Array.isArray(drawerList) ? drawerList : []).filter(function (_ref2) {
124
- var showInHeader = _ref2.showInHeader;
125
- return showInHeader;
126
- }),
127
- setOpen: setOpen
128
- }), /*#__PURE__*/React__default.createElement(Divider, null), Array.isArray(supportLanguages) && supportLanguages.length > 0 && /*#__PURE__*/React__default.createElement(Select, {
129
- className: "drawer__lang",
130
- ariaLabel: languageSelectLabel || getIntl().formatMessage({
131
- id: 'aria.header.languageSelect'
132
- }),
133
- defaultValue: checkLanguageSupport({
134
- language: locale,
135
- supportLanguages: supportLanguages
136
- }),
137
- onChange: function onChange(value) {
138
- return onLanguageChange(value);
139
- },
140
- options: supportLanguages
141
- }), extraTools && /*#__PURE__*/React__default.createElement("div", {
142
- className: "drawer__extraTools"
143
- }, extraTools)));
144
- };
145
- Drawer.defaultProps = {
146
- title: undefined,
147
- logo: undefined,
148
- locale: undefined,
149
- supportLanguages: [
150
- // { value: 'en', label: 'English' },
151
- {
152
- value: 'zh-tw',
153
- label: '繁體中文'
154
- }
155
- // { value: 'zh-cn', label: '簡體中文' },
156
- ],
157
-
158
- drawerList: undefined,
159
- onLanguageChange: function onLanguageChange() {},
160
- languageSelectLabel: undefined,
161
- extraTools: undefined
162
- };
163
- Drawer.propTypes = {
164
- title: PropTypes.string,
165
- logo: PropTypes.node,
166
- locale: PropTypes.string,
167
- supportLanguages: PropTypes.arrayOf(PropTypes.any),
168
- drawerList: PropTypes.arrayOf(PropTypes.any),
169
- onLanguageChange: PropTypes.func,
170
- /** 語言下拉的無障礙名稱(WCAG 3.3.2);未提供時使用套件內 aria.header.languageSelect */
171
- languageSelectLabel: PropTypes.string,
172
- /** 呼叫端自訂的工具區(如字級縮放);由 Header 一併傳入,窄畫面時顯示於抽屜內 */
173
- extraTools: PropTypes.node
174
- };
175
-
176
- export { Drawer as D, checkLanguageSupport as c, defaultSupportLanguage as d };