stargazer-ui 1.0.2 → 1.0.4
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 +19 -0
- package/dist/BaseTypes.js +1 -0
- package/dist/Button/index.d.ts +9 -0
- package/dist/Button/index.js +1 -1
- package/dist/Card/index.d.ts +92 -0
- package/dist/Card/index.js +15 -29
- package/dist/CloseButton/index.d.ts +8 -0
- package/dist/Dropdown/index.d.ts +124 -0
- package/dist/Dropdown/index.js +140 -117
- package/dist/FloatingLabel/index.d.ts +11 -0
- package/dist/FloatingLabel/index.js +9 -9
- package/dist/Form/index.d.ts +65 -0
- package/dist/Form/index.js +56 -51
- package/dist/Grid/Col.js +19 -0
- package/dist/Grid/Container.js +9 -0
- package/dist/Grid/Row.js +17 -0
- package/dist/InputGroup/index.d.ts +14 -0
- package/dist/InputGroup/index.js +6 -5
- package/dist/Modal/index.d.ts +70 -0
- package/dist/Modal/index.js +78 -64
- package/dist/Nav/index.d.ts +46 -0
- package/dist/Nav/index.js +11 -12
- package/dist/NavBar/index.d.ts +46 -0
- package/dist/NavBar/index.js +15 -14
- package/dist/NavDropdown/index.d.ts +39 -0
- package/dist/NavDropdown/index.js +226 -218
- package/dist/OffCanvas/OffCanvas.js +2266 -0
- package/dist/Overlay/index.js +36 -36
- package/dist/Popout/index.d.ts +56 -0
- package/dist/Popout/index.js +55 -68
- package/dist/Spinner/index.d.ts +10 -0
- package/dist/Spinner/index.js +9 -0
- package/dist/Table/index.d.ts +9 -0
- package/dist/Table/index.js +9 -0
- package/dist/Tabs/index.d.ts +42 -0
- package/dist/Tabs/index.js +60 -52
- package/dist/stylesheets/stargazerui.css +1160 -17
- package/dist/stylesheets/stargazerui.css.map +1 -1
- package/dist/vite-env.d.js +1 -0
- package/package.json +14 -2
package/dist/Dropdown/index.js
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const L = (
|
|
4
|
-
const
|
|
5
|
-
let n =
|
|
6
|
-
return o === "up" ? n =
|
|
7
|
-
},
|
|
8
|
-
let r =
|
|
9
|
-
for (;
|
|
10
|
-
r.id != o + "-menu" ? r = r.parentElement : (
|
|
11
|
-
return
|
|
12
|
-
}, I =
|
|
13
|
-
|
|
1
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
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
|
+
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", c = r ? "right-end" : "left-end", w = r ? "left-start" : "right-start", l = r ? "left-end" : "right-end";
|
|
5
|
+
let n = d ? h : i;
|
|
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
|
+
}, k = (d, o = "") => {
|
|
8
|
+
let r = d.target, u = !0, m = !1;
|
|
9
|
+
for (; u; )
|
|
10
|
+
r.id != o + "-menu" ? r = r.parentElement : (m = !0, u = !1), r.id === "root" && (u = !1, m = !1);
|
|
11
|
+
return m;
|
|
12
|
+
}, I = D(null), M = ({ children: d, value: o }) => /* @__PURE__ */ v(I.Provider, { value: o, children: d }), x = () => {
|
|
13
|
+
const d = P(I);
|
|
14
|
+
if (!d)
|
|
15
|
+
throw new Error(
|
|
16
|
+
"useDropdownContext has to be used within DropdownContextProvider!"
|
|
17
|
+
);
|
|
18
|
+
return d;
|
|
19
|
+
}, O = E(({
|
|
20
|
+
children: d,
|
|
14
21
|
className: o,
|
|
15
22
|
onSelect: r,
|
|
16
|
-
onToggle:
|
|
17
|
-
|
|
18
|
-
drop:
|
|
19
|
-
align:
|
|
20
|
-
autoClose:
|
|
21
|
-
show:
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
const [n, e] =
|
|
25
|
-
B.stopPropagation(), e((
|
|
26
|
-
},
|
|
27
|
-
align:
|
|
28
|
-
drop:
|
|
29
|
-
showInternal:
|
|
30
|
-
handleToggle:
|
|
31
|
-
placement:
|
|
23
|
+
onToggle: u,
|
|
24
|
+
controlId: m,
|
|
25
|
+
drop: i = "down",
|
|
26
|
+
align: h = "start",
|
|
27
|
+
autoClose: g = !0,
|
|
28
|
+
show: c = "default",
|
|
29
|
+
...w
|
|
30
|
+
}, l) => {
|
|
31
|
+
const [n, e] = y(c === "default" ? !1 : c), [f, b] = y({ case: "" }), a = (B) => {
|
|
32
|
+
B.stopPropagation(), e((S) => !S);
|
|
33
|
+
}, s = L(h === "end", i), p = $(() => ({
|
|
34
|
+
align: h,
|
|
35
|
+
drop: i,
|
|
36
|
+
showInternal: c != "default" && u ? c : n,
|
|
37
|
+
handleToggle: c != "default" && u ? u : a,
|
|
38
|
+
placement: s,
|
|
32
39
|
directionClasses: {
|
|
33
40
|
down: "dropdown",
|
|
34
41
|
"down-centered": "dropdown-center",
|
|
@@ -37,146 +44,162 @@ const L = (s, o, r = !1) => {
|
|
|
37
44
|
end: "dropend",
|
|
38
45
|
start: "dropstart"
|
|
39
46
|
},
|
|
40
|
-
|
|
41
|
-
activeDescendant:
|
|
42
|
-
setActiveDescendant:
|
|
43
|
-
}), [
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
}), q = ({ children:
|
|
46
|
-
const {
|
|
47
|
-
let
|
|
48
|
-
switch (t.key) {
|
|
47
|
+
controlId: m,
|
|
48
|
+
activeDescendant: f,
|
|
49
|
+
setActiveDescendant: b
|
|
50
|
+
}), [h, i, c, n, u, s, m, f, b]);
|
|
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
|
+
}), q = E(({ children: d, className: o, navDropdown: r = !1, as: u = "button", variant: m = "primary", ...i }, h) => {
|
|
53
|
+
const { controlId: g, handleToggle: c, setActiveDescendant: w, showInternal: l } = x(), n = u, e = (t) => {
|
|
54
|
+
let s = !1;
|
|
55
|
+
switch (console.log(t.key), t.key) {
|
|
49
56
|
case "ArrowDown":
|
|
50
|
-
|
|
57
|
+
s = !0, l ? w((p) => ({ ...p, case: "next" })) : (c(t), w((p) => ({ ...p, case: "first" })));
|
|
51
58
|
break;
|
|
52
59
|
case "ArrowUp":
|
|
53
|
-
|
|
60
|
+
s = !0, l ? w((p) => ({ ...p, case: "previous" })) : (c(t), w((p) => ({ ...p, case: "last" })));
|
|
54
61
|
break;
|
|
55
62
|
case "Home":
|
|
56
|
-
|
|
63
|
+
s = !0, l && w((p) => ({ ...p, case: "first" }));
|
|
57
64
|
break;
|
|
58
65
|
case "End":
|
|
59
|
-
|
|
66
|
+
s = !0, l && w((p) => ({ ...p, case: "last" }));
|
|
67
|
+
break;
|
|
68
|
+
case "Tab":
|
|
69
|
+
l && c(t);
|
|
60
70
|
break;
|
|
61
71
|
case "Escape":
|
|
62
|
-
|
|
72
|
+
s = !0, l && c(t);
|
|
63
73
|
break;
|
|
64
74
|
case "Enter":
|
|
65
75
|
case " ":
|
|
66
|
-
if (
|
|
67
|
-
|
|
76
|
+
if (l) {
|
|
77
|
+
s = !0, document.querySelector(".sg-dropdown-item-visual-focus").click(), c(t);
|
|
68
78
|
break;
|
|
69
79
|
} else {
|
|
70
|
-
|
|
80
|
+
w((p) => ({ ...p, case: "first" }));
|
|
71
81
|
break;
|
|
72
82
|
}
|
|
73
83
|
}
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
84
|
+
s && (t.stopPropagation(), t.preventDefault());
|
|
85
|
+
}, f = (t) => {
|
|
86
|
+
if (l && t.target.id !== g) {
|
|
87
|
+
if (!k(t, g))
|
|
88
|
+
c(t);
|
|
89
|
+
else if (k(t, g)) {
|
|
90
|
+
c(t);
|
|
91
|
+
const s = document.getElementById(g);
|
|
92
|
+
s == null || s.focus();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
77
95
|
};
|
|
78
|
-
|
|
79
|
-
const t = document.getElementById(
|
|
80
|
-
return t.addEventListener("keydown", e, !0), document.addEventListener("mouseup",
|
|
81
|
-
t.removeEventListener("keydown", e, !0), document.removeEventListener("mouseup",
|
|
96
|
+
C(() => {
|
|
97
|
+
const t = document.getElementById(g);
|
|
98
|
+
return t.addEventListener("keydown", e, !0), document.addEventListener("mouseup", f, !0), function() {
|
|
99
|
+
t.removeEventListener("keydown", e, !0), document.removeEventListener("mouseup", f, !0);
|
|
82
100
|
};
|
|
83
|
-
}, [e,
|
|
84
|
-
const
|
|
85
|
-
|
|
101
|
+
}, [e, g]);
|
|
102
|
+
const b = (t) => {
|
|
103
|
+
c(t), l || w((s) => ({ ...s, case: "first" }));
|
|
86
104
|
};
|
|
87
|
-
let
|
|
88
|
-
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(
|
|
89
107
|
n,
|
|
90
108
|
{
|
|
91
109
|
tabIndex: "0",
|
|
92
110
|
type: "button",
|
|
93
111
|
"aria-haspopup": "true",
|
|
94
|
-
"aria-controls":
|
|
95
|
-
"aria-expanded":
|
|
96
|
-
id:
|
|
97
|
-
ref:
|
|
98
|
-
className:
|
|
99
|
-
onClick: (t) =>
|
|
100
|
-
...
|
|
101
|
-
children:
|
|
112
|
+
"aria-controls": g + "-menu",
|
|
113
|
+
"aria-expanded": l,
|
|
114
|
+
id: g,
|
|
115
|
+
ref: h,
|
|
116
|
+
className: a,
|
|
117
|
+
onClick: (t) => b(t),
|
|
118
|
+
...i,
|
|
119
|
+
children: d
|
|
102
120
|
}
|
|
103
121
|
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const H = ({ children: s, className: o, style: r = {}, ...i }, u) => {
|
|
107
|
-
const { controlID: c, showInternal: v, activeDescendant: f } = S(I), [d, g] = C(r);
|
|
122
|
+
}), j = E(({ children: d, className: o, style: r = {}, ...u }, m) => {
|
|
123
|
+
const { controlId: i, showInternal: h, activeDescendant: g } = x(), [c, w] = y(r);
|
|
108
124
|
A(() => {
|
|
109
|
-
if (
|
|
110
|
-
const n = document.getElementById(
|
|
111
|
-
console.log(n);
|
|
125
|
+
if (h) {
|
|
126
|
+
const n = document.getElementById(i + "-menu");
|
|
112
127
|
let e = {};
|
|
113
|
-
n.getBoundingClientRect().right > window.innerWidth ? e = { ...e, right: 0 } : n.getBoundingClientRect().left < 0 ? e = { ...e, left: 0 } : n.getBoundingClientRect().top < 0 ? e = { ...e, top: 0 } : n.getBoundingClientRect().bottom > window.innerHeight && (e = { ...e, bottom: 0 }),
|
|
128
|
+
n.getBoundingClientRect().right > window.innerWidth ? e = { ...e, right: 0 } : n.getBoundingClientRect().left < 0 ? e = { ...e, left: 0 } : n.getBoundingClientRect().top < 0 ? e = { ...e, top: 0 } : n.getBoundingClientRect().bottom > window.innerHeight && (e = { ...e, bottom: 0 }), w((f) => ({ ...f, ...e }));
|
|
114
129
|
}
|
|
115
|
-
}, [
|
|
116
|
-
if (
|
|
117
|
-
const n = document.getElementById(
|
|
118
|
-
let
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
}, [h]), C(() => {
|
|
131
|
+
if (h) {
|
|
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 a = 0, t = e[0].children[0];
|
|
134
|
+
if (b != null) {
|
|
135
|
+
b.classList.remove("sg-dropdown-item-visual-focus");
|
|
136
|
+
for (let s = 0; s < e.length; s++)
|
|
137
|
+
if (e[s] === b.parentElement) {
|
|
138
|
+
a = s;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
123
141
|
}
|
|
124
|
-
switch (
|
|
142
|
+
switch (g.case) {
|
|
125
143
|
case "first":
|
|
126
|
-
t = e[0].children[0],
|
|
144
|
+
t = e[0].children[0], a = 0;
|
|
127
145
|
break;
|
|
128
146
|
case "last":
|
|
129
|
-
t = e[
|
|
147
|
+
t = e[f].children[0], a = f;
|
|
130
148
|
break;
|
|
131
149
|
case "next":
|
|
132
|
-
|
|
150
|
+
a = a === f ? 0 : a + 1, t = e[a].children[0];
|
|
133
151
|
break;
|
|
134
152
|
case "previous":
|
|
135
|
-
|
|
153
|
+
a = a === 0 ? f : a - 1, t = e[a].children[0];
|
|
136
154
|
break;
|
|
137
155
|
}
|
|
138
|
-
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");
|
|
139
157
|
} else
|
|
140
|
-
document.getElementById(
|
|
141
|
-
}, [
|
|
142
|
-
const
|
|
158
|
+
document.getElementById(i + "-menu").setAttribute("aria-activedescendant", "");
|
|
159
|
+
}, [i, h, g]);
|
|
160
|
+
const l = (n) => {
|
|
161
|
+
var a;
|
|
143
162
|
const e = n.target;
|
|
144
|
-
|
|
163
|
+
let f = e.classList.contains("sg-dropdown-item-visual-focus");
|
|
164
|
+
const b = document.getElementById(i + "-menu");
|
|
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));
|
|
145
166
|
};
|
|
146
|
-
return
|
|
147
|
-
const n = document.getElementById(
|
|
167
|
+
return C(() => {
|
|
168
|
+
const n = document.getElementById(i + "-menu");
|
|
148
169
|
for (let e of n.children)
|
|
149
|
-
e.addEventListener("mouseover",
|
|
170
|
+
e.addEventListener("mouseover", l, !0);
|
|
150
171
|
return function() {
|
|
151
|
-
for (let
|
|
152
|
-
|
|
172
|
+
for (let f of n.children)
|
|
173
|
+
f.removeEventListener("mouseover", l, !0);
|
|
153
174
|
};
|
|
154
|
-
}, []), /* @__PURE__ */
|
|
175
|
+
}, []), /* @__PURE__ */ v(
|
|
155
176
|
"ul",
|
|
156
177
|
{
|
|
157
|
-
id:
|
|
178
|
+
id: i + "-menu",
|
|
158
179
|
role: "menu",
|
|
159
|
-
tabIndex:
|
|
160
|
-
"aria-labelledby":
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
children: s
|
|
180
|
+
tabIndex: -1,
|
|
181
|
+
"aria-labelledby": i,
|
|
182
|
+
ref: m,
|
|
183
|
+
className: `sg-dropdown-list${o ? " " + o : ""}${h ? " show" : ""}`,
|
|
184
|
+
style: c,
|
|
185
|
+
...u,
|
|
186
|
+
children: d
|
|
167
187
|
}
|
|
168
188
|
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
189
|
+
}), H = E(({ children: d, as: o = "button", className: r, ...u }, m) => /* @__PURE__ */ v("li", { role: "none", children: /* @__PURE__ */ v(o, { ref: m, role: "menuitem", tabIndex: "-1", className: `sg-dropdown-item${r ? " " + r : ""}`, ...u, children: d }) })), V = E(({ className: d = "", ...o }, r) => /* @__PURE__ */ v("hr", { ref: r, className: `.sg-dropdown-divider${d}`, ...o })), K = Object.assign(O, {
|
|
190
|
+
Toggle: q,
|
|
191
|
+
Menu: j,
|
|
192
|
+
Item: H,
|
|
193
|
+
//Text: Text,
|
|
194
|
+
Divider: V
|
|
195
|
+
});
|
|
175
196
|
export {
|
|
176
|
-
|
|
197
|
+
V as Divider,
|
|
177
198
|
I as DropdownContext,
|
|
178
|
-
|
|
179
|
-
H as
|
|
199
|
+
M as DropdownContextProvider,
|
|
200
|
+
H as Item,
|
|
201
|
+
j as Menu,
|
|
180
202
|
q as Toggle,
|
|
181
|
-
|
|
203
|
+
K as default,
|
|
204
|
+
x as useDropdownContext
|
|
182
205
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BaseLabelType } from "../BaseTypes";
|
|
3
|
+
export type FloatingLabelType = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
htmlFor?: string;
|
|
7
|
+
label: string;
|
|
8
|
+
controlId: string;
|
|
9
|
+
} & BaseLabelType;
|
|
10
|
+
declare const FloatingLabel: React.ForwardRefExoticComponent<Omit<FloatingLabelType, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
11
|
+
export default FloatingLabel;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
|
|
8
|
-
/* @__PURE__ */
|
|
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/index.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
9
|
] }) });
|
|
10
10
|
});
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
x as default
|
|
13
13
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BaseDivType, BaseFormType, BaseInputType, BaseLabelType, BaseSelectType, BaseSmallType } from "../BaseTypes";
|
|
3
|
+
export type FormContextType = {
|
|
4
|
+
controlId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const FormContext: React.Context<FormContextType | null>;
|
|
7
|
+
export declare const FormContextProvider: ({ children, value }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
value: FormContextType;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const useFormContext: () => FormContextType;
|
|
12
|
+
export type FormType = {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
} & BaseFormType;
|
|
15
|
+
export type FormControlType = {
|
|
16
|
+
as?: React.ElementType;
|
|
17
|
+
className?: string;
|
|
18
|
+
plaintext?: boolean;
|
|
19
|
+
id?: string;
|
|
20
|
+
type?: string;
|
|
21
|
+
autoFocus?: boolean;
|
|
22
|
+
} & BaseInputType;
|
|
23
|
+
export type FormSelectType = {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
id?: string;
|
|
27
|
+
} & BaseSelectType;
|
|
28
|
+
export type FormGroupType = {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
controlId: string;
|
|
32
|
+
} & BaseDivType;
|
|
33
|
+
export type FormLabelType = {
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
htmlFor?: string;
|
|
37
|
+
} & BaseLabelType;
|
|
38
|
+
export type FormCheckType = {
|
|
39
|
+
classNameContainer?: string;
|
|
40
|
+
containerRef?: React.LegacyRef<HTMLDivElement>;
|
|
41
|
+
containerId?: string;
|
|
42
|
+
style?: React.CSSProperties;
|
|
43
|
+
classNameLabel?: string;
|
|
44
|
+
labelRef?: React.LegacyRef<HTMLLabelElement>;
|
|
45
|
+
label?: string;
|
|
46
|
+
labelId?: string;
|
|
47
|
+
className?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
controlId?: string;
|
|
50
|
+
reverse?: boolean;
|
|
51
|
+
checkStyle?: React.CSSProperties;
|
|
52
|
+
} & BaseInputType;
|
|
53
|
+
export type FormTextType = {
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
className?: string;
|
|
56
|
+
} & BaseSmallType;
|
|
57
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<FormType, "ref"> & React.RefAttributes<HTMLFormElement>> & {
|
|
58
|
+
Control: React.ForwardRefExoticComponent<Omit<FormControlType, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
59
|
+
Select: React.ForwardRefExoticComponent<Omit<FormSelectType, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
60
|
+
Group: React.ForwardRefExoticComponent<Omit<FormGroupType, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
61
|
+
Label: React.ForwardRefExoticComponent<Omit<FormLabelType, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
62
|
+
Check: React.ForwardRefExoticComponent<Omit<FormCheckType, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
63
|
+
Text: React.ForwardRefExoticComponent<Omit<FormTextType, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
64
|
+
};
|
|
65
|
+
export default _default;
|
package/dist/Form/index.js
CHANGED
|
@@ -1,58 +1,63 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
return /* @__PURE__ */ n("
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
labelRef: c,
|
|
1
|
+
import { jsx as n, jsxs as $, Fragment as k } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as b, forwardRef as l, useMemo as j, useContext as I } from "react";
|
|
3
|
+
const w = b(null), H = ({ children: e, value: t }) => /* @__PURE__ */ n(w.Provider, { value: t, children: e }), g = () => {
|
|
4
|
+
const e = I(w);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error(
|
|
7
|
+
"useFormContext has to be used within a FormContextProvider!"
|
|
8
|
+
);
|
|
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 }, u) => {
|
|
11
|
+
let i = e;
|
|
12
|
+
const { controlId: d } = g();
|
|
13
|
+
let x = d || 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: u, id: x, type: r, className: f, ...m });
|
|
15
|
+
}), E = l(({ children: e, className: t, id: o, ...c }, r) => {
|
|
16
|
+
const { controlId: s } = g();
|
|
17
|
+
let m = s || o;
|
|
18
|
+
return /* @__PURE__ */ n("select", { ref: r, className: `sg-form-select${t ? " " + t : ""}`, id: m, ...c, children: e });
|
|
19
|
+
}), G = l(({ children: e, className: t, controlId: o, ...c }, r) => {
|
|
20
|
+
const s = j(() => ({ controlId: o }), [o]);
|
|
21
|
+
return /* @__PURE__ */ n("div", { ref: r, className: `sg-from-group${t ? " " + t : ""}`, ...c, children: /* @__PURE__ */ n(H, { value: s, children: e }) });
|
|
22
|
+
}), M = l(({ children: e, className: t, htmlFor: o }, c) => {
|
|
23
|
+
const { controlId: r } = g();
|
|
24
|
+
return /* @__PURE__ */ n("label", { ref: c, htmlFor: o || r, className: `sg-form-label${t ? " " + t : ""}`, children: e });
|
|
25
|
+
}), O = l(({
|
|
26
|
+
classNameContainer: e,
|
|
27
|
+
containerRef: t,
|
|
28
|
+
containerId: o,
|
|
29
|
+
style: c,
|
|
30
|
+
classNameLabel: r,
|
|
31
|
+
labelRef: s,
|
|
33
32
|
label: m,
|
|
34
33
|
labelId: u,
|
|
35
34
|
className: i,
|
|
36
|
-
type:
|
|
37
|
-
id:
|
|
38
|
-
controlId:
|
|
35
|
+
type: d,
|
|
36
|
+
id: x,
|
|
37
|
+
controlId: f,
|
|
39
38
|
reverse: p = !1,
|
|
40
|
-
checkStyle:
|
|
41
|
-
...
|
|
42
|
-
},
|
|
43
|
-
let
|
|
44
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
45
|
-
/* @__PURE__ */ n("input", { ref:
|
|
46
|
-
/* @__PURE__ */ n("label", { ref:
|
|
47
|
-
] }) : /* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */ n("label", { ref:
|
|
49
|
-
/* @__PURE__ */ n("input", { ref:
|
|
39
|
+
checkStyle: v,
|
|
40
|
+
...a
|
|
41
|
+
}, C) => {
|
|
42
|
+
let h = f || x, F = d === "switch" ? "checkbox" : d;
|
|
43
|
+
return /* @__PURE__ */ n("div", { ref: t, id: o, style: c, className: `sg-form-check${p ? "-reverse" : ""}${e ? " " + e : ""}${d === "switch" ? " sg-form-switch" : ""}`, children: p ? /* @__PURE__ */ $(k, { children: [
|
|
44
|
+
/* @__PURE__ */ n("input", { ref: C, type: F, id: h, className: `sg-form-check-input${i ? " " + i : ""}`, ...a }),
|
|
45
|
+
/* @__PURE__ */ n("label", { ref: s, id: u, htmlFor: h, className: `sg-form-check-label${r ? " " + r : ""}`, children: m })
|
|
46
|
+
] }) : /* @__PURE__ */ $(k, { children: [
|
|
47
|
+
/* @__PURE__ */ n("label", { ref: s, id: u, htmlFor: h, className: `sg-form-check-label${r ? " " + r : ""}`, children: m }),
|
|
48
|
+
/* @__PURE__ */ n("input", { ref: C, type: F, id: h, className: `sg-form-check-input${i ? " " + i : ""}`, style: v, ...a })
|
|
50
49
|
] }) });
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
Control: y,
|
|
52
|
+
Select: E,
|
|
53
|
+
Group: G,
|
|
54
|
+
Label: M,
|
|
55
|
+
Check: O,
|
|
56
|
+
Text: S
|
|
57
|
+
});
|
|
55
58
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
w as FormContext,
|
|
60
|
+
H as FormContextProvider,
|
|
61
|
+
z as default,
|
|
62
|
+
g as useFormContext
|
|
58
63
|
};
|
package/dist/Grid/Col.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h } from "react";
|
|
3
|
+
const j = ({ children: u, as: i = "div", className: d = "", ...o }, p) => {
|
|
4
|
+
const g = i, m = ["xxl", "xl", "lg", "md", "sm", "xs"], x = "xs";
|
|
5
|
+
let n = "", c = "", r = [];
|
|
6
|
+
m.forEach((e) => {
|
|
7
|
+
const t = o[e];
|
|
8
|
+
delete o[e];
|
|
9
|
+
let l, f, a;
|
|
10
|
+
typeof t == "object" && t != null ? { span: l, offset: f, order: a } = t : l = t;
|
|
11
|
+
const s = e !== x ? `-${e}` : "";
|
|
12
|
+
l && (c += l === !0 ? ` sg-col${s}` : ` sg-col${s}-${l}`, r.push(l === !0 ? ` sg-col${s}` : ` sg-col${s}-${l}`)), a != null && (n += ` order${s}-${a}`), f != null && (n += ` offset${s}-${f}`);
|
|
13
|
+
});
|
|
14
|
+
let $ = d + n + c;
|
|
15
|
+
return $ += r.length ? "" : " sg-col", /* @__PURE__ */ C(g, { ref: p, className: $, ...o, children: u });
|
|
16
|
+
}, v = h(j);
|
|
17
|
+
export {
|
|
18
|
+
v as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
const l = ({ children: e, className: o, fluid: r, ...f }, i) => {
|
|
4
|
+
let t = "sg-container", n = typeof r == "string" ? `-${r}` : "-fluid";
|
|
5
|
+
return /* @__PURE__ */ a("div", { ref: i, className: `${r ? t + n : t} ${o}`, ...f, children: e });
|
|
6
|
+
}, d = s(l);
|
|
7
|
+
export {
|
|
8
|
+
d as default
|
|
9
|
+
};
|
package/dist/Grid/Row.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as x } from "react";
|
|
3
|
+
const $ = ({ children: n, className: c = "", as: f = "div", ...t }, a) => {
|
|
4
|
+
const r = f, m = ["xxl", "xl", "lg", "md", "sm", "xs"], d = "xs";
|
|
5
|
+
let e = "";
|
|
6
|
+
return m.forEach((o) => {
|
|
7
|
+
const l = t[o];
|
|
8
|
+
delete t[o];
|
|
9
|
+
let s;
|
|
10
|
+
l != null && typeof l == "object" ? { cols: s } = l : s = l;
|
|
11
|
+
const i = o !== d ? `-${o}` : "";
|
|
12
|
+
s != null && (e += ` sg-row-cols${i}-${s}`);
|
|
13
|
+
}), /* @__PURE__ */ u(r, { ref: a, className: `sg-row ${c}${e}`, ...t, children: n });
|
|
14
|
+
}, g = x($);
|
|
15
|
+
export {
|
|
16
|
+
g as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BaseDivType } from "../BaseTypes";
|
|
3
|
+
export type InputGroupType = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
} & BaseDivType;
|
|
7
|
+
export type InputGroupText = {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<InputGroupType, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
12
|
+
Text: React.ForwardRefExoticComponent<InputGroupText & React.RefAttributes<HTMLSpanElement>>;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
package/dist/InputGroup/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s } from "react";
|
|
3
|
+
const e = s(({ children: r, className: t, ...o }, n) => /* @__PURE__ */ p("div", { ref: n, className: `sg-input-group${t ? " " + t : ""}`, ...o, children: r })), u = s(({ children: r, className: t, ...o }, n) => /* @__PURE__ */ p("span", { ref: n, className: `sg-input-group-text${t ? " " + t : ""}`, ...o, children: r })), f = Object.assign(e, {
|
|
4
|
+
Text: u
|
|
5
|
+
});
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
+
f as default
|
|
7
8
|
};
|