@daoyi/nmtl-ui 2.0.1-beta.96 → 2.0.1-beta.97

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.
@@ -3,7 +3,7 @@ import React__default, { createContext, forwardRef, createElement, useContext, u
3
3
  import PropTypes from 'prop-types';
4
4
  import { h as hoistNonReactStatics_cjs } from './hoist-non-react-statics.cjs-3f408ad2.js';
5
5
  import axios from 'axios';
6
- import { M as Modal } from './Modal-5a27951f.js';
6
+ import { M as Modal } from './Modal-777fe87d.js';
7
7
  import { c as commonjsGlobal, a as getDefaultExportFromCjs } from './_commonjsHelpers-70de2c37.js';
8
8
  import { c as classNames } from './index-b76a85f4.js';
9
9
  import { Input, Button, Box, Typography, FormControl, RadioGroup, FormControlLabel, Radio, TextField, TextareaAutosize } from '@material-ui/core';
@@ -11540,6 +11540,8 @@ function reducer(state, action) {
11540
11540
 
11541
11541
  const Upload = _ref => {
11542
11542
  let {
11543
+ ariaLabelledby,
11544
+ buttonText,
11543
11545
  onChange
11544
11546
  } = _ref;
11545
11547
  const fileRef = useRef(null);
@@ -11565,17 +11567,31 @@ const Upload = _ref => {
11565
11567
  className: "container"
11566
11568
  }, /*#__PURE__*/React__default.createElement("div", getRootProps({
11567
11569
  className: 'dropzone'
11568
- }), /*#__PURE__*/React__default.createElement("input", getInputProps()), /*#__PURE__*/React__default.createElement(Button, {
11570
+ }), /*#__PURE__*/React__default.createElement("input", getInputProps({
11571
+ 'aria-labelledby': ariaLabelledby
11572
+ })), /*#__PURE__*/React__default.createElement(Button, {
11569
11573
  variant: "contained",
11570
11574
  color: "default",
11571
- startIcon: /*#__PURE__*/React__default.createElement(default_1, null),
11575
+ startIcon: /*#__PURE__*/React__default.createElement(default_1, {
11576
+ "aria-hidden": "true"
11577
+ }),
11572
11578
  onClick: openDialog
11573
- }, "Upload")), /*#__PURE__*/React__default.createElement("aside", null, /*#__PURE__*/React__default.createElement("ul", null, acceptedFiles.map(file => /*#__PURE__*/React__default.createElement("li", {
11579
+ }, buttonText || 'Upload')), /*#__PURE__*/React__default.createElement("aside", null, /*#__PURE__*/React__default.createElement("ul", {
11580
+ "aria-live": "polite"
11581
+ }, acceptedFiles.map(file => /*#__PURE__*/React__default.createElement("li", {
11574
11582
  key: file.path
11575
11583
  }, file.path)))));
11576
11584
  });
11577
11585
  };
11586
+ Upload.defaultProps = {
11587
+ ariaLabelledby: undefined,
11588
+ buttonText: undefined
11589
+ };
11578
11590
  Upload.propTypes = {
11591
+ /** 欄位標題元素 id(aria-labelledby 關聯用) */
11592
+ ariaLabelledby: PropTypes.string,
11593
+ /** 觸發按鈕的可見文字(建議傳欄位標題,如「附件上傳」) */
11594
+ buttonText: PropTypes.string,
11579
11595
  onChange: PropTypes.func.isRequired
11580
11596
  };
11581
11597
 
@@ -11664,7 +11680,10 @@ const FormItem = _ref => {
11664
11680
  }, option.desc)))));
11665
11681
  break;
11666
11682
  case 'upload':
11683
+ /* WCAG 1.3.1/3.3.2 附件上傳:標題 id 關聯內部 file input;按鈕以欄位標題為可見文字(WAVE: Missing form label) */
11667
11684
  component = /*#__PURE__*/React__default.createElement(Upload, _extends$1({}, field, {
11685
+ ariaLabelledby: labelId,
11686
+ buttonText: label,
11668
11687
  onChange: files => setFieldValue(field.name, files)
11669
11688
  }));
11670
11689
  break;
@@ -11703,13 +11722,13 @@ const FormItem = _ref => {
11703
11722
  }, label, required && /*#__PURE__*/React__default.createElement("div", {
11704
11723
  className: "formItem__title__star",
11705
11724
  "aria-hidden": "true"
11706
- }, '*')) : /*#__PURE__*/React__default.createElement("div", {
11725
+ }, "*")) : /*#__PURE__*/React__default.createElement("div", {
11707
11726
  className: "formItem__title",
11708
11727
  id: labelId
11709
11728
  }, label, required && /*#__PURE__*/React__default.createElement("div", {
11710
11729
  className: "formItem__title__star",
11711
11730
  "aria-hidden": "true"
11712
- }, '*'))), hint && /*#__PURE__*/React__default.createElement(Box, {
11731
+ }, "*"))), hint && /*#__PURE__*/React__default.createElement(Box, {
11713
11732
  my: 1
11714
11733
  }, /*#__PURE__*/React__default.createElement(Typography, {
11715
11734
  variant: "body2"
@@ -1,11 +1,11 @@
1
- export { C as default } from './ContactModal-560b9bdd.js';
1
+ export { C as default } from './ContactModal-7427edd0.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
7
  import 'axios';
8
- import './Modal-5a27951f.js';
8
+ import './Modal-777fe87d.js';
9
9
  import './index-b76a85f4.js';
10
10
  import '@material-ui/core';
11
11
  import '@material-ui/icons';
@@ -3143,7 +3143,7 @@ const ResetMobileIcon = _ref => {
3143
3143
  })));
3144
3144
  };
3145
3145
 
3146
- var css_248z = ".extraTools {\n width: 100%;\n display: inline-flex;\n justify-content: flex-end;\n align-items: center;\n gap: 1rem;\n padding: 0px 20px;\n padding-top: 12px;\n}\n.extraTools__share button {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools__download {\n cursor: pointer;\n}\n.extraTools__download-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools__fullscreenBtn {\n cursor: pointer;\n padding-top: 0;\n}\n.extraTools__fullscreenBtn-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools__fontsize {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools .font-size-changer,\n.extraTools .font-size-changer-buttons,\n.extraTools .font-size-up,\n.extraTools .font-size-down,\n.extraTools .tooltip {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools .font-size-up {\n width: 32px !important;\n cursor: pointer;\n margin-right: 16px !important;\n}\n.extraTools .font-size-down {\n cursor: pointer;\n width: 32px !important;\n}\n.extraTools .fullscreenExit {\n text-align: right;\n cursor: pointer;\n border: 0;\n}\n.extraTools #download-menu .MuiMenuItem-root {\n color: #4e3a16;\n width: auto;\n overflow: hidden;\n font-size: 1rem;\n box-sizing: border-box;\n min-height: 48px;\n font-weight: 400;\n line-height: 1;\n padding-top: 1rem;\n white-space: initial;\n border-bottom: 0;\n letter-spacing: 0.00938em;\n padding-bottom: 1rem;\n}";
3146
+ var css_248z = ".extraTools {\n width: 100%;\n display: inline-flex;\n justify-content: flex-end;\n align-items: center;\n gap: 1rem;\n padding: 0px 20px;\n padding-top: 12px;\n}\n.extraTools__share button {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools__download {\n cursor: pointer;\n}\n.extraTools__download-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools__fullscreenBtn {\n cursor: pointer;\n padding-top: 0;\n}\n.extraTools__fullscreenBtn-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools__fontsize {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools .font-size-changer,\n.extraTools .font-size-changer-buttons,\n.extraTools .font-size-up,\n.extraTools .font-size-down,\n.extraTools .tooltip {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.extraTools .font-size-up {\n width: 32px !important;\n cursor: pointer;\n margin-right: 16px !important;\n}\n.extraTools .font-size-down {\n cursor: pointer;\n width: 32px !important;\n}\n.extraTools .font-size-up,\n.extraTools .font-size-down {\n height: 32px;\n line-height: 32px !important;\n}\n.extraTools .fullscreenExit {\n text-align: right;\n cursor: pointer;\n border: 0;\n}\n.extraTools #download-menu .MuiMenuItem-root {\n color: #4e3a16;\n width: auto;\n overflow: hidden;\n font-size: 1rem;\n box-sizing: border-box;\n min-height: 48px;\n font-weight: 400;\n line-height: 1;\n padding-top: 1rem;\n white-space: initial;\n border-bottom: 0;\n letter-spacing: 0.00938em;\n padding-bottom: 1rem;\n}";
3147
3147
  styleInject(css_248z);
3148
3148
 
3149
3149
  /* eslint-disable prefer-destructuring */
@@ -1,4 +1,4 @@
1
- export { E as default } from './ExtraTools-94eeda8d.js';
1
+ export { E as default } from './ExtraTools-8d2ef84d.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import './index-b76a85f4.js';
@@ -3,12 +3,12 @@ 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-560b9bdd.js';
6
+ import { C as ContactModal } from './ContactModal-7427edd0.js';
7
7
  import { S as Spin } from './Spin-8dc60bfe.js';
8
8
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
9
9
  import './hoist-non-react-statics.cjs-3f408ad2.js';
10
10
  import 'react-is';
11
- import './Modal-5a27951f.js';
11
+ import './Modal-777fe87d.js';
12
12
  import '@material-ui/core';
13
13
  import '@material-ui/icons';
14
14
  import './Button-305b69a0.js';
@@ -2,7 +2,7 @@ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
2
  import React__default, { useState, useEffect } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
- import { M as Modal } from './Modal-5a27951f.js';
5
+ import { M as Modal } from './Modal-777fe87d.js';
6
6
  import { Typography } from '@material-ui/core';
7
7
  import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
8
8
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
@@ -2386,6 +2386,21 @@ const defaultColors = {
2386
2386
  secondaryColor: '#ffc400'
2387
2387
  };
2388
2388
 
2389
+ /* WCAG 1.4.3:依背景色相對亮度自動選深/白前景(Dialog 標題列底色為各站 primaryColor,
2390
+ 淺色品牌(如 #9dc9da、#ECC651)配固定白字對比不足——WAVE 實測「聯繫我們」標題被抓) */
2391
+ const contrastText = hex => {
2392
+ const h = (hex || '').replace('#', '');
2393
+ if (h.length !== 6 && h.length !== 3) return 'white';
2394
+ const f = h.length === 3 ? h.split('').map(c => c + c).join('') : h;
2395
+ const [r, g, b] = [0, 2, 4].map(i => {
2396
+ const s = parseInt(f.slice(i, i + 2), 16) / 255;
2397
+ return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
2398
+ });
2399
+ const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
2400
+ /* 白字需底色亮度 ≤ 0.1833 才達 4.5:1;否則配深字 */
2401
+ return luminance <= 0.1833 ? 'white' : '#0f1315';
2402
+ };
2403
+
2389
2404
  // export const commonThemeProps = ({ darkMode, colors }) => {
2390
2405
  const commonTheme = _ref => {
2391
2406
  let {
@@ -2557,7 +2572,7 @@ const commonTheme = _ref => {
2557
2572
  root: {
2558
2573
  padding: '0 4px 0 12px',
2559
2574
  background: primaryColor,
2560
- color: 'white'
2575
+ color: contrastText(primaryColor)
2561
2576
  }
2562
2577
  },
2563
2578
  MuiDialogContent: {
@@ -8,7 +8,7 @@ import { S as Spin } from './Spin-8dc60bfe.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
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: white;\n}\n.modal__title__close {\n cursor: pointer;\n color: white;\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}";
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
12
  styleInject(css_248z);
13
13
 
14
14
  var Modal = function Modal(props) {
@@ -1,4 +1,4 @@
1
- export { M as default } from './Modal-5a27951f.js';
1
+ export { M as default } from './Modal-777fe87d.js';
2
2
  import 'react';
3
3
  import './index-b76a85f4.js';
4
4
  import 'prop-types';
@@ -2,7 +2,7 @@ import React__default, { useMemo, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { c as classNames } from './index-b76a85f4.js';
4
4
  import { e as event, d as d3Select, a as dispatch, c as customEvent, D as DragEvent, q as quadtree, m as map, t as timer, T as Transform, i as identity, b as interrupt, o as ordinal, f as category10 } from './transform-3a04288b.js';
5
- import { E as ExtraTools } from './ExtraTools-94eeda8d.js';
5
+ import { E as ExtraTools } from './ExtraTools-8d2ef84d.js';
6
6
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
7
  import './_rollupPluginBabelHelpers-a52356f6.js';
8
8
  import './_commonjsHelpers-70de2c37.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daoyi/nmtl-ui",
3
- "version": "2.0.1-beta.96",
3
+ "version": "2.0.1-beta.97",
4
4
  "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
5
5
  "author": "daoyi",
6
6
  "main": "lib/index.js",