@elliemae/ds-legacy-accessibility 1.0.0-rc.1

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.
Files changed (58) hide show
  1. package/dist/cjs/index.js +31 -0
  2. package/dist/cjs/index.js.map +7 -0
  3. package/dist/cjs/live-region/DSLiveRegion.js +60 -0
  4. package/dist/cjs/live-region/DSLiveRegion.js.map +7 -0
  5. package/dist/cjs/live-region/index.js +30 -0
  6. package/dist/cjs/live-region/index.js.map +7 -0
  7. package/dist/cjs/live-region/propTypes.js +48 -0
  8. package/dist/cjs/live-region/propTypes.js.map +7 -0
  9. package/dist/cjs/live-region/styles.js +48 -0
  10. package/dist/cjs/live-region/styles.js.map +7 -0
  11. package/dist/cjs/live-region/useLiveRegion.js +111 -0
  12. package/dist/cjs/live-region/useLiveRegion.js.map +7 -0
  13. package/dist/cjs/package.json +7 -0
  14. package/dist/cjs/skip-to/DSSkipTo.js +52 -0
  15. package/dist/cjs/skip-to/DSSkipTo.js.map +7 -0
  16. package/dist/cjs/skip-to/index.d.js +28 -0
  17. package/dist/cjs/skip-to/index.d.js.map +7 -0
  18. package/dist/cjs/skip-to/index.js +37 -0
  19. package/dist/cjs/skip-to/index.js.map +7 -0
  20. package/dist/cjs/skip-to/propTypes.js +40 -0
  21. package/dist/cjs/skip-to/propTypes.js.map +7 -0
  22. package/dist/cjs/skip-to/styles.js +63 -0
  23. package/dist/cjs/skip-to/styles.js.map +7 -0
  24. package/dist/esm/index.js +4 -0
  25. package/dist/esm/index.js.map +7 -0
  26. package/dist/esm/live-region/DSLiveRegion.js +30 -0
  27. package/dist/esm/live-region/DSLiveRegion.js.map +7 -0
  28. package/dist/esm/live-region/index.js +3 -0
  29. package/dist/esm/live-region/index.js.map +7 -0
  30. package/dist/esm/live-region/propTypes.js +18 -0
  31. package/dist/esm/live-region/propTypes.js.map +7 -0
  32. package/dist/esm/live-region/styles.js +18 -0
  33. package/dist/esm/live-region/styles.js.map +7 -0
  34. package/dist/esm/live-region/useLiveRegion.js +81 -0
  35. package/dist/esm/live-region/useLiveRegion.js.map +7 -0
  36. package/dist/esm/package.json +7 -0
  37. package/dist/esm/skip-to/DSSkipTo.js +22 -0
  38. package/dist/esm/skip-to/DSSkipTo.js.map +7 -0
  39. package/dist/esm/skip-to/index.d.js +2 -0
  40. package/dist/esm/skip-to/index.d.js.map +7 -0
  41. package/dist/esm/skip-to/index.js +7 -0
  42. package/dist/esm/skip-to/index.js.map +7 -0
  43. package/dist/esm/skip-to/propTypes.js +10 -0
  44. package/dist/esm/skip-to/propTypes.js.map +7 -0
  45. package/dist/esm/skip-to/styles.js +33 -0
  46. package/dist/esm/skip-to/styles.js.map +7 -0
  47. package/dist/types/index.d.ts +2 -0
  48. package/dist/types/live-region/DSLiveRegion.d.ts +9 -0
  49. package/dist/types/live-region/index.d.ts +1 -0
  50. package/dist/types/live-region/propTypes.d.ts +20 -0
  51. package/dist/types/live-region/styles.d.ts +1 -0
  52. package/dist/types/live-region/useLiveRegion.d.ts +24 -0
  53. package/dist/types/skip-to/DSSkipTo.d.ts +9 -0
  54. package/dist/types/skip-to/index.d.d.ts +4 -0
  55. package/dist/types/skip-to/index.d.ts +1 -0
  56. package/dist/types/skip-to/propTypes.d.ts +2 -0
  57. package/dist/types/skip-to/styles.d.ts +1 -0
  58. package/package.json +83 -0
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var styles_exports = {};
30
+ __export(styles_exports, {
31
+ StyledButton: () => StyledButton
32
+ });
33
+ module.exports = __toCommonJS(styles_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_ds_legacy_system = require("@elliemae/ds-legacy-system");
36
+ const StyledButton = import_ds_legacy_system.styled.button`
37
+ left: -999px;
38
+ outline: none;
39
+ position: absolute;
40
+ top: auto;
41
+ width: 1px;
42
+ height: 1px;
43
+ overflow: hidden;
44
+ z-index: -999;
45
+ &:focus,
46
+ &:active {
47
+ color: ${({ theme }) => theme.colors.brand[600]};
48
+ background-color: ${({ theme }) => theme.colors.neutral["000"]};
49
+ text-decoration: underline;
50
+ left: 0;
51
+ top: 0;
52
+ height: auto;
53
+ cursor: pointer;
54
+ width: fit-content;
55
+ padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xxs}`};
56
+ border-radius: 2px;
57
+ border: 2px solid ${({ theme }) => theme.colors.brand[700]};
58
+ text-align: center;
59
+ z-index: 999;
60
+ overflow: auto;
61
+ }
62
+ `;
63
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/skip-to/styles.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { styled } from '@elliemae/ds-legacy-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,8BAAuB;AAEhB,MAAM,eAAe,+BAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAWtB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA,wBAC1B,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOlD,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA;AAAA,wBAEzC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ export * from "./skip-to/index.js";
3
+ export * from "./live-region/index.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './skip-to/index.js';\nexport * from './live-region/index.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,30 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import ReactDOM from "react-dom";
4
+ import { useEffect, useState } from "react";
5
+ import { describe } from "@elliemae/ds-legacy-props-helpers";
6
+ import { StyledContainer } from "./styles.js";
7
+ import { DSLiveRegionPropTypes } from "./propTypes.js";
8
+ const DSLiveRegion = (props) => {
9
+ const [text, setText] = useState(" ");
10
+ useEffect(() => {
11
+ if (props.methods && props.methods.current) {
12
+ props.methods.current.read = setText;
13
+ }
14
+ }, [props.methods]);
15
+ if (text === "")
16
+ return null;
17
+ return ReactDOM.createPortal(
18
+ /* @__PURE__ */ jsx(StyledContainer, { "aria-atomic": true, id: props.id, role: props.role, "aria-live": props["aria-live"] ?? "polite", children: text }),
19
+ props.portal?.current ?? document.body
20
+ );
21
+ };
22
+ DSLiveRegion.propTypes = DSLiveRegionPropTypes;
23
+ DSLiveRegion.displayName = "DSLiveRegion";
24
+ const DSLiveRegionWithSchema = describe(DSLiveRegion);
25
+ DSLiveRegionWithSchema.propTypes = DSLiveRegionPropTypes;
26
+ export {
27
+ DSLiveRegion,
28
+ DSLiveRegionWithSchema
29
+ };
30
+ //# sourceMappingURL=DSLiveRegion.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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, { useEffect, useState } from 'react';\nimport { describe } from '@elliemae/ds-legacy-props-helpers';\nimport { StyledContainer } from './styles.js';\nimport { DSLiveRegionPropTypes } from './propTypes.js';\nimport type { DSLiveRegionT } from './propTypes.js';\n\nconst DSLiveRegion = (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 = DSLiveRegionPropTypes;\nDSLiveRegion.displayName = 'DSLiveRegion';\nconst DSLiveRegionWithSchema = describe(DSLiveRegion);\nDSLiveRegionWithSchema.propTypes = DSLiveRegionPropTypes;\n\nexport { DSLiveRegion, DSLiveRegionWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmBnB;AAnBJ,OAAO,cAAc;AACrB,SAAgB,WAAW,gBAAgB;AAC3C,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAGtC,MAAM,eAAe,CAAC,UAAmD;AACvE,QAAM,CAAC,MAAM,OAAO,IAAI,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;AAAA,IACd,oBAAC,mBAAgB,eAAW,MAAC,IAAI,MAAM,IAAI,MAAM,MAAM,MAAM,aAAW,MAAM,WAAW,KAAK,UAC3F,gBACH;AAAA,IACA,MAAM,QAAQ,WAAW,SAAS;AAAA,EACpC;AACF;AAEA,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,yBAAyB,SAAS,YAAY;AACpD,uBAAuB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ export * from "./useLiveRegion.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 './useLiveRegion.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "@elliemae/ds-legacy-props-helpers";
3
+ const UseLiveRegionPropTypes = {
4
+ id: PropTypes.string.description("Id of the live region"),
5
+ portal: PropTypes.object.description("Portal to render the live region")
6
+ };
7
+ const DSLiveRegionPropTypes = {
8
+ id: PropTypes.string.description("Id of the live region"),
9
+ portal: PropTypes.object.description("Portal to render the live region"),
10
+ role: PropTypes.string.description("Role of the live region"),
11
+ "aria-live": PropTypes.string.description("Aria live attribute"),
12
+ methods: PropTypes.object.description("Methods to read the live region")
13
+ };
14
+ export {
15
+ DSLiveRegionPropTypes,
16
+ UseLiveRegionPropTypes
17
+ };
18
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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-legacy-props-helpers';\nimport type { Dispatch, MutableRefObject, SetStateAction, WeakValidationMap } from 'react';\n\nexport declare namespace UseLiveRegionT {\n export interface Props {\n id?: string;\n portal?: React.MutableRefObject<HTMLElement>;\n }\n}\n\nexport declare namespace DSLiveRegionT {\n export interface Props {\n id?: string;\n portal?: MutableRefObject<HTMLElement>;\n role?: string;\n 'aria-live'?: string;\n methods?: MutableRefObject<{ read?: Dispatch<SetStateAction<string>> }>;\n }\n}\n\nexport const UseLiveRegionPropTypes = {\n id: PropTypes.string.description('Id of the live region'),\n portal: PropTypes.object.description('Portal to render the live region'),\n} as WeakValidationMap<unknown>;\n\nexport const DSLiveRegionPropTypes = {\n id: PropTypes.string.description('Id of the live region'),\n portal: PropTypes.object.description('Portal to render the live region'),\n role: PropTypes.string.description('Role of the live region'),\n 'aria-live': PropTypes.string.description('Aria live attribute'),\n methods: PropTypes.object.description('Methods to read the live region'),\n} as WeakValidationMap<unknown>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;AAoBnB,MAAM,yBAAyB;AAAA,EACpC,IAAI,UAAU,OAAO,YAAY,uBAAuB;AAAA,EACxD,QAAQ,UAAU,OAAO,YAAY,kCAAkC;AACzE;AAEO,MAAM,wBAAwB;AAAA,EACnC,IAAI,UAAU,OAAO,YAAY,uBAAuB;AAAA,EACxD,QAAQ,UAAU,OAAO,YAAY,kCAAkC;AAAA,EACvE,MAAM,UAAU,OAAO,YAAY,yBAAyB;AAAA,EAC5D,aAAa,UAAU,OAAO,YAAY,qBAAqB;AAAA,EAC/D,SAAS,UAAU,OAAO,YAAY,iCAAiC;AACzE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { styled } from "@elliemae/ds-legacy-system";
3
+ const StyledContainer = styled.div`
4
+ position: absolute;
5
+ width: 1px;
6
+ height: 1px;
7
+ margin: -1px;
8
+ border: 0;
9
+ padding: 0;
10
+ overflow: hidden;
11
+ clip: rect(0 0 0 0);
12
+ clip-path: inset(100%);
13
+ white-space: nowrap;
14
+ `;
15
+ export {
16
+ StyledContainer
17
+ };
18
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/live-region/styles.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-legacy-system';\n\nexport const StyledContainer = styled.div`\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n border: 0;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(100%);\n white-space: nowrap;\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAEhB,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,81 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import ReactDOM from "react-dom";
4
+ import { memo, useEffect, useState, useCallback, useRef, useMemo } from "react";
5
+ import { describe } from "@elliemae/ds-legacy-props-helpers";
6
+ import { uid } from "uid";
7
+ import { StyledContainer } from "./styles.js";
8
+ import { UseLiveRegionPropTypes } from "./propTypes.js";
9
+ const DSLiveRegion = memo((props) => {
10
+ const [internalMessage, setInternalMessage] = useState("");
11
+ const [unsafe_emulateAssertiveNVDA, setUnsafe_emulateAssertiveNVDA] = useState(false);
12
+ const [role, setRole] = useState(void 0);
13
+ const [ariaLive, setAriaLive] = useState("polite");
14
+ const { id, portal } = props || {};
15
+ const reset = useCallback(() => {
16
+ setInternalMessage("");
17
+ setUnsafe_emulateAssertiveNVDA(false);
18
+ setAriaLive("polite");
19
+ setRole(void 0);
20
+ }, []);
21
+ const configure = useCallback(
22
+ (message, options) => {
23
+ reset();
24
+ setTimeout(() => {
25
+ if (options?.unsafe_emulateAssertiveNVDA)
26
+ setUnsafe_emulateAssertiveNVDA(true);
27
+ setTimeout(() => {
28
+ if (options?.assertive || options?.unsafe_emulateAssertiveNVDA)
29
+ setAriaLive("assertive");
30
+ if (options?.unsafe_emulateAssertiveNVDA) {
31
+ setRole("alert");
32
+ setUnsafe_emulateAssertiveNVDA(false);
33
+ }
34
+ if (options?.delay) {
35
+ setTimeout(
36
+ () => {
37
+ setInternalMessage(message);
38
+ },
39
+ options?.delay
40
+ );
41
+ } else {
42
+ setInternalMessage(message);
43
+ }
44
+ });
45
+ });
46
+ },
47
+ [reset]
48
+ );
49
+ useEffect(() => {
50
+ if (props.methods) {
51
+ props.methods.current.read = configure;
52
+ }
53
+ }, [configure, props.methods]);
54
+ if (unsafe_emulateAssertiveNVDA)
55
+ return null;
56
+ return ReactDOM.createPortal(
57
+ /* @__PURE__ */ jsx(StyledContainer, { "aria-atomic": true, id, role, "aria-live": ariaLive, children: internalMessage }),
58
+ portal?.current || document.body
59
+ );
60
+ });
61
+ const useLiveRegion = (props) => {
62
+ const methods = useRef({});
63
+ const { id, portal } = props || {};
64
+ const instanceUID = useMemo(() => `ds-live-region-${uid(5)}`, []);
65
+ const read = useCallback((message, options) => methods.current.read?.(message, options), []);
66
+ return useMemo(
67
+ () => ({
68
+ LiveRegion: () => /* @__PURE__ */ jsx(DSLiveRegion, { methods, id: id ?? instanceUID, portal }),
69
+ read
70
+ }),
71
+ [id, instanceUID, portal, read]
72
+ );
73
+ };
74
+ useLiveRegion.displayName = "useLiveRegion";
75
+ const UseLiveRegionWithSchema = describe(useLiveRegion);
76
+ UseLiveRegionWithSchema.propTypes = UseLiveRegionPropTypes;
77
+ export {
78
+ UseLiveRegionWithSchema,
79
+ useLiveRegion
80
+ };
81
+ //# 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", "/* eslint-disable max-nested-callbacks */\nimport ReactDOM from 'react-dom';\nimport React, { memo, useEffect, useState, useCallback, useRef, useMemo } from 'react';\nimport { describe } from '@elliemae/ds-legacy-props-helpers';\nimport { uid } from 'uid';\nimport { StyledContainer } from './styles.js';\nimport { UseLiveRegionPropTypes } from './propTypes.js';\nimport type { UseLiveRegionT } from './propTypes.js';\n\ninterface Options {\n assertive?: boolean;\n unsafe_emulateAssertiveNVDA?: boolean;\n delay?: number;\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 setTimeout(() => {\n if (options?.assertive || options?.unsafe_emulateAssertiveNVDA) setAriaLive('assertive');\n if (options?.unsafe_emulateAssertiveNVDA) {\n setRole('alert');\n setUnsafe_emulateAssertiveNVDA(false);\n }\n if (options?.delay) {\n setTimeout(\n () => {\n setInternalMessage(message);\n },\n options?.delay,\n );\n } else {\n setInternalMessage(message);\n }\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={id ?? instanceUID} portal={portal} />,\n read,\n }),\n [id, instanceUID, portal, read],\n );\n};\n\nuseLiveRegion.displayName = 'useLiveRegion';\nconst UseLiveRegionWithSchema = describe(useLiveRegion);\nUseLiveRegionWithSchema.propTypes = UseLiveRegionPropTypes;\nexport { useLiveRegion, UseLiveRegionWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC0EnB;AAzEJ,OAAO,cAAc;AACrB,SAAgB,MAAM,WAAW,UAAU,aAAa,QAAQ,eAAe;AAC/E,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AAiBvC,MAAM,eAAe,KAAK,CAAC,UAAqC;AAC9D,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAiB,EAAE;AAEjE,QAAM,CAAC,6BAA6B,8BAA8B,IAAI,SAAS,KAAK;AACpF,QAAM,CAAC,MAAM,OAAO,IAAI,SAA6B,MAAS;AAC9D,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,QAAQ;AACjD,QAAM,EAAE,IAAI,OAAO,IAAI,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;AAAA,IAChB,CAAC,SAAiB,YAAqB;AACrC,YAAM;AACN,iBAAW,MAAM;AACf,YAAI,SAAS;AAA6B,yCAA+B,IAAI;AAC7E,mBAAW,MAAM;AACf,cAAI,SAAS,aAAa,SAAS;AAA6B,wBAAY,WAAW;AACvF,cAAI,SAAS,6BAA6B;AACxC,oBAAQ,OAAO;AACf,2CAA+B,KAAK;AAAA,UACtC;AACA,cAAI,SAAS,OAAO;AAClB;AAAA,cACE,MAAM;AACJ,mCAAmB,OAAO;AAAA,cAC5B;AAAA,cACA,SAAS;AAAA,YACX;AAAA,UACF,OAAO;AACL,+BAAmB,OAAO;AAAA,UAC5B;AAAA,QACF,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AAAA,IACA,CAAC,KAAK;AAAA,EACR;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;AAAA,IACd,oBAAC,mBAAgB,eAAW,MAAC,IAAQ,MAAY,aAAW,UACzD,2BACH;AAAA,IACA,QAAQ,WAAW,SAAS;AAAA,EAC9B;AACF,CAAC;AAED,MAAM,gBAAgB,CAAC,UAAgC;AACrD,QAAM,UAAU,OAAgB,CAAC,CAAC;AAElC,QAAM,EAAE,IAAI,OAAO,IAAI,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;AAAA,IACL,OAAO;AAAA,MACL,YAAY,MAAM,oBAAC,gBAAa,SAAkB,IAAI,MAAM,aAAa,QAAgB;AAAA,MACzF;AAAA,IACF;AAAA,IACA,CAAC,IAAI,aAAa,QAAQ,IAAI;AAAA,EAChC;AACF;AAEA,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa;AACtD,wBAAwB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useCallback } from "react";
4
+ import { describe } from "@elliemae/ds-legacy-props-helpers";
5
+ import { propTypes } from "./propTypes.js";
6
+ import { StyledButton } from "./styles.js";
7
+ const DSSkipTo = (props) => {
8
+ const { goTo, message = "Skip to main content" } = props;
9
+ const handleOnClick = useCallback(() => {
10
+ document.getElementById(goTo).focus();
11
+ }, [goTo]);
12
+ return /* @__PURE__ */ jsx(StyledButton, { onClick: handleOnClick, children: message });
13
+ };
14
+ DSSkipTo.propTypes = propTypes;
15
+ DSSkipTo.displayName = "DSSkipTo";
16
+ const DSSkipToWithSchema = describe(DSSkipTo);
17
+ DSSkipToWithSchema.propTypes = propTypes;
18
+ export {
19
+ DSSkipTo,
20
+ DSSkipToWithSchema
21
+ };
22
+ //# sourceMappingURL=DSSkipTo.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 '@elliemae/ds-legacy-props-helpers';\nimport { propTypes } from './propTypes.js';\nimport type { DSSkipToPropsT as Props } from './index.d';\nimport { StyledButton } from './styles.js';\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
+ "mappings": "AAAA,YAAY,WAAW;ACWd;AAXT,SAAgB,mBAAmB;AACnC,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAE1B,SAAS,oBAAoB;AAE7B,MAAM,WAAW,CAAC,UAA8B;AAC9C,QAAM,EAAE,MAAM,UAAU,uBAAuB,IAAI;AACnD,QAAM,gBAAgB,YAAY,MAAM;AACtC,IAAC,SAAS,eAAe,IAAI,EAAkB,MAAM;AAAA,EACvD,GAAG,CAAC,IAAI,CAAC;AACT,SAAO,oBAAC,gBAAa,SAAS,eAAgB,mBAAQ;AACxD;AAEA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { DSSkipTo, DSSkipToWithSchema } from "./DSSkipTo.js";
3
+ export {
4
+ DSSkipTo,
5
+ DSSkipToWithSchema
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/skip-to/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSSkipTo, DSSkipToWithSchema } from './DSSkipTo.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAAU,0BAA0B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "@elliemae/ds-legacy-props-helpers";
3
+ const propTypes = {
4
+ goTo: PropTypes.string.isRequired.description("String containing content's id that you want to go."),
5
+ message: PropTypes.string.description("Message for the Skip To component, default is 'Skip to main content'.")
6
+ };
7
+ export {
8
+ propTypes
9
+ };
10
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 type { WeakValidationMap } from 'react';\nimport { PropTypes } from '@elliemae/ds-legacy-props-helpers';\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} as WeakValidationMap<unknown>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AAEnB,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU,OAAO,WAAW,YAAY,qDAAqD;AAAA,EACnG,SAAS,UAAU,OAAO,YAAY,uEAAuE;AAC/G;",
6
+ "names": []
7
+ }
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { styled } from "@elliemae/ds-legacy-system";
3
+ const StyledButton = styled.button`
4
+ left: -999px;
5
+ outline: none;
6
+ position: absolute;
7
+ top: auto;
8
+ width: 1px;
9
+ height: 1px;
10
+ overflow: hidden;
11
+ z-index: -999;
12
+ &:focus,
13
+ &:active {
14
+ color: ${({ theme }) => theme.colors.brand[600]};
15
+ background-color: ${({ theme }) => theme.colors.neutral["000"]};
16
+ text-decoration: underline;
17
+ left: 0;
18
+ top: 0;
19
+ height: auto;
20
+ cursor: pointer;
21
+ width: fit-content;
22
+ padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xxs}`};
23
+ border-radius: 2px;
24
+ border: 2px solid ${({ theme }) => theme.colors.brand[700]};
25
+ text-align: center;
26
+ z-index: 999;
27
+ overflow: auto;
28
+ }
29
+ `;
30
+ export {
31
+ StyledButton
32
+ };
33
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 '@elliemae/ds-legacy-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
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AAEhB,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAWtB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA,wBAC1B,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOlD,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA;AAAA,wBAEzC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './skip-to/index.js';
2
+ export * from './live-region/index.js';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { DSLiveRegionT } from './propTypes.js';
3
+ declare const DSLiveRegion: {
4
+ (props: DSLiveRegionT.Props): JSX.Element | null;
5
+ propTypes: React.WeakValidationMap<unknown>;
6
+ displayName: string;
7
+ };
8
+ declare const DSLiveRegionWithSchema: import("@elliemae/ds-legacy-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSLiveRegionT.Props>;
9
+ export { DSLiveRegion, DSLiveRegionWithSchema };
@@ -0,0 +1 @@
1
+ export * from './useLiveRegion.js';
@@ -0,0 +1,20 @@
1
+ import type { Dispatch, MutableRefObject, SetStateAction, WeakValidationMap } from 'react';
2
+ export declare namespace UseLiveRegionT {
3
+ interface Props {
4
+ id?: string;
5
+ portal?: React.MutableRefObject<HTMLElement>;
6
+ }
7
+ }
8
+ export declare namespace DSLiveRegionT {
9
+ interface Props {
10
+ id?: string;
11
+ portal?: MutableRefObject<HTMLElement>;
12
+ role?: string;
13
+ 'aria-live'?: string;
14
+ methods?: MutableRefObject<{
15
+ read?: Dispatch<SetStateAction<string>>;
16
+ }>;
17
+ }
18
+ }
19
+ export declare const UseLiveRegionPropTypes: WeakValidationMap<unknown>;
20
+ export declare const DSLiveRegionPropTypes: WeakValidationMap<unknown>;
@@ -0,0 +1 @@
1
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", import("@elliemae/ds-legacy-system").Theme, object & import("@elliemae/ds-legacy-system").OwnerInterface, never>;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import type { UseLiveRegionT } from './propTypes.js';
3
+ interface Options {
4
+ assertive?: boolean;
5
+ unsafe_emulateAssertiveNVDA?: boolean;
6
+ delay?: number;
7
+ }
8
+ interface Methods {
9
+ read?: (message: string, options: Options) => void;
10
+ }
11
+ export interface Props {
12
+ methods?: React.MutableRefObject<Methods>;
13
+ id?: string;
14
+ portal?: React.MutableRefObject<HTMLElement>;
15
+ }
16
+ declare const useLiveRegion: {
17
+ (props: UseLiveRegionT.Props): {
18
+ LiveRegion: () => import("react/jsx-runtime.js").JSX.Element;
19
+ read: (message: string, options: Options) => void | undefined;
20
+ };
21
+ displayName: string;
22
+ };
23
+ declare const UseLiveRegionWithSchema: import("@elliemae/ds-legacy-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<UseLiveRegionT.Props>;
24
+ export { useLiveRegion, UseLiveRegionWithSchema };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { DSSkipToPropsT as Props } from './index.d';
3
+ declare const DSSkipTo: {
4
+ (props: Props): JSX.Element;
5
+ propTypes: React.WeakValidationMap<unknown>;
6
+ displayName: string;
7
+ };
8
+ declare const DSSkipToWithSchema: import("@elliemae/ds-legacy-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<Props>;
9
+ export { DSSkipTo, DSSkipToWithSchema };
@@ -0,0 +1,4 @@
1
+ export interface DSSkipToPropsT {
2
+ goTo: string;
3
+ message?: string;
4
+ }
@@ -0,0 +1 @@
1
+ export { DSSkipTo, DSSkipToWithSchema } from './DSSkipTo.js';
@@ -0,0 +1,2 @@
1
+ import type { WeakValidationMap } from 'react';
2
+ export declare const propTypes: WeakValidationMap<unknown>;
@@ -0,0 +1 @@
1
+ export declare const StyledButton: import("styled-components").StyledComponent<"button", import("@elliemae/ds-legacy-system").Theme, object & import("@elliemae/ds-legacy-system").OwnerInterface, never>;
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@elliemae/ds-legacy-accessibility",
3
+ "version": "1.0.0-rc.1",
4
+ "license": "MIT",
5
+ "description": "ICE MT - Dimsum - Accessibility",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
16
+ },
17
+ "./skip-to/styles": {
18
+ "import": "./dist/esm/skip-to/styles.js",
19
+ "require": "./dist/cjs/skip-to/styles.js"
20
+ },
21
+ "./skip-to/propTypes": {
22
+ "import": "./dist/esm/skip-to/propTypes.js",
23
+ "require": "./dist/cjs/skip-to/propTypes.js"
24
+ },
25
+ "./skip-to": {
26
+ "import": "./dist/esm/skip-to/index.js",
27
+ "require": "./dist/cjs/skip-to/index.js"
28
+ },
29
+ "./skip-to/DSSkipTo": {
30
+ "import": "./dist/esm/skip-to/DSSkipTo.js",
31
+ "require": "./dist/cjs/skip-to/DSSkipTo.js"
32
+ }
33
+ },
34
+ "sideEffects": [
35
+ "*.css",
36
+ "*.scss"
37
+ ],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://git.elliemae.io/platform-ui/dimsum-legacy.git"
41
+ },
42
+ "engines": {
43
+ "pnpm": ">=6",
44
+ "node": ">=16"
45
+ },
46
+ "author": "ICE MT",
47
+ "jestSonar": {
48
+ "sonar56x": true,
49
+ "reportPath": "reports",
50
+ "reportFile": "tests.xml",
51
+ "indent": 4
52
+ },
53
+ "dependencies": {
54
+ "uid": "~2.0.1",
55
+ "@elliemae/ds-legacy-system": "1.0.0-rc.1",
56
+ "@elliemae/ds-legacy-props-helpers": "1.0.0-rc.1"
57
+ },
58
+ "devDependencies": {
59
+ "@elliemae/pui-cli": "~9.0.0-next.31",
60
+ "styled-components": "~5.3.9",
61
+ "@elliemae/ds-legacy-monorepo-devops": "1.0.0-rc.1"
62
+ },
63
+ "peerDependencies": {
64
+ "react": "^17.0.2",
65
+ "react-dom": "^17.0.2",
66
+ "styled-components": "~5.3.9"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public",
70
+ "typeSafety": false
71
+ },
72
+ "scripts": {
73
+ "dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
74
+ "test": "pui-cli test --passWithNoTests",
75
+ "lint": "node ../../../scripts/lint.mjs",
76
+ "eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../../.eslintrc.js' src/",
77
+ "dts": "node ../../../scripts/dts.mjs",
78
+ "build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
79
+ "dev:build": "pnpm --filter {.}... build",
80
+ "dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
81
+ "checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
82
+ }
83
+ }