@elliemae/ds-accessibility 3.1.0-next.2 → 3.1.0-next.20

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.
@@ -31,7 +31,7 @@ var import_ds_utilities = require("@elliemae/ds-utilities");
31
31
  var import_styles = require("./styles");
32
32
  var import_propTypes = require("./propTypes");
33
33
  const DSLiveRegion = (0, import_react.memo)((props) => {
34
- const [text, setText] = (0, import_react.useState)("");
34
+ const [text, setText] = (0, import_react.useState)(" ");
35
35
  (0, import_react.useEffect)(() => {
36
36
  if (props.methods && props.methods.current) {
37
37
  props.methods.current.read = setText;
@@ -41,8 +41,8 @@ const DSLiveRegion = (0, import_react.memo)((props) => {
41
41
  return null;
42
42
  return import_react_dom.default.createPortal(/* @__PURE__ */ import_react.default.createElement(import_styles.StyledContainer, {
43
43
  "aria-atomic": true,
44
- id: props["id"],
45
- role: props["role"],
44
+ id: props.id,
45
+ role: props.role,
46
46
  "aria-live": props["aria-live"] || "polite"
47
47
  }, text), props.portal?.current || document.body);
48
48
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/live-region/DSLiveRegion.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import ReactDOM from 'react-dom';\nimport React, { memo, useEffect, useState } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { StyledContainer } from './styles';\nimport { propTypes } from './propTypes';\nimport type { DSLiveRegionT } from './propTypes';\n\nconst DSLiveRegion = memo((props: DSLiveRegionT.Props): JSX.Element | null => {\n const [text, setText] = useState('');\n\n useEffect(() => {\n if (props.methods && props.methods.current) {\n props.methods.current.read = setText;\n }\n }, [props.methods]);\n\n if (text === '') return null;\n\n return ReactDOM.createPortal(\n <StyledContainer aria-atomic id={props['id']} role={props['role']} aria-live={props['aria-live'] || 'polite'}>\n {text}\n </StyledContainer>,\n props.portal?.current || document.body,\n );\n});\n\nDSLiveRegion.propTypes = propTypes;\nDSLiveRegion.displayName = \"DSLiveRegion\";\nconst DSLiveRegionWithSchema = describe(DSLiveRegion);\nDSLiveRegionWithSchema.propTypes = propTypes;\n\nexport { DSLiveRegion, DSLiveRegionWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAqB;AACrB,mBAAiD;AACjD,0BAAyB;AACzB,oBAAgC;AAChC,uBAA0B;AAG1B,MAAM,eAAe,uBAAK,CAAC,UAAmD;AAC5E,QAAM,CAAC,MAAM,WAAW,2BAAS,EAAE;AAEnC,8BAAU,MAAM;AACd,QAAI,MAAM,WAAW,MAAM,QAAQ,SAAS;AAC1C,YAAM,QAAQ,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,CAAC;AAElB,MAAI,SAAS;AAAI,WAAO;AAExB,SAAO,yBAAS,aACd,mDAAC;AAAA,IAAgB,eAAW;AAAA,IAAC,IAAI,MAAM;AAAA,IAAO,MAAM,MAAM;AAAA,IAAS,aAAW,MAAM,gBAAgB;AAAA,KACjG,IACH,GACA,MAAM,QAAQ,WAAW,SAAS,IACpC;AACF,CAAC;AAED,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,yBAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;",
4
+ "sourcesContent": ["import ReactDOM from 'react-dom';\nimport React, { memo, useEffect, useState } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { StyledContainer } from './styles';\nimport { propTypes } from './propTypes';\nimport type { DSLiveRegionT } from './propTypes';\n\nconst DSLiveRegion = memo((props: DSLiveRegionT.Props): JSX.Element | null => {\n const [text, setText] = useState(' ');\n\n useEffect(() => {\n if (props.methods && props.methods.current) {\n props.methods.current.read = setText;\n }\n }, [props.methods]);\n\n if (text === '') return null;\n\n return ReactDOM.createPortal(\n <StyledContainer aria-atomic id={props.id} role={props.role} aria-live={props['aria-live'] || 'polite'}>\n {text}\n </StyledContainer>,\n props.portal?.current || document.body,\n );\n});\n\nDSLiveRegion.propTypes = propTypes;\nDSLiveRegion.displayName = 'DSLiveRegion';\nconst DSLiveRegionWithSchema = describe(DSLiveRegion);\nDSLiveRegionWithSchema.propTypes = propTypes;\n\nexport { DSLiveRegion, DSLiveRegionWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAqB;AACrB,mBAAiD;AACjD,0BAAyB;AACzB,oBAAgC;AAChC,uBAA0B;AAG1B,MAAM,eAAe,uBAAK,CAAC,UAAmD;AAC5E,QAAM,CAAC,MAAM,WAAW,2BAAS,GAAG;AAEpC,8BAAU,MAAM;AACd,QAAI,MAAM,WAAW,MAAM,QAAQ,SAAS;AAC1C,YAAM,QAAQ,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,CAAC;AAElB,MAAI,SAAS;AAAI,WAAO;AAExB,SAAO,yBAAS,aACd,mDAAC;AAAA,IAAgB,eAAW;AAAA,IAAC,IAAI,MAAM;AAAA,IAAI,MAAM,MAAM;AAAA,IAAM,aAAW,MAAM,gBAAgB;AAAA,KAC3F,IACH,GACA,MAAM,QAAQ,WAAW,SAAS,IACpC;AACF,CAAC;AAED,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,yBAAyB,kCAAS,YAAY;AACpD,uBAAuB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -18,5 +18,5 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var live_region_exports = {};
19
19
  module.exports = __toCommonJS(live_region_exports);
20
20
  var React = __toESM(require("react"));
21
- __reExport(live_region_exports, require("./DSLiveRegion"), module.exports);
21
+ __reExport(live_region_exports, require("./useLiveRegion"), module.exports);
22
22
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/live-region/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export * from './DSLiveRegion';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,2BAAd;",
4
+ "sourcesContent": ["export * from './useLiveRegion';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,4BAAd;",
6
6
  "names": []
7
7
  }
@@ -24,12 +24,5 @@ __export(propTypes_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(propTypes_exports);
26
26
  var React = __toESM(require("react"));
27
- var import_ds_utilities = require("@elliemae/ds-utilities");
28
- const propTypes = {
29
- methods: import_ds_utilities.PropTypes.object.description("Ref Object."),
30
- portal: import_ds_utilities.PropTypes.node.description("Sets a custom portal").defaultValue("Body Element."),
31
- ["aria-live"]: import_ds_utilities.PropTypes.oneOf(["assertive", "polite", "off"]).description("Selects your aria live mode."),
32
- role: import_ds_utilities.PropTypes.oneOf(["log", "status", "alert", "progressbar", "marquee", "timer"]).description("Selects your specific role."),
33
- id: import_ds_utilities.PropTypes.string.description("Unique id for the Live Region.")
34
- };
27
+ const propTypes = {};
35
28
  //# sourceMappingURL=propTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/live-region/propTypes.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { PropTypes } from '@elliemae/ds-utilities';\nimport type React from 'react';\n\nexport declare module DSLiveRegionT {\n interface Methods {\n read: React.Dispatch<React.SetStateAction<string>>;\n }\n export interface Props {\n methods?: React.MutableRefObject<Methods>;\n portal?: React.MutableRefObject<HTMLElement>;\n ['aria-live']?: 'off' | 'assertive' | 'polite';\n role?: 'log' | 'status' | 'alert' | 'progressbar' | 'marquee' | 'timer';\n id?: string;\n }\n}\n\nexport const propTypes = {\n methods: PropTypes.object.description('Ref Object.'),\n portal: PropTypes.node.description('Sets a custom portal').defaultValue('Body Element.'),\n ['aria-live']: PropTypes.oneOf(['assertive', 'polite', 'off']).description('Selects your aria live mode.'),\n role: PropTypes.oneOf(['log', 'status', 'alert', 'progressbar', 'marquee', 'timer']).description(\n 'Selects your specific role.',\n ),\n id: PropTypes.string.description('Unique id for the Live Region.'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA0B;AAgBnB,MAAM,YAAY;AAAA,EACvB,SAAS,8BAAU,OAAO,YAAY,aAAa;AAAA,EACnD,QAAQ,8BAAU,KAAK,YAAY,sBAAsB,EAAE,aAAa,eAAe;AAAA,GACtF,cAAc,8BAAU,MAAM,CAAC,aAAa,UAAU,KAAK,CAAC,EAAE,YAAY,8BAA8B;AAAA,EACzG,MAAM,8BAAU,MAAM,CAAC,OAAO,UAAU,SAAS,eAAe,WAAW,OAAO,CAAC,EAAE,YACnF,6BACF;AAAA,EACA,IAAI,8BAAU,OAAO,YAAY,gCAAgC;AACnE;",
4
+ "sourcesContent": ["import type React from 'react';\n\nexport declare namespace UseLiveRegionT {\n export interface Props {\n id?: string;\n portal?: React.MutableRefObject<HTMLElement>;\n }\n}\n\nexport const propTypes = {};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADShB,MAAM,YAAY,CAAC;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,93 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var useLiveRegion_exports = {};
22
+ __export(useLiveRegion_exports, {
23
+ UseLiveRegionWithSchema: () => UseLiveRegionWithSchema,
24
+ useLiveRegion: () => useLiveRegion
25
+ });
26
+ module.exports = __toCommonJS(useLiveRegion_exports);
27
+ var React = __toESM(require("react"));
28
+ var import_react_dom = __toESM(require("react-dom"));
29
+ var import_react = __toESM(require("react"));
30
+ var import_ds_utilities = require("@elliemae/ds-utilities");
31
+ var import_uid = require("uid");
32
+ var import_styles = require("./styles");
33
+ var import_propTypes = require("./propTypes");
34
+ const DSLiveRegion = (0, import_react.memo)((props) => {
35
+ const [internalMessage, setInternalMessage] = (0, import_react.useState)("");
36
+ const [unsafe_emulateAssertiveNVDA, setUnsafe_emulateAssertiveNVDA] = (0, import_react.useState)(false);
37
+ const [role, setRole] = (0, import_react.useState)(void 0);
38
+ const [ariaLive, setAriaLive] = (0, import_react.useState)("polite");
39
+ const { id, portal } = props || {};
40
+ const reset = (0, import_react.useCallback)(() => {
41
+ setInternalMessage("");
42
+ setUnsafe_emulateAssertiveNVDA(false);
43
+ setAriaLive("polite");
44
+ setRole(void 0);
45
+ }, []);
46
+ const configure = (0, import_react.useCallback)((message, options) => {
47
+ reset();
48
+ setTimeout(() => {
49
+ if (options?.unsafe_emulateAssertiveNVDA)
50
+ setUnsafe_emulateAssertiveNVDA(true);
51
+ setTimeout(() => {
52
+ if (options?.assertive || options?.unsafe_emulateAssertiveNVDA)
53
+ setAriaLive("assertive");
54
+ if (options?.unsafe_emulateAssertiveNVDA) {
55
+ setRole("alert");
56
+ setUnsafe_emulateAssertiveNVDA(false);
57
+ }
58
+ setInternalMessage(message);
59
+ });
60
+ });
61
+ }, [reset]);
62
+ (0, import_react.useEffect)(() => {
63
+ if (props.methods) {
64
+ props.methods.current.read = configure;
65
+ }
66
+ }, [configure, props.methods]);
67
+ if (unsafe_emulateAssertiveNVDA)
68
+ return null;
69
+ return import_react_dom.default.createPortal(/* @__PURE__ */ import_react.default.createElement(import_styles.StyledContainer, {
70
+ "aria-atomic": true,
71
+ id,
72
+ role,
73
+ "aria-live": ariaLive
74
+ }, internalMessage), portal?.current || document.body);
75
+ });
76
+ const useLiveRegion = (props) => {
77
+ const methods = (0, import_react.useRef)({});
78
+ const { id, portal } = props || {};
79
+ const instanceUID = (0, import_react.useMemo)(() => `ds-live-region-${(0, import_uid.uid)(5)}`, []);
80
+ const read = (0, import_react.useCallback)((message, options) => methods.current.read?.(message, options), []);
81
+ return (0, import_react.useMemo)(() => ({
82
+ LiveRegion: () => /* @__PURE__ */ import_react.default.createElement(DSLiveRegion, {
83
+ methods,
84
+ id: instanceUID || id,
85
+ portal
86
+ }),
87
+ read
88
+ }), [id, instanceUID, portal, read]);
89
+ };
90
+ useLiveRegion.displayName = "useLiveRegion";
91
+ const UseLiveRegionWithSchema = (0, import_ds_utilities.describe)(useLiveRegion);
92
+ UseLiveRegionWithSchema.propTypes = import_propTypes.propTypes;
93
+ //# sourceMappingURL=useLiveRegion.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/live-region/useLiveRegion.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import ReactDOM from 'react-dom';\nimport React, { memo, useEffect, useState, useCallback, useRef, useMemo } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { uid } from 'uid';\nimport { StyledContainer } from './styles';\nimport { propTypes } from './propTypes';\nimport type { UseLiveRegionT } from './propTypes';\n\ninterface Options {\n assertive?: boolean;\n unsafe_emulateAssertiveNVDA?: boolean;\n}\ninterface Methods {\n read?: (message: string, options: Options) => void;\n}\nexport interface Props {\n methods?: React.MutableRefObject<Methods>;\n id?: string;\n portal?: React.MutableRefObject<HTMLElement>;\n}\n\nconst DSLiveRegion = memo((props: Props): JSX.Element | null => {\n const [internalMessage, setInternalMessage] = useState<string>('');\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const [unsafe_emulateAssertiveNVDA, setUnsafe_emulateAssertiveNVDA] = useState(false);\n const [role, setRole] = useState<undefined | string>(undefined);\n const [ariaLive, setAriaLive] = useState('polite');\n const { id, portal } = props || {};\n\n const reset = useCallback(() => {\n setInternalMessage('');\n setUnsafe_emulateAssertiveNVDA(false);\n setAriaLive('polite');\n setRole(undefined);\n }, []);\n\n const configure = useCallback(\n (message: string, options: Options) => {\n reset();\n setTimeout(() => {\n if (options?.unsafe_emulateAssertiveNVDA) setUnsafe_emulateAssertiveNVDA(true);\n // eslint-disable-next-line max-nested-callbacks\n setTimeout(() => {\n if (options?.assertive || options?.unsafe_emulateAssertiveNVDA) setAriaLive('assertive');\n if (options?.unsafe_emulateAssertiveNVDA) {\n setRole('alert');\n setUnsafe_emulateAssertiveNVDA(false);\n }\n setInternalMessage(message);\n });\n });\n },\n [reset],\n );\n\n useEffect(() => {\n if (props.methods) {\n props.methods.current.read = configure;\n }\n }, [configure, props.methods]);\n\n if (unsafe_emulateAssertiveNVDA) return null;\n\n return ReactDOM.createPortal(\n <StyledContainer aria-atomic id={id} role={role} aria-live={ariaLive}>\n {internalMessage}\n </StyledContainer>,\n portal?.current || document.body,\n );\n});\n\nconst useLiveRegion = (props: UseLiveRegionT.Props) => {\n const methods = useRef<Methods>({});\n\n const { id, portal } = props || {};\n\n const instanceUID = useMemo(() => `ds-live-region-${uid(5)}`, []);\n\n const read = useCallback((message: string, options: Options) => methods.current.read?.(message, options), []);\n\n return useMemo(\n () => ({\n LiveRegion: () => <DSLiveRegion methods={methods} id={instanceUID || id} portal={portal} />,\n read,\n }),\n [id, instanceUID, portal, read],\n );\n};\n\nuseLiveRegion.displayName = 'useLiveRegion';\nconst UseLiveRegionWithSchema = describe(useLiveRegion);\nUseLiveRegionWithSchema.propTypes = propTypes;\nexport { useLiveRegion, UseLiveRegionWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAqB;AACrB,mBAA+E;AAC/E,0BAAyB;AACzB,iBAAoB;AACpB,oBAAgC;AAChC,uBAA0B;AAgB1B,MAAM,eAAe,uBAAK,CAAC,UAAqC;AAC9D,QAAM,CAAC,iBAAiB,sBAAsB,2BAAiB,EAAE;AAEjE,QAAM,CAAC,6BAA6B,kCAAkC,2BAAS,KAAK;AACpF,QAAM,CAAC,MAAM,WAAW,2BAA6B,MAAS;AAC9D,QAAM,CAAC,UAAU,eAAe,2BAAS,QAAQ;AACjD,QAAM,EAAE,IAAI,WAAW,SAAS,CAAC;AAEjC,QAAM,QAAQ,8BAAY,MAAM;AAC9B,uBAAmB,EAAE;AACrB,mCAA+B,KAAK;AACpC,gBAAY,QAAQ;AACpB,YAAQ,MAAS;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,8BAChB,CAAC,SAAiB,YAAqB;AACrC,UAAM;AACN,eAAW,MAAM;AACf,UAAI,SAAS;AAA6B,uCAA+B,IAAI;AAE7E,iBAAW,MAAM;AACf,YAAI,SAAS,aAAa,SAAS;AAA6B,sBAAY,WAAW;AACvF,YAAI,SAAS,6BAA6B;AACxC,kBAAQ,OAAO;AACf,yCAA+B,KAAK;AAAA,QACtC;AACA,2BAAmB,OAAO;AAAA,MAC5B,CAAC;AAAA,IACH,CAAC;AAAA,EACH,GACA,CAAC,KAAK,CACR;AAEA,8BAAU,MAAM;AACd,QAAI,MAAM,SAAS;AACjB,YAAM,QAAQ,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,OAAO,CAAC;AAE7B,MAAI;AAA6B,WAAO;AAExC,SAAO,yBAAS,aACd,mDAAC;AAAA,IAAgB,eAAW;AAAA,IAAC;AAAA,IAAQ;AAAA,IAAY,aAAW;AAAA,KACzD,eACH,GACA,QAAQ,WAAW,SAAS,IAC9B;AACF,CAAC;AAED,MAAM,gBAAgB,CAAC,UAAgC;AACrD,QAAM,UAAU,yBAAgB,CAAC,CAAC;AAElC,QAAM,EAAE,IAAI,WAAW,SAAS,CAAC;AAEjC,QAAM,cAAc,0BAAQ,MAAM,kBAAkB,oBAAI,CAAC,KAAK,CAAC,CAAC;AAEhE,QAAM,OAAO,8BAAY,CAAC,SAAiB,YAAqB,QAAQ,QAAQ,OAAO,SAAS,OAAO,GAAG,CAAC,CAAC;AAE5G,SAAO,0BACL,MAAO;AAAA,IACL,YAAY,MAAM,mDAAC;AAAA,MAAa;AAAA,MAAkB,IAAI,eAAe;AAAA,MAAI;AAAA,KAAgB;AAAA,IACzF;AAAA,EACF,IACA,CAAC,IAAI,aAAa,QAAQ,IAAI,CAChC;AACF;AAEA,cAAc,cAAc;AAC5B,MAAM,0BAA0B,kCAAS,aAAa;AACtD,wBAAwB,YAAY;",
6
+ "names": []
7
+ }
@@ -26,7 +26,7 @@ __export(DSSkipTo_exports, {
26
26
  module.exports = __toCommonJS(DSSkipTo_exports);
27
27
  var React = __toESM(require("react"));
28
28
  var import_react = __toESM(require("react"));
29
- var import_react_desc = require("react-desc");
29
+ var import_ds_utilities = require("@elliemae/ds-utilities");
30
30
  var import_propTypes = require("./propTypes");
31
31
  var import_styles = require("./styles");
32
32
  const DSSkipTo = (props) => {
@@ -40,6 +40,6 @@ const DSSkipTo = (props) => {
40
40
  };
41
41
  DSSkipTo.propTypes = import_propTypes.propTypes;
42
42
  DSSkipTo.displayName = "DSSkipTo";
43
- const DSSkipToWithSchema = (0, import_react_desc.describe)(DSSkipTo);
43
+ const DSSkipToWithSchema = (0, import_ds_utilities.describe)(DSSkipTo);
44
44
  DSSkipToWithSchema.propTypes = import_propTypes.propTypes;
45
45
  //# sourceMappingURL=DSSkipTo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/skip-to/DSSkipTo.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useCallback } from 'react';\nimport { describe } from 'react-desc';\nimport { propTypes } from './propTypes';\nimport type { DSSkipToPropsT as Props } from './index.d';\nimport { StyledButton } from './styles';\n\nconst DSSkipTo = (props: Props): JSX.Element => {\n const { goTo, message = 'Skip to main content' } = props;\n const handleOnClick = useCallback(() => {\n (document.getElementById(goTo) as HTMLElement).focus();\n }, [goTo]);\n return <StyledButton onClick={handleOnClick}>{message}</StyledButton>;\n};\n\nDSSkipTo.propTypes = propTypes;\nDSSkipTo.displayName = 'DSSkipTo';\nconst DSSkipToWithSchema = describe(DSSkipTo);\nDSSkipToWithSchema.propTypes = propTypes;\n\nexport { DSSkipTo, DSSkipToWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAmC;AACnC,wBAAyB;AACzB,uBAA0B;AAE1B,oBAA6B;AAE7B,MAAM,WAAW,CAAC,UAA8B;AAC9C,QAAM,EAAE,MAAM,UAAU,2BAA2B;AACnD,QAAM,gBAAgB,8BAAY,MAAM;AACtC,IAAC,SAAS,eAAe,IAAI,EAAkB,MAAM;AAAA,EACvD,GAAG,CAAC,IAAI,CAAC;AACT,SAAO,mDAAC;AAAA,IAAa,SAAS;AAAA,KAAgB,OAAQ;AACxD;AAEA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,qBAAqB,gCAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
4
+ "sourcesContent": ["import React, { useCallback } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { propTypes } from './propTypes';\nimport type { DSSkipToPropsT as Props } from './index.d';\nimport { StyledButton } from './styles';\n\nconst DSSkipTo = (props: Props): JSX.Element => {\n const { goTo, message = 'Skip to main content' } = props;\n const handleOnClick = useCallback(() => {\n (document.getElementById(goTo) as HTMLElement).focus();\n }, [goTo]);\n return <StyledButton onClick={handleOnClick}>{message}</StyledButton>;\n};\n\nDSSkipTo.propTypes = propTypes;\nDSSkipTo.displayName = 'DSSkipTo';\nconst DSSkipToWithSchema = describe(DSSkipTo);\nDSSkipToWithSchema.propTypes = propTypes;\n\nexport { DSSkipTo, DSSkipToWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAmC;AACnC,0BAAyB;AACzB,uBAA0B;AAE1B,oBAA6B;AAE7B,MAAM,WAAW,CAAC,UAA8B;AAC9C,QAAM,EAAE,MAAM,UAAU,2BAA2B;AACnD,QAAM,gBAAgB,8BAAY,MAAM;AACtC,IAAC,SAAS,eAAe,IAAI,EAAkB,MAAM;AAAA,EACvD,GAAG,CAAC,IAAI,CAAC;AACT,SAAO,mDAAC;AAAA,IAAa,SAAS;AAAA,KAAgB,OAAQ;AACxD;AAEA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,qBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -24,9 +24,9 @@ __export(propTypes_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(propTypes_exports);
26
26
  var React = __toESM(require("react"));
27
- var import_react_desc = require("react-desc");
27
+ var import_ds_utilities = require("@elliemae/ds-utilities");
28
28
  const propTypes = {
29
- goTo: import_react_desc.PropTypes.string.isRequired.description("String containing content's id that you want to go."),
30
- message: import_react_desc.PropTypes.string.description("Message for the Skip To component, default is 'Skip to main content'.")
29
+ goTo: import_ds_utilities.PropTypes.string.isRequired.description("String containing content's id that you want to go."),
30
+ message: import_ds_utilities.PropTypes.string.description("Message for the Skip To component, default is 'Skip to main content'.")
31
31
  };
32
32
  //# sourceMappingURL=propTypes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/skip-to/propTypes.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { PropTypes } from 'react-desc';\n\nexport const propTypes = {\n goTo: PropTypes.string.isRequired.description(\"String containing content's id that you want to go.\"),\n message: PropTypes.string.description(\"Message for the Skip To component, default is 'Skip to main content'.\"),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAEnB,MAAM,YAAY;AAAA,EACvB,MAAM,4BAAU,OAAO,WAAW,YAAY,qDAAqD;AAAA,EACnG,SAAS,4BAAU,OAAO,YAAY,uEAAuE;AAC/G;",
4
+ "sourcesContent": ["import { PropTypes } from '@elliemae/ds-utilities';\n\nexport const propTypes = {\n goTo: PropTypes.string.isRequired.description(\"String containing content's id that you want to go.\"),\n message: PropTypes.string.description(\"Message for the Skip To component, default is 'Skip to main content'.\"),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA0B;AAEnB,MAAM,YAAY;AAAA,EACvB,MAAM,8BAAU,OAAO,WAAW,YAAY,qDAAqD;AAAA,EACnG,SAAS,8BAAU,OAAO,YAAY,uEAAuE;AAC/G;",
6
6
  "names": []
7
7
  }
@@ -24,8 +24,8 @@ __export(styles_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(styles_exports);
26
26
  var React = __toESM(require("react"));
27
- var import_styled_components = __toESM(require("styled-components"));
28
- const StyledButton = import_styled_components.default.button`
27
+ var import_ds_system = require("@elliemae/ds-system");
28
+ const StyledButton = import_ds_system.styled.button`
29
29
  left: -999px;
30
30
  outline: none;
31
31
  position: absolute;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/skip-to/styles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import styled from 'styled-components';\n\nexport const StyledButton = styled.button`\n left: -999px;\n outline: none;\n position: absolute;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n z-index: -999;\n &:focus,\n &:active {\n color: ${({ theme }) => theme.colors.brand[600]};\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n text-decoration: underline;\n left: 0;\n top: 0;\n height: auto;\n cursor: pointer;\n width: fit-content;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xxs}`};\n border-radius: 2px;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n text-align: center;\n z-index: 999;\n overflow: auto;\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAAmB;AAEZ,MAAM,eAAe,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAWtB,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA,wBACvB,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAO7C,CAAC,EAAE,YAAY,GAAG,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA;AAAA,wBAEzC,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;",
4
+ "sourcesContent": ["import { styled } from '@elliemae/ds-system';\n\nexport const StyledButton = styled.button`\n left: -999px;\n outline: none;\n position: absolute;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n z-index: -999;\n &:focus,\n &:active {\n color: ${({ theme }) => theme.colors.brand[600]};\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n text-decoration: underline;\n left: 0;\n top: 0;\n height: auto;\n cursor: pointer;\n width: fit-content;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xxs}`};\n border-radius: 2px;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n text-align: center;\n z-index: 999;\n overflow: auto;\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AAEhB,MAAM,eAAe,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAWtB,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA,wBACvB,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAO7C,CAAC,EAAE,YAAY,GAAG,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA;AAAA,wBAEzC,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -5,7 +5,7 @@ import { describe } from "@elliemae/ds-utilities";
5
5
  import { StyledContainer } from "./styles";
6
6
  import { propTypes } from "./propTypes";
7
7
  const DSLiveRegion = memo((props) => {
8
- const [text, setText] = useState("");
8
+ const [text, setText] = useState(" ");
9
9
  useEffect(() => {
10
10
  if (props.methods && props.methods.current) {
11
11
  props.methods.current.read = setText;
@@ -15,8 +15,8 @@ const DSLiveRegion = memo((props) => {
15
15
  return null;
16
16
  return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(StyledContainer, {
17
17
  "aria-atomic": true,
18
- id: props["id"],
19
- role: props["role"],
18
+ id: props.id,
19
+ role: props.role,
20
20
  "aria-live": props["aria-live"] || "polite"
21
21
  }, text), props.portal?.current || document.body);
22
22
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/live-region/DSLiveRegion.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import ReactDOM from 'react-dom';\nimport React, { memo, useEffect, useState } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { StyledContainer } from './styles';\nimport { propTypes } from './propTypes';\nimport type { DSLiveRegionT } from './propTypes';\n\nconst DSLiveRegion = memo((props: DSLiveRegionT.Props): JSX.Element | null => {\n const [text, setText] = useState('');\n\n useEffect(() => {\n if (props.methods && props.methods.current) {\n props.methods.current.read = setText;\n }\n }, [props.methods]);\n\n if (text === '') return null;\n\n return ReactDOM.createPortal(\n <StyledContainer aria-atomic id={props['id']} role={props['role']} aria-live={props['aria-live'] || 'polite'}>\n {text}\n </StyledContainer>,\n props.portal?.current || document.body,\n );\n});\n\nDSLiveRegion.propTypes = propTypes;\nDSLiveRegion.displayName = \"DSLiveRegion\";\nconst DSLiveRegionWithSchema = describe(DSLiveRegion);\nDSLiveRegionWithSchema.propTypes = propTypes;\n\nexport { DSLiveRegion, DSLiveRegionWithSchema };\n"],
5
- "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAGA,MAAM,eAAe,KAAK,CAAC,UAAmD;AAC5E,QAAM,CAAC,MAAM,WAAW,SAAS,EAAE;AAEnC,YAAU,MAAM;AACd,QAAI,MAAM,WAAW,MAAM,QAAQ,SAAS;AAC1C,YAAM,QAAQ,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,CAAC;AAElB,MAAI,SAAS;AAAI,WAAO;AAExB,SAAO,SAAS,aACd,qCAAC;AAAA,IAAgB,eAAW;AAAA,IAAC,IAAI,MAAM;AAAA,IAAO,MAAM,MAAM;AAAA,IAAS,aAAW,MAAM,gBAAgB;AAAA,KACjG,IACH,GACA,MAAM,QAAQ,WAAW,SAAS,IACpC;AACF,CAAC;AAED,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,yBAAyB,SAAS,YAAY;AACpD,uBAAuB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import ReactDOM from 'react-dom';\nimport React, { memo, useEffect, useState } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { StyledContainer } from './styles';\nimport { propTypes } from './propTypes';\nimport type { DSLiveRegionT } from './propTypes';\n\nconst DSLiveRegion = memo((props: DSLiveRegionT.Props): JSX.Element | null => {\n const [text, setText] = useState(' ');\n\n useEffect(() => {\n if (props.methods && props.methods.current) {\n props.methods.current.read = setText;\n }\n }, [props.methods]);\n\n if (text === '') return null;\n\n return ReactDOM.createPortal(\n <StyledContainer aria-atomic id={props.id} role={props.role} aria-live={props['aria-live'] || 'polite'}>\n {text}\n </StyledContainer>,\n props.portal?.current || document.body,\n );\n});\n\nDSLiveRegion.propTypes = propTypes;\nDSLiveRegion.displayName = 'DSLiveRegion';\nconst DSLiveRegionWithSchema = describe(DSLiveRegion);\nDSLiveRegionWithSchema.propTypes = propTypes;\n\nexport { DSLiveRegion, DSLiveRegionWithSchema };\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAGA,MAAM,eAAe,KAAK,CAAC,UAAmD;AAC5E,QAAM,CAAC,MAAM,WAAW,SAAS,GAAG;AAEpC,YAAU,MAAM;AACd,QAAI,MAAM,WAAW,MAAM,QAAQ,SAAS;AAC1C,YAAM,QAAQ,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,MAAM,OAAO,CAAC;AAElB,MAAI,SAAS;AAAI,WAAO;AAExB,SAAO,SAAS,aACd,qCAAC;AAAA,IAAgB,eAAW;AAAA,IAAC,IAAI,MAAM;AAAA,IAAI,MAAM,MAAM;AAAA,IAAM,aAAW,MAAM,gBAAgB;AAAA,KAC3F,IACH,GACA,MAAM,QAAQ,WAAW,SAAS,IACpC;AACF,CAAC;AAED,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,yBAAyB,SAAS,YAAY;AACpD,uBAAuB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,3 @@
1
1
  import * as React from "react";
2
- export * from "./DSLiveRegion";
2
+ export * from "./useLiveRegion";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/live-region/index.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSLiveRegion';\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './useLiveRegion';\n"],
5
5
  "mappings": "AAAA;ACAA;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,5 @@
1
1
  import * as React from "react";
2
- import { PropTypes } from "@elliemae/ds-utilities";
3
- const propTypes = {
4
- methods: PropTypes.object.description("Ref Object."),
5
- portal: PropTypes.node.description("Sets a custom portal").defaultValue("Body Element."),
6
- ["aria-live"]: PropTypes.oneOf(["assertive", "polite", "off"]).description("Selects your aria live mode."),
7
- role: PropTypes.oneOf(["log", "status", "alert", "progressbar", "marquee", "timer"]).description("Selects your specific role."),
8
- id: PropTypes.string.description("Unique id for the Live Region.")
9
- };
2
+ const propTypes = {};
10
3
  export {
11
4
  propTypes
12
5
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/live-region/propTypes.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from '@elliemae/ds-utilities';\nimport type React from 'react';\n\nexport declare module DSLiveRegionT {\n interface Methods {\n read: React.Dispatch<React.SetStateAction<string>>;\n }\n export interface Props {\n methods?: React.MutableRefObject<Methods>;\n portal?: React.MutableRefObject<HTMLElement>;\n ['aria-live']?: 'off' | 'assertive' | 'polite';\n role?: 'log' | 'status' | 'alert' | 'progressbar' | 'marquee' | 'timer';\n id?: string;\n }\n}\n\nexport const propTypes = {\n methods: PropTypes.object.description('Ref Object.'),\n portal: PropTypes.node.description('Sets a custom portal').defaultValue('Body Element.'),\n ['aria-live']: PropTypes.oneOf(['assertive', 'polite', 'off']).description('Selects your aria live mode.'),\n role: PropTypes.oneOf(['log', 'status', 'alert', 'progressbar', 'marquee', 'timer']).description(\n 'Selects your specific role.',\n ),\n id: PropTypes.string.description('Unique id for the Live Region.'),\n};\n"],
5
- "mappings": "AAAA;ACAA;AAgBO,MAAM,YAAY;AAAA,EACvB,SAAS,UAAU,OAAO,YAAY,aAAa;AAAA,EACnD,QAAQ,UAAU,KAAK,YAAY,sBAAsB,EAAE,aAAa,eAAe;AAAA,GACtF,cAAc,UAAU,MAAM,CAAC,aAAa,UAAU,KAAK,CAAC,EAAE,YAAY,8BAA8B;AAAA,EACzG,MAAM,UAAU,MAAM,CAAC,OAAO,UAAU,SAAS,eAAe,WAAW,OAAO,CAAC,EAAE,YACnF,6BACF;AAAA,EACA,IAAI,UAAU,OAAO,YAAY,gCAAgC;AACnE;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\n\nexport declare namespace UseLiveRegionT {\n export interface Props {\n id?: string;\n portal?: React.MutableRefObject<HTMLElement>;\n }\n}\n\nexport const propTypes = {};\n"],
5
+ "mappings": "AAAA;ACSO,MAAM,YAAY,CAAC;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,71 @@
1
+ import * as React from "react";
2
+ import ReactDOM from "react-dom";
3
+ import React2, { memo, useEffect, useState, useCallback, useRef, useMemo } from "react";
4
+ import { describe } from "@elliemae/ds-utilities";
5
+ import { uid } from "uid";
6
+ import { StyledContainer } from "./styles";
7
+ import { propTypes } from "./propTypes";
8
+ const DSLiveRegion = memo((props) => {
9
+ const [internalMessage, setInternalMessage] = useState("");
10
+ const [unsafe_emulateAssertiveNVDA, setUnsafe_emulateAssertiveNVDA] = useState(false);
11
+ const [role, setRole] = useState(void 0);
12
+ const [ariaLive, setAriaLive] = useState("polite");
13
+ const { id, portal } = props || {};
14
+ const reset = useCallback(() => {
15
+ setInternalMessage("");
16
+ setUnsafe_emulateAssertiveNVDA(false);
17
+ setAriaLive("polite");
18
+ setRole(void 0);
19
+ }, []);
20
+ const configure = useCallback((message, options) => {
21
+ reset();
22
+ setTimeout(() => {
23
+ if (options?.unsafe_emulateAssertiveNVDA)
24
+ setUnsafe_emulateAssertiveNVDA(true);
25
+ setTimeout(() => {
26
+ if (options?.assertive || options?.unsafe_emulateAssertiveNVDA)
27
+ setAriaLive("assertive");
28
+ if (options?.unsafe_emulateAssertiveNVDA) {
29
+ setRole("alert");
30
+ setUnsafe_emulateAssertiveNVDA(false);
31
+ }
32
+ setInternalMessage(message);
33
+ });
34
+ });
35
+ }, [reset]);
36
+ useEffect(() => {
37
+ if (props.methods) {
38
+ props.methods.current.read = configure;
39
+ }
40
+ }, [configure, props.methods]);
41
+ if (unsafe_emulateAssertiveNVDA)
42
+ return null;
43
+ return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(StyledContainer, {
44
+ "aria-atomic": true,
45
+ id,
46
+ role,
47
+ "aria-live": ariaLive
48
+ }, internalMessage), portal?.current || document.body);
49
+ });
50
+ const useLiveRegion = (props) => {
51
+ const methods = useRef({});
52
+ const { id, portal } = props || {};
53
+ const instanceUID = useMemo(() => `ds-live-region-${uid(5)}`, []);
54
+ const read = useCallback((message, options) => methods.current.read?.(message, options), []);
55
+ return useMemo(() => ({
56
+ LiveRegion: () => /* @__PURE__ */ React2.createElement(DSLiveRegion, {
57
+ methods,
58
+ id: instanceUID || id,
59
+ portal
60
+ }),
61
+ read
62
+ }), [id, instanceUID, portal, read]);
63
+ };
64
+ useLiveRegion.displayName = "useLiveRegion";
65
+ const UseLiveRegionWithSchema = describe(useLiveRegion);
66
+ UseLiveRegionWithSchema.propTypes = propTypes;
67
+ export {
68
+ UseLiveRegionWithSchema,
69
+ useLiveRegion
70
+ };
71
+ //# sourceMappingURL=useLiveRegion.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/live-region/useLiveRegion.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import ReactDOM from 'react-dom';\nimport React, { memo, useEffect, useState, useCallback, useRef, useMemo } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { uid } from 'uid';\nimport { StyledContainer } from './styles';\nimport { propTypes } from './propTypes';\nimport type { UseLiveRegionT } from './propTypes';\n\ninterface Options {\n assertive?: boolean;\n unsafe_emulateAssertiveNVDA?: boolean;\n}\ninterface Methods {\n read?: (message: string, options: Options) => void;\n}\nexport interface Props {\n methods?: React.MutableRefObject<Methods>;\n id?: string;\n portal?: React.MutableRefObject<HTMLElement>;\n}\n\nconst DSLiveRegion = memo((props: Props): JSX.Element | null => {\n const [internalMessage, setInternalMessage] = useState<string>('');\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const [unsafe_emulateAssertiveNVDA, setUnsafe_emulateAssertiveNVDA] = useState(false);\n const [role, setRole] = useState<undefined | string>(undefined);\n const [ariaLive, setAriaLive] = useState('polite');\n const { id, portal } = props || {};\n\n const reset = useCallback(() => {\n setInternalMessage('');\n setUnsafe_emulateAssertiveNVDA(false);\n setAriaLive('polite');\n setRole(undefined);\n }, []);\n\n const configure = useCallback(\n (message: string, options: Options) => {\n reset();\n setTimeout(() => {\n if (options?.unsafe_emulateAssertiveNVDA) setUnsafe_emulateAssertiveNVDA(true);\n // eslint-disable-next-line max-nested-callbacks\n setTimeout(() => {\n if (options?.assertive || options?.unsafe_emulateAssertiveNVDA) setAriaLive('assertive');\n if (options?.unsafe_emulateAssertiveNVDA) {\n setRole('alert');\n setUnsafe_emulateAssertiveNVDA(false);\n }\n setInternalMessage(message);\n });\n });\n },\n [reset],\n );\n\n useEffect(() => {\n if (props.methods) {\n props.methods.current.read = configure;\n }\n }, [configure, props.methods]);\n\n if (unsafe_emulateAssertiveNVDA) return null;\n\n return ReactDOM.createPortal(\n <StyledContainer aria-atomic id={id} role={role} aria-live={ariaLive}>\n {internalMessage}\n </StyledContainer>,\n portal?.current || document.body,\n );\n});\n\nconst useLiveRegion = (props: UseLiveRegionT.Props) => {\n const methods = useRef<Methods>({});\n\n const { id, portal } = props || {};\n\n const instanceUID = useMemo(() => `ds-live-region-${uid(5)}`, []);\n\n const read = useCallback((message: string, options: Options) => methods.current.read?.(message, options), []);\n\n return useMemo(\n () => ({\n LiveRegion: () => <DSLiveRegion methods={methods} id={instanceUID || id} portal={portal} />,\n read,\n }),\n [id, instanceUID, portal, read],\n );\n};\n\nuseLiveRegion.displayName = 'useLiveRegion';\nconst UseLiveRegionWithSchema = describe(useLiveRegion);\nUseLiveRegionWithSchema.propTypes = propTypes;\nexport { useLiveRegion, UseLiveRegionWithSchema };\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAgBA,MAAM,eAAe,KAAK,CAAC,UAAqC;AAC9D,QAAM,CAAC,iBAAiB,sBAAsB,SAAiB,EAAE;AAEjE,QAAM,CAAC,6BAA6B,kCAAkC,SAAS,KAAK;AACpF,QAAM,CAAC,MAAM,WAAW,SAA6B,MAAS;AAC9D,QAAM,CAAC,UAAU,eAAe,SAAS,QAAQ;AACjD,QAAM,EAAE,IAAI,WAAW,SAAS,CAAC;AAEjC,QAAM,QAAQ,YAAY,MAAM;AAC9B,uBAAmB,EAAE;AACrB,mCAA+B,KAAK;AACpC,gBAAY,QAAQ;AACpB,YAAQ,MAAS;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,YAChB,CAAC,SAAiB,YAAqB;AACrC,UAAM;AACN,eAAW,MAAM;AACf,UAAI,SAAS;AAA6B,uCAA+B,IAAI;AAE7E,iBAAW,MAAM;AACf,YAAI,SAAS,aAAa,SAAS;AAA6B,sBAAY,WAAW;AACvF,YAAI,SAAS,6BAA6B;AACxC,kBAAQ,OAAO;AACf,yCAA+B,KAAK;AAAA,QACtC;AACA,2BAAmB,OAAO;AAAA,MAC5B,CAAC;AAAA,IACH,CAAC;AAAA,EACH,GACA,CAAC,KAAK,CACR;AAEA,YAAU,MAAM;AACd,QAAI,MAAM,SAAS;AACjB,YAAM,QAAQ,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,WAAW,MAAM,OAAO,CAAC;AAE7B,MAAI;AAA6B,WAAO;AAExC,SAAO,SAAS,aACd,qCAAC;AAAA,IAAgB,eAAW;AAAA,IAAC;AAAA,IAAQ;AAAA,IAAY,aAAW;AAAA,KACzD,eACH,GACA,QAAQ,WAAW,SAAS,IAC9B;AACF,CAAC;AAED,MAAM,gBAAgB,CAAC,UAAgC;AACrD,QAAM,UAAU,OAAgB,CAAC,CAAC;AAElC,QAAM,EAAE,IAAI,WAAW,SAAS,CAAC;AAEjC,QAAM,cAAc,QAAQ,MAAM,kBAAkB,IAAI,CAAC,KAAK,CAAC,CAAC;AAEhE,QAAM,OAAO,YAAY,CAAC,SAAiB,YAAqB,QAAQ,QAAQ,OAAO,SAAS,OAAO,GAAG,CAAC,CAAC;AAE5G,SAAO,QACL,MAAO;AAAA,IACL,YAAY,MAAM,qCAAC;AAAA,MAAa;AAAA,MAAkB,IAAI,eAAe;AAAA,MAAI;AAAA,KAAgB;AAAA,IACzF;AAAA,EACF,IACA,CAAC,IAAI,aAAa,QAAQ,IAAI,CAChC;AACF;AAEA,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa;AACtD,wBAAwB,YAAY;",
6
+ "names": []
7
+ }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import React2, { useCallback } from "react";
3
- import { describe } from "react-desc";
3
+ import { describe } from "@elliemae/ds-utilities";
4
4
  import { propTypes } from "./propTypes";
5
5
  import { StyledButton } from "./styles";
6
6
  const DSSkipTo = (props) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/skip-to/DSSkipTo.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback } from 'react';\nimport { describe } from 'react-desc';\nimport { propTypes } from './propTypes';\nimport type { DSSkipToPropsT as Props } from './index.d';\nimport { StyledButton } from './styles';\n\nconst DSSkipTo = (props: Props): JSX.Element => {\n const { goTo, message = 'Skip to main content' } = props;\n const handleOnClick = useCallback(() => {\n (document.getElementById(goTo) as HTMLElement).focus();\n }, [goTo]);\n return <StyledButton onClick={handleOnClick}>{message}</StyledButton>;\n};\n\nDSSkipTo.propTypes = propTypes;\nDSSkipTo.displayName = 'DSSkipTo';\nconst DSSkipToWithSchema = describe(DSSkipTo);\nDSSkipToWithSchema.propTypes = propTypes;\n\nexport { DSSkipTo, DSSkipToWithSchema };\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { propTypes } from './propTypes';\nimport type { DSSkipToPropsT as Props } from './index.d';\nimport { StyledButton } from './styles';\n\nconst DSSkipTo = (props: Props): JSX.Element => {\n const { goTo, message = 'Skip to main content' } = props;\n const handleOnClick = useCallback(() => {\n (document.getElementById(goTo) as HTMLElement).focus();\n }, [goTo]);\n return <StyledButton onClick={handleOnClick}>{message}</StyledButton>;\n};\n\nDSSkipTo.propTypes = propTypes;\nDSSkipTo.displayName = 'DSSkipTo';\nconst DSSkipToWithSchema = describe(DSSkipTo);\nDSSkipToWithSchema.propTypes = propTypes;\n\nexport { DSSkipTo, DSSkipToWithSchema };\n"],
5
5
  "mappings": "AAAA;ACAA;AACA;AACA;AAEA;AAEA,MAAM,WAAW,CAAC,UAA8B;AAC9C,QAAM,EAAE,MAAM,UAAU,2BAA2B;AACnD,QAAM,gBAAgB,YAAY,MAAM;AACtC,IAAC,SAAS,eAAe,IAAI,EAAkB,MAAM;AAAA,EACvD,GAAG,CAAC,IAAI,CAAC;AACT,SAAO,qCAAC;AAAA,IAAa,SAAS;AAAA,KAAgB,OAAQ;AACxD;AAEA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { PropTypes } from "react-desc";
2
+ import { PropTypes } from "@elliemae/ds-utilities";
3
3
  const propTypes = {
4
4
  goTo: PropTypes.string.isRequired.description("String containing content's id that you want to go."),
5
5
  message: PropTypes.string.description("Message for the Skip To component, default is 'Skip to main content'.")
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/skip-to/propTypes.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\n\nexport const propTypes = {\n goTo: PropTypes.string.isRequired.description(\"String containing content's id that you want to go.\"),\n message: PropTypes.string.description(\"Message for the Skip To component, default is 'Skip to main content'.\"),\n};\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from '@elliemae/ds-utilities';\n\nexport const propTypes = {\n goTo: PropTypes.string.isRequired.description(\"String containing content's id that you want to go.\"),\n message: PropTypes.string.description(\"Message for the Skip To component, default is 'Skip to main content'.\"),\n};\n"],
5
5
  "mappings": "AAAA;ACAA;AAEO,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU,OAAO,WAAW,YAAY,qDAAqD;AAAA,EACnG,SAAS,UAAU,OAAO,YAAY,uEAAuE;AAC/G;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import styled from "styled-components";
2
+ import { styled } from "@elliemae/ds-system";
3
3
  const StyledButton = styled.button`
4
4
  left: -999px;
5
5
  outline: none;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/skip-to/styles.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\n\nexport const StyledButton = styled.button`\n left: -999px;\n outline: none;\n position: absolute;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n z-index: -999;\n &:focus,\n &:active {\n color: ${({ theme }) => theme.colors.brand[600]};\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n text-decoration: underline;\n left: 0;\n top: 0;\n height: auto;\n cursor: pointer;\n width: fit-content;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xxs}`};\n border-radius: 2px;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n text-align: center;\n z-index: 999;\n overflow: auto;\n }\n`;\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\n\nexport const StyledButton = styled.button`\n left: -999px;\n outline: none;\n position: absolute;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n z-index: -999;\n &:focus,\n &:active {\n color: ${({ theme }) => theme.colors.brand[600]};\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n text-decoration: underline;\n left: 0;\n top: 0;\n height: auto;\n cursor: pointer;\n width: fit-content;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xxs}`};\n border-radius: 2px;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n text-align: center;\n z-index: 999;\n overflow: auto;\n }\n`;\n"],
5
5
  "mappings": "AAAA;ACAA;AAEO,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAWtB,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA,wBACvB,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAO7C,CAAC,EAAE,YAAY,GAAG,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA;AAAA,wBAEzC,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-accessibility",
3
- "version": "3.1.0-next.2",
3
+ "version": "3.1.0-next.20",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Accessibility",
6
6
  "files": [
@@ -50,26 +50,28 @@
50
50
  "reportFile": "tests.xml",
51
51
  "indent": 4
52
52
  },
53
- "scripts": {
54
- "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
55
- "test": "node ../../scripts/testing/test.mjs",
56
- "lint": "node ../../scripts/lint.mjs",
57
- "dts": "node ../../scripts/dts.mjs",
58
- "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
59
- },
60
53
  "dependencies": {
61
- "@elliemae/ds-utilities": "3.1.0-next.2"
54
+ "@elliemae/ds-system": "3.1.0-next.20",
55
+ "@elliemae/ds-utilities": "3.1.0-next.20"
62
56
  },
63
57
  "devDependencies": {
64
- "styled-components": "~5.3.3"
58
+ "styled-components": "~5.3.5"
65
59
  },
66
60
  "peerDependencies": {
67
61
  "react": "^17.0.2",
68
62
  "react-dom": "^17.0.2",
69
- "styled-components": "^5.3.3"
63
+ "styled-components": "^5.3.5"
70
64
  },
71
65
  "publishConfig": {
72
66
  "access": "public",
73
67
  "typeSafety": false
68
+ },
69
+ "scripts": {
70
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
71
+ "test": "node ../../scripts/testing/test.mjs",
72
+ "lint": "node ../../scripts/lint.mjs",
73
+ "dts": "node ../../scripts/dts.mjs",
74
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
75
+ "checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
74
76
  }
75
- }
77
+ }