@blaze-cms/admin 0.146.0-node18-tooltips.56 → 0.146.0-node18-core-styles-tooltips.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -45
- package/blaze.config.js +2 -0
- package/lib/components/ConfirmAction/ConfirmAction.js +92 -0
- package/lib/components/ConfirmAction/ConfirmAction.js.map +1 -0
- package/lib/components/ConfirmAction/index.js +11 -0
- package/lib/components/ConfirmAction/index.js.map +1 -0
- package/lib/components/DeleteAction/DeleteAction.js +11 -15
- package/lib/components/DeleteAction/DeleteAction.js.map +1 -1
- package/lib/components/PageHeader/HeaderIconButton.js +38 -0
- package/lib/components/PageHeader/HeaderIconButton.js.map +1 -0
- package/lib/components/PageHeader/PageHeader.js +84 -13
- package/lib/components/PageHeader/PageHeader.js.map +1 -1
- package/lib/components/PageHeader/TitleEditor.js +107 -0
- package/lib/components/PageHeader/TitleEditor.js.map +1 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib-es/components/ConfirmAction/ConfirmAction.js +68 -0
- package/lib-es/components/ConfirmAction/ConfirmAction.js.map +1 -0
- package/lib-es/components/ConfirmAction/index.js +3 -0
- package/lib-es/components/ConfirmAction/index.js.map +1 -0
- package/lib-es/components/DeleteAction/DeleteAction.js +13 -19
- package/lib-es/components/DeleteAction/DeleteAction.js.map +1 -1
- package/lib-es/components/PageHeader/HeaderIconButton.js +32 -0
- package/lib-es/components/PageHeader/HeaderIconButton.js.map +1 -0
- package/lib-es/components/PageHeader/PageHeader.js +80 -24
- package/lib-es/components/PageHeader/PageHeader.js.map +1 -1
- package/lib-es/components/PageHeader/TitleEditor.js +79 -0
- package/lib-es/components/PageHeader/TitleEditor.js.map +1 -0
- package/lib-es/index.js +2 -1
- package/lib-es/index.js.map +1 -1
- package/package.json +16 -15
- package/src/components/ConfirmAction/ConfirmAction.js +72 -0
- package/src/components/ConfirmAction/index.js +3 -0
- package/src/components/DeleteAction/DeleteAction.js +16 -23
- package/src/components/PageHeader/HeaderIconButton.js +27 -0
- package/src/components/PageHeader/PageHeader.js +90 -19
- package/src/components/PageHeader/TitleEditor.js +87 -0
- package/src/index.js +2 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _excluded = ["icon", "label", "className"];
|
|
14
|
+
var HeaderIconButton = function HeaderIconButton(_ref) {
|
|
15
|
+
var icon = _ref.icon,
|
|
16
|
+
label = _ref.label,
|
|
17
|
+
className = _ref.className,
|
|
18
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/_react["default"].createElement("button", (0, _extends2["default"])({
|
|
20
|
+
type: "button",
|
|
21
|
+
className: "page-header__icon-button".concat(className ? " ".concat(className) : ''),
|
|
22
|
+
title: label,
|
|
23
|
+
"aria-label": label
|
|
24
|
+
}, rest), /*#__PURE__*/_react["default"].createElement("span", {
|
|
25
|
+
className: "material-icons",
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
}, icon));
|
|
28
|
+
};
|
|
29
|
+
HeaderIconButton.propTypes = {
|
|
30
|
+
icon: _propTypes["default"].string.isRequired,
|
|
31
|
+
label: _propTypes["default"].string.isRequired,
|
|
32
|
+
className: _propTypes["default"].string
|
|
33
|
+
};
|
|
34
|
+
HeaderIconButton.defaultProps = {
|
|
35
|
+
className: ''
|
|
36
|
+
};
|
|
37
|
+
var _default = exports["default"] = HeaderIconButton;
|
|
38
|
+
//# sourceMappingURL=HeaderIconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderIconButton.js","names":["_react","_interopRequireDefault","require","_propTypes","_excluded","HeaderIconButton","_ref","icon","label","className","rest","_objectWithoutProperties2","createElement","_extends2","type","concat","title","propTypes","PropTypes","string","isRequired","defaultProps","_default","exports"],"sources":["../../../src/components/PageHeader/HeaderIconButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst HeaderIconButton = ({ icon, label, className, ...rest }) => (\n <button\n type=\"button\"\n className={`page-header__icon-button${className ? ` ${className}` : ''}`}\n title={label}\n aria-label={label}\n {...rest}>\n <span className=\"material-icons\" aria-hidden=\"true\">\n {icon}\n </span>\n </button>\n);\n\nHeaderIconButton.propTypes = {\n icon: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n className: PropTypes.string\n};\n\nHeaderIconButton.defaultProps = {\n className: ''\n};\n\nexport default HeaderIconButton;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAmC,IAAAE,SAAA;AAEnC,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA;EAAA,IAAMC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAKC,IAAI,OAAAC,yBAAA,aAAAL,IAAA,EAAAF,SAAA;EAAA,oBACzDJ,MAAA,YAAAY,aAAA,eAAAC,SAAA;IACEC,IAAI,EAAC,QAAQ;IACbL,SAAS,6BAAAM,MAAA,CAA6BN,SAAS,OAAAM,MAAA,CAAON,SAAS,IAAK,EAAE,CAAG;IACzEO,KAAK,EAAER,KAAM;IACb,cAAYA;EAAM,GACdE,IAAI,gBACRV,MAAA,YAAAY,aAAA;IAAMH,SAAS,EAAC,gBAAgB;IAAC,eAAY;EAAM,GAChDF,IACG,CACA,CAAC;AAAA,CACV;AAEDF,gBAAgB,CAACY,SAAS,GAAG;EAC3BV,IAAI,EAAEW,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjCZ,KAAK,EAAEU,qBAAS,CAACC,MAAM,CAACC,UAAU;EAClCX,SAAS,EAAES,qBAAS,CAACC;AACvB,CAAC;AAEDd,gBAAgB,CAACgB,YAAY,GAAG;EAC9BZ,SAAS,EAAE;AACb,CAAC;AAAC,IAAAa,QAAA,GAAAC,OAAA,cAEalB,gBAAgB","ignoreList":[]}
|
|
@@ -1,22 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
3
4
|
require("core-js/modules/es.object.define-property.js");
|
|
5
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
+
require("core-js/modules/es.string.iterator.js");
|
|
7
|
+
require("core-js/modules/es.weak-map.js");
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
4
9
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
11
|
Object.defineProperty(exports, "__esModule", {
|
|
6
12
|
value: true
|
|
7
13
|
});
|
|
8
14
|
exports["default"] = void 0;
|
|
9
15
|
require("core-js/modules/es.array.map.js");
|
|
10
16
|
require("core-js/modules/es.object.to-string.js");
|
|
11
|
-
var
|
|
17
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
19
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
20
|
var _MetaTitle = _interopRequireDefault(require("../MetaTitle/MetaTitle"));
|
|
21
|
+
var _HeaderIconButton = _interopRequireDefault(require("./HeaderIconButton"));
|
|
22
|
+
var _TitleEditor = _interopRequireDefault(require("./TitleEditor"));
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
14
25
|
var PageHeader = function PageHeader(_ref) {
|
|
15
26
|
var title = _ref.title,
|
|
16
27
|
subtitle = _ref.subtitle,
|
|
17
28
|
children = _ref.children,
|
|
18
29
|
pageName = _ref.pageName,
|
|
19
|
-
onViewUrl = _ref.onViewUrl
|
|
30
|
+
onViewUrl = _ref.onViewUrl,
|
|
31
|
+
viewUrlDisabledReason = _ref.viewUrlDisabledReason,
|
|
32
|
+
onTitleChange = _ref.onTitleChange,
|
|
33
|
+
titleActions = _ref.titleActions;
|
|
34
|
+
var _useState = (0, _react.useState)(false),
|
|
35
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
36
|
+
isEditingTitle = _useState2[0],
|
|
37
|
+
setIsEditingTitle = _useState2[1];
|
|
38
|
+
var isTitleEditable = typeof onTitleChange === 'function';
|
|
39
|
+
// A reason renders the button disabled instead of dropping it.
|
|
40
|
+
var showViewButton = !!onViewUrl || !!viewUrlDisabledReason;
|
|
41
|
+
var hasTitleActions = isTitleEditable || !!titleActions || showViewButton;
|
|
42
|
+
var startEditing = function startEditing() {
|
|
43
|
+
return setIsEditingTitle(true);
|
|
44
|
+
};
|
|
45
|
+
var stopEditing = function stopEditing() {
|
|
46
|
+
return setIsEditingTitle(false);
|
|
47
|
+
};
|
|
48
|
+
var saveTitle = function saveTitle(nextTitle) {
|
|
49
|
+
stopEditing();
|
|
50
|
+
onTitleChange(nextTitle);
|
|
51
|
+
};
|
|
52
|
+
var renderTitle = function renderTitle() {
|
|
53
|
+
if (isEditingTitle) {
|
|
54
|
+
return /*#__PURE__*/_react["default"].createElement(_TitleEditor["default"], {
|
|
55
|
+
title: title,
|
|
56
|
+
onSave: saveTitle,
|
|
57
|
+
onCancel: stopEditing
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isTitleEditable ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
61
|
+
className: "page-header__heading page-header__heading--editable",
|
|
62
|
+
onClick: startEditing,
|
|
63
|
+
title: "Edit title",
|
|
64
|
+
role: "button",
|
|
65
|
+
tabIndex: 0,
|
|
66
|
+
onKeyDown: function onKeyDown(_ref2) {
|
|
67
|
+
var key = _ref2.key;
|
|
68
|
+
return key === 'Enter' && startEditing();
|
|
69
|
+
}
|
|
70
|
+
}, title) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
71
|
+
className: "page-header__heading"
|
|
72
|
+
}, title), hasTitleActions && /*#__PURE__*/_react["default"].createElement("div", {
|
|
73
|
+
className: "page-header__title-actions"
|
|
74
|
+
}, isTitleEditable && /*#__PURE__*/_react["default"].createElement(_HeaderIconButton["default"], {
|
|
75
|
+
icon: "edit",
|
|
76
|
+
label: "Edit title",
|
|
77
|
+
onClick: startEditing,
|
|
78
|
+
"data-testid": "page-header-title-edit"
|
|
79
|
+
}), titleActions, showViewButton && /*#__PURE__*/_react["default"].createElement(_HeaderIconButton["default"], {
|
|
80
|
+
icon: "open_in_new",
|
|
81
|
+
label: viewUrlDisabledReason || 'View',
|
|
82
|
+
className: viewUrlDisabledReason ? 'page-header__icon-button--disabled' : '',
|
|
83
|
+
"aria-disabled": viewUrlDisabledReason ? 'true' : undefined,
|
|
84
|
+
onClick: viewUrlDisabledReason ? undefined : onViewUrl,
|
|
85
|
+
"data-testid": "page-header-view"
|
|
86
|
+
})));
|
|
87
|
+
};
|
|
20
88
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_MetaTitle["default"], {
|
|
21
89
|
title: title,
|
|
22
90
|
pageName: pageName
|
|
@@ -24,13 +92,9 @@ var PageHeader = function PageHeader(_ref) {
|
|
|
24
92
|
className: "page-header--wrapper"
|
|
25
93
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
26
94
|
className: "page-header page-header--sticky"
|
|
27
|
-
},
|
|
28
|
-
className: "page-
|
|
29
|
-
|
|
30
|
-
role: "button"
|
|
31
|
-
}, title) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
32
|
-
className: "page-header__heading"
|
|
33
|
-
}, title), /*#__PURE__*/_react["default"].createElement("div", {
|
|
95
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
96
|
+
className: "page-header__title"
|
|
97
|
+
}, renderTitle()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
34
98
|
className: "page-header__button"
|
|
35
99
|
}, children)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
36
100
|
className: "page-header page-header--base"
|
|
@@ -43,16 +107,22 @@ PageHeader.propTypes = {
|
|
|
43
107
|
subtitle: _propTypes["default"].string,
|
|
44
108
|
children: _propTypes["default"].oneOfType([_propTypes["default"].array, _propTypes["default"].object, _propTypes["default"].string]),
|
|
45
109
|
pageName: _propTypes["default"].string,
|
|
46
|
-
onViewUrl: _propTypes["default"].func
|
|
110
|
+
onViewUrl: _propTypes["default"].func,
|
|
111
|
+
viewUrlDisabledReason: _propTypes["default"].string,
|
|
112
|
+
onTitleChange: _propTypes["default"].func,
|
|
113
|
+
titleActions: _propTypes["default"].node
|
|
47
114
|
};
|
|
48
115
|
PageHeader.defaultProps = {
|
|
49
116
|
subtitle: '',
|
|
50
117
|
children: '',
|
|
51
118
|
pageName: '',
|
|
52
|
-
onViewUrl: null
|
|
119
|
+
onViewUrl: null,
|
|
120
|
+
viewUrlDisabledReason: null,
|
|
121
|
+
onTitleChange: null,
|
|
122
|
+
titleActions: null
|
|
53
123
|
};
|
|
54
|
-
var PageHeaderActions = function PageHeaderActions(
|
|
55
|
-
var children =
|
|
124
|
+
var PageHeaderActions = function PageHeaderActions(_ref3) {
|
|
125
|
+
var children = _ref3.children;
|
|
56
126
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _react["default"].Children.map(children, function (child) {
|
|
57
127
|
return child && /*#__PURE__*/_react["default"].cloneElement(child);
|
|
58
128
|
}));
|
|
@@ -61,5 +131,6 @@ PageHeaderActions.propTypes = {
|
|
|
61
131
|
children: _propTypes["default"].oneOfType([_propTypes["default"].array, _propTypes["default"].object]).isRequired
|
|
62
132
|
};
|
|
63
133
|
PageHeader.Actions = PageHeaderActions;
|
|
134
|
+
PageHeader.IconButton = _HeaderIconButton["default"];
|
|
64
135
|
var _default = exports["default"] = PageHeader;
|
|
65
136
|
//# sourceMappingURL=PageHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.js","names":["_react","
|
|
1
|
+
{"version":3,"file":"PageHeader.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_MetaTitle","_HeaderIconButton","_TitleEditor","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","PageHeader","_ref","title","subtitle","children","pageName","onViewUrl","viewUrlDisabledReason","onTitleChange","titleActions","_useState","useState","_useState2","_slicedToArray2","isEditingTitle","setIsEditingTitle","isTitleEditable","showViewButton","hasTitleActions","startEditing","stopEditing","saveTitle","nextTitle","renderTitle","createElement","onSave","onCancel","Fragment","className","onClick","role","tabIndex","onKeyDown","_ref2","key","icon","label","undefined","propTypes","PropTypes","string","isRequired","oneOfType","array","object","func","node","defaultProps","PageHeaderActions","_ref3","React","Children","map","child","cloneElement","Actions","IconButton","HeaderIconButton","_default","exports"],"sources":["../../../src/components/PageHeader/PageHeader.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport MetaTitle from '../MetaTitle/MetaTitle';\nimport HeaderIconButton from './HeaderIconButton';\nimport TitleEditor from './TitleEditor';\n\nconst PageHeader = ({\n title,\n subtitle,\n children,\n pageName,\n onViewUrl,\n viewUrlDisabledReason,\n onTitleChange,\n titleActions\n}) => {\n const [isEditingTitle, setIsEditingTitle] = useState(false);\n const isTitleEditable = typeof onTitleChange === 'function';\n // A reason renders the button disabled instead of dropping it.\n const showViewButton = !!onViewUrl || !!viewUrlDisabledReason;\n const hasTitleActions = isTitleEditable || !!titleActions || showViewButton;\n\n const startEditing = () => setIsEditingTitle(true);\n const stopEditing = () => setIsEditingTitle(false);\n const saveTitle = nextTitle => {\n stopEditing();\n onTitleChange(nextTitle);\n };\n\n const renderTitle = () => {\n if (isEditingTitle) {\n return <TitleEditor title={title} onSave={saveTitle} onCancel={stopEditing} />;\n }\n\n return (\n <>\n {isTitleEditable ? (\n <div\n className=\"page-header__heading page-header__heading--editable\"\n onClick={startEditing}\n title=\"Edit title\"\n role=\"button\"\n tabIndex={0}\n onKeyDown={({ key }) => key === 'Enter' && startEditing()}>\n {title}\n </div>\n ) : (\n <div className=\"page-header__heading\">{title}</div>\n )}\n {hasTitleActions && (\n <div className=\"page-header__title-actions\">\n {isTitleEditable && (\n <HeaderIconButton\n icon=\"edit\"\n label=\"Edit title\"\n onClick={startEditing}\n data-testid=\"page-header-title-edit\"\n />\n )}\n {titleActions}\n {showViewButton && (\n <HeaderIconButton\n icon=\"open_in_new\"\n label={viewUrlDisabledReason || 'View'}\n className={viewUrlDisabledReason ? 'page-header__icon-button--disabled' : ''}\n aria-disabled={viewUrlDisabledReason ? 'true' : undefined}\n onClick={viewUrlDisabledReason ? undefined : onViewUrl}\n data-testid=\"page-header-view\"\n />\n )}\n </div>\n )}\n </>\n );\n };\n\n return (\n <>\n <MetaTitle title={title} pageName={pageName} />\n <div className=\"page-header--wrapper\">\n <div className=\"page-header page-header--sticky\">\n <div className=\"page-header__title\">{renderTitle()}</div>\n <div className=\"page-header__button\">{children}</div>\n </div>\n <div className=\"page-header page-header--base\">\n <div className=\"page-header__subheading\">{subtitle}</div>\n </div>\n </div>\n </>\n );\n};\n\nPageHeader.propTypes = {\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.array, PropTypes.object, PropTypes.string]),\n pageName: PropTypes.string,\n onViewUrl: PropTypes.func,\n viewUrlDisabledReason: PropTypes.string,\n onTitleChange: PropTypes.func,\n titleActions: PropTypes.node\n};\n\nPageHeader.defaultProps = {\n subtitle: '',\n children: '',\n pageName: '',\n onViewUrl: null,\n viewUrlDisabledReason: null,\n onTitleChange: null,\n titleActions: null\n};\n\nconst PageHeaderActions = ({ children }) => (\n <>{React.Children.map(children, child => child && React.cloneElement(child))}</>\n);\n\nPageHeaderActions.propTypes = {\n children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired\n};\n\nPageHeader.Actions = PageHeaderActions;\nPageHeader.IconButton = HeaderIconButton;\n\nexport default PageHeader;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,YAAA,GAAAH,sBAAA,CAAAF,OAAA;AAAwC,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD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ChD,QAAQ,EAAE,UAAAiD,KAAK;IAAA,OAAIA,KAAK,iBAAIH,iBAAK,CAACI,YAAY,CAACD,KAAK,CAAC;EAAA,EAAI,CAAC;AAAA,CACjF;AAEDL,iBAAiB,CAACV,SAAS,GAAG;EAC5BlC,QAAQ,EAAEmC,qBAAS,CAACG,SAAS,CAAC,CAACH,qBAAS,CAACI,KAAK,EAAEJ,qBAAS,CAACK,MAAM,CAAC,CAAC,CAACH;AACrE,CAAC;AAEDzC,UAAU,CAACuD,OAAO,GAAGP,iBAAiB;AACtChD,UAAU,CAACwD,UAAU,GAAGC,4BAAgB;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAE1B3D,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
require("core-js/modules/es.object.define-property.js");
|
|
5
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
+
require("core-js/modules/es.object.to-string.js");
|
|
7
|
+
require("core-js/modules/es.string.iterator.js");
|
|
8
|
+
require("core-js/modules/es.weak-map.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
11
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
12
|
+
Object.defineProperty(exports, "__esModule", {
|
|
13
|
+
value: true
|
|
14
|
+
});
|
|
15
|
+
exports["default"] = void 0;
|
|
16
|
+
require("core-js/modules/es.string.trim.js");
|
|
17
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
|
+
var _HeaderIconButton = _interopRequireDefault(require("./HeaderIconButton"));
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
+
var TitleEditor = function TitleEditor(_ref) {
|
|
24
|
+
var title = _ref.title,
|
|
25
|
+
onSave = _ref.onSave,
|
|
26
|
+
onCancel = _ref.onCancel;
|
|
27
|
+
var _useState = (0, _react.useState)(title),
|
|
28
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
29
|
+
value = _useState2[0],
|
|
30
|
+
setValue = _useState2[1];
|
|
31
|
+
var inputRef = (0, _react.useRef)(null);
|
|
32
|
+
// Blur and the tick/cross clicks can both fire for one edit; only the first wins.
|
|
33
|
+
var isDone = (0, _react.useRef)(false);
|
|
34
|
+
(0, _react.useEffect)(function () {
|
|
35
|
+
if (inputRef.current) {
|
|
36
|
+
inputRef.current.focus();
|
|
37
|
+
inputRef.current.select();
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
var finish = function finish(callback) {
|
|
41
|
+
if (isDone.current) return;
|
|
42
|
+
isDone.current = true;
|
|
43
|
+
callback();
|
|
44
|
+
};
|
|
45
|
+
var save = function save() {
|
|
46
|
+
return finish(function () {
|
|
47
|
+
var nextTitle = value.trim();
|
|
48
|
+
if (!nextTitle || nextTitle === title) {
|
|
49
|
+
onCancel();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
onSave(nextTitle);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var cancel = function cancel() {
|
|
56
|
+
return finish(onCancel);
|
|
57
|
+
};
|
|
58
|
+
var onKeyDown = function onKeyDown(event) {
|
|
59
|
+
if (event.key === 'Enter') {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
save();
|
|
62
|
+
} else if (event.key === 'Escape') {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
cancel();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var keepInputFocus = function keepInputFocus(event) {
|
|
68
|
+
return event.preventDefault();
|
|
69
|
+
};
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
71
|
+
className: "page-header__title-editor"
|
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
73
|
+
ref: inputRef,
|
|
74
|
+
type: "text",
|
|
75
|
+
className: "page-header__title-input",
|
|
76
|
+
value: value,
|
|
77
|
+
onChange: function onChange(_ref2) {
|
|
78
|
+
var target = _ref2.target;
|
|
79
|
+
return setValue(target.value);
|
|
80
|
+
},
|
|
81
|
+
onKeyDown: onKeyDown,
|
|
82
|
+
onBlur: save,
|
|
83
|
+
"aria-label": "Title",
|
|
84
|
+
"data-testid": "page-header-title-input"
|
|
85
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
86
|
+
className: "page-header__title-editor-actions"
|
|
87
|
+
}, /*#__PURE__*/_react["default"].createElement(_HeaderIconButton["default"], {
|
|
88
|
+
icon: "check",
|
|
89
|
+
label: "Save title",
|
|
90
|
+
onMouseDown: keepInputFocus,
|
|
91
|
+
onClick: save,
|
|
92
|
+
"data-testid": "page-header-title-save"
|
|
93
|
+
}), /*#__PURE__*/_react["default"].createElement(_HeaderIconButton["default"], {
|
|
94
|
+
icon: "close",
|
|
95
|
+
label: "Cancel",
|
|
96
|
+
onMouseDown: keepInputFocus,
|
|
97
|
+
onClick: cancel,
|
|
98
|
+
"data-testid": "page-header-title-cancel"
|
|
99
|
+
})));
|
|
100
|
+
};
|
|
101
|
+
TitleEditor.propTypes = {
|
|
102
|
+
title: _propTypes["default"].string.isRequired,
|
|
103
|
+
onSave: _propTypes["default"].func.isRequired,
|
|
104
|
+
onCancel: _propTypes["default"].func.isRequired
|
|
105
|
+
};
|
|
106
|
+
var _default = exports["default"] = TitleEditor;
|
|
107
|
+
//# sourceMappingURL=TitleEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TitleEditor.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_HeaderIconButton","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TitleEditor","_ref","title","onSave","onCancel","_useState","useState","_useState2","_slicedToArray2","value","setValue","inputRef","useRef","isDone","useEffect","current","focus","select","finish","callback","save","nextTitle","trim","cancel","onKeyDown","event","key","preventDefault","keepInputFocus","createElement","className","ref","type","onChange","_ref2","target","onBlur","icon","label","onMouseDown","onClick","propTypes","PropTypes","string","isRequired","func","_default","exports"],"sources":["../../../src/components/PageHeader/TitleEditor.js"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport HeaderIconButton from './HeaderIconButton';\n\nconst TitleEditor = ({ title, onSave, onCancel }) => {\n const [value, setValue] = useState(title);\n const inputRef = useRef(null);\n // Blur and the tick/cross clicks can both fire for one edit; only the first wins.\n const isDone = useRef(false);\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n inputRef.current.select();\n }\n }, []);\n\n const finish = callback => {\n if (isDone.current) return;\n isDone.current = true;\n callback();\n };\n\n const save = () =>\n finish(() => {\n const nextTitle = value.trim();\n if (!nextTitle || nextTitle === title) {\n onCancel();\n return;\n }\n onSave(nextTitle);\n });\n\n const cancel = () => finish(onCancel);\n\n const onKeyDown = event => {\n if (event.key === 'Enter') {\n event.preventDefault();\n save();\n } else if (event.key === 'Escape') {\n event.preventDefault();\n cancel();\n }\n };\n\n const keepInputFocus = event => event.preventDefault();\n\n return (\n <div className=\"page-header__title-editor\">\n <input\n ref={inputRef}\n type=\"text\"\n className=\"page-header__title-input\"\n value={value}\n onChange={({ target }) => setValue(target.value)}\n onKeyDown={onKeyDown}\n onBlur={save}\n aria-label=\"Title\"\n data-testid=\"page-header-title-input\"\n />\n <div className=\"page-header__title-editor-actions\">\n <HeaderIconButton\n icon=\"check\"\n label=\"Save title\"\n onMouseDown={keepInputFocus}\n onClick={save}\n data-testid=\"page-header-title-save\"\n />\n <HeaderIconButton\n icon=\"close\"\n label=\"Cancel\"\n onMouseDown={keepInputFocus}\n onClick={cancel}\n data-testid=\"page-header-title-cancel\"\n />\n </div>\n </div>\n );\n};\n\nTitleEditor.propTypes = {\n title: PropTypes.string.isRequired,\n onSave: PropTypes.func.isRequired,\n onCancel: PropTypes.func.isRequired\n};\n\nexport default TitleEditor;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAkD,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAA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A,IAAKC,MAAM,GAAAD,KAAA,CAANC,MAAM;MAAA,OAAOzB,QAAQ,CAACyB,MAAM,CAAC1B,KAAK,CAAC;IAAA,CAAC;IACjDe,SAAS,EAAEA,SAAU;IACrBY,MAAM,EAAEhB,IAAK;IACb,cAAW,OAAO;IAClB,eAAY;EAAyB,CACtC,CAAC,eACF9C,MAAA,YAAAuD,aAAA;IAAKC,SAAS,EAAC;EAAmC,gBAChDxD,MAAA,YAAAuD,aAAA,CAAClD,iBAAA,WAAgB;IACf0D,IAAI,EAAC,OAAO;IACZC,KAAK,EAAC,YAAY;IAClBC,WAAW,EAAEX,cAAe;IAC5BY,OAAO,EAAEpB,IAAK;IACd,eAAY;EAAwB,CACrC,CAAC,eACF9C,MAAA,YAAAuD,aAAA,CAAClD,iBAAA,WAAgB;IACf0D,IAAI,EAAC,OAAO;IACZC,KAAK,EAAC,QAAQ;IACdC,WAAW,EAAEX,cAAe;IAC5BY,OAAO,EAAEjB,MAAO;IAChB,eAAY;EAA0B,CACvC,CACE,CACF,CAAC;AAEV,CAAC;AAEDvB,WAAW,CAACyC,SAAS,GAAG;EACtBvC,KAAK,EAAEwC,qBAAS,CAACC,MAAM,CAACC,UAAU;EAClCzC,MAAM,EAAEuC,qBAAS,CAACG,IAAI,CAACD,UAAU;EACjCxC,QAAQ,EAAEsC,qBAAS,CAACG,IAAI,CAACD;AAC3B,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAEa/C,WAAW","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "CardPrompt", {
|
|
|
11
11
|
return _CardPrompt["default"];
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
+
Object.defineProperty(exports, "ConfirmAction", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _ConfirmAction["default"];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
14
20
|
Object.defineProperty(exports, "CopyDataFromAction", {
|
|
15
21
|
enumerable: true,
|
|
16
22
|
get: function get() {
|
|
@@ -61,6 +67,7 @@ Object.defineProperty(exports, "getBlazeAdmin", {
|
|
|
61
67
|
});
|
|
62
68
|
var _PageHeader = _interopRequireDefault(require("./components/PageHeader"));
|
|
63
69
|
var _DeleteAction = _interopRequireDefault(require("./components/DeleteAction"));
|
|
70
|
+
var _ConfirmAction = _interopRequireDefault(require("./components/ConfirmAction"));
|
|
64
71
|
var _CardPrompt = _interopRequireDefault(require("./components/CardPrompt"));
|
|
65
72
|
var _CopyDataFromAction = _interopRequireDefault(require("./components/CopyDataFromAction"));
|
|
66
73
|
var _MetaTitle = _interopRequireDefault(require("./components/MetaTitle"));
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_PageHeader","_interopRequireDefault","require","_DeleteAction","_CardPrompt","_CopyDataFromAction","_MetaTitle","_LeaveAction","_RevertToTemplate","_Loading","_getBlazeAdmin"],"sources":["../src/index.js"],"sourcesContent":["import PageHeader from './components/PageHeader';\nimport DeleteAction from './components/DeleteAction';\nimport CardPrompt from './components/CardPrompt';\nimport CopyDataFromAction from './components/CopyDataFromAction';\nimport MetaTitle from './components/MetaTitle';\nimport LeaveAction from './components/LeaveAction';\nimport RevertToTemplate from './components/RevertToTemplate';\nimport Loading from './components/Loading';\nimport { getBlazeAdmin } from './utils/get-blaze-admin';\n\nexport {\n getBlazeAdmin,\n PageHeader,\n DeleteAction,\n CardPrompt,\n CopyDataFromAction,\n MetaTitle,\n LeaveAction,\n RevertToTemplate,\n Loading\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_PageHeader","_interopRequireDefault","require","_DeleteAction","_ConfirmAction","_CardPrompt","_CopyDataFromAction","_MetaTitle","_LeaveAction","_RevertToTemplate","_Loading","_getBlazeAdmin"],"sources":["../src/index.js"],"sourcesContent":["import PageHeader from './components/PageHeader';\nimport DeleteAction from './components/DeleteAction';\nimport ConfirmAction from './components/ConfirmAction';\nimport CardPrompt from './components/CardPrompt';\nimport CopyDataFromAction from './components/CopyDataFromAction';\nimport MetaTitle from './components/MetaTitle';\nimport LeaveAction from './components/LeaveAction';\nimport RevertToTemplate from './components/RevertToTemplate';\nimport Loading from './components/Loading';\nimport { getBlazeAdmin } from './utils/get-blaze-admin';\n\nexport {\n getBlazeAdmin,\n PageHeader,\n DeleteAction,\n ConfirmAction,\n CardPrompt,\n CopyDataFromAction,\n MetaTitle,\n LeaveAction,\n RevertToTemplate,\n Loading\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,mBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,YAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,iBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,QAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useId, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Modal from '@blaze-react/modal';
|
|
4
|
+
const normalise = value => value.replace(/[\s,]/g, '');
|
|
5
|
+
|
|
6
|
+
// with confirmPhrase, confirming only runs once the phrase has been typed, for large or irreversible actions
|
|
7
|
+
const ConfirmAction = ({
|
|
8
|
+
onClose,
|
|
9
|
+
onConfirm,
|
|
10
|
+
confirmLabel,
|
|
11
|
+
confirmPhrase,
|
|
12
|
+
children
|
|
13
|
+
}) => {
|
|
14
|
+
const phraseId = useId();
|
|
15
|
+
const [typed, setTyped] = useState('');
|
|
16
|
+
const [showHint, setShowHint] = useState(false);
|
|
17
|
+
const confirmed = !confirmPhrase || normalise(typed) === normalise(confirmPhrase);
|
|
18
|
+
const alertActions = [{
|
|
19
|
+
callback: event => {
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
if (!confirmed) {
|
|
22
|
+
setShowHint(true);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
onConfirm();
|
|
26
|
+
},
|
|
27
|
+
modifiers: confirmed ? ['small'] : ['small', 'disabled'],
|
|
28
|
+
textButton: confirmLabel
|
|
29
|
+
}];
|
|
30
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
31
|
+
actions: alertActions,
|
|
32
|
+
onClose: onClose,
|
|
33
|
+
isAlert: true
|
|
34
|
+
}, children, confirmPhrase && /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "confirm-action__confirm"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
37
|
+
htmlFor: phraseId
|
|
38
|
+
}, "Type ", /*#__PURE__*/React.createElement("strong", null, confirmPhrase), " to confirm"), /*#__PURE__*/React.createElement("input", {
|
|
39
|
+
id: phraseId,
|
|
40
|
+
type: "text",
|
|
41
|
+
inputMode: "numeric",
|
|
42
|
+
autoComplete: "off",
|
|
43
|
+
value: typed,
|
|
44
|
+
onChange: ({
|
|
45
|
+
target: {
|
|
46
|
+
value
|
|
47
|
+
}
|
|
48
|
+
}) => {
|
|
49
|
+
setTyped(value);
|
|
50
|
+
setShowHint(false);
|
|
51
|
+
}
|
|
52
|
+
}), showHint && /*#__PURE__*/React.createElement("p", {
|
|
53
|
+
role: "alert"
|
|
54
|
+
}, "Type ", confirmPhrase, " to ", confirmLabel.toLowerCase(), " them all")));
|
|
55
|
+
};
|
|
56
|
+
ConfirmAction.propTypes = {
|
|
57
|
+
onClose: PropTypes.func.isRequired,
|
|
58
|
+
onConfirm: PropTypes.func.isRequired,
|
|
59
|
+
confirmLabel: PropTypes.string.isRequired,
|
|
60
|
+
confirmPhrase: PropTypes.string,
|
|
61
|
+
children: PropTypes.node
|
|
62
|
+
};
|
|
63
|
+
ConfirmAction.defaultProps = {
|
|
64
|
+
confirmPhrase: null,
|
|
65
|
+
children: null
|
|
66
|
+
};
|
|
67
|
+
export default ConfirmAction;
|
|
68
|
+
//# sourceMappingURL=ConfirmAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmAction.js","names":["React","useId","useState","PropTypes","Modal","normalise","value","replace","ConfirmAction","onClose","onConfirm","confirmLabel","confirmPhrase","children","phraseId","typed","setTyped","showHint","setShowHint","confirmed","alertActions","callback","event","stopPropagation","modifiers","textButton","createElement","actions","isAlert","className","htmlFor","id","type","inputMode","autoComplete","onChange","target","role","toLowerCase","propTypes","func","isRequired","string","node","defaultProps"],"sources":["../../../src/components/ConfirmAction/ConfirmAction.js"],"sourcesContent":["import React, { useId, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport Modal from '@blaze-react/modal';\n\nconst normalise = value => value.replace(/[\\s,]/g, '');\n\n// with confirmPhrase, confirming only runs once the phrase has been typed, for large or irreversible actions\nconst ConfirmAction = ({ onClose, onConfirm, confirmLabel, confirmPhrase, children }) => {\n const phraseId = useId();\n const [typed, setTyped] = useState('');\n const [showHint, setShowHint] = useState(false);\n const confirmed = !confirmPhrase || normalise(typed) === normalise(confirmPhrase);\n\n const alertActions = [\n {\n callback: event => {\n event.stopPropagation();\n if (!confirmed) {\n setShowHint(true);\n return;\n }\n onConfirm();\n },\n modifiers: confirmed ? ['small'] : ['small', 'disabled'],\n textButton: confirmLabel\n }\n ];\n\n return (\n <Modal actions={alertActions} onClose={onClose} isAlert>\n {children}\n {confirmPhrase && (\n <div className=\"confirm-action__confirm\">\n <label htmlFor={phraseId}>\n Type <strong>{confirmPhrase}</strong> to confirm\n </label>\n <input\n id={phraseId}\n type=\"text\"\n inputMode=\"numeric\"\n autoComplete=\"off\"\n value={typed}\n onChange={({ target: { value } }) => {\n setTyped(value);\n setShowHint(false);\n }}\n />\n {showHint && (\n <p role=\"alert\">\n Type {confirmPhrase} to {confirmLabel.toLowerCase()} them all\n </p>\n )}\n </div>\n )}\n </Modal>\n );\n};\n\nConfirmAction.propTypes = {\n onClose: PropTypes.func.isRequired,\n onConfirm: PropTypes.func.isRequired,\n confirmLabel: PropTypes.string.isRequired,\n confirmPhrase: PropTypes.string,\n children: PropTypes.node\n};\n\nConfirmAction.defaultProps = {\n confirmPhrase: null,\n children: null\n};\n\nexport default ConfirmAction;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,KAAK,EAAEC,QAAQ,QAAQ,OAAO;AAC9C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,oBAAoB;AAEtC,MAAMC,SAAS,GAAGC,KAAK,IAAIA,KAAK,CAACC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;;AAEtD;AACA,MAAMC,aAAa,GAAGA,CAAC;EAAEC,OAAO;EAAEC,SAAS;EAAEC,YAAY;EAAEC,aAAa;EAAEC;AAAS,CAAC,KAAK;EACvF,MAAMC,QAAQ,GAAGb,KAAK,CAAC,CAAC;EACxB,MAAM,CAACc,KAAK,EAAEC,QAAQ,CAAC,GAAGd,QAAQ,CAAC,EAAE,CAAC;EACtC,MAAM,CAACe,QAAQ,EAAEC,WAAW,CAAC,GAAGhB,QAAQ,CAAC,KAAK,CAAC;EAC/C,MAAMiB,SAAS,GAAG,CAACP,aAAa,IAAIP,SAAS,CAACU,KAAK,CAAC,KAAKV,SAAS,CAACO,aAAa,CAAC;EAEjF,MAAMQ,YAAY,GAAG,CACnB;IACEC,QAAQ,EAAEC,KAAK,IAAI;MACjBA,KAAK,CAACC,eAAe,CAAC,CAAC;MACvB,IAAI,CAACJ,SAAS,EAAE;QACdD,WAAW,CAAC,IAAI,CAAC;QACjB;MACF;MACAR,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EAAEV,SAAS,CAACwC;AACtB,CAAC;AAEDnC,aAAa,CAACoC,YAAY,GAAG;EAC3BhC,aAAa,EAAE,IAAI;EACnBC,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeL,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ConfirmAction"],"sources":["../../../src/components/ConfirmAction/index.js"],"sourcesContent":["import ConfirmAction from './ConfirmAction';\n\nexport default ConfirmAction;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3C,eAAeA,aAAa","ignoreList":[]}
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import ConfirmAction from '../ConfirmAction';
|
|
4
4
|
const DeleteAction = ({
|
|
5
5
|
onClose,
|
|
6
6
|
deleteAction,
|
|
7
|
-
itemName
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
textButton: 'Delete'
|
|
16
|
-
}];
|
|
17
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
18
|
-
actions: alertActions,
|
|
19
|
-
onClose: onClose,
|
|
20
|
-
isAlert: true
|
|
21
|
-
}, /*#__PURE__*/React.createElement("p", null, "You are about to delete: ", /*#__PURE__*/React.createElement("strong", null, itemName)));
|
|
22
|
-
};
|
|
7
|
+
itemName,
|
|
8
|
+
confirmPhrase
|
|
9
|
+
}) => /*#__PURE__*/React.createElement(ConfirmAction, {
|
|
10
|
+
onClose: onClose,
|
|
11
|
+
onConfirm: deleteAction,
|
|
12
|
+
confirmLabel: "Delete",
|
|
13
|
+
confirmPhrase: confirmPhrase
|
|
14
|
+
}, /*#__PURE__*/React.createElement("p", null, "You are about to delete: ", /*#__PURE__*/React.createElement("strong", null, itemName)));
|
|
23
15
|
DeleteAction.propTypes = {
|
|
24
16
|
onClose: PropTypes.func.isRequired,
|
|
25
17
|
deleteAction: PropTypes.func.isRequired,
|
|
26
|
-
itemName: PropTypes.string
|
|
18
|
+
itemName: PropTypes.string,
|
|
19
|
+
confirmPhrase: PropTypes.string
|
|
27
20
|
};
|
|
28
21
|
DeleteAction.defaultProps = {
|
|
29
|
-
itemName: ''
|
|
22
|
+
itemName: '',
|
|
23
|
+
confirmPhrase: null
|
|
30
24
|
};
|
|
31
25
|
export default DeleteAction;
|
|
32
26
|
//# sourceMappingURL=DeleteAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteAction.js","names":["React","PropTypes","
|
|
1
|
+
{"version":3,"file":"DeleteAction.js","names":["React","PropTypes","ConfirmAction","DeleteAction","onClose","deleteAction","itemName","confirmPhrase","createElement","onConfirm","confirmLabel","propTypes","func","isRequired","string","defaultProps"],"sources":["../../../src/components/DeleteAction/DeleteAction.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ConfirmAction from '../ConfirmAction';\n\nconst DeleteAction = ({ onClose, deleteAction, itemName, confirmPhrase }) => (\n <ConfirmAction\n onClose={onClose}\n onConfirm={deleteAction}\n confirmLabel=\"Delete\"\n confirmPhrase={confirmPhrase}>\n <p>\n You are about to delete: <strong>{itemName}</strong>\n </p>\n </ConfirmAction>\n);\n\nDeleteAction.propTypes = {\n onClose: PropTypes.func.isRequired,\n deleteAction: PropTypes.func.isRequired,\n itemName: PropTypes.string,\n confirmPhrase: PropTypes.string\n};\n\nDeleteAction.defaultProps = {\n itemName: '',\n confirmPhrase: null\n};\n\nexport default DeleteAction;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,aAAa,MAAM,kBAAkB;AAE5C,MAAMC,YAAY,GAAGA,CAAC;EAAEC,OAAO;EAAEC,YAAY;EAAEC,QAAQ;EAAEC;AAAc,CAAC,kBACtEP,KAAA,CAAAQ,aAAA,CAACN,aAAa;EACZE,OAAO,EAAEA,OAAQ;EACjBK,SAAS,EAAEJ,YAAa;EACxBK,YAAY,EAAC,QAAQ;EACrBH,aAAa,EAAEA;AAAc,gBAC7BP,KAAA,CAAAQ,aAAA,YAAG,2BACwB,eAAAR,KAAA,CAAAQ,aAAA,iBAASF,QAAiB,CAClD,CACU,CAChB;AAEDH,YAAY,CAACQ,SAAS,GAAG;EACvBP,OAAO,EAAEH,SAAS,CAACW,IAAI,CAACC,UAAU;EAClCR,YAAY,EAAEJ,SAAS,CAACW,IAAI,CAACC,UAAU;EACvCP,QAAQ,EAAEL,SAAS,CAACa,MAAM;EAC1BP,aAAa,EAAEN,SAAS,CAACa;AAC3B,CAAC;AAEDX,YAAY,CAACY,YAAY,GAAG;EAC1BT,QAAQ,EAAE,EAAE;EACZC,aAAa,EAAE;AACjB,CAAC;AAED,eAAeJ,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["icon", "label", "className"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
const HeaderIconButton = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
icon,
|
|
9
|
+
label,
|
|
10
|
+
className
|
|
11
|
+
} = _ref,
|
|
12
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
14
|
+
type: "button",
|
|
15
|
+
className: `page-header__icon-button${className ? ` ${className}` : ''}`,
|
|
16
|
+
title: label,
|
|
17
|
+
"aria-label": label
|
|
18
|
+
}, rest), /*#__PURE__*/React.createElement("span", {
|
|
19
|
+
className: "material-icons",
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}, icon));
|
|
22
|
+
};
|
|
23
|
+
HeaderIconButton.propTypes = {
|
|
24
|
+
icon: PropTypes.string.isRequired,
|
|
25
|
+
label: PropTypes.string.isRequired,
|
|
26
|
+
className: PropTypes.string
|
|
27
|
+
};
|
|
28
|
+
HeaderIconButton.defaultProps = {
|
|
29
|
+
className: ''
|
|
30
|
+
};
|
|
31
|
+
export default HeaderIconButton;
|
|
32
|
+
//# sourceMappingURL=HeaderIconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderIconButton.js","names":["React","PropTypes","HeaderIconButton","_ref","icon","label","className","rest","_objectWithoutProperties","_excluded","createElement","_extends","type","title","propTypes","string","isRequired","defaultProps"],"sources":["../../../src/components/PageHeader/HeaderIconButton.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst HeaderIconButton = ({ icon, label, className, ...rest }) => (\n <button\n type=\"button\"\n className={`page-header__icon-button${className ? ` ${className}` : ''}`}\n title={label}\n aria-label={label}\n {...rest}>\n <span className=\"material-icons\" aria-hidden=\"true\">\n {icon}\n </span>\n </button>\n);\n\nHeaderIconButton.propTypes = {\n icon: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n className: PropTypes.string\n};\n\nHeaderIconButton.defaultProps = {\n className: ''\n};\n\nexport default HeaderIconButton;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;MAAEC,IAAI;MAAEC,KAAK;MAAEC;IAAmB,CAAC,GAAAH,IAAA;IAANI,IAAI,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAAA,oBACzDT,KAAA,CAAAU,aAAA,WAAAC,QAAA;IACEC,IAAI,EAAC,QAAQ;IACbN,SAAS,EAAE,2BAA2BA,SAAS,GAAG,IAAIA,SAAS,EAAE,GAAG,EAAE,EAAG;IACzEO,KAAK,EAAER,KAAM;IACb,cAAYA;EAAM,GACdE,IAAI,gBACRP,KAAA,CAAAU,aAAA;IAAMJ,SAAS,EAAC,gBAAgB;IAAC,eAAY;EAAM,GAChDF,IACG,CACA,CAAC;AAAA,CACV;AAEDF,gBAAgB,CAACY,SAAS,GAAG;EAC3BV,IAAI,EAAEH,SAAS,CAACc,MAAM,CAACC,UAAU;EACjCX,KAAK,EAAEJ,SAAS,CAACc,MAAM,CAACC,UAAU;EAClCV,SAAS,EAAEL,SAAS,CAACc;AACvB,CAAC;AAEDb,gBAAgB,CAACe,YAAY,GAAG;EAC9BX,SAAS,EAAE;AACb,CAAC;AAED,eAAeJ,gBAAgB","ignoreList":[]}
|