se-design 1.0.80 → 1.0.81-dev2
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/icons/envelope.svg +4 -0
- package/dist/assets/icons/views.svg +7 -0
- package/dist/assets/style.css +1 -1
- package/dist/components/Checkbox/index.d.ts +4 -0
- package/dist/components/DatePicker/useDatePickerA11y.d.ts +1 -4
- package/dist/components/Dropdown/index.d.ts +4 -0
- package/dist/components/LabelChip/index.d.ts +1 -0
- package/dist/components/Popover/index.d.ts +9 -1
- package/dist/components/Radio/index.d.ts +4 -0
- package/dist/components/Toggle/index.d.ts +4 -0
- package/dist/index10.js.map +1 -1
- package/dist/index100.js.map +1 -1
- package/dist/index101.js.map +1 -1
- package/dist/index102.js.map +1 -1
- package/dist/index103.js.map +1 -1
- package/dist/index104.js.map +1 -1
- package/dist/index105.js.map +1 -1
- package/dist/index106.js.map +1 -1
- package/dist/index107.js.map +1 -1
- package/dist/index108.js.map +1 -1
- package/dist/index109.js.map +1 -1
- package/dist/index11.js +44 -43
- package/dist/index11.js.map +1 -1
- package/dist/index110.js.map +1 -1
- package/dist/index111.js.map +1 -1
- package/dist/index112.js.map +1 -1
- package/dist/index113.js.map +1 -1
- package/dist/index114.js.map +1 -1
- package/dist/index115.js.map +1 -1
- package/dist/index116.js.map +1 -1
- package/dist/index117.js.map +1 -1
- package/dist/index118.js.map +1 -1
- package/dist/index119.js.map +1 -1
- package/dist/index12.js +38 -31
- package/dist/index12.js.map +1 -1
- package/dist/index120.js +2 -2
- package/dist/index120.js.map +1 -1
- package/dist/index121.js +1 -1
- package/dist/index121.js.map +1 -1
- package/dist/index122.js +2 -2
- package/dist/index122.js.map +1 -1
- package/dist/index123.js +2 -2
- 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 +1 -1
- package/dist/index127.js.map +1 -1
- package/dist/index128.js +1 -1
- package/dist/index128.js.map +1 -1
- package/dist/index129.js +1 -1
- package/dist/index129.js.map +1 -1
- package/dist/index13.js +20 -19
- package/dist/index13.js.map +1 -1
- package/dist/index130.js +2 -2
- package/dist/index130.js.map +1 -1
- package/dist/index131.js +2 -2
- package/dist/index131.js.map +1 -1
- package/dist/index132.js +2 -2
- package/dist/index132.js.map +1 -1
- package/dist/index133.js +1 -1
- package/dist/index133.js.map +1 -1
- package/dist/index134.js +1 -1
- package/dist/index134.js.map +1 -1
- package/dist/index135.js +1 -1
- package/dist/index135.js.map +1 -1
- package/dist/index136.js +1 -1
- package/dist/index136.js.map +1 -1
- package/dist/index137.js +1 -1
- package/dist/index137.js.map +1 -1
- package/dist/index138.js +1 -1
- package/dist/index138.js.map +1 -1
- package/dist/index139.js +1 -1
- package/dist/index139.js.map +1 -1
- package/dist/index14.js.map +1 -1
- package/dist/index140.js +1 -1
- package/dist/index140.js.map +1 -1
- package/dist/index141.js +2 -2
- package/dist/index141.js.map +1 -1
- package/dist/index142.js +2 -2
- 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 +1 -1
- 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 +1 -1
- package/dist/index149.js.map +1 -1
- package/dist/index150.js +2 -2
- package/dist/index150.js.map +1 -1
- package/dist/index151.js +1 -1
- package/dist/index151.js.map +1 -1
- package/dist/index152.js +2 -2
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +2 -2
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +2 -2
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +2 -2
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +1 -1
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +1 -1
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +1 -1
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +1 -1
- package/dist/index159.js.map +1 -1
- package/dist/index16.js +1 -1
- package/dist/index16.js.map +1 -1
- package/dist/index160.js +1 -1
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +1 -1
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +1 -1
- 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/index17.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.map +1 -1
- package/dist/index180.js +2 -2
- package/dist/index180.js.map +1 -1
- package/dist/index181.js +2 -2
- 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 +2 -2
- 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 +1 -1
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +1 -1
- package/dist/index189.js.map +1 -1
- package/dist/index19.js +185 -163
- package/dist/index19.js.map +1 -1
- 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 +1 -1
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +1 -1
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +2 -2
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +1 -1
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +2 -2
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +2 -149
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +2 -9
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +149 -6
- package/dist/index199.js.map +1 -1
- package/dist/index20.js.map +1 -1
- package/dist/index200.js +8 -4
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +5 -39
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +8 -0
- package/dist/index202.js.map +1 -0
- package/dist/index203.js +45 -0
- package/dist/index203.js.map +1 -0
- package/dist/index204.js +24 -0
- package/dist/index204.js.map +1 -0
- package/dist/index21.js.map +1 -1
- package/dist/{index208.js → index211.js} +1 -1
- package/dist/index211.js.map +1 -0
- package/dist/{index209.js → index212.js} +1 -1
- package/dist/{index209.js.map → index212.js.map} +1 -1
- package/dist/index22.js.map +1 -1
- package/dist/{index217.js → index220.js} +1 -1
- package/dist/{index217.js.map → index220.js.map} +1 -1
- package/dist/index228.js +1233 -43
- package/dist/index228.js.map +1 -1
- package/dist/index23.js +30 -28
- package/dist/index23.js.map +1 -1
- package/dist/index231.js +46 -0
- package/dist/index231.js.map +1 -0
- package/dist/index24.js.map +1 -1
- package/dist/index240.js +167 -16
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +3 -9
- package/dist/index241.js.map +1 -1
- package/dist/index243.js +18 -4
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +9 -169
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +10 -11
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +4 -5
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +170 -6
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +11 -38
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +6 -2
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +259 -236
- package/dist/index25.js.map +1 -1
- package/dist/index250.js +5 -7
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +36 -325
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +2 -50
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +8 -2
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +323 -72
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +47 -90
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +2 -52
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +75 -7
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +92 -4
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +48 -48
- package/dist/index259.js.map +1 -1
- package/dist/index26.js.map +1 -1
- package/dist/index260.js +8 -2
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +5 -2
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +55 -0
- package/dist/index262.js.map +1 -0
- package/dist/index263.js +5 -0
- package/dist/index263.js.map +1 -0
- package/dist/index264.js +5 -0
- package/dist/index264.js.map +1 -0
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +3 -3
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +43 -41
- package/dist/index29.js.map +1 -1
- package/dist/index3.js.map +1 -1
- package/dist/index30.js +81 -79
- package/dist/index30.js.map +1 -1
- package/dist/index31.js.map +1 -1
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +18 -16
- package/dist/index33.js.map +1 -1
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +1 -1
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +1 -1
- package/dist/index36.js.map +1 -1
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +1 -1
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +2 -2
- package/dist/index39.js.map +1 -1
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +1 -1
- package/dist/index40.js.map +1 -1
- package/dist/index41.js.map +1 -1
- package/dist/index42.js.map +1 -1
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +3 -3
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +1 -1
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +2 -2
- package/dist/index46.js.map +1 -1
- package/dist/index47.js.map +1 -1
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +1 -1
- package/dist/index49.js.map +1 -1
- package/dist/index5.js.map +1 -1
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +183 -175
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +1 -1
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +1 -1
- package/dist/index53.js.map +1 -1
- package/dist/index54.js.map +1 -1
- package/dist/index55.js.map +1 -1
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +1 -1
- package/dist/index57.js.map +1 -1
- package/dist/index58.js.map +1 -1
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +148 -144
- package/dist/index6.js.map +1 -1
- package/dist/index60.js.map +1 -1
- package/dist/index61.js.map +1 -1
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +1 -1
- package/dist/index63.js.map +1 -1
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +1 -1
- package/dist/index65.js.map +1 -1
- package/dist/index67.js.map +1 -1
- package/dist/index68.js.map +1 -1
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +1 -1
- package/dist/index7.js.map +1 -1
- package/dist/index70.js.map +1 -1
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +34 -33
- package/dist/index72.js.map +1 -1
- package/dist/index73.js.map +1 -1
- package/dist/index74.js.map +1 -1
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +21 -21
- package/dist/index76.js.map +1 -1
- package/dist/index77.js.map +1 -1
- package/dist/index78.js.map +1 -1
- package/dist/index8.js.map +1 -1
- package/dist/index80.js.map +1 -1
- package/dist/index81.js.map +1 -1
- package/dist/index82.js.map +1 -1
- package/dist/index83.js.map +1 -1
- package/dist/index84.js.map +1 -1
- package/dist/index85.js.map +1 -1
- package/dist/index86.js.map +1 -1
- package/dist/index87.js.map +1 -1
- package/dist/index88.js.map +1 -1
- package/dist/index89.js.map +1 -1
- package/dist/index9.js +28 -26
- package/dist/index9.js.map +1 -1
- package/dist/index90.js.map +1 -1
- package/dist/index91.js.map +1 -1
- package/dist/index92.js.map +1 -1
- package/dist/index93.js.map +1 -1
- package/dist/index94.js.map +1 -1
- package/dist/index95.js.map +1 -1
- package/dist/index96.js.map +1 -1
- package/dist/index97.js.map +1 -1
- package/dist/index98.js.map +1 -1
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
- package/dist/index208.js.map +0 -1
- package/dist/index225.js +0 -1236
- package/dist/index225.js.map +0 -1
- package/dist/index237.js +0 -176
- package/dist/index237.js.map +0 -1
- package/dist/index238.js +0 -7
- package/dist/index238.js.map +0 -1
- package/dist/index242.js +0 -13
- package/dist/index242.js.map +0 -1
package/dist/index228.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index228.js","sources":[
|
|
1
|
+
{"version":3,"file":"index228.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index23.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import s, { useState as
|
|
2
|
-
import { useStableId as
|
|
3
|
-
import { getA11yNameAttributes as
|
|
1
|
+
import s, { useState as j, useEffect as B } from "react";
|
|
2
|
+
import { useStableId as K } from "./index201.js";
|
|
3
|
+
import { getA11yNameAttributes as L } from "./index78.js";
|
|
4
4
|
import "./index72.js";
|
|
5
|
-
import { mergeIds as
|
|
5
|
+
import { mergeIds as q } from "./index202.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
function h() {
|
|
8
|
-
return h = Object.assign ? Object.assign.bind() : function(
|
|
8
|
+
return h = Object.assign ? Object.assign.bind() : function(l) {
|
|
9
9
|
for (var i = 1; i < arguments.length; i++) {
|
|
10
10
|
var r = arguments[i];
|
|
11
|
-
for (var e in r) ({}).hasOwnProperty.call(r, e) && (
|
|
11
|
+
for (var e in r) ({}).hasOwnProperty.call(r, e) && (l[e] = r[e]);
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return l;
|
|
14
14
|
}, h.apply(null, arguments);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
className:
|
|
16
|
+
const Q = ({
|
|
17
|
+
className: l = "",
|
|
18
18
|
automationId: i = "",
|
|
19
19
|
defaultChecked: r = !1,
|
|
20
20
|
checked: e,
|
|
21
21
|
disabled: n = !1,
|
|
22
22
|
onChange: x,
|
|
23
23
|
checkMarkType: c = "",
|
|
24
|
-
label:
|
|
24
|
+
label: u = "",
|
|
25
25
|
disabledLabel: g = "",
|
|
26
26
|
containerAutomationId: E = "",
|
|
27
27
|
ariaLabel: y,
|
|
28
28
|
ariaLabelledBy: C,
|
|
29
29
|
ariaDescribedBy: N,
|
|
30
|
+
ariaControls: I,
|
|
30
31
|
tabIndex: k,
|
|
31
|
-
ariaHidden:
|
|
32
|
+
ariaHidden: w = !1
|
|
32
33
|
}) => {
|
|
33
|
-
const o = e !== void 0, [t, m] =
|
|
34
|
-
|
|
34
|
+
const o = e !== void 0, [t, m] = j(o ? e : r);
|
|
35
|
+
B(() => {
|
|
35
36
|
m(o ? e : r);
|
|
36
37
|
}, [e, r]);
|
|
37
|
-
const
|
|
38
|
+
const A = (a) => {
|
|
38
39
|
n || (o || m((b) => !b), x?.(o ? !e : !t, a));
|
|
39
|
-
},
|
|
40
|
+
}, $ = (a) => {
|
|
40
41
|
if (!n && (a.key === "Enter" || a.key === " ")) {
|
|
41
42
|
a.preventDefault(), a.stopPropagation();
|
|
42
43
|
const b = o ? !e : !t;
|
|
@@ -47,29 +48,30 @@ const J = ({
|
|
|
47
48
|
currentTarget: d
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
},
|
|
51
|
-
ariaLabelledBy:
|
|
51
|
+
}, D = () => n ? t && c === "tick" ? "disabled-tick" : t && c === "minus-checkbox" ? "disabled-minus-checkbox" : t && !c ? "disabled-tick" : "disabled-default" : c === "minus-checkbox" && t ? "minus-checkbox" : t ? "checked" : "unchecked", O = () => n ? "checkbox-label-disabled" : "checkbox-label", p = () => n && g ? g : u, f = K(void 0, "checkbox-input"), v = u ? `${f}-label` : void 0, S = L({
|
|
52
|
+
ariaLabelledBy: q(v, C),
|
|
52
53
|
ariaLabel: y,
|
|
53
54
|
ariaDescribedBy: N
|
|
54
|
-
}),
|
|
55
|
+
}), _ = () => c === "minus-checkbox" && t ? "mixed" : t ? "true" : "false";
|
|
55
56
|
return /* @__PURE__ */ s.createElement("div", {
|
|
56
57
|
className: "se-design-checkbox-ctn",
|
|
57
|
-
"aria-hidden":
|
|
58
|
+
"aria-hidden": w ? "true" : void 0
|
|
58
59
|
}, /* @__PURE__ */ s.createElement("label", h({
|
|
59
60
|
role: "checkbox",
|
|
60
61
|
htmlFor: f,
|
|
61
|
-
className: `se-design-checkbox ${
|
|
62
|
+
className: `se-design-checkbox ${l} ${D()}`,
|
|
62
63
|
"data-automation-id": E || "checkbox-container",
|
|
63
64
|
tabIndex: k !== void 0 ? k : n ? -1 : 0,
|
|
64
|
-
"aria-checked":
|
|
65
|
-
"aria-disabled": n ? "true" : "false"
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
"aria-checked": _(),
|
|
66
|
+
"aria-disabled": n ? "true" : "false",
|
|
67
|
+
"aria-controls": I
|
|
68
|
+
}, S, {
|
|
69
|
+
onKeyDown: $
|
|
68
70
|
}), /* @__PURE__ */ s.createElement("input", {
|
|
69
71
|
id: f,
|
|
70
72
|
type: "checkbox",
|
|
71
73
|
checked: t,
|
|
72
|
-
onChange:
|
|
74
|
+
onChange: A,
|
|
73
75
|
disabled: n,
|
|
74
76
|
tabIndex: -1,
|
|
75
77
|
"aria-hidden": "true"
|
|
@@ -78,11 +80,11 @@ const J = ({
|
|
|
78
80
|
"data-automation-id": i
|
|
79
81
|
}), p()?.length > 0 && /* @__PURE__ */ s.createElement("span", {
|
|
80
82
|
id: v,
|
|
81
|
-
className:
|
|
82
|
-
"data-automation-id": i || (
|
|
83
|
+
className: O(),
|
|
84
|
+
"data-automation-id": i || (u ? `checkbox-label-${u}` : "checkbox-label")
|
|
83
85
|
}, p())));
|
|
84
86
|
};
|
|
85
87
|
export {
|
|
86
|
-
|
|
88
|
+
Q as Checkbox
|
|
87
89
|
};
|
|
88
90
|
//# sourceMappingURL=index23.js.map
|
package/dist/index23.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index23.js","sources":["../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { FC, useState, useEffect } from 'react';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes } from '../../utils/a11y';\nimport { mergeIds } from '../../utils/mergeIds';\nimport './style.scss';\n\nexport interface CheckboxProps {\n className?: string;\n automationId?: string;\n defaultChecked?: boolean;\n /**\n * Controlled checked value. When provided, the checkbox is controlled by the parent\n * and its visual state always reflects this prop. Use `onChange` to update the parent state.\n */\n checked?: boolean;\n onChange?: (checked: boolean, e: React.ChangeEvent<HTMLInputElement>) => void;\n disabled?: boolean;\n checkMarkType?: 'tick' | 'minus-checkbox' | '';\n label?: string;\n disabledLabel?: string;\n containerAutomationId?: string;\n /**\n * Explicit accessible name for the checkbox.\n * Used as fallback when ariaLabelledBy is not provided and no internal label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this checkbox (for screen reader association).\n * Typically used when checkbox is part of a larger labelled context.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this checkbox (provides additional context).\n * Often used for help text or instructions.\n */\n ariaDescribedBy?: string;\n /**\n * Override the default tabIndex. Pass -1 when the checkbox is used as a\n * visual-only indicator inside a composite widget (e.g. listbox option).\n */\n tabIndex?: number;\n /**\n * When true, sets aria-hidden=\"true\" on the checkbox container so the\n * checkbox role and state are hidden from assistive technology. Use when\n * the checkbox is purely visual (e.g. inside a role=\"option\" that already\n * conveys selection state via aria-selected).\n */\n ariaHidden?: boolean;\n}\n\nexport const Checkbox: FC<CheckboxProps> = ({\n className = '',\n automationId = '',\n defaultChecked = false,\n checked,\n disabled = false,\n onChange,\n checkMarkType = '',\n label = '',\n disabledLabel = '',\n containerAutomationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n tabIndex: tabIndexProp,\n ariaHidden = false\n}) => {\n const isControlled = checked !== undefined;\n const [isChecked, setIsChecked] = useState(isControlled ? checked : defaultChecked);\n\n useEffect(() => {\n if (isControlled) {\n setIsChecked(checked!);\n } else {\n setIsChecked(defaultChecked);\n }\n }, [checked, defaultChecked]);\n\n const handleClick = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n if (!isControlled) {\n setIsChecked((prev) => !prev);\n }\n onChange?.(isControlled ? !checked : !isChecked, e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLLabelElement | HTMLSpanElement>) => {\n if (disabled) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const newChecked = isControlled ? !checked : !isChecked;\n if (!isControlled) {\n setIsChecked(newChecked);\n }\n\n // Create a proper synthetic event for the onChange callback\n const inputElement = e.currentTarget.closest('label')?.querySelector('input');\n if (inputElement) {\n const syntheticEvent = {\n target: inputElement,\n currentTarget: inputElement\n } as React.ChangeEvent<HTMLInputElement>;\n onChange?.(newChecked, syntheticEvent);\n }\n }\n };\n\n const getCheckBoxClassName = () => {\n // Handle disabled states with proper checked status\n if (disabled) {\n if (isChecked && checkMarkType === 'tick') return 'disabled-tick';\n if (isChecked && checkMarkType === 'minus-checkbox') return 'disabled-minus-checkbox';\n if (isChecked && !checkMarkType) return 'disabled-tick'; // Default to tick for checked disabled\n return 'disabled-default'; // Unchecked disabled\n }\n\n // Handle enabled states\n if (checkMarkType === 'minus-checkbox' && isChecked) return 'minus-checkbox';\n return isChecked ? 'checked' : 'unchecked';\n };\n\n const getLabelClassName = () => {\n return disabled ? 'checkbox-label-disabled' : 'checkbox-label';\n };\n\n const getLabelText = () => {\n if (disabled && disabledLabel) {\n return disabledLabel;\n }\n return label;\n };\n\n // Generate stable IDs (persists across renders)\n const inputId = useStableId(undefined, 'checkbox-input');\n const labelId = label ? `${inputId}-label` : undefined;\n\n const a11yNameAttributes = getA11yNameAttributes({\n ariaLabelledBy: mergeIds(labelId, ariaLabelledBy),\n ariaLabel,\n ariaDescribedBy\n });\n\n // Determine aria-checked value: \"mixed\" for indeterminate, \"true\" for checked, \"false\" for unchecked\n const getAriaChecked = () => {\n if (checkMarkType === 'minus-checkbox' && isChecked) {\n return 'mixed'; // Indeterminate/half-checked state\n }\n return isChecked ? 'true' : 'false';\n };\n\n return (\n <div className=\"se-design-checkbox-ctn\" aria-hidden={ariaHidden ? 'true' : undefined}>\n <label\n role=\"checkbox\"\n htmlFor={inputId}\n className={`se-design-checkbox ${className} ${getCheckBoxClassName()}`}\n data-automation-id={containerAutomationId || 'checkbox-container'}\n tabIndex={tabIndexProp !== undefined ? tabIndexProp : disabled ? -1 : 0}\n aria-checked={getAriaChecked()}\n aria-disabled={disabled ? 'true' : 'false'}\n {...a11yNameAttributes}\n onKeyDown={handleKeyDown}\n >\n <input\n id={inputId}\n type=\"checkbox\"\n checked={isChecked}\n onChange={handleClick}\n disabled={disabled}\n tabIndex={-1}\n aria-hidden=\"true\"\n />\n <span className=\"checkbox-item\" data-automation-id={automationId}></span>\n {getLabelText()?.length > 0 && (\n <span\n id={labelId}\n className={getLabelClassName()}\n data-automation-id={automationId || (label ? `checkbox-label-${label}` : 'checkbox-label')}\n >\n {getLabelText()}\n </span>\n )}\n </label>\n </div>\n );\n};\n"],"names":["Checkbox","className","automationId","defaultChecked","checked","disabled","onChange","checkMarkType","label","disabledLabel","containerAutomationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","tabIndex","tabIndexProp","ariaHidden","isControlled","undefined","isChecked","setIsChecked","useState","useEffect","handleClick","e","prev","handleKeyDown","key","preventDefault","stopPropagation","newChecked","inputElement","currentTarget","closest","querySelector","target","getCheckBoxClassName","getLabelClassName","getLabelText","inputId","useStableId","labelId","a11yNameAttributes","getA11yNameAttributes","mergeIds","getAriaChecked","React","createElement","_extends","role","htmlFor","onKeyDown","id","type","length"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index23.js","sources":["../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { FC, useState, useEffect } from 'react';\nimport { useStableId } from '../../utils/useStableId';\nimport { getA11yNameAttributes } from '../../utils/a11y';\nimport { mergeIds } from '../../utils/mergeIds';\nimport './style.scss';\n\nexport interface CheckboxProps {\n className?: string;\n automationId?: string;\n defaultChecked?: boolean;\n /**\n * Controlled checked value. When provided, the checkbox is controlled by the parent\n * and its visual state always reflects this prop. Use `onChange` to update the parent state.\n */\n checked?: boolean;\n onChange?: (checked: boolean, e: React.ChangeEvent<HTMLInputElement>) => void;\n disabled?: boolean;\n checkMarkType?: 'tick' | 'minus-checkbox' | '';\n label?: string;\n disabledLabel?: string;\n containerAutomationId?: string;\n /**\n * Explicit accessible name for the checkbox.\n * Used as fallback when ariaLabelledBy is not provided and no internal label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this checkbox (for screen reader association).\n * Typically used when checkbox is part of a larger labelled context.\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this checkbox (provides additional context).\n * Often used for help text or instructions.\n */\n ariaDescribedBy?: string;\n /**\n * ID of the element controlled by this checkbox (e.g. an expandable region).\n */\n ariaControls?: string;\n /**\n * Override the default tabIndex. Pass -1 when the checkbox is used as a\n * visual-only indicator inside a composite widget (e.g. listbox option).\n */\n tabIndex?: number;\n /**\n * When true, sets aria-hidden=\"true\" on the checkbox container so the\n * checkbox role and state are hidden from assistive technology. Use when\n * the checkbox is purely visual (e.g. inside a role=\"option\" that already\n * conveys selection state via aria-selected).\n */\n ariaHidden?: boolean;\n}\n\nexport const Checkbox: FC<CheckboxProps> = ({\n className = '',\n automationId = '',\n defaultChecked = false,\n checked,\n disabled = false,\n onChange,\n checkMarkType = '',\n label = '',\n disabledLabel = '',\n containerAutomationId = '',\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ariaControls,\n tabIndex: tabIndexProp,\n ariaHidden = false\n}) => {\n const isControlled = checked !== undefined;\n const [isChecked, setIsChecked] = useState(isControlled ? checked : defaultChecked);\n\n useEffect(() => {\n if (isControlled) {\n setIsChecked(checked!);\n } else {\n setIsChecked(defaultChecked);\n }\n }, [checked, defaultChecked]);\n\n const handleClick = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n if (!isControlled) {\n setIsChecked((prev) => !prev);\n }\n onChange?.(isControlled ? !checked : !isChecked, e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLLabelElement | HTMLSpanElement>) => {\n if (disabled) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const newChecked = isControlled ? !checked : !isChecked;\n if (!isControlled) {\n setIsChecked(newChecked);\n }\n\n // Create a proper synthetic event for the onChange callback\n const inputElement = e.currentTarget.closest('label')?.querySelector('input');\n if (inputElement) {\n const syntheticEvent = {\n target: inputElement,\n currentTarget: inputElement\n } as React.ChangeEvent<HTMLInputElement>;\n onChange?.(newChecked, syntheticEvent);\n }\n }\n };\n\n const getCheckBoxClassName = () => {\n // Handle disabled states with proper checked status\n if (disabled) {\n if (isChecked && checkMarkType === 'tick') return 'disabled-tick';\n if (isChecked && checkMarkType === 'minus-checkbox') return 'disabled-minus-checkbox';\n if (isChecked && !checkMarkType) return 'disabled-tick'; // Default to tick for checked disabled\n return 'disabled-default'; // Unchecked disabled\n }\n\n // Handle enabled states\n if (checkMarkType === 'minus-checkbox' && isChecked) return 'minus-checkbox';\n return isChecked ? 'checked' : 'unchecked';\n };\n\n const getLabelClassName = () => {\n return disabled ? 'checkbox-label-disabled' : 'checkbox-label';\n };\n\n const getLabelText = () => {\n if (disabled && disabledLabel) {\n return disabledLabel;\n }\n return label;\n };\n\n // Generate stable IDs (persists across renders)\n const inputId = useStableId(undefined, 'checkbox-input');\n const labelId = label ? `${inputId}-label` : undefined;\n\n const a11yNameAttributes = getA11yNameAttributes({\n ariaLabelledBy: mergeIds(labelId, ariaLabelledBy),\n ariaLabel,\n ariaDescribedBy\n });\n\n // Determine aria-checked value: \"mixed\" for indeterminate, \"true\" for checked, \"false\" for unchecked\n const getAriaChecked = () => {\n if (checkMarkType === 'minus-checkbox' && isChecked) {\n return 'mixed'; // Indeterminate/half-checked state\n }\n return isChecked ? 'true' : 'false';\n };\n\n return (\n <div className=\"se-design-checkbox-ctn\" aria-hidden={ariaHidden ? 'true' : undefined}>\n <label\n role=\"checkbox\"\n htmlFor={inputId}\n className={`se-design-checkbox ${className} ${getCheckBoxClassName()}`}\n data-automation-id={containerAutomationId || 'checkbox-container'}\n tabIndex={tabIndexProp !== undefined ? tabIndexProp : disabled ? -1 : 0}\n aria-checked={getAriaChecked()}\n aria-disabled={disabled ? 'true' : 'false'}\n aria-controls={ariaControls}\n {...a11yNameAttributes}\n onKeyDown={handleKeyDown}\n >\n <input\n id={inputId}\n type=\"checkbox\"\n checked={isChecked}\n onChange={handleClick}\n disabled={disabled}\n tabIndex={-1}\n aria-hidden=\"true\"\n />\n <span className=\"checkbox-item\" data-automation-id={automationId}></span>\n {getLabelText()?.length > 0 && (\n <span\n id={labelId}\n className={getLabelClassName()}\n data-automation-id={automationId || (label ? `checkbox-label-${label}` : 'checkbox-label')}\n >\n {getLabelText()}\n </span>\n )}\n </label>\n </div>\n );\n};\n"],"names":["Checkbox","className","automationId","defaultChecked","checked","disabled","onChange","checkMarkType","label","disabledLabel","containerAutomationId","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaControls","tabIndex","tabIndexProp","ariaHidden","isControlled","undefined","isChecked","setIsChecked","useState","useEffect","handleClick","e","prev","handleKeyDown","key","preventDefault","stopPropagation","newChecked","inputElement","currentTarget","closest","querySelector","target","getCheckBoxClassName","getLabelClassName","getLabelText","inputId","useStableId","labelId","a11yNameAttributes","getA11yNameAttributes","mergeIds","getAriaChecked","React","createElement","_extends","role","htmlFor","onKeyDown","id","type","length"],"mappings":";;;;;;;;;;;;;;;AAsDO,MAAMA,IAA8BA,CAAC;AAAA,EAC1CC,WAAAA,IAAY;AAAA,EACZC,cAAAA,IAAe;AAAA,EACfC,gBAAAA,IAAiB;AAAA,EACjBC,SAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,UAAAA;AAAAA,EACAC,eAAAA,IAAgB;AAAA,EAChBC,OAAAA,IAAQ;AAAA,EACRC,eAAAA,IAAgB;AAAA,EAChBC,uBAAAA,IAAwB;AAAA,EACxBC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,UAAUC;AAAAA,EACVC,YAAA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;AAAAA,IACAE,iBAAAA;AAAAA,EAAAA,CACD,GAGKiC,IAAiBA,MACjBvC,MAAkB,oBAAoBa,IACjC,UAEFA,IAAY,SAAS;AAG9B,SACE2B,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAK/C,WAAU;AAAA,IAAyB,eAAagB,IAAa,SAASE;AAAAA,EAAAA,GACzE4B,gBAAAA,EAAAC,cAAA,SAAAC,EAAA;AAAA,IACEC,MAAK;AAAA,IACLC,SAASX;AAAAA,IACTvC,WAAW,sBAAsBA,CAAS,IAAIoC,GAAsB;AAAA,IACpE,sBAAoB3B,KAAyB;AAAA,IAC7CK,UAAUC,MAAiBG,SAAYH,IAAeX,IAAW,KAAK;AAAA,IACtE,gBAAcyC,EAAAA;AAAAA,IACd,iBAAezC,IAAW,SAAS;AAAA,IACnC,iBAAeS;AAAAA,EAAAA,GACX6B,GAAkB;AAAA,IACtBS,WAAWzB;AAAAA,EAAAA,CAAc,GAEzBoB,gBAAAA,EAAAC,cAAA,SAAA;AAAA,IACEK,IAAIb;AAAAA,IACJc,MAAK;AAAA,IACLlD,SAASgB;AAAAA,IACTd,UAAUkB;AAAAA,IACVnB,UAAAA;AAAAA,IACAU,UAAU;AAAA,IACV,eAAY;AAAA,EAAA,CACb,GACDgC,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAM/C,WAAU;AAAA,IAAgB,sBAAoBC;AAAAA,EAAAA,CAAoB,GACvEqC,EAAAA,GAAgBgB,SAAS,KACxBR,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IACEK,IAAIX;AAAAA,IACJzC,WAAWqC,EAAAA;AAAAA,IACX,sBAAoBpC,MAAiBM,IAAQ,kBAAkBA,CAAK,KAAK;AAAA,EAAA,GAExE+B,EAAAA,CACG,CAEH,CACJ;AAET;"}
|
package/dist/index231.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import d, { forwardRef as b } from "react";
|
|
2
|
+
import { Button as p } from "./index4.js";
|
|
3
|
+
function n() {
|
|
4
|
+
return n = Object.assign ? Object.assign.bind() : function(a) {
|
|
5
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
6
|
+
var e = arguments[t];
|
|
7
|
+
for (var r in e) ({}).hasOwnProperty.call(e, r) && (a[r] = e[r]);
|
|
8
|
+
}
|
|
9
|
+
return a;
|
|
10
|
+
}, n.apply(null, arguments);
|
|
11
|
+
}
|
|
12
|
+
const g = /* @__PURE__ */ b(({
|
|
13
|
+
id: a,
|
|
14
|
+
label: t,
|
|
15
|
+
isSelected: e,
|
|
16
|
+
isDisabled: r = !1,
|
|
17
|
+
panelId: o,
|
|
18
|
+
tabIndex: s,
|
|
19
|
+
className: l = "",
|
|
20
|
+
automationId: u,
|
|
21
|
+
onClick: i,
|
|
22
|
+
onFocus: c,
|
|
23
|
+
onKeyDown: f
|
|
24
|
+
}, m) => /* @__PURE__ */ d.createElement(p, n({
|
|
25
|
+
ref: m,
|
|
26
|
+
type: "unstyled",
|
|
27
|
+
label: t,
|
|
28
|
+
disabled: r,
|
|
29
|
+
onClick: i,
|
|
30
|
+
className: l,
|
|
31
|
+
automationId: u,
|
|
32
|
+
role: "tab",
|
|
33
|
+
id: a,
|
|
34
|
+
"aria-selected": e
|
|
35
|
+
}, o ? {
|
|
36
|
+
"aria-controls": o
|
|
37
|
+
} : {}, {
|
|
38
|
+
tabIndex: s,
|
|
39
|
+
onFocus: c,
|
|
40
|
+
onKeyDown: f
|
|
41
|
+
})));
|
|
42
|
+
g.displayName = "TabButton";
|
|
43
|
+
export {
|
|
44
|
+
g as TabButton
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=index231.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index231.js","sources":["../src/components/NavigationBar/TabButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Button } from '../Button';\n\nexport interface TabButtonProps {\n id: string;\n label: string;\n isSelected: boolean;\n isDisabled?: boolean;\n panelId?: string;\n tabIndex: number;\n className?: string;\n automationId?: string;\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n onFocus: () => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n}\n\n/**\n * Internal TabButton component for NavigationBar.\n * Uses Button (unstyled) internally for consistent activation handling.\n * Supports forwardRef for focus management (roving tabindex).\n */\nexport const TabButton = forwardRef<HTMLButtonElement, TabButtonProps>(\n (\n {\n id,\n label,\n isSelected,\n isDisabled = false,\n panelId,\n tabIndex,\n className = '',\n automationId,\n onClick,\n onFocus,\n onKeyDown\n },\n ref\n ) => {\n return (\n <Button\n ref={ref}\n type=\"unstyled\"\n label={label}\n disabled={isDisabled}\n onClick={onClick}\n className={className}\n automationId={automationId}\n role=\"tab\"\n id={id}\n aria-selected={isSelected}\n {...(panelId ? { 'aria-controls': panelId } : {})}\n tabIndex={tabIndex}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n />\n );\n }\n);\n\nTabButton.displayName = 'TabButton';\n"],"names":["TabButton","id","label","isSelected","isDisabled","panelId","tabIndex","className","automationId","onClick","onFocus","onKeyDown","ref","React","createElement","Button","_extends","type","disabled","role","displayName"],"mappings":";;;;;;;;;;;AAsBO,MAAMA,sBACX,CACE;AAAA,EACEC,IAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,YAAAA,IAAa;AAAA,EACbC,SAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,WAAAA,IAAY;AAAA,EACZC,cAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAC,WAAAA;AACF,GACAC,MAGEC,gBAAAA,EAAAC,cAACC,GAAMC,EAAA;AAAA,EACLJ,KAAAA;AAAAA,EACAK,MAAK;AAAA,EACLf,OAAAA;AAAAA,EACAgB,UAAUd;AAAAA,EACVK,SAAAA;AAAAA,EACAF,WAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAW,MAAK;AAAA,EACLlB,IAAAA;AAAAA,EACA,iBAAeE;AAAAA,GACVE,IAAU;AAAA,EAAE,iBAAiBA;AAAAA,IAAY,IAAE;AAAA,EAChDC,UAAAA;AAAAA,EACAI,SAAAA;AAAAA,EACAC,WAAAA;AAAAA,CAAqB,CACtB,CAGP;AAEAX,EAAUoB,cAAc;"}
|
package/dist/index24.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index24.js","sources":["../src/components/ColorCodedLabel/index.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Badge } from 'src/components/Badge';\n\nexport type ColorCodedLabelProps = {\n label: string;\n tag?: string;\n color?: string;\n onClick?: () => void;\n};\n\nexport const ColorCodedLabel: FC<ColorCodedLabelProps> = (props) => {\n const { label, color, onClick = () => {}, tag } = props;\n return (\n <div\n className=\"se-design-color-coded-label flex items-center gap-2\"\n onClick={onClick}\n >\n {color && <span className=\"w-[15px] h-[15px] rounded-[3px] inline-block\" style={{ backgroundColor: color }}></span>}\n <div>{label}</div>\n {tag && <Badge label={tag} />}\n </div>\n );\n};\n"],"names":["React__default","Badge","ColorCodedLabel","props","label","color","onClick","tag","React","createElement","className","style","backgroundColor"],"mappings":"AAUO,OAAAA,OAAA;AAAA,SAAA,SAAAC,SAAA;AAAA,MAAMC,IAA6CC,
|
|
1
|
+
{"version":3,"file":"index24.js","sources":["../src/components/ColorCodedLabel/index.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Badge } from 'src/components/Badge';\n\nexport type ColorCodedLabelProps = {\n label: string;\n tag?: string;\n color?: string;\n onClick?: () => void;\n};\n\nexport const ColorCodedLabel: FC<ColorCodedLabelProps> = (props) => {\n const { label, color, onClick = () => {}, tag } = props;\n return (\n <div\n className=\"se-design-color-coded-label flex items-center gap-2\"\n onClick={onClick}\n >\n {color && <span className=\"w-[15px] h-[15px] rounded-[3px] inline-block\" style={{ backgroundColor: color }}></span>}\n <div>{label}</div>\n {tag && <Badge label={tag} />}\n </div>\n );\n};\n"],"names":["React__default","Badge","ColorCodedLabel","props","label","color","onClick","tag","React","createElement","className","style","backgroundColor"],"mappings":"AAUO,OAAAA,OAAA;AAAA,SAAA,SAAAC,SAAA;AAAA,MAAMC,IAA6CC,CAAAA,MAAU;AAClE,QAAM;AAAA,IAAEC,OAAAA;AAAAA,IAAOC,OAAAA;AAAAA,IAAOC,SAAAA,IAAUA,MAAM;AAAA,IAAC;AAAA,IAAGC,KAAAA;AAAAA,EAAAA,IAAQJ;AAClD,SACEK,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEC,WAAU;AAAA,IACVJ,SAAAA;AAAAA,EAAAA,GAECD,KAASG,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAMC,WAAU;AAAA,IAA+CC,OAAO;AAAA,MAAEC,iBAAiBP;AAAAA,IAAAA;AAAAA,EAAM,CAAS,GAClHG,gBAAAA,EAAAC,cAAA,OAAA,MAAML,CAAW,GAChBG,KAAOC,gBAAAA,EAAAC,cAACR,GAAK;AAAA,IAACG,OAAOG;AAAAA,EAAAA,CAAM,CACzB;AAET;"}
|
package/dist/index240.js
CHANGED
|
@@ -1,22 +1,173 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useState as W, useMemo as F, useEffect as N, useCallback as S } from "react";
|
|
2
|
+
import { useRovingFocus as C } from "./index70.js";
|
|
3
|
+
const z = (e, n, s, g, m, D = !1) => {
|
|
4
|
+
const i = e.toLocaleDateString("en-US", {
|
|
5
|
+
weekday: "long",
|
|
6
|
+
month: "long",
|
|
7
|
+
day: "numeric",
|
|
8
|
+
year: "numeric"
|
|
9
|
+
});
|
|
10
|
+
return m ? i : g ? `${i}, start and end of range` : n ? `${i}, start of range` : s ? `${i}, end of range` : D ? `${i}, in range` : i;
|
|
11
|
+
}, y = (e) => {
|
|
12
|
+
const n = e.getFullYear(), s = String(e.getMonth() + 1).padStart(2, "0"), g = String(e.getDate()).padStart(2, "0");
|
|
13
|
+
return `date-${n}-${s}-${g}`;
|
|
14
|
+
}, k = (e, n) => new Date(e, n + 1, 0).getDate(), L = (e) => {
|
|
15
|
+
const n = e.getFullYear(), s = e.getMonth();
|
|
16
|
+
return Array.from({
|
|
17
|
+
length: k(n, s)
|
|
18
|
+
}, (g, m) => y(new Date(n, s, m + 1)));
|
|
19
|
+
}, x = (e, n, s) => {
|
|
20
|
+
const g = e.getFullYear(), m = e.getMonth(), D = (a) => a.getFullYear() === g && a.getMonth() === m;
|
|
21
|
+
if (s.startDate && D(s.startDate)) {
|
|
22
|
+
const a = new Date(s.startDate);
|
|
23
|
+
a.setHours(0, 0, 0, 0);
|
|
24
|
+
const l = y(a);
|
|
25
|
+
if (n.includes(l)) return l;
|
|
26
|
+
}
|
|
27
|
+
if (s.endDate && D(s.endDate)) {
|
|
28
|
+
const a = new Date(s.endDate);
|
|
29
|
+
a.setHours(0, 0, 0, 0);
|
|
30
|
+
const l = y(a);
|
|
31
|
+
if (n.includes(l)) return l;
|
|
32
|
+
}
|
|
33
|
+
const i = /* @__PURE__ */ new Date();
|
|
34
|
+
if (D(i)) {
|
|
35
|
+
const a = y(i);
|
|
36
|
+
if (n.includes(a)) return a;
|
|
37
|
+
}
|
|
38
|
+
return n[0] || "";
|
|
4
39
|
};
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
40
|
+
function B({
|
|
41
|
+
leftMonth: e,
|
|
42
|
+
rightMonth: n,
|
|
43
|
+
showSingleMonth: s,
|
|
44
|
+
selectedRange: g,
|
|
45
|
+
onMonthChange: m
|
|
11
46
|
}) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
47
|
+
const [D, i] = W(null), a = F(() => L(e), [e]), l = F(() => L(n), [n]), E = F(() => x(e, a, g), [e, a, g]), H = F(() => x(n, l, g), [n, l, g]), {
|
|
48
|
+
getRovingItemProps: Y,
|
|
49
|
+
focusItem: I,
|
|
50
|
+
getContainerProps: U
|
|
51
|
+
} = C({
|
|
52
|
+
itemIds: a,
|
|
53
|
+
defaultFocusedId: E,
|
|
54
|
+
orientation: "grid",
|
|
55
|
+
cols: 7,
|
|
56
|
+
loop: !1,
|
|
57
|
+
role: "grid"
|
|
58
|
+
}), {
|
|
59
|
+
getRovingItemProps: M,
|
|
60
|
+
focusItem: h,
|
|
61
|
+
getContainerProps: G
|
|
62
|
+
} = C({
|
|
63
|
+
itemIds: l,
|
|
64
|
+
defaultFocusedId: H,
|
|
65
|
+
orientation: "grid",
|
|
66
|
+
cols: 7,
|
|
67
|
+
loop: !1,
|
|
68
|
+
role: "grid"
|
|
69
|
+
});
|
|
70
|
+
N(() => {
|
|
71
|
+
if (!D) return;
|
|
72
|
+
const f = y(D);
|
|
73
|
+
a.includes(f) ? (I(f), i(null)) : l.includes(f) && (h(f), i(null));
|
|
74
|
+
}, [D, a, l, I, h]);
|
|
75
|
+
const b = S((f, K) => {
|
|
76
|
+
const v = s || K === "left";
|
|
77
|
+
m(new Date(f.getFullYear(), f.getMonth(), 1), v), i(new Date(f));
|
|
78
|
+
}, [s, m]);
|
|
79
|
+
return {
|
|
80
|
+
getGridCellProps: S(({
|
|
81
|
+
isLeftCalendar: f,
|
|
82
|
+
isDateDisabled: K,
|
|
83
|
+
handleDateClick: v
|
|
84
|
+
}) => {
|
|
85
|
+
const A = f ? "left" : "right", $ = f ? I : h, O = f ? Y : M, R = (t, p) => {
|
|
86
|
+
const c = p.getFullYear(), o = p.getMonth(), d = p.getDate(), w = (r) => {
|
|
87
|
+
if (r.getFullYear() !== c || r.getMonth() !== o) {
|
|
88
|
+
b(r, A);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
$(y(r));
|
|
92
|
+
};
|
|
93
|
+
switch (t.key) {
|
|
94
|
+
case "ArrowLeft":
|
|
95
|
+
t.preventDefault(), t.stopPropagation(), w(new Date(c, o, d - 1));
|
|
96
|
+
break;
|
|
97
|
+
case "ArrowRight":
|
|
98
|
+
t.preventDefault(), t.stopPropagation(), w(new Date(c, o, d + 1));
|
|
99
|
+
break;
|
|
100
|
+
case "ArrowUp":
|
|
101
|
+
t.preventDefault(), t.stopPropagation(), w(new Date(c, o, d - 7));
|
|
102
|
+
break;
|
|
103
|
+
case "ArrowDown":
|
|
104
|
+
t.preventDefault(), t.stopPropagation(), w(new Date(c, o, d + 7));
|
|
105
|
+
break;
|
|
106
|
+
case "Home": {
|
|
107
|
+
t.preventDefault(), t.stopPropagation();
|
|
108
|
+
const r = p.getDay(), u = new Date(c, o, d - r), P = u.getMonth() !== o ? new Date(c, o, 1) : u;
|
|
109
|
+
$(y(P));
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case "End": {
|
|
113
|
+
t.preventDefault(), t.stopPropagation();
|
|
114
|
+
const r = p.getDay(), u = new Date(c, o, d + (6 - r)), P = k(c, o), T = u.getMonth() !== o ? new Date(c, o, P) : u;
|
|
115
|
+
$(y(T));
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "PageUp": {
|
|
119
|
+
t.preventDefault(), t.stopPropagation();
|
|
120
|
+
const r = t.shiftKey ? c - 1 : c, u = t.shiftKey ? o : o - 1, P = Math.min(d, k(r, u));
|
|
121
|
+
b(new Date(r, u, P), A);
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "PageDown": {
|
|
125
|
+
t.preventDefault(), t.stopPropagation();
|
|
126
|
+
const r = t.shiftKey ? c + 1 : c, u = t.shiftKey ? o : o + 1, P = Math.min(d, k(r, u));
|
|
127
|
+
b(new Date(r, u, P), A);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "Enter":
|
|
131
|
+
case " ":
|
|
132
|
+
t.preventDefault(), K(p) || v(p);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
return ({
|
|
137
|
+
cellId: t,
|
|
138
|
+
cellDate: p,
|
|
139
|
+
disabled: c,
|
|
140
|
+
ariaLabel: o,
|
|
141
|
+
ariaCurrent: d,
|
|
142
|
+
ariaDisabled: w
|
|
143
|
+
}) => {
|
|
144
|
+
const r = O(t);
|
|
145
|
+
return {
|
|
146
|
+
id: t,
|
|
147
|
+
ref: r.ref,
|
|
148
|
+
tabIndex: r.tabIndex,
|
|
149
|
+
onFocus: r.onFocus,
|
|
150
|
+
"aria-label": o,
|
|
151
|
+
"aria-current": d,
|
|
152
|
+
"aria-disabled": w,
|
|
153
|
+
onKeyDown: (u) => R(u, p),
|
|
154
|
+
onClick: () => {
|
|
155
|
+
c || v(p);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
}, [b, I, h, Y, M]),
|
|
160
|
+
getLeftRovingItemProps: Y,
|
|
161
|
+
getRightRovingItemProps: M,
|
|
162
|
+
getLeftContainerProps: U,
|
|
163
|
+
getRightContainerProps: G,
|
|
164
|
+
focusLeftItem: I,
|
|
165
|
+
focusRightItem: h
|
|
166
|
+
};
|
|
18
167
|
}
|
|
19
168
|
export {
|
|
20
|
-
|
|
169
|
+
y as formatDateId,
|
|
170
|
+
z as getCellAriaLabel,
|
|
171
|
+
B as useDatePickerA11y
|
|
21
172
|
};
|
|
22
173
|
//# sourceMappingURL=index240.js.map
|
package/dist/index240.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index240.js","sources":["../src/utils/a11y/useScrollActiveIntoView.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nconst DEFAULT_SCROLL_OPTIONS: ScrollIntoViewOptions = { block: 'nearest' };\n\nexport interface UseScrollActiveIntoViewOptions {\n /**\n * Ref to the container element\n */\n containerRef?: RefObject<HTMLElement | null>;\n \n /**\n * Index of the currently active/highlighted item (-1 if none)\n */\n activeIndex: number;\n \n /**\n * CSS selector for item elements\n * Default: '[role=\"option\"]'\n */\n itemSelector?: string;\n \n /**\n * Whether scrolling is enabled\n * Default: true\n */\n enabled?: boolean;\n \n /**\n * ScrollIntoView options\n * Default: { block: 'nearest' }\n */\n scrollOptions?: ScrollIntoViewOptions;\n}\n\n/**\n * Hook to automatically scroll the active item into view.\n * \n * Useful for aria-activedescendant patterns where DOM focus stays\n * on the container (e.g., input field) but we need to visually show\n * which descendant option is logically active.\n * \n * Common use cases:\n * - Combobox dropdown options\n * - Menu items with virtual focus\n * - Grid cells with keyboard navigation\n * - Tree view items\n * - Listbox options\n * \n * @example\n * ```tsx\n * const [highlightedIndex, setHighlightedIndex] = useState(-1);\n * const listboxRef = useRef<HTMLDivElement>(null);\n * \n * useScrollActiveIntoView({\n * containerRef: listboxRef,\n * activeIndex: highlightedIndex,\n * itemSelector: '[role=\"option\"]'\n * });\n * \n * // Now when highlightedIndex changes, the item scrolls into view\n * ```\n * \n * @example Custom scroll behavior\n * ```tsx\n * useScrollActiveIntoView({\n * containerRef: menuRef,\n * activeIndex: activeMenuIndex,\n * itemSelector: '[role=\"menuitem\"]',\n * scrollOptions: { block: 'center', behavior: 'smooth' }\n * });\n * ```\n */\nexport function useScrollActiveIntoView({\n containerRef,\n activeIndex,\n itemSelector = '[role=\"option\"]',\n enabled = true,\n scrollOptions = DEFAULT_SCROLL_OPTIONS\n}: UseScrollActiveIntoViewOptions): void {\n useEffect(() => {\n // Early returns for disabled states\n if (!enabled || activeIndex < 0 || !containerRef?.current) {\n return;\n }\n \n const container = containerRef.current;\n const items = container.querySelectorAll(itemSelector);\n const activeItem = items[activeIndex] as HTMLElement;\n \n if (activeItem) {\n activeItem.scrollIntoView(scrollOptions);\n }\n }, [activeIndex, containerRef, itemSelector, enabled, scrollOptions]);\n}\n"],"names":["useEffect","DEFAULT_SCROLL_OPTIONS","block","useScrollActiveIntoView","containerRef","activeIndex","itemSelector","enabled","scrollOptions","current","activeItem","querySelectorAll","scrollIntoView"],"mappings":"AAGA,SAAA,aAAAA,SAAA;AAAA,MAAMC,IAAgD;AAAA,EAAEC,OAAO;AAAU;AAsElE,SAASC,EAAwB;AAAA,EACtCC,cAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,SAAAA,IAAU;AAAA,EACVC,eAAAA,IAAgBP;AACc,GAAS;AACvCD,EAAAA,EAAU,MAAM;AAEd,QAAI,CAACO,KAAWF,IAAc,KAAK,CAACD,GAAcK;AAChD;AAKIC,UAAAA,IAFYN,EAAaK,QACPE,iBAAiBL,CAAY,EAC5BD,CAAW;AAEpC,IAAIK,KACFA,EAAWE,eAAeJ,CAAa;AAAA,EACzC,GACC,CAACH,GAAaD,GAAcE,GAAcC,GAASC,CAAa,CAAC;AACtE;"}
|
|
1
|
+
{"version":3,"file":"index240.js","sources":["../src/components/DatePicker/useDatePickerA11y.ts"],"sourcesContent":["import React, { useState, useCallback, useEffect, useMemo } from 'react';\n\nimport { useRovingFocus, RovingItemProps, RovingContainerProps, AccessibleNameInput } from '../../utils/a11y/useRovingFocus';\nimport type { DateRange } from './index';\n\nexport const getCellAriaLabel = (\n date: Date,\n isStart: boolean,\n isEnd: boolean,\n isSameStartEnd: boolean,\n singleDateSelection: boolean,\n inRange: boolean = false\n): string => {\n const base = date.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric'\n });\n if (singleDateSelection) return base;\n if (isSameStartEnd) return `${base}, start and end of range`;\n if (isStart) return `${base}, start of range`;\n if (isEnd) return `${base}, end of range`;\n if (inRange) return `${base}, in range`;\n return base;\n};\n\nexport const formatDateId = (d: Date) => {\n const y = d.getFullYear();\n const m = String(d.getMonth() + 1).padStart(2, '0');\n const dd = String(d.getDate()).padStart(2, '0');\n return `date-${y}-${m}-${dd}`;\n};\n\nconst getDaysInMonth = (year: number, month: number) => new Date(year, month + 1, 0).getDate();\n\nconst getPanelItemIds = (panelDate: Date): string[] => {\n const year = panelDate.getFullYear();\n const month = panelDate.getMonth();\n return Array.from({ length: getDaysInMonth(year, month) }, (_, i) =>\n formatDateId(new Date(year, month, i + 1))\n );\n};\n\nconst getPanelDefaultFocusId = (panelDate: Date, itemIds: string[], selectedRange: DateRange): string => {\n const year = panelDate.getFullYear();\n const month = panelDate.getMonth();\n const isInPanel = (d: Date) => d.getFullYear() === year && d.getMonth() === month;\n\n // Prefer startDate if it falls in this panel\n if (selectedRange.startDate && isInPanel(selectedRange.startDate)) {\n const d = new Date(selectedRange.startDate);\n d.setHours(0, 0, 0, 0);\n const id = formatDateId(d);\n if (itemIds.includes(id)) return id;\n }\n // Fall back to endDate if it falls in this panel (e.g. right panel when start is in left panel)\n if (selectedRange.endDate && isInPanel(selectedRange.endDate)) {\n const d = new Date(selectedRange.endDate);\n d.setHours(0, 0, 0, 0);\n const id = formatDateId(d);\n if (itemIds.includes(id)) return id;\n }\n const today = new Date();\n if (isInPanel(today)) {\n const id = formatDateId(today);\n if (itemIds.includes(id)) return id;\n }\n return itemIds[0] || '';\n};\n\ninterface UseDatePickerA11yOptions {\n leftMonth: Date;\n rightMonth: Date;\n showSingleMonth: boolean;\n selectedRange: DateRange;\n onMonthChange: (date: Date, isLeft: boolean) => void;\n}\n\ninterface CellKeyDownOptions {\n isLeftCalendar: boolean;\n isDateDisabled: (date: Date) => boolean;\n handleDateClick: (date: Date) => void;\n}\n\ninterface GridCellItemInput {\n cellId: string;\n cellDate: Date;\n disabled: boolean;\n ariaLabel: string;\n ariaCurrent: 'date' | undefined;\n ariaDisabled: true | undefined;\n}\n\nexport interface GridCellElementProps {\n id: string;\n ref: (el: HTMLElement | null) => void;\n tabIndex: number;\n onFocus: () => void;\n 'aria-label': string;\n 'aria-current': 'date' | undefined;\n 'aria-disabled': true | undefined;\n onKeyDown: (e: React.KeyboardEvent) => void;\n onClick: () => void;\n}\n\ninterface UseDatePickerA11yReturn {\n getGridCellProps: (options: CellKeyDownOptions) => (item: GridCellItemInput) => GridCellElementProps;\n getLeftRovingItemProps: (id: string) => RovingItemProps;\n getRightRovingItemProps: (id: string) => RovingItemProps;\n getLeftContainerProps: (nameInput?: AccessibleNameInput) => RovingContainerProps;\n getRightContainerProps: (nameInput?: AccessibleNameInput) => RovingContainerProps;\n focusLeftItem: (id: string) => void;\n focusRightItem: (id: string) => void;\n}\n\nexport function useDatePickerA11y({\n leftMonth,\n rightMonth,\n showSingleMonth,\n selectedRange,\n onMonthChange\n}: UseDatePickerA11yOptions): UseDatePickerA11yReturn {\n const [keyboardFocusDate, setKeyboardFocusDate] = useState<Date | null>(null);\n\n const leftItemIds = useMemo(() => getPanelItemIds(leftMonth), [leftMonth]);\n const rightItemIds = useMemo(() => getPanelItemIds(rightMonth), [rightMonth]);\n\n const leftDefaultFocusId = useMemo(\n () => getPanelDefaultFocusId(leftMonth, leftItemIds, selectedRange),\n [leftMonth, leftItemIds, selectedRange]\n );\n const rightDefaultFocusId = useMemo(\n () => getPanelDefaultFocusId(rightMonth, rightItemIds, selectedRange),\n [rightMonth, rightItemIds, selectedRange]\n );\n\n const { getRovingItemProps: getLeftRovingItemProps, focusItem: focusLeftItem, getContainerProps: getLeftContainerProps } = useRovingFocus({\n itemIds: leftItemIds,\n defaultFocusedId: leftDefaultFocusId,\n orientation: 'grid',\n cols: 7,\n loop: false,\n role: 'grid'\n });\n\n const { getRovingItemProps: getRightRovingItemProps, focusItem: focusRightItem, getContainerProps: getRightContainerProps } = useRovingFocus({\n itemIds: rightItemIds,\n defaultFocusedId: rightDefaultFocusId,\n orientation: 'grid',\n cols: 7,\n loop: false,\n role: 'grid'\n });\n\n // After keyboard navigation shifts a panel to a new month, focus the target cell via roving focus refs\n useEffect(() => {\n if (!keyboardFocusDate) return;\n const id = formatDateId(keyboardFocusDate);\n if (leftItemIds.includes(id)) {\n focusLeftItem(id);\n setKeyboardFocusDate(null);\n } else if (rightItemIds.includes(id)) {\n focusRightItem(id);\n setKeyboardFocusDate(null);\n }\n }, [keyboardFocusDate, leftItemIds, rightItemIds, focusLeftItem, focusRightItem]);\n\n // Navigate the keyboard focus to a date that may be in a different month.\n // Each panel advances completely independently — never touches the other panel.\n const handleKeyboardNavigate = useCallback(\n (targetDate: Date, sourcePanel: 'left' | 'right') => {\n const isLeft = showSingleMonth || sourcePanel === 'left';\n onMonthChange(new Date(targetDate.getFullYear(), targetDate.getMonth(), 1), isLeft);\n setKeyboardFocusDate(new Date(targetDate));\n },\n [showSingleMonth, onMonthChange]\n );\n\n const getGridCellProps = useCallback(\n ({ isLeftCalendar, isDateDisabled, handleDateClick }: CellKeyDownOptions) => {\n const panel: 'left' | 'right' = isLeftCalendar ? 'left' : 'right';\n const focusPanelItem = isLeftCalendar ? focusLeftItem : focusRightItem;\n const getRovingItemProps = isLeftCalendar ? getLeftRovingItemProps : getRightRovingItemProps;\n\n const handleKeyDown = (e: React.KeyboardEvent, cellDate: Date) => {\n const cellYear = cellDate.getFullYear();\n const cellMonth = cellDate.getMonth();\n const cellDay = cellDate.getDate();\n\n const navigateTo = (targetDate: Date) => {\n if (targetDate.getFullYear() !== cellYear || targetDate.getMonth() !== cellMonth) {\n handleKeyboardNavigate(targetDate, panel);\n return;\n }\n focusPanelItem(formatDateId(targetDate));\n };\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay - 1));\n break;\n case 'ArrowRight':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay + 1));\n break;\n case 'ArrowUp':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay - 7));\n break;\n case 'ArrowDown':\n e.preventDefault(); e.stopPropagation();\n navigateTo(new Date(cellYear, cellMonth, cellDay + 7));\n break;\n case 'Home': {\n // First day of the current week row (Sunday), clamped to month start\n e.preventDefault(); e.stopPropagation();\n const dayOfWeek = cellDate.getDay();\n const homeDate = new Date(cellYear, cellMonth, cellDay - dayOfWeek);\n const clamped = homeDate.getMonth() !== cellMonth ? new Date(cellYear, cellMonth, 1) : homeDate;\n focusPanelItem(formatDateId(clamped));\n break;\n }\n case 'End': {\n // Last day of the current week row (Saturday), clamped to month end\n e.preventDefault(); e.stopPropagation();\n const dayOfWeek = cellDate.getDay();\n const endDate = new Date(cellYear, cellMonth, cellDay + (6 - dayOfWeek));\n const daysInThisMonth = getDaysInMonth(cellYear, cellMonth);\n const clamped =\n endDate.getMonth() !== cellMonth ? new Date(cellYear, cellMonth, daysInThisMonth) : endDate;\n focusPanelItem(formatDateId(clamped));\n break;\n }\n case 'PageUp': {\n // Shift+PageUp = previous year, PageUp = previous month\n e.preventDefault(); e.stopPropagation();\n const tYear = e.shiftKey ? cellYear - 1 : cellYear;\n const tMonth = e.shiftKey ? cellMonth : cellMonth - 1;\n const tDay = Math.min(cellDay, getDaysInMonth(tYear, tMonth));\n handleKeyboardNavigate(new Date(tYear, tMonth, tDay), panel);\n break;\n }\n case 'PageDown': {\n // Shift+PageDown = next year, PageDown = next month\n e.preventDefault(); e.stopPropagation();\n const tYear = e.shiftKey ? cellYear + 1 : cellYear;\n const tMonth = e.shiftKey ? cellMonth : cellMonth + 1;\n const tDay = Math.min(cellDay, getDaysInMonth(tYear, tMonth));\n handleKeyboardNavigate(new Date(tYear, tMonth, tDay), panel);\n break;\n }\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!isDateDisabled(cellDate)) {\n handleDateClick(cellDate);\n }\n break;\n }\n };\n\n return ({ cellId, cellDate, disabled, ariaLabel, ariaCurrent, ariaDisabled }: GridCellItemInput): GridCellElementProps => {\n const rovingProps = getRovingItemProps(cellId);\n return {\n id: cellId,\n ref: rovingProps.ref,\n tabIndex: rovingProps.tabIndex,\n onFocus: rovingProps.onFocus,\n 'aria-label': ariaLabel,\n 'aria-current': ariaCurrent,\n 'aria-disabled': ariaDisabled,\n onKeyDown: (e: React.KeyboardEvent) => handleKeyDown(e, cellDate),\n onClick: () => { if (!disabled) handleDateClick(cellDate); }\n };\n };\n },\n [handleKeyboardNavigate, focusLeftItem, focusRightItem, getLeftRovingItemProps, getRightRovingItemProps]\n );\n\n return {\n getGridCellProps,\n getLeftRovingItemProps,\n getRightRovingItemProps,\n getLeftContainerProps,\n getRightContainerProps,\n focusLeftItem,\n focusRightItem\n };\n}\n"],"names":["useState","useMemo","useEffect","useCallback","useRovingFocus","getCellAriaLabel","date","isStart","isEnd","isSameStartEnd","singleDateSelection","inRange","base","toLocaleDateString","weekday","month","day","year","formatDateId","d","y","getFullYear","m","String","getMonth","padStart","dd","getDate","getDaysInMonth","Date","getPanelItemIds","panelDate","Array","from","length","_","i","getPanelDefaultFocusId","itemIds","selectedRange","isInPanel","startDate","setHours","id","includes","endDate","today","useDatePickerA11y","leftMonth","rightMonth","showSingleMonth","onMonthChange","keyboardFocusDate","setKeyboardFocusDate","leftItemIds","rightItemIds","leftDefaultFocusId","rightDefaultFocusId","getRovingItemProps","getLeftRovingItemProps","focusItem","focusLeftItem","getContainerProps","getLeftContainerProps","defaultFocusedId","orientation","cols","loop","role","getRightRovingItemProps","focusRightItem","getRightContainerProps","handleKeyboardNavigate","targetDate","sourcePanel","isLeft","getGridCellProps","isLeftCalendar","isDateDisabled","handleDateClick","panel","focusPanelItem","handleKeyDown","e","cellDate","cellYear","cellMonth","cellDay","navigateTo","key","preventDefault","stopPropagation","dayOfWeek","getDay","homeDate","clamped","daysInThisMonth","tYear","shiftKey","tMonth","tDay","Math","min","cellId","disabled","ariaLabel","ariaCurrent","ariaDisabled","rovingProps","ref","tabIndex","onFocus","onKeyDown","onClick"],"mappings":"AAKO,SAAA,YAAAA,GAAA,WAAAC,GAAA,aAAAC,GAAA,eAAAC,SAAA;AAAA,SAAA,kBAAAC,SAAA;AAAA,MAAMC,IAAmBA,CAC9BC,GACAC,GACAC,GACAC,GACAC,GACAC,IAAmB,OACR;AACX,QAAMC,IAAON,EAAKO,mBAAmB,SAAS;AAAA,IAC5CC,SAAS;AAAA,IACTC,OAAO;AAAA,IACPC,KAAK;AAAA,IACLC,MAAM;AAAA,EAAA,CACP;AACD,SAAIP,IAA4BE,IAC5BH,IAAuB,GAAGG,CAAI,6BAC9BL,IAAgB,GAAGK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UAAUF,EAAYE;AAAAA,UACtBC,SAASH,EAAYG;AAAAA,UACrB,cAAcN;AAAAA,UACd,gBAAgBC;AAAAA,UAChB,iBAAiBC;AAAAA,UACjBK,WAAWA,CAAC7B,MAA2BD,EAAcC,GAAGC,CAAQ;AAAA,UAChE6B,SAASA,MAAM;AAAE,YAAKT,KAAUzB,EAAgBK,CAAQ;AAAA,UAAG;AAAA,QAAA;AAAA,MAE/D;AAAA,IACF,GACA,CAACZ,GAAwBX,GAAeS,GAAgBX,GAAwBU,CAAuB,CACzG;AAAA,IAIEV,wBAAAA;AAAAA,IACAU,yBAAAA;AAAAA,IACAN,uBAAAA;AAAAA,IACAQ,wBAAAA;AAAAA,IACAV,eAAAA;AAAAA,IACAS,gBAAAA;AAAAA,EAAAA;AAEJ;"}
|
package/dist/index241.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
var o = {};
|
|
4
|
-
for (var e in t) if ({}.hasOwnProperty.call(t, e)) {
|
|
5
|
-
if (i.indexOf(e) >= 0) continue;
|
|
6
|
-
o[e] = t[e];
|
|
7
|
-
}
|
|
8
|
-
return o;
|
|
1
|
+
function n(e) {
|
|
2
|
+
return new Promise((t) => setTimeout(t, e));
|
|
9
3
|
}
|
|
10
4
|
export {
|
|
11
|
-
|
|
5
|
+
n as delay
|
|
12
6
|
};
|
|
13
7
|
//# sourceMappingURL=index241.js.map
|
package/dist/index241.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index241.js","sources":["../
|
|
1
|
+
{"version":3,"file":"index241.js","sources":["../src/utils/delay.ts"],"sourcesContent":["/**\n * Delays execution by the specified number of milliseconds\n * @param ms - The number of milliseconds to delay\n * @returns A Promise that resolves after the specified delay\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n} "],"names":["delay","ms","Promise","resolve","setTimeout"],"mappings":"AAKO,SAASA,EAAMC,GAA2B;AAC7C,SAAO,IAAIC,QAAQC,CAAAA,MAAWC,WAAWD,GAASF,CAAE,CAAC;AACzD;"}
|
package/dist/index243.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useEffect as s } from "react";
|
|
2
|
+
const u = {
|
|
3
|
+
block: "nearest"
|
|
4
|
+
};
|
|
5
|
+
function m({
|
|
6
|
+
containerRef: t,
|
|
7
|
+
activeIndex: o,
|
|
8
|
+
itemSelector: r = '[role="option"]',
|
|
9
|
+
enabled: c = !0,
|
|
10
|
+
scrollOptions: e = u
|
|
11
|
+
}) {
|
|
12
|
+
s(() => {
|
|
13
|
+
if (!c || o < 0 || !t?.current)
|
|
14
|
+
return;
|
|
15
|
+
const n = t.current.querySelectorAll(r)[o];
|
|
16
|
+
n && n.scrollIntoView(e);
|
|
17
|
+
}, [o, t, r, c, e]);
|
|
4
18
|
}
|
|
5
19
|
export {
|
|
6
|
-
|
|
20
|
+
m as useScrollActiveIntoView
|
|
7
21
|
};
|
|
8
22
|
//# sourceMappingURL=index243.js.map
|
package/dist/index243.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index243.js","sources":["../
|
|
1
|
+
{"version":3,"file":"index243.js","sources":["../src/utils/a11y/useScrollActiveIntoView.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nconst DEFAULT_SCROLL_OPTIONS: ScrollIntoViewOptions = { block: 'nearest' };\n\nexport interface UseScrollActiveIntoViewOptions {\n /**\n * Ref to the container element\n */\n containerRef?: RefObject<HTMLElement | null>;\n \n /**\n * Index of the currently active/highlighted item (-1 if none)\n */\n activeIndex: number;\n \n /**\n * CSS selector for item elements\n * Default: '[role=\"option\"]'\n */\n itemSelector?: string;\n \n /**\n * Whether scrolling is enabled\n * Default: true\n */\n enabled?: boolean;\n \n /**\n * ScrollIntoView options\n * Default: { block: 'nearest' }\n */\n scrollOptions?: ScrollIntoViewOptions;\n}\n\n/**\n * Hook to automatically scroll the active item into view.\n * \n * Useful for aria-activedescendant patterns where DOM focus stays\n * on the container (e.g., input field) but we need to visually show\n * which descendant option is logically active.\n * \n * Common use cases:\n * - Combobox dropdown options\n * - Menu items with virtual focus\n * - Grid cells with keyboard navigation\n * - Tree view items\n * - Listbox options\n * \n * @example\n * ```tsx\n * const [highlightedIndex, setHighlightedIndex] = useState(-1);\n * const listboxRef = useRef<HTMLDivElement>(null);\n * \n * useScrollActiveIntoView({\n * containerRef: listboxRef,\n * activeIndex: highlightedIndex,\n * itemSelector: '[role=\"option\"]'\n * });\n * \n * // Now when highlightedIndex changes, the item scrolls into view\n * ```\n * \n * @example Custom scroll behavior\n * ```tsx\n * useScrollActiveIntoView({\n * containerRef: menuRef,\n * activeIndex: activeMenuIndex,\n * itemSelector: '[role=\"menuitem\"]',\n * scrollOptions: { block: 'center', behavior: 'smooth' }\n * });\n * ```\n */\nexport function useScrollActiveIntoView({\n containerRef,\n activeIndex,\n itemSelector = '[role=\"option\"]',\n enabled = true,\n scrollOptions = DEFAULT_SCROLL_OPTIONS\n}: UseScrollActiveIntoViewOptions): void {\n useEffect(() => {\n // Early returns for disabled states\n if (!enabled || activeIndex < 0 || !containerRef?.current) {\n return;\n }\n \n const container = containerRef.current;\n const items = container.querySelectorAll(itemSelector);\n const activeItem = items[activeIndex] as HTMLElement;\n \n if (activeItem) {\n activeItem.scrollIntoView(scrollOptions);\n }\n }, [activeIndex, containerRef, itemSelector, enabled, scrollOptions]);\n}\n"],"names":["useEffect","DEFAULT_SCROLL_OPTIONS","block","useScrollActiveIntoView","containerRef","activeIndex","itemSelector","enabled","scrollOptions","current","activeItem","querySelectorAll","scrollIntoView"],"mappings":"AAGA,SAAA,aAAAA,SAAA;AAAA,MAAMC,IAAgD;AAAA,EAAEC,OAAO;AAAU;AAsElE,SAASC,EAAwB;AAAA,EACtCC,cAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,cAAAA,IAAe;AAAA,EACfC,SAAAA,IAAU;AAAA,EACVC,eAAAA,IAAgBP;AACc,GAAS;AACvCD,EAAAA,EAAU,MAAM;AAEd,QAAI,CAACO,KAAWF,IAAc,KAAK,CAACD,GAAcK;AAChD;AAKF,UAAMC,IAFYN,EAAaK,QACPE,iBAAiBL,CAAY,EAC5BD,CAAW;AAEpC,IAAIK,KACFA,EAAWE,eAAeJ,CAAa;AAAA,EAE3C,GAAG,CAACH,GAAaD,GAAcE,GAAcC,GAASC,CAAa,CAAC;AACtE;"}
|