stargazer-ui 1.0.1 → 1.0.3
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 +15 -0
- package/dist/BaseTypes.js +1 -0
- package/dist/Button/index.d.ts +9 -0
- package/dist/Button/index.js +6 -0
- package/dist/Card/index.d.ts +92 -0
- package/dist/Card/index.js +18 -0
- package/dist/CloseButton/index.d.ts +8 -0
- package/dist/CloseButton/index.js +6 -0
- package/dist/Dropdown/index.d.ts +108 -0
- package/dist/Dropdown/index.js +204 -0
- package/dist/FloatingLabel/index.js +13 -0
- package/dist/Form/index.d.ts +61 -0
- package/dist/Form/index.js +62 -0
- package/dist/InputGroup/index.js +7 -0
- package/dist/Modal/index.js +85 -0
- package/dist/Nav/index.js +14 -0
- package/dist/NavBar/index.js +16 -0
- package/dist/NavDropdown/index.js +850 -0
- package/dist/Overlay/index.js +125 -0
- package/dist/Popout/index.js +85 -0
- package/dist/Tabs/index.js +69 -0
- package/dist/ToggleButton/index.js +11 -0
- package/dist/main.js +30 -0
- package/dist/stylesheets/stargazerui.css +113 -62
- package/dist/stylesheets/stargazerui.css.map +1 -1
- package/dist/vite-env.d.js +1 -0
- package/package.json +22 -12
- package/dist/ui.es.js +0 -1983
- package/dist/ui.umd.js +0 -33
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as s, jsxs as w, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as T, forwardRef as m, useState as M, useEffect as C, useRef as A, useContext as B } from "react";
|
|
3
|
+
import { createPortal as F } from "react-dom";
|
|
4
|
+
import k from "../CloseButton/index.js";
|
|
5
|
+
import P from "../Button/index.js";
|
|
6
|
+
const g = T(!1), H = ({ children: t, value: n }) => /* @__PURE__ */ s(g.Provider, { value: n, children: t }), N = () => B(g), d = m(({
|
|
7
|
+
children: t,
|
|
8
|
+
centered: n = !1,
|
|
9
|
+
size: e = "md",
|
|
10
|
+
show: o,
|
|
11
|
+
backdrop: l = "static",
|
|
12
|
+
onHide: a = "none",
|
|
13
|
+
className: r,
|
|
14
|
+
id: i,
|
|
15
|
+
...h
|
|
16
|
+
}, b) => {
|
|
17
|
+
const [f, c] = M(!1);
|
|
18
|
+
C(() => {
|
|
19
|
+
c(o);
|
|
20
|
+
}, [o]);
|
|
21
|
+
const p = A(null);
|
|
22
|
+
j(p);
|
|
23
|
+
let u = typeof o == "boolean" && typeof a == "function" ? void 0 : { show: typeof o == "boolean", onHide: typeof a == "function" };
|
|
24
|
+
u && console.error(
|
|
25
|
+
u.show ? null : "The variable 'show' must be used and must be a boolean used to decide when to show the modal!",
|
|
26
|
+
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!"
|
|
27
|
+
);
|
|
28
|
+
const x = () => {
|
|
29
|
+
a && a(), c(!1);
|
|
30
|
+
};
|
|
31
|
+
C(() => {
|
|
32
|
+
const y = p.current;
|
|
33
|
+
y && (f ? y.showModal() : y.close());
|
|
34
|
+
}, [f]);
|
|
35
|
+
let v = `sg-modal-tag sg-modal-${e}`;
|
|
36
|
+
return r && (v += " " + r), (l === "static" || l === "true") && (v += " sg-modal-static"), f ? F(
|
|
37
|
+
/* @__PURE__ */ s("dialog", { ref: p, className: v, children: /* @__PURE__ */ s(H, { value: a, children: u ? /* @__PURE__ */ w(E, { children: [
|
|
38
|
+
/* @__PURE__ */ s(d.Header, { closeButton: !0, children: /* @__PURE__ */ s(d.Title, { children: "An Error ocurred!" }) }),
|
|
39
|
+
/* @__PURE__ */ s(d.Body, { children: /* @__PURE__ */ w("p", { children: [
|
|
40
|
+
u.show ? null : "The variable 'show' must be used and must be a boolean used to decide when to show the modal!",
|
|
41
|
+
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!"
|
|
42
|
+
] }) }),
|
|
43
|
+
/* @__PURE__ */ s(d.Footer, { children: /* @__PURE__ */ s(P, { variant: "danger", type: "button", onClick: x, children: "Close" }) })
|
|
44
|
+
] }) : t }) }),
|
|
45
|
+
document.body
|
|
46
|
+
) : null;
|
|
47
|
+
}), $ = m(({ as: t = "", className: n = "", children: e, closeButton: o = !1, onClick: l = "none", ...a }, r) => {
|
|
48
|
+
let h = ["div", "span", "h1", "h2", "h3", "h4", "h5", "h6"].find((c) => c === t) ? t : "div";
|
|
49
|
+
const b = N(), f = (c) => {
|
|
50
|
+
l != "none" && l(c), b != "none" && b();
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ w(h, { ref: r, className: `sg-modal-header ${n}`, ...a, children: [
|
|
53
|
+
e,
|
|
54
|
+
o ? /* @__PURE__ */ s(k, { variant: !0, onClick: f }) : null
|
|
55
|
+
] });
|
|
56
|
+
});
|
|
57
|
+
d.Header = $;
|
|
58
|
+
const S = ({ children: t, as: n = "h4", className: e, ...o }, l) => {
|
|
59
|
+
let r = ["div", "span", "h1", "h2", "h3", "h4", "h5", "h6"].find((i) => i === n) ? n : "h4";
|
|
60
|
+
return /* @__PURE__ */ s(r, { ref: l, className: `sg-modal-title ${e}`, ...o, children: t });
|
|
61
|
+
};
|
|
62
|
+
d.Title = m(S);
|
|
63
|
+
const D = ({ children: t, className: n, ...e }, o) => /* @__PURE__ */ s("div", { ref: o, className: `sg-modal-body ${n}`, ...e, children: t });
|
|
64
|
+
d.Body = m(D);
|
|
65
|
+
const K = ({ children: t, className: n, ...e }, o) => /* @__PURE__ */ s("div", { ref: o, className: `sg-modal-footer ${n}`, ...e, children: t });
|
|
66
|
+
d.Footer = m(K);
|
|
67
|
+
const j = function(t) {
|
|
68
|
+
C(() => {
|
|
69
|
+
const n = (e) => {
|
|
70
|
+
const o = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])', l = t.current;
|
|
71
|
+
if (l) {
|
|
72
|
+
const a = l.querySelectorAll(o)[0], r = l.querySelectorAll(o), i = r[r.length - 1];
|
|
73
|
+
if (!(e.key === "Tab" || e.keyCode === 9))
|
|
74
|
+
return;
|
|
75
|
+
e.shiftKey ? document.activeElement === a && (i.focus(), e.preventDefault()) : document.activeElement === i && (a.focus(), e.preventDefault());
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return document.addEventListener("keydown", n, !0), function() {
|
|
79
|
+
document.removeEventListener("keydown", n, !0);
|
|
80
|
+
};
|
|
81
|
+
}, [t]);
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
d as default
|
|
85
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
import { navbarContext as u } from "../NavBar/index.js";
|
|
4
|
+
const l = s(({ children: o, className: n, fill: e, justify: r, as: t = "ul", ...m }, f) => {
|
|
5
|
+
const p = t;
|
|
6
|
+
let i = "";
|
|
7
|
+
return u && (i = "sg-navbar-"), /* @__PURE__ */ a(p, { role: "menubar", ref: f, className: `${n} ${i}nav`, ...m, children: o });
|
|
8
|
+
}), c = ({ children: o, className: n, as: e = "li", ...r }, t) => /* @__PURE__ */ a(e, { role: "none", ref: t, className: `sg-nav-item${n ? " " + n : ""}`, ...r, children: o });
|
|
9
|
+
l.Item = s(c);
|
|
10
|
+
const v = ({ children: o, className: n, as: e = "a", ...r }, t) => /* @__PURE__ */ a(e, { role: "menuitem", ref: t, className: `sg-nav-link${n ? " " + n : ""}`, ...r, children: o });
|
|
11
|
+
l.Link = s(v);
|
|
12
|
+
export {
|
|
13
|
+
l as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as b, forwardRef as v, useMemo as d } from "react";
|
|
3
|
+
const m = b(null), p = ({ children: t, value: n }) => /* @__PURE__ */ e(m.Provider, { value: n, children: t }), c = v(({ children: t, className: n, navbarPrefix: r = "sg-navbar-", ...o }, a) => {
|
|
4
|
+
const s = d(() => r, [r]);
|
|
5
|
+
return /* @__PURE__ */ e("nav", { ref: a, className: `sg-navbar${n ? " " + n : ""}`, ...o, children: /* @__PURE__ */ e(p, { value: s, children: t }) });
|
|
6
|
+
}), x = ({ children: t, className: n, href: r = "#", as: o = "a", ...a }, s) => {
|
|
7
|
+
const u = o || (r && o != "Link" ? "a" : "span");
|
|
8
|
+
return /* @__PURE__ */ e(u, { ref: s, href: r, className: `sg-navbar-brand${n ? " " + n : ""}`, ...a, children: t });
|
|
9
|
+
};
|
|
10
|
+
c.Brand = v(x);
|
|
11
|
+
const C = ({ children: t, className: n, as: r = "span", ...o }, a) => /* @__PURE__ */ e(r, { ref: a, className: `sg-navbar-text${n ? " " + n : ""}`, ...o, children: t });
|
|
12
|
+
c.Text = v(C);
|
|
13
|
+
export {
|
|
14
|
+
c as default,
|
|
15
|
+
m as navbarContext
|
|
16
|
+
};
|