@schandlergarcia/sf-web-components 1.2.13 → 1.2.15
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/library/heroui/Popover.d.ts +3 -5
- package/dist/components/library/heroui/Popover.js +21 -21
- package/dist/components/library/heroui/Popover.js.map +1 -1
- package/package.json +1 -1
- package/scripts/reset-command-center.sh +9 -1
- package/scripts/validate-dashboard.sh +9 -1
- package/src/components/library/heroui/Popover.jsx +15 -5
|
@@ -32,14 +32,13 @@ export function Popover({ children, open, onOpenChange, ...props }: {
|
|
|
32
32
|
open: any;
|
|
33
33
|
onOpenChange: any;
|
|
34
34
|
}): import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
export function PopoverTrigger({ children, open, onOpenChange, ...props }: {
|
|
35
|
+
export function PopoverTrigger({ children, open, onOpenChange, asChild, ...props }: {
|
|
36
36
|
[x: string]: any;
|
|
37
37
|
children: any;
|
|
38
38
|
open: any;
|
|
39
39
|
onOpenChange: any;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, HTMLElement>;
|
|
40
|
+
asChild: any;
|
|
41
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
43
42
|
export function PopoverContent({ children, open, className, align, sideOffset, ...props }: {
|
|
44
43
|
[x: string]: any;
|
|
45
44
|
children: any;
|
|
@@ -48,4 +47,3 @@ export function PopoverContent({ children, open, className, align, sideOffset, .
|
|
|
48
47
|
align?: string | undefined;
|
|
49
48
|
sideOffset?: number | undefined;
|
|
50
49
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
51
|
-
import React from "react";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
const [
|
|
5
|
-
|
|
2
|
+
import a from "react";
|
|
3
|
+
function m({ children: e, open: t, onOpenChange: l, ...s }) {
|
|
4
|
+
const [n, r] = a.useState(!1), i = t !== void 0, d = i ? t : n, u = (o) => {
|
|
5
|
+
i || r(o), l?.(o);
|
|
6
6
|
};
|
|
7
|
-
return /* @__PURE__ */ c("div", { className: "relative inline-block", ...
|
|
7
|
+
return /* @__PURE__ */ c("div", { className: "relative inline-block", ...s, children: a.Children.map(e, (o) => a.isValidElement(o) ? a.cloneElement(o, { open: d, onOpenChange: u }) : o) });
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
...
|
|
13
|
-
onClick:
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
if (!
|
|
17
|
-
const
|
|
9
|
+
const b = m, C = ({ children: e, open: t, onOpenChange: l, asChild: s, ...n }) => {
|
|
10
|
+
const r = () => l?.(!t);
|
|
11
|
+
return s && a.isValidElement(e) ? a.cloneElement(e, {
|
|
12
|
+
...n,
|
|
13
|
+
onClick: r
|
|
14
|
+
}) : /* @__PURE__ */ c("button", { type: "button", onClick: r, ...n, children: e });
|
|
15
|
+
}, g = ({ children: e, open: t, className: l = "", align: s = "center", sideOffset: n = 4, ...r }) => {
|
|
16
|
+
if (!t) return null;
|
|
17
|
+
const i = {
|
|
18
18
|
start: "left-0",
|
|
19
19
|
center: "left-1/2 -translate-x-1/2",
|
|
20
20
|
end: "right-0"
|
|
@@ -22,16 +22,16 @@ const g = p, v = ({ children: n, open: e, onOpenChange: r, ...o }) => {
|
|
|
22
22
|
return /* @__PURE__ */ c(
|
|
23
23
|
"div",
|
|
24
24
|
{
|
|
25
|
-
className: `absolute z-50 mt-${
|
|
26
|
-
...
|
|
27
|
-
children:
|
|
25
|
+
className: `absolute z-50 mt-${n} w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-900 shadow-md dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 ${i[s] || i.center} ${l}`,
|
|
26
|
+
...r,
|
|
27
|
+
children: e
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
b as Popover,
|
|
33
|
+
g as PopoverContent,
|
|
34
|
+
C as PopoverTrigger,
|
|
35
|
+
m as default
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=Popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../../src/components/library/heroui/Popover.jsx"],"sourcesContent":["import React from \"react\";\n\n/**\n * HeroUI v3 Popover — simple popover for shadcn compatibility.\n * Using native HTML/CSS since HeroUI v3 doesn't have a Popover component.\n *\n * @example\n * import { Popover, PopoverTrigger, PopoverContent } from \"@/components/library\";\n * <Popover>\n * <PopoverTrigger>Open</PopoverTrigger>\n * <PopoverContent>Content</PopoverContent>\n * </Popover>\n */\nexport default function HeroUIPopover({ children, open, onOpenChange, ...props }) {\n const [isOpen, setIsOpen] = React.useState(false);\n const isControlled = open !== undefined;\n const actualOpen = isControlled ? open : isOpen;\n\n const handleOpenChange = (newOpen) => {\n if (!isControlled) setIsOpen(newOpen);\n onOpenChange?.(newOpen);\n };\n\n return (\n <div className=\"relative inline-block\" {...props}>\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, { open: actualOpen, onOpenChange: handleOpenChange });\n }\n return child;\n })}\n </div>\n );\n}\n\nexport const Popover = HeroUIPopover;\n\nexport const PopoverTrigger = ({ children, open, onOpenChange, ...props }) => {\n const handleClick = () => onOpenChange?.(!open);\n\n return React.cloneElement(children, {\n
|
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../../src/components/library/heroui/Popover.jsx"],"sourcesContent":["import React from \"react\";\n\n/**\n * HeroUI v3 Popover — simple popover for shadcn compatibility.\n * Using native HTML/CSS since HeroUI v3 doesn't have a Popover component.\n *\n * @example\n * import { Popover, PopoverTrigger, PopoverContent } from \"@/components/library\";\n * <Popover>\n * <PopoverTrigger>Open</PopoverTrigger>\n * <PopoverContent>Content</PopoverContent>\n * </Popover>\n */\nexport default function HeroUIPopover({ children, open, onOpenChange, ...props }) {\n const [isOpen, setIsOpen] = React.useState(false);\n const isControlled = open !== undefined;\n const actualOpen = isControlled ? open : isOpen;\n\n const handleOpenChange = (newOpen) => {\n if (!isControlled) setIsOpen(newOpen);\n onOpenChange?.(newOpen);\n };\n\n return (\n <div className=\"relative inline-block\" {...props}>\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, { open: actualOpen, onOpenChange: handleOpenChange });\n }\n return child;\n })}\n </div>\n );\n}\n\nexport const Popover = HeroUIPopover;\n\nexport const PopoverTrigger = ({ children, open, onOpenChange, asChild, ...props }) => {\n const handleClick = () => onOpenChange?.(!open);\n\n // If asChild is true, clone the child element with the props\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(children, {\n ...props,\n onClick: handleClick,\n });\n }\n\n // Otherwise, wrap in a button\n return (\n <button type=\"button\" onClick={handleClick} {...props}>\n {children}\n </button>\n );\n};\n\nexport const PopoverContent = ({ children, open, className = \"\", align = \"center\", sideOffset = 4, ...props }) => {\n if (!open) return null;\n\n const alignClasses = {\n start: \"left-0\",\n center: \"left-1/2 -translate-x-1/2\",\n end: \"right-0\"\n };\n\n return (\n <div\n className={`absolute z-50 mt-${sideOffset} w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-900 shadow-md dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50 ${alignClasses[align] || alignClasses.center} ${className}`}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":["HeroUIPopover","children","open","onOpenChange","props","isOpen","setIsOpen","React","isControlled","actualOpen","handleOpenChange","newOpen","jsx","child","Popover","PopoverTrigger","asChild","handleClick","PopoverContent","className","align","sideOffset","alignClasses"],"mappings":";;AAaA,SAAwBA,EAAc,EAAE,UAAAC,GAAU,MAAAC,GAAM,cAAAC,GAAc,GAAGC,KAAS;AAChF,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAM,SAAS,EAAK,GAC1CC,IAAeN,MAAS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euo pipefail
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
# When run from npm script, use the current working directory (the consuming project)
|
|
19
|
+
# When run directly from the package, navigate to parent
|
|
20
|
+
if [ -d "node_modules/@schandlergarcia/sf-web-components" ]; then
|
|
21
|
+
# Running from consuming project
|
|
22
|
+
ROOT="$PWD"
|
|
23
|
+
else
|
|
24
|
+
# Running from package itself
|
|
25
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
26
|
+
fi
|
|
19
27
|
cd "$ROOT"
|
|
20
28
|
|
|
21
29
|
echo ""
|
|
@@ -10,7 +10,15 @@
|
|
|
10
10
|
#
|
|
11
11
|
set -euo pipefail
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
# When run from npm script, use the current working directory (the consuming project)
|
|
14
|
+
# When run directly from the package, navigate to parent
|
|
15
|
+
if [ -d "node_modules/@schandlergarcia/sf-web-components" ]; then
|
|
16
|
+
# Running from consuming project
|
|
17
|
+
ROOT="$PWD"
|
|
18
|
+
else
|
|
19
|
+
# Running from package itself
|
|
20
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
21
|
+
fi
|
|
14
22
|
cd "$ROOT"
|
|
15
23
|
|
|
16
24
|
PAGES_DIR="src/components/pages"
|
|
@@ -35,13 +35,23 @@ export default function HeroUIPopover({ children, open, onOpenChange, ...props }
|
|
|
35
35
|
|
|
36
36
|
export const Popover = HeroUIPopover;
|
|
37
37
|
|
|
38
|
-
export const PopoverTrigger = ({ children, open, onOpenChange, ...props }) => {
|
|
38
|
+
export const PopoverTrigger = ({ children, open, onOpenChange, asChild, ...props }) => {
|
|
39
39
|
const handleClick = () => onOpenChange?.(!open);
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
// If asChild is true, clone the child element with the props
|
|
42
|
+
if (asChild && React.isValidElement(children)) {
|
|
43
|
+
return React.cloneElement(children, {
|
|
44
|
+
...props,
|
|
45
|
+
onClick: handleClick,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Otherwise, wrap in a button
|
|
50
|
+
return (
|
|
51
|
+
<button type="button" onClick={handleClick} {...props}>
|
|
52
|
+
{children}
|
|
53
|
+
</button>
|
|
54
|
+
);
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
export const PopoverContent = ({ children, open, className = "", align = "center", sideOffset = 4, ...props }) => {
|