@elliemae/ds-accessibility 3.12.0-rc.2 → 3.12.0-rc.21
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/DSLiveRegion.js +1 -7
- package/dist/cjs/live-region/DSLiveRegion.js.map +1 -1
- package/dist/cjs/live-region/useLiveRegion.js +2 -12
- package/dist/cjs/live-region/useLiveRegion.js.map +1 -1
- package/dist/cjs/skip-to/DSSkipTo.js +1 -4
- package/dist/cjs/skip-to/DSSkipTo.js.map +1 -1
- package/dist/esm/live-region/DSLiveRegion.js +1 -7
- package/dist/esm/live-region/DSLiveRegion.js.map +1 -1
- package/dist/esm/live-region/useLiveRegion.js +2 -12
- package/dist/esm/live-region/useLiveRegion.js.map +1 -1
- package/dist/esm/skip-to/DSSkipTo.js +1 -4
- package/dist/esm/skip-to/DSSkipTo.js.map +1 -1
- package/package.json +4 -4
@@ -45,13 +45,7 @@ const DSLiveRegion = (0, import_react.memo)((props) => {
|
|
45
45
|
if (text === "")
|
46
46
|
return null;
|
47
47
|
return import_react_dom.default.createPortal(
|
48
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, {
|
49
|
-
"aria-atomic": true,
|
50
|
-
id: props.id,
|
51
|
-
role: props.role,
|
52
|
-
"aria-live": props["aria-live"] || "polite",
|
53
|
-
children: text
|
54
|
-
}),
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, { "aria-atomic": true, id: props.id, role: props.role, "aria-live": props["aria-live"] || "polite", children: text }),
|
55
49
|
props.portal?.current || document.body
|
56
50
|
);
|
57
51
|
});
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/live-region/DSLiveRegion.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
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;ADmBnB;AAnBJ,uBAAqB;AACrB,mBAAiD;AACjD,0BAAyB;AACzB,oBAAgC;AAChC,uBAA0B;AAG1B,MAAM,mBAAe,mBAAK,CAAC,UAAmD;AAC5E,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,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,iBAAAA,QAAS;AAAA,IACd,4CAAC
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBnB;AAnBJ,uBAAqB;AACrB,mBAAiD;AACjD,0BAAyB;AACzB,oBAAgC;AAChC,uBAA0B;AAG1B,MAAM,mBAAe,mBAAK,CAAC,UAAmD;AAC5E,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,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,iBAAAA,QAAS;AAAA,IACd,4CAAC,iCAAgB,eAAW,MAAC,IAAI,MAAM,IAAI,MAAM,MAAM,MAAM,aAAW,MAAM,gBAAgB,UAC3F,gBACH;AAAA,IACA,MAAM,QAAQ,WAAW,SAAS;AAAA,EACpC;AACF,CAAC;AAED,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,6BAAyB,8BAAS,YAAY;AACpD,uBAAuB,YAAY;",
|
6
6
|
"names": ["ReactDOM"]
|
7
7
|
}
|
@@ -81,13 +81,7 @@ const DSLiveRegion = (0, import_react.memo)((props) => {
|
|
81
81
|
if (unsafe_emulateAssertiveNVDA)
|
82
82
|
return null;
|
83
83
|
return import_react_dom.default.createPortal(
|
84
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, {
|
85
|
-
"aria-atomic": true,
|
86
|
-
id,
|
87
|
-
role,
|
88
|
-
"aria-live": ariaLive,
|
89
|
-
children: internalMessage
|
90
|
-
}),
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, { "aria-atomic": true, id, role, "aria-live": ariaLive, children: internalMessage }),
|
91
85
|
portal?.current || document.body
|
92
86
|
);
|
93
87
|
});
|
@@ -98,11 +92,7 @@ const useLiveRegion = (props) => {
|
|
98
92
|
const read = (0, import_react.useCallback)((message, options) => methods.current.read?.(message, options), []);
|
99
93
|
return (0, import_react.useMemo)(
|
100
94
|
() => ({
|
101
|
-
LiveRegion: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DSLiveRegion, {
|
102
|
-
methods,
|
103
|
-
id: instanceUID || id,
|
104
|
-
portal
|
105
|
-
}),
|
95
|
+
LiveRegion: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DSLiveRegion, { methods, id: instanceUID || id, portal }),
|
106
96
|
read
|
107
97
|
}),
|
108
98
|
[id, instanceUID, portal, read]
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/live-region/useLiveRegion.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
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-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 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 setInternalMessage(message);\n }, options?.delay);\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={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;ADuEnB;AAtEJ,uBAAqB;AACrB,mBAA+E;AAC/E,0BAAyB;AACzB,iBAAoB;AACpB,oBAAgC;AAChC,uBAA0B;AAiB1B,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;AA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M,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,eAAe,IAAI,QAAgB;AAAA,MACzF;AAAA,IACF;AAAA,IACA,CAAC,IAAI,aAAa,QAAQ,IAAI;AAAA,EAChC;AACF;AAEA,cAAc,cAAc;AAC5B,MAAM,8BAA0B,8BAAS,aAAa;AACtD,wBAAwB,YAAY;",
|
6
6
|
"names": ["ReactDOM"]
|
7
7
|
}
|
@@ -39,10 +39,7 @@ const DSSkipTo = (props) => {
|
|
39
39
|
const handleOnClick = (0, import_react.useCallback)(() => {
|
40
40
|
document.getElementById(goTo).focus();
|
41
41
|
}, [goTo]);
|
42
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledButton, {
|
43
|
-
onClick: handleOnClick,
|
44
|
-
children: message
|
45
|
-
});
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledButton, { onClick: handleOnClick, children: message });
|
46
43
|
};
|
47
44
|
DSSkipTo.propTypes = import_propTypes.propTypes;
|
48
45
|
DSSkipTo.displayName = "DSSkipTo";
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../src/skip-to/DSSkipTo.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
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;ADWd;AAXT,mBAAmC;AACnC,0BAAyB;AACzB,uBAA0B;AAE1B,oBAA6B;AAE7B,MAAM,WAAW,CAAC,UAA8B;AAC9C,QAAM,EAAE,MAAM,UAAU,uBAAuB,IAAI;AACnD,QAAM,oBAAgB,0BAAY,MAAM;AACtC,IAAC,SAAS,eAAe,IAAI,EAAkB,MAAM;AAAA,EACvD,GAAG,CAAC,IAAI,CAAC;AACT,SAAO,4CAAC
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWd;AAXT,mBAAmC;AACnC,0BAAyB;AACzB,uBAA0B;AAE1B,oBAA6B;AAE7B,MAAM,WAAW,CAAC,UAA8B;AAC9C,QAAM,EAAE,MAAM,UAAU,uBAAuB,IAAI;AACnD,QAAM,oBAAgB,0BAAY,MAAM;AACtC,IAAC,SAAS,eAAe,IAAI,EAAkB,MAAM;AAAA,EACvD,GAAG,CAAC,IAAI,CAAC;AACT,SAAO,4CAAC,8BAAa,SAAS,eAAgB,mBAAQ;AACxD;AAEA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,yBAAqB,8BAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -15,13 +15,7 @@ const DSLiveRegion = memo((props) => {
|
|
15
15
|
if (text === "")
|
16
16
|
return null;
|
17
17
|
return ReactDOM.createPortal(
|
18
|
-
/* @__PURE__ */ jsx(StyledContainer, {
|
19
|
-
"aria-atomic": true,
|
20
|
-
id: props.id,
|
21
|
-
role: props.role,
|
22
|
-
"aria-live": props["aria-live"] || "polite",
|
23
|
-
children: text
|
24
|
-
}),
|
18
|
+
/* @__PURE__ */ jsx(StyledContainer, { "aria-atomic": true, id: props.id, role: props.role, "aria-live": props["aria-live"] || "polite", children: text }),
|
25
19
|
props.portal?.current || document.body
|
26
20
|
);
|
27
21
|
});
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/live-region/DSLiveRegion.tsx"],
|
4
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,YAAY,WAAW;ACmBnB;AAnBJ,OAAO,cAAc;AACrB,SAAgB,MAAM,WAAW,gBAAgB;AACjD,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAG1B,MAAM,eAAe,KAAK,CAAC,UAAmD;AAC5E,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
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACmBnB;AAnBJ,OAAO,cAAc;AACrB,SAAgB,MAAM,WAAW,gBAAgB;AACjD,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAG1B,MAAM,eAAe,KAAK,CAAC,UAAmD;AAC5E,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,gBAAgB,UAC3F,gBACH;AAAA,IACA,MAAM,QAAQ,WAAW,SAAS;AAAA,EACpC;AACF,CAAC;AAED,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,yBAAyB,SAAS,YAAY;AACpD,uBAAuB,YAAY;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -51,13 +51,7 @@ const DSLiveRegion = memo((props) => {
|
|
51
51
|
if (unsafe_emulateAssertiveNVDA)
|
52
52
|
return null;
|
53
53
|
return ReactDOM.createPortal(
|
54
|
-
/* @__PURE__ */ jsx(StyledContainer, {
|
55
|
-
"aria-atomic": true,
|
56
|
-
id,
|
57
|
-
role,
|
58
|
-
"aria-live": ariaLive,
|
59
|
-
children: internalMessage
|
60
|
-
}),
|
54
|
+
/* @__PURE__ */ jsx(StyledContainer, { "aria-atomic": true, id, role, "aria-live": ariaLive, children: internalMessage }),
|
61
55
|
portal?.current || document.body
|
62
56
|
);
|
63
57
|
});
|
@@ -68,11 +62,7 @@ const useLiveRegion = (props) => {
|
|
68
62
|
const read = useCallback((message, options) => methods.current.read?.(message, options), []);
|
69
63
|
return useMemo(
|
70
64
|
() => ({
|
71
|
-
LiveRegion: () => /* @__PURE__ */ jsx(DSLiveRegion, {
|
72
|
-
methods,
|
73
|
-
id: instanceUID || id,
|
74
|
-
portal
|
75
|
-
}),
|
65
|
+
LiveRegion: () => /* @__PURE__ */ jsx(DSLiveRegion, { methods, id: instanceUID || id, portal }),
|
76
66
|
read
|
77
67
|
}),
|
78
68
|
[id, instanceUID, portal, read]
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/live-region/useLiveRegion.tsx"],
|
4
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-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 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 setInternalMessage(message);\n }, options?.delay);\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={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,YAAY,WAAW;ACuEnB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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,eAAe,IAAI,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
|
}
|
@@ -9,10 +9,7 @@ const DSSkipTo = (props) => {
|
|
9
9
|
const handleOnClick = useCallback(() => {
|
10
10
|
document.getElementById(goTo).focus();
|
11
11
|
}, [goTo]);
|
12
|
-
return /* @__PURE__ */ jsx(StyledButton, {
|
13
|
-
onClick: handleOnClick,
|
14
|
-
children: message
|
15
|
-
});
|
12
|
+
return /* @__PURE__ */ jsx(StyledButton, { onClick: handleOnClick, children: message });
|
16
13
|
};
|
17
14
|
DSSkipTo.propTypes = propTypes;
|
18
15
|
DSSkipTo.displayName = "DSSkipTo";
|
@@ -2,6 +2,6 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/skip-to/DSSkipTo.tsx"],
|
4
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
|
-
"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
|
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
6
|
"names": []
|
7
7
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-accessibility",
|
3
|
-
"version": "3.12.0-rc.
|
3
|
+
"version": "3.12.0-rc.21",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Accessibility",
|
6
6
|
"files": [
|
@@ -51,9 +51,9 @@
|
|
51
51
|
"indent": 4
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
|
-
"
|
55
|
-
"@elliemae/ds-
|
56
|
-
"
|
54
|
+
"uid": "~2.0.0",
|
55
|
+
"@elliemae/ds-system": "3.12.0-rc.21",
|
56
|
+
"@elliemae/ds-utilities": "3.12.0-rc.21"
|
57
57
|
},
|
58
58
|
"devDependencies": {
|
59
59
|
"styled-components": "~5.3.6"
|