se-design 1.0.22 → 1.0.23
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/components/Dropdown/index.d.ts +1 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/index17.js +27 -26
- package/dist/index17.js.map +1 -1
- package/dist/index21.js +9 -9
- package/dist/index21.js.map +1 -1
- package/dist/index23.js +60 -61
- package/dist/index23.js.map +1 -1
- package/package.json +1 -1
|
@@ -21,5 +21,6 @@ export interface PopoverProps {
|
|
|
21
21
|
isWithPortal?: boolean;
|
|
22
22
|
noBorder?: boolean;
|
|
23
23
|
ariaLabel?: string;
|
|
24
|
+
sourceRole?: 'button' | 'combobox';
|
|
24
25
|
}
|
|
25
26
|
export declare const Popover: React.ForwardRefExoticComponent<PopoverProps & React.RefAttributes<PopoverHandle>>;
|
package/dist/index17.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import R, { forwardRef as
|
|
2
|
-
import
|
|
1
|
+
import R, { forwardRef as Y, useState as E, useRef as V, useEffect as C, useImperativeHandle as Z } from "react";
|
|
2
|
+
import ee from "react-dom";
|
|
3
3
|
function H() {
|
|
4
4
|
return H = Object.assign ? Object.assign.bind() : function(v) {
|
|
5
5
|
for (var g = 1; g < arguments.length; g++) {
|
|
@@ -9,7 +9,7 @@ function H() {
|
|
|
9
9
|
return v;
|
|
10
10
|
}, H.apply(null, arguments);
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const re = /* @__PURE__ */ Y(({
|
|
13
13
|
className: v = "",
|
|
14
14
|
automationId: g = "",
|
|
15
15
|
position: f = "bottom-center",
|
|
@@ -19,12 +19,13 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
19
19
|
renderPopoverSrcElement: F,
|
|
20
20
|
onPopoverToggle: j,
|
|
21
21
|
isPopoverOpen: B,
|
|
22
|
-
disabled:
|
|
22
|
+
disabled: w = !1,
|
|
23
23
|
isWithPortal: b = !1,
|
|
24
24
|
ariaLabel: N,
|
|
25
|
+
sourceRole: W = "button",
|
|
25
26
|
...T
|
|
26
|
-
},
|
|
27
|
-
const [c, u] = E(!1), [
|
|
27
|
+
}, _) => {
|
|
28
|
+
const [c, u] = E(!1), [h, z] = E(f), [X, O] = E(!1), a = V(null), l = V(null), [$, y] = E({
|
|
28
29
|
top: 0,
|
|
29
30
|
left: 0
|
|
30
31
|
}), k = (e = "bottom-center") => {
|
|
@@ -60,8 +61,8 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
60
61
|
}
|
|
61
62
|
const p = l.current?.getBoundingClientRect(), A = p?.width || 0, d = p?.height || 0;
|
|
62
63
|
if (i + A > n && (i = Math.max(0, n - A)), i < 0 && (i = 0), r + d > s) {
|
|
63
|
-
const U = t.top,
|
|
64
|
-
U >= d || U >
|
|
64
|
+
const U = t.top, Q = s - t.bottom;
|
|
65
|
+
U >= d || U > Q ? (r = t.top - d, r < 0 && (r = 0)) : r = Math.max(0, s - d);
|
|
65
66
|
}
|
|
66
67
|
return r < 0 && (r = t.bottom, r + d > s && (r = Math.max(0, s - d))), {
|
|
67
68
|
top: r,
|
|
@@ -70,14 +71,14 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
70
71
|
};
|
|
71
72
|
C(() => {
|
|
72
73
|
if (j && j(c), c && !b)
|
|
73
|
-
return document.body.addEventListener("click", q, !0),
|
|
74
|
+
return document.body.addEventListener("click", q, !0), G(), () => document.body.removeEventListener("click", q, !0);
|
|
74
75
|
if (c && b) {
|
|
75
76
|
document.body.addEventListener("click", P, !0), window.addEventListener("scroll", P), window.addEventListener("resize", K);
|
|
76
77
|
const e = setTimeout(() => {
|
|
77
|
-
const t = k(
|
|
78
|
+
const t = k(h);
|
|
78
79
|
D(), t && y(t);
|
|
79
80
|
}, 0), o = setTimeout(() => {
|
|
80
|
-
const t = k(
|
|
81
|
+
const t = k(h);
|
|
81
82
|
t && y(t);
|
|
82
83
|
}, 10);
|
|
83
84
|
return () => {
|
|
@@ -101,7 +102,7 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
101
102
|
o && document.activeElement === a.current && o.focus();
|
|
102
103
|
}, 0);
|
|
103
104
|
}, [c]);
|
|
104
|
-
const
|
|
105
|
+
const G = () => {
|
|
105
106
|
if (!l.current) return;
|
|
106
107
|
const e = l.current.getBoundingClientRect(), o = window.innerHeight;
|
|
107
108
|
e?.bottom > o ? z(f.includes("left") ? "top-left" : f.includes("right") ? "top-right" : "top-center") : e?.top < 0 && z(f.includes("left") ? "bottom-left" : f.includes("right") ? "bottom-right" : "bottom-center");
|
|
@@ -114,7 +115,7 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
114
115
|
const o = a.current, t = l.current;
|
|
115
116
|
if (!o) return;
|
|
116
117
|
if (D(), e.type === "scroll" && c) {
|
|
117
|
-
const d = k(
|
|
118
|
+
const d = k(h);
|
|
118
119
|
d && y(d);
|
|
119
120
|
}
|
|
120
121
|
const n = e.target, s = o.contains(n), r = t?.contains(n), p = n.closest?.(".se-design-popover-wrapper");
|
|
@@ -122,7 +123,7 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
122
123
|
}, K = () => {
|
|
123
124
|
if (c && b && a.current) {
|
|
124
125
|
D();
|
|
125
|
-
const e = k(
|
|
126
|
+
const e = k(h);
|
|
126
127
|
e && y(e);
|
|
127
128
|
}
|
|
128
129
|
}, x = () => {
|
|
@@ -138,10 +139,10 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
138
139
|
let r = -1;
|
|
139
140
|
e.key === "ArrowDown" ? (e.preventDefault(), e.stopPropagation(), r = s < n.length - 1 ? s + 1 : 0) : e.key === "ArrowUp" ? (e.preventDefault(), e.stopPropagation(), r = s > 0 ? s - 1 : n.length - 1) : e.key === "Home" ? (e.preventDefault(), e.stopPropagation(), r = 0) : e.key === "End" && (e.preventDefault(), e.stopPropagation(), r = n.length - 1), r >= 0 && n[r] ? n[r].focus() : s === -1 && n.length > 0 && n[0].focus();
|
|
140
141
|
};
|
|
141
|
-
|
|
142
|
+
Z(_, () => ({
|
|
142
143
|
togglePopover: x
|
|
143
144
|
}), []);
|
|
144
|
-
const
|
|
145
|
+
const J = {
|
|
145
146
|
"bottom-left": {
|
|
146
147
|
left: "0",
|
|
147
148
|
top: "100%"
|
|
@@ -170,13 +171,13 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
170
171
|
}
|
|
171
172
|
}, M = T?.noBorder ? "" : "shadow-md border rounded-md";
|
|
172
173
|
return /* @__PURE__ */ R.createElement("div", H({
|
|
173
|
-
className: "se-design-popover-wrapper cursor-pointer relative" + (v.length > 0 ? ` ${v}` : "") + (c ? " open" : "") + (
|
|
174
|
+
className: "se-design-popover-wrapper cursor-pointer relative" + (v.length > 0 ? ` ${v}` : "") + (c ? " open" : "") + (w ? " opacity-50 cursor-not-allowed pointer-events-none" : ""),
|
|
174
175
|
ref: a,
|
|
175
176
|
onClick: (e) => {
|
|
176
|
-
|
|
177
|
+
w || (e.stopPropagation(), x());
|
|
177
178
|
},
|
|
178
179
|
onKeyDown: (e) => {
|
|
179
|
-
if (!
|
|
180
|
+
if (!w)
|
|
180
181
|
if (e.key === "Enter" || e.key === " ") {
|
|
181
182
|
e.preventDefault(), e.stopPropagation();
|
|
182
183
|
const o = c;
|
|
@@ -200,11 +201,11 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
200
201
|
}
|
|
201
202
|
}, 0));
|
|
202
203
|
},
|
|
203
|
-
role:
|
|
204
|
-
"aria-expanded": c,
|
|
204
|
+
role: W,
|
|
205
|
+
"aria-expanded": c ? "true" : "false",
|
|
205
206
|
"aria-haspopup": "true",
|
|
206
|
-
tabIndex:
|
|
207
|
-
"aria-disabled":
|
|
207
|
+
tabIndex: 0,
|
|
208
|
+
"aria-disabled": w ? "true" : "false",
|
|
208
209
|
"aria-label": N,
|
|
209
210
|
"data-automation-id": g
|
|
210
211
|
}, T), F({
|
|
@@ -216,7 +217,7 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
216
217
|
borderColor: "var(--color-gray-200)",
|
|
217
218
|
color: "var(--color-gray-900)",
|
|
218
219
|
backgroundColor: "var(--color-white)",
|
|
219
|
-
...
|
|
220
|
+
...J[h]
|
|
220
221
|
},
|
|
221
222
|
onClick: (e) => e.stopPropagation(),
|
|
222
223
|
onKeyDown: (e) => {
|
|
@@ -228,7 +229,7 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
228
229
|
"data-automation-id": m
|
|
229
230
|
}, I({
|
|
230
231
|
closePopoverCb: () => u(!1)
|
|
231
|
-
})), b && c &&
|
|
232
|
+
})), b && c && X && /* @__PURE__ */ ee.createPortal(/* @__PURE__ */ R.createElement("div", {
|
|
232
233
|
className: `popover-content-with-portal ${M} ${L == "full" ? "w-full" : "w-max"}`,
|
|
233
234
|
style: {
|
|
234
235
|
position: "fixed",
|
|
@@ -252,6 +253,6 @@ const oe = /* @__PURE__ */ Q(({
|
|
|
252
253
|
})), document.body));
|
|
253
254
|
});
|
|
254
255
|
export {
|
|
255
|
-
|
|
256
|
+
re as Popover
|
|
256
257
|
};
|
|
257
258
|
//# sourceMappingURL=index17.js.map
|
package/dist/index17.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index17.js","sources":["../src/components/Popover/index.tsx"],"sourcesContent":["import React, { useState, useRef, ReactNode, useEffect, forwardRef, ForwardedRef, useImperativeHandle } from 'react';\nimport ReactDOM from 'react-dom';\n\nexport interface PopoverHandle {\n togglePopover: () => void;\n}\n\nexport interface PopoverProps {\n className?: string;\n automationId?: string;\n popoverContentAutomationId?: string;\n renderPopoverContents: (props: { closePopoverCb: () => void }) => ReactNode;\n renderPopoverSrcElement: (props: { displayPopover: boolean; togglePopover: () => void }) => ReactNode;\n position?: 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';\n onPopoverToggle?: (displayPopover: boolean) => void;\n contentWidth?: 'full' | 'max';\n isPopoverOpen?: boolean;\n disabled?: boolean;\n isWithPortal?: boolean;\n noBorder?: boolean;\n ariaLabel?: string;\n}\n\nexport const Popover = forwardRef<PopoverHandle, PopoverProps>(\n (\n {\n className = '',\n automationId = '',\n position = 'bottom-center',\n popoverContentAutomationId = '',\n contentWidth = 'max',\n renderPopoverContents,\n renderPopoverSrcElement,\n onPopoverToggle,\n isPopoverOpen,\n disabled = false,\n isWithPortal = false,\n ariaLabel,\n ...props\n },\n ref: ForwardedRef<PopoverHandle>\n ) => {\n const [displayPopover, setDisplayPopover] = useState(false);\n const [popoverPosition, setPopoverPosition] = useState(position);\n const [isSrcElementVisible, setIsSrcElementVisible] = useState(false);\n const srcElementRef = useRef<HTMLDivElement>(null);\n const popoverContentRef = useRef<HTMLDivElement>(null);\n\n const [portalPosition, setPortalPosition] = useState({ top: 0, left: 0 });\n\n const calculatePositionOfPopover = (position: string = 'bottom-center') => {\n if (!srcElementRef.current) return { top: 0, left: 0 };\n\n let localPosition = position;\n\n const srcRect = srcElementRef.current.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Calculate position for portal\n let top = 0;\n let left = 0;\n\n switch (localPosition) {\n case 'bottom-left':\n top = srcRect.bottom;\n left = srcRect.left;\n break;\n case 'bottom-right':\n top = srcRect.bottom;\n left = srcRect.right - srcRect.width * 0.5;\n break;\n case 'bottom-center':\n top = srcRect.bottom;\n left = srcRect.left + srcRect.width * 0.15;\n break;\n case 'top-left':\n top = srcRect.top - srcRect.height * 1.9;\n left = srcRect.left;\n break;\n case 'top-right':\n top = srcRect.top - srcRect.height * 1.9;\n left = srcRect.right - srcRect.width * 0.5;\n break;\n case 'top-center':\n top = srcRect.top - srcRect.height * 1.9;\n left = srcRect.left + srcRect.width * 0.15;\n break;\n default:\n top = srcRect.bottom;\n left = srcRect.left;\n break;\n }\n\n // Get popover dimensions if available\n const popoverRect = popoverContentRef.current?.getBoundingClientRect();\n const popoverWidth = popoverRect?.width || 0;\n const popoverHeight = popoverRect?.height || 0;\n\n // Adjust position to keep popover within viewport bounds\n // Horizontal adjustments\n if (left + popoverWidth > viewportWidth) {\n // Popover extends beyond right edge, shift it left\n left = Math.max(0, viewportWidth - popoverWidth);\n }\n if (left < 0) {\n // Popover extends beyond left edge, shift it right\n left = 0;\n }\n\n // Vertical adjustments\n if (top + popoverHeight > viewportHeight) {\n // Popover extends beyond bottom edge\n // Try to position it above the source element\n const spaceAbove = srcRect.top;\n const spaceBelow = viewportHeight - srcRect.bottom;\n \n if (spaceAbove >= popoverHeight || spaceAbove > spaceBelow) {\n // Position above if there's enough space or more space above\n top = srcRect.top - popoverHeight;\n // Ensure it doesn't go above viewport\n if (top < 0) {\n top = 0;\n }\n } else {\n // Keep at bottom but adjust to fit within viewport\n top = Math.max(0, viewportHeight - popoverHeight);\n }\n }\n if (top < 0) {\n // Popover extends beyond top edge, position it below the source element\n top = srcRect.bottom;\n // Ensure it doesn't go below viewport\n if (top + popoverHeight > viewportHeight) {\n top = Math.max(0, viewportHeight - popoverHeight);\n }\n }\n\n return { top, left };\n };\n \n useEffect(() => {\n if (onPopoverToggle) {\n onPopoverToggle(displayPopover);\n }\n\n if (displayPopover && !isWithPortal) {\n document.body.addEventListener('click', clickListener, true);\n checkPopoverPosition();\n return () => document.body.removeEventListener('click', clickListener, true);\n } else if (displayPopover && isWithPortal) {\n document.body.addEventListener('click', clickAndScrollListenerWithPortal, true);\n window.addEventListener('scroll', clickAndScrollListenerWithPortal);\n window.addEventListener('resize', resizeListenerWithPortal);\n\n // Initial position calculation\n const timeout1 = setTimeout(() => {\n const position = calculatePositionOfPopover(popoverPosition);\n checkSourceVisibility();\n \n if (position) {\n setPortalPosition(position);\n }\n }, 0);\n\n // Recalculate after popover is rendered to get accurate dimensions\n const timeout2 = setTimeout(() => {\n const position = calculatePositionOfPopover(popoverPosition);\n if (position) {\n setPortalPosition(position);\n }\n }, 10);\n\n return () => {\n document.body.removeEventListener('click', clickAndScrollListenerWithPortal, true);\n window.removeEventListener('scroll', clickAndScrollListenerWithPortal);\n window.removeEventListener('resize', resizeListenerWithPortal);\n clearTimeout(timeout1);\n clearTimeout(timeout2);\n };\n }\n }, [displayPopover, isWithPortal]);\n\n const checkSourceVisibility = () => {\n if (!srcElementRef.current) {\n setIsSrcElementVisible(false);\n return;\n }\n\n const rec = srcElementRef.current.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const viewportWidth = window.innerWidth;\n\n const isVisible = rec.top < viewportHeight && rec.bottom > 0 && rec.left < viewportWidth && rec.right > 0;\n\n setIsSrcElementVisible(isVisible);\n };\n\n useEffect(() => {\n setDisplayPopover(isPopoverOpen ?? false);\n }, [isPopoverOpen]);\n\n useEffect(() => {\n // Focus first focusable element when popover opens\n if (displayPopover && popoverContentRef.current) {\n setTimeout(() => {\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n const firstFocusable = popoverContentRef.current?.querySelector<HTMLElement>(focusableSelectors);\n if (firstFocusable && document.activeElement === srcElementRef.current) {\n firstFocusable.focus();\n }\n }, 0);\n }\n }, [displayPopover]);\n\n //Function to check popover position\n const checkPopoverPosition = () => {\n if (!popoverContentRef.current) return;\n\n const popoverRect = popoverContentRef.current.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n\n if (popoverRect?.bottom > viewportHeight) {\n setPopoverPosition(\n position.includes('left') ? 'top-left' : position.includes('right') ? 'top-right' : 'top-center'\n );\n } else if (popoverRect?.top < 0) {\n // If popover extends beyond top of viewport, switch to bottom position\n setPopoverPosition(\n position.includes('left') ? 'bottom-left' : position.includes('right') ? 'bottom-right' : 'bottom-center'\n );\n }\n };\n\n const clickListener = (event: MouseEvent) => {\n const currentDropRef = srcElementRef.current;\n if (!currentDropRef) return;\n\n const target = event.target as Node;\n const isSourcePopover = currentDropRef.contains(target);\n const isPopoverContent = popoverContentRef.current?.contains(target);\n \n // Check if click is on another popover's source element\n const clickedElement = target as HTMLElement;\n const closestPopoverWrapper = clickedElement.closest?.('.se-design-popover-wrapper');\n const isAnotherPopoverSource = closestPopoverWrapper && closestPopoverWrapper !== currentDropRef;\n \n // if clicked source is parent or the popover-content, do not toggle dropdown.\n // Also close if clicking on another popover's source element\n if ((!isSourcePopover && !isPopoverContent) || isAnotherPopoverSource) {\n setDisplayPopover(false);\n }\n };\n\n const clickAndScrollListenerWithPortal = (event: Event) => {\n const currentDropRef = srcElementRef.current;\n const currentPopoverRef = popoverContentRef.current;\n if (!currentDropRef) return;\n checkSourceVisibility();\n\n // Recalculate position on scroll\n if (event.type === 'scroll' && displayPopover) {\n const position = calculatePositionOfPopover(popoverPosition);\n if (position) {\n setPortalPosition(position);\n }\n }\n\n const target = event.target as Node;\n const isSourcePopover = currentDropRef.contains(target);\n const isPopoverContent = currentPopoverRef?.contains(target);\n \n // Check if click is on another popover's source element\n const clickedElement = target as HTMLElement;\n const closestPopoverWrapper = clickedElement.closest?.('.se-design-popover-wrapper');\n const isAnotherPopoverSource = closestPopoverWrapper && closestPopoverWrapper !== currentDropRef;\n\n // if clicked source is parent or the popover-content, do not toggle dropdown.\n // Also close if clicking on another popover's source element\n if ((!isSourcePopover && !isPopoverContent) || isAnotherPopoverSource) {\n setDisplayPopover(false);\n }\n };\n\n const resizeListenerWithPortal = () => {\n if (displayPopover && isWithPortal && srcElementRef.current) {\n checkSourceVisibility();\n const position = calculatePositionOfPopover(popoverPosition);\n if (position) {\n setPortalPosition(position);\n }\n }\n };\n\n const togglePopover = () => {\n setDisplayPopover((displayPopover) => !displayPopover);\n };\n\n const handleArrowKeyNavigation = (e: React.KeyboardEvent, container: HTMLDivElement | null) => {\n if (!container) return;\n\n // Find all focusable elements within the popover content\n // This includes elements with role=\"menuitem\", role=\"option\", tabIndex >= 0, etc.\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n\n const focusableElements = Array.from(\n container.querySelectorAll<HTMLElement>(focusableSelectors)\n ).filter((el) => {\n // Filter out disabled and hidden elements\n const style = window.getComputedStyle(el);\n return (\n !el.hasAttribute('disabled') &&\n !el.hasAttribute('aria-disabled') &&\n style.display !== 'none' &&\n style.visibility !== 'hidden' &&\n (el.tabIndex >= 0 || el.hasAttribute('role'))\n );\n });\n\n if (focusableElements.length === 0) return;\n\n const currentIndex = focusableElements.findIndex((el) => el === document.activeElement);\n let nextIndex = -1;\n\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = currentIndex < focusableElements.length - 1 ? currentIndex + 1 : 0;\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = currentIndex > 0 ? currentIndex - 1 : focusableElements.length - 1;\n } else if (e.key === 'Home') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = 0;\n } else if (e.key === 'End') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = focusableElements.length - 1;\n }\n\n if (nextIndex >= 0 && focusableElements[nextIndex]) {\n focusableElements[nextIndex].focus();\n } else if (currentIndex === -1 && focusableElements.length > 0) {\n // If no element is currently focused, focus the first one\n focusableElements[0].focus();\n }\n };\n\n useImperativeHandle(ref, () => ({ togglePopover }), []);\n\n const popoverContentStyle = {\n 'bottom-left': { left: '0', top: '100%' },\n 'bottom-right': { right: '0', top: '100%' },\n 'bottom-center': { left: '50%', transform: 'translateX(-50%)', top: '100%' },\n 'top-left': { left: '0', bottom: '100%' },\n 'top-right': { right: '0', bottom: '100%' },\n 'top-center': { left: '50%', transform: 'translateX(-50%)', bottom: '100%' }\n };\n const popoverContentClasses = props?.noBorder ? '' : 'shadow-md border rounded-md';\n\n return (\n <div\n className={\n 'se-design-popover-wrapper cursor-pointer relative' +\n (className.length > 0 ? ` ${className}` : '') +\n (displayPopover ? ' open' : '') +\n (disabled ? ' opacity-50 cursor-not-allowed pointer-events-none' : '')\n }\n ref={srcElementRef}\n onClick={(e) => {\n if (disabled) return;\n e.stopPropagation();\n togglePopover();\n }}\n onKeyDown={(e) => {\n if (disabled) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const wasOpen = displayPopover;\n togglePopover();\n // Focus first focusable element when opening\n if (!wasOpen) {\n setTimeout(() => {\n const currentRef = popoverContentRef.current;\n if (currentRef) {\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n const firstFocusable = currentRef.querySelector<HTMLElement>(focusableSelectors);\n if (firstFocusable) {\n firstFocusable.focus();\n }\n }\n }, 0);\n }\n } else if (e.key === 'Escape' && displayPopover) {\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(false);\n } else if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && displayPopover) {\n // Handle arrow keys when popover is open\n const currentRef = popoverContentRef.current;\n if (currentRef) {\n handleArrowKeyNavigation(e, currentRef);\n }\n } else if (e.key === 'ArrowDown' && !displayPopover) {\n // Open popover and focus first item when ArrowDown is pressed\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(true);\n setTimeout(() => {\n const currentRef = popoverContentRef.current;\n if (currentRef) {\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n const firstFocusable = currentRef.querySelector<HTMLElement>(focusableSelectors);\n if (firstFocusable) {\n firstFocusable.focus();\n }\n }\n }, 0);\n }\n }}\n role=\"button\"\n aria-expanded={displayPopover}\n aria-haspopup=\"true\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled}\n aria-label={ariaLabel}\n data-automation-id={automationId}\n {...props}\n >\n {renderPopoverSrcElement({ displayPopover, togglePopover })}\n\n {displayPopover && !isWithPortal && (\n <div\n className={`popover-content absolute ${popoverContentClasses} z-[1000] ${contentWidth == 'full' ? 'w-full' : 'w-max'}`}\n style={{\n borderColor: 'var(--color-gray-200)',\n color: 'var(--color-gray-900)',\n backgroundColor: 'var(--color-white)',\n ...popoverContentStyle[popoverPosition]\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Allow Escape key to close popover when focus is on content\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(false);\n srcElementRef.current?.focus();\n } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n // Handle arrow key navigation for focusable elements inside popover\n handleArrowKeyNavigation(e, popoverContentRef.current);\n }\n }}\n role=\"dialog\"\n aria-modal=\"false\"\n ref={popoverContentRef}\n data-automation-id={popoverContentAutomationId}\n >\n {renderPopoverContents({ closePopoverCb: () => setDisplayPopover(false) })}\n </div>\n )}\n {isWithPortal &&\n displayPopover &&\n isSrcElementVisible &&\n ReactDOM.createPortal(\n <div\n className={`popover-content-with-portal ${popoverContentClasses} ${contentWidth == 'full' ? 'w-full' : 'w-max'}`}\n style={{\n position: 'fixed',\n top: portalPosition.top,\n left: portalPosition.left,\n zIndex: 1000,\n borderColor: 'var(--color-gray-200)',\n color: 'var(--color-gray-900)',\n backgroundColor: 'var(--color-white)'\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Allow Escape key to close popover when focus is on content\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(false);\n srcElementRef.current?.focus();\n } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n // Handle arrow key navigation for focusable elements inside popover\n handleArrowKeyNavigation(e, popoverContentRef.current);\n }\n }}\n role=\"dialog\"\n aria-modal=\"false\"\n ref={popoverContentRef}\n data-automation-id={popoverContentAutomationId}\n >\n {renderPopoverContents({ closePopoverCb: () => setDisplayPopover(false) })}\n </div>,\n document.body\n )}\n </div>\n );\n }\n);\n\n"],"names":["Popover","className","automationId","position","popoverContentAutomationId","contentWidth","renderPopoverContents","renderPopoverSrcElement","onPopoverToggle","isPopoverOpen","disabled","isWithPortal","ariaLabel","props","ref","displayPopover","setDisplayPopover","useState","popoverPosition","setPopoverPosition","isSrcElementVisible","setIsSrcElementVisible","srcElementRef","useRef","popoverContentRef","portalPosition","setPortalPosition","top","left","calculatePositionOfPopover","current","localPosition","srcRect","getBoundingClientRect","viewportWidth","window","innerWidth","viewportHeight","innerHeight","bottom","right","width","height","popoverRect","popoverWidth","popoverHeight","Math","max","spaceAbove","spaceBelow","useEffect","document","body","addEventListener","clickListener","checkPopoverPosition","removeEventListener","clickAndScrollListenerWithPortal","resizeListenerWithPortal","timeout1","setTimeout","checkSourceVisibility","timeout2","clearTimeout","rec","isVisible","focusableSelectors","join","firstFocusable","querySelector","activeElement","focus","includes","event","currentDropRef","target","isSourcePopover","contains","isPopoverContent","closestPopoverWrapper","closest","currentPopoverRef","type","togglePopover","handleArrowKeyNavigation","e","container","focusableElements","Array","from","querySelectorAll","filter","el","style","getComputedStyle","hasAttribute","display","visibility","tabIndex","length","currentIndex","findIndex","nextIndex","key","preventDefault","stopPropagation","useImperativeHandle","popoverContentStyle","transform","popoverContentClasses","noBorder","React","createElement","_extends","onClick","onKeyDown","wasOpen","currentRef","role","borderColor","color","backgroundColor","closePopoverCb","ReactDOM","createPortal","zIndex"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,uBACX,CACE;AAAA,EACEC,WAAAA,IAAY;AAAA,EACZC,cAAAA,IAAe;AAAA,EACfC,UAAAA,IAAW;AAAA,EACXC,4B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wF,OAAO;AAAA,MACL1F,UAAU;AAAA,MACVwB,KAAKF,EAAeE;AAAAA,MACpBC,MAAMH,EAAeG;AAAAA,MACrBiG,QAAQ;AAAA,MACRN,aAAa;AAAA,MACbC,OAAO;AAAA,MACPC,iBAAiB;AAAA,IAAA;AAAA,IAEnBP,SAAU7B,CAAAA,MAAMA,EAAEoB,gBAAAA;AAAAA,IAClBU,WAAY9B,CAAAA,MAAM;AAEhB,MAAIA,EAAEkB,QAAQ,YACZlB,EAAEmB,eAAAA,GACFnB,EAAEoB,gBAAAA,GACFzF,EAAkB,EAAK,GACvBM,EAAcQ,SAASyC,MAAAA,MACdc,EAAEkB,QAAQ,eAAelB,EAAEkB,QAAQ,aAAalB,EAAEkB,QAAQ,UAAUlB,EAAEkB,QAAQ,UAEvFnB,EAAyBC,GAAG7D,EAAkBM,OAAO;AAAA,IAEzD;AAAA,IACAwF,MAAK;AAAA,IACL,cAAW;AAAA,IACXxG,KAAKU;AAAAA,IACL,sBAAoBpB;AAAAA,EAAAA,GAEnBE,EAAsB;AAAA,IAAEoH,gBAAgBA,MAAM1G,EAAkB,EAAK;AAAA,EAAA,CAAG,CACtE,GACLmC,SAASC,IACX,CACC;AAET,CACF;"}
|
|
1
|
+
{"version":3,"file":"index17.js","sources":["../src/components/Popover/index.tsx"],"sourcesContent":["import React, { useState, useRef, ReactNode, useEffect, forwardRef, ForwardedRef, useImperativeHandle } from 'react';\nimport ReactDOM from 'react-dom';\n\nexport interface PopoverHandle {\n togglePopover: () => void;\n}\n\nexport interface PopoverProps {\n className?: string;\n automationId?: string;\n popoverContentAutomationId?: string;\n renderPopoverContents: (props: { closePopoverCb: () => void }) => ReactNode;\n renderPopoverSrcElement: (props: { displayPopover: boolean; togglePopover: () => void }) => ReactNode;\n position?: 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';\n onPopoverToggle?: (displayPopover: boolean) => void;\n contentWidth?: 'full' | 'max';\n isPopoverOpen?: boolean;\n disabled?: boolean;\n isWithPortal?: boolean;\n noBorder?: boolean;\n ariaLabel?: string;\n sourceRole?: 'button' | 'combobox';\n}\n\nexport const Popover = forwardRef<PopoverHandle, PopoverProps>(\n (\n {\n className = '',\n automationId = '',\n position = 'bottom-center',\n popoverContentAutomationId = '',\n contentWidth = 'max',\n renderPopoverContents,\n renderPopoverSrcElement,\n onPopoverToggle,\n isPopoverOpen,\n disabled = false,\n isWithPortal = false,\n ariaLabel,\n sourceRole = 'button',\n ...props\n },\n ref: ForwardedRef<PopoverHandle>\n ) => {\n const [displayPopover, setDisplayPopover] = useState(false);\n const [popoverPosition, setPopoverPosition] = useState(position);\n const [isSrcElementVisible, setIsSrcElementVisible] = useState(false);\n const srcElementRef = useRef<HTMLDivElement>(null);\n const popoverContentRef = useRef<HTMLDivElement>(null);\n\n const [portalPosition, setPortalPosition] = useState({ top: 0, left: 0 });\n\n const calculatePositionOfPopover = (position: string = 'bottom-center') => {\n if (!srcElementRef.current) return { top: 0, left: 0 };\n\n let localPosition = position;\n\n const srcRect = srcElementRef.current.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Calculate position for portal\n let top = 0;\n let left = 0;\n\n switch (localPosition) {\n case 'bottom-left':\n top = srcRect.bottom;\n left = srcRect.left;\n break;\n case 'bottom-right':\n top = srcRect.bottom;\n left = srcRect.right - srcRect.width * 0.5;\n break;\n case 'bottom-center':\n top = srcRect.bottom;\n left = srcRect.left + srcRect.width * 0.15;\n break;\n case 'top-left':\n top = srcRect.top - srcRect.height * 1.9;\n left = srcRect.left;\n break;\n case 'top-right':\n top = srcRect.top - srcRect.height * 1.9;\n left = srcRect.right - srcRect.width * 0.5;\n break;\n case 'top-center':\n top = srcRect.top - srcRect.height * 1.9;\n left = srcRect.left + srcRect.width * 0.15;\n break;\n default:\n top = srcRect.bottom;\n left = srcRect.left;\n break;\n }\n\n // Get popover dimensions if available\n const popoverRect = popoverContentRef.current?.getBoundingClientRect();\n const popoverWidth = popoverRect?.width || 0;\n const popoverHeight = popoverRect?.height || 0;\n\n // Adjust position to keep popover within viewport bounds\n // Horizontal adjustments\n if (left + popoverWidth > viewportWidth) {\n // Popover extends beyond right edge, shift it left\n left = Math.max(0, viewportWidth - popoverWidth);\n }\n if (left < 0) {\n // Popover extends beyond left edge, shift it right\n left = 0;\n }\n\n // Vertical adjustments\n if (top + popoverHeight > viewportHeight) {\n // Popover extends beyond bottom edge\n // Try to position it above the source element\n const spaceAbove = srcRect.top;\n const spaceBelow = viewportHeight - srcRect.bottom;\n \n if (spaceAbove >= popoverHeight || spaceAbove > spaceBelow) {\n // Position above if there's enough space or more space above\n top = srcRect.top - popoverHeight;\n // Ensure it doesn't go above viewport\n if (top < 0) {\n top = 0;\n }\n } else {\n // Keep at bottom but adjust to fit within viewport\n top = Math.max(0, viewportHeight - popoverHeight);\n }\n }\n if (top < 0) {\n // Popover extends beyond top edge, position it below the source element\n top = srcRect.bottom;\n // Ensure it doesn't go below viewport\n if (top + popoverHeight > viewportHeight) {\n top = Math.max(0, viewportHeight - popoverHeight);\n }\n }\n\n return { top, left };\n };\n \n useEffect(() => {\n if (onPopoverToggle) {\n onPopoverToggle(displayPopover);\n }\n\n if (displayPopover && !isWithPortal) {\n document.body.addEventListener('click', clickListener, true);\n checkPopoverPosition();\n return () => document.body.removeEventListener('click', clickListener, true);\n } else if (displayPopover && isWithPortal) {\n document.body.addEventListener('click', clickAndScrollListenerWithPortal, true);\n window.addEventListener('scroll', clickAndScrollListenerWithPortal);\n window.addEventListener('resize', resizeListenerWithPortal);\n\n // Initial position calculation\n const timeout1 = setTimeout(() => {\n const position = calculatePositionOfPopover(popoverPosition);\n checkSourceVisibility();\n \n if (position) {\n setPortalPosition(position);\n }\n }, 0);\n\n // Recalculate after popover is rendered to get accurate dimensions\n const timeout2 = setTimeout(() => {\n const position = calculatePositionOfPopover(popoverPosition);\n if (position) {\n setPortalPosition(position);\n }\n }, 10);\n\n return () => {\n document.body.removeEventListener('click', clickAndScrollListenerWithPortal, true);\n window.removeEventListener('scroll', clickAndScrollListenerWithPortal);\n window.removeEventListener('resize', resizeListenerWithPortal);\n clearTimeout(timeout1);\n clearTimeout(timeout2);\n };\n }\n }, [displayPopover, isWithPortal]);\n\n const checkSourceVisibility = () => {\n if (!srcElementRef.current) {\n setIsSrcElementVisible(false);\n return;\n }\n\n const rec = srcElementRef.current.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const viewportWidth = window.innerWidth;\n\n const isVisible = rec.top < viewportHeight && rec.bottom > 0 && rec.left < viewportWidth && rec.right > 0;\n\n setIsSrcElementVisible(isVisible);\n };\n\n useEffect(() => {\n setDisplayPopover(isPopoverOpen ?? false);\n }, [isPopoverOpen]);\n\n useEffect(() => {\n // Focus first focusable element when popover opens\n if (displayPopover && popoverContentRef.current) {\n setTimeout(() => {\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n const firstFocusable = popoverContentRef.current?.querySelector<HTMLElement>(focusableSelectors);\n if (firstFocusable && document.activeElement === srcElementRef.current) {\n firstFocusable.focus();\n }\n }, 0);\n }\n }, [displayPopover]);\n\n //Function to check popover position\n const checkPopoverPosition = () => {\n if (!popoverContentRef.current) return;\n\n const popoverRect = popoverContentRef.current.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n\n if (popoverRect?.bottom > viewportHeight) {\n setPopoverPosition(\n position.includes('left') ? 'top-left' : position.includes('right') ? 'top-right' : 'top-center'\n );\n } else if (popoverRect?.top < 0) {\n // If popover extends beyond top of viewport, switch to bottom position\n setPopoverPosition(\n position.includes('left') ? 'bottom-left' : position.includes('right') ? 'bottom-right' : 'bottom-center'\n );\n }\n };\n\n const clickListener = (event: MouseEvent) => {\n const currentDropRef = srcElementRef.current;\n if (!currentDropRef) return;\n\n const target = event.target as Node;\n const isSourcePopover = currentDropRef.contains(target);\n const isPopoverContent = popoverContentRef.current?.contains(target);\n \n // Check if click is on another popover's source element\n const clickedElement = target as HTMLElement;\n const closestPopoverWrapper = clickedElement.closest?.('.se-design-popover-wrapper');\n const isAnotherPopoverSource = closestPopoverWrapper && closestPopoverWrapper !== currentDropRef;\n \n // if clicked source is parent or the popover-content, do not toggle dropdown.\n // Also close if clicking on another popover's source element\n if ((!isSourcePopover && !isPopoverContent) || isAnotherPopoverSource) {\n setDisplayPopover(false);\n }\n };\n\n const clickAndScrollListenerWithPortal = (event: Event) => {\n const currentDropRef = srcElementRef.current;\n const currentPopoverRef = popoverContentRef.current;\n if (!currentDropRef) return;\n checkSourceVisibility();\n\n // Recalculate position on scroll\n if (event.type === 'scroll' && displayPopover) {\n const position = calculatePositionOfPopover(popoverPosition);\n if (position) {\n setPortalPosition(position);\n }\n }\n\n const target = event.target as Node;\n const isSourcePopover = currentDropRef.contains(target);\n const isPopoverContent = currentPopoverRef?.contains(target);\n \n // Check if click is on another popover's source element\n const clickedElement = target as HTMLElement;\n const closestPopoverWrapper = clickedElement.closest?.('.se-design-popover-wrapper');\n const isAnotherPopoverSource = closestPopoverWrapper && closestPopoverWrapper !== currentDropRef;\n\n // if clicked source is parent or the popover-content, do not toggle dropdown.\n // Also close if clicking on another popover's source element\n if ((!isSourcePopover && !isPopoverContent) || isAnotherPopoverSource) {\n setDisplayPopover(false);\n }\n };\n\n const resizeListenerWithPortal = () => {\n if (displayPopover && isWithPortal && srcElementRef.current) {\n checkSourceVisibility();\n const position = calculatePositionOfPopover(popoverPosition);\n if (position) {\n setPortalPosition(position);\n }\n }\n };\n\n const togglePopover = () => {\n setDisplayPopover((displayPopover) => !displayPopover);\n };\n\n const handleArrowKeyNavigation = (e: React.KeyboardEvent, container: HTMLDivElement | null) => {\n if (!container) return;\n\n // Find all focusable elements within the popover content\n // This includes elements with role=\"menuitem\", role=\"option\", tabIndex >= 0, etc.\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n\n const focusableElements = Array.from(\n container.querySelectorAll<HTMLElement>(focusableSelectors)\n ).filter((el) => {\n // Filter out disabled and hidden elements\n const style = window.getComputedStyle(el);\n return (\n !el.hasAttribute('disabled') &&\n !el.hasAttribute('aria-disabled') &&\n style.display !== 'none' &&\n style.visibility !== 'hidden' &&\n (el.tabIndex >= 0 || el.hasAttribute('role'))\n );\n });\n\n if (focusableElements.length === 0) return;\n\n const currentIndex = focusableElements.findIndex((el) => el === document.activeElement);\n let nextIndex = -1;\n\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = currentIndex < focusableElements.length - 1 ? currentIndex + 1 : 0;\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = currentIndex > 0 ? currentIndex - 1 : focusableElements.length - 1;\n } else if (e.key === 'Home') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = 0;\n } else if (e.key === 'End') {\n e.preventDefault();\n e.stopPropagation();\n nextIndex = focusableElements.length - 1;\n }\n\n if (nextIndex >= 0 && focusableElements[nextIndex]) {\n focusableElements[nextIndex].focus();\n } else if (currentIndex === -1 && focusableElements.length > 0) {\n // If no element is currently focused, focus the first one\n focusableElements[0].focus();\n }\n };\n\n useImperativeHandle(ref, () => ({ togglePopover }), []);\n\n const popoverContentStyle = {\n 'bottom-left': { left: '0', top: '100%' },\n 'bottom-right': { right: '0', top: '100%' },\n 'bottom-center': { left: '50%', transform: 'translateX(-50%)', top: '100%' },\n 'top-left': { left: '0', bottom: '100%' },\n 'top-right': { right: '0', bottom: '100%' },\n 'top-center': { left: '50%', transform: 'translateX(-50%)', bottom: '100%' }\n };\n const popoverContentClasses = props?.noBorder ? '' : 'shadow-md border rounded-md';\n\n return (\n <div\n className={\n 'se-design-popover-wrapper cursor-pointer relative' +\n (className.length > 0 ? ` ${className}` : '') +\n (displayPopover ? ' open' : '') +\n (disabled ? ' opacity-50 cursor-not-allowed pointer-events-none' : '')\n }\n ref={srcElementRef}\n onClick={(e) => {\n if (disabled) return;\n e.stopPropagation();\n togglePopover();\n }}\n onKeyDown={(e) => {\n if (disabled) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const wasOpen = displayPopover;\n togglePopover();\n // Focus first focusable element when opening\n if (!wasOpen) {\n setTimeout(() => {\n const currentRef = popoverContentRef.current;\n if (currentRef) {\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n const firstFocusable = currentRef.querySelector<HTMLElement>(focusableSelectors);\n if (firstFocusable) {\n firstFocusable.focus();\n }\n }\n }, 0);\n }\n } else if (e.key === 'Escape' && displayPopover) {\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(false);\n } else if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && displayPopover) {\n // Handle arrow keys when popover is open\n const currentRef = popoverContentRef.current;\n if (currentRef) {\n handleArrowKeyNavigation(e, currentRef);\n }\n } else if (e.key === 'ArrowDown' && !displayPopover) {\n // Open popover and focus first item when ArrowDown is pressed\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(true);\n setTimeout(() => {\n const currentRef = popoverContentRef.current;\n if (currentRef) {\n const focusableSelectors = [\n '[role=\"menuitem\"]',\n '[role=\"option\"]',\n '[role=\"menuitemcheckbox\"]',\n '[role=\"menuitemradio\"]',\n 'button:not([disabled])',\n 'a[href]',\n '[tabindex]:not([tabindex=\"-1\"])'\n ].join(', ');\n const firstFocusable = currentRef.querySelector<HTMLElement>(focusableSelectors);\n if (firstFocusable) {\n firstFocusable.focus();\n }\n }\n }, 0);\n }\n }}\n role={sourceRole}\n aria-expanded={displayPopover ? 'true' : 'false'}\n aria-haspopup=\"true\"\n tabIndex={0}\n aria-disabled={disabled ? 'true' : 'false'}\n aria-label={ariaLabel}\n data-automation-id={automationId}\n {...props}\n >\n {renderPopoverSrcElement({ displayPopover, togglePopover })}\n\n {displayPopover && !isWithPortal && (\n <div\n className={`popover-content absolute ${popoverContentClasses} z-[1000] ${contentWidth == 'full' ? 'w-full' : 'w-max'}`}\n style={{\n borderColor: 'var(--color-gray-200)',\n color: 'var(--color-gray-900)',\n backgroundColor: 'var(--color-white)',\n ...popoverContentStyle[popoverPosition]\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Allow Escape key to close popover when focus is on content\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(false);\n srcElementRef.current?.focus();\n } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n // Handle arrow key navigation for focusable elements inside popover\n handleArrowKeyNavigation(e, popoverContentRef.current);\n }\n }}\n role=\"dialog\"\n aria-modal=\"false\"\n ref={popoverContentRef}\n data-automation-id={popoverContentAutomationId}\n >\n {renderPopoverContents({ closePopoverCb: () => setDisplayPopover(false) })}\n </div>\n )}\n {isWithPortal &&\n displayPopover &&\n isSrcElementVisible &&\n ReactDOM.createPortal(\n <div\n className={`popover-content-with-portal ${popoverContentClasses} ${contentWidth == 'full' ? 'w-full' : 'w-max'}`}\n style={{\n position: 'fixed',\n top: portalPosition.top,\n left: portalPosition.left,\n zIndex: 1000,\n borderColor: 'var(--color-gray-200)',\n color: 'var(--color-gray-900)',\n backgroundColor: 'var(--color-white)'\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Allow Escape key to close popover when focus is on content\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n setDisplayPopover(false);\n srcElementRef.current?.focus();\n } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Home' || e.key === 'End') {\n // Handle arrow key navigation for focusable elements inside popover\n handleArrowKeyNavigation(e, popoverContentRef.current);\n }\n }}\n role=\"dialog\"\n aria-modal=\"false\"\n ref={popoverContentRef}\n data-automation-id={popoverContentAutomationId}\n >\n {renderPopoverContents({ closePopoverCb: () => setDisplayPopover(false) })}\n </div>,\n document.body\n )}\n </div>\n );\n }\n);\n\n"],"names":["Popover","className","automationId","position","popoverContentAutomationId","contentWidth","renderPopoverContents","renderPopoverSrcElement","onPopoverToggle","isPopoverOpen","disabled","isWithPortal","ariaLabel","sourceRole","props","ref","displayPopover","setDisplayPopover","useState","popoverPosition","setPopoverPosition","isSrcElementVisible","setIsSrcElementVisible","srcElementRef","useRef","popoverContentRef","portalPosition","setPortalPosition","top","left","calculatePositionOfPopover","current","localPosition","srcRect","getBoundingClientRect","viewportWidth","window","innerWidth","viewportHeight","innerHeight","bottom","right","width","height","popoverRect","popoverWidth","popoverHeight","Math","max","spaceAbove","spaceBelow","useEffect","document","body","addEventListener","clickListener","checkPopoverPosition","removeEventListener","clickAndScrollListenerWithPortal","resizeListenerWithPortal","timeout1","setTimeout","checkSourceVisibility","timeout2","clearTimeout","rec","isVisible","focusableSelectors","join","firstFocusable","querySelector","activeElement","focus","includes","event","currentDropRef","target","isSourcePopover","contains","isPopoverContent","closestPopoverWrapper","closest","currentPopoverRef","type","togglePopover","handleArrowKeyNavigation","e","container","focusableElements","Array","from","querySelectorAll","filter","el","style","getComputedStyle","hasAttribute","display","visibility","tabIndex","length","currentIndex","findIndex","nextIndex","key","preventDefault","stopPropagation","useImperativeHandle","popoverContentStyle","transform","popoverContentClasses","noBorder","React","createElement","_extends","onClick","onKeyDown","wasOpen","currentRef","role","borderColor","color","backgroundColor","closePopoverCb","ReactDOM","createPortal","zIndex"],"mappings":";;;;;;;;;;;AAwBO,MAAMA,uBACX,CACE;AAAA,E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b,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEhH,WAAW,+BAA+B6G,CAAqB,IAAIzG,KAAgB,SAAS,WAAW,OAAO;AAAA,IAC9GyF,OAAO;AAAA,MACL3F,UAAU;AAAA,MACVyB,KAAKF,EAAeE;AAAAA,MACpBC,MAAMH,EAAeG;AAAAA,MACrBiG,QAAQ;AAAA,MACRN,aAAa;AAAA,MACbC,OAAO;AAAA,MACPC,iBAAiB;AAAA,IAAA;AAAA,IAEnBP,SAAU7B,CAAAA,MAAMA,EAAEoB,gBAAAA;AAAAA,IAClBU,WAAY9B,CAAAA,MAAM;AAEhB,MAAIA,EAAEkB,QAAQ,YACZlB,EAAEmB,eAAAA,GACFnB,EAAEoB,gBAAAA,GACFzF,EAAkB,EAAK,GACvBM,EAAcQ,SAASyC,MAAAA,MACdc,EAAEkB,QAAQ,eAAelB,EAAEkB,QAAQ,aAAalB,EAAEkB,QAAQ,UAAUlB,EAAEkB,QAAQ,UAEvFnB,EAAyBC,GAAG7D,EAAkBM,OAAO;AAAA,IAEzD;AAAA,IACAwF,MAAK;AAAA,IACL,cAAW;AAAA,IACXxG,KAAKU;AAAAA,IACL,sBAAoBrB;AAAAA,EAAAA,GAEnBE,EAAsB;AAAA,IAAEqH,gBAAgBA,MAAM1G,EAAkB,EAAK;AAAA,EAAA,CAAG,CACtE,GACLmC,SAASC,IACX,CACC;AAET,CACF;"}
|
package/dist/index21.js
CHANGED
|
@@ -15,7 +15,7 @@ const I = ({
|
|
|
15
15
|
defaultChecked: c = !1,
|
|
16
16
|
disabled: e = !1,
|
|
17
17
|
onChange: m,
|
|
18
|
-
checkMarkType:
|
|
18
|
+
checkMarkType: r = "",
|
|
19
19
|
label: k = "",
|
|
20
20
|
disabledLabel: h = "",
|
|
21
21
|
containerAutomationId: g = "",
|
|
@@ -26,21 +26,21 @@ const I = ({
|
|
|
26
26
|
l(c);
|
|
27
27
|
}, [c]);
|
|
28
28
|
const p = (t) => {
|
|
29
|
-
e || (l((
|
|
29
|
+
e || (l((o) => !o), m?.(!n, t));
|
|
30
30
|
}, E = (t) => {
|
|
31
31
|
if (!e && (t.key === "Enter" || t.key === " ")) {
|
|
32
32
|
t.preventDefault(), t.stopPropagation();
|
|
33
|
-
const
|
|
34
|
-
l(
|
|
33
|
+
const o = !n;
|
|
34
|
+
l(o);
|
|
35
35
|
const u = t.currentTarget.closest("label")?.querySelector("input");
|
|
36
|
-
u && m?.(
|
|
36
|
+
u && m?.(o, {
|
|
37
37
|
target: u,
|
|
38
38
|
currentTarget: u
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}, v = () => {
|
|
42
42
|
const t = "focus-visible:outline outline-2 outline-[var(--color-blue-400)] outline-offset-2 rounded";
|
|
43
|
-
return e ? n &&
|
|
43
|
+
return e ? n && r === "tick" ? "disabled-tick" : n && r === "minus-checkbox" ? "disabled-minus-checkbox" : n && !r ? "disabled-tick" : "disabled-default" : r === "minus-checkbox" && n ? `minus-checkbox ${t}` : n ? `checked ${t}` : `unchecked ${t}`;
|
|
44
44
|
}, y = () => e ? "checkbox-label-disabled" : "checkbox-label", d = () => e && h ? h : k, x = crypto.randomUUID();
|
|
45
45
|
return /* @__PURE__ */ s.createElement("div", {
|
|
46
46
|
className: "se-design-checkbox-ctn"
|
|
@@ -49,9 +49,9 @@ const I = ({
|
|
|
49
49
|
htmlFor: x,
|
|
50
50
|
className: `se-design-checkbox ${i} ${v()}`,
|
|
51
51
|
"data-automation-id": g || "checkbox-container",
|
|
52
|
-
tabIndex:
|
|
53
|
-
"aria-checked": n,
|
|
54
|
-
"aria-disabled": e
|
|
52
|
+
tabIndex: 0,
|
|
53
|
+
"aria-checked": n ? "true" : "false",
|
|
54
|
+
"aria-disabled": e ? "true" : "false"
|
|
55
55
|
}, f ? {
|
|
56
56
|
"aria-label": f
|
|
57
57
|
} : {
|
package/dist/index21.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index21.js","sources":["../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { FC, useState, useEffect } from 'react';\nimport './style.scss';\n\nexport interface CheckboxProps {\n className?: string;\n automationId?: string;\n defaultChecked?: boolean;\n onChange?: (checked: boolean, e: React.ChangeEvent<HTMLInputElement>) => void;\n disabled?: boolean;\n checkMarkType?: 'tick' | 'minus-checkbox' | '';\n label?: string;\n disabledLabel?: string;\n containerAutomationId?: string;\n ariaLabel?: string;\n}\n\nexport const Checkbox: FC<CheckboxProps> = ({\n className = '',\n automationId = '',\n defaultChecked = false,\n disabled = false,\n onChange,\n checkMarkType = '',\n label = '',\n disabledLabel = '',\n containerAutomationId = '',\n ariaLabel = 'Checkbox'\n}) => {\n const [isChecked, setIsChecked] = useState(defaultChecked);\n\n useEffect(() => {\n setIsChecked(defaultChecked);\n }, [defaultChecked]);\n\n const handleClick = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n setIsChecked((prev) => (checkMarkType === 'minus-checkbox' ? !prev : !prev));\n onChange?.(!isChecked, e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLLabelElement | HTMLSpanElement>) => {\n if (disabled) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const newChecked = !isChecked;\n setIsChecked(newChecked);\n \n // Create a proper synthetic event for the onChange callback\n const inputElement = e.currentTarget.closest('label')?.querySelector('input');\n if (inputElement) {\n const syntheticEvent = {\n target: inputElement,\n currentTarget: inputElement,\n } as React.ChangeEvent<HTMLInputElement>;\n onChange?.(newChecked, syntheticEvent);\n }\n }\n };\n\n const getCheckBoxClassName = () => {\n const focusClass = 'focus-visible:outline outline-2 outline-[var(--color-blue-400)] outline-offset-2 rounded';\n\n // Handle disabled states with proper checked status\n if (disabled) {\n if (isChecked && checkMarkType === 'tick') return 'disabled-tick';\n if (isChecked && checkMarkType === 'minus-checkbox') return 'disabled-minus-checkbox';\n if (isChecked && !checkMarkType) return 'disabled-tick'; // Default to tick for checked disabled\n return 'disabled-default'; // Unchecked disabled\n }\n\n // Handle enabled states\n if (checkMarkType === 'minus-checkbox' && isChecked) return `minus-checkbox ${focusClass}`;\n return isChecked ? `checked ${focusClass}` : `unchecked ${focusClass}`;\n };\n\n const getLabelClassName = () => {\n return disabled ? 'checkbox-label-disabled' : 'checkbox-label';\n };\n\n const getLabelText = () => {\n if (disabled && disabledLabel) {\n return disabledLabel;\n }\n return label;\n };\n const uniqueId = crypto.randomUUID();\n\n return (\n <div className=\"se-design-checkbox-ctn\">\n <label\n role=\"checkbox\"\n htmlFor={uniqueId}\n className={`se-design-checkbox ${className} ${getCheckBoxClassName()}`}\n data-automation-id={containerAutomationId || 'checkbox-container'}\n tabIndex={
|
|
1
|
+
{"version":3,"file":"index21.js","sources":["../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { FC, useState, useEffect } from 'react';\nimport './style.scss';\n\nexport interface CheckboxProps {\n className?: string;\n automationId?: string;\n defaultChecked?: boolean;\n onChange?: (checked: boolean, e: React.ChangeEvent<HTMLInputElement>) => void;\n disabled?: boolean;\n checkMarkType?: 'tick' | 'minus-checkbox' | '';\n label?: string;\n disabledLabel?: string;\n containerAutomationId?: string;\n ariaLabel?: string;\n}\n\nexport const Checkbox: FC<CheckboxProps> = ({\n className = '',\n automationId = '',\n defaultChecked = false,\n disabled = false,\n onChange,\n checkMarkType = '',\n label = '',\n disabledLabel = '',\n containerAutomationId = '',\n ariaLabel = 'Checkbox'\n}) => {\n const [isChecked, setIsChecked] = useState(defaultChecked);\n\n useEffect(() => {\n setIsChecked(defaultChecked);\n }, [defaultChecked]);\n\n const handleClick = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (disabled) return;\n setIsChecked((prev) => (checkMarkType === 'minus-checkbox' ? !prev : !prev));\n onChange?.(!isChecked, e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLLabelElement | HTMLSpanElement>) => {\n if (disabled) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const newChecked = !isChecked;\n setIsChecked(newChecked);\n \n // Create a proper synthetic event for the onChange callback\n const inputElement = e.currentTarget.closest('label')?.querySelector('input');\n if (inputElement) {\n const syntheticEvent = {\n target: inputElement,\n currentTarget: inputElement,\n } as React.ChangeEvent<HTMLInputElement>;\n onChange?.(newChecked, syntheticEvent);\n }\n }\n };\n\n const getCheckBoxClassName = () => {\n const focusClass = 'focus-visible:outline outline-2 outline-[var(--color-blue-400)] outline-offset-2 rounded';\n\n // Handle disabled states with proper checked status\n if (disabled) {\n if (isChecked && checkMarkType === 'tick') return 'disabled-tick';\n if (isChecked && checkMarkType === 'minus-checkbox') return 'disabled-minus-checkbox';\n if (isChecked && !checkMarkType) return 'disabled-tick'; // Default to tick for checked disabled\n return 'disabled-default'; // Unchecked disabled\n }\n\n // Handle enabled states\n if (checkMarkType === 'minus-checkbox' && isChecked) return `minus-checkbox ${focusClass}`;\n return isChecked ? `checked ${focusClass}` : `unchecked ${focusClass}`;\n };\n\n const getLabelClassName = () => {\n return disabled ? 'checkbox-label-disabled' : 'checkbox-label';\n };\n\n const getLabelText = () => {\n if (disabled && disabledLabel) {\n return disabledLabel;\n }\n return label;\n };\n const uniqueId = crypto.randomUUID();\n\n return (\n <div className=\"se-design-checkbox-ctn\">\n <label\n role=\"checkbox\"\n htmlFor={uniqueId}\n className={`se-design-checkbox ${className} ${getCheckBoxClassName()}`}\n data-automation-id={containerAutomationId || 'checkbox-container'}\n tabIndex={0}\n aria-checked={isChecked ? 'true' : 'false'}\n aria-disabled={disabled ? 'true' : 'false'}\n {...(ariaLabel ? { 'aria-label': ariaLabel } : { 'aria-labelledby': `${automationId}-label` })}\n onKeyDown={handleKeyDown}\n >\n <input\n id={uniqueId}\n type=\"checkbox\"\n checked={isChecked}\n onChange={handleClick}\n disabled={disabled}\n aria-hidden=\"true\"\n />\n <span className=\"checkbox-item\" data-automation-id={automationId}></span>\n {getLabelText()?.length > 0 && <span className={getLabelClassName()} data-automation-id=\"checkbox-label\">{getLabelText()}</span>}\n </label>\n </div>\n );\n};\n"],"names":["Checkbox","className","automationId","defaultChecked","disabled","onChange","checkMarkType","label","disabledLabel","containerAutomationId","ariaLabel","isChecked","setIsChecked","useState","useEffect","handleClick","e","prev","handleKeyDown","key","preventDefault","stopPropagation","newChecked","inputElement","currentTarget","closest","querySelector","target","getCheckBoxClassName","focusClass","getLabelClassName","getLabelText","uniqueId","crypto","randomUUID","React","createElement","_extends","role","htmlFor","tabIndex","onKeyDown","id","type","checked","length"],"mappings":";;;;;;;;;;;AAgBO,MAAMA,IAA8BA,CAAC;AAAA,EAC1CC,WAAAA,IAAY;AAAA,EACZC,cAAAA,IAAe;AAAA,EACfC,gBAAAA,IAAiB;AAAA,EACjBC,UAAAA,IAAW;AAAA,EACXC,UAAAA;AAAAA,EACAC,eAAAA,IAAgB;AAAA,EAChBC,OAAAA,IAAQ;AAAA,EACRC,eAAAA,IAAgB;AAAA,EAChBC,uBAAAA,IAAwB;AAAA,EACxBC,WAAAA,IAAY;AACd,MAAM;AACJ,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAASV,CAAc;AAEzDW,EAAAA,EAAU,MAAM;AACdF,IAAAA,EAAaT,CAAc;AAAA,EAC7B,GAAG,CAACA,CAAc,CAAC;AAEnB,QAAMY,IAAcA,CAACC,MAA2C;AAC9D,IAAIZ,MACJQ,EAAcK,OAA+C,CAACA,CAAa,GAC3EZ,IAAW,CAACM,GAAWK,CAAC;AAAA,EAC1B,GAEME,IAAgBA,CAACF,MAA+D;AACpF,QAAIZ,CAAAA,MACAY,EAAEG,QAAQ,WAAWH,EAAEG,QAAQ,MAAK;AACtCH,MAAAA,EAAEI,eAAAA,GACFJ,EAAEK,gBAAAA;AACF,YAAMC,IAAa,CAACX;AACpBC,MAAAA,EAAaU,CAAU;AAGvB,YAAMC,IAAeP,EAAEQ,cAAcC,QAAQ,OAAO,GAAGC,cAAc,OAAO;AAC5E,MAAIH,KAKFlB,IAAWiB,GAJY;AAAA,QACrBK,QAAQJ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AAAA,EAAAC,cAAA,QAAA;AAAA,IAAMnC,WAAW6B,EAAAA;AAAAA,IAAqB,sBAAmB;AAAA,EAAA,GAAkBC,EAAAA,CAAqB,CAC1H,CACJ;AAET;"}
|
package/dist/index23.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import t, { useState as
|
|
2
|
-
import { Popover as
|
|
1
|
+
import t, { useState as w, useRef as H, useEffect as $ } from "react";
|
|
2
|
+
import { Popover as Y } from "./index17.js";
|
|
3
3
|
import { Icon as A } from "./index5.js";
|
|
4
|
-
import { Checkbox as
|
|
4
|
+
import { Checkbox as Z } from "./index21.js";
|
|
5
5
|
import { Button as B } from "./index3.js";
|
|
6
|
-
import { InputWithIcon as
|
|
7
|
-
const
|
|
8
|
-
const [
|
|
6
|
+
import { InputWithIcon as ee } from "./index50.js";
|
|
7
|
+
const ce = (o) => {
|
|
8
|
+
const [i, P] = w(!1), [f, x] = w(""), [a, d] = w(() => o?.defaultSelectedValue ? Array.isArray(o?.defaultSelectedValue) ? o?.defaultSelectedValue : [o.defaultSelectedValue] : []), p = H(null), {
|
|
9
9
|
selectBy: s = "",
|
|
10
10
|
optionsUniqueBy: n = "",
|
|
11
|
-
displaySelected:
|
|
12
|
-
dropDownOptions:
|
|
13
|
-
defaultText:
|
|
11
|
+
displaySelected: L = !1,
|
|
12
|
+
dropDownOptions: h,
|
|
13
|
+
defaultText: m = "Select",
|
|
14
14
|
iconColor: g = "var(--color-gray-700)",
|
|
15
15
|
disabled: y = !1,
|
|
16
|
-
dropdownClassName:
|
|
16
|
+
dropdownClassName: M = "",
|
|
17
17
|
hasError: S = !1,
|
|
18
|
-
errorMessage:
|
|
18
|
+
errorMessage: O = "",
|
|
19
19
|
customDropdownContent: E = null,
|
|
20
|
-
isBorderless:
|
|
20
|
+
isBorderless: U = !1,
|
|
21
21
|
shouldShowSearch: D = !1,
|
|
22
|
-
searchPlaceholder:
|
|
23
|
-
searchResultEmptyMessage: C = "No results found"
|
|
22
|
+
searchPlaceholder: R = "Search...",
|
|
23
|
+
searchResultEmptyMessage: C = "No results found",
|
|
24
|
+
ariaLabel: j = ""
|
|
24
25
|
} = o;
|
|
25
|
-
|
|
26
|
+
$(() => {
|
|
26
27
|
const e = o?.defaultSelectedValue ? Array.isArray(o?.defaultSelectedValue) ? o?.defaultSelectedValue : [o.defaultSelectedValue] : [];
|
|
27
|
-
|
|
28
|
-
}, [o?.defaultSelectedValue]),
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
const v = o?.type === "multi-select", N = () => f.trim() ? (
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
28
|
+
d(e);
|
|
29
|
+
}, [o?.defaultSelectedValue]), $(() => {
|
|
30
|
+
i || x("");
|
|
31
|
+
}, [i]);
|
|
32
|
+
const v = o?.type === "multi-select", N = () => f.trim() ? (h || []).filter((e) => (e?.[s]?.toString().toLowerCase() || "").includes(f.toLowerCase())) : h || [], k = (e) => {
|
|
33
|
+
d([e]), p.current?.togglePopover(), o?.onOptionClick?.(e);
|
|
34
|
+
}, T = (e) => v ? m : e?.[s] || m, q = () => {
|
|
35
|
+
d([]);
|
|
35
36
|
}, V = (e, r = !1) => {
|
|
36
37
|
if (o?.renderOptionChip)
|
|
37
38
|
return o?.renderOptionChip(e, r);
|
|
@@ -41,16 +42,16 @@ const ne = (o) => {
|
|
|
41
42
|
className: "option-chip flex items-center w-full"
|
|
42
43
|
}, /* @__PURE__ */ t.createElement("div", {
|
|
43
44
|
className: `${c > 0 ? "w-full" : "flex-1"} truncate`
|
|
44
|
-
}, `${
|
|
45
|
+
}, `${m}: ${l}`), c > 0 && /* @__PURE__ */ t.createElement("div", {
|
|
45
46
|
className: "flex-shrink-0"
|
|
46
47
|
}, "+", c));
|
|
47
48
|
}
|
|
48
49
|
return /* @__PURE__ */ t.createElement("p", {
|
|
49
50
|
className: "option-chip flex flex-1 items-center justify-between"
|
|
50
|
-
},
|
|
51
|
-
},
|
|
51
|
+
}, T(e));
|
|
52
|
+
}, I = () => /* @__PURE__ */ t.createElement("div", {
|
|
52
53
|
className: " w-full relative flex items-center border-b border-[var(--color-gray-300)]"
|
|
53
|
-
}, /* @__PURE__ */ t.createElement(
|
|
54
|
+
}, /* @__PURE__ */ t.createElement(ee, {
|
|
54
55
|
leftIcon: {
|
|
55
56
|
name: "search",
|
|
56
57
|
position: "left",
|
|
@@ -59,8 +60,8 @@ const ne = (o) => {
|
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
62
|
value: f,
|
|
62
|
-
onChange: (e) =>
|
|
63
|
-
placeholder:
|
|
63
|
+
onChange: (e) => x(e),
|
|
64
|
+
placeholder: R,
|
|
64
65
|
style: {
|
|
65
66
|
margin: 0,
|
|
66
67
|
gap: 0
|
|
@@ -70,17 +71,17 @@ const ne = (o) => {
|
|
|
70
71
|
border: "none",
|
|
71
72
|
outline: "none"
|
|
72
73
|
}
|
|
73
|
-
})),
|
|
74
|
-
const l = e[s], c = a[0]?.[s] ||
|
|
74
|
+
})), z = (e, r) => {
|
|
75
|
+
const l = e[s], c = a[0]?.[s] || m, G = n?.length ? e[n] == a[0]?.[n] : !0, u = L && l === c && G;
|
|
75
76
|
return /* @__PURE__ */ t.createElement("div", {
|
|
76
77
|
key: `$drop-option-${crypto.randomUUID()}`,
|
|
77
78
|
className: `option break-words px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between ${u ? "selected" : ""}`,
|
|
78
79
|
onClick: () => k(e),
|
|
79
|
-
onKeyDown: (
|
|
80
|
-
(
|
|
80
|
+
onKeyDown: (b) => {
|
|
81
|
+
(b.key === "Enter" || b.key === " ") && (b.preventDefault(), k(e));
|
|
81
82
|
},
|
|
82
83
|
role: "option",
|
|
83
|
-
"aria-selected": u,
|
|
84
|
+
"aria-selected": u ? "true" : "false",
|
|
84
85
|
tabIndex: 0,
|
|
85
86
|
"data-automation-id": `dropdown-option-${e?.automationId || r}`
|
|
86
87
|
}, V({
|
|
@@ -90,46 +91,46 @@ const ne = (o) => {
|
|
|
90
91
|
name: "checkmark",
|
|
91
92
|
stroke: g
|
|
92
93
|
}));
|
|
93
|
-
},
|
|
94
|
+
}, J = () => {
|
|
94
95
|
const e = N();
|
|
95
96
|
return /* @__PURE__ */ t.createElement("div", {
|
|
96
97
|
className: "dropdown-content dropdown-options",
|
|
97
98
|
role: "listbox",
|
|
98
99
|
"aria-label": "Dropdown options"
|
|
99
|
-
}, D &&
|
|
100
|
+
}, D && I(), /* @__PURE__ */ t.createElement("div", {
|
|
100
101
|
className: "flex flex-col max-h-80 overflow-y-auto"
|
|
101
|
-
}, e.length > 0 ? e.map((r, l) =>
|
|
102
|
+
}, e.length > 0 ? e.map((r, l) => z(r, l)) : /* @__PURE__ */ t.createElement("div", {
|
|
102
103
|
className: "px-3 py-4 text-center text-[var(--color-gray-500)] text-sm",
|
|
103
104
|
role: "status",
|
|
104
105
|
"aria-live": "polite"
|
|
105
106
|
}, C)));
|
|
106
|
-
},
|
|
107
|
+
}, Q = (e, r) => {
|
|
107
108
|
let l = [];
|
|
108
|
-
e ? l = [...a, r] : l = a?.filter((c) => c[n] !== r[n]),
|
|
109
|
-
},
|
|
109
|
+
e ? l = [...a, r] : l = a?.filter((c) => c[n] !== r[n]), d(l);
|
|
110
|
+
}, W = () => {
|
|
110
111
|
p.current?.togglePopover(), o?.onApply?.(a);
|
|
111
|
-
},
|
|
112
|
+
}, _ = (e) => {
|
|
112
113
|
const r = a.some((l) => l[n] === e[n]);
|
|
113
114
|
return /* @__PURE__ */ t.createElement("div", {
|
|
114
115
|
key: `$drop-option-${crypto.randomUUID()}`,
|
|
115
116
|
className: "option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between"
|
|
116
|
-
}, /* @__PURE__ */ t.createElement(
|
|
117
|
+
}, /* @__PURE__ */ t.createElement(Z, {
|
|
117
118
|
automationId: "checkbox",
|
|
118
119
|
className: "checkbox",
|
|
119
120
|
defaultChecked: r,
|
|
120
|
-
onChange: (l) =>
|
|
121
|
+
onChange: (l) => Q(l, e),
|
|
121
122
|
label: e?.label
|
|
122
123
|
}));
|
|
123
|
-
},
|
|
124
|
+
}, F = () => {
|
|
124
125
|
const e = N();
|
|
125
126
|
return /* @__PURE__ */ t.createElement("div", {
|
|
126
127
|
className: "dropdown-content dropdown-options",
|
|
127
128
|
role: "listbox",
|
|
128
129
|
"aria-label": "Multi-select dropdown options",
|
|
129
130
|
"aria-multiselectable": "true"
|
|
130
|
-
}, D &&
|
|
131
|
+
}, D && I(), /* @__PURE__ */ t.createElement("div", {
|
|
131
132
|
className: "flex flex-col max-h-80 overflow-y-auto"
|
|
132
|
-
}, e.length > 0 ? e.map((r) =>
|
|
133
|
+
}, e.length > 0 ? e.map((r) => _(r)) : /* @__PURE__ */ t.createElement("div", {
|
|
133
134
|
className: "px-3 py-4 text-center text-[var(--color-gray-500)] text-sm",
|
|
134
135
|
role: "status",
|
|
135
136
|
"aria-live": "polite"
|
|
@@ -139,15 +140,15 @@ const ne = (o) => {
|
|
|
139
140
|
label: "Clear",
|
|
140
141
|
type: "link",
|
|
141
142
|
size: "sm",
|
|
142
|
-
onClick:
|
|
143
|
+
onClick: q
|
|
143
144
|
}), /* @__PURE__ */ t.createElement(B, {
|
|
144
145
|
label: "Apply",
|
|
145
146
|
type: "primary",
|
|
146
147
|
size: "sm",
|
|
147
|
-
onClick:
|
|
148
|
+
onClick: W
|
|
148
149
|
})));
|
|
149
|
-
},
|
|
150
|
-
const e =
|
|
150
|
+
}, K = () => {
|
|
151
|
+
const e = i ? "border-[var(--color-blue-500)]" : y ? "border-[var(--color-gray-300)]" : "border-[var(--color-gray-600)]", r = S ? "border-[var(--color-red-500)]" : "", l = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 ${U ? "border-0" : `border rounded-md ${r || e}`} flex items-center ${M}`;
|
|
151
152
|
return /* @__PURE__ */ t.createElement("div", {
|
|
152
153
|
className: l
|
|
153
154
|
}, /* @__PURE__ */ t.createElement("div", {
|
|
@@ -158,14 +159,11 @@ const ne = (o) => {
|
|
|
158
159
|
"aria-hidden": "true"
|
|
159
160
|
}, /* @__PURE__ */ t.createElement(A, {
|
|
160
161
|
name: "chevron",
|
|
161
|
-
rotation:
|
|
162
|
+
rotation: i ? "180" : "0",
|
|
162
163
|
className: "transition-transform",
|
|
163
164
|
stroke: g
|
|
164
165
|
})));
|
|
165
|
-
},
|
|
166
|
-
const e = a[0]?.[s] || i;
|
|
167
|
-
return o?.label ? `${o.label}: ${e}` : `Select option, currently selected: ${e}`;
|
|
168
|
-
};
|
|
166
|
+
}, X = () => j || "Select option";
|
|
169
167
|
return /* @__PURE__ */ t.createElement("div", {
|
|
170
168
|
className: `se-design-dropdown-container${o?.className ? ` ${o?.className}` : ""}`,
|
|
171
169
|
style: o?.style
|
|
@@ -174,21 +172,22 @@ const ne = (o) => {
|
|
|
174
172
|
}, o?.label), /* @__PURE__ */ t.createElement("div", {
|
|
175
173
|
style: o?.style,
|
|
176
174
|
className: `${y ? "bg-[var(--color-gray-50)] rounded-md cursor-not-allowed" : ""}`
|
|
177
|
-
}, /* @__PURE__ */ t.createElement(
|
|
175
|
+
}, /* @__PURE__ */ t.createElement(Y, {
|
|
178
176
|
ref: p,
|
|
179
|
-
renderPopoverContents: E || (v ?
|
|
177
|
+
renderPopoverContents: E || (v ? F : J),
|
|
180
178
|
contentWidth: "full",
|
|
181
|
-
renderPopoverSrcElement:
|
|
179
|
+
renderPopoverSrcElement: K,
|
|
182
180
|
onPopoverToggle: (e) => P(e),
|
|
183
181
|
disabled: y,
|
|
184
182
|
automationId: o?.dropDownSrcAutomationId,
|
|
185
183
|
popoverContentAutomationId: o?.dropDownContentAutomationId,
|
|
186
|
-
ariaLabel:
|
|
184
|
+
ariaLabel: X(),
|
|
185
|
+
sourceRole: "combobox"
|
|
187
186
|
})), S && /* @__PURE__ */ t.createElement("div", {
|
|
188
187
|
className: "text-[var(--color-red-500)] text-sm"
|
|
189
|
-
},
|
|
188
|
+
}, O));
|
|
190
189
|
};
|
|
191
190
|
export {
|
|
192
|
-
|
|
191
|
+
ce as Dropdown
|
|
193
192
|
};
|
|
194
193
|
//# sourceMappingURL=index23.js.map
|
package/dist/index23.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index23.js","sources":["../src/components/Dropdown/index.tsx"],"sourcesContent":["import React, { FC, useState, useRef, useEffect } from 'react';\n\nimport { Popover, PopoverHandle } from 'src/components/Popover';\nimport { Icon } from 'components/Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\nimport { InputWithIcon } from '../InputWithIcon';\n\ntype DropdownValue = {\n [key: string]: any;\n};\n\ntype DropdownProps = {\n label?: string;\n type: 'select' | 'multi-select';\n dropDownOptions?: DropdownValue[];\n defaultText?: string;\n selectBy?: string;\n optionsUniqueBy?: string;\n displaySelected?: boolean;\n defaultSelectedValue?: DropdownValue | DropdownValue[];\n onOptionClick?: (selectedValue: DropdownValue) => void;\n style?: React.CSSProperties;\n renderOptionChip?: (option: DropdownValue, srcOption: boolean) => React.ReactNode;\n className?: string;\n iconColor?: string;\n disabled?: boolean;\n dropdownClassName?: string;\n hasError?: boolean;\n errorMessage?: string;\n onApply?: (selectedValue: DropdownValue[]) => void;\n customDropdownContent?: () => React.ReactNode;\n isBorderless?: boolean;\n dropDownSrcAutomationId?: string;\n dropDownSelectAutomationId?: string;\n dropDownContentAutomationId?: string;\n shouldShowSearch?: boolean;\n searchPlaceholder?: string;\n searchResultEmptyMessage?: string;\n};\n\nexport const Dropdown: FC<DropdownProps> = (props) => {\n const [isDropDownOpen, setIsDropDownOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [selectedDropDownValues, setSelectedDropDownValues] = useState<DropdownValue[]>(() =>\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n const popoverRef = useRef<HTMLDivElement & PopoverHandle>(null);\n\n const {\n selectBy = '',\n optionsUniqueBy = '',\n displaySelected = false,\n dropDownOptions,\n defaultText = 'Select',\n iconColor = 'var(--color-gray-700)',\n disabled = false,\n dropdownClassName = '',\n hasError = false,\n errorMessage = '',\n customDropdownContent = null,\n isBorderless = false,\n shouldShowSearch = false,\n searchPlaceholder = 'Search...',\n searchResultEmptyMessage = 'No results found'\n } = props;\n\n useEffect(() => {\n const newValues = props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : [];\n setSelectedDropDownValues(newValues);\n }, [props?.defaultSelectedValue]);\n\n useEffect(() => {\n if (!isDropDownOpen) {\n setSearchQuery('');\n }\n }, [isDropDownOpen]);\n\n const isMultiSelect = props?.type === 'multi-select';\n\n const getFilteredOptions = () => {\n if (!searchQuery.trim()) {\n return dropDownOptions || [];\n }\n return (dropDownOptions || []).filter((option) => {\n const optionValue = option?.[selectBy]?.toString().toLowerCase() || '';\n return optionValue.includes(searchQuery.toLowerCase());\n });\n };\n\n const handleDropDownOptionClick = (dropDownOption: any) => {\n setSelectedDropDownValues([dropDownOption]);\n popoverRef.current?.togglePopover();\n props?.onOptionClick?.(dropDownOption);\n };\n\n const getSelectedDropDownValue = (option: DropdownValue) => {\n if (isMultiSelect) {\n return defaultText;\n }\n return option?.[selectBy] || defaultText;\n };\n\n const clearSelectedDropDownValues = () => {\n setSelectedDropDownValues([]);\n };\n\n const optionChip = (option: DropdownValue, srcOption: boolean = false) => {\n if (props?.renderOptionChip) {\n return props?.renderOptionChip(option, srcOption);\n }\n\n if (isMultiSelect && selectedDropDownValues?.length > 0) {\n const firstSelectedLabel = selectedDropDownValues[0]?.[selectBy] || '';\n const remainingCount = selectedDropDownValues.length - 1;\n\n // For multiple selections: text takes remaining space, count takes minimum space needed\n return (\n <div className={`option-chip flex items-center w-full`}>\n <div\n className={`${remainingCount > 0 ? 'w-full' : 'flex-1'} truncate`}\n >{`${defaultText}: ${firstSelectedLabel}`}</div>\n {remainingCount > 0 && <div className=\"flex-shrink-0\">+{remainingCount}</div>}\n </div>\n );\n }\n\n return <p className={`option-chip flex flex-1 items-center justify-between`}>{getSelectedDropDownValue(option)}</p>;\n };\n\n const renderSearchBar = () => {\n return (\n <div className=\" w-full relative flex items-center border-b border-[var(--color-gray-300)]\">\n <InputWithIcon\n leftIcon={{ name: 'search', position: 'left', style: { color: 'var(--color-gray-500)' } }}\n value={searchQuery}\n onChange={(value) => setSearchQuery(value)}\n placeholder={searchPlaceholder}\n style={{ margin: 0, gap: 0 }}\n inputStyle={{ width: '100%', border: 'none', outline: 'none' }}\n />\n </div>\n );\n };\n\n const dropDownOptionJsx = (dropDownOption: DropdownValue, index: number) => {\n const optionTxt = dropDownOption[selectBy];\n const dropDownSelectedValue = selectedDropDownValues[0]?.[selectBy] || defaultText;\n const selectByUniqueId = optionsUniqueBy?.length\n ? dropDownOption[optionsUniqueBy] == selectedDropDownValues[0]?.[optionsUniqueBy]\n : true;\n const isOptionSelected = displaySelected && optionTxt === dropDownSelectedValue && selectByUniqueId;\n return (\n <div\n key={`$drop-option-${crypto.randomUUID()}`}\n className={`option break-words px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between ${\n isOptionSelected ? 'selected' : ''\n }`}\n onClick={() => handleDropDownOptionClick(dropDownOption)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleDropDownOptionClick(dropDownOption);\n }\n }}\n role=\"option\"\n aria-selected={isOptionSelected}\n tabIndex={0}\n data-automation-id={`dropdown-option-${dropDownOption?.automationId || index}`}\n >\n {optionChip({ ...dropDownOption, isOptionSelected }, false)}\n {isOptionSelected && <Icon name=\"checkmark\" stroke={iconColor} />}\n </div>\n );\n };\n\n const renderDropdownContents = () => {\n const filteredOptions = getFilteredOptions();\n return (\n <div className=\"dropdown-content dropdown-options\" role=\"listbox\" aria-label=\"Dropdown options\">\n {shouldShowSearch && renderSearchBar()}\n <div className=\"flex flex-col max-h-80 overflow-y-auto\">\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => dropDownOptionJsx(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-500)] text-sm\" role=\"status\" aria-live=\"polite\">{searchResultEmptyMessage}</div>\n )}\n </div>\n </div>\n );\n };\n\n const handleMultiSelectDropdownOptionClick = (isSelected: boolean, dropDownOption: DropdownValue) => {\n let newSelectedDropDownValues: DropdownValue[] = [];\n if (isSelected) {\n newSelectedDropDownValues = [...selectedDropDownValues, dropDownOption];\n } else {\n newSelectedDropDownValues = selectedDropDownValues?.filter(\n (option) => option[optionsUniqueBy] !== dropDownOption[optionsUniqueBy]\n );\n }\n setSelectedDropDownValues(newSelectedDropDownValues);\n };\n\n const handleApplySelectedDropDownValues = () => {\n popoverRef.current?.togglePopover();\n props?.onApply?.(selectedDropDownValues);\n };\n\n const multiSelectDropdownOptionJSX = (dropDownOption: DropdownValue) => {\n const isOptionSelected = selectedDropDownValues.some(\n (option) => option[optionsUniqueBy] === dropDownOption[optionsUniqueBy]\n );\n return (\n <div\n key={`$drop-option-${crypto.randomUUID()}`}\n className=\"option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between\"\n >\n <Checkbox\n automationId=\"checkbox\"\n className=\"checkbox\"\n defaultChecked={isOptionSelected}\n onChange={(value) => handleMultiSelectDropdownOptionClick(value, dropDownOption)}\n label={dropDownOption?.label}\n />\n </div>\n );\n };\n\n const renderMultiSelectDropdownContents = () => {\n const filteredOptions = getFilteredOptions();\n return (\n <div className=\"dropdown-content dropdown-options\" role=\"listbox\" aria-label=\"Multi-select dropdown options\" aria-multiselectable=\"true\">\n {shouldShowSearch && renderSearchBar()}\n <div className=\"flex flex-col max-h-80 overflow-y-auto\">\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption) => multiSelectDropdownOptionJSX(dropDownOption))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-500)] text-sm\" role=\"status\" aria-live=\"polite\">{searchResultEmptyMessage}</div>\n )}\n </div>\n <div className=\"flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]\">\n <Button label=\"Clear\" type=\"link\" size=\"sm\" onClick={clearSelectedDropDownValues} />\n <Button label=\"Apply\" type=\"primary\" size=\"sm\" onClick={handleApplySelectedDropDownValues} />\n </div>\n </div>\n );\n };\n\n const renderDropdownSelect = () => {\n const borderColor = isDropDownOpen\n ? 'border-[var(--color-blue-500)]'\n : disabled\n ? 'border-[var(--color-gray-300)]'\n : 'border-[var(--color-gray-600)]';\n const errorBorderColor = hasError ? 'border-[var(--color-red-500)]' : '';\n const dropDownSelectClass = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 ${\n isBorderless ? 'border-0' : `border rounded-md ${errorBorderColor ? errorBorderColor : borderColor}`\n } flex items-center ${dropdownClassName}`;\n\n return (\n <div className={dropDownSelectClass}>\n <div\n className=\"flex-1 min-w-0\"\n data-automation-id={props?.dropDownSelectAutomationId || 'selected-dropdown-value'}\n >\n {optionChip(selectedDropDownValues[0], true)}\n </div>\n <div className=\"flex-shrink-0 ml-2\" aria-hidden=\"true\">\n <Icon\n name={'chevron'}\n rotation={isDropDownOpen ? '180' : '0'}\n className={`transition-transform`}\n stroke={iconColor}\n />\n </div>\n </div>\n );\n };\n\n const getDropdownAriaLabel = () => {\n const selectedValue = selectedDropDownValues[0]?.[selectBy] || defaultText;\n return props?.label ? `${props.label}: ${selectedValue}` : `Select option, currently selected: ${selectedValue}`;\n };\n\n return (\n <div\n className={`se-design-dropdown-container${props?.className ? ` ${props?.className}` : ''}`}\n style={props?.style}\n >\n {props?.label && (\n <div className=\"se-design-dropdown-label mb-[3px] text-[var(--color-gray-700)] text-sm\">{props?.label}</div>\n )}\n <div\n style={props?.style}\n className={`${disabled ? 'bg-[var(--color-gray-50)] rounded-md cursor-not-allowed' : ''}`}\n >\n <Popover\n ref={popoverRef}\n renderPopoverContents={\n customDropdownContent\n ? customDropdownContent\n : isMultiSelect\n ? renderMultiSelectDropdownContents\n : renderDropdownContents\n }\n contentWidth={'full'}\n renderPopoverSrcElement={renderDropdownSelect}\n onPopoverToggle={(value) => setIsDropDownOpen(value)}\n disabled={disabled}\n automationId={props?.dropDownSrcAutomationId}\n popoverContentAutomationId={props?.dropDownContentAutomationId}\n ariaLabel={getDropdownAriaLabel()}\n />\n </div>\n {hasError && <div className=\"text-[var(--color-red-500)] text-sm\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["React__default","useState","useRef","useEffect","Popover","Icon","Checkbox","Button","InputWithIcon","Dropdown","props","isDropDownOpen","setIsDropDownOpen","searchQuery","setSearchQuery","selectedDropDownValues","setSelectedDropDownValues","defaultSelectedValue","Array","isArray","popoverRef","selectBy","optionsUniqueBy","displaySelected","dropDownOptions","defaultText","iconColor","disabled","dropdownClassName","hasError","errorMessage","customDropdownContent","isBorderless","shouldShowSearch","searchPlaceholder","searchResultEmptyMessage","newValues","isMultiSelect","type","getFilteredOptions","trim","filter","option","toString","toLowerCase","includes","handleDropDownOptionClick","dropDownOption","current","togglePopover","onOptionClick","getSelectedDropDownValue","clearSelectedDropDownValues","optionChip","srcOption","renderOptionChip","length","firstSelectedLabel","remainingCount","React","createElement","className","renderSearchBar","leftIcon","name","position","style","color","value","onChange","placeholder","margin","gap","inputStyle","width","border","outline","dropDownOptionJsx","index","optionTxt","dropDownSelectedValue","selectByUniqueId","isOptionSelected","key","crypto","randomUUID","onClick","onKeyDown","e","preventDefault","role","tabIndex","automationId","stroke","renderDropdownContents","filteredOptions","map","handleMultiSelectDropdownOptionClick","isSelected","newSelectedDropDownValues","handleApplySelectedDropDownValues","onApply","multiSelectDropdownOptionJSX","some","defaultChecked","label","renderMultiSelectDropdownContents","size","renderDropdownSelect","borderColor","errorBorderColor","dropDownSelectClass","dropDownSelectAutomationId","rotation","getDropdownAriaLabel","selectedValue","ref","renderPopoverContents","contentWidth","renderPopoverSrcElement","onPopoverToggle","dropDownSrcAutomationId","popoverContentAutomationId","dropDownContent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BAAAA,EAAAC,cAACxD,GAAO;AAAA,IACNgH,KAAKhG;AAAAA,IACLiG,uBACEtF,MAEIM,IACAqE,IACAZ;AAAAA,IAENwB,cAAc;AAAA,IACdC,yBAAyBX;AAAAA,IACzBY,iBAAkBpD,CAAAA,MAAUxD,EAAkBwD,CAAK;AAAA,IACnDzC,UAAAA;AAAAA,IACAiE,cAAclF,GAAO+G;AAAAA,IACrBC,4BAA4BhH,GAAOiH;AAAAA,IACnCC,WAAWV,EAAAA;AAAAA,EAAqB,CACjC,CACE,GACJrF,KAAY8B,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKC,WAAU;AAAA,EAAA,GAAuC/B,CAAkB,CAClF;AAET;"}
|
|
1
|
+
{"version":3,"file":"index23.js","sources":["../src/components/Dropdown/index.tsx"],"sourcesContent":["import React, { FC, useState, useRef, useEffect } from 'react';\n\nimport { Popover, PopoverHandle } from 'src/components/Popover';\nimport { Icon } from 'components/Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\nimport { InputWithIcon } from '../InputWithIcon';\n\ntype DropdownValue = {\n [key: string]: any;\n};\n\ntype DropdownProps = {\n label?: string;\n ariaLabel?: string;\n type: 'select' | 'multi-select';\n dropDownOptions?: DropdownValue[];\n defaultText?: string;\n selectBy?: string;\n optionsUniqueBy?: string;\n displaySelected?: boolean;\n defaultSelectedValue?: DropdownValue | DropdownValue[];\n onOptionClick?: (selectedValue: DropdownValue) => void;\n style?: React.CSSProperties;\n renderOptionChip?: (option: DropdownValue, srcOption: boolean) => React.ReactNode;\n className?: string;\n iconColor?: string;\n disabled?: boolean;\n dropdownClassName?: string;\n hasError?: boolean;\n errorMessage?: string;\n onApply?: (selectedValue: DropdownValue[]) => void;\n customDropdownContent?: () => React.ReactNode;\n isBorderless?: boolean;\n dropDownSrcAutomationId?: string;\n dropDownSelectAutomationId?: string;\n dropDownContentAutomationId?: string;\n shouldShowSearch?: boolean;\n searchPlaceholder?: string;\n searchResultEmptyMessage?: string;\n};\n\nexport const Dropdown: FC<DropdownProps> = (props) => {\n const [isDropDownOpen, setIsDropDownOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [selectedDropDownValues, setSelectedDropDownValues] = useState<DropdownValue[]>(() =>\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n const popoverRef = useRef<HTMLDivElement & PopoverHandle>(null);\n\n const {\n selectBy = '',\n optionsUniqueBy = '',\n displaySelected = false,\n dropDownOptions,\n defaultText = 'Select',\n iconColor = 'var(--color-gray-700)',\n disabled = false,\n dropdownClassName = '',\n hasError = false,\n errorMessage = '',\n customDropdownContent = null,\n isBorderless = false,\n shouldShowSearch = false,\n searchPlaceholder = 'Search...',\n searchResultEmptyMessage = 'No results found',\n ariaLabel = ''\n } = props;\n\n useEffect(() => {\n const newValues = props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : [];\n setSelectedDropDownValues(newValues);\n }, [props?.defaultSelectedValue]);\n\n useEffect(() => {\n if (!isDropDownOpen) {\n setSearchQuery('');\n }\n }, [isDropDownOpen]);\n\n const isMultiSelect = props?.type === 'multi-select';\n\n const getFilteredOptions = () => {\n if (!searchQuery.trim()) {\n return dropDownOptions || [];\n }\n return (dropDownOptions || []).filter((option) => {\n const optionValue = option?.[selectBy]?.toString().toLowerCase() || '';\n return optionValue.includes(searchQuery.toLowerCase());\n });\n };\n\n const handleDropDownOptionClick = (dropDownOption: any) => {\n setSelectedDropDownValues([dropDownOption]);\n popoverRef.current?.togglePopover();\n props?.onOptionClick?.(dropDownOption);\n };\n\n const getSelectedDropDownValue = (option: DropdownValue) => {\n if (isMultiSelect) {\n return defaultText;\n }\n return option?.[selectBy] || defaultText;\n };\n\n const clearSelectedDropDownValues = () => {\n setSelectedDropDownValues([]);\n };\n\n const optionChip = (option: DropdownValue, srcOption: boolean = false) => {\n if (props?.renderOptionChip) {\n return props?.renderOptionChip(option, srcOption);\n }\n\n if (isMultiSelect && selectedDropDownValues?.length > 0) {\n const firstSelectedLabel = selectedDropDownValues[0]?.[selectBy] || '';\n const remainingCount = selectedDropDownValues.length - 1;\n\n // For multiple selections: text takes remaining space, count takes minimum space needed\n return (\n <div className={`option-chip flex items-center w-full`}>\n <div\n className={`${remainingCount > 0 ? 'w-full' : 'flex-1'} truncate`}\n >{`${defaultText}: ${firstSelectedLabel}`}</div>\n {remainingCount > 0 && <div className=\"flex-shrink-0\">+{remainingCount}</div>}\n </div>\n );\n }\n\n return <p className={`option-chip flex flex-1 items-center justify-between`}>{getSelectedDropDownValue(option)}</p>;\n };\n\n const renderSearchBar = () => {\n return (\n <div className=\" w-full relative flex items-center border-b border-[var(--color-gray-300)]\">\n <InputWithIcon\n leftIcon={{ name: 'search', position: 'left', style: { color: 'var(--color-gray-500)' } }}\n value={searchQuery}\n onChange={(value) => setSearchQuery(value)}\n placeholder={searchPlaceholder}\n style={{ margin: 0, gap: 0 }}\n inputStyle={{ width: '100%', border: 'none', outline: 'none' }}\n />\n </div>\n );\n };\n\n const dropDownOptionJsx = (dropDownOption: DropdownValue, index: number) => {\n const optionTxt = dropDownOption[selectBy];\n const dropDownSelectedValue = selectedDropDownValues[0]?.[selectBy] || defaultText;\n const selectByUniqueId = optionsUniqueBy?.length\n ? dropDownOption[optionsUniqueBy] == selectedDropDownValues[0]?.[optionsUniqueBy]\n : true;\n const isOptionSelected = displaySelected && optionTxt === dropDownSelectedValue && selectByUniqueId;\n return (\n <div\n key={`$drop-option-${crypto.randomUUID()}`}\n className={`option break-words px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between ${\n isOptionSelected ? 'selected' : ''\n }`}\n onClick={() => handleDropDownOptionClick(dropDownOption)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n handleDropDownOptionClick(dropDownOption);\n }\n }}\n role=\"option\"\n aria-selected={isOptionSelected ? 'true' : 'false'}\n tabIndex={0}\n data-automation-id={`dropdown-option-${dropDownOption?.automationId || index}`}\n >\n {optionChip({ ...dropDownOption, isOptionSelected }, false)}\n {isOptionSelected && <Icon name=\"checkmark\" stroke={iconColor} />}\n </div>\n );\n };\n\n const renderDropdownContents = () => {\n const filteredOptions = getFilteredOptions();\n return (\n <div className=\"dropdown-content dropdown-options\" role=\"listbox\" aria-label=\"Dropdown options\">\n {shouldShowSearch && renderSearchBar()}\n <div className=\"flex flex-col max-h-80 overflow-y-auto\">\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption, index) => dropDownOptionJsx(dropDownOption, index))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-500)] text-sm\" role=\"status\" aria-live=\"polite\">{searchResultEmptyMessage}</div>\n )}\n </div>\n </div>\n );\n };\n\n const handleMultiSelectDropdownOptionClick = (isSelected: boolean, dropDownOption: DropdownValue) => {\n let newSelectedDropDownValues: DropdownValue[] = [];\n if (isSelected) {\n newSelectedDropDownValues = [...selectedDropDownValues, dropDownOption];\n } else {\n newSelectedDropDownValues = selectedDropDownValues?.filter(\n (option) => option[optionsUniqueBy] !== dropDownOption[optionsUniqueBy]\n );\n }\n setSelectedDropDownValues(newSelectedDropDownValues);\n };\n\n const handleApplySelectedDropDownValues = () => {\n popoverRef.current?.togglePopover();\n props?.onApply?.(selectedDropDownValues);\n };\n\n const multiSelectDropdownOptionJSX = (dropDownOption: DropdownValue) => {\n const isOptionSelected = selectedDropDownValues.some(\n (option) => option[optionsUniqueBy] === dropDownOption[optionsUniqueBy]\n );\n return (\n <div\n key={`$drop-option-${crypto.randomUUID()}`}\n className=\"option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between\"\n >\n <Checkbox\n automationId=\"checkbox\"\n className=\"checkbox\"\n defaultChecked={isOptionSelected}\n onChange={(value) => handleMultiSelectDropdownOptionClick(value, dropDownOption)}\n label={dropDownOption?.label}\n />\n </div>\n );\n };\n\n const renderMultiSelectDropdownContents = () => {\n const filteredOptions = getFilteredOptions();\n return (\n <div className=\"dropdown-content dropdown-options\" role=\"listbox\" aria-label=\"Multi-select dropdown options\" aria-multiselectable=\"true\">\n {shouldShowSearch && renderSearchBar()}\n <div className=\"flex flex-col max-h-80 overflow-y-auto\">\n {filteredOptions.length > 0 ? (\n filteredOptions.map((dropDownOption) => multiSelectDropdownOptionJSX(dropDownOption))\n ) : (\n <div className=\"px-3 py-4 text-center text-[var(--color-gray-500)] text-sm\" role=\"status\" aria-live=\"polite\">{searchResultEmptyMessage}</div>\n )}\n </div>\n <div className=\"flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]\">\n <Button label=\"Clear\" type=\"link\" size=\"sm\" onClick={clearSelectedDropDownValues} />\n <Button label=\"Apply\" type=\"primary\" size=\"sm\" onClick={handleApplySelectedDropDownValues} />\n </div>\n </div>\n );\n };\n\n const renderDropdownSelect = () => {\n const borderColor = isDropDownOpen\n ? 'border-[var(--color-blue-500)]'\n : disabled\n ? 'border-[var(--color-gray-300)]'\n : 'border-[var(--color-gray-600)]';\n const errorBorderColor = hasError ? 'border-[var(--color-red-500)]' : '';\n const dropDownSelectClass = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 ${\n isBorderless ? 'border-0' : `border rounded-md ${errorBorderColor ? errorBorderColor : borderColor}`\n } flex items-center ${dropdownClassName}`;\n\n return (\n <div className={dropDownSelectClass}>\n <div\n className=\"flex-1 min-w-0\"\n data-automation-id={props?.dropDownSelectAutomationId || 'selected-dropdown-value'}\n >\n {optionChip(selectedDropDownValues[0], true)}\n </div>\n <div className=\"flex-shrink-0 ml-2\" aria-hidden=\"true\">\n <Icon\n name={'chevron'}\n rotation={isDropDownOpen ? '180' : '0'}\n className={`transition-transform`}\n stroke={iconColor}\n />\n </div>\n </div>\n );\n };\n\n const getDropdownAriaLabel = () => {\n return ariaLabel || `Select option`;\n };\n\n return (\n <div\n className={`se-design-dropdown-container${props?.className ? ` ${props?.className}` : ''}`}\n style={props?.style}\n >\n {props?.label && (\n <div className=\"se-design-dropdown-label mb-[3px] text-[var(--color-gray-700)] text-sm\">{props?.label}</div>\n )}\n <div\n style={props?.style}\n className={`${disabled ? 'bg-[var(--color-gray-50)] rounded-md cursor-not-allowed' : ''}`}\n >\n <Popover\n ref={popoverRef}\n renderPopoverContents={\n customDropdownContent\n ? customDropdownContent\n : isMultiSelect\n ? renderMultiSelectDropdownContents\n : renderDropdownContents\n }\n contentWidth={'full'}\n renderPopoverSrcElement={renderDropdownSelect}\n onPopoverToggle={(value) => setIsDropDownOpen(value)}\n disabled={disabled}\n automationId={props?.dropDownSrcAutomationId}\n popoverContentAutomationId={props?.dropDownContentAutomationId}\n ariaLabel={getDropdownAriaLabel()}\n sourceRole=\"combobox\"\n />\n </div>\n {hasError && <div className=\"text-[var(--color-red-500)] text-sm\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["React__default","useState","useRef","useEffect","Popover","Icon","Checkbox","Button","InputWithIcon","Dropdown","props","isDropDownOpen","setIsDropDownOpen","searchQuery","setSearchQuery","selectedDropDownValues","setSelectedDropDownValues","defaultSelectedValue","Array","isArray","popoverRef","selectBy","optionsUniqueBy","displaySelected","dropDownOptions","defaultText","iconColor","disabled","dropdownClassName","hasError","errorMessage","customDropdownContent","isBorderless","shouldShowSearch","searchPlaceholder","searchResultEmptyMessage","ariaLabel","newValues","isMultiSelect","type","getFilteredOptions","trim","filter","option","toString","toLowerCase","includes","handleDropDownOptionClick","dropDownOption","current","togglePopover","onOptionClick","getSelectedDropDownValue","clearSelectedDropDownValues","optionChip","srcOption","renderOptionChip","length","firstSelectedLabel","remainingCount","React","createElement","className","renderSearchBar","leftIcon","name","position","style","color","value","onChange","placeholder","margin","gap","inputStyle","width","border","outline","dropDownOptionJsx","index","optionTxt","dropDownSelectedValue","selectByUniqueId","isOptionSelected","key","crypto","randomUUID","onClick","onKeyDown","e","preventDefault","role","tabIndex","automationId","stroke","renderDropdownContents","filteredOptions","map","handleMultiSelectDropdownOptionClick","isSelected","newSelectedDropDownValues","handleApplySelectedDropDownValues","onApply","multiSelectDropdownOptionJSX","some","defaultChecked","label","renderMultiSelectDropdownContents","size","renderDropdownSelect","borderColor","errorBorderColor","dropDownSelectClass","dropDownSelectAutomationId","rotation","getDropdownAriaLabel","ref","renderPopoverContents","contentWidth","renderPopoverSrcElement","onPopoverToggle","dropDownSrcAutomationId","popoverContentAutomationId","dropDownContentAutomationId","sourceRole"],"mappings":"AA0CO,OAAAA,KAAA,YAAAC,GAAA,UAAAC,GAAA,aAAAC,SAAA;AAAA,SAAA,WAAAC,SAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,SAAA,YAAAC,SAAA;AAAA,SAAA,UAAAC,SAAA;AAAA,SAAA,iBAAAC,UAAA;AAAA,MAAMC,KAA+BC,CAAAA,MAAU;AACpD,QAAM,CAACC,GAAgBC,CAAiB,IAAIX,EAAS,EAAK,GACpD,CAACY,GAAaC,CAAc,IAAIb,EAAS,EAAE,GAC3C,CAACc,GAAwBC,CAAyB,IAAIf,EAA0B,MACpFS,GAAOO,uBACHC,MAAMC,QAAQT,GAAOO,oBAAoB,IACvCP,GAAOO,uBACP,CAACP,EAAMO,oBAAoB,IAC7B,EACN,GACMG,IAAalB,EAAuC,IAAI,GAExD;AAAA,IACJmB,UAAAA,IAAW;AAAA,IACXC,iBAAAA,IAAkB;AAAA,IAClBC,iBAAAA,IAAkB;AAAA,IAClBC,iBAAAA;AAAAA,IACAC,aAAAA,IAAc;AAAA,IACdC,WAAAA,IAAY;AAAA,IACZC,UAAAA,IAAW;AAAA,IACXC,mBAAAA,IAAoB;AAAA,IACpBC,UAAAA,IAAW;AAAA,IACXC,cAAAA,IAAe;AAAA,IACfC,uBAAAA,IAAwB;AAAA,IACxBC,cAAAA,IAAe;AAAA,IACfC,kBAAAA,IAAmB;AAAA,IACnBC,mBAAAA,IAAoB;AAAA,IACpBC,0BAAAA,IAA2B;AAAA,IAC3BC,WAAAA,I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