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

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,6 +1,6 @@
1
1
  import { _ as _extends } from './_rollupPluginBabelHelpers-a52356f6.js';
2
2
  import * as React from 'react';
3
- import React__default, { Component, forwardRef, useState } from 'react';
3
+ import React__default, { Component, forwardRef, useState, useRef, useEffect } from 'react';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
5
  import PropTypes from 'prop-types';
6
6
  import { a as getDefaultExportFromCjs } from './_commonjsHelpers-70de2c37.js';
@@ -3362,7 +3362,31 @@ const FontSizeChanger = _ref5 => {
3362
3362
  FontSizeTargets,
3363
3363
  FontSizeOptions
3364
3364
  } = _ref5;
3365
+ /* WCAG 2.1.1/4.1.2 react-font-size-changer 渲染的 A+/A− 為純 div onClick、
3366
+ 無法聚焦也無鍵盤操作(第三方庫不提供 prop):掛載後補 tabindex/role/aria-label/Enter+Space */
3367
+ const rootRef = useRef(null);
3368
+ useEffect(() => {
3369
+ if (!rootRef.current) return;
3370
+ rootRef.current.querySelectorAll('.font-size-up, .font-size-down').forEach(el => {
3371
+ if (el.getAttribute('tabindex') === '0') return;
3372
+ const isUp = el.classList.contains('font-size-up');
3373
+ const labelId = isUp ? 'knowledge.writersAndWorksSNA.big' : 'knowledge.writersAndWorksSNA.small';
3374
+ const fallback = isUp ? '字級放大' : '字級縮小';
3375
+ el.setAttribute('tabindex', '0');
3376
+ el.setAttribute('role', 'button');
3377
+ el.setAttribute('aria-label', intl ? intl.formatMessage({
3378
+ id: labelId
3379
+ }) : fallback);
3380
+ el.addEventListener('keydown', event => {
3381
+ if (event.key === 'Enter' || event.key === ' ') {
3382
+ event.preventDefault();
3383
+ el.click();
3384
+ }
3385
+ });
3386
+ });
3387
+ });
3365
3388
  return /*#__PURE__*/React__default.createElement("div", {
3389
+ ref: rootRef,
3366
3390
  className: classNames('extraTools__fontsize', className)
3367
3391
  }, /*#__PURE__*/React__default.createElement(FontSize, {
3368
3392
  targets: FontSizeTargets,
@@ -1,4 +1,4 @@
1
- export { E as default } from './ExtraTools-5954ee3a.js';
1
+ export { E as default } from './ExtraTools-94eeda8d.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import './index-b76a85f4.js';
@@ -187,6 +187,17 @@ var Footer = function Footer(props) {
187
187
  }).map(function (_ref5, i) {
188
188
  var name = _ref5.name,
189
189
  url = _ref5.url;
190
+ /* 站內連結('/' 開頭,如網站導覽)同分頁開啟;外部連結維持另開新視窗 */
191
+ if (url && url.startsWith('/')) {
192
+ return /*#__PURE__*/React__default.createElement("a", {
193
+ className: "footer__content__item__link",
194
+ style: {
195
+ color: primaryColor
196
+ },
197
+ href: url,
198
+ key: i.toString()
199
+ }, name.toUpperCase());
200
+ }
190
201
  return /*#__PURE__*/React__default.createElement("a", {
191
202
  className: "footer__content__item__link",
192
203
  style: {
@@ -202,8 +213,17 @@ var Footer = function Footer(props) {
202
213
  style: {
203
214
  color: primaryColor
204
215
  },
216
+ role: "button",
217
+ tabIndex: 0,
218
+ "aria-haspopup": "dialog",
205
219
  onClick: function onClick() {
206
220
  return setContactModalOpen(true);
221
+ },
222
+ onKeyDown: function onKeyDown(event) {
223
+ if (event.key === 'Enter' || event.key === ' ') {
224
+ event.preventDefault();
225
+ setContactModalOpen(true);
226
+ }
207
227
  }
208
228
  }, formatMessage({
209
229
  id: 'common.has.problem'
@@ -1,6 +1,7 @@
1
1
  import { c as _objectWithoutProperties } from './_rollupPluginBabelHelpers-a52356f6.js';
2
2
  import React__default, { useMemo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import { c as classNames } from './index-b76a85f4.js';
4
5
  import { q as queryString } from './index-b47819f3.js';
5
6
  import { useHistory, Link } from 'react-router-dom';
6
7
  import { Tooltip } from '@material-ui/core';
@@ -10,11 +11,12 @@ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
11
  var css_248z = ".forwardLink {\n width: -moz-fit-content;\n width: fit-content;\n max-width: 100%;\n display: flex;\n}\n.forwardLink__link {\n color: unset;\n text-decoration: none;\n text-overflow: ellipsis;\n overflow: hidden;\n cursor: pointer;\n display: block;\n width: 100%;\n}\n.forwardLink__link--disabled {\n cursor: not-allowed;\n}";
11
12
  styleInject(css_248z);
12
13
 
13
- var _excluded = ["className", "title", "target", "disabled", "children", "tip", "onClick"];
14
+ var _excluded = ["className", "linkClassName", "title", "target", "disabled", "children", "tip", "onClick"];
14
15
  var locale = '/zh-tw'; // 20230318 暫時寫死,若套件納入語系控制,可將其置換
15
16
 
16
17
  var ForwardLink = function ForwardLink(_ref) {
17
18
  var className = _ref.className,
19
+ linkClassName = _ref.linkClassName,
18
20
  title = _ref.title,
19
21
  target = _ref.target,
20
22
  disabled = _ref.disabled,
@@ -58,9 +60,14 @@ var ForwardLink = function ForwardLink(_ref) {
58
60
  className: "forwardLink"
59
61
  }, disabled ? /*#__PURE__*/React__default.createElement("div", {
60
62
  title: domTitle,
61
- className: "forwardLink__link--disabled"
62
- }, children) : /*#__PURE__*/React__default.createElement(Link, {
63
- className: "forwardLink__link",
63
+ className: classNames('forwardLink__link--disabled', linkClassName)
64
+ }, children) :
65
+ /*#__PURE__*/
66
+ /* linkClassName 直接掛在可聚焦的 <a> 上:消費端的 ellipsis/overflow 樣式若掛在
67
+ 外層 className(包裹 div),會裁掉 <a> 的焦點框(WCAG 2.4.7 走查實測)——
68
+ 此類樣式應改傳 linkClassName */
69
+ React__default.createElement(Link, {
70
+ className: classNames('forwardLink__link', linkClassName),
64
71
  target: target,
65
72
  title: domTitle,
66
73
  "aria-label": newWindowLabel,
@@ -79,6 +86,7 @@ var ForwardLink = function ForwardLink(_ref) {
79
86
  };
80
87
  ForwardLink.defaultProps = {
81
88
  className: undefined,
89
+ linkClassName: undefined,
82
90
  title: undefined,
83
91
  target: '_blank',
84
92
  disabled: undefined,
@@ -92,8 +100,10 @@ ForwardLink.defaultProps = {
92
100
 
93
101
  /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
94
102
  ForwardLink.propTypes = {
95
- /** Css Name */
103
+ /** Css Name(掛在外層包裹 div;帶 overflow/ellipsis 的樣式請改用 linkClassName,否則會裁掉焦點框) */
96
104
  className: PropTypes.string,
105
+ /** 直接掛在可聚焦 <a> 上的 Css Name */
106
+ linkClassName: PropTypes.string,
97
107
  /** DOM title */
98
108
  title: PropTypes.string,
99
109
  /** DOM title */
@@ -1,7 +1,8 @@
1
- export { F as default } from './ForwardLink-aa950a50.js';
1
+ export { F as default } from './ForwardLink-83a7eea9.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
+ import './index-b76a85f4.js';
5
6
  import './index-b47819f3.js';
6
7
  import 'react-router-dom';
7
8
  import '@material-ui/core';
@@ -2,7 +2,7 @@ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
2
  import React__default, { useState, useRef, useEffect } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
- import { F as ForwardLink } from './ForwardLink-aa950a50.js';
5
+ import { F as ForwardLink } from './ForwardLink-83a7eea9.js';
6
6
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
7
  import './index-b47819f3.js';
8
8
  import 'react-router-dom';
@@ -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-5954ee3a.js';
5
+ import { E as ExtraTools } from './ExtraTools-94eeda8d.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,125 +1,125 @@
1
- {
2
- "name": "@daoyi/nmtl-ui",
3
- "version": "2.0.1-beta.95",
4
- "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
5
- "author": "daoyi",
6
- "main": "lib/index.js",
7
- "typings": "lib/index.d.ts",
8
- "files": [
9
- "lib"
10
- ],
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/HsunTsai/react-storybook-jsx-starter"
14
- },
15
- "dependencies": {
16
- "@geometricpanda/storybook-addon-badges": "0.2.2",
17
- "@material-ui/core": "4.12.3",
18
- "@material-ui/icons": "4.11.2",
19
- "@material-ui/lab": "4.0.0-alpha.60",
20
- "@material-ui/styles": "4.11.4",
21
- "axios": "0.21.1",
22
- "babel-eslint": "10.1.0",
23
- "classnames": "2.3.1",
24
- "d3": "5.16.0",
25
- "d3-selection": "1.4.2",
26
- "d3-transition": "1.3.2",
27
- "dom-to-image": "2.6.0",
28
- "formik": "2.2.9",
29
- "html-to-react": "1.4.5",
30
- "jquery": "3.6.0",
31
- "js-file-download": "0.4.12",
32
- "jszip": "3.7.1",
33
- "lodash": "4.17.21",
34
- "markdown-it": "12.0.6",
35
- "moment": "^2.29.4",
36
- "notistack": "1.0.10",
37
- "prop-types": "15.7.2",
38
- "query-string": "6.12.1",
39
- "react": "16.14.0",
40
- "react-awesome-lightbox": "^1.8.1",
41
- "react-data-export": "0.6.0",
42
- "react-dom": "16.14.0",
43
- "react-dropzone": "11.3.2",
44
- "react-facebook-login": "4.1.1",
45
- "react-file-download": "0.3.5",
46
- "react-font-size-changer": "0.2.0",
47
- "react-google-login": "5.2.2",
48
- "react-intl": "5.8.0",
49
- "react-redux": "7.2.5",
50
- "react-router-dom": "5.2.0",
51
- "react-share": "4.4.0",
52
- "react-slick": "^0.28.1",
53
- "redux": "4.1.0",
54
- "sass": "1.41.1",
55
- "screenfull": "5.2.0",
56
- "slick-carousel": "^1.8.1",
57
- "styled-components": "5.3.5",
58
- "xlsx": "0.18.5"
59
- },
60
- "devDependencies": {
61
- "@babel/core": "7.14.8",
62
- "@babel/preset-env": "7.14.8",
63
- "@babel/preset-react": "7.14.5",
64
- "@rollup/plugin-babel": "5.3.1",
65
- "@rollup/plugin-commonjs": "22.0.0",
66
- "@rollup/plugin-node-resolve": "13.2.1",
67
- "@rollup/plugin-replace": "4.0.0",
68
- "@rollup/plugin-image": "2.1.1",
69
- "@rollup/plugin-json": "4.1.0",
70
- "@storybook/addon-essentials": "6.5.13",
71
- "@storybook/addon-links": "6.5.13",
72
- "@storybook/addon-notes": "6.0.0-alpha.6",
73
- "@storybook/addons": "6.5.13",
74
- "@storybook/preset-scss": "1.0.3",
75
- "@storybook/react": "6.5.13",
76
- "autoprefixer": "9.8.6",
77
- "babel-loader": "8.2.2",
78
- "babel-plugin-transform-imports": "2.0.0",
79
- "css-loader": "1.0.1",
80
- "eslint": "7.2.0",
81
- "eslint-config-airbnb": "18.2.1",
82
- "eslint-config-node": "4.1.0",
83
- "eslint-config-prettier": "8.3.0",
84
- "eslint-loader": "4.0.2",
85
- "eslint-plugin-import": "2.22.1",
86
- "eslint-plugin-jsx-a11y": "6.4.1",
87
- "eslint-plugin-node": "11.1.0",
88
- "eslint-plugin-prettier": "3.4.1",
89
- "eslint-plugin-react": "7.21.5",
90
- "eslint-plugin-react-hooks": "1.7.0",
91
- "http-proxy-middleware": "1.3.1",
92
- "prettier": "2.4.1",
93
- "rollup": "2.70.2",
94
- "rollup-plugin-cleaner": "1.0.0",
95
- "rollup-plugin-postcss": "4.0.1",
96
- "rollup-plugin-terser": "7.0.2",
97
- "sass-loader": "7.1.0",
98
- "style-loader": "0.22.1"
99
- },
100
- "browserslist": {
101
- "production": [
102
- ">0.2%",
103
- "not dead",
104
- "not op_mini all"
105
- ],
106
- "development": [
107
- "last 1 chrome version",
108
- "last 1 firefox version",
109
- "last 1 safari version"
110
- ]
111
- },
112
- "scripts": {
113
- "start": "set NODE_OPTIONS=--max_old_space_size=16384 && yarn storybook",
114
- "lint": "eslint ./src/**/*.{js,jsx}",
115
- "format": "prettier --write --tab-width 4 --use-tabs true \"{,src/**/}*.{js,jsx}\"",
116
- "storybook": "start-storybook -p 6006 --no-open",
117
- "build": "rollup -c && npm run build-index",
118
- "build-index": "node ./rollup.index.js",
119
- "build-storybook": "build-storybook -c .storybook -o public",
120
- "create": "node ./buildUtils/create.js",
121
- "pub": "npm version patch -m Publish && npm publish",
122
- "pub-alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
123
- "pub-beta": "npm version prerelease --preid=beta && npm publish --tag beta"
124
- }
125
- }
1
+ {
2
+ "name": "@daoyi/nmtl-ui",
3
+ "version": "2.0.1-beta.96",
4
+ "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
5
+ "author": "daoyi",
6
+ "main": "lib/index.js",
7
+ "typings": "lib/index.d.ts",
8
+ "files": [
9
+ "lib"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/HsunTsai/react-storybook-jsx-starter"
14
+ },
15
+ "dependencies": {
16
+ "@geometricpanda/storybook-addon-badges": "0.2.2",
17
+ "@material-ui/core": "4.12.3",
18
+ "@material-ui/icons": "4.11.2",
19
+ "@material-ui/lab": "4.0.0-alpha.60",
20
+ "@material-ui/styles": "4.11.4",
21
+ "axios": "0.21.1",
22
+ "babel-eslint": "10.1.0",
23
+ "classnames": "2.3.1",
24
+ "d3": "5.16.0",
25
+ "d3-selection": "1.4.2",
26
+ "d3-transition": "1.3.2",
27
+ "dom-to-image": "2.6.0",
28
+ "formik": "2.2.9",
29
+ "html-to-react": "1.4.5",
30
+ "jquery": "3.6.0",
31
+ "js-file-download": "0.4.12",
32
+ "jszip": "3.7.1",
33
+ "lodash": "4.17.21",
34
+ "markdown-it": "12.0.6",
35
+ "moment": "^2.29.4",
36
+ "notistack": "1.0.10",
37
+ "prop-types": "15.7.2",
38
+ "query-string": "6.12.1",
39
+ "react": "16.14.0",
40
+ "react-awesome-lightbox": "^1.8.1",
41
+ "react-data-export": "0.6.0",
42
+ "react-dom": "16.14.0",
43
+ "react-dropzone": "11.3.2",
44
+ "react-facebook-login": "4.1.1",
45
+ "react-file-download": "0.3.5",
46
+ "react-font-size-changer": "0.2.0",
47
+ "react-google-login": "5.2.2",
48
+ "react-intl": "5.8.0",
49
+ "react-redux": "7.2.5",
50
+ "react-router-dom": "5.2.0",
51
+ "react-share": "4.4.0",
52
+ "react-slick": "^0.28.1",
53
+ "redux": "4.1.0",
54
+ "sass": "1.41.1",
55
+ "screenfull": "5.2.0",
56
+ "slick-carousel": "^1.8.1",
57
+ "styled-components": "5.3.5",
58
+ "xlsx": "0.18.5"
59
+ },
60
+ "devDependencies": {
61
+ "@babel/core": "7.14.8",
62
+ "@babel/preset-env": "7.14.8",
63
+ "@babel/preset-react": "7.14.5",
64
+ "@rollup/plugin-babel": "5.3.1",
65
+ "@rollup/plugin-commonjs": "22.0.0",
66
+ "@rollup/plugin-node-resolve": "13.2.1",
67
+ "@rollup/plugin-replace": "4.0.0",
68
+ "@rollup/plugin-image": "2.1.1",
69
+ "@rollup/plugin-json": "4.1.0",
70
+ "@storybook/addon-essentials": "6.5.13",
71
+ "@storybook/addon-links": "6.5.13",
72
+ "@storybook/addon-notes": "6.0.0-alpha.6",
73
+ "@storybook/addons": "6.5.13",
74
+ "@storybook/preset-scss": "1.0.3",
75
+ "@storybook/react": "6.5.13",
76
+ "autoprefixer": "9.8.6",
77
+ "babel-loader": "8.2.2",
78
+ "babel-plugin-transform-imports": "2.0.0",
79
+ "css-loader": "1.0.1",
80
+ "eslint": "7.2.0",
81
+ "eslint-config-airbnb": "18.2.1",
82
+ "eslint-config-node": "4.1.0",
83
+ "eslint-config-prettier": "8.3.0",
84
+ "eslint-loader": "4.0.2",
85
+ "eslint-plugin-import": "2.22.1",
86
+ "eslint-plugin-jsx-a11y": "6.4.1",
87
+ "eslint-plugin-node": "11.1.0",
88
+ "eslint-plugin-prettier": "3.4.1",
89
+ "eslint-plugin-react": "7.21.5",
90
+ "eslint-plugin-react-hooks": "1.7.0",
91
+ "http-proxy-middleware": "1.3.1",
92
+ "prettier": "2.4.1",
93
+ "rollup": "2.70.2",
94
+ "rollup-plugin-cleaner": "1.0.0",
95
+ "rollup-plugin-postcss": "4.0.1",
96
+ "rollup-plugin-terser": "7.0.2",
97
+ "sass-loader": "7.1.0",
98
+ "style-loader": "0.22.1"
99
+ },
100
+ "browserslist": {
101
+ "production": [
102
+ ">0.2%",
103
+ "not dead",
104
+ "not op_mini all"
105
+ ],
106
+ "development": [
107
+ "last 1 chrome version",
108
+ "last 1 firefox version",
109
+ "last 1 safari version"
110
+ ]
111
+ },
112
+ "scripts": {
113
+ "start": "set NODE_OPTIONS=--max_old_space_size=16384 && yarn storybook",
114
+ "lint": "eslint ./src/**/*.{js,jsx}",
115
+ "format": "prettier --write --tab-width 4 --use-tabs true \"{,src/**/}*.{js,jsx}\"",
116
+ "storybook": "start-storybook -p 6006 --no-open",
117
+ "build": "rollup -c && npm run build-index",
118
+ "build-index": "node ./rollup.index.js",
119
+ "build-storybook": "build-storybook -c .storybook -o public",
120
+ "create": "node ./buildUtils/create.js",
121
+ "pub": "npm version patch -m Publish && npm publish",
122
+ "pub-alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
123
+ "pub-beta": "npm version prerelease --preid=beta && npm publish --tag beta"
124
+ }
125
+ }