@elliemae/ds-accessibility 3.28.1-rc.2 → 3.29.0-next.0
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/dist/cjs/live-region/index.js +1 -0
- package/dist/cjs/live-region/index.js.map +2 -2
- package/dist/cjs/live-region/propTypes.js.map +2 -2
- package/dist/cjs/live-region/typescript-testing/typescript-live-region-valid.js +59 -0
- package/dist/cjs/live-region/typescript-testing/typescript-live-region-valid.js.map +7 -0
- package/dist/cjs/live-region/useLiveRegion.js.map +2 -2
- package/dist/cjs/skip-to/index.js.map +1 -1
- package/dist/cjs/skip-to/typescript-testing/typescript-skip-to-valid.js +45 -0
- package/dist/cjs/skip-to/typescript-testing/typescript-skip-to-valid.js.map +7 -0
- package/dist/esm/live-region/index.js +1 -0
- package/dist/esm/live-region/index.js.map +2 -2
- package/dist/esm/live-region/propTypes.js.map +2 -2
- package/dist/esm/live-region/typescript-testing/typescript-live-region-valid.js +36 -0
- package/dist/esm/live-region/typescript-testing/typescript-live-region-valid.js.map +7 -0
- package/dist/esm/live-region/useLiveRegion.js.map +2 -2
- package/dist/esm/skip-to/index.js.map +1 -1
- package/dist/esm/skip-to/typescript-testing/typescript-skip-to-valid.js +22 -0
- package/dist/esm/skip-to/typescript-testing/typescript-skip-to-valid.js.map +7 -0
- package/dist/types/live-region/index.d.ts +1 -0
- package/dist/types/live-region/propTypes.d.ts +2 -1
- package/dist/types/live-region/typescript-testing/typescript-live-region-valid.d.ts +1 -0
- package/dist/types/skip-to/index.d.ts +1 -0
- package/dist/types/skip-to/typescript-testing/typescript-skip-to-valid.d.ts +1 -0
- package/package.json +5 -5
@@ -27,4 +27,5 @@ var live_region_exports = {};
|
|
27
27
|
module.exports = __toCommonJS(live_region_exports);
|
28
28
|
var React = __toESM(require("react"));
|
29
29
|
__reExport(live_region_exports, require("./useLiveRegion.js"), module.exports);
|
30
|
+
var import_propTypes = require("./propTypes.js");
|
30
31
|
//# 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 './useLiveRegion.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,+BAAd;",
|
4
|
+
"sourcesContent": ["export * from './useLiveRegion.js';\nexport { type DSLiveRegionT } from './propTypes.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;ADAvB,gCAAc,+BAAd;AACA,uBAAmC;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -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-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'?:
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA0B;
|
4
|
+
"sourcesContent": ["import { PropTypes } from '@elliemae/ds-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 type AriaLiveT = 'polite' | 'off' | 'assertive';\n\n export interface Props {\n id?: string;\n portal?: MutableRefObject<HTMLElement>;\n role?: string;\n 'aria-live'?: AriaLiveT;\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", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA0B;AAsBnB,MAAM,yBAAyB;AAAA,EACpC,IAAI,kCAAU,OAAO,YAAY,uBAAuB;AAAA,EACxD,QAAQ,kCAAU,OAAO,YAAY,kCAAkC;AACzE;AAEO,MAAM,wBAAwB;AAAA,EACnC,IAAI,kCAAU,OAAO,YAAY,uBAAuB;AAAA,EACxD,QAAQ,kCAAU,OAAO,YAAY,kCAAkC;AAAA,EACvE,MAAM,kCAAU,OAAO,YAAY,yBAAyB;AAAA,EAC5D,aAAa,kCAAU,OAAO,YAAY,qBAAqB;AAAA,EAC/D,SAAS,kCAAU,OAAO,YAAY,iCAAiC;AACzE;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -0,0 +1,59 @@
|
|
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 __copyProps = (to, from, except, desc) => {
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
10
|
+
for (let key of __getOwnPropNames(from))
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
}
|
14
|
+
return to;
|
15
|
+
};
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
+
mod
|
23
|
+
));
|
24
|
+
var React = __toESM(require("react"));
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
26
|
+
var import_react = require("react");
|
27
|
+
var import__ = require("../index.js");
|
28
|
+
const ref = (0, import_react.createRef)();
|
29
|
+
const methods = (0, import_react.createRef)();
|
30
|
+
const testExplicitDefinition = {
|
31
|
+
id: "live-region-id",
|
32
|
+
portal: ref,
|
33
|
+
role: "alert",
|
34
|
+
"aria-live": "assertive",
|
35
|
+
methods
|
36
|
+
};
|
37
|
+
const testInferedTypeCompatibility = {
|
38
|
+
id: "live-region-id",
|
39
|
+
portal: ref,
|
40
|
+
role: "alert",
|
41
|
+
"aria-live": "assertive",
|
42
|
+
methods
|
43
|
+
};
|
44
|
+
const testDefinitionAsConst = {
|
45
|
+
id: "live-region-id",
|
46
|
+
portal: ref,
|
47
|
+
role: "alert",
|
48
|
+
"aria-live": "assertive",
|
49
|
+
methods
|
50
|
+
};
|
51
|
+
const ExampleUsageComponent = () => {
|
52
|
+
const { read, LiveRegion } = (0, import__.useLiveRegion)({});
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveRegion, { ...testExplicitDefinition }),
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveRegion, { ...testInferedTypeCompatibility }),
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveRegion, { ...testDefinitionAsConst })
|
57
|
+
] });
|
58
|
+
};
|
59
|
+
//# sourceMappingURL=typescript-live-region-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/live-region/typescript-testing/typescript-live-region-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport type { MutableRefObject } from 'react';\nimport { createRef } from 'react';\nimport { useLiveRegion } from '../index.js';\nimport type { DSLiveRegionT, Props } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSLiveRegionT.Props;\n\nconst ref = createRef() as MutableRefObject<HTMLElement>;\nconst methods = createRef() as DSLiveRegionT.Props['methods'];\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n id: 'live-region-id',\n portal: ref,\n role: 'alert',\n 'aria-live': 'assertive',\n methods: methods,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n id: 'live-region-id',\n portal: ref,\n role: 'alert',\n 'aria-live': 'assertive',\n methods: methods,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n id: 'live-region-id',\n portal: ref,\n role: 'alert',\n 'aria-live': 'assertive',\n methods: methods,\n} as const;\n\nconst ExampleUsageComponent = () => {\n const { read, LiveRegion } = useLiveRegion({});\n return (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <LiveRegion {...testExplicitDefinition} />\n <LiveRegion {...testInferedTypeCompatibility} />\n <LiveRegion {...testDefinitionAsConst} />\n </>\n );\n};\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACyCnB;AAvCJ,mBAA0B;AAC1B,eAA8B;AAM9B,MAAM,UAAM,wBAAU;AACtB,MAAM,cAAU,wBAAU;AAG1B,MAAM,yBAA+C;AAAA,EACnD,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AACF;AAGA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AACF;AAEA,MAAM,wBAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AACF;AAEA,MAAM,wBAAwB,MAAM;AAClC,QAAM,EAAE,MAAM,WAAW,QAAI,wBAAc,CAAC,CAAC;AAC7C,SACE,4EAEE;AAAA,gDAAC,cAAY,GAAG,wBAAwB;AAAA,IACxC,4CAAC,cAAY,GAAG,8BAA8B;AAAA,IAC9C,4CAAC,cAAY,GAAG,uBAAuB;AAAA,KACzC;AAEJ;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/live-region/useLiveRegion.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["/* 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-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", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0EnB;AAzEJ,uBAAqB;AACrB,mBAA+E;AAC/E,8BAAyB;AACzB,iBAAoB;AACpB,oBAAgC;AAChC,uBAAuC;AAiBvC,MAAM,mBAAe,mBAAK,CAAC,UAAqC;AAC9D,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAiB,EAAE;AAEjE,QAAM,CAAC,6BAA6B,8BAA8B,QAAI,uBAAS,KAAK;AACpF,QAAM,CAAC,MAAM,OAAO,QAAI,uBAA6B,MAAS;AAC9D,QAAM,CAAC,UAAU,WAAW,QAAI,
|
4
|
+
"sourcesContent": ["/* 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-props-helpers';\nimport { uid } from 'uid';\nimport { StyledContainer } from './styles.js';\nimport { UseLiveRegionPropTypes } from './propTypes.js';\nimport type { DSLiveRegionT, 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<DSLiveRegionT.AriaLiveT>('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", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0EnB;AAzEJ,uBAAqB;AACrB,mBAA+E;AAC/E,8BAAyB;AACzB,iBAAoB;AACpB,oBAAgC;AAChC,uBAAuC;AAiBvC,MAAM,mBAAe,mBAAK,CAAC,UAAqC;AAC9D,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAiB,EAAE;AAEjE,QAAM,CAAC,6BAA6B,8BAA8B,QAAI,uBAAS,KAAK;AACpF,QAAM,CAAC,MAAM,OAAO,QAAI,uBAA6B,MAAS;AAC9D,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAkC,QAAQ;AAC1E,QAAM,EAAE,IAAI,OAAO,IAAI,SAAS,CAAC;AAEjC,QAAM,YAAQ,0BAAY,MAAM;AAC9B,uBAAmB,EAAE;AACrB,mCAA+B,KAAK;AACpC,gBAAY,QAAQ;AACpB,YAAQ,MAAS;AAAA,EACnB,GAAG,CAAC,CAAC;AAEL,QAAM,gBAAY;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,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,iBAAAA,QAAS;AAAA,IACd,4CAAC,iCAAgB,eAAW,MAAC,IAAQ,MAAY,aAAW,UACzD,2BACH;AAAA,IACA,QAAQ,WAAW,SAAS;AAAA,EAC9B;AACF,CAAC;AAED,MAAM,gBAAgB,CAAC,UAAgC;AACrD,QAAM,cAAU,qBAAgB,CAAC,CAAC;AAElC,QAAM,EAAE,IAAI,OAAO,IAAI,SAAS,CAAC;AAEjC,QAAM,kBAAc,sBAAQ,MAAM,sBAAkB,gBAAI,CAAC,KAAK,CAAC,CAAC;AAEhE,QAAM,WAAO,0BAAY,CAAC,SAAiB,YAAqB,QAAQ,QAAQ,OAAO,SAAS,OAAO,GAAG,CAAC,CAAC;AAE5G,aAAO;AAAA,IACL,OAAO;AAAA,MACL,YAAY,MAAM,4CAAC,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,8BAA0B,kCAAS,aAAa;AACtD,wBAAwB,YAAY;",
|
6
6
|
"names": ["ReactDOM"]
|
7
7
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/skip-to/index.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["export { DSSkipTo, DSSkipToWithSchema } from './DSSkipTo.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
4
|
+
"sourcesContent": ["export { DSSkipTo, DSSkipToWithSchema } from './DSSkipTo.js';\nexport type { DSSkipToPropsT } from './index.d.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,sBAA6C;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -0,0 +1,45 @@
|
|
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 __copyProps = (to, from, except, desc) => {
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
10
|
+
for (let key of __getOwnPropNames(from))
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
}
|
14
|
+
return to;
|
15
|
+
};
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
+
mod
|
23
|
+
));
|
24
|
+
var React = __toESM(require("react"));
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
26
|
+
var import__ = require("../index.js");
|
27
|
+
const testExplicitDefinition = {
|
28
|
+
goTo: "my-main-content-id",
|
29
|
+
message: "My custom message"
|
30
|
+
};
|
31
|
+
const testInferedTypeCompatibility = {
|
32
|
+
goTo: "my-main-content-id",
|
33
|
+
message: "My custom message"
|
34
|
+
};
|
35
|
+
const testDefinitionAsConst = {
|
36
|
+
goTo: "my-main-content-id",
|
37
|
+
message: "My custom message"
|
38
|
+
};
|
39
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSSkipTo, { ...testExplicitDefinition }),
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSSkipTo, { ...testInferedTypeCompatibility }),
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSSkipTo, { ...testDefinitionAsConst }),
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSSkipTo, { goTo: "my-main-content-id", message: "My custom message" })
|
44
|
+
] });
|
45
|
+
//# sourceMappingURL=typescript-skip-to-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/skip-to/typescript-testing/typescript-skip-to-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSSkipTo } from '../index.js';\nimport type { DSSkipToPropsT as Props } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = Props;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n goTo: 'my-main-content-id',\n message: 'My custom message',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n goTo: 'my-main-content-id',\n message: 'My custom message',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n goTo: 'my-main-content-id',\n message: 'My custom message',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSSkipTo {...testExplicitDefinition} />\n <DSSkipTo {...testInferedTypeCompatibility} />\n <DSSkipTo {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSSkipTo goTo=\"my-main-content-id\" message=\"My custom message\" />\n </>\n);\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACyBrB;AAxBF,eAAyB;AAOzB,MAAM,yBAA+C;AAAA,EACnD,MAAM;AAAA,EACN,SAAS;AACX;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM;AAAA,EACN,SAAS;AACX;AAEA,MAAM,wBAAwB;AAAA,EAC5B,MAAM;AAAA,EACN,SAAS;AACX;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,qBAAU,GAAG,wBAAwB;AAAA,EACtC,4CAAC,qBAAU,GAAG,8BAA8B;AAAA,EAC5C,4CAAC,qBAAU,GAAG,uBAAuB;AAAA,EAErC,4CAAC,qBAAS,MAAK,sBAAqB,SAAQ,qBAAoB;AAAA,GAClE;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -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 './useLiveRegion.js';\n"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;",
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './useLiveRegion.js';\nexport { type DSLiveRegionT } from './propTypes.js';\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,eAAmC;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -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-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'?:
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from '@elliemae/ds-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 type AriaLiveT = 'polite' | 'off' | 'assertive';\n\n export interface Props {\n id?: string;\n portal?: MutableRefObject<HTMLElement>;\n role?: string;\n 'aria-live'?: AriaLiveT;\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;AAsBnB,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
6
|
"names": []
|
7
7
|
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import { createRef } from "react";
|
4
|
+
import { useLiveRegion } from "../index.js";
|
5
|
+
const ref = createRef();
|
6
|
+
const methods = createRef();
|
7
|
+
const testExplicitDefinition = {
|
8
|
+
id: "live-region-id",
|
9
|
+
portal: ref,
|
10
|
+
role: "alert",
|
11
|
+
"aria-live": "assertive",
|
12
|
+
methods
|
13
|
+
};
|
14
|
+
const testInferedTypeCompatibility = {
|
15
|
+
id: "live-region-id",
|
16
|
+
portal: ref,
|
17
|
+
role: "alert",
|
18
|
+
"aria-live": "assertive",
|
19
|
+
methods
|
20
|
+
};
|
21
|
+
const testDefinitionAsConst = {
|
22
|
+
id: "live-region-id",
|
23
|
+
portal: ref,
|
24
|
+
role: "alert",
|
25
|
+
"aria-live": "assertive",
|
26
|
+
methods
|
27
|
+
};
|
28
|
+
const ExampleUsageComponent = () => {
|
29
|
+
const { read, LiveRegion } = useLiveRegion({});
|
30
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
31
|
+
/* @__PURE__ */ jsx(LiveRegion, { ...testExplicitDefinition }),
|
32
|
+
/* @__PURE__ */ jsx(LiveRegion, { ...testInferedTypeCompatibility }),
|
33
|
+
/* @__PURE__ */ jsx(LiveRegion, { ...testDefinitionAsConst })
|
34
|
+
] });
|
35
|
+
};
|
36
|
+
//# sourceMappingURL=typescript-live-region-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/live-region/typescript-testing/typescript-live-region-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport type { MutableRefObject } from 'react';\nimport { createRef } from 'react';\nimport { useLiveRegion } from '../index.js';\nimport type { DSLiveRegionT, Props } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSLiveRegionT.Props;\n\nconst ref = createRef() as MutableRefObject<HTMLElement>;\nconst methods = createRef() as DSLiveRegionT.Props['methods'];\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n id: 'live-region-id',\n portal: ref,\n role: 'alert',\n 'aria-live': 'assertive',\n methods: methods,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n id: 'live-region-id',\n portal: ref,\n role: 'alert',\n 'aria-live': 'assertive',\n methods: methods,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n id: 'live-region-id',\n portal: ref,\n role: 'alert',\n 'aria-live': 'assertive',\n methods: methods,\n} as const;\n\nconst ExampleUsageComponent = () => {\n const { read, LiveRegion } = useLiveRegion({});\n return (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <LiveRegion {...testExplicitDefinition} />\n <LiveRegion {...testInferedTypeCompatibility} />\n <LiveRegion {...testDefinitionAsConst} />\n </>\n );\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACyCnB,mBAEE,KAFF;AAvCJ,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAM9B,MAAM,MAAM,UAAU;AACtB,MAAM,UAAU,UAAU;AAG1B,MAAM,yBAA+C;AAAA,EACnD,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AACF;AAGA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AACF;AAEA,MAAM,wBAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AACF;AAEA,MAAM,wBAAwB,MAAM;AAClC,QAAM,EAAE,MAAM,WAAW,IAAI,cAAc,CAAC,CAAC;AAC7C,SACE,iCAEE;AAAA,wBAAC,cAAY,GAAG,wBAAwB;AAAA,IACxC,oBAAC,cAAY,GAAG,8BAA8B;AAAA,IAC9C,oBAAC,cAAY,GAAG,uBAAuB;AAAA,KACzC;AAEJ;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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-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,
|
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-props-helpers';\nimport { uid } from 'uid';\nimport { StyledContainer } from './styles.js';\nimport { UseLiveRegionPropTypes } from './propTypes.js';\nimport type { DSLiveRegionT, 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<DSLiveRegionT.AriaLiveT>('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,SAAkC,QAAQ;AAC1E,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
6
|
"names": []
|
7
7
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
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"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSSkipTo, DSSkipToWithSchema } from './DSSkipTo.js';\nexport type { DSSkipToPropsT } from './index.d.js';\n"],
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAAU,0BAA0B;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import { DSSkipTo } from "../index.js";
|
4
|
+
const testExplicitDefinition = {
|
5
|
+
goTo: "my-main-content-id",
|
6
|
+
message: "My custom message"
|
7
|
+
};
|
8
|
+
const testInferedTypeCompatibility = {
|
9
|
+
goTo: "my-main-content-id",
|
10
|
+
message: "My custom message"
|
11
|
+
};
|
12
|
+
const testDefinitionAsConst = {
|
13
|
+
goTo: "my-main-content-id",
|
14
|
+
message: "My custom message"
|
15
|
+
};
|
16
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
17
|
+
/* @__PURE__ */ jsx(DSSkipTo, { ...testExplicitDefinition }),
|
18
|
+
/* @__PURE__ */ jsx(DSSkipTo, { ...testInferedTypeCompatibility }),
|
19
|
+
/* @__PURE__ */ jsx(DSSkipTo, { ...testDefinitionAsConst }),
|
20
|
+
/* @__PURE__ */ jsx(DSSkipTo, { goTo: "my-main-content-id", message: "My custom message" })
|
21
|
+
] });
|
22
|
+
//# sourceMappingURL=typescript-skip-to-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/skip-to/typescript-testing/typescript-skip-to-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSSkipTo } from '../index.js';\nimport type { DSSkipToPropsT as Props } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = Props;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n goTo: 'my-main-content-id',\n message: 'My custom message',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n goTo: 'my-main-content-id',\n message: 'My custom message',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n goTo: 'my-main-content-id',\n message: 'My custom message',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSSkipTo {...testExplicitDefinition} />\n <DSSkipTo {...testInferedTypeCompatibility} />\n <DSSkipTo {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSSkipTo goTo=\"my-main-content-id\" message=\"My custom message\" />\n </>\n);\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACyBrB,mBAEE,KAFF;AAxBF,SAAS,gBAAgB;AAOzB,MAAM,yBAA+C;AAAA,EACnD,MAAM;AAAA,EACN,SAAS;AACX;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM;AAAA,EACN,SAAS;AACX;AAEA,MAAM,wBAAwB;AAAA,EAC5B,MAAM;AAAA,EACN,SAAS;AACX;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,YAAU,GAAG,wBAAwB;AAAA,EACtC,oBAAC,YAAU,GAAG,8BAA8B;AAAA,EAC5C,oBAAC,YAAU,GAAG,uBAAuB;AAAA,EAErC,oBAAC,YAAS,MAAK,sBAAqB,SAAQ,qBAAoB;AAAA,GAClE;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -6,11 +6,12 @@ export declare namespace UseLiveRegionT {
|
|
6
6
|
}
|
7
7
|
}
|
8
8
|
export declare namespace DSLiveRegionT {
|
9
|
+
type AriaLiveT = 'polite' | 'off' | 'assertive';
|
9
10
|
interface Props {
|
10
11
|
id?: string;
|
11
12
|
portal?: MutableRefObject<HTMLElement>;
|
12
13
|
role?: string;
|
13
|
-
'aria-live'?:
|
14
|
+
'aria-live'?: AriaLiveT;
|
14
15
|
methods?: MutableRefObject<{
|
15
16
|
read?: Dispatch<SetStateAction<string>>;
|
16
17
|
}>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-accessibility",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.29.0-next.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Accessibility",
|
6
6
|
"files": [
|
@@ -52,13 +52,13 @@
|
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
54
|
"uid": "~2.0.1",
|
55
|
-
"@elliemae/ds-props-helpers": "3.
|
56
|
-
"@elliemae/ds-system": "3.
|
55
|
+
"@elliemae/ds-props-helpers": "3.29.0-next.0",
|
56
|
+
"@elliemae/ds-system": "3.29.0-next.0"
|
57
57
|
},
|
58
58
|
"devDependencies": {
|
59
59
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
60
60
|
"styled-components": "~5.3.9",
|
61
|
-
"@elliemae/ds-monorepo-devops": "3.
|
61
|
+
"@elliemae/ds-monorepo-devops": "3.29.0-next.0"
|
62
62
|
},
|
63
63
|
"peerDependencies": {
|
64
64
|
"react": "^17.0.2",
|
@@ -67,7 +67,7 @@
|
|
67
67
|
},
|
68
68
|
"publishConfig": {
|
69
69
|
"access": "public",
|
70
|
-
"typeSafety":
|
70
|
+
"typeSafety": true
|
71
71
|
},
|
72
72
|
"scripts": {
|
73
73
|
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|