stargazer-ui 1.0.3 → 1.0.5
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/BaseTypes.d.ts +4 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/Button.types.d.ts +7 -0
- package/dist/components/Button/Button.types.js +1 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +4 -0
- package/dist/components/Card/Card.d.ts +34 -0
- package/dist/components/Card/Card.js +18 -0
- package/dist/components/Card/Card.types.d.ts +24 -0
- package/dist/components/Card/Card.types.js +1 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Card/index.js +4 -0
- package/dist/{CloseButton/index.d.ts → components/CloseButton/CloseButton.d.ts} +1 -5
- package/dist/components/CloseButton/CloseButton.types.d.ts +5 -0
- package/dist/components/CloseButton/CloseButton.types.js +1 -0
- package/dist/components/CloseButton/index.d.ts +1 -0
- package/dist/components/CloseButton/index.js +4 -0
- package/dist/{Dropdown/index.d.ts → components/Dropdown/Dropdown.d.ts} +18 -55
- package/dist/{Dropdown/index.js → components/Dropdown/Dropdown.js} +31 -30
- package/dist/components/Dropdown/Dropdown.types.d.ts +55 -0
- package/dist/components/Dropdown/Dropdown.types.js +1 -0
- package/dist/components/Dropdown/index.d.ts +1 -0
- package/dist/components/Dropdown/index.js +4 -0
- package/dist/components/FloatingLabel/FloatingLabel.d.ts +4 -0
- package/dist/components/FloatingLabel/FloatingLabel.js +13 -0
- package/dist/components/FloatingLabel/FloatingLabel.types.d.ts +9 -0
- package/dist/components/FloatingLabel/FloatingLabel.types.js +1 -0
- package/dist/components/FloatingLabel/index.d.ts +1 -0
- package/dist/components/FloatingLabel/index.js +4 -0
- package/dist/components/Form/Form.d.ts +17 -0
- package/dist/{Form/index.js → components/Form/Form.js} +16 -15
- package/dist/components/Form/Form.types.d.ts +50 -0
- package/dist/components/Form/Form.types.js +1 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Form/index.js +4 -0
- package/dist/components/Grid/Grid.d.ts +5 -0
- package/dist/components/Grid/Grid.js +36 -0
- package/dist/components/Grid/index.d.ts +1 -0
- package/dist/components/Grid/index.js +4 -0
- package/dist/components/InputGroup/InputGroup.d.ts +6 -0
- package/dist/components/InputGroup/InputGroup.js +8 -0
- package/dist/components/InputGroup/InputGroup.types.d.ts +10 -0
- package/dist/components/InputGroup/InputGroup.types.js +1 -0
- package/dist/components/InputGroup/index.d.ts +1 -0
- package/dist/components/InputGroup/index.js +4 -0
- package/dist/components/Modal/Modal.d.ts +40 -0
- package/dist/components/Modal/Modal.js +100 -0
- package/dist/components/Modal/Modal.types.d.ts +40 -0
- package/dist/components/Modal/Modal.types.js +1 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Modal/index.js +4 -0
- package/dist/components/Nav/Nav.d.ts +30 -0
- package/dist/components/Nav/Nav.js +13 -0
- package/dist/components/Nav/Nav.types.d.ts +17 -0
- package/dist/components/Nav/Nav.types.js +1 -0
- package/dist/components/Nav/index.d.ts +1 -0
- package/dist/components/Nav/index.js +4 -0
- package/dist/components/NavBar/Navbar.d.ts +20 -0
- package/dist/components/NavBar/Navbar.js +17 -0
- package/dist/components/NavBar/Navbar.types.d.ts +18 -0
- package/dist/components/NavBar/Navbar.types.js +1 -0
- package/dist/components/NavBar/index.d.ts +1 -0
- package/dist/components/NavBar/index.js +4 -0
- package/dist/components/NavDropdown/NavDropdown.d.ts +35 -0
- package/dist/components/NavDropdown/NavDropdown.js +62 -0
- package/dist/components/NavDropdown/NavDropdown.types.d.ts +5 -0
- package/dist/components/NavDropdown/NavDropdown.types.js +1 -0
- package/dist/components/NavDropdown/index.d.ts +1 -0
- package/dist/components/NavDropdown/index.js +4 -0
- package/dist/components/OffCanvas/OffCanvas.d.ts +3 -0
- package/dist/components/OffCanvas/OffCanvas.js +2266 -0
- package/dist/components/OffCanvas/index.d.ts +1 -0
- package/dist/components/OffCanvas/index.js +4 -0
- package/dist/components/Overlay/Overlay.d.ts +3 -0
- package/dist/components/Overlay/index.d.ts +1 -0
- package/dist/components/Overlay/index.js +4 -0
- package/dist/components/Popout/Popout.d.ts +22 -0
- package/dist/components/Popout/Popout.js +72 -0
- package/dist/components/Popout/Popout.types.d.ts +36 -0
- package/dist/components/Popout/Popout.types.js +1 -0
- package/dist/components/Popout/index.d.ts +1 -0
- package/dist/components/Popout/index.js +4 -0
- package/dist/components/Spinner/Spinner.d.ts +4 -0
- package/dist/components/Spinner/Spinner.js +9 -0
- package/dist/components/Spinner/Spinner.types.d.ts +7 -0
- package/dist/components/Spinner/Spinner.types.js +1 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Table/Table.d.ts +4 -0
- package/dist/components/Table/Table.js +9 -0
- package/dist/components/Table/Table.types.d.ts +7 -0
- package/dist/components/Table/Table.types.js +1 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.js +4 -0
- package/dist/components/Tabs/Tabs.d.ts +9 -0
- package/dist/components/Tabs/Tabs.js +77 -0
- package/dist/components/Tabs/Tabs.types.d.ts +35 -0
- package/dist/components/Tabs/Tabs.types.js +1 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.js +4 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +9 -0
- package/dist/components/ToggleButton/ToggleButton.js +11 -0
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +0 -0
- package/dist/components/ToggleButton/ToggleButton.types.js +1 -0
- package/dist/components/ToggleButton/index.d.ts +1 -0
- package/dist/components/ToggleButton/index.js +4 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.js +19 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +19 -0
- package/dist/types.d.ts +2 -0
- package/package.json +18 -4
- package/dist/Button/index.d.ts +0 -9
- package/dist/Card/index.d.ts +0 -92
- package/dist/Card/index.js +0 -18
- package/dist/FloatingLabel/index.js +0 -13
- package/dist/Form/index.d.ts +0 -61
- package/dist/InputGroup/index.js +0 -7
- package/dist/Modal/index.js +0 -85
- package/dist/Nav/index.js +0 -14
- package/dist/NavBar/index.js +0 -16
- package/dist/NavDropdown/index.js +0 -850
- package/dist/Popout/index.js +0 -85
- package/dist/Tabs/index.js +0 -69
- package/dist/ToggleButton/index.js +0 -11
- package/dist/main.js +0 -30
- package/dist/stylesheets/stargazerui.css +0 -3759
- package/dist/stylesheets/stargazerui.css.map +0 -1
- /package/dist/{Button/index.js → components/Button/Button.js} +0 -0
- /package/dist/{CloseButton/index.js → components/CloseButton/CloseButton.js} +0 -0
- /package/dist/{Overlay/index.js → components/Overlay/Overlay.js} +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsxs as p, jsx as s, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as D, forwardRef as b, useContext as P, useState as $, useEffect as w, useRef as B } from "react";
|
|
3
|
+
import { createPortal as F } from "react-dom";
|
|
4
|
+
import K from "../CloseButton/CloseButton.js";
|
|
5
|
+
import L from "../Button/Button.js";
|
|
6
|
+
const g = D(null), N = ({ children: e, value: t }) => /* @__PURE__ */ s(g.Provider, { value: t, children: e }), S = () => {
|
|
7
|
+
const e = P(g);
|
|
8
|
+
if (!e)
|
|
9
|
+
throw new Error(
|
|
10
|
+
"useModalContext has to be used within ModalContextProvider!"
|
|
11
|
+
);
|
|
12
|
+
return e;
|
|
13
|
+
}, j = ({
|
|
14
|
+
children: e,
|
|
15
|
+
centered: t = !1,
|
|
16
|
+
size: n = "md",
|
|
17
|
+
show: o,
|
|
18
|
+
backdrop: l = "static",
|
|
19
|
+
onHide: a,
|
|
20
|
+
className: d,
|
|
21
|
+
id: i,
|
|
22
|
+
...m
|
|
23
|
+
}) => {
|
|
24
|
+
const [h, f] = $(o);
|
|
25
|
+
w(() => {
|
|
26
|
+
f(o);
|
|
27
|
+
}, [o]);
|
|
28
|
+
const r = B(null);
|
|
29
|
+
H(r);
|
|
30
|
+
let u = typeof o == "boolean" && typeof a == "function" ? void 0 : { show: typeof o == "boolean", onHide: typeof a == "function" };
|
|
31
|
+
u && console.error(
|
|
32
|
+
u.show ? null : "The variable 'show' must be used and must be a boolean used to decide when to show the modal!",
|
|
33
|
+
u.onHide ? null : "The variable 'onHide' must be used and must be a function which is used to set 'show' as the modal gets closed!"
|
|
34
|
+
);
|
|
35
|
+
const y = () => {
|
|
36
|
+
a && a(), f(!1);
|
|
37
|
+
};
|
|
38
|
+
w(() => {
|
|
39
|
+
const c = r.current;
|
|
40
|
+
c && (h ? (c.classList.remove("close"), c.showModal()) : c.close());
|
|
41
|
+
}, [h]);
|
|
42
|
+
let v = `sg-modal-tag sg-modal-${n}`;
|
|
43
|
+
d && (v += " " + d), (l === "static" || l === "true") && (v += " sg-modal-static");
|
|
44
|
+
const k = (c) => {
|
|
45
|
+
if (c.key != "Escape")
|
|
46
|
+
return;
|
|
47
|
+
c.preventDefault();
|
|
48
|
+
const C = r.current;
|
|
49
|
+
C.classList.add("close"), C.addEventListener("animationend", () => {
|
|
50
|
+
y();
|
|
51
|
+
}, { once: !0 });
|
|
52
|
+
};
|
|
53
|
+
return F(
|
|
54
|
+
/* @__PURE__ */ s("dialog", { ref: r, className: v, onKeyDown: (c) => k(c), ...m, children: /* @__PURE__ */ s(N, { value: a, children: u ? /* @__PURE__ */ s(q, { typeCheck: u, closeModal: y }) : e }) }),
|
|
55
|
+
document.body
|
|
56
|
+
);
|
|
57
|
+
}, x = b(({ children: e, as: t = "", className: n = "", closeButton: o = !1, onClick: l, ...a }, d) => {
|
|
58
|
+
let m = ["div", "span", "h1", "h2", "h3", "h4", "h5", "h6"].find((r) => r === t) ? t : "div";
|
|
59
|
+
const h = S(), f = (r) => {
|
|
60
|
+
l && l(r), h();
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ p(m, { ref: d, className: `sg-modal-header ${n}`, ...a, children: [
|
|
63
|
+
e,
|
|
64
|
+
o ? /* @__PURE__ */ s(K, { variant: !0, onClick: (r) => f(r) }) : null
|
|
65
|
+
] });
|
|
66
|
+
}), E = b(({ children: e, as: t = "h4", className: n, ...o }, l) => {
|
|
67
|
+
let d = ["div", "span", "h1", "h2", "h3", "h4", "h5", "h6"].find((i) => i === t) ? t : "h4";
|
|
68
|
+
return /* @__PURE__ */ s(d, { ref: l, className: `sg-modal-title ${n}`, ...o, children: e });
|
|
69
|
+
}), M = b(({ children: e, className: t, ...n }, o) => /* @__PURE__ */ s("div", { ref: o, className: `sg-modal-body ${t}`, ...n, children: e })), T = b(({ children: e, className: t, ...n }, o) => /* @__PURE__ */ s("div", { ref: o, className: `sg-modal-footer ${t}`, ...n, children: e })), Q = Object.assign(j, {
|
|
70
|
+
Header: x,
|
|
71
|
+
Title: E,
|
|
72
|
+
Body: M,
|
|
73
|
+
Footer: T
|
|
74
|
+
}), H = function(e) {
|
|
75
|
+
w(() => {
|
|
76
|
+
const t = (n) => {
|
|
77
|
+
const o = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])', l = e.current;
|
|
78
|
+
if (l) {
|
|
79
|
+
const a = l.querySelectorAll(o)[0], d = l.querySelectorAll(o), i = d[d.length - 1];
|
|
80
|
+
if (!(n.key === "Tab"))
|
|
81
|
+
return;
|
|
82
|
+
n.shiftKey ? document.activeElement === a && (i.focus(), n.preventDefault()) : document.activeElement === i && (a.focus(), n.preventDefault());
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return document.addEventListener("keydown", t, !0), function() {
|
|
86
|
+
document.removeEventListener("keydown", t, !0);
|
|
87
|
+
};
|
|
88
|
+
}, [e]);
|
|
89
|
+
}, q = ({ typeCheck: e, closeModal: t }) => /* @__PURE__ */ p(A, { children: [
|
|
90
|
+
/* @__PURE__ */ s(x, { closeButton: !0, children: /* @__PURE__ */ s(E, { children: "An Error ocurred!" }) }),
|
|
91
|
+
/* @__PURE__ */ s(M, { children: /* @__PURE__ */ p("p", { children: [
|
|
92
|
+
e.show ? null : "The variable 'show' must be used and must be a boolean used to decide when to show the modal!",
|
|
93
|
+
e.onHide ? null : "The variable 'onHide' must be used and must be a function which is used to set 'show' as the modal gets closed!"
|
|
94
|
+
] }) }),
|
|
95
|
+
/* @__PURE__ */ s(T, { children: /* @__PURE__ */ s(L, { variant: "danger", type: "button", onClick: () => t(), children: "Close" }) })
|
|
96
|
+
] });
|
|
97
|
+
export {
|
|
98
|
+
Q as default,
|
|
99
|
+
H as useKeepElementFocused
|
|
100
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseDialogType, BaseDivType, BaseHeadingType, BaseSpanType } from "../../BaseTypes";
|
|
3
|
+
export type ModalContextType = Function | null;
|
|
4
|
+
export type ModalType = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
centered?: boolean;
|
|
9
|
+
size?: string;
|
|
10
|
+
show: boolean;
|
|
11
|
+
backdrop?: string;
|
|
12
|
+
onHide: Function;
|
|
13
|
+
} & BaseDialogType;
|
|
14
|
+
export type ModalHeaderType = {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
as?: React.ElementType;
|
|
17
|
+
className?: string;
|
|
18
|
+
closeButton?: boolean;
|
|
19
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
20
|
+
} & (BaseDivType | BaseHeadingType | BaseSpanType);
|
|
21
|
+
export type ModalTitleType = {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
as?: React.ElementType;
|
|
24
|
+
className?: string;
|
|
25
|
+
} & (BaseDivType | BaseHeadingType | BaseSpanType);
|
|
26
|
+
export type ModalBodyType = {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
} & BaseDivType;
|
|
30
|
+
export type ModalFooterType = {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
} & BaseDivType;
|
|
34
|
+
export type ErrorModalType = {
|
|
35
|
+
typeCheck: {
|
|
36
|
+
show: boolean;
|
|
37
|
+
onHide: boolean;
|
|
38
|
+
};
|
|
39
|
+
closeModal: Function;
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Modal";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: React.ForwardRefExoticComponent<(Omit<{
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string | undefined;
|
|
5
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
6
|
+
} & React.ClassAttributes<HTMLUListElement> & React.HTMLAttributes<HTMLUListElement>, "ref"> | Omit<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
className?: string | undefined;
|
|
9
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
10
|
+
} & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<HTMLElement>> & {
|
|
11
|
+
Item: React.ForwardRefExoticComponent<(Omit<{
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
15
|
+
} & React.ClassAttributes<HTMLLIElement> & React.LiHTMLAttributes<HTMLLIElement>, "ref"> | Omit<{
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
className?: string | undefined;
|
|
18
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
19
|
+
} & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
20
|
+
Link: React.ForwardRefExoticComponent<(Omit<{
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
className?: string | undefined;
|
|
23
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
24
|
+
} & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
28
|
+
} & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
|
+
import { useNavbarContext as i } from "../NavBar/Navbar.js";
|
|
4
|
+
const v = m(({ children: o, className: n, as: t = "ul", ...e }, r) => {
|
|
5
|
+
const a = t, c = i();
|
|
6
|
+
return /* @__PURE__ */ s(a, { ref: r, className: `${n} ${c || "sg-navbar-"}nav`, ...e, children: o });
|
|
7
|
+
}), p = m(({ children: o, className: n, as: t = "li", ...e }, r) => /* @__PURE__ */ s(t, { role: "none", ref: r, className: `sg-nav-item${n ? " " + n : ""}`, ...e, children: o })), f = m(({ children: o, className: n, as: t = "a", ...e }, r) => /* @__PURE__ */ s(t, { role: "menuitem", ref: r, className: `sg-nav-link${n ? " " + n : ""}`, ...e, children: o })), x = Object.assign(v, {
|
|
8
|
+
Item: p,
|
|
9
|
+
Link: f
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
x as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseAnchorType, BaseElementType, BaseLItemType, BaseUListType } from "../../BaseTypes";
|
|
3
|
+
export type NavType = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
as?: React.ElementType;
|
|
7
|
+
} & (BaseUListType | BaseElementType);
|
|
8
|
+
export type NavItemType = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
} & (BaseLItemType | BaseElementType);
|
|
13
|
+
export type NavLinkType = {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
as?: React.ElementType;
|
|
17
|
+
} & (BaseAnchorType | BaseElementType);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Nav";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NavbarTextType, NavbarType } from "./Navbar.types";
|
|
3
|
+
export type NavbarContextType = string | null;
|
|
4
|
+
export declare const NavbarContext: React.Context<NavbarContextType>;
|
|
5
|
+
export declare const useNavbarContext: () => NavbarContextType;
|
|
6
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<NavbarType, "ref"> & React.RefAttributes<HTMLElement>> & {
|
|
7
|
+
Brand: React.ForwardRefExoticComponent<(Omit<{
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string | undefined;
|
|
10
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
11
|
+
href?: string | undefined;
|
|
12
|
+
} & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
16
|
+
href?: string | undefined;
|
|
17
|
+
} & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<HTMLAnchorElement | HTMLElement>>;
|
|
18
|
+
Text: React.ForwardRefExoticComponent<Omit<NavbarTextType, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as b, forwardRef as c, useMemo as x, useContext as C } from "react";
|
|
3
|
+
const v = b(null), m = ({ children: n, value: t }) => /* @__PURE__ */ a(v.Provider, { value: t, children: n }), N = () => C(v), p = c(({ children: n, className: t, navbarPrefix: o = "sg-navbar-", ...r }, e) => {
|
|
4
|
+
const s = x(() => o, [o]);
|
|
5
|
+
return /* @__PURE__ */ a("nav", { ref: e, className: `sg-navbar${t ? " " + t : ""}`, ...r, children: /* @__PURE__ */ a(m, { value: s, children: n }) });
|
|
6
|
+
}), d = c(({ children: n, className: t, href: o = "#", as: r = "a", ...e }, s) => {
|
|
7
|
+
const u = r || (o && r != "Link" ? "a" : "span");
|
|
8
|
+
return /* @__PURE__ */ a(u, { ref: s, href: o, className: `sg-navbar-brand${t ? " " + t : ""}`, ...e, children: n });
|
|
9
|
+
}), i = c(({ children: n, className: t, as: o = "span", ...r }, e) => /* @__PURE__ */ a(o, { ref: e, className: `sg-navbar-text${t ? " " + t : ""}`, ...r, children: n })), $ = Object.assign(p, {
|
|
10
|
+
Brand: d,
|
|
11
|
+
Text: i
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
v as NavbarContext,
|
|
15
|
+
$ as default,
|
|
16
|
+
N as useNavbarContext
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseAnchorType, BaseElementType, BaseNavType } from "../../BaseTypes";
|
|
3
|
+
export type NavbarType = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
navbarPrefix?: string;
|
|
7
|
+
} & BaseNavType;
|
|
8
|
+
export type NavbarBrandType = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
href?: string;
|
|
13
|
+
} & (BaseAnchorType | BaseElementType);
|
|
14
|
+
export type NavbarTextType = {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
as?: React.ElementType;
|
|
18
|
+
} & BaseElementType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Navbar";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NavDropdownType } from "./NavDropdown.types";
|
|
3
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<NavDropdownType, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
4
|
+
Toggle: import("react").ForwardRefExoticComponent<(Omit<{
|
|
5
|
+
children: import("react").ReactNode;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
navDropdown?: boolean | undefined;
|
|
8
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
9
|
+
variant?: string | undefined;
|
|
10
|
+
} & import("react").ClassAttributes<HTMLAnchorElement> & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
|
|
11
|
+
children: import("react").ReactNode;
|
|
12
|
+
className?: string | undefined;
|
|
13
|
+
navDropdown?: boolean | undefined;
|
|
14
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
15
|
+
variant?: string | undefined;
|
|
16
|
+
} & import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "ref"> | Omit<{
|
|
17
|
+
children: import("react").ReactNode;
|
|
18
|
+
className?: string | undefined;
|
|
19
|
+
navDropdown?: boolean | undefined;
|
|
20
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
21
|
+
variant?: string | undefined;
|
|
22
|
+
} & import("react").ClassAttributes<HTMLElement> & import("react").HTMLAttributes<HTMLElement>, "ref">) & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
23
|
+
Menu: import("react").ForwardRefExoticComponent<Omit<import("../Dropdown/Dropdown.types").DropdownMenuType, "ref"> & import("react").RefAttributes<HTMLUListElement>>;
|
|
24
|
+
Item: import("react").ForwardRefExoticComponent<(Omit<{
|
|
25
|
+
children: import("react").ReactNode;
|
|
26
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
27
|
+
className?: string | undefined;
|
|
28
|
+
} & import("react").ClassAttributes<HTMLAnchorElement> & import("react").AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
|
|
29
|
+
children: import("react").ReactNode;
|
|
30
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
31
|
+
className?: string | undefined;
|
|
32
|
+
} & import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "ref">) & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
33
|
+
Divider: import("react").ForwardRefExoticComponent<Omit<import("../Dropdown/Dropdown.types").DropdownDividerType, "ref"> & import("react").RefAttributes<HTMLHRElement>>;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as f, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N, useState as h, useCallback as O, useMemo as $ } from "react";
|
|
3
|
+
import d, { DropdownContextProvider as k } from "../Dropdown/Dropdown.js";
|
|
4
|
+
const A = (o, n, e = !1) => {
|
|
5
|
+
const r = e ? "top-end" : "top-start", s = e ? "top-start" : "top-end", c = e ? "bottom-end" : "bottom-start", l = e ? "bottom-start" : "bottom-end", u = e ? "right-start" : "left-start", a = e ? "right-end" : "left-end", p = e ? "left-start" : "right-start", m = e ? "left-end" : "right-end";
|
|
6
|
+
let t = o ? l : c;
|
|
7
|
+
return n === "up" ? t = o ? s : r : n === "end" ? t = o ? m : p : n === "start" ? t = o ? a : u : n === "down-centered" ? t = "bottom" : n === "up-centered" && (t = "top"), t;
|
|
8
|
+
}, V = N(({
|
|
9
|
+
children: o,
|
|
10
|
+
className: n,
|
|
11
|
+
onSelect: e,
|
|
12
|
+
onToggle: r,
|
|
13
|
+
controlId: s,
|
|
14
|
+
toggleProps: c,
|
|
15
|
+
title: l,
|
|
16
|
+
menuProps: u,
|
|
17
|
+
drop: a = "down",
|
|
18
|
+
align: p = "start",
|
|
19
|
+
autoClose: m = !0,
|
|
20
|
+
show: t = "default",
|
|
21
|
+
...S
|
|
22
|
+
}, D) => {
|
|
23
|
+
const [w, x] = h(t === "default" ? !1 : t), [i, g] = h({ case: "" }), v = O((j) => {
|
|
24
|
+
j.stopPropagation(), x((E) => !E);
|
|
25
|
+
}, []), b = A(p === "end", a), C = {
|
|
26
|
+
down: "dropdown",
|
|
27
|
+
"down-centered": "dropdown-center",
|
|
28
|
+
up: "dropup",
|
|
29
|
+
"up-centered": "dropup-center dropup",
|
|
30
|
+
end: "dropend",
|
|
31
|
+
start: "dropstart"
|
|
32
|
+
}, I = s, M = $(() => ({
|
|
33
|
+
align: p,
|
|
34
|
+
drop: a,
|
|
35
|
+
showInternal: t != "default" && r ? t : w,
|
|
36
|
+
handleToggle: t != "default" && r ? r : v,
|
|
37
|
+
placement: b,
|
|
38
|
+
directionClasses: {
|
|
39
|
+
down: "dropdown",
|
|
40
|
+
"down-centered": "dropdown-center",
|
|
41
|
+
up: "dropup",
|
|
42
|
+
"up-centered": "dropup-center dropup",
|
|
43
|
+
end: "dropend",
|
|
44
|
+
start: "dropstart"
|
|
45
|
+
},
|
|
46
|
+
controlId: I,
|
|
47
|
+
activeDescendant: i,
|
|
48
|
+
setActiveDescendant: g
|
|
49
|
+
}), [p, a, t, w, r, v, b, C, s, i, g]);
|
|
50
|
+
return /* @__PURE__ */ f("div", { ref: D, id: s + "-wrapper", className: `sg-dropdown${n ? " " + n : ""} sg-nav-item`, ...S, children: /* @__PURE__ */ P(k, { value: M, children: [
|
|
51
|
+
/* @__PURE__ */ f(d.Toggle, { navDropdown: !0, ...c, children: l }),
|
|
52
|
+
/* @__PURE__ */ f(d.Menu, { ...u, children: o })
|
|
53
|
+
] }) });
|
|
54
|
+
}), F = Object.assign(V, {
|
|
55
|
+
Toggle: d.Toggle,
|
|
56
|
+
Menu: d.Menu,
|
|
57
|
+
Item: d.Item,
|
|
58
|
+
Divider: d.Divider
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
F as default
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./NavDropdown";
|