stargazer-ui 1.0.4 → 1.0.6

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.
Files changed (139) hide show
  1. package/dist/cjs/components/Button/Button.d.ts +4 -0
  2. package/dist/cjs/components/Button/Button.types.d.ts +7 -0
  3. package/dist/cjs/components/Button/index.d.ts +1 -0
  4. package/dist/cjs/components/Card/Card.d.ts +34 -0
  5. package/dist/cjs/components/Card/Card.types.d.ts +24 -0
  6. package/dist/cjs/components/Card/index.d.ts +1 -0
  7. package/dist/{CloseButton/index.d.ts → cjs/components/CloseButton/CloseButton.d.ts} +1 -5
  8. package/dist/cjs/components/CloseButton/CloseButton.types.d.ts +5 -0
  9. package/dist/cjs/components/CloseButton/index.d.ts +1 -0
  10. package/dist/{Dropdown/index.d.ts → cjs/components/Dropdown/Dropdown.d.ts} +1 -54
  11. package/dist/cjs/components/Dropdown/Dropdown.types.d.ts +55 -0
  12. package/dist/cjs/components/Dropdown/index.d.ts +1 -0
  13. package/dist/cjs/components/FloatingLabel/FloatingLabel.d.ts +4 -0
  14. package/dist/cjs/components/FloatingLabel/FloatingLabel.types.d.ts +9 -0
  15. package/dist/cjs/components/FloatingLabel/index.d.ts +1 -0
  16. package/dist/cjs/components/Form/Form.d.ts +17 -0
  17. package/dist/cjs/components/Form/Form.types.d.ts +50 -0
  18. package/dist/cjs/components/Form/index.d.ts +1 -0
  19. package/dist/cjs/components/InputGroup/InputGroup.d.ts +6 -0
  20. package/dist/cjs/components/InputGroup/InputGroup.types.d.ts +10 -0
  21. package/dist/cjs/components/InputGroup/index.d.ts +1 -0
  22. package/dist/{Modal/index.d.ts → cjs/components/Modal/Modal.d.ts} +2 -32
  23. package/dist/cjs/components/Modal/Modal.types.d.ts +40 -0
  24. package/dist/cjs/components/Modal/index.d.ts +1 -0
  25. package/dist/{Nav/index.d.ts → cjs/components/Nav/Nav.d.ts} +0 -16
  26. package/dist/cjs/components/Nav/Nav.types.d.ts +17 -0
  27. package/dist/cjs/components/Nav/index.d.ts +1 -0
  28. package/dist/cjs/components/NavBar/Navbar.d.ts +20 -0
  29. package/dist/cjs/components/NavBar/Navbar.types.d.ts +18 -0
  30. package/dist/cjs/components/NavBar/index.d.ts +1 -0
  31. package/dist/{NavDropdown/index.d.ts → cjs/components/NavDropdown/NavDropdown.d.ts} +3 -7
  32. package/dist/cjs/components/NavDropdown/NavDropdown.types.d.ts +5 -0
  33. package/dist/cjs/components/NavDropdown/index.d.ts +1 -0
  34. package/dist/{Popout/index.d.ts → cjs/components/Popout/Popout.d.ts} +1 -35
  35. package/dist/cjs/components/Popout/Popout.types.d.ts +36 -0
  36. package/dist/cjs/components/Popout/index.d.ts +1 -0
  37. package/dist/{Spinner/index.d.ts → cjs/components/Spinner/Spinner.d.ts} +1 -7
  38. package/dist/cjs/components/Spinner/Spinner.types.d.ts +7 -0
  39. package/dist/cjs/components/Spinner/index.d.ts +1 -0
  40. package/dist/cjs/components/Table/Table.d.ts +4 -0
  41. package/dist/cjs/components/Table/Table.types.d.ts +7 -0
  42. package/dist/cjs/components/Table/index.d.ts +1 -0
  43. package/dist/cjs/components/Tabs/Tabs.d.ts +9 -0
  44. package/dist/{Tabs/index.d.ts → cjs/components/Tabs/Tabs.types.d.ts} +2 -9
  45. package/dist/cjs/components/Tabs/index.d.ts +1 -0
  46. package/dist/cjs/components/ToggleButton/ToggleButton.d.ts +9 -0
  47. package/dist/cjs/components/ToggleButton/index.d.ts +1 -0
  48. package/dist/cjs/components/index.d.ts +16 -0
  49. package/dist/cjs/index.d.ts +1 -0
  50. package/dist/cjs/index.js +2 -0
  51. package/dist/cjs/index.js.map +1 -0
  52. package/dist/esm/BaseTypes.d.ts +19 -0
  53. package/dist/esm/components/Button/Button.d.ts +4 -0
  54. package/dist/esm/components/Button/Button.types.d.ts +7 -0
  55. package/dist/esm/components/Button/index.d.ts +1 -0
  56. package/dist/esm/components/Card/Card.d.ts +34 -0
  57. package/dist/esm/components/Card/Card.types.d.ts +24 -0
  58. package/dist/esm/components/Card/index.d.ts +1 -0
  59. package/dist/esm/components/CloseButton/CloseButton.d.ts +4 -0
  60. package/dist/esm/components/CloseButton/CloseButton.types.d.ts +5 -0
  61. package/dist/esm/components/CloseButton/index.d.ts +1 -0
  62. package/dist/esm/components/Dropdown/Dropdown.d.ts +71 -0
  63. package/dist/esm/components/Dropdown/Dropdown.types.d.ts +55 -0
  64. package/dist/esm/components/Dropdown/index.d.ts +1 -0
  65. package/dist/esm/components/FloatingLabel/FloatingLabel.d.ts +4 -0
  66. package/dist/esm/components/FloatingLabel/FloatingLabel.types.d.ts +9 -0
  67. package/dist/esm/components/FloatingLabel/index.d.ts +1 -0
  68. package/dist/esm/components/Form/Form.d.ts +17 -0
  69. package/dist/esm/components/Form/Form.types.d.ts +50 -0
  70. package/dist/esm/components/Form/index.d.ts +1 -0
  71. package/dist/esm/components/InputGroup/InputGroup.d.ts +6 -0
  72. package/dist/esm/components/InputGroup/InputGroup.types.d.ts +10 -0
  73. package/dist/esm/components/InputGroup/index.d.ts +1 -0
  74. package/dist/esm/components/Modal/Modal.d.ts +40 -0
  75. package/dist/esm/components/Modal/Modal.types.d.ts +40 -0
  76. package/dist/esm/components/Modal/index.d.ts +1 -0
  77. package/dist/esm/components/Nav/Nav.d.ts +30 -0
  78. package/dist/esm/components/Nav/Nav.types.d.ts +17 -0
  79. package/dist/esm/components/Nav/index.d.ts +1 -0
  80. package/dist/esm/components/NavBar/Navbar.d.ts +20 -0
  81. package/dist/esm/components/NavBar/Navbar.types.d.ts +18 -0
  82. package/dist/esm/components/NavBar/index.d.ts +1 -0
  83. package/dist/esm/components/NavDropdown/NavDropdown.d.ts +35 -0
  84. package/dist/esm/components/NavDropdown/NavDropdown.types.d.ts +5 -0
  85. package/dist/esm/components/NavDropdown/index.d.ts +1 -0
  86. package/dist/esm/components/Popout/Popout.d.ts +22 -0
  87. package/dist/esm/components/Popout/Popout.types.d.ts +36 -0
  88. package/dist/esm/components/Popout/index.d.ts +1 -0
  89. package/dist/esm/components/Spinner/Spinner.d.ts +4 -0
  90. package/dist/esm/components/Spinner/Spinner.types.d.ts +7 -0
  91. package/dist/esm/components/Spinner/index.d.ts +1 -0
  92. package/dist/esm/components/Table/Table.d.ts +4 -0
  93. package/dist/esm/components/Table/Table.types.d.ts +7 -0
  94. package/dist/esm/components/Table/index.d.ts +1 -0
  95. package/dist/esm/components/Tabs/Tabs.d.ts +9 -0
  96. package/dist/esm/components/Tabs/Tabs.types.d.ts +35 -0
  97. package/dist/esm/components/Tabs/index.d.ts +1 -0
  98. package/dist/esm/components/ToggleButton/ToggleButton.d.ts +9 -0
  99. package/dist/esm/components/ToggleButton/index.d.ts +1 -0
  100. package/dist/esm/components/index.d.ts +16 -0
  101. package/dist/esm/index.d.ts +1 -0
  102. package/dist/esm/index.js +2 -0
  103. package/dist/esm/index.js.map +1 -0
  104. package/dist/types.d.ts +470 -0
  105. package/package.json +15 -4
  106. package/dist/BaseTypes.js +0 -1
  107. package/dist/Button/index.d.ts +0 -9
  108. package/dist/Button/index.js +0 -6
  109. package/dist/Card/index.d.ts +0 -92
  110. package/dist/Card/index.js +0 -18
  111. package/dist/CloseButton/index.js +0 -6
  112. package/dist/Dropdown/index.js +0 -205
  113. package/dist/FloatingLabel/index.d.ts +0 -11
  114. package/dist/FloatingLabel/index.js +0 -13
  115. package/dist/Form/index.d.ts +0 -65
  116. package/dist/Form/index.js +0 -63
  117. package/dist/Grid/Col.js +0 -19
  118. package/dist/Grid/Container.js +0 -9
  119. package/dist/Grid/Row.js +0 -17
  120. package/dist/InputGroup/index.d.ts +0 -14
  121. package/dist/InputGroup/index.js +0 -8
  122. package/dist/Modal/index.js +0 -99
  123. package/dist/Nav/index.js +0 -13
  124. package/dist/NavBar/index.d.ts +0 -46
  125. package/dist/NavBar/index.js +0 -17
  126. package/dist/NavDropdown/index.js +0 -858
  127. package/dist/OffCanvas/OffCanvas.js +0 -2266
  128. package/dist/Overlay/index.js +0 -125
  129. package/dist/Popout/index.js +0 -72
  130. package/dist/Spinner/index.js +0 -9
  131. package/dist/Table/index.d.ts +0 -9
  132. package/dist/Table/index.js +0 -9
  133. package/dist/Tabs/index.js +0 -77
  134. package/dist/ToggleButton/index.js +0 -11
  135. package/dist/main.js +0 -30
  136. package/dist/stylesheets/stargazerui.css +0 -4902
  137. package/dist/stylesheets/stargazerui.css.map +0 -1
  138. package/dist/vite-env.d.js +0 -1
  139. /package/dist/{BaseTypes.d.ts → cjs/BaseTypes.d.ts} +0 -0
@@ -1,6 +0,0 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as a } from "react";
3
- const c = a(({ className: e, variant: o = !1, ...l }, t) => /* @__PURE__ */ s("button", { ref: t, className: `sg-button-close${o ? " sg-button-close-white" : ""} ${e}`, ...l, children: /* @__PURE__ */ s("span", { className: "sg-close-visually-hidden-label", children: "Close" }) }));
4
- export {
5
- c as default
6
- };
@@ -1,205 +0,0 @@
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,
21
- className: o,
22
- onSelect: r,
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,
39
- directionClasses: {
40
- down: "dropdown",
41
- "down-centered": "dropdown-center",
42
- up: "dropup",
43
- "up-centered": "dropup-center dropup",
44
- end: "dropend",
45
- start: "dropstart"
46
- },
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) {
56
- case "ArrowDown":
57
- s = !0, l ? w((p) => ({ ...p, case: "next" })) : (c(t), w((p) => ({ ...p, case: "first" })));
58
- break;
59
- case "ArrowUp":
60
- s = !0, l ? w((p) => ({ ...p, case: "previous" })) : (c(t), w((p) => ({ ...p, case: "last" })));
61
- break;
62
- case "Home":
63
- s = !0, l && w((p) => ({ ...p, case: "first" }));
64
- break;
65
- case "End":
66
- s = !0, l && w((p) => ({ ...p, case: "last" }));
67
- break;
68
- case "Tab":
69
- l && c(t);
70
- break;
71
- case "Escape":
72
- s = !0, l && c(t);
73
- break;
74
- case "Enter":
75
- case " ":
76
- if (l) {
77
- s = !0, document.querySelector(".sg-dropdown-item-visual-focus").click(), c(t);
78
- break;
79
- } else {
80
- w((p) => ({ ...p, case: "first" }));
81
- break;
82
- }
83
- }
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
- }
95
- };
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);
100
- };
101
- }, [e, g]);
102
- const b = (t) => {
103
- c(t), l || w((s) => ({ ...s, case: "first" }));
104
- };
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
- n,
108
- {
109
- tabIndex: "0",
110
- type: "button",
111
- "aria-haspopup": "true",
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
120
- }
121
- );
122
- }), j = E(({ children: d, className: o, style: r = {}, ...u }, m) => {
123
- const { controlId: i, showInternal: h, activeDescendant: g } = x(), [c, w] = y(r);
124
- A(() => {
125
- if (h) {
126
- const n = document.getElementById(i + "-menu");
127
- let e = {};
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 }));
129
- }
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
- }
141
- }
142
- switch (g.case) {
143
- case "first":
144
- t = e[0].children[0], a = 0;
145
- break;
146
- case "last":
147
- t = e[f].children[0], a = f;
148
- break;
149
- case "next":
150
- a = a === f ? 0 : a + 1, t = e[a].children[0];
151
- break;
152
- case "previous":
153
- a = a === 0 ? f : a - 1, t = e[a].children[0];
154
- break;
155
- }
156
- n.setAttribute("aria-activedescendant", t.id), e[a].children[0].classList.add("sg-dropdown-item-visual-focus");
157
- } else
158
- document.getElementById(i + "-menu").setAttribute("aria-activedescendant", "");
159
- }, [i, h, g]);
160
- const l = (n) => {
161
- var a;
162
- const e = n.target;
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));
166
- };
167
- return C(() => {
168
- const n = document.getElementById(i + "-menu");
169
- for (let e of n.children)
170
- e.addEventListener("mouseover", l, !0);
171
- return function() {
172
- for (let f of n.children)
173
- f.removeEventListener("mouseover", l, !0);
174
- };
175
- }, []), /* @__PURE__ */ v(
176
- "ul",
177
- {
178
- id: i + "-menu",
179
- role: "menu",
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
187
- }
188
- );
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
- });
196
- export {
197
- V as Divider,
198
- I as DropdownContext,
199
- M as DropdownContextProvider,
200
- H as Item,
201
- j as Menu,
202
- q as Toggle,
203
- K as default,
204
- x as useDropdownContext
205
- };
@@ -1,11 +0,0 @@
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 +0,0 @@
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
- ] }) });
10
- });
11
- export {
12
- x as default
13
- };
@@ -1,65 +0,0 @@
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;
@@ -1,63 +0,0 @@
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,
32
- label: m,
33
- labelId: u,
34
- className: i,
35
- type: d,
36
- id: x,
37
- controlId: f,
38
- reverse: p = !1,
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 })
49
- ] }) });
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
- });
58
- export {
59
- w as FormContext,
60
- H as FormContextProvider,
61
- z as default,
62
- g as useFormContext
63
- };
package/dist/Grid/Col.js DELETED
@@ -1,19 +0,0 @@
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
- };
@@ -1,9 +0,0 @@
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 DELETED
@@ -1,17 +0,0 @@
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
- };
@@ -1,14 +0,0 @@
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;
@@ -1,8 +0,0 @@
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
- });
6
- export {
7
- f as default
8
- };
@@ -1,99 +0,0 @@
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 B, useEffect as w, useRef as F } from "react";
3
- import { createPortal as K } from "react-dom";
4
- import L from "../CloseButton/index.js";
5
- import N from "../Button/index.js";
6
- const g = D(null), $ = ({ 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] = B(o);
25
- w(() => {
26
- f(o);
27
- }, [o]);
28
- const r = F(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 K(
54
- /* @__PURE__ */ s("dialog", { ref: r, className: v, onKeyDown: (c) => k(c), ...m, children: /* @__PURE__ */ s($, { 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(L, { 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(N, { variant: "danger", type: "button", onClick: () => t(), children: "Close" }) })
96
- ] });
97
- export {
98
- Q as default
99
- };
package/dist/Nav/index.js DELETED
@@ -1,13 +0,0 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- import { useNavbarContext as c } from "../NavBar/index.js";
4
- const p = m(({ children: o, className: n, as: t = "ul", ...e }, r) => {
5
- const a = t, i = c();
6
- return /* @__PURE__ */ s(a, { ref: r, className: `${n} ${i || "sg-navbar-"}nav`, ...e, children: o });
7
- }), v = 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 })), b = Object.assign(p, {
8
- Item: v,
9
- Link: f
10
- });
11
- export {
12
- b as default
13
- };
@@ -1,46 +0,0 @@
1
- import React from "react";
2
- import { BaseAnchorType, BaseElementType, BaseNavType } from "../BaseTypes";
3
- export type NavbarContextType = string | null;
4
- export declare const NavbarContext: React.Context<NavbarContextType>;
5
- export declare const useNavbarContext: () => NavbarContextType;
6
- export type NavbarType = {
7
- children: React.ReactNode;
8
- className?: string;
9
- navbarPrefix?: string;
10
- } & BaseNavType;
11
- export type NavbarBrandType = {
12
- children: React.ReactNode;
13
- className?: string;
14
- as?: React.ElementType;
15
- href?: string;
16
- } & (BaseAnchorType | BaseElementType);
17
- export type NavbarTextType = {
18
- children: React.ReactNode;
19
- className?: string;
20
- as?: React.ElementType;
21
- } & BaseElementType;
22
- declare const _default: React.ForwardRefExoticComponent<Omit<NavbarType, "ref"> & React.RefAttributes<HTMLElement>> & {
23
- Brand: React.ForwardRefExoticComponent<(Omit<{
24
- children: React.ReactNode;
25
- className?: string | undefined;
26
- as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
27
- href?: string | undefined;
28
- } & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
29
- children: React.ReactNode;
30
- className?: string | undefined;
31
- as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
32
- href?: string | undefined;
33
- } & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<BaseAnchorType | BaseElementType>>;
34
- Text: React.ForwardRefExoticComponent<(Omit<{
35
- children: React.ReactNode;
36
- className?: string | undefined;
37
- as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
38
- href?: string | undefined;
39
- } & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
40
- children: React.ReactNode;
41
- className?: string | undefined;
42
- as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
43
- href?: string | undefined;
44
- } & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<HTMLElement>>;
45
- };
46
- export default _default;
@@ -1,17 +0,0 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { createContext as x, forwardRef as c, useMemo as b, useContext as C } from "react";
3
- const u = x(null), d = ({ children: t, value: n }) => /* @__PURE__ */ a(u.Provider, { value: n, children: t }), N = () => C(u), m = c(({ children: t, className: n, navbarPrefix: o = "sg-navbar-", ...r }, e) => {
4
- const s = b(() => o, [o]);
5
- return /* @__PURE__ */ a("nav", { ref: e, className: `sg-navbar${n ? " " + n : ""}`, ...r, children: /* @__PURE__ */ a(d, { value: s, children: t }) });
6
- }), p = c(({ children: t, className: n, href: o = "#", as: r = "a", ...e }, s) => {
7
- const v = r || (o && r != "Link" ? "a" : "span");
8
- return /* @__PURE__ */ a(v, { ref: s, href: o, className: `sg-navbar-brand${n ? " " + n : ""}`, ...e, children: t });
9
- }), i = c(({ children: t, className: n, as: o = "span", ...r }, e) => /* @__PURE__ */ a(o, { ref: e, className: `sg-navbar-text${n ? " " + n : ""}`, ...r, children: t })), f = Object.assign(m, {
10
- Brand: p,
11
- Text: i
12
- });
13
- export {
14
- u as NavbarContext,
15
- f as default,
16
- N as useNavbarContext
17
- };