@semcore/modal 3.0.17 → 3.0.19

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 CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [3.0.19] - 2022-09-21
6
+
7
+ ### Changed
8
+
9
+ - Version patch update due to children dependencies update (`@semcore/icon` [2.30.3 ~> 2.30.4]).
10
+
11
+ ## [3.0.18] - 2022-09-21
12
+
13
+ ### Changed
14
+
15
+ - Version patch update due to children dependencies update (`@semcore/icon` [2.30.2 ~> 2.30.3]).
16
+
5
17
  ## [3.0.17] - 2022-08-30
6
18
 
7
19
  ### Changed
package/lib/cjs/Modal.js CHANGED
@@ -70,15 +70,15 @@ var style = (
70
70
  /*__reshadow_css_start__*/
71
71
  _core.sstyled.insert(
72
72
  /*__inner_css_start__*/
73
- ".___SWindow_1xkza_gg_{position:relative;border-radius:12px;background:#ffffff;box-sizing:border-box;margin:auto;padding:40px;box-shadow:0 3px 8px rgba(25,27,35,.2)}.___SWindow_1xkza_gg_:focus{outline:none}.___SOverlay_1xkza_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:40px;background:rgba(25,27,35,.7);overflow:auto;z-index:10005;-webkit-overflow-scrolling:touch}.___SOverlay_1xkza_gg_ .___SOverlay_1xkza_gg_{background:rgba(25,27,35,.4)}.___SClose_1xkza_gg_{display:inline-flex;position:absolute;right:0;top:0;padding:12px;color:#a9abb6;cursor:pointer;z-index:1;border:none;background:none;outline:none}.___SClose_1xkza_gg_:hover{color:#8a8e9b}.___SClose_1xkza_gg_.__keyboardFocused_1xkza_gg_{box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}@media (max-width:767px){.___SWindow_1xkza_gg_{min-width:60%}.___SOverlay_1xkza_gg_{padding:12px}}"
73
+ ".___SWindow_1p1zc_gg_{position:relative;border-radius:12px;background:#ffffff;box-sizing:border-box;margin:auto;padding:40px;box-shadow:0 3px 8px rgba(25,27,35,.2)}.___SWindow_1p1zc_gg_:focus{outline:none}.___SOverlay_1p1zc_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:40px;background:rgba(25,27,35,.7);overflow:auto;z-index:10005;-webkit-overflow-scrolling:touch}.___SOverlay_1p1zc_gg_ .___SOverlay_1p1zc_gg_{background:rgba(25,27,35,.4)}.___SClose_1p1zc_gg_{display:inline-flex;position:absolute;right:0;top:0;padding:12px;color:#a9abb6;cursor:pointer;z-index:1;border:none;background:none;outline:none}.___SClose_1p1zc_gg_:hover{color:#8a8e9b}.___SClose_1p1zc_gg_.__keyboardFocused_1p1zc_gg_{box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}@media (max-width:767px){.___SWindow_1p1zc_gg_{min-width:60%}.___SOverlay_1p1zc_gg_{padding:12px}}"
74
74
  /*__inner_css_end__*/
75
- , "1xkza_gg_")
75
+ , "1p1zc_gg_")
76
76
  /*__reshadow_css_end__*/
77
77
  , {
78
- "__SWindow": "___SWindow_1xkza_gg_",
79
- "__SOverlay": "___SOverlay_1xkza_gg_",
80
- "__SClose": "___SClose_1xkza_gg_",
81
- "_keyboardFocused": "__keyboardFocused_1xkza_gg_"
78
+ "__SWindow": "___SWindow_1p1zc_gg_",
79
+ "__SOverlay": "___SOverlay_1p1zc_gg_",
80
+ "__SClose": "___SClose_1p1zc_gg_",
81
+ "_keyboardFocused": "__keyboardFocused_1p1zc_gg_"
82
82
  });
83
83
 
84
84
  var ModalRoot = /*#__PURE__*/function (_Component) {
@@ -193,8 +193,8 @@ function Window(props) {
193
193
  "tabIndex": -1,
194
194
  "autoFocus": true,
195
195
  "role": "dialog",
196
- "aria-modal": true,
197
- "aria-label": "Modal window"
196
+ "aria-label": "Modal window",
197
+ "aria-modal": true
198
198
  }, _ref2))), /*#__PURE__*/_react["default"].createElement(_portal.PortalProvider, _ref5.cn("PortalProvider", {
199
199
  "value": windowRef
200
200
  }), closable && /*#__PURE__*/_react["default"].createElement(Modal.Close, null), /*#__PURE__*/_react["default"].createElement(Children, _ref5.cn("Children", {}))));
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["ModalRoot","e","key","stopPropagation","fire","asProps","duration","visible","onOutsideClick","handleOutsideClick","closable","onKeyDown","handleKeyDown","onClick","handleIconCloseClick","Children","disablePortal","advanceMode","isAdvanceMode","Modal","Overlay","displayName","Window","Component","style","FocusLockWrapper","React","forwardRef","ref","tag","other","props","SWindow","styles","windowRef","useRef","sstyled","Box","SOverlay","FadeInOut","overlayRef","usePreventScroll","Close","SClose","defaultProps","children","enhance","keyboardFocusEnhance","createComponent"],"sources":["../../src/Modal.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport FocusLock from 'react-focus-lock';\nimport { FadeInOut } from '@semcore/animation';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport Portal, { PortalProvider } from '@semcore/portal';\nimport { Box } from '@semcore/flex-box';\nimport OutsideClick from '@semcore/outside-click';\nimport CloseIcon from '@semcore/icon/Close/l';\nimport fire from '@semcore/utils/lib/fire';\nimport usePreventScroll from '@semcore/utils/lib/use/usePreventScroll';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport style from './style/modal.shadow.css';\n\nclass ModalRoot extends Component {\n static displayName = 'Modal';\n static style = style;\n static defaultProps = {\n duration: 200,\n closable: true,\n };\n\n handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n fire(this, 'onClose', 'onEscape', e);\n }\n };\n\n handleIconCloseClick = (e) => {\n fire(this, 'onClose', 'onCloseClick', e);\n };\n\n handleOutsideClick = (e) => {\n fire(this, 'onClose', 'onOutsideClick', e);\n };\n\n getOverlayProps() {\n const { duration, visible } = this.asProps;\n return {\n duration,\n visible,\n onOutsideClick: this.handleOutsideClick,\n };\n }\n\n getWindowProps() {\n const { visible, closable } = this.asProps;\n return {\n visible,\n closable,\n onKeyDown: this.handleKeyDown,\n };\n }\n\n getCloseProps() {\n return {\n onClick: this.handleIconCloseClick,\n };\n }\n\n render() {\n const { Children, disablePortal } = this.asProps;\n\n const advanceMode = isAdvanceMode(Children, [\n Modal.Overlay.displayName,\n Modal.Window.displayName,\n ]);\n\n return (\n <Portal disablePortal={disablePortal}>\n {advanceMode ? (\n <Children />\n ) : (\n <Modal.Overlay>\n <Root render={Modal.Window} />\n </Modal.Overlay>\n )}\n </Portal>\n );\n }\n}\n\nconst FocusLockWrapper = React.forwardRef(function ({ tag, ...other }, ref) {\n return <FocusLock ref={ref} as={tag} lockProps={other} {...other} />;\n});\n\nfunction Window(props) {\n const SWindow = Root;\n const { Children, styles, visible, closable } = props;\n const windowRef = useRef(null);\n\n if (!visible) return null;\n\n return sstyled(styles)(\n <SWindow\n render={FocusLockWrapper}\n tag={Box}\n ref={windowRef}\n returnFocus={true}\n tabIndex={-1}\n autoFocus={true}\n role=\"dialog\"\n aria-modal={true}\n aria-label=\"Modal window\"\n >\n <PortalProvider value={windowRef}>\n {closable && <Modal.Close />}\n <Children />\n </PortalProvider>\n </SWindow>,\n );\n}\n\nfunction Overlay(props) {\n const SOverlay = Root;\n const { Children, styles, onOutsideClick, visible } = props;\n const overlayRef = useRef(null);\n usePreventScroll(visible);\n\n return sstyled(styles)(\n <SOverlay render={FadeInOut} ref={overlayRef}>\n <OutsideClick root={overlayRef} onOutsideClick={onOutsideClick}>\n <Children />\n </OutsideClick>\n </SOverlay>,\n );\n}\n\nfunction Close(props) {\n const SClose = Root;\n return sstyled(props.styles)(\n <SClose render={Box} tag=\"button\" tabIndex={0} aria-label=\"Close\" />,\n );\n}\n\nClose.defaultProps = {\n children: <CloseIcon title=\"Close\" />,\n};\n\nClose.enhance = [keyboardFocusEnhance()];\n\nconst Modal = createComponent(ModalRoot, {\n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AN,GAAgB,CAAC,IAAAC,gCAAA,GAAD,CAAhB;AAEA,IAAM5B,KAAK,GAAG,IAAA6B,gBAAA,EAAgBhD,SAAhB,EAA2B;EACvCsB,MAAM,EAANA,MADuC;EAEvCF,OAAO,EAAPA,OAFuC;EAGvCsB,KAAK,EAALA;AAHuC,CAA3B,CAAd;eAMevB,K"}
1
+ {"version":3,"file":"Modal.js","names":["ModalRoot","e","key","stopPropagation","fire","asProps","duration","visible","onOutsideClick","handleOutsideClick","closable","onKeyDown","handleKeyDown","onClick","handleIconCloseClick","Children","disablePortal","advanceMode","isAdvanceMode","Modal","Overlay","displayName","Window","Component","style","FocusLockWrapper","React","forwardRef","ref","tag","other","props","SWindow","styles","windowRef","useRef","sstyled","Box","SOverlay","FadeInOut","overlayRef","usePreventScroll","Close","SClose","defaultProps","children","enhance","keyboardFocusEnhance","createComponent"],"sources":["../../src/Modal.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport FocusLock from 'react-focus-lock';\nimport { FadeInOut } from '@semcore/animation';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport Portal, { PortalProvider } from '@semcore/portal';\nimport { Box } from '@semcore/flex-box';\nimport OutsideClick from '@semcore/outside-click';\nimport CloseIcon from '@semcore/icon/Close/l';\nimport fire from '@semcore/utils/lib/fire';\nimport usePreventScroll from '@semcore/utils/lib/use/usePreventScroll';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport style from './style/modal.shadow.css';\n\nclass ModalRoot extends Component {\n static displayName = 'Modal';\n static style = style;\n static defaultProps = {\n duration: 200,\n closable: true,\n };\n\n handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n fire(this, 'onClose', 'onEscape', e);\n }\n };\n\n handleIconCloseClick = (e) => {\n fire(this, 'onClose', 'onCloseClick', e);\n };\n\n handleOutsideClick = (e) => {\n fire(this, 'onClose', 'onOutsideClick', e);\n };\n\n getOverlayProps() {\n const { duration, visible } = this.asProps;\n return {\n duration,\n visible,\n onOutsideClick: this.handleOutsideClick,\n };\n }\n\n getWindowProps() {\n const { visible, closable } = this.asProps;\n return {\n visible,\n closable,\n onKeyDown: this.handleKeyDown,\n };\n }\n\n getCloseProps() {\n return {\n onClick: this.handleIconCloseClick,\n };\n }\n\n render() {\n const { Children, disablePortal } = this.asProps;\n\n const advanceMode = isAdvanceMode(Children, [\n Modal.Overlay.displayName,\n Modal.Window.displayName,\n ]);\n\n return (\n <Portal disablePortal={disablePortal}>\n {advanceMode ? (\n <Children />\n ) : (\n <Modal.Overlay>\n <Root render={Modal.Window} />\n </Modal.Overlay>\n )}\n </Portal>\n );\n }\n}\n\nconst FocusLockWrapper = React.forwardRef(function ({ tag, ...other }, ref) {\n return <FocusLock ref={ref} as={tag} lockProps={other} {...other} />;\n});\n\nfunction Window(props) {\n const SWindow = Root;\n const { Children, styles, visible, closable } = props;\n const windowRef = useRef(null);\n\n if (!visible) return null;\n\n return sstyled(styles)(\n <SWindow\n render={FocusLockWrapper}\n tag={Box}\n ref={windowRef}\n returnFocus={true}\n tabIndex={-1}\n autoFocus={true}\n role=\"dialog\"\n aria-label=\"Modal window\"\n aria-modal={true}\n >\n <PortalProvider value={windowRef}>\n {closable && <Modal.Close />}\n <Children />\n </PortalProvider>\n </SWindow>,\n );\n}\n\nfunction Overlay(props) {\n const SOverlay = Root;\n const { Children, styles, onOutsideClick, visible } = props;\n const overlayRef = useRef(null);\n usePreventScroll(visible);\n\n return sstyled(styles)(\n <SOverlay render={FadeInOut} ref={overlayRef}>\n <OutsideClick root={overlayRef} onOutsideClick={onOutsideClick}>\n <Children />\n </OutsideClick>\n </SOverlay>,\n );\n}\n\nfunction Close(props) {\n const SClose = Root;\n return sstyled(props.styles)(\n <SClose render={Box} tag=\"button\" tabIndex={0} aria-label=\"Close\" />,\n );\n}\n\nClose.defaultProps = {\n children: <CloseIcon title=\"Close\" />,\n};\n\nClose.enhance = [keyboardFocusEnhance()];\n\nconst Modal = createComponent(ModalRoot, {\n Window,\n Overlay,\n Close,\n});\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGMA,S;;;;;;;;;;;;;;;sGAQY,UAACC,CAAD,EAAO;MACrB,IAAIA,CAAC,CAACC,GAAF,KAAU,QAAd,EAAwB;QACtBD,CAAC,CAACE,eAAF;QACA,IAAAC,gBAAA,kDAAW,SAAX,EAAsB,UAAtB,EAAkCH,CAAlC;MACD;IACF,C;6GAEsB,UAACA,CAAD,EAAO;MAC5B,IAAAG,gBAAA,kDAAW,SAAX,EAAsB,cAAtB,EAAsCH,CAAtC;IACD,C;2GAEoB,UAACA,CAAD,EAAO;MAC1B,IAAAG,gBAAA,kDAAW,SAAX,EAAsB,gBAAtB,EAAwCH,CAAxC;IACD,C;;;;;;WAED,2BAAkB;MAChB,oBAA8B,KAAKI,OAAnC;MAAA,IAAQC,QAAR,iBAAQA,QAAR;MAAA,IAAkBC,OAAlB,iBAAkBA,OAAlB;MACA,OAAO;QACLD,QAAQ,EAARA,QADK;QAELC,OAAO,EAAPA,OAFK;QAGLC,cAAc,EAAE,KAAKC;MAHhB,CAAP;IAKD;;;WAED,0BAAiB;MACf,qBAA8B,KAAKJ,OAAnC;MAAA,IAAQE,OAAR,kBAAQA,OAAR;MAAA,IAAiBG,QAAjB,kBAAiBA,QAAjB;MACA,OAAO;QACLH,OAAO,EAAPA,OADK;QAELG,QAAQ,EAARA,QAFK;QAGLC,SAAS,EAAE,KAAKC;MAHX,CAAP;IAKD;;;WAED,yBAAgB;MACd,OAAO;QACLC,OAAO,EAAE,KAAKC;MADT,CAAP;IAGD;;;WAED,kBAAS;MAAA;MACP,qBAAoC,KAAKT,OAAzC;MAAA,IAAQU,QAAR,kBAA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AAK,EAAC;EAAjB;AADS,CAArB;AAIAH,KAAK,CAACI,OAAN,GAAgB,CAAC,IAAAC,gCAAA,GAAD,CAAhB;AAEA,IAAM5B,KAAK,GAAG,IAAA6B,gBAAA,EAAgBhD,SAAhB,EAA2B;EACvCsB,MAAM,EAANA,MADuC;EAEvCF,OAAO,EAAPA,OAFuC;EAGvCsB,KAAK,EAALA;AAHuC,CAA3B,CAAd;eAMevB,K"}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
+
9
+ var _test = require("@playwright/test");
10
+
11
+ var _playwright = require("@guidepup/playwright");
12
+
13
+ var _e2eStand = require("@semcore/jest-preset-ui/e2e-stand");
14
+
15
+ var _path = require("path");
16
+
17
+ var _promises = require("fs/promises");
18
+
19
+ var _voReporter = require("@semcore/jest-preset-ui/vo-reporter");
20
+
21
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
22
+
23
+ (0, _playwright.voTest)('Users can interact with Modal via VoiceOver', /*#__PURE__*/function () {
24
+ var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
25
+ var page, pureVoiceOver, standPath, reportPath, htmlContent, _yield$makeVoiceOverR, voiceOver, getReport, report;
26
+
27
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
28
+ while (1) {
29
+ switch (_context.prev = _context.next) {
30
+ case 0:
31
+ page = _ref.page, pureVoiceOver = _ref.voiceOver;
32
+ standPath = (0, _path.resolve)(__dirname, '../../../website/docs/components/modal/examples/modal.jsx');
33
+ reportPath = (0, _path.resolve)(__dirname, '../../../website/docs/components/modal/modal-a11y-report.md');
34
+ _context.next = 5;
35
+ return (0, _e2eStand.e2eStandToHtml)(standPath, 'en');
36
+
37
+ case 5:
38
+ htmlContent = _context.sent;
39
+ _context.next = 8;
40
+ return page.setContent(htmlContent);
41
+
42
+ case 8:
43
+ _context.next = 10;
44
+ return (0, _voReporter.makeVoiceOverReporter)(pureVoiceOver);
45
+
46
+ case 10:
47
+ _yield$makeVoiceOverR = _context.sent;
48
+ voiceOver = _yield$makeVoiceOverR.voiceOver;
49
+ getReport = _yield$makeVoiceOverR.getReport;
50
+ _context.next = 15;
51
+ return voiceOver.interact();
52
+
53
+ case 15:
54
+ _context.t0 = _test.expect;
55
+ _context.next = 18;
56
+ return voiceOver.itemText();
57
+
58
+ case 18:
59
+ _context.t1 = _context.sent;
60
+ (0, _context.t0)(_context.t1).toBe('Open modal button');
61
+ _context.next = 22;
62
+ return voiceOver.act();
63
+
64
+ case 22:
65
+ _context.t2 = _test.expect;
66
+ _context.next = 25;
67
+ return voiceOver.lastSpokenPhrase();
68
+
69
+ case 25:
70
+ _context.t3 = _context.sent;
71
+ (0, _context.t2)(_context.t3).toBe('Modal window web dialog with 5 items Close button');
72
+ _context.next = 29;
73
+ return voiceOver.next();
74
+
75
+ case 29:
76
+ _context.t4 = _test.expect;
77
+ _context.next = 32;
78
+ return voiceOver.itemText();
79
+
80
+ case 32:
81
+ _context.t5 = _context.sent;
82
+ (0, _context.t4)(_context.t5).toBe('Do you want to save your changes? heading level 2');
83
+ _context.next = 36;
84
+ return voiceOver.next();
85
+
86
+ case 36:
87
+ _context.next = 38;
88
+ return voiceOver.next();
89
+
90
+ case 38:
91
+ _context.t6 = _test.expect;
92
+ _context.next = 41;
93
+ return voiceOver.itemText();
94
+
95
+ case 41:
96
+ _context.t7 = _context.sent;
97
+ (0, _context.t6)(_context.t7).toBe('Save changes button');
98
+ _context.next = 45;
99
+ return voiceOver.act();
100
+
101
+ case 45:
102
+ _context.t8 = _test.expect;
103
+ _context.next = 48;
104
+ return voiceOver.itemText();
105
+
106
+ case 48:
107
+ _context.t9 = _context.sent;
108
+ (0, _context.t8)(_context.t9).toBe('Open modal button');
109
+ _context.next = 52;
110
+ return (0, _voReporter.getReportHeader)();
111
+
112
+ case 52:
113
+ _context.t10 = _context.sent;
114
+ _context.t11 = _context.t10 + '\n\n';
115
+ _context.next = 56;
116
+ return getReport(standPath);
117
+
118
+ case 56:
119
+ _context.t12 = _context.sent;
120
+ report = _context.t11 + _context.t12;
121
+ _context.next = 60;
122
+ return (0, _promises.writeFile)(reportPath, report);
123
+
124
+ case 60:
125
+ case "end":
126
+ return _context.stop();
127
+ }
128
+ }
129
+ }, _callee);
130
+ }));
131
+
132
+ return function (_x) {
133
+ return _ref2.apply(this, arguments);
134
+ };
135
+ }());
136
+ //# sourceMappingURL=modal.vo-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.vo-test.js","names":["test","page","pureVoiceOver","voiceOver","standPath","resolvePath","__dirname","reportPath","e2eStandToHtml","htmlContent","setContent","makeVoiceOverReporter","getReport","interact","expect","itemText","toBe","act","lastSpokenPhrase","next","getReportHeader","report","writeFile"],"sources":["../../src/modal.vo-test.ts"],"sourcesContent":["import { expect } from '@playwright/test';\nimport { voTest as test } from '@guidepup/playwright';\nimport { e2eStandToHtml } from '@semcore/jest-preset-ui/e2e-stand';\nimport { resolve as resolvePath } from 'path';\nimport { writeFile } from 'fs/promises';\nimport { getReportHeader, makeVoiceOverReporter } from '@semcore/jest-preset-ui/vo-reporter';\n\ntest('Users can interact with Modal via VoiceOver', async ({ page, voiceOver: pureVoiceOver }) => {\n const standPath = resolvePath(\n __dirname,\n '../../../website/docs/components/modal/examples/modal.jsx',\n );\n const reportPath = resolvePath(\n __dirname,\n '../../../website/docs/components/modal/modal-a11y-report.md',\n );\n const htmlContent = await e2eStandToHtml(standPath, 'en');\n\n await page.setContent(htmlContent);\n const { voiceOver, getReport } = await makeVoiceOverReporter(pureVoiceOver);\n await voiceOver.interact();\n\n expect(await voiceOver.itemText()).toBe('Open modal button');\n await voiceOver.act();\n expect(await voiceOver.lastSpokenPhrase()).toBe(\n 'Modal window web dialog with 5 items Close button',\n );\n await voiceOver.next();\n expect(await voiceOver.itemText()).toBe('Do you want to save your changes? heading level 2');\n await voiceOver.next();\n await voiceOver.next();\n expect(await voiceOver.itemText()).toBe('Save changes button');\n await voiceOver.act();\n expect(await voiceOver.itemText()).toBe('Open modal button');\n\n const report = (await getReportHeader()) + '\\n\\n' + (await getReport(standPath));\n\n await writeFile(reportPath, report);\n});\n"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;+CAJA,oJ;;AAMA,IAAAA,kBAAA,EAAK,6CAAL;EAAA,wF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AxBqC;;UAAA;YAAA;YAAA,8BAwBfC,IAxBe,CAwBV,qBAxBU;YAAA;YAAA,OAyB5Cb,SAAS,CAACc,GAAV,EAzB4C;;UAAA;YAAA,cA0BlDH,YA1BkD;YAAA;YAAA,OA0BrCX,SAAS,CAACY,QAAV,EA1BqC;;UAAA;YAAA;YAAA,8BA0BfC,IA1Be,CA0BV,mBA1BU;YAAA;YAAA,OA4B5B,IAAAI,2BAAA,GA5B4B;;UAAA;YAAA;YAAA,8BA4BP,MA5BO;YAAA;YAAA,OA4BSR,SAAS,CAACR,SAAD,CA5BlB;;UAAA;YAAA;YA4B5CiB,MA5B4C;YAAA;YAAA,OA8B5C,IAAAC,mBAAA,EAAUf,UAAV,EAAsBc,MAAtB,CA9B4C;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAApD;;EAAA;IAAA;EAAA;AAAA"}
package/lib/es6/Modal.js CHANGED
@@ -40,15 +40,15 @@ var style = (
40
40
  /*__reshadow_css_start__*/
41
41
  _sstyled.insert(
42
42
  /*__inner_css_start__*/
43
- ".___SWindow_1xkza_gg_{position:relative;border-radius:12px;background:#ffffff;box-sizing:border-box;margin:auto;padding:40px;box-shadow:0 3px 8px rgba(25,27,35,.2)}.___SWindow_1xkza_gg_:focus{outline:none}.___SOverlay_1xkza_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:40px;background:rgba(25,27,35,.7);overflow:auto;z-index:10005;-webkit-overflow-scrolling:touch}.___SOverlay_1xkza_gg_ .___SOverlay_1xkza_gg_{background:rgba(25,27,35,.4)}.___SClose_1xkza_gg_{display:inline-flex;position:absolute;right:0;top:0;padding:12px;color:#a9abb6;cursor:pointer;z-index:1;border:none;background:none;outline:none}.___SClose_1xkza_gg_:hover{color:#8a8e9b}.___SClose_1xkza_gg_.__keyboardFocused_1xkza_gg_{box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}@media (max-width:767px){.___SWindow_1xkza_gg_{min-width:60%}.___SOverlay_1xkza_gg_{padding:12px}}"
43
+ ".___SWindow_1p1zc_gg_{position:relative;border-radius:12px;background:#ffffff;box-sizing:border-box;margin:auto;padding:40px;box-shadow:0 3px 8px rgba(25,27,35,.2)}.___SWindow_1p1zc_gg_:focus{outline:none}.___SOverlay_1p1zc_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:40px;background:rgba(25,27,35,.7);overflow:auto;z-index:10005;-webkit-overflow-scrolling:touch}.___SOverlay_1p1zc_gg_ .___SOverlay_1p1zc_gg_{background:rgba(25,27,35,.4)}.___SClose_1p1zc_gg_{display:inline-flex;position:absolute;right:0;top:0;padding:12px;color:#a9abb6;cursor:pointer;z-index:1;border:none;background:none;outline:none}.___SClose_1p1zc_gg_:hover{color:#8a8e9b}.___SClose_1p1zc_gg_.__keyboardFocused_1p1zc_gg_{box-shadow:0 0 0 3px rgba(0, 143, 248, 0.2)}@media (max-width:767px){.___SWindow_1p1zc_gg_{min-width:60%}.___SOverlay_1p1zc_gg_{padding:12px}}"
44
44
  /*__inner_css_end__*/
45
- , "1xkza_gg_")
45
+ , "1p1zc_gg_")
46
46
  /*__reshadow_css_end__*/
47
47
  , {
48
- "__SWindow": "___SWindow_1xkza_gg_",
49
- "__SOverlay": "___SOverlay_1xkza_gg_",
50
- "__SClose": "___SClose_1xkza_gg_",
51
- "_keyboardFocused": "__keyboardFocused_1xkza_gg_"
48
+ "__SWindow": "___SWindow_1p1zc_gg_",
49
+ "__SOverlay": "___SOverlay_1p1zc_gg_",
50
+ "__SClose": "___SClose_1p1zc_gg_",
51
+ "_keyboardFocused": "__keyboardFocused_1p1zc_gg_"
52
52
  });
53
53
 
54
54
  var ModalRoot = /*#__PURE__*/function (_Component) {
@@ -171,8 +171,8 @@ function Window(props) {
171
171
  "tabIndex": -1,
172
172
  "autoFocus": true,
173
173
  "role": "dialog",
174
- "aria-modal": true,
175
- "aria-label": "Modal window"
174
+ "aria-label": "Modal window",
175
+ "aria-modal": true
176
176
  }, _ref2))), /*#__PURE__*/React.createElement(PortalProvider, _ref5.cn("PortalProvider", {
177
177
  "value": windowRef
178
178
  }), closable && /*#__PURE__*/React.createElement(Modal.Close, null), /*#__PURE__*/React.createElement(Children, _ref5.cn("Children", {}))));
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["React","useRef","FocusLock","FadeInOut","createComponent","Component","sstyled","Root","Portal","PortalProvider","Box","OutsideClick","CloseIcon","fire","usePreventScroll","isAdvanceMode","keyboardFocusEnhance","ModalRoot","e","key","stopPropagation","asProps","duration","visible","onOutsideClick","handleOutsideClick","closable","onKeyDown","handleKeyDown","onClick","handleIconCloseClick","Children","disablePortal","advanceMode","Modal","Overlay","displayName","Window","style","FocusLockWrapper","forwardRef","ref","tag","other","props","SWindow","styles","windowRef","SOverlay","overlayRef","Close","SClose","defaultProps","children","enhance"],"sources":["../../src/Modal.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport FocusLock from 'react-focus-lock';\nimport { FadeInOut } from '@semcore/animation';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport Portal, { PortalProvider } from '@semcore/portal';\nimport { Box } from '@semcore/flex-box';\nimport OutsideClick from '@semcore/outside-click';\nimport CloseIcon from '@semcore/icon/Close/l';\nimport fire from '@semcore/utils/lib/fire';\nimport usePreventScroll from '@semcore/utils/lib/use/usePreventScroll';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport style from './style/modal.shadow.css';\n\nclass ModalRoot extends Component {\n static displayName = 'Modal';\n static style = style;\n static defaultProps = {\n duration: 200,\n closable: true,\n };\n\n handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n fire(this, 'onClose', 'onEscape', e);\n }\n };\n\n handleIconCloseClick = (e) => {\n fire(this, 'onClose', 'onCloseClick', e);\n };\n\n handleOutsideClick = (e) => {\n fire(this, 'onClose', 'onOutsideClick', e);\n };\n\n getOverlayProps() {\n const { duration, visible } = this.asProps;\n return {\n duration,\n visible,\n onOutsideClick: this.handleOutsideClick,\n };\n }\n\n getWindowProps() {\n const { visible, closable } = this.asProps;\n return {\n visible,\n closable,\n onKeyDown: this.handleKeyDown,\n };\n }\n\n getCloseProps() {\n return {\n onClick: this.handleIconCloseClick,\n };\n }\n\n render() {\n const { Children, disablePortal } = this.asProps;\n\n const advanceMode = isAdvanceMode(Children, [\n Modal.Overlay.displayName,\n Modal.Window.displayName,\n ]);\n\n return (\n <Portal disablePortal={disablePortal}>\n {advanceMode ? (\n <Children />\n ) : (\n <Modal.Overlay>\n <Root render={Modal.Window} />\n </Modal.Overlay>\n )}\n </Portal>\n );\n }\n}\n\nconst FocusLockWrapper = React.forwardRef(function ({ tag, ...other }, ref) {\n return <FocusLock ref={ref} as={tag} lockProps={other} {...other} />;\n});\n\nfunction Window(props) {\n const SWindow = Root;\n const { Children, styles, visible, closable } = props;\n const windowRef = useRef(null);\n\n if (!visible) return null;\n\n return sstyled(styles)(\n <SWindow\n render={FocusLockWrapper}\n tag={Box}\n ref={windowRef}\n returnFocus={true}\n tabIndex={-1}\n autoFocus={true}\n role=\"dialog\"\n aria-modal={true}\n aria-label=\"Modal window\"\n >\n <PortalProvider value={windowRef}>\n {closable && <Modal.Close />}\n <Children />\n </PortalProvider>\n </SWindow>,\n );\n}\n\nfunction Overlay(props) {\n const SOverlay = Root;\n const { Children, styles, onOutsideClick, visible } = props;\n const overlayRef = useRef(null);\n usePreventScroll(visible);\n\n return sstyled(styles)(\n <SOverlay render={FadeInOut} ref={overlayRef}>\n <OutsideClick root={overlayRef} onOutsideClick={onOutsideClick}>\n <Children />\n </OutsideClick>\n </SOverlay>,\n );\n}\n\nfunction Close(props) {\n const SClose = Root;\n return sstyled(props.styles)(\n <SClose render={Box} tag=\"button\" tabIndex={0} aria-label=\"Close\" />,\n );\n}\n\nClose.defaultProps = {\n children: <CloseIcon title=\"Close\" />,\n};\n\nClose.enhance = [keyboardFocusEnhance()];\n\nconst Modal = createComponent(ModalRoot, {\n Window,\n Overlay,\n Close,\n});\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,MAAhB,QAA8B,OAA9B;AACA,OAAOC,SAAP,MAAsB,kBAAtB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,OAAOC,MAAP,IAAiBC,cAAjB,QAAuC,iBAAvC;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,YAAP,MAAyB,wBAAzB;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,OAAOC,IAAP,MAAiB,yBAAjB;AACA,OAAOC,gBAAP,MAA6B,yCAA7B;AACA,SAASC,aAAT,QAA8B,kCAA9B;AACA,OAAOC,oBAAP,MAAiC,kDAAjC;;;;;;;;;;;;;;;;;;IAGMC,S;;;;;;;;;;;;;;;;oEAQY,UAACC,CAAD,EAAO;MACrB,IAAIA,CAAC,CAACC,GAAF,KAAU,QAAd,EAAwB;QACtBD,CAAC,CAACE,eAAF;QACAP,IAAI,gCAAO,SAAP,EAAkB,UAAlB,EAA8BK,CAA9B,CAAJ;MACD;IACF,C;;2EAEsB,UAACA,CAAD,EAAO;MAC5BL,IAAI,gCAAO,SAAP,EAAkB,cAAlB,EAAkCK,CAAlC,CAAJ;IACD,C;;yEAEoB,UAACA,CAAD,EAAO;MAC1BL,IAAI,gCAAO,SAAP,EAAkB,gBAAlB,EAAoCK,CAApC,CAAJ;IACD,C;;;;;;;WAED,2BAAkB;MAChB,oBAA8B,KAAKG,OAAnC;MAAA,IAAQC,QAAR,iBAAQA,QAAR;MAAA,IAAkBC,OAAlB,iBAAkBA,OAAlB;MACA,OAAO;QACLD,QAAQ,EAARA,QADK;QAELC,OAAO,EAAPA,OAFK;QAG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A,kBAAgDzB;EAAhD,iBACE,oBAAC,QAAD,2BADF,CADF,CADF;AAOD;;AAED,SAAS0B,KAAT,CAAeN,KAAf,EAAsB;EAAA;EAAA;;EACpB,IAAMO,MAAM,GAEMzC,GAFlB;EACA,eAAOJ,OAAO,CAACsC,KAAK,CAACE,MAAP,CAAd,eACE,oBAAC,MAAD;IAAA,OAAyB,QAAzB;IAAA,YAA4C,CAA5C;IAAA,cAA0D;EAA1D,YADF;AAGD;;AAEDI,KAAK,CAACE,YAAN,GAAqB;EACnBC,QAAQ,eAAE,oBAAC,SAAD;IAAW,KAAK,EAAC;EAAjB;AADS,CAArB;AAIAH,KAAK,CAACI,OAAN,GAAgB,CAACtC,oBAAoB,EAArB,CAAhB;AAEA,IAAMkB,KAAK,GAAG9B,eAAe,CAACa,SAAD,EAAY;EACvCoB,MAAM,EAANA,MADuC;EAEvCF,OAAO,EAAPA,OAFuC;EAGvCe,KAAK,EAALA;AAHuC,CAAZ,CAA7B;AAMA,eAAehB,KAAf"}
1
+ {"version":3,"file":"Modal.js","names":["React","useRef","FocusLock","FadeInOut","createComponent","Component","sstyled","Root","Portal","PortalProvider","Box","OutsideClick","CloseIcon","fire","usePreventScroll","isAdvanceMode","keyboardFocusEnhance","ModalRoot","e","key","stopPropagation","asProps","duration","visible","onOutsideClick","handleOutsideClick","closable","onKeyDown","handleKeyDown","onClick","handleIconCloseClick","Children","disablePortal","advanceMode","Modal","Overlay","displayName","Window","style","FocusLockWrapper","forwardRef","ref","tag","other","props","SWindow","styles","windowRef","SOverlay","overlayRef","Close","SClose","defaultProps","children","enhance"],"sources":["../../src/Modal.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport FocusLock from 'react-focus-lock';\nimport { FadeInOut } from '@semcore/animation';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport Portal, { PortalProvider } from '@semcore/portal';\nimport { Box } from '@semcore/flex-box';\nimport OutsideClick from '@semcore/outside-click';\nimport CloseIcon from '@semcore/icon/Close/l';\nimport fire from '@semcore/utils/lib/fire';\nimport usePreventScroll from '@semcore/utils/lib/use/usePreventScroll';\nimport { isAdvanceMode } from '@semcore/utils/lib/findComponent';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport style from './style/modal.shadow.css';\n\nclass ModalRoot extends Component {\n static displayName = 'Modal';\n static style = style;\n static defaultProps = {\n duration: 200,\n closable: true,\n };\n\n handleKeyDown = (e) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n fire(this, 'onClose', 'onEscape', e);\n }\n };\n\n handleIconCloseClick = (e) => {\n fire(this, 'onClose', 'onCloseClick', e);\n };\n\n handleOutsideClick = (e) => {\n fire(this, 'onClose', 'onOutsideClick', e);\n };\n\n getOverlayProps() {\n const { duration, visible } = this.asProps;\n return {\n duration,\n visible,\n onOutsideClick: this.handleOutsideClick,\n };\n }\n\n getWindowProps() {\n const { visible, closable } = this.asProps;\n return {\n visible,\n closable,\n onKeyDown: this.handleKeyDown,\n };\n }\n\n getCloseProps() {\n return {\n onClick: this.handleIconCloseClick,\n };\n }\n\n render() {\n const { Children, disablePortal } = this.asProps;\n\n const advanceMode = isAdvanceMode(Children, [\n Modal.Overlay.displayName,\n Modal.Window.displayName,\n ]);\n\n return (\n <Portal disablePortal={disablePortal}>\n {advanceMode ? (\n <Children />\n ) : (\n <Modal.Overlay>\n <Root render={Modal.Window} />\n </Modal.Overlay>\n )}\n </Portal>\n );\n }\n}\n\nconst FocusLockWrapper = React.forwardRef(function ({ tag, ...other }, ref) {\n return <FocusLock ref={ref} as={tag} lockProps={other} {...other} />;\n});\n\nfunction Window(props) {\n const SWindow = Root;\n const { Children, styles, visible, closable } = props;\n const windowRef = useRef(null);\n\n if (!visible) return null;\n\n return sstyled(styles)(\n <SWindow\n render={FocusLockWrapper}\n tag={Box}\n ref={windowRef}\n returnFocus={true}\n tabIndex={-1}\n autoFocus={true}\n role=\"dialog\"\n aria-label=\"Modal window\"\n aria-modal={true}\n >\n <PortalProvider value={windowRef}>\n {closable && <Modal.Close />}\n <Children />\n </PortalProvider>\n </SWindow>,\n );\n}\n\nfunction Overlay(props) {\n const SOverlay = Root;\n const { Children, styles, onOutsideClick, visible } = props;\n const overlayRef = useRef(null);\n usePreventScroll(visible);\n\n return sstyled(styles)(\n <SOverlay render={FadeInOut} ref={overlayRef}>\n <OutsideClick root={overlayRef} onOutsideClick={onOutsideClick}>\n <Children />\n </OutsideClick>\n </SOverlay>,\n );\n}\n\nfunction Close(props) {\n const SClose = Root;\n return sstyled(props.styles)(\n <SClose render={Box} tag=\"button\" tabIndex={0} aria-label=\"Close\" />,\n );\n}\n\nClose.defaultProps = {\n children: <CloseIcon title=\"Close\" />,\n};\n\nClose.enhance = [keyboardFocusEnhance()];\n\nconst Modal = createComponent(ModalRoot, {\n Window,\n Overlay,\n Close,\n});\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,MAAhB,QAA8B,OAA9B;AACA,OAAOC,SAAP,MAAsB,kBAAtB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,OAAOC,MAAP,IAAiBC,cAAjB,QAAuC,iBAAvC;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,YAAP,MAAyB,wBAAzB;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,OAAOC,IAAP,MAAiB,yBAAjB;AACA,OAAOC,gBAAP,MAA6B,yCAA7B;AACA,SAASC,aAAT,QAA8B,kCAA9B;AACA,OAAOC,oBAAP,MAAiC,kDAAjC;;;;;;;;;;;;;;;;;;IAGMC,S;;;;;;;;;;;;;;;;oEAQY,UAACC,CAAD,EAAO;MACrB,IAAIA,CAAC,CAACC,GAAF,KAAU,QAAd,EAAwB;QACtBD,CAAC,CAACE,eAAF;QACAP,IAAI,gCAAO,SAAP,EAAkB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ANpB;EACA,IAAQ4B,QAAR,GAAsDa,KAAtD,CAAQb,QAAR;EAAA,IAAkBe,MAAlB,GAAsDF,KAAtD,CAAkBE,MAAlB;EAAA,IAA0BtB,cAA1B,GAAsDoB,KAAtD,CAA0BpB,cAA1B;EAAA,IAA0CD,OAA1C,GAAsDqB,KAAtD,CAA0CrB,OAA1C;EACA,IAAM0B,UAAU,GAAGhD,MAAM,CAAC,IAAD,CAAzB;EACAa,gBAAgB,CAACS,OAAD,CAAhB;EAEA,eAAOjB,OAAO,CAACwC,MAAD,CAAd,eACE,oBAAC,QAAD;IAAA,OAAkCG;EAAlC,0BACE,oBAAC,YAAD;IAAA,QAAoBA,UAApB;IAAA,kBAAgDzB;EAAhD,iBACE,oBAAC,QAAD,2BADF,CADF,CADF;AAOD;;AAED,SAAS0B,KAAT,CAAeN,KAAf,EAAsB;EAAA;EAAA;;EACpB,IAAMO,MAAM,GAEMzC,GAFlB;EACA,eAAOJ,OAAO,CAACsC,KAAK,CAACE,MAAP,CAAd,eACE,oBAAC,MAAD;IAAA,OAAyB,QAAzB;IAAA,YAA4C,CAA5C;IAAA,cAA0D;EAA1D,YADF;AAGD;;AAEDI,KAAK,CAACE,YAAN,GAAqB;EACnBC,QAAQ,eAAE,oBAAC,SAAD;IAAW,KAAK,EAAC;EAAjB;AADS,CAArB;AAIAH,KAAK,CAACI,OAAN,GAAgB,CAACtC,oBAAoB,EAArB,CAAhB;AAEA,IAAMkB,KAAK,GAAG9B,eAAe,CAACa,SAAD,EAAY;EACvCoB,MAAM,EAANA,MADuC;EAEvCF,OAAO,EAAPA,OAFuC;EAGvCe,KAAK,EAALA;AAHuC,CAAZ,CAA7B;AAMA,eAAehB,KAAf"}
@@ -0,0 +1,125 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+
4
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
+
6
+ import { expect } from '@playwright/test';
7
+ import { voTest as test } from '@guidepup/playwright';
8
+ import { e2eStandToHtml } from '@semcore/jest-preset-ui/e2e-stand';
9
+ import { resolve as resolvePath } from 'path';
10
+ import { writeFile } from 'fs/promises';
11
+ import { getReportHeader, makeVoiceOverReporter } from '@semcore/jest-preset-ui/vo-reporter';
12
+ test('Users can interact with Modal via VoiceOver', /*#__PURE__*/function () {
13
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
14
+ var page, pureVoiceOver, standPath, reportPath, htmlContent, _yield$makeVoiceOverR, voiceOver, getReport, report;
15
+
16
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17
+ while (1) {
18
+ switch (_context.prev = _context.next) {
19
+ case 0:
20
+ page = _ref.page, pureVoiceOver = _ref.voiceOver;
21
+ standPath = resolvePath(__dirname, '../../../website/docs/components/modal/examples/modal.jsx');
22
+ reportPath = resolvePath(__dirname, '../../../website/docs/components/modal/modal-a11y-report.md');
23
+ _context.next = 5;
24
+ return e2eStandToHtml(standPath, 'en');
25
+
26
+ case 5:
27
+ htmlContent = _context.sent;
28
+ _context.next = 8;
29
+ return page.setContent(htmlContent);
30
+
31
+ case 8:
32
+ _context.next = 10;
33
+ return makeVoiceOverReporter(pureVoiceOver);
34
+
35
+ case 10:
36
+ _yield$makeVoiceOverR = _context.sent;
37
+ voiceOver = _yield$makeVoiceOverR.voiceOver;
38
+ getReport = _yield$makeVoiceOverR.getReport;
39
+ _context.next = 15;
40
+ return voiceOver.interact();
41
+
42
+ case 15:
43
+ _context.t0 = expect;
44
+ _context.next = 18;
45
+ return voiceOver.itemText();
46
+
47
+ case 18:
48
+ _context.t1 = _context.sent;
49
+ (0, _context.t0)(_context.t1).toBe('Open modal button');
50
+ _context.next = 22;
51
+ return voiceOver.act();
52
+
53
+ case 22:
54
+ _context.t2 = expect;
55
+ _context.next = 25;
56
+ return voiceOver.lastSpokenPhrase();
57
+
58
+ case 25:
59
+ _context.t3 = _context.sent;
60
+ (0, _context.t2)(_context.t3).toBe('Modal window web dialog with 5 items Close button');
61
+ _context.next = 29;
62
+ return voiceOver.next();
63
+
64
+ case 29:
65
+ _context.t4 = expect;
66
+ _context.next = 32;
67
+ return voiceOver.itemText();
68
+
69
+ case 32:
70
+ _context.t5 = _context.sent;
71
+ (0, _context.t4)(_context.t5).toBe('Do you want to save your changes? heading level 2');
72
+ _context.next = 36;
73
+ return voiceOver.next();
74
+
75
+ case 36:
76
+ _context.next = 38;
77
+ return voiceOver.next();
78
+
79
+ case 38:
80
+ _context.t6 = expect;
81
+ _context.next = 41;
82
+ return voiceOver.itemText();
83
+
84
+ case 41:
85
+ _context.t7 = _context.sent;
86
+ (0, _context.t6)(_context.t7).toBe('Save changes button');
87
+ _context.next = 45;
88
+ return voiceOver.act();
89
+
90
+ case 45:
91
+ _context.t8 = expect;
92
+ _context.next = 48;
93
+ return voiceOver.itemText();
94
+
95
+ case 48:
96
+ _context.t9 = _context.sent;
97
+ (0, _context.t8)(_context.t9).toBe('Open modal button');
98
+ _context.next = 52;
99
+ return getReportHeader();
100
+
101
+ case 52:
102
+ _context.t10 = _context.sent;
103
+ _context.t11 = _context.t10 + '\n\n';
104
+ _context.next = 56;
105
+ return getReport(standPath);
106
+
107
+ case 56:
108
+ _context.t12 = _context.sent;
109
+ report = _context.t11 + _context.t12;
110
+ _context.next = 60;
111
+ return writeFile(reportPath, report);
112
+
113
+ case 60:
114
+ case "end":
115
+ return _context.stop();
116
+ }
117
+ }
118
+ }, _callee);
119
+ }));
120
+
121
+ return function (_x) {
122
+ return _ref2.apply(this, arguments);
123
+ };
124
+ }());
125
+ //# sourceMappingURL=modal.vo-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.vo-test.js","names":["expect","voTest","test","e2eStandToHtml","resolve","resolvePath","writeFile","getReportHeader","makeVoiceOverReporter","page","pureVoiceOver","voiceOver","standPath","__dirname","reportPath","htmlContent","setContent","getReport","interact","itemText","toBe","act","lastSpokenPhrase","next","report"],"sources":["../../src/modal.vo-test.ts"],"sourcesContent":["import { expect } from '@playwright/test';\nimport { voTest as test } from '@guidepup/playwright';\nimport { e2eStandToHtml } from '@semcore/jest-preset-ui/e2e-stand';\nimport { resolve as resolvePath } from 'path';\nimport { writeFile } from 'fs/promises';\nimport { getReportHeader, makeVoiceOverReporter } from '@semcore/jest-preset-ui/vo-reporter';\n\ntest('Users can interact with Modal via VoiceOver', async ({ page, voiceOver: pureVoiceOver }) => {\n const standPath = resolvePath(\n __dirname,\n '../../../website/docs/components/modal/examples/modal.jsx',\n );\n const reportPath = resolvePath(\n __dirname,\n '../../../website/docs/components/modal/modal-a11y-report.md',\n );\n const htmlContent = await e2eStandToHtml(standPath, 'en');\n\n await page.setContent(htmlContent);\n const { voiceOver, getReport } = await makeVoiceOverReporter(pureVoiceOver);\n await voiceOver.interact();\n\n expect(await voiceOver.itemText()).toBe('Open modal button');\n await voiceOver.act();\n expect(await voiceOver.lastSpokenPhrase()).toBe(\n 'Modal window web dialog with 5 items Close button',\n );\n await voiceOver.next();\n expect(await voiceOver.itemText()).toBe('Do you want to save your changes? heading level 2');\n await voiceOver.next();\n await voiceOver.next();\n expect(await voiceOver.itemText()).toBe('Save changes button');\n await voiceOver.act();\n expect(await voiceOver.itemText()).toBe('Open modal button');\n\n const report = (await getReportHeader()) + '\\n\\n' + (await getReport(standPath));\n\n await writeFile(reportPath, report);\n});\n"],"mappings":";;;+CACA,oJ;;AADA,SAASA,MAAT,QAAuB,kBAAvB;AACA,SAASC,MAAM,IAAIC,IAAnB,QAA+B,sBAA/B;AACA,SAASC,cAAT,QAA+B,mCAA/B;AACA,SAASC,OAAO,IAAIC,WAApB,QAAuC,MAAvC;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,eAAT,EAA0BC,qBAA1B,QAAuD,qCAAvD;AAEAN,IAAI,CAAC,6CAAD;EAAA,uEAAgD;IAAA;;IAAA;MAAA;QAAA;UAAA;YAASO,IAAT,QAASA,IAAT,EAA0BC,aAA1B,QAAeC,SAAf;YAC5CC,SAD4C,GAChCP,WAAW,CAC3BQ,SAD2B,EAE3B,2DAF2B,CADqB;YAK5CC,UAL4C,GAK/BT,WAAW,CAC5BQ,SAD4B,EAE5B,6DAF4B,CALoB;YAAA;YAAA,OASxBV,cAAc,CAACS,SAAD,EAAY,IAAZ,CATU;;UAAA;YAS5CG,WAT4C;YAAA;YAAA,OAW5CN,IAAI,CAACO,UAAL,CAAgBD,WAAhB,CAX4C;;UAAA;YAAA;YAAA,OAYXP,qBAAqB,CAACE,aAAD,CAZV;;UAAA;YAAA;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AAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAAhD;;EAAA;IAAA;EAAA;AAAA,IAAJ"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/modal",
3
3
  "description": "Semrush Modal Component",
4
- "version": "3.0.17",
4
+ "version": "3.0.19",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -13,12 +13,12 @@
13
13
  "test": "jest"
14
14
  },
15
15
  "dependencies": {
16
- "@semcore/utils": "^3.31.2",
17
16
  "@semcore/animation": "^1",
18
- "@semcore/portal": "^2",
19
17
  "@semcore/flex-box": "^4",
20
18
  "@semcore/icon": "^2.16",
21
19
  "@semcore/outside-click": "^2",
20
+ "@semcore/portal": "^2",
21
+ "@semcore/utils": "^3.31.2",
22
22
  "react-focus-lock": "2.5.1"
23
23
  },
24
24
  "peerDependencies": {
@@ -34,6 +34,8 @@
34
34
  "directory": "semcore/modal"
35
35
  },
36
36
  "devDependencies": {
37
+ "@guidepup/playwright": "0.6.1",
38
+ "@playwright/test": "1.25.1",
37
39
  "@semcore/jest-preset-ui": "1.0.0"
38
40
  }
39
41
  }