@daoyi/nmtl-ui 2.0.1-beta.120 → 2.0.1-beta.122

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.
@@ -1,3 +1,4 @@
1
+ import { c as _objectWithoutProperties, _ as _extends } from './_rollupPluginBabelHelpers-a52356f6.js';
1
2
  import React__default from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { c as classNames } from './index-b76a85f4.js';
@@ -7,6 +8,7 @@ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
8
  var css_248z = ".button {\n border: 1px solid #ffffff99;\n border-radius: 45px;\n padding: 8px 16px;\n background: #007bff;\n color: white;\n cursor: pointer;\n}\n.button:hover {\n opacity: 0.9;\n}";
8
9
  styleInject(css_248z);
9
10
 
11
+ var _excluded = ["style", "className", "tabIndex", "alt", "text", "size", "variant", "type", "color", "loading", "disabled", "icon", "endIcon", "children", "onClick"];
10
12
  var Button = function Button(props) {
11
13
  var style = props.style,
12
14
  className = props.className,
@@ -23,7 +25,27 @@ var Button = function Button(props) {
23
25
  endIcon = props.endIcon,
24
26
  children = props.children,
25
27
  onClick = props.onClick;
26
- return /*#__PURE__*/React__default.createElement(Button$1, {
28
+ /* 本元件原本逐一挑選 props,呼叫端傳入的 aria-*/title/role 會被靜默丟掉——
29
+ nmtl-web 有三處為了補可及名稱而傳 aria-label,其中 areaMap 那處自 80db4537
30
+ 起就一直沒有生效(WCAG 4.1.2,Freego HM1410200C)。
31
+ 把宣告過的 props 取出後,其餘一律往下傳。 */
32
+ props.style;
33
+ props.className;
34
+ props.tabIndex;
35
+ props.alt;
36
+ props.text;
37
+ props.size;
38
+ props.variant;
39
+ props.type;
40
+ props.color;
41
+ props.loading;
42
+ props.disabled;
43
+ props.icon;
44
+ props.endIcon;
45
+ props.children;
46
+ props.onClick;
47
+ var rest = _objectWithoutProperties(props, _excluded);
48
+ return /*#__PURE__*/React__default.createElement(Button$1, _extends({}, rest, {
27
49
  style: style,
28
50
  className: classNames('button', className),
29
51
  tabIndex: tabIndex,
@@ -37,7 +59,7 @@ var Button = function Button(props) {
37
59
  endIcon: loading ? /*#__PURE__*/React__default.createElement(CircularProgress, {
38
60
  size: 16
39
61
  }) : endIcon
40
- }, text, children);
62
+ }), text, children);
41
63
  };
42
64
  Button.defaultProps = {
43
65
  style: undefined,
@@ -1,4 +1,5 @@
1
- export { B as default } from './Button-305b69a0.js';
1
+ export { B as default } from './Button-7bd5aa09.js';
2
+ import './_rollupPluginBabelHelpers-a52356f6.js';
2
3
  import 'react';
3
4
  import 'prop-types';
4
5
  import './index-b76a85f4.js';
@@ -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-76fef34f.js';
6
+ import { M as Modal } from './Modal-b62ff592.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, IconButton, Button, Box, Typography, FormControl, RadioGroup, FormControlLabel, Radio, TextField, TextareaAutosize } from '@material-ui/core';
@@ -1,15 +1,15 @@
1
- export { C as default } from './ContactModal-763fc7cb.js';
1
+ export { C as default } from './ContactModal-ac82e7a6.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-76fef34f.js';
8
+ import './Modal-b62ff592.js';
9
9
  import './index-b76a85f4.js';
10
10
  import '@material-ui/core';
11
11
  import '@material-ui/icons';
12
- import './Button-305b69a0.js';
12
+ import './Button-7bd5aa09.js';
13
13
  import './style-inject.es-1f59c1d0.js';
14
14
  import './Spin-8f87eadc.js';
15
15
  import './globalConfig';
@@ -3,16 +3,16 @@ 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-763fc7cb.js';
6
+ import { C as ContactModal } from './ContactModal-ac82e7a6.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 './Modal-76fef34f.js';
12
+ import './Modal-b62ff592.js';
13
13
  import '@material-ui/core';
14
14
  import '@material-ui/icons';
15
- import './Button-305b69a0.js';
15
+ import './Button-7bd5aa09.js';
16
16
  import './_commonjsHelpers-70de2c37.js';
17
17
  import './defaultTheme-ed7746fe.js';
18
18
  import '@material-ui/styles';
@@ -13,7 +13,8 @@ var Input = function Input(props) {
13
13
  defaultValue = props.defaultValue,
14
14
  value = props.value,
15
15
  type = props.type,
16
- error = props.error; // Attributes
16
+ error = props.error,
17
+ ariaLabel = props.ariaLabel; // Attributes
17
18
 
18
19
  var _onChange = props.onChange,
19
20
  _onKeyPress = props.onKeyPress,
@@ -22,8 +23,11 @@ var Input = function Input(props) {
22
23
  var suffix = props.suffix; // Dom Status
23
24
 
24
25
  var OutlinedInputProps = {
26
+ /* WCAG 3.3.2(Freego HM1130104C):placeholder 不是 label,包裹式 label 檢測工具也不認,
27
+ 需要時由呼叫端傳 ariaLabel,直接標在 input 元素上 */
25
28
  inputProps: {
26
- className: classNames('input', className)
29
+ className: classNames('input', className),
30
+ 'aria-label': ariaLabel
27
31
  },
28
32
  placeholder: placeholder,
29
33
  defaultValue: defaultValue,
@@ -52,7 +56,8 @@ Input.defaultProps = {
52
56
  onPressEnter: undefined,
53
57
  suffix: null,
54
58
  type: 'text',
55
- error: false
59
+ error: false,
60
+ ariaLabel: undefined
56
61
  };
57
62
 
58
63
  /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
@@ -76,7 +81,9 @@ Input.propTypes = {
76
81
  /** HTML5 Input type */
77
82
  type: PropTypes.string,
78
83
  /** Input error */
79
- error: PropTypes.bool
84
+ error: PropTypes.bool,
85
+ /** 無可見 label 時的可及名稱(WCAG 3.3.2);會標在 input 元素上 */
86
+ ariaLabel: PropTypes.string
80
87
  };
81
88
 
82
89
  export { Input as default };
@@ -2,13 +2,13 @@ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
2
  import React__default, { useState, useEffect, useRef } 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-76fef34f.js';
5
+ import { M as Modal } from './Modal-b62ff592.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 { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
  import '@material-ui/icons';
11
- import './Button-305b69a0.js';
11
+ import './Button-7bd5aa09.js';
12
12
  import './Spin-8f87eadc.js';
13
13
  import './_commonjsHelpers-70de2c37.js';
14
14
  import './defaultTheme-ed7746fe.js';
@@ -3,7 +3,7 @@ import { c as classNames } from './index-b76a85f4.js';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Dialog, DialogTitle, IconButton, DialogContent, DialogActions, CircularProgress } from '@material-ui/core';
5
5
  import { CloseSharp } from '@material-ui/icons';
6
- import { B as Button } from './Button-305b69a0.js';
6
+ import { B as Button } from './Button-7bd5aa09.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';
@@ -1,10 +1,11 @@
1
- export { M as default } from './Modal-76fef34f.js';
1
+ export { M as default } from './Modal-b62ff592.js';
2
2
  import 'react';
3
3
  import './index-b76a85f4.js';
4
4
  import 'prop-types';
5
5
  import '@material-ui/core';
6
6
  import '@material-ui/icons';
7
- import './Button-305b69a0.js';
7
+ import './Button-7bd5aa09.js';
8
+ import './_rollupPluginBabelHelpers-a52356f6.js';
8
9
  import './style-inject.es-1f59c1d0.js';
9
10
  import './Spin-8f87eadc.js';
10
11
  import './globalConfig';
@@ -32,11 +32,16 @@ var Radio = function Radio(props) {
32
32
  }, Array.isArray(options) && options.map(function (option) {
33
33
  return /*#__PURE__*/React__default.createElement(FormControlLabel, {
34
34
  value: option.value,
35
- key: option.value,
35
+ key: option.value
36
+ /* WCAG 4.1.2(Freego HM1130104C):FormControlLabel 產生的是「包裹式」隱式 label,
37
+ 檢測工具只認 input 自身的 for/title/aria-*,故把選項文字同步標在 input 上 */,
36
38
  control: /*#__PURE__*/React__default.createElement(Radio$1, {
37
39
  disabled: option.disabled || false,
38
40
  size: size,
39
- className: className
41
+ className: className,
42
+ inputProps: {
43
+ 'aria-label': typeof option.label === 'string' ? option.label : String(option.value)
44
+ }
40
45
  }),
41
46
  label: option.label
42
47
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daoyi/nmtl-ui",
3
- "version": "2.0.1-beta.120",
3
+ "version": "2.0.1-beta.122",
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",