se-design 1.0.81 → 1.0.83-dev.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/assets/style.css +1 -1
- package/dist/components/MessageBar/index.d.ts +20 -1
- package/dist/components/NLSearch/ClearAiFiltersBar.d.ts +21 -0
- package/dist/components/NLSearch/NLDynamicChip.d.ts +18 -0
- package/dist/components/NLSearch/NLSearchInput.d.ts +21 -0
- package/dist/components/NLSearch/index.d.ts +6 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +131 -124
- package/dist/index.js.map +1 -1
- package/dist/index100.js +1 -1
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +1 -1
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +1 -1
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +1 -1
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +1 -1
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +1 -1
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +1 -1
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +1 -1
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +1 -1
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +1 -1
- package/dist/index109.js.map +1 -1
- package/dist/index11.js +1 -1
- package/dist/index110.js +1 -1
- package/dist/index110.js.map +1 -1
- package/dist/index111.js +1 -1
- package/dist/index111.js.map +1 -1
- package/dist/index112.js +1 -1
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +2 -2
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +2 -2
- package/dist/index114.js.map +1 -1
- package/dist/index115.js +1 -1
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +2 -2
- package/dist/index116.js.map +1 -1
- package/dist/index117.js +2 -2
- package/dist/index117.js.map +1 -1
- package/dist/index118.js +2 -2
- package/dist/index118.js.map +1 -1
- package/dist/index119.js +2 -2
- package/dist/index119.js.map +1 -1
- package/dist/index12.js +3 -3
- package/dist/index120.js +1 -1
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +2 -2
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +2 -2
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +1 -1
- package/dist/index123.js.map +1 -1
- package/dist/index124.js +1 -1
- package/dist/index124.js.map +1 -1
- package/dist/index125.js +2 -2
- package/dist/index125.js.map +1 -1
- package/dist/index126.js +2 -2
- package/dist/index126.js.map +1 -1
- package/dist/index127.js +2 -2
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +2 -2
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +2 -2
- package/dist/index129.js.map +1 -1
- package/dist/index13.js +2 -2
- package/dist/index130.js +1 -1
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +1 -1
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +1 -1
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +2 -2
- package/dist/index133.js.map +1 -1
- package/dist/index134.js +1 -1
- package/dist/index134.js.map +1 -1
- package/dist/index135.js +2 -2
- package/dist/index135.js.map +1 -1
- package/dist/index136.js +2 -2
- package/dist/index136.js.map +1 -1
- package/dist/index137.js +1 -1
- package/dist/index137.js.map +1 -1
- package/dist/index138.js +2 -2
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +2 -2
- package/dist/index139.js.map +1 -1
- package/dist/index140.js +1 -1
- package/dist/index140.js.map +1 -1
- package/dist/index141.js +1 -1
- package/dist/index141.js.map +1 -1
- package/dist/index142.js +1 -1
- package/dist/index142.js.map +1 -1
- package/dist/index143.js +1 -1
- package/dist/index143.js.map +1 -1
- package/dist/index144.js +1 -1
- package/dist/index144.js.map +1 -1
- package/dist/index145.js +1 -1
- package/dist/index145.js.map +1 -1
- package/dist/index146.js +2 -2
- package/dist/index146.js.map +1 -1
- package/dist/index147.js +1 -1
- package/dist/index147.js.map +1 -1
- package/dist/index148.js +1 -1
- package/dist/index148.js.map +1 -1
- package/dist/index149.js +2 -2
- package/dist/index149.js.map +1 -1
- package/dist/index150.js +1 -1
- package/dist/index150.js.map +1 -1
- package/dist/index151.js +1 -1
- package/dist/index151.js.map +1 -1
- package/dist/index152.js +1 -1
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +1 -1
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +1 -1
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +2 -2
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +2 -2
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +1 -1
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +2 -2
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +1 -1
- package/dist/index159.js.map +1 -1
- package/dist/index16.js +3 -3
- package/dist/index160.js +1 -1
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +2 -2
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +2 -2
- package/dist/index162.js.map +1 -1
- package/dist/index163.js +1 -1
- package/dist/index163.js.map +1 -1
- package/dist/index164.js +1 -1
- package/dist/index164.js.map +1 -1
- package/dist/index165.js +1 -1
- package/dist/index165.js.map +1 -1
- package/dist/index166.js +1 -1
- package/dist/index166.js.map +1 -1
- package/dist/index167.js +1 -1
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +1 -1
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +1 -1
- package/dist/index169.js.map +1 -1
- package/dist/index170.js +1 -1
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +1 -1
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +1 -1
- package/dist/index172.js.map +1 -1
- package/dist/index173.js +1 -1
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +1 -1
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +1 -1
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +1 -1
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +1 -1
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +1 -1
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +1 -1
- package/dist/index179.js.map +1 -1
- package/dist/index18.js +2 -2
- package/dist/index180.js +1 -1
- package/dist/index180.js.map +1 -1
- package/dist/index181.js +1 -1
- package/dist/index181.js.map +1 -1
- package/dist/index182.js +1 -1
- package/dist/index182.js.map +1 -1
- package/dist/index183.js +1 -1
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +1 -1
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +2 -2
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +1 -1
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +1 -1
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +2 -2
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +2 -2
- package/dist/index189.js.map +1 -1
- package/dist/index19.js +5 -5
- package/dist/index190.js +1 -1
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +1 -1
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +2 -2
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +1 -1
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +1 -1
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +1 -1
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +1 -1
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +1 -1
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +1 -1
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +1 -1
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +2 -2
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +1 -1
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +2 -2
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +149 -2
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +9 -2
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +6 -2
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +5 -149
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +41 -4
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +24 -0
- package/dist/index208.js.map +1 -0
- package/dist/index215.js +26 -0
- package/dist/index215.js.map +1 -0
- package/dist/index216.js +71 -0
- package/dist/index216.js.map +1 -0
- package/dist/{index221.js → index224.js} +1 -1
- package/dist/{index221.js.map → index224.js.map} +1 -1
- package/dist/index23.js +4 -4
- package/dist/index232.js +1233 -43
- package/dist/index232.js.map +1 -1
- package/dist/index235.js +46 -0
- package/dist/index235.js.map +1 -0
- package/dist/index244.js +168 -8
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +3 -9
- package/dist/index245.js.map +1 -1
- package/dist/index247.js +18 -169
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +10 -11
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +8 -4
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +3 -3
- package/dist/index250.js +4 -5
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +168 -36
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +11 -2
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +5 -7
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +5 -326
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +36 -48
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +2 -2
- package/dist/index257.js +7 -75
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +308 -74
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +45 -47
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +2 -8
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +75 -4
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +89 -48
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +52 -2
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +8 -2
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +8 -0
- package/dist/index265.js.map +1 -0
- package/dist/index266.js +55 -0
- package/dist/index266.js.map +1 -0
- package/dist/index267.js +5 -0
- package/dist/index267.js.map +1 -0
- package/dist/index268.js +5 -0
- package/dist/index268.js.map +1 -0
- package/dist/index27.js +1 -1
- package/dist/index28.js +4 -4
- package/dist/index29.js +3 -3
- package/dist/index3.js +3 -3
- package/dist/index30.js +4 -4
- package/dist/index32.js +10 -11
- package/dist/index33.js +1 -1
- package/dist/index35.js +4 -4
- package/dist/index36.js +5 -5
- package/dist/index38.js +3 -3
- package/dist/index39.js +4 -4
- package/dist/index4.js +3 -3
- package/dist/index40.js +1 -1
- package/dist/index42.js +7 -8
- package/dist/index43.js +95 -57
- package/dist/index43.js.map +1 -1
- package/dist/index45.js +4 -4
- package/dist/index46.js +142 -193
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +21 -38
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +36 -33
- package/dist/index48.js.map +1 -1
- package/dist/index50.js +189 -78
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +36 -459
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +33 -98
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +151 -36
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +84 -36
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +456 -88
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +96 -161
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +35 -146
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +38 -33
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +89 -83
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +123 -123
- package/dist/index60.js +157 -113
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +143 -61
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +33 -152
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +80 -312
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +118 -45
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +62 -140
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +152 -12
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +316 -44
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +44 -82
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +143 -18
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +9 -10
- package/dist/index70.js +9 -63
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +45 -26
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +78 -102
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +18 -61
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +63 -18
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +27 -5
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +102 -48
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +58 -20
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +19 -7
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +5 -23
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +51 -16
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +23 -8
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +7 -40
- package/dist/index82.js.map +1 -1
- package/dist/index84.js +2 -68
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +2 -21
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +5 -0
- package/dist/index86.js.map +1 -0
- package/dist/index87.js +1 -1
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +2 -2
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +1 -1
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +5 -5
- package/dist/index90.js +2 -2
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +1 -1
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +1 -1
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +1 -1
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +1 -1
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +1 -1
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +1 -1
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +1 -1
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +1 -1
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +1 -1
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
- package/dist/index229.js +0 -1236
- package/dist/index229.js.map +0 -1
- package/dist/index241.js +0 -173
- package/dist/index241.js.map +0 -1
- package/dist/index242.js +0 -7
- package/dist/index242.js.map +0 -1
- package/dist/index246.js +0 -8
- package/dist/index246.js.map +0 -1
- package/dist/index49.js +0 -152
- package/dist/index49.js.map +0 -1
- package/dist/index83.js +0 -9
- package/dist/index83.js.map +0 -1
package/dist/index68.js
CHANGED
|
@@ -1,87 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
loop: h = !0,
|
|
11
|
-
disabled: x = !1,
|
|
12
|
-
optionSelector: b = '[role="option"]',
|
|
13
|
-
hasItems: c
|
|
14
|
-
}) {
|
|
15
|
-
const d = u(null), r = u(!1), i = u(!1), m = c !== void 0 ? c : l.length > 0, a = f(() => {
|
|
16
|
-
s(!1);
|
|
17
|
-
}, [s]);
|
|
18
|
-
P(() => {
|
|
19
|
-
t || (r.current = !1);
|
|
20
|
-
}, [t]);
|
|
21
|
-
const e = y({
|
|
22
|
-
items: l,
|
|
23
|
-
isOpen: t,
|
|
24
|
-
onSelect: g,
|
|
25
|
-
onClose: a,
|
|
26
|
-
onOpen: () => s(!0),
|
|
27
|
-
loop: h,
|
|
28
|
-
disabled: x,
|
|
29
|
-
listboxRef: d,
|
|
30
|
-
optionSelector: b
|
|
31
|
-
}), p = R({
|
|
32
|
-
onFocusOut: a,
|
|
33
|
-
onEscape: a,
|
|
34
|
-
disabled: !t
|
|
35
|
-
}), v = {
|
|
36
|
-
...p,
|
|
37
|
-
onBlurCapture: (o) => {
|
|
38
|
-
if (!r.current) {
|
|
39
|
-
if (i.current) {
|
|
40
|
-
i.current = !1;
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
p.onBlurCapture(o);
|
|
44
|
-
}
|
|
1
|
+
import N, { forwardRef as _ } from "react";
|
|
2
|
+
import { getA11yNameAttributes as k } from "./index82.js";
|
|
3
|
+
import "./index76.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function a() {
|
|
6
|
+
return a = Object.assign ? Object.assign.bind() : function(r) {
|
|
7
|
+
for (var n = 1; n < arguments.length; n++) {
|
|
8
|
+
var e = arguments[n];
|
|
9
|
+
for (var t in e) ({}).hasOwnProperty.call(e, t) && (r[t] = e[t]);
|
|
45
10
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"aria-expanded": t && m,
|
|
49
|
-
"aria-haspopup": "listbox",
|
|
50
|
-
"aria-controls": t ? n : void 0,
|
|
51
|
-
"aria-autocomplete": "list",
|
|
52
|
-
"aria-activedescendant": e.highlightedIndex >= 0 ? e.getOptionId(n, e.highlightedIndex) : void 0,
|
|
53
|
-
onKeyDown: (o) => {
|
|
54
|
-
o.key === "Tab" && (i.current = !0), e.handleKeyDown(o);
|
|
55
|
-
}
|
|
56
|
-
}, w = {
|
|
57
|
-
id: n,
|
|
58
|
-
role: "listbox",
|
|
59
|
-
ref: d,
|
|
60
|
-
onMouseDownCapture: (o) => {
|
|
61
|
-
r.current = !0;
|
|
62
|
-
},
|
|
63
|
-
onMouseUpCapture: (o) => {
|
|
64
|
-
r.current = !1;
|
|
65
|
-
},
|
|
66
|
-
onMouseLeave: (o) => {
|
|
67
|
-
r.current = !1;
|
|
68
|
-
}
|
|
69
|
-
}, C = f((o, D = !1) => ({
|
|
70
|
-
id: e.getOptionId(n, o),
|
|
71
|
-
role: "option",
|
|
72
|
-
"aria-selected": D
|
|
73
|
-
}), [e.getOptionId, n]);
|
|
74
|
-
return {
|
|
75
|
-
containerProps: v,
|
|
76
|
-
inputProps: I,
|
|
77
|
-
listboxProps: w,
|
|
78
|
-
getOptionProps: C,
|
|
79
|
-
highlightedIndex: e.highlightedIndex,
|
|
80
|
-
setHighlightedIndex: e.setHighlightedIndex,
|
|
81
|
-
getOptionId: e.getOptionId
|
|
82
|
-
};
|
|
11
|
+
return r;
|
|
12
|
+
}, a.apply(null, arguments);
|
|
83
13
|
}
|
|
14
|
+
const v = " (opens in a new tab)", y = /* @__PURE__ */ _(({
|
|
15
|
+
href: r,
|
|
16
|
+
label: n,
|
|
17
|
+
external: e = !1,
|
|
18
|
+
className: t = "",
|
|
19
|
+
automationId: c = "",
|
|
20
|
+
ariaLabel: o,
|
|
21
|
+
ariaLabelledBy: l,
|
|
22
|
+
ariaDescribedBy: m,
|
|
23
|
+
onClick: u,
|
|
24
|
+
target: s,
|
|
25
|
+
rel: i,
|
|
26
|
+
...f
|
|
27
|
+
}, p) => {
|
|
28
|
+
const d = e ? s ?? "_blank" : s, g = e ? i ?? "noopener noreferrer" : i, b = k({
|
|
29
|
+
// External link aria-label enhancement for screen readers:
|
|
30
|
+
// When external={true}, always append "(opens in a new tab)"
|
|
31
|
+
ariaLabel: e ? `${o ?? n}${v}` : o,
|
|
32
|
+
ariaLabelledBy: l,
|
|
33
|
+
ariaDescribedBy: m
|
|
34
|
+
}), A = ["se-design-link", "focus-outline", "focus-visible:underline", t].filter(Boolean).join(" ");
|
|
35
|
+
return /* @__PURE__ */ N.createElement("a", a({
|
|
36
|
+
ref: p,
|
|
37
|
+
href: r,
|
|
38
|
+
target: d,
|
|
39
|
+
rel: g,
|
|
40
|
+
className: A,
|
|
41
|
+
"data-automation-id": c,
|
|
42
|
+
onClick: u
|
|
43
|
+
}, f, b), n);
|
|
44
|
+
});
|
|
45
|
+
y.displayName = "Link";
|
|
84
46
|
export {
|
|
85
|
-
|
|
47
|
+
y as Link
|
|
86
48
|
};
|
|
87
49
|
//# sourceMappingURL=index68.js.map
|
package/dist/index68.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index68.js","sources":["../src/utils/a11y/useCombobox.ts"],"sourcesContent":["import { useRef, useCallback, useEffect } from 'react';\nimport type { RefObject } from 'react';\nimport { useComboboxNavigation } from './useComboboxNavigation';\nimport { useDismissOnFocusOut } from './useDismissOnFocusOut';\nimport type { UseDismissOnFocusOutReturn } from './useDismissOnFocusOut';\n\nexport interface UseComboboxOptions<T = any> {\n /**\n * Array of items to navigate through\n */\n items: T[];\n \n /**\n * Whether the dropdown is currently open\n */\n isOpen: boolean;\n \n /**\n * Callback to change the open state\n */\n onOpenChange: (open: boolean) => void;\n \n /**\n * Callback when an item is selected (Enter key)\n */\n onSelect: (item: T, index: number) => void;\n \n /**\n * Stable ID for the listbox element\n */\n listboxId: string;\n \n /**\n * Whether to wrap around at the ends of the list.\n * Default: true\n */\n loop?: boolean;\n \n /**\n * Whether keyboard navigation is disabled\n * (e.g., for custom rendered content)\n */\n disabled?: boolean;\n \n /**\n * CSS selector for option elements (default: '[role=\"option\"]')\n */\n optionSelector?: string;\n \n /**\n * Whether the listbox has any items to show\n * Used for aria-expanded logic\n * Default: items.length > 0\n */\n hasItems?: boolean;\n}\n\nexport interface UseComboboxReturn {\n /**\n * Props to spread on the container element (handles dismiss on focus out)\n */\n containerProps: UseDismissOnFocusOutReturn<HTMLElement>;\n \n /**\n * Props to spread on the combobox input element\n */\n inputProps: {\n role: 'combobox';\n 'aria-expanded': boolean;\n 'aria-haspopup': 'listbox';\n 'aria-controls': string | undefined;\n 'aria-autocomplete': 'list';\n 'aria-activedescendant': string | undefined;\n onKeyDown: (e: React.KeyboardEvent) => void;\n };\n \n /**\n * Props to spread on the listbox element\n */\n listboxProps: {\n id: string;\n role: 'listbox';\n ref: RefObject<HTMLDivElement | null>;\n onMouseDownCapture: (e: React.MouseEvent) => void;\n onMouseUpCapture: (e: React.MouseEvent) => void;\n onMouseLeave: (e: React.MouseEvent) => void;\n };\n \n /**\n * Generate props for an option element at the given index\n * @param selected - Whether this option is the currently selected/chosen value (not keyboard highlight)\n */\n getOptionProps: (index: number, selected?: boolean) => {\n id: string;\n role: 'option';\n 'aria-selected': boolean;\n };\n \n /**\n * Currently highlighted index (-1 if none)\n */\n highlightedIndex: number;\n \n /**\n * Set the highlighted index manually\n */\n setHighlightedIndex: (index: number | ((prev: number) => number)) => void;\n \n /**\n * Generate stable ID for an option\n */\n getOptionId: (listboxId: string, index: number) => string;\n}\n\n/**\n * Comprehensive hook for implementing WAI-ARIA combobox pattern.\n * \n * Combines:\n * - Keyboard navigation (Arrow Up/Down, Enter, Escape, Tab)\n * - Focus management and dismissal\n * - ARIA attributes for accessibility\n * - Auto-scroll highlighted item into view\n * \n * This hook provides a complete, batteries-included solution for building\n * accessible combobox components (autocomplete, select, search with suggestions, etc.)\n * \n * @example Basic usage\n * ```tsx\n * const MyCombobox = () => {\n * const [isOpen, setIsOpen] = useState(false);\n * const [items, setItems] = useState(['Apple', 'Banana', 'Cherry']);\n * \n * const {\n * containerProps,\n * inputProps,\n * listboxProps,\n * getOptionProps,\n * highlightedIndex\n * } = useCombobox({\n * items,\n * isOpen,\n * onOpenChange: setIsOpen,\n * onSelect: (item) => console.log('Selected:', item),\n * listboxId: 'my-listbox'\n * });\n * \n * return (\n * <div {...containerProps}>\n * <input {...inputProps} />\n * {isOpen && (\n * <div {...listboxProps}>\n * {items.map((item, i) => (\n * <div key={i} {...getOptionProps(i)}>\n * {item}\n * </div>\n * ))}\n * </div>\n * )}\n * </div>\n * );\n * };\n * ```\n * \n * @example With custom ARIA labels and handlers\n * ```tsx\n * const MySearchBox = () => {\n * const [query, setQuery] = useState('');\n * const [suggestions, setSuggestions] = useState([]);\n * const [isOpen, setIsOpen] = useState(false);\n * \n * const { containerProps, inputProps, listboxProps, getOptionProps } = useCombobox({\n * items: suggestions,\n * isOpen,\n * onOpenChange: setIsOpen,\n * onSelect: (suggestion) => {\n * setQuery(suggestion);\n * setIsOpen(false);\n * },\n * listboxId: 'search-suggestions'\n * });\n * \n * return (\n * <div {...containerProps}>\n * <input\n * {...inputProps}\n * value={query}\n * onChange={(e) => setQuery(e.target.value)}\n * aria-label=\"Search\"\n * />\n * {isOpen && suggestions.length > 0 && (\n * <div {...listboxProps} aria-label=\"Search suggestions\">\n * {suggestions.map((suggestion, i) => (\n * <div\n * key={i}\n * {...getOptionProps(i)}\n * onClick={() => {\n * setQuery(suggestion);\n * setIsOpen(false);\n * }}\n * >\n * {suggestion}\n * </div>\n * ))}\n * </div>\n * )}\n * </div>\n * );\n * };\n * ```\n */\nexport function useCombobox<T = any>({\n items,\n isOpen,\n onOpenChange,\n onSelect,\n listboxId,\n loop = true,\n disabled = false,\n optionSelector = '[role=\"option\"]',\n hasItems\n}: UseComboboxOptions<T>): UseComboboxReturn {\n const listboxRef = useRef<HTMLDivElement | null>(null);\n const pointerDownInListboxRef = useRef(false);\n const tabKeyPressedRef = useRef(false);\n \n // Determine if we should show as expanded\n const shouldShowExpanded = hasItems !== undefined ? hasItems : items.length > 0;\n \n // Close dropdown callback\n const closeDropdown = useCallback(() => {\n onOpenChange(false);\n }, [onOpenChange]);\n\n // Ensure pointer state doesn't get stuck when listbox unmounts\n useEffect(() => {\n if (!isOpen) {\n pointerDownInListboxRef.current = false;\n }\n }, [isOpen]);\n \n // Keyboard navigation with aria-activedescendant\n const navigation = useComboboxNavigation<T>({\n items,\n isOpen,\n onSelect,\n onClose: closeDropdown,\n onOpen: () => onOpenChange(true),\n loop,\n disabled,\n listboxRef,\n optionSelector\n });\n \n // Focus out / Escape dismissal\n const dismissHandlers = useDismissOnFocusOut({\n onFocusOut: closeDropdown,\n onEscape: closeDropdown,\n disabled: !isOpen\n });\n\n const containerProps: UseDismissOnFocusOutReturn<HTMLElement> = {\n ...dismissHandlers,\n onBlurCapture: (e) => {\n // Clicking inside a listbox option can blur the input (relatedTarget is null),\n // which would dismiss before the click handler runs. Prevent that.\n if (pointerDownInListboxRef.current) return;\n \n // Tab key pressed - let Tab handler close dropdown, skip blur detection\n if (tabKeyPressedRef.current) {\n tabKeyPressedRef.current = false;\n return;\n }\n \n dismissHandlers.onBlurCapture(e);\n }\n };\n \n // Build input props\n const inputProps = {\n role: 'combobox' as const,\n 'aria-expanded': isOpen && shouldShowExpanded,\n 'aria-haspopup': 'listbox' as const,\n 'aria-controls': isOpen ? listboxId : undefined,\n 'aria-autocomplete': 'list' as const,\n 'aria-activedescendant': \n navigation.highlightedIndex >= 0 \n ? navigation.getOptionId(listboxId, navigation.highlightedIndex) \n : undefined,\n onKeyDown: (e: React.KeyboardEvent) => {\n // Set flag when Tab is pressed (before blur fires)\n if (e.key === 'Tab') {\n tabKeyPressedRef.current = true;\n }\n navigation.handleKeyDown(e);\n }\n };\n \n // Build listbox props\n const listboxProps = {\n id: listboxId,\n role: 'listbox' as const,\n ref: listboxRef,\n onMouseDownCapture: (_e: React.MouseEvent) => {\n pointerDownInListboxRef.current = true;\n },\n onMouseUpCapture: (_e: React.MouseEvent) => {\n pointerDownInListboxRef.current = false;\n },\n onMouseLeave: (_e: React.MouseEvent) => {\n pointerDownInListboxRef.current = false;\n }\n };\n \n // Option props generator\n const getOptionProps = useCallback(\n (index: number, selected: boolean = false) => ({\n id: navigation.getOptionId(listboxId, index),\n role: 'option' as const,\n 'aria-selected': selected\n }),\n [navigation.getOptionId, listboxId]\n );\n \n return {\n containerProps,\n inputProps,\n listboxProps,\n getOptionProps,\n highlightedIndex: navigation.highlightedIndex,\n setHighlightedIndex: navigation.setHighlightedIndex,\n getOptionId: navigation.getOptionId\n };\n}\n"],"names":["useRef","useCallback","useEffect","useComboboxNavigation","useDismissOnFocusOut","useCombobox","items","isOpen","onOpenChange","onSelect","listboxId","loop","disabled","optionSelector","hasItems","listboxRef","pointerDownInListboxRef","tabKeyPressedRef","shouldShowExpanded","undefined","length","closeDropdown","current","navigation","onClose","onOpen","dismissHandlers","onFocusOut","onEscape","containerProps","onBlurCapture","e","inputProps","role","highlightedIndex","getOptionId","onKeyDown","key","handleKeyDown","listboxProps","id","ref","onMouseDownCapture","_e","onMouseUpCapture","onMouseLeave","getOptionProps","index","selected","setHighlightedIndex"],"mappings":"AAkNO,SAAA,UAAAA,GAAA,eA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C,CAAC;AAAA;AAAA,IACjC;AAAA,EAAA,GAIIC,IAAa;AAAA,IACjBC,MAAM;AAAA,IACN,iBAAiB1B,KAAUW;AAAAA,IAC3B,iBAAiB;AAAA,IACjB,iBAAiBX,IAASG,IAAYS;AAAAA,IACtC,qBAAqB;AAAA,IACrB,yBACEI,EAAWW,oBAAoB,IAC3BX,EAAWY,YAAYzB,GAAWa,EAAWW,gBAAgB,IAC7Df;AAAAA,IACNiB,WAAWA,CAACL,MAA2B;AAErC,MAAIA,EAAEM,QAAQ,UACZpB,EAAiBK,UAAU,KAE7BC,EAAWe,cAAcP,CAAC;AAAA,IAC5B;AAAA,EAAA,GAIIQ,IAAe;AAAA,IACnBC,IAAI9B;AAAAA,IACJuB,MAAM;AAAA,IACNQ,KAAK1B;AAAAA,IACL2B,oBAAoBA,CAACC,MAAyB;AAC5C3B,MAAAA,EAAwBM,UAAU;AAAA,IACpC;AAAA,IACAsB,kBAAkBA,CAACD,MAAyB;AAC1C3B,MAAAA,EAAwBM,UAAU;AAAA,IACpC;AAAA,IACAuB,cAAcA,CAACF,MAAyB;AACtC3B,MAAAA,EAAwBM,UAAU;AAAA,IACpC;AAAA,EAAA,GAIIwB,IAAiB7C,EACrB,CAAC8C,GAAeC,IAAoB,QAAW;AAAA,IAC7CR,IAAIjB,EAAWY,YAAYzB,GAAWqC,CAAK;AAAA,IAC3Cd,MAAM;AAAA,IACN,iBAAiBe;AAAAA,EAAAA,IAEnB,CAACzB,EAAWY,aAAazB,CAAS,CACpC;AAEA,SAAO;AAAA,IACLmB,gBAAAA;AAAAA,IACAG,YAAAA;AAAAA,IACAO,cAAAA;AAAAA,IACAO,gBAAAA;AAAAA,IACAZ,kBAAkBX,EAAWW;AAAAA,IAC7Be,qBAAqB1B,EAAW0B;AAAAA,IAChCd,aAAaZ,EAAWY;AAAAA,EAAAA;AAE5B;"}
|
|
1
|
+
{"version":3,"file":"index68.js","sources":["../src/components/Link/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { getA11yNameAttributes } from '../../utils/a11y';\nimport './style.scss';\n\n/**\n * Allows native anchor attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own href/onClick/aria-label/aria-labelledby/aria-describedby typing.\n */\ntype NativeAnchorProps = Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'href' | 'onClick' | 'target' | 'rel' | 'aria-label' | 'aria-labelledby' | 'aria-describedby'\n>;\n\nexport interface LinkProps extends NativeAnchorProps {\n /**\n * URL to navigate to (required for actual links)\n */\n href: string;\n /**\n * Link text content (string only)\n */\n label: string;\n /**\n * If true, automatically adds target=\"_blank\" and rel=\"noopener noreferrer\"\n * Also appends \" (opens in a new tab)\" to aria-label for screen readers\n */\n external?: boolean;\n /**\n * Accessible name for the link. Use when link text is generic or unclear.\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this link.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this link.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * Click handler (e.g., for analytics tracking)\n */\n onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * Override target (if you need something other than \"_blank\" for external links).\n * Note: If external={true} and target is provided, the provided target will be used.\n */\n target?: string;\n /**\n * Override rel (if you need something other than \"noopener noreferrer\" for external links).\n * Note: If external={true} and rel is provided, the provided rel will be used.\n */\n rel?: string;\n}\n\nconst EXTERNAL_LINK_ARIA_SUFFIX = ' (opens in a new tab)';\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n (\n {\n href,\n label,\n external = false,\n className = '',\n automationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n onClick,\n target,\n rel,\n ...props\n },\n ref\n ) => {\n // Handle external link attributes\n // If external={true}, default to target=\"_blank\" and rel=\"noopener noreferrer\"\n // Explicit target/rel props can override these defaults\n const targetAttr = external ? (target ?? '_blank') : target;\n const relAttr = external ? (rel ?? 'noopener noreferrer') : rel;\n\n // Compute accessible name/description props with correct precedence\n // Precedence: ariaLabelledBy > ariaLabel > visible text content\n const accessibleNameProps = getA11yNameAttributes({\n // External link aria-label enhancement for screen readers:\n // When external={true}, always append \"(opens in a new tab)\"\n ariaLabel:\n external ? `${ariaLabel ?? label}${EXTERNAL_LINK_ARIA_SUFFIX}` : ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n const linkClassName = ['se-design-link', 'focus-outline', 'focus-visible:underline', className]\n .filter(Boolean)\n .join(' ');\n\n return (\n <a\n ref={ref}\n href={href}\n target={targetAttr}\n rel={relAttr}\n className={linkClassName}\n data-automation-id={automationId}\n onClick={onClick}\n {...props}\n {...accessibleNameProps}\n >\n {label}\n </a>\n );\n }\n);\n\nLink.displayName = 'Link';\n"],"names":["EXTERNAL_LINK_ARIA_SUFFIX","Link","href","label","external","className","automationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","onClick","target","rel","props","ref","targetAttr","relAttr","accessibleNameProps","getA11yNameAttributes","linkClassName","filter","Boolean","join","React","createElement","_extends","displayName"],"mappings":";;;;;;;;;;;;;AAkEA,MAAMA,IAA4B,yBAErBC,sBACX,CACE;AAAA,EACEC,MAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,WAAAA,IAAY;AAAA,EACZC,cAAAA,IAAe;AAAA,EACfC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,QAAAA;AAAAA,EACAC,KAAAA;AAAAA,EACA,GAAGC;AACL,GACAC,MACG;AAIH,QAAMC,IAAaX,IAAYO,KAAU,WAAYA,GAC/CK,IAAUZ,IAAYQ,KAAO,wBAAyBA,GAItDK,IAAsBC,EAAsB;AAAA;AAAA;AAAA,IAGhDX,WACEH,IAAW,GAAGG,KAAaJ,CAAK,GAAGH,CAAyB,KAAKO;AAAAA,IACnEC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,EAAAA,CACD,GAEKU,IAAgB,CAAC,kBAAkB,iBAAiB,2BAA2Bd,CAAS,EAC3Fe,OAAOC,OAAO,EACdC,KAAK,GAAG;AAEX,SACEC,gBAAAA,EAAAC,cAAA,KAAAC,EAAA;AAAA,IACEX,KAAAA;AAAAA,IACAZ,MAAAA;AAAAA,IACAS,QAAQI;AAAAA,IACRH,KAAKI;AAAAA,IACLX,WAAWc;AAAAA,IACX,sBAAoBb;AAAAA,IACpBI,SAAAA;AAAAA,EAAAA,GACIG,GACAI,CAAmB,GAEtBd,CACA;AAEP,CACF;AAEAF,EAAKyB,cAAc;"}
|
package/dist/index69.js
CHANGED
|
@@ -1,22 +1,147 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import a from "react";
|
|
2
|
+
import { Button as f } from "./index4.js";
|
|
3
|
+
import { Badge as j } from "./index10.js";
|
|
4
|
+
import { Icon as q } from "./index6.js";
|
|
5
|
+
import { Link as N } from "./index68.js";
|
|
6
|
+
import { CustomModal as G } from "./index13.js";
|
|
7
|
+
import { useStableId as J } from "./index205.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
const K = {
|
|
10
|
+
lg: {
|
|
11
|
+
width: "768px",
|
|
12
|
+
height: "500px"
|
|
13
|
+
},
|
|
14
|
+
sm: {
|
|
15
|
+
width: "656px",
|
|
16
|
+
height: "384px"
|
|
17
|
+
}
|
|
18
|
+
}, ea = ({
|
|
19
|
+
isOpen: u,
|
|
20
|
+
onClose: n,
|
|
21
|
+
trigger: c,
|
|
22
|
+
modalWidth: b,
|
|
23
|
+
modalHeight: g,
|
|
24
|
+
variant: x,
|
|
25
|
+
size: t = "lg",
|
|
26
|
+
availabilityLabel: k = "Available on ",
|
|
27
|
+
availabilityBadgeText: r,
|
|
28
|
+
title: C,
|
|
29
|
+
description: v,
|
|
30
|
+
learnMoreLinkText: o,
|
|
31
|
+
learnMoreHref: l,
|
|
32
|
+
onLearnMoreClick: s,
|
|
33
|
+
featureListDesc: m,
|
|
34
|
+
featuresList: I = [],
|
|
35
|
+
featureItemIcon: L,
|
|
36
|
+
mediaContent: S,
|
|
37
|
+
laterButtonText: _,
|
|
38
|
+
purchaseButtonText: A,
|
|
39
|
+
onLaterClick: F,
|
|
40
|
+
onPurchaseClick: P,
|
|
41
|
+
className: $ = "",
|
|
42
|
+
modalContentClassName: D = "",
|
|
43
|
+
automationId: i = "",
|
|
44
|
+
id: z
|
|
45
|
+
}) => {
|
|
46
|
+
const p = J(z, "paywall-title"), B = () => {
|
|
47
|
+
F?.(), n();
|
|
48
|
+
}, d = K[t], O = b ?? d.width, w = g ?? d.height, y = x === "with-points" && t === "lg", h = I.map((e) => typeof e == "string" ? {
|
|
49
|
+
text: e
|
|
50
|
+
} : {
|
|
51
|
+
text: e.text,
|
|
52
|
+
icon: e.icon,
|
|
53
|
+
href: e.href,
|
|
54
|
+
external: e.external,
|
|
55
|
+
onLinkClick: e.onLinkClick
|
|
56
|
+
}), R = y && h.length > 0, W = L ?? /* @__PURE__ */ a.createElement(q, {
|
|
57
|
+
name: "info",
|
|
58
|
+
rotation: "180"
|
|
59
|
+
}), Y = /* @__PURE__ */ a.createElement("section", {
|
|
60
|
+
className: `paywall paywall-ctn paywall-ctn--${t} ${$}`,
|
|
61
|
+
"data-automation-id": i
|
|
62
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
63
|
+
className: "paywall-card"
|
|
64
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
65
|
+
className: "paywall-card-content"
|
|
66
|
+
}, r && /* @__PURE__ */ a.createElement("span", {
|
|
67
|
+
className: "paywall-card-availability"
|
|
68
|
+
}, /* @__PURE__ */ a.createElement("span", {
|
|
69
|
+
className: "paywall-card-availability-label"
|
|
70
|
+
}, k), /* @__PURE__ */ a.createElement(j, {
|
|
71
|
+
label: r,
|
|
72
|
+
className: "paywall-card-badge",
|
|
73
|
+
bgColor: "var(--color-yellow-100)",
|
|
74
|
+
textColor: "var(--color-yellow-700)"
|
|
75
|
+
})), /* @__PURE__ */ a.createElement("h3", {
|
|
76
|
+
id: p,
|
|
77
|
+
className: "paywall-card-title"
|
|
78
|
+
}, C), /* @__PURE__ */ a.createElement("p", {
|
|
79
|
+
className: "paywall-card-description"
|
|
80
|
+
}, v, o && (l || s) && /* @__PURE__ */ a.createElement(N, {
|
|
81
|
+
href: l ?? "#",
|
|
82
|
+
label: o,
|
|
83
|
+
external: !!l,
|
|
84
|
+
className: "paywall-card-learn-more",
|
|
85
|
+
onClick: (e) => {
|
|
86
|
+
l || e.preventDefault(), s?.(e);
|
|
11
87
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
88
|
+
})), y && m && /* @__PURE__ */ a.createElement("p", {
|
|
89
|
+
className: "paywall-card-features-intro"
|
|
90
|
+
}, m), R && /* @__PURE__ */ a.createElement("ul", {
|
|
91
|
+
className: "paywall-card-features-list"
|
|
92
|
+
}, h.map((e) => /* @__PURE__ */ a.createElement("li", {
|
|
93
|
+
key: e.text,
|
|
94
|
+
className: "paywall-card-feature-item"
|
|
95
|
+
}, /* @__PURE__ */ a.createElement("span", {
|
|
96
|
+
className: "paywall-card-feature-icon",
|
|
97
|
+
"aria-hidden": !0
|
|
98
|
+
}, e.icon ?? W), /* @__PURE__ */ a.createElement("span", null, e.href || e.onLinkClick ? /* @__PURE__ */ a.createElement(N, {
|
|
99
|
+
href: e.href ?? "#",
|
|
100
|
+
label: e.text,
|
|
101
|
+
external: e.external,
|
|
102
|
+
onClick: (E) => {
|
|
103
|
+
e.href || E.preventDefault(), e.onLinkClick?.(E);
|
|
104
|
+
}
|
|
105
|
+
}) : e.text)))), /* @__PURE__ */ a.createElement("div", {
|
|
106
|
+
className: "paywall-card-actions"
|
|
107
|
+
}, /* @__PURE__ */ a.createElement(f, {
|
|
108
|
+
type: "ghost",
|
|
109
|
+
size: "md",
|
|
110
|
+
label: _,
|
|
111
|
+
onClick: B,
|
|
112
|
+
className: "paywall-card-btn-later"
|
|
113
|
+
}), /* @__PURE__ */ a.createElement(f, {
|
|
114
|
+
type: "primary",
|
|
115
|
+
size: "md",
|
|
116
|
+
label: A,
|
|
117
|
+
onClick: P,
|
|
118
|
+
className: "paywall-card-btn-purchase"
|
|
119
|
+
}))), /* @__PURE__ */ a.createElement("div", {
|
|
120
|
+
className: "paywall-card-media"
|
|
121
|
+
}, S))), Z = /* @__PURE__ */ a.createElement("div", {
|
|
122
|
+
role: "dialog",
|
|
123
|
+
"aria-modal": "true",
|
|
124
|
+
"aria-labelledby": p,
|
|
125
|
+
className: `paywall-modal-content ${D}`,
|
|
126
|
+
style: {
|
|
127
|
+
height: w,
|
|
128
|
+
minHeight: w
|
|
129
|
+
}
|
|
130
|
+
}, Y);
|
|
131
|
+
return /* @__PURE__ */ a.createElement(a.Fragment, null, c && /* @__PURE__ */ a.createElement("span", {
|
|
132
|
+
className: "paywall-trigger"
|
|
133
|
+
}, c), /* @__PURE__ */ a.createElement(G, {
|
|
134
|
+
isOpen: u,
|
|
135
|
+
onClose: n,
|
|
136
|
+
onModalClick: () => {
|
|
137
|
+
},
|
|
138
|
+
renderModalContent: () => Z,
|
|
139
|
+
width: O,
|
|
140
|
+
contentClassName: "paywall-modal-content-wrapper",
|
|
141
|
+
automationId: i
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
19
144
|
export {
|
|
20
|
-
|
|
145
|
+
ea as Paywall
|
|
21
146
|
};
|
|
22
147
|
//# sourceMappingURL=index69.js.map
|
package/dist/index69.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index69.js","sources":["../src/utils/a11y/useFocusManagement.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { DependencyList } from 'react';\n\nexport interface UseFocusManagementOptions {\n /**\n * CSS selector to query the primary focus target.\n * Default: 'h1'\n */\n targetSelector?: string;\n /**\n * Fallback element id if selector target is not found.\n * Default: 'main-content'\n */\n fallbackId?: string;\n}\n\n/**\n * Generic focus management hook for route/state driven UI transitions.\n * Useful for both route changes and in-page multi-step wizards.\n * \n * Always skips first render and uses animation frame for safe DOM timing.\n */\nexport function useFocusManagement(\n dependencies: DependencyList,\n {\n targetSelector = '#main-content h1',\n fallbackId = 'main-content'\n }: UseFocusManagementOptions = {}\n): void {\n const isFirstRender = useRef(true);\n\n useEffect(() => {\n // Always skip first render\n if (isFirstRender.current) {\n isFirstRender.current = false;\n return;\n }\n\n const focusTarget = () => {\n const el = (document.querySelector(targetSelector) || document.getElementById(fallbackId)) as HTMLElement;\n if (el) {\n if (!el.hasAttribute('tabindex')) el.setAttribute('tabindex', '-1');\n el.focus();\n }\n };\n\n // Always use animation frame for safe DOM timing\n const rafId = requestAnimationFrame(focusTarget);\n return () => cancelAnimationFrame(rafId);\n }, dependencies);\n}\n"],"names":["useFocusManagement","dependencies","targetSelector","fallbackId","isFirstRender","useRef","useEffect","current","rafId","requestAnimationFrame","focusTarget","el","document","querySelector","getElementById","hasAttribute","setAttribute","focus","cancelAnimationFrame"],"mappings":";AAsBO,SAASA,EACdC,GACA;AAAA,EACEC,gBAAAA,IAAiB;AAAA,EACjBC,YAAAA,IAAa;AACY,IAAI,IACzB;AACN,QAAMC,IAAgBC,EAAO,EAAI;AAEjCC,EAAAA,EAAU,MAAM;AAEd,QAAIF,EAAcG,SAAS;AACzBH,MAAAA,EAAcG,UAAU;AACxB;AAAA,IACF;AAWA,UAAMC,IAAQC,sBATMC,MAAM;AACxB,YAAMC,IAAMC,SAASC,cAAcX,CAAc,KAAKU,SAASE,eAAeX,CAAU;AACxF,MAAIQ,MACGA,EAAGI,aAAa,UAAU,KAAGJ,EAAGK,aAAa,YAAY,IAAI,GAClEL,EAAGM,MAAAA;AAAAA,IAEP,CAG+C;AAC/C,WAAO,MAAMC,qBAAqBV,CAAK;AAAA,EACzC,GAAGP,CAAY;AACjB;"}
|
|
1
|
+
{"version":3,"file":"index69.js","sources":["../src/components/Paywall/index.tsx"],"sourcesContent":["import React, { FC, ReactNode } from 'react';\nimport { Button } from 'src/components/Button';\nimport { Badge } from 'src/components/Badge';\nimport { Icon } from 'src/components/Icon';\nimport { Link } from 'src/components/Link';\nimport { CustomModal } from 'src/components/CustomModal';\nimport { useStableId } from 'src/utils/useStableId';\nimport './style.scss';\n\n/** Variant: with bullet points list, or description only */\nexport type PaywallVariant = 'with-points' | 'description-only';\n\n/** Size: small (656×384) or large (768×500) – sets modal dimensions and media panel proportion */\nexport type PaywallSize = 'sm' | 'lg';\n\n/** Feature list item: plain string (uses default/list icon) or object with text, optional per-item icon, and optional link/action */\nexport type PaywallFeatureItem =\n | string\n | {\n text: string;\n icon?: ReactNode;\n /** If provided, the feature text becomes a hyperlink navigating to this URL */\n href?: string;\n /** If true, opens the href in a new tab (only applicable when href is set) */\n external?: boolean;\n /** Click handler — use with href for analytics, or alone for SPA actions */\n onLinkClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;\n };\n\nconst PAYWALL_SIZE_DIMENSIONS: Record<PaywallSize, { width: string; height: string }> = {\n lg: { width: '768px', height: '500px' },\n sm: { width: '656px', height: '384px' },\n};\n\nexport interface PaywallProps {\n isOpen: boolean;\n onClose: () => void;\n trigger?: ReactNode;\n modalWidth?: string;\n modalHeight?: string;\n variant: PaywallVariant;\n size?: PaywallSize;\n availabilityLabel?: string;\n availabilityBadgeText?: string;\n title: string;\n description: string;\n learnMoreLinkText?: string;\n learnMoreHref?: string;\n onLearnMoreClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;\n featureListDesc?: string;\n featuresList?: PaywallFeatureItem[];\n featureItemIcon?: ReactNode;\n mediaContent?: ReactNode;\n laterButtonText: string;\n purchaseButtonText: string;\n onLaterClick?: () => void;\n onPurchaseClick?: () => void;\n className?: string;\n modalContentClassName?: string;\n automationId?: string;\n id?: string;\n}\n\n/** Paywall – always shown in a modal. Pass isOpen/onClose and optionally a trigger. */\nexport const Paywall: FC<PaywallProps> = ({\n isOpen,\n onClose,\n trigger,\n modalWidth,\n modalHeight,\n variant,\n size = 'lg',\n availabilityLabel = 'Available on ',\n availabilityBadgeText,\n title,\n description,\n learnMoreLinkText,\n learnMoreHref,\n onLearnMoreClick,\n featureListDesc,\n featuresList = [],\n featureItemIcon,\n mediaContent,\n laterButtonText,\n purchaseButtonText,\n onLaterClick,\n onPurchaseClick,\n className = '',\n modalContentClassName = '',\n automationId = '',\n id: providedId,\n}) => {\n const titleId = useStableId(providedId, 'paywall-title');\n\n const handleLaterClick = () => {\n onLaterClick?.();\n onClose();\n };\n\n const dimensions = PAYWALL_SIZE_DIMENSIONS[size];\n const width = modalWidth ?? dimensions.width;\n const height = modalHeight ?? dimensions.height;\n\n const withPoints = variant === 'with-points' && size === 'lg';\n const normalizedFeatures = featuresList.map((item): { text: string; icon?: ReactNode; href?: string; external?: boolean; onLinkClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void } =>\n typeof item === 'string'\n ? { text: item }\n : { text: item.text, icon: item.icon, href: item.href, external: item.external, onLinkClick: item.onLinkClick }\n );\n const showFeatures = withPoints && normalizedFeatures.length > 0;\n const defaultIcon = featureItemIcon ?? <Icon name=\"info\" rotation='180'/>;\n\n const content = (\n <section\n className={`paywall paywall-ctn paywall-ctn--${size} ${className}`}\n data-automation-id={automationId}\n >\n <div className=\"paywall-card\">\n <div className=\"paywall-card-content\">\n {availabilityBadgeText && (\n <span className=\"paywall-card-availability\">\n <span className=\"paywall-card-availability-label\">{availabilityLabel}</span>\n <Badge\n label={availabilityBadgeText}\n className=\"paywall-card-badge\"\n bgColor=\"var(--color-yellow-100)\"\n textColor=\"var(--color-yellow-700)\"\n />\n </span>\n )}\n <h3 id={titleId} className=\"paywall-card-title\">{title}</h3>\n <p className=\"paywall-card-description\">\n {description}\n {learnMoreLinkText && (learnMoreHref || onLearnMoreClick) && (\n <Link\n href={learnMoreHref ?? '#'}\n label={learnMoreLinkText}\n external={!!learnMoreHref}\n className=\"paywall-card-learn-more\"\n onClick={(e) => { if (!learnMoreHref) { e.preventDefault(); } onLearnMoreClick?.(e); }}\n />\n )}\n </p>\n {withPoints && featureListDesc && (\n <p className=\"paywall-card-features-intro\">{featureListDesc}</p>\n )}\n {showFeatures && (\n <ul className=\"paywall-card-features-list\">\n {normalizedFeatures.map((item) => (\n <li key={item.text} className=\"paywall-card-feature-item\">\n <span className=\"paywall-card-feature-icon\" aria-hidden>\n {item.icon ?? defaultIcon}\n </span>\n <span>\n {item.href || item.onLinkClick ? (\n <Link\n href={item.href ?? '#'}\n label={item.text}\n external={item.external}\n onClick={(e) => { if (!item.href) { e.preventDefault(); } item.onLinkClick?.(e); }}\n />\n ) : (\n item.text\n )}\n </span>\n </li>\n ))}\n </ul>\n )}\n <div className=\"paywall-card-actions\">\n <Button\n type=\"ghost\"\n size=\"md\"\n label={laterButtonText}\n onClick={handleLaterClick}\n className=\"paywall-card-btn-later\"\n />\n <Button\n type=\"primary\"\n size=\"md\"\n label={purchaseButtonText}\n onClick={onPurchaseClick}\n className=\"paywall-card-btn-purchase\"\n />\n </div>\n </div>\n <div className=\"paywall-card-media\">\n {mediaContent}\n </div>\n </div>\n </section>\n );\n\n const modalContent = (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n className={`paywall-modal-content ${modalContentClassName}`}\n style={{ height, minHeight: height }}\n >\n {content}\n </div>\n );\n\n return (\n <>\n {trigger && <span className=\"paywall-trigger\">{trigger}</span>}\n <CustomModal\n isOpen={isOpen}\n onClose={onClose}\n onModalClick={() => {}}\n renderModalContent={() => modalContent}\n width={width}\n contentClassName=\"paywall-modal-content-wrapper\"\n automationId={automationId}\n />\n </>\n );\n};\n\nexport default Paywall;\n"],"names":["React__default","Button","Badge","Icon","Link","CustomModal","useStableId","PAYWALL_SIZE_DIMENSIONS","lg","width","height","sm","Paywall","isOpen","onClose","trigger","modalWidth","modalHeight","variant","size","availabilityLabel","availabilityBadgeText","title","description","learnMoreLinkText","learnMoreHref","onLearnMoreClick","featureListDesc","featuresList","featureItemIcon","mediaContent","laterButtonText","purchaseButtonText","onLaterClick","onPurchaseClick","className","modalContentClassName","automationId","id","providedId","titleId","handleLaterClick","dimensions","withPoints","normalizedFeatures","map","item","text","icon","href","external","onLinkClick","showFeatures","length","defaultIcon","React","createElement","name","rotation","content","label","bgColor","textColor","onClick","e","preventDefault","key","type","modalContent","role","style","minHeight","Fragment","onModalClick","renderModalContent","contentClassName"],"mappings":"AA6BA,OAAAA,OAAA;AAAA,SAAA,UAAAC,SAAA;AAAA,SAAA,SAAAC,SAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,SAAA,eAAAC,SAAA;AAAA,SAAA,eAAAC,SAAA;AAAA,OAAA;AAAA,MAAMC,IAAkF;AAAA,EACtFC,IAAI;AAAA,IAAEC,OAAO;AAAA,IAASC,QAAQ;AAAA,EAAA;AAAA,EAC9BC,IAAI;AAAA,IAAEF,OAAO;AAAA,IAASC,QAAQ;AAAA,EAAA;AAChC,GAgCaE,KAA4BA,CAAC;AAAA,EACxCC,QAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,MAAAA,IAAO;AAAA,EACPC,mBAAAA,IAAoB;AAAA,EACpBC,uBAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,mBAAAA;AAAAA,EACAC,eAAAA;AAAAA,EACAC,kBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,cAAAA,IAAe,CAAA;AAAA,EACfC,iBAAAA;AAA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AA,IAC1B3D,OAAAA;AAAAA,IACAkE,kBAAiB;AAAA,IACjBtC,cAAAA;AAAAA,EAAAA,CACD,CACD;AAEN;"}
|
package/dist/index7.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import { isElementVisible as p } from "./
|
|
1
|
+
import c, { useState as h, useCallback as i } from "react";
|
|
2
|
+
import "./index76.js";
|
|
3
|
+
import { isElementVisible as p } from "./index204.js";
|
|
4
4
|
const x = ({
|
|
5
5
|
skipLinks: n,
|
|
6
|
-
className:
|
|
6
|
+
className: r = ""
|
|
7
7
|
}) => {
|
|
8
|
-
const [
|
|
8
|
+
const [s, u] = h(n), l = i(() => {
|
|
9
9
|
const t = n.filter((e) => {
|
|
10
10
|
const o = document.getElementById(e.id);
|
|
11
11
|
return p(o);
|
|
@@ -30,10 +30,10 @@ const x = ({
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}, []);
|
|
33
|
-
return n.length === 0 ? null : /* @__PURE__ */
|
|
34
|
-
className: `se-design-skip-links-bar relative w-full h-0 overflow-hidden p-0 flex items-center justify-center bg-[var(--color-blue-50)] transition-[height] duration-300 ease-out focus-within:h-auto focus-within:py-1 focus-within:px-2 ${
|
|
33
|
+
return n.length === 0 ? null : /* @__PURE__ */ c.createElement("div", {
|
|
34
|
+
className: `se-design-skip-links-bar relative w-full h-0 overflow-hidden p-0 flex items-center justify-center bg-[var(--color-blue-50)] transition-[height] duration-300 ease-out focus-within:h-auto focus-within:py-1 focus-within:px-2 ${r}`,
|
|
35
35
|
onFocus: a
|
|
36
|
-
},
|
|
36
|
+
}, s.map((t) => /* @__PURE__ */ c.createElement("a", {
|
|
37
37
|
key: t.id,
|
|
38
38
|
href: `#${t.id}`,
|
|
39
39
|
className: "absolute -left-[9999px] [clip:rect(0,0,0,0)] no-underline text-[var(--color-blue-500)] text-md py-1 px-2.5 rounded capitalize focus:static focus:left-auto focus:[clip:auto] focus:outline-none focus-visible:!outline-none hover:text-[var(--color-blue-600)] hover:bg-[var(--color-blue-200)]",
|
|
@@ -43,7 +43,6 @@ const x = ({
|
|
|
43
43
|
}, t.label)));
|
|
44
44
|
};
|
|
45
45
|
export {
|
|
46
|
-
x as SkipLinksBar
|
|
47
|
-
x as default
|
|
46
|
+
x as SkipLinksBar
|
|
48
47
|
};
|
|
49
48
|
//# sourceMappingURL=index7.js.map
|
package/dist/index70.js
CHANGED
|
@@ -1,69 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tabIndex: v = 0,
|
|
6
|
-
defaultFocusedId: u,
|
|
7
|
-
orientation: a = "horizontal",
|
|
8
|
-
cols: i,
|
|
9
|
-
loop: k = !0,
|
|
10
|
-
onFocusChange: f,
|
|
11
|
-
role: h
|
|
1
|
+
function i({
|
|
2
|
+
titleId: r,
|
|
3
|
+
descriptionId: t,
|
|
4
|
+
isFocusable: a = !1
|
|
12
5
|
}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const e = u || r[0] || "";
|
|
17
|
-
b(e);
|
|
18
|
-
}
|
|
19
|
-
}, [r, c, u]);
|
|
20
|
-
const x = n.useCallback((e) => {
|
|
21
|
-
b(e), f?.(e);
|
|
22
|
-
}, [f]), y = n.useCallback((e) => {
|
|
23
|
-
const t = g.current[e];
|
|
24
|
-
t ? t.focus() : (b(e), f?.(e));
|
|
25
|
-
}, [f]), p = n.useCallback((e, t = 1) => {
|
|
26
|
-
if (r.length === 0) return;
|
|
27
|
-
const o = r.indexOf(c), l = Math.max(0, o);
|
|
28
|
-
let s = l;
|
|
29
|
-
switch (e) {
|
|
30
|
-
case "first":
|
|
31
|
-
s = 0;
|
|
32
|
-
break;
|
|
33
|
-
case "last":
|
|
34
|
-
s = r.length - 1;
|
|
35
|
-
break;
|
|
36
|
-
case "prev":
|
|
37
|
-
k ? s = (l - t + r.length) % r.length : s = Math.max(0, l - t);
|
|
38
|
-
break;
|
|
39
|
-
case "next":
|
|
40
|
-
k ? s = (l + t) % r.length : s = Math.min(r.length - 1, l + t);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
const w = r[s];
|
|
44
|
-
w && g.current[w]?.focus();
|
|
45
|
-
}, [r, c, k]), A = n.useCallback((e) => ({
|
|
46
|
-
ref: (t) => {
|
|
47
|
-
g.current[e] = t;
|
|
48
|
-
},
|
|
49
|
-
tabIndex: c === e ? v : -1,
|
|
50
|
-
onFocus: () => x(e)
|
|
51
|
-
}), [c, v, x]), R = n.useCallback((e) => {
|
|
52
|
-
let t = null, o = 1;
|
|
53
|
-
e.key === "Home" ? t = "first" : e.key === "End" ? t = "last" : (a !== "vertical" && (e.key === "ArrowLeft" ? t = "prev" : e.key === "ArrowRight" && (t = "next")), !t && a !== "horizontal" && (e.key === "ArrowUp" ? t = "prev" : e.key === "ArrowDown" && (t = "next"), t && i && (o = i))), t && (e.preventDefault(), e.stopPropagation(), p(t, o));
|
|
54
|
-
}, [a, i, p]), z = n.useCallback((e) => {
|
|
55
|
-
const t = {};
|
|
56
|
-
return h && (t.role = h), a === "horizontal" ? t["aria-orientation"] = "horizontal" : a === "vertical" && (t["aria-orientation"] = "vertical"), e && Object.assign(t, C(e)), t;
|
|
57
|
-
}, [h, a]);
|
|
58
|
-
return {
|
|
59
|
-
setFocusedId: x,
|
|
60
|
-
focusItem: y,
|
|
61
|
-
handleKeyDown: R,
|
|
62
|
-
getRovingItemProps: A,
|
|
63
|
-
getContainerProps: z
|
|
6
|
+
const e = {
|
|
7
|
+
role: "region",
|
|
8
|
+
"aria-labelledby": r
|
|
64
9
|
};
|
|
10
|
+
return t && (e["aria-describedby"] = t), a && (e.tabIndex = -1), e;
|
|
65
11
|
}
|
|
66
12
|
export {
|
|
67
|
-
|
|
13
|
+
i as getRegionAttributes
|
|
68
14
|
};
|
|
69
15
|
//# sourceMappingURL=index70.js.map
|
package/dist/index70.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index70.js","sources":["../src/utils/a11y/useRovingFocus.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { getA11yNameAttributes, AccessibleNameInput } from './accessibleName';\nexport type { AccessibleNameInput };\n\nexport type RovingDirection = 'prev' | 'next' | 'first' | 'last';\n\nexport interface UseRovingFocusOptions {\n /**\n * Array of item IDs in order\n */\n itemIds: string[];\n\n /**\n * The tabIndex to apply to the currently focused item in the roving group.\n * Defaults to 0 \n */\n tabIndex?: number;\n\n /**\n * Initial focused item ID. Defaults to first item.\n */\n defaultFocusedId?: string;\n\n /**\n * Orientation for arrow key mapping.\n * - horizontal: ArrowLeft/ArrowRight\n * - vertical: ArrowUp/ArrowDown\n * - grid: all four arrow keys (Left/Right move by 1, Up/Down move by `cols`)\n */\n orientation?: 'horizontal' | 'vertical' | 'grid';\n\n /**\n * Number of columns in the grid. Required when orientation is 'grid'.\n * ArrowUp/ArrowDown navigate by this many items in the flat itemIds array.\n */\n cols?: number;\n\n /**\n * Whether navigation wraps around at ends. Defaults to true.\n */\n loop?: boolean;\n\n /**\n * Callback when focus changes\n */\n onFocusChange?: (id: string) => void;\n\n /**\n * ARIA role for the container element (e.g. 'grid', 'menu', 'tablist', 'toolbar').\n * Returned via getContainerProps().\n */\n role?: React.AriaRole;\n}\n\nexport interface RovingItemProps {\n ref: (el: HTMLElement | null) => void;\n tabIndex: number;\n onFocus: () => void;\n}\n\nexport interface RovingContainerProps {\n role?: React.AriaRole;\n 'aria-orientation'?: 'horizontal' | 'vertical';\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n}\n\nexport interface UseRovingFocusReturn {\n /**\n * Set focused item ID manually\n */\n setFocusedId: (id: string) => void;\n\n /**\n * Imperatively focus a DOM element by id.\n * If the element exists in refs, focus it immediately.\n * If not yet in DOM, update state so it gets focus once rendered.\n */\n focusItem: (id: string) => void;\n\n /**\n * Keyboard handler for arrow/Home/End navigation.\n * Attach to each item's onKeyDown.\n */\n handleKeyDown: (e: React.KeyboardEvent) => void;\n\n /**\n * Get props for an item in the roving focus group (ref + tabIndex)\n */\n getRovingItemProps: (id: string) => RovingItemProps;\n\n /**\n * Props to spread on the container element.\n * Returns role (if provided), aria-orientation (derived from orientation; omitted for grid),\n * and any accessible name/description attributes passed in.\n */\n getContainerProps: (nameInput?: AccessibleNameInput) => RovingContainerProps;\n}\n\n/**\n * Hook for managing roving focus pattern (roving tabindex).\n * Reusable for composite widgets: tabs, toolbars, menus, listboxes, radio groups, grids.\n *\n * @example\n * // 1D (toolbar/tabs):\n * const { getRovingItemProps, handleKeyDown } = useRovingFocus({\n * itemIds: ['tab1', 'tab2', 'tab3'],\n * orientation: 'horizontal'\n * });\n *\n * // 2D (grid — flat itemIds, cols for row-jump math):\n * const { getRovingItemProps, handleKeyDown } = useRovingFocus({\n * itemIds: ['r0c0', 'r0c1', 'r0c2', 'r1c0', 'r1c1', 'r1c2'],\n * orientation: 'grid',\n * cols: 3\n * });\n *\n * // In render:\n * <button {...getRovingItemProps('tab1')} onKeyDown={handleKeyDown}>Tab 1</button>\n */\nexport function useRovingFocus({\n itemIds,\n tabIndex = 0,\n defaultFocusedId,\n orientation = 'horizontal',\n cols,\n loop = true,\n onFocusChange,\n role\n}: UseRovingFocusOptions): UseRovingFocusReturn {\n const [focusedId, setFocusedIdState] = React.useState<string>(\n defaultFocusedId || itemIds[0] || ''\n );\n\n const itemRefs = React.useRef<Record<string, HTMLElement | null>>({});\n\n // Sync focusedId if itemIds change and current focusedId is no longer valid\n React.useEffect(() => {\n if (itemIds.length > 0 && !itemIds.includes(focusedId)) {\n const newFocusedId = defaultFocusedId || itemIds[0] || '';\n setFocusedIdState(newFocusedId);\n }\n }, [itemIds, focusedId, defaultFocusedId]);\n\n const setFocusedId = React.useCallback(\n (id: string) => {\n setFocusedIdState(id);\n onFocusChange?.(id);\n },\n [onFocusChange]\n );\n\n const focusItem = React.useCallback(\n (id: string) => {\n const el = itemRefs.current[id];\n if (el) {\n el.focus();\n } else {\n // element not yet in DOM (e.g. month just changed) — update state so it gets focus once rendered\n setFocusedIdState(id);\n onFocusChange?.(id);\n }\n },\n [onFocusChange]\n );\n\n const moveFocus = React.useCallback(\n (direction: RovingDirection, step: number = 1) => {\n if (itemIds.length === 0) return;\n\n const currentIdx = itemIds.indexOf(focusedId);\n const safeIdx = Math.max(0, currentIdx);\n let nextIdx = safeIdx;\n\n switch (direction) {\n case 'first':\n nextIdx = 0;\n break;\n case 'last':\n nextIdx = itemIds.length - 1;\n break;\n case 'prev':\n if (loop) {\n nextIdx = (safeIdx - step + itemIds.length) % itemIds.length;\n } else {\n nextIdx = Math.max(0, safeIdx - step);\n }\n break;\n case 'next':\n if (loop) {\n nextIdx = (safeIdx + step) % itemIds.length;\n } else {\n nextIdx = Math.min(itemIds.length - 1, safeIdx + step);\n }\n break;\n }\n\n const nextId = itemIds[nextIdx];\n if (!nextId) return;\n\n itemRefs.current[nextId]?.focus();\n },\n [itemIds, focusedId, loop]\n );\n\n const getRovingItemProps = React.useCallback(\n (id: string): RovingItemProps => ({\n ref: (el: HTMLElement | null) => {\n itemRefs.current[id] = el;\n },\n tabIndex: focusedId === id ? tabIndex : -1,\n onFocus: () => setFocusedId(id)\n }),\n [focusedId, tabIndex, setFocusedId]\n );\n\n // Keyboard handler for arrow/Home/End navigation\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n let direction: RovingDirection | null = null;\n let step = 1;\n\n if (e.key === 'Home') {\n direction = 'first';\n } else if (e.key === 'End') {\n direction = 'last';\n } else {\n // Horizontal axis (Left/Right) — active for 'horizontal' and 'grid'\n if (orientation !== 'vertical') {\n if (e.key === 'ArrowLeft') direction = 'prev';\n else if (e.key === 'ArrowRight') direction = 'next';\n }\n // Vertical axis (Up/Down) — active for 'vertical' and 'grid'\n if (!direction && orientation !== 'horizontal') {\n if (e.key === 'ArrowUp') direction = 'prev';\n else if (e.key === 'ArrowDown') direction = 'next';\n if (direction && cols) step = cols;\n }\n }\n\n if (direction) {\n e.preventDefault();\n e.stopPropagation();\n moveFocus(direction, step);\n }\n },\n [orientation, cols, moveFocus]\n );\n\n const getContainerProps = React.useCallback((nameInput?: AccessibleNameInput): RovingContainerProps => {\n const props: RovingContainerProps = {};\n if (role) props.role = role;\n if (orientation === 'horizontal') props['aria-orientation'] = 'horizontal';\n else if (orientation === 'vertical') props['aria-orientation'] = 'vertical';\n // grid: aria-orientation omitted — not applicable for role=\"grid\"\n if (nameInput) Object.assign(props, getA11yNameAttributes(nameInput));\n return props;\n }, [role, orientation]);\n\n return {\n setFocusedId,\n focusItem,\n handleKeyDown,\n getRovingItemProps,\n getContainerProps\n };\n}\n"],"names":["React","getA11yNameAttributes","useRovingFocus","itemIds","tabIndex","defaultFocusedId","orientation","cols","loop","onFocusChange","role","focusedId","setFocusedIdState","useState","itemRefs","useRef","useEffect","length","includes","newFocusedId","setFocusedId","useCallback","id","focusItem","el","current","focus","moveFocus","direction","step","currentIdx","indexOf","safeIdx","Math","max","nextIdx","min","nextId","getRovingItemProps","ref","onFocus","handleKeyDown","e","key","preventDefault","stopPropagation","getContainerProps","nameInput","props","Object","assign"],"mappings":"AA0HO,YAAAA,OAAA;AAAA,SAAA,yBAAAC,SAAA;AAAA,SAASC,EAAe;AAAA,EAC7BC,SAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,kBAAAA;AAAAA,EACAC,aAAAA,IAAc;AAAA,EACdC,MAAAA;AAAAA,EACAC,MAAAA,IAAO;AAAA,EACPC,eAAAA;AAAAA,EACAC,MAAAA;AACqB,GAAyB;AAC9C,QAAM,CAACC,GAAWC,CAAiB,IAAIZ,EAAMa,SAC3CR,KAAoBF,EAAQ,CAAC,KAAK,EACpC,GAEMW,IAAWd,EAAMe,OAA2C,EAAE;AAGpEf,EAAAA,EAAMgB,UAAU,MAAM;AACpB,QAAIb,EAAQc,SAAS,KAAK,CAACd,EAAQe,SAASP,CAAS,GAAG;AACtD,YAAMQ,IAAed,KAAoB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index70.js","sources":["../src/utils/a11y/regionAttributes.ts"],"sourcesContent":["/**\n * Returns ARIA attributes for a region container element.\n * Used for semantic containers that need role=\"region\" with proper labeling.\n * \n * @param options - Configuration options\n * @param options.titleId - Required. ID of the heading element that labels this region\n * @param options.descriptionId - Optional. ID of the description element\n * @param options.isFocusable - Optional. Whether to make the region focusable (adds tabIndex={-1})\n * @returns Object with region ARIA attributes\n */\nexport function getRegionAttributes({\n titleId,\n descriptionId,\n isFocusable = false\n}: {\n titleId: string;\n descriptionId?: string;\n isFocusable?: boolean;\n}): {\n role: 'region';\n 'aria-labelledby': string;\n 'aria-describedby'?: string;\n tabIndex?: number;\n} {\n const attributes: {\n role: 'region';\n 'aria-labelledby': string;\n 'aria-describedby'?: string;\n tabIndex?: number;\n } = {\n role: 'region',\n 'aria-labelledby': titleId\n };\n\n if (descriptionId) {\n attributes['aria-describedby'] = descriptionId;\n }\n\n if (isFocusable) {\n attributes.tabIndex = -1;\n }\n\n return attributes;\n}\n"],"names":["getRegionAttributes","titleId","descriptionId","isFocusable","attributes","role","tabIndex"],"mappings":"AAUO,SAASA,EAAoB;AAAA,EAClCC,SAAAA;AAAAA,EACAC,eAAAA;AAAAA,EACAC,aAAAA,IAAc;AAKhB,GAKE;AACA,QAAMC,IAKF;AAAA,IACFC,MAAM;AAAA,IACN,mBAAmBJ;AAAAA,EAAAA;AAGrB,SAAIC,MACFE,EAAW,kBAAkB,IAAIF,IAG/BC,MACFC,EAAWE,WAAW,KAGjBF;AACT;"}
|
package/dist/index71.js
CHANGED
|
@@ -1,30 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import { isVirtualClick as w } from "./index79.js";
|
|
3
|
+
function R({
|
|
4
|
+
disabled: p = !1,
|
|
5
|
+
loading: i = !1,
|
|
6
|
+
onClick: u,
|
|
7
|
+
onKeyboardActivate: s,
|
|
8
|
+
isNative: l = !0,
|
|
9
|
+
role: d = "button",
|
|
10
|
+
tabIndex: D = 0,
|
|
11
|
+
stopPropagation: c = !1,
|
|
12
|
+
preventDefault: f = !1,
|
|
13
|
+
pressed: P
|
|
14
|
+
} = {}) {
|
|
15
|
+
const e = p || i, n = t.useRef(!1), o = t.useCallback(() => {
|
|
16
|
+
n.current = !0;
|
|
17
|
+
}, []), m = t.useCallback((r) => {
|
|
18
|
+
if (e) return;
|
|
19
|
+
c && r.stopPropagation(), f && r.preventDefault();
|
|
20
|
+
const y = w(r.nativeEvent), C = n.current;
|
|
21
|
+
n.current = !1;
|
|
22
|
+
const b = y ? "virtual" : C ? "pointer" : "keyboard";
|
|
23
|
+
if ((b === "keyboard" || b === "virtual") && s) {
|
|
24
|
+
s(r);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
u?.(r);
|
|
28
|
+
}, [e, u, s, c, f]), v = t.useCallback((r) => {
|
|
29
|
+
e || (r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.currentTarget.click());
|
|
30
|
+
}, [e]), k = {
|
|
31
|
+
onPointerDown: o,
|
|
32
|
+
onMouseDown: o,
|
|
33
|
+
onTouchStart: o,
|
|
34
|
+
onClick: m,
|
|
35
|
+
"aria-disabled": e ? "true" : void 0,
|
|
36
|
+
"aria-busy": i ? "true" : void 0,
|
|
37
|
+
"aria-pressed": P
|
|
38
|
+
};
|
|
39
|
+
l || (k.onKeyDown = v);
|
|
40
|
+
const a = {
|
|
41
|
+
pressProps: k,
|
|
42
|
+
isDisabled: e
|
|
43
|
+
};
|
|
44
|
+
return l || (a.role = d, a.tabIndex = e ? -1 : D), a;
|
|
22
45
|
}
|
|
23
46
|
export {
|
|
24
|
-
|
|
25
|
-
u as FOCUSABLE_WITH_ROLES_SELECTOR,
|
|
26
|
-
b as getFirstFocusableElement,
|
|
27
|
-
s as getFocusableElements,
|
|
28
|
-
c as getLastFocusableElement
|
|
47
|
+
R as useAccessiblePress
|
|
29
48
|
};
|
|
30
49
|
//# sourceMappingURL=index71.js.map
|