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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as v } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as D, forwardRef as E, useState as y, useMemo as $, useEffect as C, useLayoutEffect as A, useContext as P } from "react";
|
|
3
3
|
const L = (d, o, r = !1) => {
|
|
4
|
-
const u = r ? "top-end" : "top-start", m = r ? "top-start" : "top-end", i = r ? "bottom-end" : "bottom-start", h = r ? "bottom-start" : "bottom-end", g = r ? "right-start" : "left-start",
|
|
4
|
+
const u = r ? "top-end" : "top-start", m = r ? "top-start" : "top-end", i = r ? "bottom-end" : "bottom-start", h = r ? "bottom-start" : "bottom-end", g = r ? "right-start" : "left-start", c = r ? "right-end" : "left-end", w = r ? "left-start" : "right-start", l = r ? "left-end" : "right-end";
|
|
5
5
|
let n = d ? h : i;
|
|
6
|
-
return o === "up" ? n = d ? m : u : o === "end" ? n = d ? l : w : o === "start" ? n = d ?
|
|
6
|
+
return o === "up" ? n = d ? m : u : o === "end" ? n = d ? l : w : o === "start" ? n = d ? c : g : o === "down-centered" ? n = "bottom" : o === "up-centered" && (n = "top"), n;
|
|
7
7
|
}, k = (d, o = "") => {
|
|
8
8
|
let r = d.target, u = !0, m = !1;
|
|
9
9
|
for (; u; )
|
|
@@ -25,16 +25,16 @@ const L = (d, o, r = !1) => {
|
|
|
25
25
|
drop: i = "down",
|
|
26
26
|
align: h = "start",
|
|
27
27
|
autoClose: g = !0,
|
|
28
|
-
show:
|
|
28
|
+
show: c = "default",
|
|
29
29
|
...w
|
|
30
30
|
}, l) => {
|
|
31
|
-
const [n, e] = y(
|
|
31
|
+
const [n, e] = y(c === "default" ? !1 : c), [f, b] = y({ case: "" }), a = (B) => {
|
|
32
32
|
B.stopPropagation(), e((S) => !S);
|
|
33
33
|
}, s = L(h === "end", i), p = $(() => ({
|
|
34
34
|
align: h,
|
|
35
35
|
drop: i,
|
|
36
|
-
showInternal:
|
|
37
|
-
handleToggle:
|
|
36
|
+
showInternal: c != "default" && u ? c : n,
|
|
37
|
+
handleToggle: c != "default" && u ? u : a,
|
|
38
38
|
placement: s,
|
|
39
39
|
directionClasses: {
|
|
40
40
|
down: "dropdown",
|
|
@@ -47,17 +47,17 @@ const L = (d, o, r = !1) => {
|
|
|
47
47
|
controlId: m,
|
|
48
48
|
activeDescendant: f,
|
|
49
49
|
setActiveDescendant: b
|
|
50
|
-
}), [h, i,
|
|
50
|
+
}), [h, i, c, n, u, s, m, f, b]);
|
|
51
51
|
return /* @__PURE__ */ v("div", { id: m + "-wrapper", ref: l, className: `sg-dropdown${o ? " " + o : ""}`, ...w, children: /* @__PURE__ */ v(M, { value: p, children: d }) });
|
|
52
52
|
}), q = E(({ children: d, className: o, navDropdown: r = !1, as: u = "button", variant: m = "primary", ...i }, h) => {
|
|
53
|
-
const { controlId: g, handleToggle:
|
|
53
|
+
const { controlId: g, handleToggle: c, setActiveDescendant: w, showInternal: l } = x(), n = u, e = (t) => {
|
|
54
54
|
let s = !1;
|
|
55
55
|
switch (console.log(t.key), t.key) {
|
|
56
56
|
case "ArrowDown":
|
|
57
|
-
s = !0, l ? w((p) => ({ ...p, case: "next" })) : (
|
|
57
|
+
s = !0, l ? w((p) => ({ ...p, case: "next" })) : (c(t), w((p) => ({ ...p, case: "first" })));
|
|
58
58
|
break;
|
|
59
59
|
case "ArrowUp":
|
|
60
|
-
s = !0, l ? w((p) => ({ ...p, case: "previous" })) : (
|
|
60
|
+
s = !0, l ? w((p) => ({ ...p, case: "previous" })) : (c(t), w((p) => ({ ...p, case: "last" })));
|
|
61
61
|
break;
|
|
62
62
|
case "Home":
|
|
63
63
|
s = !0, l && w((p) => ({ ...p, case: "first" }));
|
|
@@ -66,15 +66,15 @@ const L = (d, o, r = !1) => {
|
|
|
66
66
|
s = !0, l && w((p) => ({ ...p, case: "last" }));
|
|
67
67
|
break;
|
|
68
68
|
case "Tab":
|
|
69
|
-
l &&
|
|
69
|
+
l && c(t);
|
|
70
70
|
break;
|
|
71
71
|
case "Escape":
|
|
72
|
-
s = !0, l &&
|
|
72
|
+
s = !0, l && c(t);
|
|
73
73
|
break;
|
|
74
74
|
case "Enter":
|
|
75
75
|
case " ":
|
|
76
76
|
if (l) {
|
|
77
|
-
s = !0, document.querySelector(".sg-dropdown-item-visual-focus").click(),
|
|
77
|
+
s = !0, document.querySelector(".sg-dropdown-item-visual-focus").click(), c(t);
|
|
78
78
|
break;
|
|
79
79
|
} else {
|
|
80
80
|
w((p) => ({ ...p, case: "first" }));
|
|
@@ -85,9 +85,9 @@ const L = (d, o, r = !1) => {
|
|
|
85
85
|
}, f = (t) => {
|
|
86
86
|
if (l && t.target.id !== g) {
|
|
87
87
|
if (!k(t, g))
|
|
88
|
-
|
|
88
|
+
c(t);
|
|
89
89
|
else if (k(t, g)) {
|
|
90
|
-
|
|
90
|
+
c(t);
|
|
91
91
|
const s = document.getElementById(g);
|
|
92
92
|
s == null || s.focus();
|
|
93
93
|
}
|
|
@@ -100,10 +100,10 @@ const L = (d, o, r = !1) => {
|
|
|
100
100
|
};
|
|
101
101
|
}, [e, g]);
|
|
102
102
|
const b = (t) => {
|
|
103
|
-
|
|
103
|
+
c(t), l || w((s) => ({ ...s, case: "first" }));
|
|
104
104
|
};
|
|
105
|
-
let
|
|
106
|
-
return (n === "a" || r) && (
|
|
105
|
+
let a = `sg-button sg-button${m ? "-" + m : "-primary"} sg-dropdown-toggle${o ? " " + o : ""}`;
|
|
106
|
+
return (n === "a" || r) && (a = `sg-nav-dropdown-toggle sg-dropdown-toggle${o ? " " + o : ""}`), /* @__PURE__ */ v(
|
|
107
107
|
n,
|
|
108
108
|
{
|
|
109
109
|
tabIndex: "0",
|
|
@@ -113,14 +113,14 @@ const L = (d, o, r = !1) => {
|
|
|
113
113
|
"aria-expanded": l,
|
|
114
114
|
id: g,
|
|
115
115
|
ref: h,
|
|
116
|
-
className:
|
|
116
|
+
className: a,
|
|
117
117
|
onClick: (t) => b(t),
|
|
118
118
|
...i,
|
|
119
119
|
children: d
|
|
120
120
|
}
|
|
121
121
|
);
|
|
122
122
|
}), j = E(({ children: d, className: o, style: r = {}, ...u }, m) => {
|
|
123
|
-
const { controlId: i, showInternal: h, activeDescendant: g } = x(), [
|
|
123
|
+
const { controlId: i, showInternal: h, activeDescendant: g } = x(), [c, w] = y(r);
|
|
124
124
|
A(() => {
|
|
125
125
|
if (h) {
|
|
126
126
|
const n = document.getElementById(i + "-menu");
|
|
@@ -130,39 +130,39 @@ const L = (d, o, r = !1) => {
|
|
|
130
130
|
}, [h]), C(() => {
|
|
131
131
|
if (h) {
|
|
132
132
|
const n = document.getElementById(i + "-menu"), e = document.getElementById(i + "-menu").children, f = e.length - 1, b = document.querySelector(".sg-dropdown-item-visual-focus");
|
|
133
|
-
let
|
|
133
|
+
let a = 0, t = e[0].children[0];
|
|
134
134
|
if (b != null) {
|
|
135
135
|
b.classList.remove("sg-dropdown-item-visual-focus");
|
|
136
136
|
for (let s = 0; s < e.length; s++)
|
|
137
137
|
if (e[s] === b.parentElement) {
|
|
138
|
-
|
|
138
|
+
a = s;
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
switch (g.case) {
|
|
143
143
|
case "first":
|
|
144
|
-
t = e[0].children[0],
|
|
144
|
+
t = e[0].children[0], a = 0;
|
|
145
145
|
break;
|
|
146
146
|
case "last":
|
|
147
|
-
t = e[f].children[0],
|
|
147
|
+
t = e[f].children[0], a = f;
|
|
148
148
|
break;
|
|
149
149
|
case "next":
|
|
150
|
-
|
|
150
|
+
a = a === f ? 0 : a + 1, t = e[a].children[0];
|
|
151
151
|
break;
|
|
152
152
|
case "previous":
|
|
153
|
-
|
|
153
|
+
a = a === 0 ? f : a - 1, t = e[a].children[0];
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
|
-
n.setAttribute("aria-activedescendant", t.id), e[
|
|
156
|
+
n.setAttribute("aria-activedescendant", t.id), e[a].children[0].classList.add("sg-dropdown-item-visual-focus");
|
|
157
157
|
} else
|
|
158
158
|
document.getElementById(i + "-menu").setAttribute("aria-activedescendant", "");
|
|
159
159
|
}, [i, h, g]);
|
|
160
160
|
const l = (n) => {
|
|
161
|
-
var
|
|
161
|
+
var a;
|
|
162
162
|
const e = n.target;
|
|
163
163
|
let f = e.classList.contains("sg-dropdown-item-visual-focus");
|
|
164
164
|
const b = document.getElementById(i + "-menu");
|
|
165
|
-
f || ((
|
|
165
|
+
f || ((a = document.querySelector(".sg-dropdown-item-visual-focus")) == null || a.classList.remove("sg-dropdown-item-visual-focus"), b.setAttribute("aria-activedescendant", ""), e.classList.add("sg-dropdown-item-visual-focus"), b.setAttribute("aria-activedescendant", e.id));
|
|
166
166
|
};
|
|
167
167
|
return C(() => {
|
|
168
168
|
const n = document.getElementById(i + "-menu");
|
|
@@ -181,7 +181,7 @@ const L = (d, o, r = !1) => {
|
|
|
181
181
|
"aria-labelledby": i,
|
|
182
182
|
ref: m,
|
|
183
183
|
className: `sg-dropdown-list${o ? " " + o : ""}${h ? " show" : ""}`,
|
|
184
|
-
style:
|
|
184
|
+
style: c,
|
|
185
185
|
...u,
|
|
186
186
|
children: d
|
|
187
187
|
}
|
|
@@ -196,6 +196,7 @@ const L = (d, o, r = !1) => {
|
|
|
196
196
|
export {
|
|
197
197
|
V as Divider,
|
|
198
198
|
I as DropdownContext,
|
|
199
|
+
M as DropdownContextProvider,
|
|
199
200
|
H as Item,
|
|
200
201
|
j as Menu,
|
|
201
202
|
q as Toggle,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseDivType, BaseAnchorType, BaseButtonType, BaseUListType, BaseHrType, BaseElementType } from "../../BaseTypes";
|
|
3
|
+
export type DropdownContextType = {
|
|
4
|
+
align: string;
|
|
5
|
+
drop: string;
|
|
6
|
+
showInternal: boolean;
|
|
7
|
+
handleToggle: Function;
|
|
8
|
+
placement: string;
|
|
9
|
+
directionClasses?: {
|
|
10
|
+
down?: string;
|
|
11
|
+
'down-centered'?: string;
|
|
12
|
+
up?: string;
|
|
13
|
+
'up-centered'?: string;
|
|
14
|
+
end?: string;
|
|
15
|
+
start?: string;
|
|
16
|
+
};
|
|
17
|
+
controlId: string;
|
|
18
|
+
activeDescendant: {
|
|
19
|
+
case: string;
|
|
20
|
+
};
|
|
21
|
+
setActiveDescendant: React.Dispatch<React.SetStateAction<{
|
|
22
|
+
case: string;
|
|
23
|
+
}>>;
|
|
24
|
+
};
|
|
25
|
+
export type DropdownType = {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
onSelect?: Function;
|
|
29
|
+
onToggle?: Function;
|
|
30
|
+
controlId: string;
|
|
31
|
+
drop?: string;
|
|
32
|
+
align?: string;
|
|
33
|
+
autoClose?: boolean;
|
|
34
|
+
show?: boolean;
|
|
35
|
+
} & BaseDivType;
|
|
36
|
+
export type DropdownToggleType = {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
navDropdown?: boolean;
|
|
40
|
+
as?: React.ElementType;
|
|
41
|
+
variant?: string;
|
|
42
|
+
} & (BaseAnchorType | BaseButtonType | BaseElementType);
|
|
43
|
+
export type DropdownMenuType = {
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
className?: string;
|
|
46
|
+
style?: React.CSSProperties | undefined;
|
|
47
|
+
} & BaseUListType;
|
|
48
|
+
export type DropdownItemType = {
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
as?: React.ElementType;
|
|
51
|
+
className?: string;
|
|
52
|
+
} & (BaseAnchorType | BaseButtonType);
|
|
53
|
+
export type DropdownDividerType = {
|
|
54
|
+
className?: string;
|
|
55
|
+
} & BaseHrType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Dropdown";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FloatingLabelType } from "./FloatingLabel.types";
|
|
3
|
+
declare const FloatingLabel: import("react").ForwardRefExoticComponent<Omit<FloatingLabelType, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
4
|
+
export default FloatingLabel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i, useMemo as f } from "react";
|
|
3
|
+
import { FormContextProvider as n } from "../Form/Form.js";
|
|
4
|
+
const x = i(({ children: o, label: a, controlId: r, className: c, htmlFor: d, ...l }, t) => {
|
|
5
|
+
const m = f(() => ({ controlId: r }), [r]);
|
|
6
|
+
return /* @__PURE__ */ e(n, { value: m, children: /* @__PURE__ */ s("div", { className: "sg-form-floating", children: [
|
|
7
|
+
o,
|
|
8
|
+
/* @__PURE__ */ e("label", { ref: t, htmlFor: r, className: "sg-form-floating-label", ...l, children: a })
|
|
9
|
+
] }) });
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
x as default
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./FloatingLabel";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormCheckType, FormContextType, FormControlType, FormGroupType, FormLabelType, FormSelectType, FormTextType, FormType } from "./Form.types";
|
|
3
|
+
export declare const FormContext: React.Context<FormContextType | null>;
|
|
4
|
+
export declare const FormContextProvider: ({ children, value }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
value: FormContextType;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const useFormContext: () => FormContextType;
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<FormType, "ref"> & React.RefAttributes<HTMLFormElement>> & {
|
|
10
|
+
Control: React.ForwardRefExoticComponent<Omit<FormControlType, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
11
|
+
Select: React.ForwardRefExoticComponent<Omit<FormSelectType, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
12
|
+
Group: React.ForwardRefExoticComponent<Omit<FormGroupType, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
Label: React.ForwardRefExoticComponent<Omit<FormLabelType, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
14
|
+
Check: React.ForwardRefExoticComponent<Omit<FormCheckType, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
15
|
+
Text: React.ForwardRefExoticComponent<Omit<FormTextType, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as C, Fragment as k } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as b, forwardRef as l, useMemo as j, useContext as I } from "react";
|
|
3
3
|
const w = b(null), H = ({ children: e, value: t }) => /* @__PURE__ */ n(w.Provider, { value: t, children: e }), g = () => {
|
|
4
4
|
const e = I(w);
|
|
@@ -7,11 +7,11 @@ const w = b(null), H = ({ children: e, value: t }) => /* @__PURE__ */ n(w.Provid
|
|
|
7
7
|
"useFormContext has to be used within a FormContextProvider!"
|
|
8
8
|
);
|
|
9
9
|
return e;
|
|
10
|
-
}, P = l(({ children: e, ...t }, o) => /* @__PURE__ */ n("form", { ref: o, ...t, children: e })), y = l(({ as: e = "input", className: t = "", plaintext: o = !1, id: c = "", type: r = "text", autoFocus: s = !1, ...m },
|
|
10
|
+
}, P = l(({ children: e, ...t }, o) => /* @__PURE__ */ n("form", { ref: o, ...t, children: e })), y = l(({ as: e = "input", className: t = "", plaintext: o = !1, id: c = "", type: r = "text", autoFocus: s = !1, ...m }, d) => {
|
|
11
11
|
let i = e;
|
|
12
|
-
const { controlId:
|
|
13
|
-
let x =
|
|
14
|
-
return /* @__PURE__ */ n(i, { autoFocus: s, ref:
|
|
12
|
+
const { controlId: u } = g();
|
|
13
|
+
let x = u || c, f = (o ? "sg-form-control-plaintext" : "sg-form-control") + (t != "" ? " " + t : "") + (r == "color" ? " sg-form-control-color" : "");
|
|
14
|
+
return /* @__PURE__ */ n(i, { autoFocus: s, ref: d, id: x, type: r, className: f, ...m });
|
|
15
15
|
}), E = l(({ children: e, className: t, id: o, ...c }, r) => {
|
|
16
16
|
const { controlId: s } = g();
|
|
17
17
|
let m = s || o;
|
|
@@ -30,22 +30,22 @@ const w = b(null), H = ({ children: e, value: t }) => /* @__PURE__ */ n(w.Provid
|
|
|
30
30
|
classNameLabel: r,
|
|
31
31
|
labelRef: s,
|
|
32
32
|
label: m,
|
|
33
|
-
labelId:
|
|
33
|
+
labelId: d,
|
|
34
34
|
className: i,
|
|
35
|
-
type:
|
|
35
|
+
type: u,
|
|
36
36
|
id: x,
|
|
37
37
|
controlId: f,
|
|
38
38
|
reverse: p = !1,
|
|
39
39
|
checkStyle: v,
|
|
40
40
|
...a
|
|
41
|
-
},
|
|
42
|
-
let h = f || x,
|
|
43
|
-
return /* @__PURE__ */ n("div", { ref: t, id: o, style: c, className: `sg-form-check${p ? "-reverse" : ""}${e ? " " + e : ""}${
|
|
44
|
-
/* @__PURE__ */ n("input", { ref:
|
|
45
|
-
/* @__PURE__ */ n("label", { ref: s, id:
|
|
46
|
-
] }) : /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */ n("label", { ref: s, id:
|
|
48
|
-
/* @__PURE__ */ n("input", { ref:
|
|
41
|
+
}, F) => {
|
|
42
|
+
let h = f || x, $ = u === "switch" ? "checkbox" : u;
|
|
43
|
+
return /* @__PURE__ */ n("div", { ref: t, id: o, style: c, className: `sg-form-check${p ? "-reverse" : ""}${e ? " " + e : ""}${u === "switch" ? " sg-form-switch" : ""}`, children: p ? /* @__PURE__ */ C(k, { children: [
|
|
44
|
+
/* @__PURE__ */ n("input", { ref: F, type: $, id: h, className: `sg-form-check-input${i ? " " + i : ""}`, ...a }),
|
|
45
|
+
/* @__PURE__ */ n("label", { ref: s, id: d, htmlFor: h, className: `sg-form-check-label${r ? " " + r : ""}`, children: m })
|
|
46
|
+
] }) : /* @__PURE__ */ C(k, { children: [
|
|
47
|
+
/* @__PURE__ */ n("label", { ref: s, id: d, htmlFor: h, className: `sg-form-check-label${r ? " " + r : ""}`, children: m }),
|
|
48
|
+
/* @__PURE__ */ n("input", { ref: F, type: $, id: h, className: `sg-form-check-input${i ? " " + i : ""}`, style: v, ...a })
|
|
49
49
|
] }) });
|
|
50
50
|
}), S = l(({ children: e, className: t, ...o }, c) => /* @__PURE__ */ n("small", { ref: c, className: `sg-form-text${t ? " " + t : ""}`, ...o, children: e })), z = Object.assign(P, {
|
|
51
51
|
Control: y,
|
|
@@ -57,6 +57,7 @@ const w = b(null), H = ({ children: e, value: t }) => /* @__PURE__ */ n(w.Provid
|
|
|
57
57
|
});
|
|
58
58
|
export {
|
|
59
59
|
w as FormContext,
|
|
60
|
+
H as FormContextProvider,
|
|
60
61
|
z as default,
|
|
61
62
|
g as useFormContext
|
|
62
63
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseDivType, BaseFormType, BaseInputType, BaseLabelType, BaseSelectType, BaseSmallType } from "../../BaseTypes";
|
|
3
|
+
export type FormContextType = {
|
|
4
|
+
controlId: string;
|
|
5
|
+
};
|
|
6
|
+
export type FormType = {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
} & BaseFormType;
|
|
9
|
+
export type FormControlType = {
|
|
10
|
+
as?: React.ElementType;
|
|
11
|
+
className?: string;
|
|
12
|
+
plaintext?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
type?: string;
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
} & BaseInputType;
|
|
17
|
+
export type FormSelectType = {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
} & BaseSelectType;
|
|
22
|
+
export type FormGroupType = {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
controlId: string;
|
|
26
|
+
} & BaseDivType;
|
|
27
|
+
export type FormLabelType = {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
htmlFor?: string;
|
|
31
|
+
} & BaseLabelType;
|
|
32
|
+
export type FormCheckType = {
|
|
33
|
+
classNameContainer?: string;
|
|
34
|
+
containerRef?: React.LegacyRef<HTMLDivElement>;
|
|
35
|
+
containerId?: string;
|
|
36
|
+
style?: React.CSSProperties;
|
|
37
|
+
classNameLabel?: string;
|
|
38
|
+
labelRef?: React.LegacyRef<HTMLLabelElement>;
|
|
39
|
+
label?: string;
|
|
40
|
+
labelId?: string;
|
|
41
|
+
className?: string;
|
|
42
|
+
type?: string;
|
|
43
|
+
controlId?: string;
|
|
44
|
+
reverse?: boolean;
|
|
45
|
+
checkStyle?: React.CSSProperties;
|
|
46
|
+
} & BaseInputType;
|
|
47
|
+
export type FormTextType = {
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
className?: string;
|
|
50
|
+
} & BaseSmallType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Form";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const _default: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>> & {
|
|
2
|
+
Col: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
3
|
+
Row: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h } from "react";
|
|
3
|
+
const j = h(({ children: i, className: u, fluid: s, ...l }, $) => {
|
|
4
|
+
let c = "sg-container", d = typeof s == "string" ? `-${s}` : "-fluid";
|
|
5
|
+
return /* @__PURE__ */ C("div", { ref: $, className: `${s ? c + d : c} ${u}`, ...l, children: i });
|
|
6
|
+
}), w = h(({ children: i, as: u = "div", className: s = "", ...l }, $) => {
|
|
7
|
+
const c = u, d = ["xxl", "xl", "lg", "md", "sm", "xs"], x = "xs";
|
|
8
|
+
let f = "", e = "", t = [];
|
|
9
|
+
d.forEach((a) => {
|
|
10
|
+
const g = l[a];
|
|
11
|
+
delete l[a];
|
|
12
|
+
let n, m, p;
|
|
13
|
+
typeof g == "object" && g != null ? { span: n, offset: m, order: p } = g : n = g;
|
|
14
|
+
const r = a !== x ? `-${a}` : "";
|
|
15
|
+
n && (e += n === !0 ? ` sg-col${r}` : ` sg-col${r}-${n}`, t.push(n === !0 ? ` sg-col${r}` : ` sg-col${r}-${n}`)), p != null && (f += ` order${r}-${p}`), m != null && (f += ` offset${r}-${m}`);
|
|
16
|
+
});
|
|
17
|
+
let o = s + f + e;
|
|
18
|
+
return o += t.length ? "" : " sg-col", /* @__PURE__ */ C(c, { ref: $, className: o, ...l, children: i });
|
|
19
|
+
}), y = h(({ children: i, className: u = "", as: s = "div", ...l }, $) => {
|
|
20
|
+
const c = s, d = ["xxl", "xl", "lg", "md", "sm", "xs"], x = "xs";
|
|
21
|
+
let f = "";
|
|
22
|
+
return d.forEach((e) => {
|
|
23
|
+
const t = l[e];
|
|
24
|
+
delete l[e];
|
|
25
|
+
let o;
|
|
26
|
+
t != null && typeof t == "object" ? { cols: o } = t : o = t;
|
|
27
|
+
const a = e !== x ? `-${e}` : "";
|
|
28
|
+
o != null && (f += ` sg-row-cols${a}-${o}`);
|
|
29
|
+
}), /* @__PURE__ */ C(c, { ref: $, className: `sg-row ${u}${f}`, ...l, children: i });
|
|
30
|
+
}), N = Object.assign(j, {
|
|
31
|
+
Col: w,
|
|
32
|
+
Row: y
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
N as default
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Grid";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputGroupText, InputGroupType } from "./InputGroup.types";
|
|
3
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<InputGroupType, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
4
|
+
Text: import("react").ForwardRefExoticComponent<InputGroupText & import("react").RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as u } from "react";
|
|
3
|
+
const s = u(({ children: r, className: t, ...o }, p) => /* @__PURE__ */ n("div", { ref: p, className: `sg-input-group${t ? " " + t : ""}`, ...o, children: r })), e = u(({ children: r, className: t, ...o }, p) => /* @__PURE__ */ n("span", { ref: p, className: `sg-input-group-text${t ? " " + t : ""}`, ...o, children: r })), f = Object.assign(s, {
|
|
4
|
+
Text: e
|
|
5
|
+
});
|
|
6
|
+
export {
|
|
7
|
+
f as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseDivType } from "../../BaseTypes";
|
|
3
|
+
export type InputGroupType = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
} & BaseDivType;
|
|
7
|
+
export type InputGroupText = {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./InputGroup";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ModalBodyType, ModalType } from "./Modal.types";
|
|
3
|
+
declare const _default: (({ children, centered, size, show, backdrop, onHide, className, id, ...restProps }: ModalType) => React.ReactPortal) & {
|
|
4
|
+
Header: React.ForwardRefExoticComponent<(Omit<{
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
closeButton?: boolean | undefined;
|
|
9
|
+
onClick?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
10
|
+
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, "ref"> | Omit<{
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
closeButton?: boolean | undefined;
|
|
15
|
+
onClick?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
16
|
+
} & React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement>, "ref"> | Omit<{
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
19
|
+
className?: string | undefined;
|
|
20
|
+
closeButton?: boolean | undefined;
|
|
21
|
+
onClick?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
22
|
+
} & React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement>, "ref">) & React.RefAttributes<HTMLDivElement | HTMLHeadingElement | HTMLSpanElement>>;
|
|
23
|
+
Title: React.ForwardRefExoticComponent<(Omit<{
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, "ref"> | Omit<{
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
30
|
+
className?: string | undefined;
|
|
31
|
+
} & React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement>, "ref"> | Omit<{
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
34
|
+
className?: string | undefined;
|
|
35
|
+
} & React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement>, "ref">) & React.RefAttributes<HTMLDivElement | HTMLHeadingElement | HTMLSpanElement>>;
|
|
36
|
+
Body: React.ForwardRefExoticComponent<Omit<ModalBodyType, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
Footer: React.ForwardRefExoticComponent<Omit<ModalBodyType, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
};
|
|
39
|
+
export default _default;
|
|
40
|
+
export declare const useKeepElementFocused: (elementRef: React.RefObject<HTMLDialogElement>) => void;
|