se-design 1.0.67-dev → 1.0.68-dev
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/Banner/index.d.ts +2 -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.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.map +1 -1
- package/dist/index120.js.map +1 -1
- package/dist/index121.js.map +1 -1
- package/dist/index122.js.map +1 -1
- package/dist/index123.js.map +1 -1
- package/dist/index124.js.map +1 -1
- package/dist/index125.js.map +1 -1
- package/dist/index126.js.map +1 -1
- package/dist/index127.js.map +1 -1
- package/dist/index128.js.map +1 -1
- package/dist/index129.js.map +1 -1
- package/dist/index13.js.map +1 -1
- package/dist/index130.js.map +1 -1
- package/dist/index131.js.map +1 -1
- package/dist/index132.js.map +1 -1
- package/dist/index133.js.map +1 -1
- package/dist/index134.js.map +1 -1
- package/dist/index135.js.map +1 -1
- package/dist/index136.js.map +1 -1
- package/dist/index137.js.map +1 -1
- package/dist/index138.js.map +1 -1
- package/dist/index139.js.map +1 -1
- package/dist/index140.js.map +1 -1
- package/dist/index141.js.map +1 -1
- package/dist/index142.js.map +1 -1
- package/dist/index143.js.map +1 -1
- package/dist/index144.js.map +1 -1
- package/dist/index145.js.map +1 -1
- package/dist/index146.js.map +1 -1
- package/dist/index147.js.map +1 -1
- package/dist/index148.js.map +1 -1
- package/dist/index149.js.map +1 -1
- package/dist/index15.js.map +1 -1
- package/dist/index150.js.map +1 -1
- package/dist/index151.js.map +1 -1
- package/dist/index152.js.map +1 -1
- package/dist/index153.js.map +1 -1
- package/dist/index154.js.map +1 -1
- package/dist/index155.js.map +1 -1
- package/dist/index156.js.map +1 -1
- package/dist/index157.js.map +1 -1
- package/dist/index158.js.map +1 -1
- package/dist/index159.js.map +1 -1
- package/dist/index16.js.map +1 -1
- package/dist/index160.js.map +1 -1
- package/dist/index161.js.map +1 -1
- package/dist/index162.js.map +1 -1
- package/dist/index163.js.map +1 -1
- package/dist/index164.js.map +1 -1
- package/dist/index165.js.map +1 -1
- package/dist/index166.js.map +1 -1
- package/dist/index167.js.map +1 -1
- package/dist/index168.js.map +1 -1
- package/dist/index169.js.map +1 -1
- package/dist/index17.js.map +1 -1
- package/dist/index170.js.map +1 -1
- package/dist/index171.js.map +1 -1
- package/dist/index172.js.map +1 -1
- package/dist/index173.js.map +1 -1
- package/dist/index174.js.map +1 -1
- package/dist/index175.js.map +1 -1
- package/dist/index176.js.map +1 -1
- package/dist/index177.js.map +1 -1
- package/dist/index178.js.map +1 -1
- package/dist/index179.js.map +1 -1
- package/dist/index18.js.map +1 -1
- package/dist/index180.js.map +1 -1
- package/dist/index181.js.map +1 -1
- package/dist/index182.js.map +1 -1
- package/dist/index183.js.map +1 -1
- package/dist/index184.js.map +1 -1
- package/dist/index185.js.map +1 -1
- package/dist/index186.js.map +1 -1
- package/dist/index187.js.map +1 -1
- package/dist/index188.js.map +1 -1
- package/dist/index189.js.map +1 -1
- package/dist/index19.js.map +1 -1
- package/dist/index192.js.map +1 -1
- package/dist/index194.js.map +1 -1
- package/dist/index196.js.map +1 -1
- package/dist/index20.js.map +1 -1
- package/dist/index204.js.map +1 -1
- package/dist/index21.js.map +1 -1
- package/dist/index215.js.map +1 -1
- package/dist/index216.js.map +1 -1
- package/dist/index22.js.map +1 -1
- package/dist/index227.js.map +1 -1
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +1 -1
- package/dist/index229.js.map +1 -1
- package/dist/index23.js.map +1 -1
- package/dist/index230.js.map +1 -1
- package/dist/index232.js.map +1 -1
- package/dist/index233.js.map +1 -1
- package/dist/index234.js.map +1 -1
- package/dist/index235.js.map +1 -1
- package/dist/index236.js.map +1 -1
- package/dist/index237.js.map +1 -1
- package/dist/index238.js.map +1 -1
- package/dist/index24.js.map +1 -1
- package/dist/index240.js.map +1 -1
- package/dist/index241.js.map +1 -1
- package/dist/index242.js.map +1 -1
- package/dist/index244.js.map +1 -1
- package/dist/index245.js.map +1 -1
- package/dist/index246.js.map +1 -1
- package/dist/index249.js.map +1 -1
- package/dist/index25.js.map +1 -1
- package/dist/index26.js.map +1 -1
- package/dist/index27.js.map +1 -1
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +57 -55
- package/dist/index29.js.map +1 -1
- package/dist/index3.js.map +1 -1
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +11 -10
- package/dist/index31.js.map +1 -1
- package/dist/index32.js.map +1 -1
- package/dist/index33.js.map +1 -1
- package/dist/index34.js.map +1 -1
- package/dist/index35.js.map +1 -1
- package/dist/index36.js.map +1 -1
- package/dist/index37.js.map +1 -1
- package/dist/index38.js.map +1 -1
- package/dist/index39.js.map +1 -1
- package/dist/index4.js.map +1 -1
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +8 -7
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +7 -6
- package/dist/index42.js.map +1 -1
- package/dist/index43.js.map +1 -1
- package/dist/index44.js.map +1 -1
- package/dist/index45.js.map +1 -1
- 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.map +1 -1
- package/dist/index5.js +72 -72
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +13 -13
- package/dist/index50.js.map +1 -1
- package/dist/index51.js.map +1 -1
- package/dist/index52.js.map +1 -1
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +17 -16
- 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.map +1 -1
- package/dist/index58.js.map +1 -1
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +7 -6
- 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.map +1 -1
- package/dist/index64.js +2 -1
- package/dist/index64.js.map +1 -1
- package/dist/index66.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.map +1 -1
- package/dist/index70.js.map +1 -1
- 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.map +1 -1
- package/dist/index77.js.map +1 -1
- package/dist/index78.js.map +1 -1
- package/dist/index79.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.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 +2 -3
package/dist/index29.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import e, { forwardRef as
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { Button as
|
|
1
|
+
import e, { forwardRef as K } from "react";
|
|
2
|
+
import { Icon as M } from "./index5.js";
|
|
3
|
+
import { Button as m } from "./index3.js";
|
|
4
4
|
import { useStableId as I } from "./index188.js";
|
|
5
|
-
import { getRegionAttributes as
|
|
6
|
-
import { useAccessiblePress as
|
|
5
|
+
import { getRegionAttributes as Q } from "./index65.js";
|
|
6
|
+
import { useAccessiblePress as U } from "./index66.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function b() {
|
|
9
|
+
return b = Object.assign ? Object.assign.bind() : function(a) {
|
|
10
10
|
for (var t = 1; t < arguments.length; t++) {
|
|
11
11
|
var r = arguments[t];
|
|
12
|
-
for (var o in r) ({}).hasOwnProperty.call(r, o) && (
|
|
12
|
+
for (var o in r) ({}).hasOwnProperty.call(r, o) && (a[o] = r[o]);
|
|
13
13
|
}
|
|
14
|
-
return
|
|
15
|
-
},
|
|
14
|
+
return a;
|
|
15
|
+
}, b.apply(null, arguments);
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const n = {
|
|
18
18
|
bannerCtn: "relative rounded-[12px] flex pr-3.5",
|
|
19
19
|
bannerContentCtn: "pt-5 pl-6 pb-5 pr-2 flex flex-col gap-2",
|
|
20
20
|
bannerLinkCta: "text-[#1088e7] cursor-pointer text-base leading-6 hover: text-[#0078d4]",
|
|
21
21
|
bannerImageCtn: "flex",
|
|
22
22
|
bannerCloseIconCtn: "absolute top-[12px] right-[12px] cursor-pointer hover:bg-[var(--color-gray-100)] rounded-full p-1 inline-flex items-center justify-center",
|
|
23
23
|
bannerButton: "self-start"
|
|
24
|
-
},
|
|
24
|
+
}, te = /* @__PURE__ */ K((a, t) => {
|
|
25
25
|
const {
|
|
26
26
|
bannerClassName: r,
|
|
27
27
|
bannerBgColor: o,
|
|
28
28
|
title: h,
|
|
29
29
|
titleTag: k = "span",
|
|
30
|
-
description:
|
|
30
|
+
description: d,
|
|
31
31
|
hasImage: v,
|
|
32
32
|
imagePosition: s = "right",
|
|
33
33
|
imageWidth: N = "30%",
|
|
@@ -35,13 +35,13 @@ const a = {
|
|
|
35
35
|
hasCloseIcon: E,
|
|
36
36
|
closeIconName: P,
|
|
37
37
|
onClose: L,
|
|
38
|
-
onBannerClick:
|
|
38
|
+
onBannerClick: l,
|
|
39
39
|
hasLinkCta: T,
|
|
40
|
-
onCtaClick:
|
|
40
|
+
onCtaClick: C,
|
|
41
41
|
onSecondaryCtaClick: $,
|
|
42
42
|
hasButtonCta: j,
|
|
43
43
|
buttonType: A = "secondary",
|
|
44
|
-
ctaText:
|
|
44
|
+
ctaText: p,
|
|
45
45
|
ctaAriaLabel: u,
|
|
46
46
|
hasSecondaryButtonCta: w = !1,
|
|
47
47
|
secondaryButtonType: R = "secondary",
|
|
@@ -49,88 +49,90 @@ const a = {
|
|
|
49
49
|
secondaryCtaAriaLabel: O,
|
|
50
50
|
automationId: _ = "",
|
|
51
51
|
titleId: c,
|
|
52
|
-
disabledPrimaryButton: z = !1
|
|
53
|
-
|
|
52
|
+
disabledPrimaryButton: z = !1,
|
|
53
|
+
hasCustomContent: F = !1,
|
|
54
|
+
customContent: W = null
|
|
55
|
+
} = a, g = l ? "cursor-pointer" : "", f = I(c, "banner-title"), y = I(void 0, "banner-description"), i = Q({
|
|
54
56
|
titleId: f,
|
|
55
|
-
descriptionId:
|
|
57
|
+
descriptionId: d ? y : void 0,
|
|
56
58
|
isFocusable: !!c
|
|
57
59
|
}), {
|
|
58
|
-
pressProps:
|
|
59
|
-
role:
|
|
60
|
-
tabIndex:
|
|
61
|
-
} =
|
|
60
|
+
pressProps: q,
|
|
61
|
+
role: D,
|
|
62
|
+
tabIndex: G
|
|
63
|
+
} = U({
|
|
62
64
|
isNative: !1,
|
|
63
|
-
onClick:
|
|
64
|
-
}),
|
|
65
|
-
...
|
|
66
|
-
role:
|
|
67
|
-
tabIndex:
|
|
65
|
+
onClick: l ? () => l() : void 0
|
|
66
|
+
}), H = l ? {
|
|
67
|
+
...q,
|
|
68
|
+
role: D,
|
|
69
|
+
tabIndex: G
|
|
68
70
|
} : {}, x = () => v && /* @__PURE__ */ e.createElement("div", {
|
|
69
|
-
className: `${
|
|
71
|
+
className: `${n.bannerImageCtn} ${g} banner-image-ctn ${s === "right" ? "mr-5 ml-0 justify-end" : "ml-5 mr-0 justify-start"} min-h-full`,
|
|
70
72
|
style: {
|
|
71
73
|
width: N
|
|
72
74
|
},
|
|
73
|
-
onClick:
|
|
75
|
+
onClick: l
|
|
74
76
|
}, /* @__PURE__ */ e.createElement("img", {
|
|
75
|
-
src:
|
|
77
|
+
src: a.bannerImage,
|
|
76
78
|
alt: B,
|
|
77
79
|
className: "max-w-[initial] h-[initial] max-h-[150px] object-contain"
|
|
78
80
|
}));
|
|
79
81
|
return /* @__PURE__ */ e.createElement("div", {
|
|
80
82
|
ref: t,
|
|
81
|
-
className: `${
|
|
83
|
+
className: `${n.bannerCtn} ${g} ${r} banner-ctn`,
|
|
82
84
|
style: {
|
|
83
85
|
backgroundColor: o
|
|
84
86
|
},
|
|
85
87
|
"data-automation-id": _,
|
|
86
|
-
role:
|
|
87
|
-
"aria-labelledby":
|
|
88
|
-
"aria-describedby":
|
|
89
|
-
tabIndex:
|
|
90
|
-
}, s === "left" && x(), /* @__PURE__ */ e.createElement("div",
|
|
91
|
-
className: `${
|
|
92
|
-
},
|
|
88
|
+
role: i.role,
|
|
89
|
+
"aria-labelledby": i["aria-labelledby"],
|
|
90
|
+
"aria-describedby": i["aria-describedby"],
|
|
91
|
+
tabIndex: i.tabIndex
|
|
92
|
+
}, s === "left" && x(), /* @__PURE__ */ e.createElement("div", b({
|
|
93
|
+
className: `${n.bannerContentCtn} w-[100%] banner-content-ctn`
|
|
94
|
+
}, H), /* @__PURE__ */ e.createElement(k, {
|
|
93
95
|
id: f,
|
|
94
96
|
className: "banner-title",
|
|
95
97
|
tabIndex: c ? -1 : void 0
|
|
96
|
-
}, h), /* @__PURE__ */ e.createElement("span", {
|
|
98
|
+
}, h), F ? /* @__PURE__ */ e.createElement(e.Fragment, null, W) : /* @__PURE__ */ e.createElement("span", {
|
|
97
99
|
id: y,
|
|
98
100
|
className: "banner-description"
|
|
99
|
-
},
|
|
101
|
+
}, d), /* @__PURE__ */ e.createElement("div", {
|
|
100
102
|
className: "flex gap-3",
|
|
101
|
-
onClick: (
|
|
102
|
-
}, T && /* @__PURE__ */ e.createElement(
|
|
103
|
+
onClick: (J) => J.stopPropagation()
|
|
104
|
+
}, T && /* @__PURE__ */ e.createElement(m, {
|
|
103
105
|
type: "link",
|
|
104
|
-
className:
|
|
105
|
-
onClick:
|
|
106
|
-
label:
|
|
106
|
+
className: n.bannerLinkCta,
|
|
107
|
+
onClick: C,
|
|
108
|
+
label: p,
|
|
107
109
|
ariaLabel: u
|
|
108
|
-
}), j && /* @__PURE__ */ e.createElement(
|
|
110
|
+
}), j && /* @__PURE__ */ e.createElement(m, {
|
|
109
111
|
type: A,
|
|
110
112
|
size: "sm",
|
|
111
|
-
label:
|
|
112
|
-
onClick:
|
|
113
|
-
className:
|
|
113
|
+
label: p,
|
|
114
|
+
onClick: C,
|
|
115
|
+
className: n?.bannerButton,
|
|
114
116
|
"data-automation-id": "banner-main-cta",
|
|
115
117
|
ariaLabel: u,
|
|
116
118
|
disabled: z
|
|
117
|
-
}), w && /* @__PURE__ */ e.createElement(
|
|
119
|
+
}), w && /* @__PURE__ */ e.createElement(m, {
|
|
118
120
|
type: R,
|
|
119
121
|
size: "sm",
|
|
120
122
|
label: S,
|
|
121
123
|
onClick: $,
|
|
122
|
-
className:
|
|
124
|
+
className: n?.secondaryBannerButton,
|
|
123
125
|
"data-automation-id": "banner-secondary-cta",
|
|
124
126
|
ariaLabel: O
|
|
125
|
-
}))), s === "right" && x(), E && /* @__PURE__ */ e.createElement(
|
|
127
|
+
}))), s === "right" && x(), E && /* @__PURE__ */ e.createElement(M, {
|
|
126
128
|
name: P,
|
|
127
|
-
className:
|
|
129
|
+
className: n.bannerCloseIconCtn,
|
|
128
130
|
onClick: L,
|
|
129
131
|
ariaLabel: "Close banner",
|
|
130
132
|
shouldStopPropagation: !0
|
|
131
133
|
}));
|
|
132
134
|
});
|
|
133
135
|
export {
|
|
134
|
-
|
|
136
|
+
te as Banner
|
|
135
137
|
};
|
|
136
138
|
//# sourceMappingURL=index29.js.map
|
package/dist/index29.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index29.js","sources":["../src/components/Banner/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Button';\nimport { useStableId } from '../../utils/useStableId';\nimport { useAccessiblePress } from '../../utils/a11y';\nimport { getRegionAttributes } from '../../utils/a11y/regionAttributes';\nimport './style.scss';\n\nexport interface BannerProps {\n bannerClassName?: string | '';\n bannerBgColor?: string | '';\n title: string | '';\n titleTag?: 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n description: string | '';\n hasImage?: boolean | false;\n imagePosition?: 'left' | 'right' | '';\n imageWidth?: string | '30%';\n imageAlt?: string | '';\n bannerImage: string | '';\n hasCloseIcon?: boolean | false;\n closeIconName: string | '';\n onClose: () => void | (() => {});\n onBannerClick?: () => void | (() => {});\n hasButtonCta?: boolean | false;\n hasSecondaryButtonCta?: boolean | false;\n buttonType?: 'primary' | 'secondary' | 'link';\n secondaryButtonType?: 'primary' | 'secondary' | 'ghost' | 'link';\n hasLinkCta?: boolean | false;\n ctaText: string | '';\n secondaryCtaText: string | '';\n onCtaClick: () => void | (() => {});\n onSecondaryCtaClick: () => void | (() => {});\n /**\n * Accessible name for primary CTA button (screen reader only, if different from visible label).\n */\n ctaAriaLabel?: string;\n /**\n * Accessible name for secondary CTA button (screen reader only, if different from visible label).\n */\n secondaryCtaAriaLabel?: string;\n automationId?: string;\n // Optional title ID for external control (e.g., focus management)\n titleId?: string;\n disabledPrimaryButton?: boolean;\n}\n\nconst classNames: Map = {\n bannerCtn: `relative rounded-[12px] flex pr-3.5`,\n bannerContentCtn: 'pt-5 pl-6 pb-5 pr-2 flex flex-col gap-2',\n bannerLinkCta: 'text-[#1088e7] cursor-pointer text-base leading-6 hover: text-[#0078d4]',\n bannerImageCtn: 'flex',\n bannerCloseIconCtn:\n 'absolute top-[12px] right-[12px] cursor-pointer hover:bg-[var(--color-gray-100)] rounded-full p-1 inline-flex items-center justify-center',\n bannerButton: 'self-start'\n};\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>((props, ref) => {\n const {\n bannerClassName,\n bannerBgColor,\n title,\n titleTag: TitleTag = 'span',\n description,\n hasImage,\n imagePosition = 'right',\n imageWidth = '30%',\n imageAlt = '',\n hasCloseIcon,\n closeIconName,\n onClose,\n onBannerClick,\n hasLinkCta,\n onCtaClick,\n onSecondaryCtaClick,\n hasButtonCta,\n buttonType = 'secondary',\n ctaText,\n ctaAriaLabel,\n hasSecondaryButtonCta = false,\n secondaryButtonType = 'secondary',\n secondaryCtaText,\n secondaryCtaAriaLabel,\n automationId = '',\n titleId: providedTitleId,\n disabledPrimaryButton = false\n } = props;\n\n const isClickableClass = onBannerClick ? 'cursor-pointer' : '';\n const titleId = useStableId(providedTitleId, 'banner-title');\n const descriptionId = useStableId(undefined, 'banner-description');\n\n const regionAttributes = getRegionAttributes({\n titleId,\n descriptionId: description ? descriptionId : undefined,\n isFocusable: !!providedTitleId\n });\n\n // When banner is clickable, make the content area keyboard-activatable (Enter/Space).\n // We intentionally keep this as an extra tab stop (per dashboard banner behavior).\n const { pressProps: bannerContentPressProps, role: bannerContentRole, tabIndex: bannerContentTabIndex } =\n useAccessiblePress({\n isNative: false,\n onClick: onBannerClick ? () => onBannerClick() : undefined\n });\n\n const bannerContentClickableProps = onBannerClick\n ? {\n ...bannerContentPressProps,\n role: bannerContentRole,\n tabIndex: bannerContentTabIndex\n }\n : {};\n\n const renderImage = () =>\n hasImage && (\n <div\n className={`${classNames.bannerImageCtn} ${isClickableClass} banner-image-ctn ${imagePosition === 'right' ? 'mr-5 ml-0 justify-end' : 'ml-5 mr-0 justify-start'} min-h-full`}\n style={{ width: imageWidth }}\n onClick={onBannerClick}\n >\n <img src={props.bannerImage} alt={imageAlt} className=\"max-w-[initial] h-[initial] max-h-[150px] object-contain\" />\n </div>\n );\n\n return (\n <div \n ref={ref}\n className={`${classNames.bannerCtn} ${isClickableClass} ${bannerClassName} banner-ctn`} \n style={{ backgroundColor: bannerBgColor }} \n data-automation-id={automationId}\n role={regionAttributes.role}\n aria-labelledby={regionAttributes['aria-labelledby']}\n aria-describedby={regionAttributes['aria-describedby']}\n tabIndex={regionAttributes.tabIndex}\n >\n {imagePosition === 'left' && renderImage()}\n <div \n className={`${classNames.bannerContentCtn} w-[100%] banner-content-ctn`} \n {...bannerContentClickableProps}\n >\n <TitleTag id={titleId} className=\"banner-title\" tabIndex={providedTitleId ? -1 : undefined}>{title}</TitleTag>\n <span id={descriptionId} className=\"banner-description\">{description}</span>\n <div className=\"flex gap-3\" onClick={(e) => e.stopPropagation()}>\n {hasLinkCta && (\n <Button \n type=\"link\" \n className={classNames.bannerLinkCta} \n onClick={onCtaClick} \n label={ctaText}\n ariaLabel={ctaAriaLabel}\n />\n )}\n {hasButtonCta && (\n <Button\n type={buttonType}\n size=\"sm\"\n label={ctaText}\n onClick={onCtaClick}\n className={classNames?.bannerButton}\n data-automation-id=\"banner-main-cta\"\n ariaLabel={ctaAriaLabel}\n disabled={disabledPrimaryButton}\n />\n )}\n {hasSecondaryButtonCta && (\n <Button\n type={secondaryButtonType}\n size=\"sm\"\n label={secondaryCtaText}\n onClick={onSecondaryCtaClick}\n className={classNames?.secondaryBannerButton}\n data-automation-id=\"banner-secondary-cta\"\n ariaLabel={secondaryCtaAriaLabel}\n />\n )}\n </div>\n </div>\n {imagePosition === 'right' && renderImage()}\n {hasCloseIcon && (\n <Icon\n name={closeIconName}\n className={classNames.bannerCloseIconCtn}\n onClick={onClose}\n ariaLabel=\"Close banner\"\n shouldStopPropagation\n />\n )}\n </div>\n );\n});\n"],"names":["classNames","bannerCtn","bannerContentCtn","bannerLinkCta","bannerImageCtn","bannerCloseIconCtn","bannerButton","Banner","forwardRef","props","ref","bannerClassName","bannerBgColor","title","titleTag","TitleTag","description","hasImage","imagePosition","imageWidth","imageAlt","hasCloseIcon","closeIconName","onClose","onBannerClick","hasLinkCta","onCtaClick","onSecondaryCtaClick","hasButtonCta","buttonType","ctaText","ctaAriaLabel","hasSecondaryButtonCta","secondaryButtonType","secondaryCtaText","secondaryCtaAriaLabel","automationId","titleId","providedTitleId","disabledPrimaryButton","isClickableClass","useStableId","descriptionId","undefined","regionAttributes","getRegionAttributes","isFocusable","pressProps","bannerContentPressProps","role","bannerContentRole","tabIndex","bannerContentTabIndex","useAccessiblePress","isNative","onClick","bannerContentClickableProps","renderImage","React","createElement","className","style","width","src","bannerImage","alt","backgroundColor","_extends","id","e","stopPropagation","Button","type","label","ariaLabel","size","disabled","secondaryBannerButton","Icon","name","shouldStopPropagation"],"mappings":";;;;;;;;;;;;;;;;AA+CA,MAAMA,IAAkB;AAAA,EACtBC,WAAW;AAAA,EACXC,kBAAkB;AAAA,EAClBC,eAAe;AAAA,EACfC,gBAAgB;AAAA,EAChBC,oBACE;AAAA,EACFC,cAAc;AAChB,GAEaC,KAASC,gBAAAA,EAAwC,CAACC,GAAOC,MAAQ;AAC5E,QAAM;AAAA,IACJC,iBAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,UAAUC,IAAW;AAAA,IACrBC,aAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,eAAAA,IAAgB;AAAA,IAChBC,YAAAA,IAAa;AAAA,IACbC,UAAAA,IAAW;AAAA,IACXC,cAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,YAAAA;AAAAA,IACAC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AAAAA,IACvB,sBAAmB;AAAA,IACnBoE,WAAW3C;AAAAA,IACX6C,UAAUrC;AAAAA,EAAAA,CACX,GAEFP,KACC0B,gBAAAA,EAAAC,cAACY,GAAM;AAAA,IACLC,MAAMvC;AAAAA,IACN0C,MAAK;AAAA,IACLF,OAAOvC;AAAAA,IACPqB,SAAS5B;AAAAA,IACTiC,WAAW5D,GAAY6E;AAAAA,IACvB,sBAAmB;AAAA,IACnBH,WAAWvC;AAAAA,EAAAA,CACZ,CAEA,CACF,GACJjB,MAAkB,WAAWuC,EAAAA,GAC7BpC,KACCqC,gBAAAA,EAAAC,cAACmB,GAAI;AAAA,IACHC,MAAMzD;AAAAA,IACNsC,WAAW5D,EAAWK;AAAAA,IACtBkD,SAAShC;AAAAA,IACTmD,WAAU;AAAA,IACVM,uBAAqB;AAAA,EAAA,CACtB,CAEA;AAET,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index29.js","sources":["../src/components/Banner/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { Icon } from 'components/Icon';\nimport { Button } from 'components/Button';\nimport { useStableId } from '../../utils/useStableId';\nimport { useAccessiblePress } from '../../utils/a11y';\nimport { getRegionAttributes } from '../../utils/a11y/regionAttributes';\nimport './style.scss';\n\nexport interface BannerProps {\n bannerClassName?: string | '';\n bannerBgColor?: string | '';\n title: string | '';\n titleTag?: 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n description: string | '';\n hasCustomContent?: boolean | false;\n customContent?: React.ReactNode;\n hasImage?: boolean | false;\n imagePosition?: 'left' | 'right' | '';\n imageWidth?: string | '30%';\n imageAlt?: string | '';\n bannerImage: string | '';\n hasCloseIcon?: boolean | false;\n closeIconName: string | '';\n onClose: () => void | (() => {});\n onBannerClick?: () => void | (() => {});\n hasButtonCta?: boolean | false;\n hasSecondaryButtonCta?: boolean | false;\n buttonType?: 'primary' | 'secondary' | 'link';\n secondaryButtonType?: 'primary' | 'secondary' | 'ghost' | 'link';\n hasLinkCta?: boolean | false;\n ctaText: string | '';\n secondaryCtaText: string | '';\n onCtaClick: () => void | (() => {});\n onSecondaryCtaClick: () => void | (() => {});\n /**\n * Accessible name for primary CTA button (screen reader only, if different from visible label).\n */\n ctaAriaLabel?: string;\n /**\n * Accessible name for secondary CTA button (screen reader only, if different from visible label).\n */\n secondaryCtaAriaLabel?: string;\n automationId?: string;\n // Optional title ID for external control (e.g., focus management)\n titleId?: string;\n disabledPrimaryButton?: boolean;\n}\n\nconst classNames: Map = {\n bannerCtn: `relative rounded-[12px] flex pr-3.5`,\n bannerContentCtn: 'pt-5 pl-6 pb-5 pr-2 flex flex-col gap-2',\n bannerLinkCta: 'text-[#1088e7] cursor-pointer text-base leading-6 hover: text-[#0078d4]',\n bannerImageCtn: 'flex',\n bannerCloseIconCtn:\n 'absolute top-[12px] right-[12px] cursor-pointer hover:bg-[var(--color-gray-100)] rounded-full p-1 inline-flex items-center justify-center',\n bannerButton: 'self-start'\n};\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>((props, ref) => {\n const {\n bannerClassName,\n bannerBgColor,\n title,\n titleTag: TitleTag = 'span',\n description,\n hasImage,\n imagePosition = 'right',\n imageWidth = '30%',\n imageAlt = '',\n hasCloseIcon,\n closeIconName,\n onClose,\n onBannerClick,\n hasLinkCta,\n onCtaClick,\n onSecondaryCtaClick,\n hasButtonCta,\n buttonType = 'secondary',\n ctaText,\n ctaAriaLabel,\n hasSecondaryButtonCta = false,\n secondaryButtonType = 'secondary',\n secondaryCtaText,\n secondaryCtaAriaLabel,\n automationId = '',\n titleId: providedTitleId,\n disabledPrimaryButton = false,\n hasCustomContent = false,\n customContent = null\n } = props;\n\n const isClickableClass = onBannerClick ? 'cursor-pointer' : '';\n const titleId = useStableId(providedTitleId, 'banner-title');\n const descriptionId = useStableId(undefined, 'banner-description');\n\n const regionAttributes = getRegionAttributes({\n titleId,\n descriptionId: description ? descriptionId : undefined,\n isFocusable: !!providedTitleId\n });\n\n // When banner is clickable, make the content area keyboard-activatable (Enter/Space).\n // We intentionally keep this as an extra tab stop (per dashboard banner behavior).\n const { pressProps: bannerContentPressProps, role: bannerContentRole, tabIndex: bannerContentTabIndex } =\n useAccessiblePress({\n isNative: false,\n onClick: onBannerClick ? () => onBannerClick() : undefined\n });\n\n const bannerContentClickableProps = onBannerClick\n ? {\n ...bannerContentPressProps,\n role: bannerContentRole,\n tabIndex: bannerContentTabIndex\n }\n : {};\n\n const renderImage = () =>\n hasImage && (\n <div\n className={`${classNames.bannerImageCtn} ${isClickableClass} banner-image-ctn ${imagePosition === 'right' ? 'mr-5 ml-0 justify-end' : 'ml-5 mr-0 justify-start'} min-h-full`}\n style={{ width: imageWidth }}\n onClick={onBannerClick}\n >\n <img src={props.bannerImage} alt={imageAlt} className=\"max-w-[initial] h-[initial] max-h-[150px] object-contain\" />\n </div>\n );\n\n return (\n <div \n ref={ref}\n className={`${classNames.bannerCtn} ${isClickableClass} ${bannerClassName} banner-ctn`} \n style={{ backgroundColor: bannerBgColor }} \n data-automation-id={automationId}\n role={regionAttributes.role}\n aria-labelledby={regionAttributes['aria-labelledby']}\n aria-describedby={regionAttributes['aria-describedby']}\n tabIndex={regionAttributes.tabIndex}\n >\n {imagePosition === 'left' && renderImage()}\n <div \n className={`${classNames.bannerContentCtn} w-[100%] banner-content-ctn`} \n {...bannerContentClickableProps}\n >\n <TitleTag id={titleId} className=\"banner-title\" tabIndex={providedTitleId ? -1 : undefined}>{title}</TitleTag>\n {hasCustomContent ? <>{customContent}</> : \n <span id={descriptionId} className=\"banner-description\">{description}</span>}\n <div className=\"flex gap-3\" onClick={(e) => e.stopPropagation()}>\n {hasLinkCta && (\n <Button \n type=\"link\" \n className={classNames.bannerLinkCta} \n onClick={onCtaClick} \n label={ctaText}\n ariaLabel={ctaAriaLabel}\n />\n )}\n {hasButtonCta && (\n <Button\n type={buttonType}\n size=\"sm\"\n label={ctaText}\n onClick={onCtaClick}\n className={classNames?.bannerButton}\n data-automation-id=\"banner-main-cta\"\n ariaLabel={ctaAriaLabel}\n disabled={disabledPrimaryButton}\n />\n )}\n {hasSecondaryButtonCta && (\n <Button\n type={secondaryButtonType}\n size=\"sm\"\n label={secondaryCtaText}\n onClick={onSecondaryCtaClick}\n className={classNames?.secondaryBannerButton}\n data-automation-id=\"banner-secondary-cta\"\n ariaLabel={secondaryCtaAriaLabel}\n />\n )}\n </div>\n </div>\n {imagePosition === 'right' && renderImage()}\n {hasCloseIcon && (\n <Icon\n name={closeIconName}\n className={classNames.bannerCloseIconCtn}\n onClick={onClose}\n ariaLabel=\"Close banner\"\n shouldStopPropagation\n />\n )}\n </div>\n );\n});\n"],"names":["classNames","bannerCtn","bannerContentCtn","bannerLinkCta","bannerImageCtn","bannerCloseIconCtn","bannerButton","Banner","forwardRef","props","ref","bannerClassName","bannerBgColor","title","titleTag","TitleTag","description","hasImage","imagePosition","imageWidth","imageAlt","hasCloseIcon","closeIconName","onClose","onBannerClick","hasLinkCta","onCtaClick","onSecondaryCtaClick","hasButtonCta","buttonType","ctaText","ctaAriaLabel","hasSecondaryButtonCta","secondaryButtonType","secondaryCtaText","secondaryCtaAriaLabel","automationId","titleId","providedTitleId","disabledPrimaryButton","hasCustomContent","customContent","isClickableClass","useStableId","descriptionId","undefined","regionAttributes","getRegionAttributes","isFocusable","pressProps","bannerContentPressProps","role","bannerContentRole","tabIndex","bannerContentTabIndex","useAccessiblePress","isNative","onClick","bannerContentClickableProps","renderImage","React","createElement","className","style","width","src","bannerImage","alt","backgroundColor","_extends","id","Fragment","e","stopPropagation","Button","type","label","ariaLabel","size","disabled","secondaryBannerButton","Icon","name","shouldStopPropagation"],"mappings":";;;;;;;;;;;;;;;;AAiDA,MAAMA,IAAkB;AAAA,EACtBC,WAAW;AAAA,EACXC,kBAAkB;AAAA,EAClBC,eAAe;AAAA,EACfC,gBAAgB;AAAA,EAChBC,oBACE;AAAA,EACFC,cAAc;AAChB,GAEaC,KAASC,gBAAAA,EAAw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A,CAAkB,GAC3E4C,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKC,WAAU;AAAA,IAAaL,SAAUe,CAAMA,MAAAA,EAAEC,gBAAgB;AAAA,EAC3DhD,GAAAA,KACCoC,gBAAAA,EAAAA,cAACa,GAAM;AAAA,IACLC,MAAK;AAAA,IACLb,WAAW9D,EAAWG;AAAAA,IACtBsD,SAAS/B;AAAAA,IACTkD,OAAO9C;AAAAA,IACP+C,WAAW9C;AAAAA,EACZ,CAAA,GAEFH,KACCgC,gBAAAA,EAAAC,cAACa,GAAM;AAAA,IACLC,MAAM9C;AAAAA,IACNiD,MAAK;AAAA,IACLF,OAAO9C;AAAAA,IACP2B,SAAS/B;AAAAA,IACToC,WAAW9D,GAAYM;AAAAA,IACvB,sBAAmB;AAAA,IACnBuE,WAAW9C;AAAAA,IACXgD,UAAUxC;AAAAA,EACX,CAAA,GAEFP,KACC4B,gBAAAA,EAAAC,cAACa,GAAM;AAAA,IACLC,MAAM1C;AAAAA,IACN6C,MAAK;AAAA,IACLF,OAAO1C;AAAAA,IACPuB,SAAS9B;AAAAA,IACTmC,WAAW9D,GAAYgF;AAAAA,IACvB,sBAAmB;AAAA,IACnBH,WAAW1C;AAAAA,EAAAA,CACZ,CAEA,CACF,GACJjB,MAAkB,WAAWyC,EAC7BtC,GAAAA,KACCwC,gBAAAA,EAAAA,cAACoB,GAAI;AAAA,IACHC,MAAM5D;AAAAA,IACNwC,WAAW9D,EAAWK;AAAAA,IACtBoD,SAASlC;AAAAA,IACTsD,WAAU;AAAA,IACVM,uBAAqB;AAAA,EACtB,CAAA,CAEA;AAET,CAAC;"}
|
package/dist/index3.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\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 button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing) \n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n const typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {label && <span className=\"button-label [font-weight:inherit]\">{label}</span>}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","props","ref","isUnstyled","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","computedIconProps","stroke","undefined","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;AA+FA,MAAMA,IAAa,iBACbC,IAA0B;AAAA,EAC9BC,SAAS;AAAA,EACTC,WAAW;AAAA,EACXC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,UAAU;AAAA,EACVC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GACMC,IAAkB;AAAA,EACtBR,SAAS,eAAeF,CAAU;AAAA,EAClCG,WAAW,iBAAiBH,CAAU;AAAA,EACtCI,OAAO,aAAaJ,CAAU;AAAA,EAC9BK,MAAM,kBAAkBL,CAAU;AAAA,EAClCM,UAAU,gBAAgBN,CAAU;AAAA,EACpCO,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GAEME,IAA6B;AAAA,EACjCC,MAAM;AAAA,EACNC,KAAK;AAAA,EACLC,QAAQ;AAAA,EACRC,OAAO;AAAA,EACPC,IAAI;AAAA,EACJC,OAAO;AACT,GAEaC,sBACX,CACE;AAAA,EACEC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,cAAAA,IAAe;AAAA,EACfC,UAAAA,IAAW;AAAA,EACXC,SAAAA,IAAU;AAAA,EACVC,WAAAA,IAAY;AAAA,EACZC,WAAAA,IAAY;AAAA,IAAEC,MAAM;AAAA,EAAA;AAAA,EACpBC,cAAAA,IAAe;AAAA,EACfC,WAAAA,IAAY;AAAA,EACZC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC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DkC,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,GAE/B1B,KAASmC,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAMhC,WAAU;AAAA,EAAA,GAAsCJ,CAAY,GAC3E,CAACG,KAAWuB,GAAmBpB,QAAQL,MAAiB,WACvDkC,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,CAE1B;AAEV,CACF;AAEA9B,EAAO2C,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index3.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\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 button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing) \n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n const typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {label && <span className=\"button-label [font-weight:inherit]\">{label}</span>}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","props","ref","isUnstyled","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","computedIconProps","stroke","undefined","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;AA+FA,MAAMA,IAAa,iBACbC,IAA0B;AAAA,EAC9BC,SAAS;AAAA,EACTC,WAAW;AAAA,EACXC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,UAAU;AAAA,EACVC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GACMC,IAAkB;AAAA,EACtBR,SAAS,eAAeF,CAAU;AAAA,EAClCG,WAAW,iBAAiBH,CAAU;AAAA,EACtCI,OAAO,aAAaJ,CAAU;AAAA,EAC9BK,MAAM,kBAAkBL,CAAU;AAAA,EAClCM,UAAU,gBAAgBN,CAAU;AAAA,EACpCO,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GAEME,IAA6B;AAAA,EACjCC,MAAM;AAAA,EACNC,KAAK;AAAA,EACLC,QAA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,IAChDzB,WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,EAAAA,CACD;AAGCwB,SAAAA,gBAAAA,EAAAC,cAAA,UAAAC,EAAA;AAAA,IACErB,KAAAA;AAAAA,IACAnB,MAAK;AAAA,IACLO,WAAWyB;AAAAA,IACX3B,UAAUiB;AAAAA,IACVX,WAAAA;AAAAA,IACA,sBAAoBD;AAAAA,EAAAA,GAChBQ,GACCG,GACDe,CAAmB,GAEtB9B,KACCgC,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACE,eAAY;AAAA,IACZhC,WAAU;AAAA,EAAA,CACX,GAEF,CAACD,KAAWuB,GAAmBpB,QAAQL,MAAiB,UACvDmC,gBAAAA,EAAAA,cAACE,GAASZ,CAAoB,GAE/B1B,KAASmC,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAMhC,WAAU;AAAA,EAAsCJ,GAAAA,CAAY,GAC3E,CAACG,KAAWuB,GAAmBpB,QAAQL,MAAiB,WACvDkC,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,CAE1B;AAEV,CACF;AAEA9B,EAAO2C,cAAc;"}
|
package/dist/index30.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index30.js","sources":["../src/components/Pagination/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Icon } from 'components/Icon';\n\ninterface PaginationProps {\n currentPage: number;\n itemsPerPage: number;\n totalItems: number;\n onPageChange: (page: number) => void;\n mobileView?: boolean;\n}\n\nconst paginationClassNames = {\n pageNavigation: \"px-[6px] flex items-center justify-center disabled:opacity-50 hover:cursor-pointer\",\n pageItem: \"px-[6px] text-sm flex items-center justify-center rounded border hover:cursor-pointer\"\n}\n\nexport const Pagination: React.FC<PaginationProps> = ({ currentPage, itemsPerPage, totalItems, onPageChange, mobileView = false }) => {\n const totalPages = Math.ceil(totalItems / itemsPerPage);\n const firstPage = 1;\n const lastPage = totalPages;\n const startItem = (currentPage - 1) * itemsPerPage + 1;\n const endItem = Math.min(currentPage * itemsPerPage, totalItems);\n const hasNextPage = endItem < totalItems;\n const hasPrevPage = currentPage > 1;\n\n const renderPageNumbers = () => {\n const pages = [];\n\n const renderPageNumber = (pageNum: number) => {\n return (\n <span\n key={pageNum}\n onClick={() => onPageChange(pageNum)}\n className={`${paginationClassNames.pageItem} ${currentPage === pageNum ? 'bg-[var(--color-gray-100)] border-[var(--color-gray-300)]' : 'border-[var(--color-gray-200)] hover:bg-[var(--color-gray-50)]'}`}\n data-automation-id={`page-number-${pageNum}`}\n >\n {pageNum}\n </span>\n );\n };\n\n const renderEllipsis = (key: string) => {\n return (\n <span key={key} className=\"w-5 h-5 text-sm rounded border border-[var(--color-gray-200)] flex items-end justify-center\">\n ...\n </span>\n );\n };\n if(mobileView) {\n pages.push(renderPageNumber(currentPage));\n\n return pages;\n }\n if (currentPage <= 3) {\n for (let i = 1; i <= Math.min(3, totalPages); i++) {\n pages.push(renderPageNumber(i));\n }\n\n if (totalPages > 3) {\n pages.push(renderEllipsis(\"ellipsis-end\"));\n pages.push(renderPageNumber(totalPages));\n }\n } else if (currentPage >= totalPages - 2) {\n pages.push(renderPageNumber(firstPage));\n pages.push(renderEllipsis(\"ellipsis-start\"));\n pages.push(renderPageNumber(totalPages - 2));\n pages.push(renderPageNumber(totalPages - 1));\n pages.push(renderPageNumber(totalPages));\n } else {\n pages.push(renderPageNumber(firstPage));\n pages.push(renderEllipsis(\"ellipsis-start\"));\n pages.push(renderPageNumber(currentPage - 1));\n pages.push(renderPageNumber(currentPage));\n pages.push(renderPageNumber(currentPage + 1));\n pages.push(renderEllipsis(\"ellipsis-end\"));\n pages.push(renderPageNumber(lastPage));\n }\n\n return pages;\n };\n\n return (\n <div className=\"flex items-center gap-1 font-normal\" data-automation-id=\"pagination-container\">\n <span className=\"text-sm text-[var(--color-gray-700)] mr-1\" data-automation-id=\"pagination-items-info\">\n {`${mobileView ? \"\" : \"Showing \"}${startItem}-${endItem} of ${totalItems}`}\n </span>\n <span\n onClick={() => hasPrevPage && onPageChange(currentPage - 1)}\n className={`${paginationClassNames.pageNavigation}`}\n data-automation-id=\"pagination-previous-button\"\n >\n <Icon name=\"next\" className=\"rotate-180 transition-transform stroke-[var(--color-gray-600)]\" />\n </span>\n {/* Render page numbers */}\n <div className=\"flex items-center gap-1\">{renderPageNumbers()}</div>\n <span\n onClick={() => hasNextPage && onPageChange(currentPage + 1)}\n className={`${paginationClassNames.pageNavigation}`}\n data-automation-id=\"pagination-next-button\"\n >\n <Icon name=\"next\" />\n </span>\n </div>\n );\n};\n"],"names":["React__default","Icon","paginationClassNames","pageNavigation","pageItem","Pagination","currentPage","itemsPerPage","totalItems","onPageChange","mobileView","totalPages","Math","ceil","firstPage","lastPage","startItem","endItem","min","hasNextPage","hasPrevPage","renderPageNumbers","pages","renderPageNumber","pageNum","React","createElement","key","onClick","className","renderEllipsis","push","i","name"],"mappings":"AAYA,OAAAA,OAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,MAAMC,IAAuB;AAAA,EAC3BC,gBAAgB;AAAA,EAChBC,UAAU;AACZ,GAEaC,IAAwCA,CAAC;AAAA,EAAEC,aAAAA;AAAAA,EAAaC,cAAAA;AAAAA,EAAcC,YAAAA;AAAAA,EAAYC,cAAAA;AAAAA,EAAcC,YAAAA,IAAa;AAAM,MAAM;AACpI,QAAMC,IAAaC,KAAKC,KAAKL,IAAaD,CAAY,GAChDO,IAAY,GACZC,IAAWJ,GACXK,KAAaV,IAAc,KAAKC,IAAe,GAC/CU,IAAUL,KAAKM,IAAIZ,IAAcC,GAAcC,CAAU,GACzDW,IAAcF,IAAUT,GACxBY,IAAcd,IAAc,GAE5Be,IAAoBA,MAAM;AAC9B,UAAMC,IAAQ,CAAA,GAERC,IAAmBA,CAACC,MAEtBC,gBAAAA,EAAAC,cAAA,QAAA;AAAA,MACEC,KAAKH;AAAAA,MACLI,SAASA,MAAMnB,EAAae,CAAO;AAAA,MACnCK,WAAW,GAAG3B,EAAqBE,QAAQ,IAAIE,MAAgBkB,IAAU,8DAA8D,gEAAgE;AAAA,MACvM,sBAAoB,eAAeA,CAAO;AAAA,
|
|
1
|
+
{"version":3,"file":"index30.js","sources":["../src/components/Pagination/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Icon } from 'components/Icon';\n\ninterface PaginationProps {\n currentPage: number;\n itemsPerPage: number;\n totalItems: number;\n onPageChange: (page: number) => void;\n mobileView?: boolean;\n}\n\nconst paginationClassNames = {\n pageNavigation: \"px-[6px] flex items-center justify-center disabled:opacity-50 hover:cursor-pointer\",\n pageItem: \"px-[6px] text-sm flex items-center justify-center rounded border hover:cursor-pointer\"\n}\n\nexport const Pagination: React.FC<PaginationProps> = ({ currentPage, itemsPerPage, totalItems, onPageChange, mobileView = false }) => {\n const totalPages = Math.ceil(totalItems / itemsPerPage);\n const firstPage = 1;\n const lastPage = totalPages;\n const startItem = (currentPage - 1) * itemsPerPage + 1;\n const endItem = Math.min(currentPage * itemsPerPage, totalItems);\n const hasNextPage = endItem < totalItems;\n const hasPrevPage = currentPage > 1;\n\n const renderPageNumbers = () => {\n const pages = [];\n\n const renderPageNumber = (pageNum: number) => {\n return (\n <span\n key={pageNum}\n onClick={() => onPageChange(pageNum)}\n className={`${paginationClassNames.pageItem} ${currentPage === pageNum ? 'bg-[var(--color-gray-100)] border-[var(--color-gray-300)]' : 'border-[var(--color-gray-200)] hover:bg-[var(--color-gray-50)]'}`}\n data-automation-id={`page-number-${pageNum}`}\n >\n {pageNum}\n </span>\n );\n };\n\n const renderEllipsis = (key: string) => {\n return (\n <span key={key} className=\"w-5 h-5 text-sm rounded border border-[var(--color-gray-200)] flex items-end justify-center\">\n ...\n </span>\n );\n };\n if(mobileView) {\n pages.push(renderPageNumber(currentPage));\n\n return pages;\n }\n if (currentPage <= 3) {\n for (let i = 1; i <= Math.min(3, totalPages); i++) {\n pages.push(renderPageNumber(i));\n }\n\n if (totalPages > 3) {\n pages.push(renderEllipsis(\"ellipsis-end\"));\n pages.push(renderPageNumber(totalPages));\n }\n } else if (currentPage >= totalPages - 2) {\n pages.push(renderPageNumber(firstPage));\n pages.push(renderEllipsis(\"ellipsis-start\"));\n pages.push(renderPageNumber(totalPages - 2));\n pages.push(renderPageNumber(totalPages - 1));\n pages.push(renderPageNumber(totalPages));\n } else {\n pages.push(renderPageNumber(firstPage));\n pages.push(renderEllipsis(\"ellipsis-start\"));\n pages.push(renderPageNumber(currentPage - 1));\n pages.push(renderPageNumber(currentPage));\n pages.push(renderPageNumber(currentPage + 1));\n pages.push(renderEllipsis(\"ellipsis-end\"));\n pages.push(renderPageNumber(lastPage));\n }\n\n return pages;\n };\n\n return (\n <div className=\"flex items-center gap-1 font-normal\" data-automation-id=\"pagination-container\">\n <span className=\"text-sm text-[var(--color-gray-700)] mr-1\" data-automation-id=\"pagination-items-info\">\n {`${mobileView ? \"\" : \"Showing \"}${startItem}-${endItem} of ${totalItems}`}\n </span>\n <span\n onClick={() => hasPrevPage && onPageChange(currentPage - 1)}\n className={`${paginationClassNames.pageNavigation}`}\n data-automation-id=\"pagination-previous-button\"\n >\n <Icon name=\"next\" className=\"rotate-180 transition-transform stroke-[var(--color-gray-600)]\" />\n </span>\n {/* Render page numbers */}\n <div className=\"flex items-center gap-1\">{renderPageNumbers()}</div>\n <span\n onClick={() => hasNextPage && onPageChange(currentPage + 1)}\n className={`${paginationClassNames.pageNavigation}`}\n data-automation-id=\"pagination-next-button\"\n >\n <Icon name=\"next\" />\n </span>\n </div>\n );\n};\n"],"names":["React__default","Icon","paginationClassNames","pageNavigation","pageItem","Pagination","currentPage","itemsPerPage","totalItems","onPageChange","mobileView","totalPages","Math","ceil","firstPage","lastPage","startItem","endItem","min","hasNextPage","hasPrevPage","renderPageNumbers","pages","renderPageNumber","pageNum","React","createElement","key","onClick","className","renderEllipsis","push","i","name"],"mappings":"AAYA,OAAAA,OAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,MAAMC,IAAuB;AAAA,EAC3BC,gBAAgB;AA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AAqBC,cAAc;AAAA,IACjD,sBAAmB;AAAA,EAAA,GAEnBuB,gBAAAA,EAAAA,cAACzB,GAAI;AAAA,IAACgC,MAAK;AAAA,EAAQ,CAAA,CACf,CACH;AAET;"}
|
package/dist/index31.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "react";
|
|
2
2
|
import { Button as N } from "./index3.js";
|
|
3
3
|
import { Badge as I } from "./index9.js";
|
|
4
|
-
import { Icon as
|
|
4
|
+
import { Icon as d } from "./index5.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
const t = {
|
|
7
7
|
widgetCtn: "flex flex-col gap-[2px] align-center border border-[var(--color-gray-200)] rounded-[12px] w-[385px]",
|
|
@@ -21,16 +21,16 @@ const t = {
|
|
|
21
21
|
requestFeatureImageCtn: "w-[48px] h-[48px] border border-[var(--color-gray-200)] rounded-[50%] flex items-center flex-shrink-0 bg-[var(--color-red-50)]",
|
|
22
22
|
requestFeatureDescriptionCtn: "flex flex-col"
|
|
23
23
|
}, B = ({
|
|
24
|
-
widgetClassName:
|
|
24
|
+
widgetClassName: g = "",
|
|
25
25
|
widgetType: a = "general",
|
|
26
26
|
widgetTitle: r = "",
|
|
27
27
|
widgetDescription: l = "",
|
|
28
28
|
widgetImage: p,
|
|
29
|
-
hasImage:
|
|
29
|
+
hasImage: f = !1,
|
|
30
30
|
hasButtonCta: n = !1,
|
|
31
31
|
hasLinkCta: i = !1,
|
|
32
32
|
ctaText: o = "",
|
|
33
|
-
hasBadge:
|
|
33
|
+
hasBadge: x = !1,
|
|
34
34
|
badgeText: w = "",
|
|
35
35
|
buttonBgColor: u = "secondary",
|
|
36
36
|
onCtaClick: b,
|
|
@@ -38,7 +38,7 @@ const t = {
|
|
|
38
38
|
webinarDateInfo: c,
|
|
39
39
|
webinarSpeaker: s
|
|
40
40
|
}) => {
|
|
41
|
-
const E =
|
|
41
|
+
const E = x && /* @__PURE__ */ e.createElement(I, {
|
|
42
42
|
label: w,
|
|
43
43
|
className: t.widgetBadge,
|
|
44
44
|
bgColor: "var(--color-yellow-50)",
|
|
@@ -52,14 +52,14 @@ const t = {
|
|
|
52
52
|
label: o,
|
|
53
53
|
className: `${t.widgetButtonCta} mt-[4px]`,
|
|
54
54
|
onClick: b
|
|
55
|
-
})), C =
|
|
55
|
+
})), C = f && /* @__PURE__ */ e.createElement("div", {
|
|
56
56
|
className: `${t.widgetImageCtn} widget-image-ctn`
|
|
57
57
|
}, /* @__PURE__ */ e.createElement("img", {
|
|
58
58
|
src: p,
|
|
59
59
|
alt: "widget-image"
|
|
60
60
|
}));
|
|
61
61
|
return /* @__PURE__ */ e.createElement("div", {
|
|
62
|
-
className: `${t.widgetCtn} ${
|
|
62
|
+
className: `${t.widgetCtn} ${g} widget-ctn`,
|
|
63
63
|
onClick: v
|
|
64
64
|
}, a !== "general" && C, /* @__PURE__ */ e.createElement("div", {
|
|
65
65
|
className: t.descriptionCtn
|
|
@@ -71,14 +71,14 @@ const t = {
|
|
|
71
71
|
className: t.webinarInfoCtn
|
|
72
72
|
}, s && /* @__PURE__ */ e.createElement("div", {
|
|
73
73
|
className: `${t.webinarDescriptionInfo} align-baseline`
|
|
74
|
-
}, /* @__PURE__ */ e.createElement(
|
|
74
|
+
}, /* @__PURE__ */ e.createElement(d, {
|
|
75
75
|
name: "people",
|
|
76
76
|
className: "relative top-[2px]"
|
|
77
77
|
}), /* @__PURE__ */ e.createElement("span", {
|
|
78
78
|
className: t.webinarSpeaker
|
|
79
79
|
}, s)), c && /* @__PURE__ */ e.createElement("div", {
|
|
80
80
|
className: `${t.webinarTimeInfo} align-baseline mb-[4px]`
|
|
81
|
-
}, /* @__PURE__ */ e.createElement(
|
|
81
|
+
}, /* @__PURE__ */ e.createElement(d, {
|
|
82
82
|
name: "clock",
|
|
83
83
|
className: "relative top-[2px]"
|
|
84
84
|
}), /* @__PURE__ */ e.createElement("span", {
|
|
@@ -96,6 +96,7 @@ const t = {
|
|
|
96
96
|
}, l), m)) : m));
|
|
97
97
|
};
|
|
98
98
|
export {
|
|
99
|
-
B as Widget
|
|
99
|
+
B as Widget,
|
|
100
|
+
B as default
|
|
100
101
|
};
|
|
101
102
|
//# sourceMappingURL=index31.js.map
|
package/dist/index31.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index31.js","sources":["../src/components/Widget/index.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport { Map } from \"../../utils/common.types\";\nimport { Button } from \"../Button\";\nimport { Badge } from \"../Badge\";\nimport { Icon } from \"../Icon\";\nimport \"./style.scss\";\n\nexport interface WidgetProps {\n widgetClassName?: string;\n widgetType?: \"promotion\" | \"webinar\" | \"request-feature\" | \"general\";\n widgetTitle?: string;\n hasBadge?: boolean;\n webinarSpeaker?: string;\n badgeText?: string;\n widgetDescription?: string;\n webinarDateInfo?: string;\n hasImage?: boolean;\n widgetImage?: string;\n hasButtonCta?: boolean;\n buttonBgColor?: 'primary' | 'secondary';\n hasLinkCta?: boolean;\n ctaText?: string;\n onCtaClick?: () => void;\n onWidgetClick?: () => void;\n}\n\nconst className: Map = {\n widgetCtn: 'flex flex-col gap-[2px] align-center border border-[var(--color-gray-200)] rounded-[12px] w-[385px]',\n widgetImageCtn: 'cursor-pointer',\n descriptionCtn: 'p-4 flex flex-col',\n widgetTitle: 'text-[var(--color-gray-900)] mt-[4px] mb-[8px]',\n widgetDescription: 'text-[var(--color-gray-700)] mb-[4px]',\n widgetLinkCta: 'text-[var(--color-blue-500)] cursor-pointer hover:text-[var(--color-blue-600)]',\n widgetButtonCta: 'self-start',\n widgetBadge: 'w-fit',\n webinarInfoCtn: 'flex flex-col gap-2',\n webinarSpeaker: 'text-[var(--color-gray-700)]',\n webinarDate: 'text-[var(--color-gray-700)]',\n webinarDescriptionInfo: 'flex gap-2',\n webinarTimeInfo: 'flex gap-2',\n requestFeatureCtn: 'flex gap-[12px]',\n requestFeatureImageCtn: 'w-[48px] h-[48px] border border-[var(--color-gray-200)] rounded-[50%] flex items-center flex-shrink-0 bg-[var(--color-red-50)]',\n requestFeatureDescriptionCtn: 'flex flex-col',\n};\n\nexport const Widget: FC<WidgetProps> = ({\n widgetClassName = \"\",\n widgetType = 'general',\n widgetTitle = \"\",\n widgetDescription = \"\",\n widgetImage,\n hasImage = false,\n hasButtonCta = false,\n hasLinkCta = false,\n ctaText = \"\",\n hasBadge = false,\n badgeText = \"\",\n buttonBgColor = 'secondary',\n onCtaClick,\n onWidgetClick,\n webinarDateInfo,\n webinarSpeaker,\n}) => {\n\n const renderBadge = hasBadge && (\n <Badge\n label={badgeText}\n className={className.widgetBadge}\n bgColor=\"var(--color-yellow-50)\"\n textColor=\"var(--color-yellow-400)\"\n fontWeight=\"normal\"\n />\n );\n\n const renderCTA = (hasLinkCta || hasButtonCta) && (\n <React.Fragment>\n {hasLinkCta && <span className={className.widgetLinkCta}>{ctaText}</span>}\n {hasButtonCta && <Button type={buttonBgColor} size=\"md\" label={ctaText} className={`${className.widgetButtonCta} mt-[4px]`} onClick={onCtaClick} />}\n </React.Fragment>\n );\n\n const renderImage = hasImage && (\n <div className={`${className.widgetImageCtn} widget-image-ctn`}>\n <img src={widgetImage} alt=\"widget-image\"/>\n </div>\n );\n\n return (\n <div className={`${className.widgetCtn} ${widgetClassName} widget-ctn`} onClick={onWidgetClick}>\n {widgetType !== \"general\" && renderImage}\n <div className={className.descriptionCtn}>\n {widgetType !== \"general\" && renderBadge}\n {widgetType !== \"request-feature\" && <span className={`${className.widgetTitle} widget-title`}>{widgetTitle}</span>}\n\n {([\"promotion\", \"general\"].includes(widgetType)) && (\n <span className={`${className.widgetDescription} widget-description`}>{widgetDescription}</span>\n )}\n\n {widgetType === \"webinar\" && (\n <div className={className.webinarInfoCtn}>\n {webinarSpeaker && (\n <div className={`${className.webinarDescriptionInfo} align-baseline`}>\n <Icon name=\"people\" className=\"relative top-[2px]\" />\n <span className={className.webinarSpeaker}>{webinarSpeaker}</span>\n </div>\n )}\n {webinarDateInfo && (\n <div className={`${className.webinarTimeInfo} align-baseline mb-[4px]`}>\n <Icon name=\"clock\" className=\"relative top-[2px]\" />\n <span className={className.webinarDate}>{webinarDateInfo}</span>\n </div>\n )}\n </div>\n )}\n\n {widgetType === \"request-feature\" ? (\n <div className={className.requestFeatureCtn}>\n <div className={className.requestFeatureImageCtn} />\n <div className={className.requestFeatureDescriptionCtn}>\n <span className={`${className.widgetTitle} widget-title`}>{widgetTitle}</span>\n <span className={`${className.widgetDescription} widget-description`}>{widgetDescription}</span>\n {renderCTA}\n </div>\n </div>\n ) : (\n renderCTA\n )}\n </div>\n </div>\n );\n};\n\nexport default Widget;"],"names":["React__default","Button","Badge","Icon","className","widgetCtn","widgetImageCtn","descriptionCtn","widgetTitle","widgetDescription","widgetLinkCta","widgetButtonCta","widgetBadge","webinarInfoCtn","webinarSpeaker","webinarDate","webinarDescriptionInfo","webinarTimeInfo","requestFeatureCtn","requestFeatureImageCtn","requestFeatureDescriptionCtn","Widget","widgetClassName","widgetType","widgetImage","hasImage","hasButtonCta","hasLinkCta","ctaText","hasBadge","badgeText","buttonBgColor","onCtaClick","onWidgetClick","webinarDateInfo","renderBadge","
|
|
1
|
+
{"version":3,"file":"index31.js","sources":["../src/components/Widget/index.tsx"],"sourcesContent":["import React, { FC } from \"react\";\nimport { Map } from \"../../utils/common.types\";\nimport { Button } from \"../Button\";\nimport { Badge } from \"../Badge\";\nimport { Icon } from \"../Icon\";\nimport \"./style.scss\";\n\nexport interface WidgetProps {\n widgetClassName?: string;\n widgetType?: \"promotion\" | \"webinar\" | \"request-feature\" | \"general\";\n widgetTitle?: string;\n hasBadge?: boolean;\n webinarSpeaker?: string;\n badgeText?: string;\n widgetDescription?: string;\n webinarDateInfo?: string;\n hasImage?: boolean;\n widgetImage?: string;\n hasButtonCta?: boolean;\n buttonBgColor?: 'primary' | 'secondary';\n hasLinkCta?: boolean;\n ctaText?: string;\n onCtaClick?: () => void;\n onWidgetClick?: () => void;\n}\n\nconst className: Map = {\n widgetCtn: 'flex flex-col gap-[2px] align-center border border-[var(--color-gray-200)] rounded-[12px] w-[385px]',\n widgetImageCtn: 'cursor-pointer',\n descriptionCtn: 'p-4 flex flex-col',\n widgetTitle: 'text-[var(--color-gray-900)] mt-[4px] mb-[8px]',\n widgetDescription: 'text-[var(--color-gray-700)] mb-[4px]',\n widgetLinkCta: 'text-[var(--color-blue-500)] cursor-pointer hover:text-[var(--color-blue-600)]',\n widgetButtonCta: 'self-start',\n widgetBadge: 'w-fit',\n webinarInfoCtn: 'flex flex-col gap-2',\n webinarSpeaker: 'text-[var(--color-gray-700)]',\n webinarDate: 'text-[var(--color-gray-700)]',\n webinarDescriptionInfo: 'flex gap-2',\n webinarTimeInfo: 'flex gap-2',\n requestFeatureCtn: 'flex gap-[12px]',\n requestFeatureImageCtn: 'w-[48px] h-[48px] border border-[var(--color-gray-200)] rounded-[50%] flex items-center flex-shrink-0 bg-[var(--color-red-50)]',\n requestFeatureDescriptionCtn: 'flex flex-col',\n};\n\nexport const Widget: FC<WidgetProps> = ({\n widgetClassName = \"\",\n widgetType = 'general',\n widgetTitle = \"\",\n widgetDescription = \"\",\n widgetImage,\n hasImage = false,\n hasButtonCta = false,\n hasLinkCta = false,\n ctaText = \"\",\n hasBadge = false,\n badgeText = \"\",\n buttonBgColor = 'secondary',\n onCtaClick,\n onWidgetClick,\n webinarDateInfo,\n webinarSpeaker,\n}) => {\n\n const renderBadge = hasBadge && (\n <Badge\n label={badgeText}\n className={className.widgetBadge}\n bgColor=\"var(--color-yellow-50)\"\n textColor=\"var(--color-yellow-400)\"\n fontWeight=\"normal\"\n />\n );\n\n const renderCTA = (hasLinkCta || hasButtonCta) && (\n <React.Fragment>\n {hasLinkCta && <span className={className.widgetLinkCta}>{ctaText}</span>}\n {hasButtonCta && <Button type={buttonBgColor} size=\"md\" label={ctaText} className={`${className.widgetButtonCta} mt-[4px]`} onClick={onCtaClick} />}\n </React.Fragment>\n );\n\n const renderImage = hasImage && (\n <div className={`${className.widgetImageCtn} widget-image-ctn`}>\n <img src={widgetImage} alt=\"widget-image\"/>\n </div>\n );\n\n return (\n <div className={`${className.widgetCtn} ${widgetClassName} widget-ctn`} onClick={onWidgetClick}>\n {widgetType !== \"general\" && renderImage}\n <div className={className.descriptionCtn}>\n {widgetType !== \"general\" && renderBadge}\n {widgetType !== \"request-feature\" && <span className={`${className.widgetTitle} widget-title`}>{widgetTitle}</span>}\n\n {([\"promotion\", \"general\"].includes(widgetType)) && (\n <span className={`${className.widgetDescription} widget-description`}>{widgetDescription}</span>\n )}\n\n {widgetType === \"webinar\" && (\n <div className={className.webinarInfoCtn}>\n {webinarSpeaker && (\n <div className={`${className.webinarDescriptionInfo} align-baseline`}>\n <Icon name=\"people\" className=\"relative top-[2px]\" />\n <span className={className.webinarSpeaker}>{webinarSpeaker}</span>\n </div>\n )}\n {webinarDateInfo && (\n <div className={`${className.webinarTimeInfo} align-baseline mb-[4px]`}>\n <Icon name=\"clock\" className=\"relative top-[2px]\" />\n <span className={className.webinarDate}>{webinarDateInfo}</span>\n </div>\n )}\n </div>\n )}\n\n {widgetType === \"request-feature\" ? (\n <div className={className.requestFeatureCtn}>\n <div className={className.requestFeatureImageCtn} />\n <div className={className.requestFeatureDescriptionCtn}>\n <span className={`${className.widgetTitle} widget-title`}>{widgetTitle}</span>\n <span className={`${className.widgetDescription} widget-description`}>{widgetDescription}</span>\n {renderCTA}\n </div>\n </div>\n ) : (\n renderCTA\n )}\n </div>\n </div>\n );\n};\n\nexport default Widget;"],"names":["React__default","Button","Badge","Icon","className","widgetCtn","widgetImageCtn","descriptionCtn","widgetTitle","widgetDescription","widgetLinkCta","widgetButtonCta","widgetBadge","webinarInfoCtn","webinarSpeaker","webinarDate","webinarDescriptionInfo","webinarTimeInfo","requestFeatureCtn","requestFeatureImageCtn","requestFeatureDescriptionCtn","Widget","widgetClassName","widgetType","widgetImage","hasImage","hasButtonCta","hasLinkCta","ctaText","hasBadge","badgeText","buttonBgColor","onCtaClick","onWidgetClick","webinarDateInfo","renderBadge","createElement","label","bgColor","textColor","fontWeight","renderCTA","React","Fragment","type","size","onClick","renderImage","src","alt","includes","name"],"mappings":"AA0BA,OAAAA,OAAA;AAAA,SAAA,UAAAC,SAAA;AAAA,SAAA,SAAAC,SAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,OAAA;AAAA,MAAMC,IAAiB;AAAA,EACrBC,WAAW;AAAA,EACXC,gBAAgB;AAAA,EAChBC,gBAAgB;AAAA,EAChBC,aAAa;AAAA,EACbC,mBAAmB;AAAA,EACnBC,eAAe;AAAA,EACfC,iBAAiB;AAAA,EACjBC,aAAa;AAAA,EACbC,gBAAgB;AAAA,EAChBC,gBAAgB;AAAA,EAChBC,aAAa;AAAA,EACbC,wBAAwB;AAAA,EACxBC,iBAAiB;AAAA,EACjBC,mBAAmB;AAAA,EACnBC,wBAAwB;AAAA,EACxBC,8BAA8B;AAChC,GAEaC,IAA0BA,CAAC;AAAA,EACtCC,iBAAAA,IAAkB;AAAA,EAClBC,YAAAA,IAAa;AAAA,EACbf,aAAAA,IAAc;AAAA,EACdC,mBAAAA,IAAoB;AAAA,EACpBe,aAAAA;AAAAA,EACAC,UAAAA,IAAW;AAAA,EACXC,cAAAA,IAAe;AAAA,EACfC,YAAAA,IAAa;AAAA,EACbC,SAAAA,IAAU;AAAA,EACVC,UAAAA,IAAW;AAAA,EACXC,WAAAA,IAAY;AAAA,EACZC,eAAAA,IAAgB;AAAA,EAChBC,YAAAA;AAAAA,EACAC,eAAAA;AAAAA,EACAC,iBAAAA;AAAAA,EACApB,gBAAAA;AACF,MAAM;AAEJ,QAAMqB,IAAcN,KAClBO,gBAAAA,EAAAA,cAAClC,GAAK;AAAA,IACJmC,OAAOP;AAAAA,IACP1B,WAAWA,EAAUQ;AAAAA,IACrB0B,SAAQ;AAAA,IACRC,WAAU;AAAA,IACVC,YAAW;AAAA,EAAA,CACZ,GAGGC,KAAad,KAAcD,MAC/BU,gBAAAA,EAAAA,cAACM,EAAMC,UAAQ,MACZhB,KAAcS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AAI;AAAA,IAACgD,MAAK;AAAA,IAAS/C,WAAU;AAAA,EAAA,CAAsB,GACpDgC,gBAAAA,EAAAA,cAAA,QAAA;AAAA,IAAMhC,WAAWA,EAAUU;AAAAA,EAAAA,GAAiBA,CAAqB,CAC9D,GAEJoB,KACEQ,gBAAAA,EAAAN,cAAA,OAAA;AAAA,IAAKhC,WAAW,GAAGA,EAAUa,eAAe;AAAA,EAAA,GAC3CmB,gBAAAA,EAAAA,cAACjC,GAAI;AAAA,IAACgD,MAAK;AAAA,IAAQ/C,WAAU;AAAA,EAAA,CAAsB,GACnDgC,gBAAAA,EAAAA,cAAA,QAAA;AAAA,IAAMhC,WAAWA,EAAUW;AAAAA,EAAAA,GAAcmB,CAAsB,CAC5D,CAEJ,GAGNX,MAAe,oBACda,gBAAAA,EAAAA,cAAA,OAAA;AAAA,IAAKhC,WAAWA,EAAUc;AAAAA,EAAAA,GACxBkB,gBAAAA,EAAAA,cAAA,OAAA;AAAA,IAAKhC,WAAWA,EAAUe;AAAAA,EAAAA,CAAyB,GACnDiB,gBAAAA,EAAAA,cAAA,OAAA;AAAA,IAAKhC,WAAWA,EAAUgB;AAAAA,EAAAA,GACxBgB,gBAAAA,EAAAA,cAAA,QAAA;AAAA,IAAMhC,WAAW,GAAGA,EAAUI,WAAW;AAAA,EAAkBA,GAAAA,CAAkB,GAC7EkC,gBAAAA,EAAAN,cAAA,QAAA;AAAA,IAAMhC,WAAW,GAAGA,EAAUK,iBAAiB;AAAA,KAAwBA,CAAwB,GAC9FgC,CACE,CACF,IAELA,CAEC,CACF;AAET;"}
|
package/dist/index32.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index32.js","sources":["../src/components/Radio/index.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nexport interface RadioProps {\n label: string;\n value: string;\n checked: boolean;\n disabled: boolean;\n name: string;\n onChange?: (props: RadioProps) => void;\n helperLabel?: string;\n maxWidth?: string;\n width?: string;\n radioLabelClassName?: string;\n radioContainerClassName?: string;\n automationId?: string;\n withBorder?: boolean;\n bgColor?: string;\n content?: () => React.ReactNode;\n}\n\nexport function Radio(props: RadioProps) {\n const {\n label,\n value,\n checked,\n disabled,\n name,\n onChange,\n width,\n radioLabelClassName = '',\n radioContainerClassName = '',\n automationId = '',\n bgColor = 'var(--color-white)',\n withBorder = true,\n content\n } = props;\n const radioRef = useRef<HTMLInputElement>(null);\n\n return (\n <div\n className={`se-design-radio-container flex flex-col justify-center items-start gap-2 ${\n disabled ? 'cursor-not-allowed' : 'cursor-pointer'\n } ${\n withBorder ? `border ${checked ? 'border-[var(--color-blue-500)]' : 'border-[var(--color-gray-400)]'} p-4` : ''\n } rounded-[6px] transition-colors duration-300 ${disabled ? 'opacity-50' : ''} ${radioContainerClassName}`}\n onClick={() => radioRef.current?.click()}\n style={{ width: width || 'auto', backgroundColor: bgColor }}\n data-automation-id={automationId}\n >\n <div className=\"flex items-center gap-[0.625rem]\" data-automation-id=\"radio-field-content\">\n <input\n ref={radioRef}\n type=\"radio\"\n id={value}\n name={name}\n value={value}\n checked={checked}\n disabled={disabled}\n className=\"radio-field-input cursor-pointer accent-[var(--color-blue-500)] disabled:cursor-not-allowed disabled:opacity-50 text-[var(--color-blue-500)] w-[14px] h-[14px] p-[3px]\"\n onChange={() => {\n onChange && onChange({ ...props, checked: true });\n }}\n />\n <label\n htmlFor={value}\n className={`${props.helperLabel ? 'flex flex-col gap-[6px]' : ''} ${\n disabled ? 'cursor-not-allowed' : 'cursor-pointer'\n }`}\n data-automation-id=\"radio-field-label\"\n >\n <span\n className={`text-sm text-[var(--color-gray-800)] ${radioLabelClassName} `}\n style={{ fontSize: '16px', fontWeight: '400' }}\n >\n {label}\n </span>\n </label>\n </div>\n {checked && content && <div className=\"radio-child-content pl-[1.5rem] w-full\">{content()}</div>}\n {props.helperLabel && (\n <span\n className={`text-sm font-normal text-[var(--color-gray-600)] ${\n props.maxWidth ? `max-w-[${props.maxWidth}]` : 'max-w-full'\n } break-words whitespace-normal`}\n data-automation-id=\"radio-field-helper-text\"\n >\n {props.helperLabel}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Radio","props","label","value","checked","disabled","name","onChange","width","radioLabelClassName","radioContainerClassName","automationId","bgColor","withBorder","content","radioRef","useRef","React","createElement","className","onClick","current","click","style","backgroundColor","ref","type","id","htmlFor","helperLabel","fontSize","fontWeight","maxWidth"],"mappings":";AAoBO,SAASA,EAAMC,GAAmB;
|
|
1
|
+
{"version":3,"file":"index32.js","sources":["../src/components/Radio/index.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nexport interface RadioProps {\n label: string;\n value: string;\n checked: boolean;\n disabled: boolean;\n name: string;\n onChange?: (props: RadioProps) => void;\n helperLabel?: string;\n maxWidth?: string;\n width?: string;\n radioLabelClassName?: string;\n radioContainerClassName?: string;\n automationId?: string;\n withBorder?: boolean;\n bgColor?: string;\n content?: () => React.ReactNode;\n}\n\nexport function Radio(props: RadioProps) {\n const {\n label,\n value,\n checked,\n disabled,\n name,\n onChange,\n width,\n radioLabelClassName = '',\n radioContainerClassName = '',\n automationId = '',\n bgColor = 'var(--color-white)',\n withBorder = true,\n content\n } = props;\n const radioRef = useRef<HTMLInputElement>(null);\n\n return (\n <div\n className={`se-design-radio-container flex flex-col justify-center items-start gap-2 ${\n disabled ? 'cursor-not-allowed' : 'cursor-pointer'\n } ${\n withBorder ? `border ${checked ? 'border-[var(--color-blue-500)]' : 'border-[var(--color-gray-400)]'} p-4` : ''\n } rounded-[6px] transition-colors duration-300 ${disabled ? 'opacity-50' : ''} ${radioContainerClassName}`}\n onClick={() => radioRef.current?.click()}\n style={{ width: width || 'auto', backgroundColor: bgColor }}\n data-automation-id={automationId}\n >\n <div className=\"flex items-center gap-[0.625rem]\" data-automation-id=\"radio-field-content\">\n <input\n ref={radioRef}\n type=\"radio\"\n id={value}\n name={name}\n value={value}\n checked={checked}\n disabled={disabled}\n className=\"radio-field-input cursor-pointer accent-[var(--color-blue-500)] disabled:cursor-not-allowed disabled:opacity-50 text-[var(--color-blue-500)] w-[14px] h-[14px] p-[3px]\"\n onChange={() => {\n onChange && onChange({ ...props, checked: true });\n }}\n />\n <label\n htmlFor={value}\n className={`${props.helperLabel ? 'flex flex-col gap-[6px]' : ''} ${\n disabled ? 'cursor-not-allowed' : 'cursor-pointer'\n }`}\n data-automation-id=\"radio-field-label\"\n >\n <span\n className={`text-sm text-[var(--color-gray-800)] ${radioLabelClassName} `}\n style={{ fontSize: '16px', fontWeight: '400' }}\n >\n {label}\n </span>\n </label>\n </div>\n {checked && content && <div className=\"radio-child-content pl-[1.5rem] w-full\">{content()}</div>}\n {props.helperLabel && (\n <span\n className={`text-sm font-normal text-[var(--color-gray-600)] ${\n props.maxWidth ? `max-w-[${props.maxWidth}]` : 'max-w-full'\n } break-words whitespace-normal`}\n data-automation-id=\"radio-field-helper-text\"\n >\n {props.helperLabel}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Radio","props","label","value","checked","disabled","name","onChange","width","radioLabelClassName","radioContainerClassName","automationId","bgColor","withBorder","content","radioRef","useRef","React","createElement","className","onClick","current","click","style","backgroundColor","ref","type","id","htmlFor","helperLabel","fontSize","fontWeight","maxWidth"],"mappings":";AAoBO,SAASA,EAAMC,GAAmB;AACjC,QAAA;AAAA,IACJC,OAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,MAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,qBAAAA,IAAsB;AAAA,IACtBC,yBAAAA,IAA0B;AAAA,IAC1BC,cAAAA,IAAe;AAAA,IACfC,SAAAA,IAAU;AAAA,IACVC,YAAAA,IAAa;AAAA,IACbC,SAAAA;AAAAA,EACEb,IAAAA,GACEc,IAAWC,EAAyB,IAAI;AAG5CC,SAAAA,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEC,WAAW,4EACTd,IAAW,uBAAuB,gBAAgB,IA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UAAU/B,EAAM+B,QAAQ,MAAM,YAAY;AAAA,IAE7D,sBAAmB;AAAA,EAAA,GAElB/B,EAAM4B,WACH,CAEL;AAET;"}
|
package/dist/index33.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index33.js","sources":["../src/components/RadioGroup/index.tsx"],"sourcesContent":["import React from 'react';\nimport { Radio, RadioProps } from '../Radio';\n\nexport interface RadioGroupProps {\n options: RadioProps[];\n onRadioGroupChange: (obj: RadioProps) => void;\n value?: string;\n direction?: 'row' | 'column';\n automationId?: string;\n withBorder?: boolean;\n /**\n * Accessible name for the radio group.\n * Applied to the fieldset element.\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this radio group.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * Shared name attribute for all radio inputs in the group.\n * Enables arrow-key navigation between options.\n * Must be unique per RadioGroup instance on the page.\n */\n name: string;\n}\n\nexport function RadioGroup(props: RadioGroupProps) {\n const { automationId = '', withBorder = true, ariaLabel, ariaLabelledBy, name } = props;\n const handleRadioChange = (obj: RadioProps) => {\n props.onRadioGroupChange({ ...obj, checked: true });\n };\n \n // Prefer aria-labelledby when provided, fallback to aria-label\n const fieldsetProps = ariaLabelledBy\n ? { 'aria-labelledby': ariaLabelledBy }\n : ariaLabel\n ? { 'aria-label': ariaLabel }\n : {};\n \n return (\n <div data-automation-id={automationId}>\n <fieldset className={`flex flex-wrap gap-2 ${props.direction === 'column' ? 'flex-col' : 'flex-row'}`} {...fieldsetProps}>\n {props.options.map((option) => (\n <Radio key={option.value} {...option} name={name} onChange={handleRadioChange} checked={option.value === props.value} withBorder={withBorder} />\n ))}\n </fieldset>\n </div>\n );\n}\n"],"names":["RadioGroup","props","automationId","withBorder","ariaLabel","ariaLabelledBy","name","handleRadioChange","obj","onRadioGroupChange","checked","fieldsetProps","React","createElement","_extends","className","direction","options","map","option","Radio","key","value","onChange"],"mappings":";;;;;;;;;;;AA6BO,SAASA,EAAWC,GAAwB;
|
|
1
|
+
{"version":3,"file":"index33.js","sources":["../src/components/RadioGroup/index.tsx"],"sourcesContent":["import React from 'react';\nimport { Radio, RadioProps } from '../Radio';\n\nexport interface RadioGroupProps {\n options: RadioProps[];\n onRadioGroupChange: (obj: RadioProps) => void;\n value?: string;\n direction?: 'row' | 'column';\n automationId?: string;\n withBorder?: boolean;\n /**\n * Accessible name for the radio group.\n * Applied to the fieldset element.\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this radio group.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * Shared name attribute for all radio inputs in the group.\n * Enables arrow-key navigation between options.\n * Must be unique per RadioGroup instance on the page.\n */\n name: string;\n}\n\nexport function RadioGroup(props: RadioGroupProps) {\n const { automationId = '', withBorder = true, ariaLabel, ariaLabelledBy, name } = props;\n const handleRadioChange = (obj: RadioProps) => {\n props.onRadioGroupChange({ ...obj, checked: true });\n };\n \n // Prefer aria-labelledby when provided, fallback to aria-label\n const fieldsetProps = ariaLabelledBy\n ? { 'aria-labelledby': ariaLabelledBy }\n : ariaLabel\n ? { 'aria-label': ariaLabel }\n : {};\n \n return (\n <div data-automation-id={automationId}>\n <fieldset className={`flex flex-wrap gap-2 ${props.direction === 'column' ? 'flex-col' : 'flex-row'}`} {...fieldsetProps}>\n {props.options.map((option) => (\n <Radio key={option.value} {...option} name={name} onChange={handleRadioChange} checked={option.value === props.value} withBorder={withBorder} />\n ))}\n </fieldset>\n </div>\n );\n}\n"],"names":["RadioGroup","props","automationId","withBorder","ariaLabel","ariaLabelledBy","name","handleRadioChange","obj","onRadioGroupChange","checked","fieldsetProps","React","createElement","_extends","className","direction","options","map","option","Radio","key","value","onChange"],"mappings":";;;;;;;;;;;AA6BO,SAASA,EAAWC,GAAwB;AAC3C,QAAA;AAAA,IAAEC,cAAAA,IAAe;AAAA,IAAIC,YAAAA,IAAa;AAAA,IAAMC,WAAAA;AAAAA,IAAWC,gBAAAA;AAAAA,IAAgBC,MAAAA;AAAAA,EAASL,IAAAA,GAC5EM,IAAoBA,CAACC,MAAoB;AAC7CP,IAAAA,EAAMQ,mBAAmB;AAAA,MAAE,GAAGD;AAAAA,MAAKE,SAAS;AAAA,IAAA,CAAM;AAAA,EAAA,GAI9CC,IAAgBN,IAClB;AAAA,IAAE,mBAAmBA;AAAAA,MACrBD,IACA;AAAA,IAAE,cAAcA;AAAAA,MAChB;AAGFQ,SAAAA,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAK,sBAAoBX;AAAAA,EACvBU,GAAAA,gBAAAA,EAAAC,cAAA,YAAAC,EAAA;AAAA,IAAUC,WAAW,wBAAwBd,EAAMe,cAAc,WAAW,aAAa,UAAU;AAAA,EAAG,GAAKL,CAAa,GACrHV,EAAMgB,QAAQC,IAAKC,CAClBP,MAAAA,gBAAAA,EAAAC,cAACO,GAAKN,EAAA;AAAA,IAACO,KAAKF,EAAOG;AAAAA,KAAWH,GAAM;AAAA,IAAEb,MAAAA;AAAAA,IAAYiB,UAAUhB;AAAAA,IAAmBG,SAASS,EAAOG,UAAUrB,EAAMqB;AAAAA,IAAOnB,YAAAA;AAAAA,EAAAA,CAAyB,CAAA,CAChJ,CACO,CACP;AAET;"}
|
package/dist/index34.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index34.js","sources":["../src/components/Accordion/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from 'react';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { useAccessiblePress } from '../../utils/a11y';\nimport { getRegionAttributes } from '../../utils/a11y/regionAttributes';\n\nexport interface AccordionProps {\n title: string;\n titleTag?: 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n titleClassName?: string;\n content: React.ReactNode;\n defaultOpen?: boolean;\n showSeparator?: boolean;\n overflow?: 'hidden' | 'visible' | 'scroll' | 'auto' | undefined | string;\n automationId?: string;\n id?: string;\n}\n\nexport const Accordion: FC<AccordionProps> = ({\n title,\n titleTag: TitleTag = 'h4',\n content,\n defaultOpen,\n overflow,\n titleClassName = '',\n showSeparator = true,\n automationId = '',\n id\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n \n useEffect(() => {\n setIsOpen(defaultOpen || false);\n }, [defaultOpen]);\n\n // Generate stable IDs for ARIA relationships\n const titleId = useStableId(id, 'accordion');\n const contentId = `${titleId}-content`; \n\n // Use accessible press hook for keyboard + mouse handling\n const { pressProps, role, tabIndex } = useAccessiblePress({\n onClick: () => setIsOpen(!isOpen),\n isNative: false // Not a native button, so hook adds Enter/Space handling\n });\n\n // Get region attributes for content panel\n const regionAttributes = getRegionAttributes({\n titleId,\n isFocusable: false\n });\n\n const focusVisibleClasses = 'group-focus-visible:[outline:var(--focus-width)_solid_var(--focus-color)] group-focus-visible:[outline-offset:var(--focus-offset)] group-focus-visible:p-[2px]';\n\n return (\n <div>\n <div\n {...pressProps}\n role={role}\n tabIndex={tabIndex}\n aria-expanded={isOpen}\n aria-controls={contentId}\n className=\"se-design-accordion-header flex items-center cursor-pointer group focus-visible:outline-none\"\n data-automation-id={automationId}\n >\n <div className={`flex items-center gap-2 rounded ${focusVisibleClasses}`}>\n <div \n className={`transform transition-transform duration-300 ${isOpen ? 'rotate-90' : ''}`}\n >\n <Icon name=\"rightSide\" />\n </div>\n <TitleTag\n id={titleId}\n className={`se-design-accordion-title text-[var(--color-gray-900)]] font-inter text-[18px] font-semibold leading-[24px] ${titleClassName}`}\n >\n {title}\n </TitleTag>\n </div>\n </div>\n <div\n id={contentId}\n {...regionAttributes}\n className={`\n se-design-accordion-content\n overflow-${overflow || 'hidden'}\n transition-all\n duration-300\n ml-1\n mt-[1vw]\n ${isOpen ? 'max-h-[1000vh] opacity-100 visible h-auto' : 'hidden'}`}\n >\n {content}\n </div>\n {showSeparator && <div className={`h-[1px] bg-[#E5E7EB] mt-[12px] ${!isOpen ? 'block' : 'hidden'}`}></div>}\n </div>\n );\n};\n"],"names":["Accordion","title","titleTag","TitleTag","content","defaultOpen","overflow","titleClassName","showSeparator","automationId","id","isOpen","setIsOpen","useState","useEffect","titleId","useStableId","contentId","pressProps","role","tabIndex","useAccessiblePress","onClick","isNative","regionAttributes","getRegionAttributes","isFocusable","React","createElement","_extends","className","Icon","name"],"mappings":";;;;;;;;;;;;;;AAkBO,MAAMA,IAAgCA,CAAC;AAAA,EAC5CC,OAAAA;AAAAA,EACAC,UAAUC,IAAW;AAAA,EACrBC,SAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,gBAAAA,IAAiB;AAAA,EACjBC,eAAAA,IAAgB;AAAA,EAChBC,cAAAA,IAAe;AAAA,EACfC,IAAAA;AACF,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAE1CC,EAAAA,EAAU,MAAM;AACdF,IAAAA,EAAUP,KAAe,EAAK;AAAA,
|
|
1
|
+
{"version":3,"file":"index34.js","sources":["../src/components/Accordion/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from 'react';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { useAccessiblePress } from '../../utils/a11y';\nimport { getRegionAttributes } from '../../utils/a11y/regionAttributes';\n\nexport interface AccordionProps {\n title: string;\n titleTag?: 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n titleClassName?: string;\n content: React.ReactNode;\n defaultOpen?: boolean;\n showSeparator?: boolean;\n overflow?: 'hidden' | 'visible' | 'scroll' | 'auto' | undefined | string;\n automationId?: string;\n id?: string;\n}\n\nexport const Accordion: FC<AccordionProps> = ({\n title,\n titleTag: TitleTag = 'h4',\n content,\n defaultOpen,\n overflow,\n titleClassName = '',\n showSeparator = true,\n automationId = '',\n id\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n \n useEffect(() => {\n setIsOpen(defaultOpen || false);\n }, [defaultOpen]);\n\n // Generate stable IDs for ARIA relationships\n const titleId = useStableId(id, 'accordion');\n const contentId = `${titleId}-content`; \n\n // Use accessible press hook for keyboard + mouse handling\n const { pressProps, role, tabIndex } = useAccessiblePress({\n onClick: () => setIsOpen(!isOpen),\n isNative: false // Not a native button, so hook adds Enter/Space handling\n });\n\n // Get region attributes for content panel\n const regionAttributes = getRegionAttributes({\n titleId,\n isFocusable: false\n });\n\n const focusVisibleClasses = 'group-focus-visible:[outline:var(--focus-width)_solid_var(--focus-color)] group-focus-visible:[outline-offset:var(--focus-offset)] group-focus-visible:p-[2px]';\n\n return (\n <div>\n <div\n {...pressProps}\n role={role}\n tabIndex={tabIndex}\n aria-expanded={isOpen}\n aria-controls={contentId}\n className=\"se-design-accordion-header flex items-center cursor-pointer group focus-visible:outline-none\"\n data-automation-id={automationId}\n >\n <div className={`flex items-center gap-2 rounded ${focusVisibleClasses}`}>\n <div \n className={`transform transition-transform duration-300 ${isOpen ? 'rotate-90' : ''}`}\n >\n <Icon name=\"rightSide\" />\n </div>\n <TitleTag\n id={titleId}\n className={`se-design-accordion-title text-[var(--color-gray-900)]] font-inter text-[18px] font-semibold leading-[24px] ${titleClassName}`}\n >\n {title}\n </TitleTag>\n </div>\n </div>\n <div\n id={contentId}\n {...regionAttributes}\n className={`\n se-design-accordion-content\n overflow-${overflow || 'hidden'}\n transition-all\n duration-300\n ml-1\n mt-[1vw]\n ${isOpen ? 'max-h-[1000vh] opacity-100 visible h-auto' : 'hidden'}`}\n >\n {content}\n </div>\n {showSeparator && <div className={`h-[1px] bg-[#E5E7EB] mt-[12px] ${!isOpen ? 'block' : 'hidden'}`}></div>}\n </div>\n );\n};\n"],"names":["Accordion","title","titleTag","TitleTag","content","defaultOpen","overflow","titleClassName","showSeparator","automationId","id","isOpen","setIsOpen","useState","useEffect","titleId","useStableId","contentId","pressProps","role","tabIndex","useAccessiblePress","onClick","isNative","regionAttributes","getRegionAttributes","isFocusable","React","createElement","_extends","className","Icon","name"],"mappings":";;;;;;;;;;;;;;AAkBO,MAAMA,IAAgCA,CAAC;AAAA,EAC5CC,OAAAA;AAAAA,EACAC,UAAUC,IAAW;AAAA,EACrBC,SAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,gBAAAA,IAAiB;AAAA,EACjBC,eAAAA,IAAgB;AAAA,EAChBC,cAAAA,IAAe;AAAA,EACfC,IAAAA;AACF,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAE1CC,EAAAA,EAAU,MAAM;AACdF,IAAAA,EAAUP,KAAe,EAAK;AAAA,EAAA,GAC7B,CAACA,CAAW,CAAC;AAGVU,QAAAA,IAAUC,EAAYN,GAAI,WAAW,GACrCO,IAAY,GAAGF,CAAO,YAGtB;AAAA,IAAEG,YAAAA;AAAAA,IAAYC,MAAAA;AAAAA,IAAMC,UAAAA;AAAAA,MAAaC,EAAmB;AAAA,IACxDC,SAASA,MAAMV,EAAU,CAACD,CAAM;AAAA,IAChCY,UAAU;AAAA;AAAA,EAAA,CACX,GAGKC,IAAmBC,EAAoB;AAAA,IAC3CV,SAAAA;AAAAA,IACAW,aAAa;AAAA,EAAA,CACd;AAKCC,SAAAA,gBAAAA,EAAAC,cACED,OAAAA,MAAAA,gBAAAA,EAAAC,cAAA,OAAAC,EAAA,CAAA,GACMX,GAAU;AAAA,IACdC,MAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACA,iBAAeT;AAAAA,IACf,iBAAeM;AAAAA,IACfa,WAAU;AAAA,IACV,sBAAoBrB;AAAAA,EAAAA,CAEpBkB,GAAAC,gBAAAA,EAAAA,cAAA,OAAA;AAAA,IAAKE,WAAW;AAAA,EAAsD,GACpEF,gBAAAA,EAAAA,cAAA,OAAA;AAAA,IACEE,WAAW,+CAA+CnB,IAAS,cAAc,EAAE;AAAA,EAAA,GAEnFiB,gBAAAA,EAAAA,cAACG,GAAI;AAAA,IAACC,MAAK;AAAA,EAAa,CAAA,CACrB,GACLL,gBAAAA,EAAAC,cAACzB,GAAQ;AAAA,IACPO,IAAIK;AAAAA,IACJe,WAAW,+GAA+GvB,CAAc;AAAA,EAAA,GAEvIN,CACO,CACP,CACF,GACL2B,gBAAAA,EAAAA,cAAA,OAAAC,EAAA;AAAA,IACEnB,IAAIO;AAAAA,KACAO,GAAgB;AAAA,IACpBM,WAAW;AAAA;AAAA,mBAEAxB,KAAY,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,UAK7BK,IAAS,8CAA8C,QAAQ;AAAA,EAAA,CAAG,GAEnEP,CACE,GACJI,KAAiBmB,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKE,WAAW,kCAAmCnB,IAAmB,WAAV,OAAkB;AAAA,EAAS,CAAA,CACtG;AAET;"}
|
package/dist/index35.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index35.js","sources":["../src/components/CustomAccordion/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from 'react';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { getRegionAttributes } from '../../utils/a11y/regionAttributes';\n\nexport interface CustomAccordionProps {\n renderAccordionContents: (props: { isOpen: boolean }) => React.ReactNode;\n renderAccordionSrcElement: (props: { isOpen: boolean }) => React.ReactNode;\n defaultOpen?: boolean;\n className?: string;\n arrowPosition?: 'left' | 'right';\n contentClassName?: string;\n disabled?: boolean;\n automationId?: string;\n id?: string;\n ariaLabel?: string;\n}\n\nexport const CustomAccordion: FC<CustomAccordionProps> = ({\n renderAccordionContents,\n renderAccordionSrcElement,\n defaultOpen,\n className = '',\n arrowPosition = 'left',\n contentClassName = '',\n disabled = false,\n automationId = '',\n id,\n ariaLabel\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n useEffect(() => {\n setIsOpen(defaultOpen || false);\n }, [defaultOpen]);\n\n // Generate stable IDs for ARIA relationships\n const triggerId = useStableId(id, 'custom-accordion');\n const contentId = `${triggerId}-content`;\n\n // Use accessible press hook for keyboard + mouse handling\n const { pressProps, role, tabIndex } = useAccessiblePress({\n onClick: () => setIsOpen(!isOpen),\n isNative: false,\n disabled\n });\n\n // Get region attributes for content panel\n const regionAttributes = getRegionAttributes({\n titleId: triggerId,\n isFocusable: false\n });\n\n const focusVisibleClasses = 'group-focus-visible:[outline:var(--focus-width)_solid_var(--focus-color)] group-focus-visible:[outline-offset:var(--focus-offset)] group-focus-visible:p-[2px]';\n\n const getArrowRotation = () => {\n if (disabled) {\n return '';\n }\n if (arrowPosition === 'left') {\n return isOpen ? 'rotate-90' : '';\n }\n return isOpen ? 'rotate-180' : '';\n };\n\n return (\n <div className={`se-design-accordion ${className}`} data-automation-id={automationId}>\n <div className=\"flex flex-col\">\n <div\n {...pressProps}\n {...getA11yNameAttributes({ ariaLabel })}\n role={role}\n tabIndex={tabIndex}\n aria-expanded={isOpen}\n aria-controls={contentId}\n className=\"se-design-accordion-src flex items-center cursor-pointer group focus-visible:outline-none\"\n >\n <div className={`flex items-center flex-1 rounded ${focusVisibleClasses}`}>\n {arrowPosition === 'left' && (\n <div\n className={`se-design-accordion-icon transform transition-transform duration-300 ${getArrowRotation()} ${\n disabled ? 'opacity-30 pointer-events-none' : ''\n }`}\n >\n <Icon name=\"rightSide\" />\n </div>\n )}\n <div className=\"se-design-accordion-elements flex-1\">\n <div id={triggerId} className=\"se-design-accordion-src-element title\">{renderAccordionSrcElement({ isOpen })}</div>\n </div>\n {arrowPosition === 'right' && (\n <div\n className={`se-design-accordion-icon transform transition-transform duration-300 ${getArrowRotation()} ${\n disabled ? 'opacity-30 pointer-events-none' : ''\n }`}\n >\n <Icon name=\"chevron\" />\n </div>\n )}\n </div>\n </div>\n {isOpen && (\n <div id={contentId} {...regionAttributes} className={`se-design-accordion-content transition-all duration-300 mt-1 ${contentClassName}`}>\n {renderAccordionContents({ isOpen })}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"names":["CustomAccordion","renderAccordionContents","renderAccordionSrcElement","defaultOpen","className","arrowPosition","contentClassName","disabled","automationId","id","ariaLabel","isOpen","setIsOpen","useState","useEffect","triggerId","useStableId","contentId","pressProps","role","tabIndex","useAccessiblePress","onClick","isNative","regionAttributes","getRegionAttributes","titleId","isFocusable","focusVisibleClasses","getArrowRotation","React","createElement","_extends","getA11yNameAttributes","Icon","name"],"mappings":";;;;;;;;;;;;;;;AAmBO,MAAMA,IAA4CA,CAAC;AAAA,EACxDC,yBAAAA;AAAAA,EACAC,2BAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,WAAAA,IAAY;AAAA,EACZC,eAAAA,IAAgB;AAAA,EAChBC,kBAAAA,IAAmB;AAAA,EACnBC,UAAAA,IAAW;AAAA,EACXC,cAAAA,IAAe;AAAA,EACfC,IAAAA;AAAAA,EACAC,WAAAA;AACF,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAC1CC,EAAAA,EAAU,MAAM;AACdF,IAAAA,EAAUT,KAAe,EAAK;AAAA,
|
|
1
|
+
{"version":3,"file":"index35.js","sources":["../src/components/CustomAccordion/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from 'react';\nimport { Icon } from '../Icon';\nimport { useStableId } from '../../utils/useStableId';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { getRegionAttributes } from '../../utils/a11y/regionAttributes';\n\nexport interface CustomAccordionProps {\n renderAccordionContents: (props: { isOpen: boolean }) => React.ReactNode;\n renderAccordionSrcElement: (props: { isOpen: boolean }) => React.ReactNode;\n defaultOpen?: boolean;\n className?: string;\n arrowPosition?: 'left' | 'right';\n contentClassName?: string;\n disabled?: boolean;\n automationId?: string;\n id?: string;\n ariaLabel?: string;\n}\n\nexport const CustomAccordion: FC<CustomAccordionProps> = ({\n renderAccordionContents,\n renderAccordionSrcElement,\n defaultOpen,\n className = '',\n arrowPosition = 'left',\n contentClassName = '',\n disabled = false,\n automationId = '',\n id,\n ariaLabel\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n useEffect(() => {\n setIsOpen(defaultOpen || false);\n }, [defaultOpen]);\n\n // Generate stable IDs for ARIA relationships\n const triggerId = useStableId(id, 'custom-accordion');\n const contentId = `${triggerId}-content`;\n\n // Use accessible press hook for keyboard + mouse handling\n const { pressProps, role, tabIndex } = useAccessiblePress({\n onClick: () => setIsOpen(!isOpen),\n isNative: false,\n disabled\n });\n\n // Get region attributes for content panel\n const regionAttributes = getRegionAttributes({\n titleId: triggerId,\n isFocusable: false\n });\n\n const focusVisibleClasses = 'group-focus-visible:[outline:var(--focus-width)_solid_var(--focus-color)] group-focus-visible:[outline-offset:var(--focus-offset)] group-focus-visible:p-[2px]';\n\n const getArrowRotation = () => {\n if (disabled) {\n return '';\n }\n if (arrowPosition === 'left') {\n return isOpen ? 'rotate-90' : '';\n }\n return isOpen ? 'rotate-180' : '';\n };\n\n return (\n <div className={`se-design-accordion ${className}`} data-automation-id={automationId}>\n <div className=\"flex flex-col\">\n <div\n {...pressProps}\n {...getA11yNameAttributes({ ariaLabel })}\n role={role}\n tabIndex={tabIndex}\n aria-expanded={isOpen}\n aria-controls={contentId}\n className=\"se-design-accordion-src flex items-center cursor-pointer group focus-visible:outline-none\"\n >\n <div className={`flex items-center flex-1 rounded ${focusVisibleClasses}`}>\n {arrowPosition === 'left' && (\n <div\n className={`se-design-accordion-icon transform transition-transform duration-300 ${getArrowRotation()} ${\n disabled ? 'opacity-30 pointer-events-none' : ''\n }`}\n >\n <Icon name=\"rightSide\" />\n </div>\n )}\n <div className=\"se-design-accordion-elements flex-1\">\n <div id={triggerId} className=\"se-design-accordion-src-element title\">{renderAccordionSrcElement({ isOpen })}</div>\n </div>\n {arrowPosition === 'right' && (\n <div\n className={`se-design-accordion-icon transform transition-transform duration-300 ${getArrowRotation()} ${\n disabled ? 'opacity-30 pointer-events-none' : ''\n }`}\n >\n <Icon name=\"chevron\" />\n </div>\n )}\n </div>\n </div>\n {isOpen && (\n <div id={contentId} {...regionAttributes} className={`se-design-accordion-content transition-all duration-300 mt-1 ${contentClassName}`}>\n {renderAccordionContents({ isOpen })}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"names":["CustomAccordion","renderAccordionContents","renderAccordionSrcElement","defaultOpen","className","arrowPosition","contentClassName","disabled","automationId","id","ariaLabel","isOpen","setIsOpen","useState","useEffect","triggerId","useStableId","contentId","pressProps","role","tabIndex","useAccessiblePress","onClick","isNative","regionAttributes","getRegionAttributes","titleId","isFocusable","focusVisibleClasses","getArrowRotation","React","createElement","_extends","getA11yNameAttributes","Icon","name"],"mappings":";;;;;;;;;;;;;;;AAmBO,MAAMA,IAA4CA,CAAC;AAAA,EACxDC,yBAAAA;AAAAA,EACAC,2BAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,WAAAA,IAAY;AAAA,EACZC,eAAAA,IAAgB;AAAA,EAChBC,kBAAAA,IAAmB;AAAA,EACnBC,UAAAA,IAAW;AAAA,EACXC,cAAAA,IAAe;AAAA,EACfC,IAAAA;AAAAA,EACAC,WAAAA;AACF,MAAM;AACJ,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAC1CC,EAAAA,EAAU,MAAM;AACdF,IAAAA,EAAUT,KAAe,EAAK;AAAA,EAAA,GAC7B,CAACA,CAAW,CAAC;AAGVY,QAAAA,IAAYC,EAAYP,GAAI,kBAAkB,GAC9CQ,IAAY,GAAGF,CAAS,YAGxB;AAAA,IAAEG,YAAAA;AAAAA,IAAYC,MAAAA;AAAAA,IAAMC,UAAAA;AAAAA,MAAaC,EAAmB;AAAA,IACxDC,SAASA,MAAMV,EAAU,CAACD,CAAM;AAAA,IAChCY,UAAU;AAAA,IACVhB,UAAAA;AAAAA,EAAAA,CACD,GAGKiB,IAAmBC,EAAoB;AAAA,IAC3CC,SAASX;AAAAA,IACTY,aAAa;AAA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