uibee 3.3.0 → 3.3.1
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/components/alert/alert.d.ts +15 -0
- package/dist/components/alert/alert.js +29 -0
- package/dist/components/badge/badge.d.ts +16 -0
- package/dist/components/badge/badge.js +26 -0
- package/dist/components/buttons/button.d.ts +25 -0
- package/dist/components/buttons/button.js +44 -0
- package/dist/components/code/code.d.ts +23 -0
- package/dist/components/code/code.js +39 -0
- package/dist/components/confirm/confirmPopup.d.ts +23 -0
- package/dist/components/confirm/confirmPopup.js +52 -0
- package/dist/components/container/accordion.d.ts +25 -0
- package/dist/components/container/accordion.js +41 -0
- package/dist/components/container/card.d.ts +13 -0
- package/dist/components/container/card.js +10 -0
- package/dist/components/container/expandableCard.d.ts +32 -0
- package/dist/components/container/expandableCard.js +70 -0
- package/dist/components/container/glassCard.d.ts +13 -0
- package/dist/components/container/glassCard.js +10 -0
- package/dist/components/container/highlight.d.ts +10 -0
- package/dist/components/container/highlight.js +10 -0
- package/dist/components/container/iconBubble.d.ts +25 -0
- package/dist/components/container/iconBubble.js +21 -0
- package/dist/components/container/leftBarPanel.d.ts +15 -0
- package/dist/components/container/leftBarPanel.js +10 -0
- package/dist/components/container/page.d.ts +15 -0
- package/dist/components/container/page.js +16 -0
- package/dist/components/container/pulseDot.d.ts +12 -0
- package/dist/components/container/pulseDot.js +23 -0
- package/dist/components/container/statCard.d.ts +18 -0
- package/dist/components/container/statCard.js +25 -0
- package/dist/components/container/tabs.d.ts +35 -0
- package/dist/components/container/tabs.js +36 -0
- package/dist/components/empty/emptyState.d.ts +19 -0
- package/dist/components/empty/emptyState.js +27 -0
- package/dist/components/footer/footer.d.ts +49 -0
- package/dist/components/footer/footer.js +109 -0
- package/dist/components/footer/loginContent.d.ts +18 -0
- package/dist/components/footer/loginContent.js +138 -0
- package/dist/components/inputs/checkbox.d.ts +20 -0
- package/dist/components/inputs/checkbox.js +76 -0
- package/dist/components/inputs/fileInput.d.ts +19 -0
- package/dist/components/inputs/fileInput.js +108 -0
- package/dist/components/inputs/input.d.ts +16 -0
- package/dist/components/inputs/input.js +157 -0
- package/dist/components/inputs/multiSelect.d.ts +37 -0
- package/dist/components/inputs/multiSelect.js +99 -0
- package/dist/components/inputs/radio.d.ts +20 -0
- package/dist/components/inputs/radio.js +70 -0
- package/dist/components/inputs/range.d.ts +14 -0
- package/dist/components/inputs/range.js +60 -0
- package/dist/components/inputs/searchInput.d.ts +11 -0
- package/dist/components/inputs/searchInput.js +56 -0
- package/dist/components/inputs/select.d.ts +42 -0
- package/dist/components/inputs/select.js +164 -0
- package/dist/components/inputs/shared/colorPickerPopup.js +293 -0
- package/dist/components/inputs/shared/dateTimePickerPopup.js +225 -0
- package/dist/components/inputs/shared/fieldWrapper.js +33 -0
- package/dist/components/inputs/shared/index.js +6 -0
- package/dist/components/inputs/shared/inputError.js +17 -0
- package/dist/components/inputs/shared/inputInfo.js +13 -0
- package/dist/components/inputs/shared/inputLabel.js +19 -0
- package/dist/components/inputs/switch.d.ts +14 -0
- package/dist/components/inputs/switch.js +37 -0
- package/dist/components/inputs/tagInput.d.ts +31 -0
- package/dist/components/inputs/tagInput.js +72 -0
- package/dist/components/inputs/textarea.d.ts +14 -0
- package/dist/components/inputs/textarea.js +76 -0
- package/dist/components/inputs/toggle.d.ts +21 -0
- package/dist/components/inputs/toggle.js +33 -0
- package/dist/components/login/loginPage.d.ts +15 -0
- package/dist/components/login/loginPage.js +80 -0
- package/dist/components/logo/logo.d.ts +9 -0
- package/dist/components/logo/logo.js +138 -0
- package/dist/components/logo/logoSmall.d.ts +4 -0
- package/dist/components/logo/logoSmall.js +56 -0
- package/dist/components/markdownrender/markdownRender.d.ts +16 -0
- package/dist/components/markdownrender/markdownRender.js +59 -0
- package/dist/components/modal/modal.d.ts +22 -0
- package/dist/components/modal/modal.js +59 -0
- package/dist/components/navbar/bubble.js +36 -0
- package/dist/components/navbar/navbar.d.ts +50 -0
- package/dist/components/navbar/navbar.js +99 -0
- package/dist/components/navbar/navbarDropdown.d.ts +15 -0
- package/dist/components/navbar/navbarDropdown.js +63 -0
- package/dist/components/navbar/navbarItem.d.ts +23 -0
- package/dist/components/navbar/navbarItem.js +38 -0
- package/dist/components/sidebar/sidebar.d.ts +34 -0
- package/dist/components/sidebar/sidebar.js +135 -0
- package/dist/components/spinner/spinner.d.ts +11 -0
- package/dist/components/spinner/spinner.js +16 -0
- package/dist/components/table/body.js +253 -0
- package/dist/components/table/constants.js +58 -0
- package/dist/components/table/empty.js +24 -0
- package/dist/components/table/format.js +39 -0
- package/dist/components/table/header.js +109 -0
- package/dist/components/table/menu.d.ts +18 -0
- package/dist/components/table/menu.js +76 -0
- package/dist/components/table/pagination.d.ts +14 -0
- package/dist/components/table/pagination.js +130 -0
- package/dist/components/table/skeleton.js +39 -0
- package/dist/components/table/table.d.ts +7 -0
- package/dist/components/table/table.js +213 -0
- package/dist/components/table/types.d.ts +52 -0
- package/dist/components/table/utils.js +9 -0
- package/dist/components/toast/toastItem.js +61 -0
- package/dist/components/toast/toaster.d.ts +13 -0
- package/dist/components/toast/toaster.js +117 -0
- package/dist/components/toggle/language.d.ts +10 -0
- package/dist/components/toggle/language.js +34 -0
- package/dist/components/toggle/theme.d.ts +8 -0
- package/dist/components/toggle/theme.js +135 -0
- package/dist/components/version/version.d.ts +13 -0
- package/dist/components/version/version.js +19 -0
- package/dist/components/vulnerability/constants.d.ts +4 -0
- package/dist/components/vulnerability/constants.js +17 -0
- package/dist/components/vulnerability/severityPill.d.ts +15 -0
- package/dist/components/vulnerability/severityPill.js +20 -0
- package/dist/{style.css → globals.css} +152 -226
- package/dist/hooks/useClickOutside.d.ts +6 -0
- package/dist/{useClickOutside-Cmp-RsP3.js → hooks/useClickOutside.js} +1 -1
- package/dist/hooks/useDarkMode.d.ts +4 -0
- package/dist/hooks/useDarkMode.js +19 -0
- package/dist/hooks/useVisibility.d.ts +7 -0
- package/dist/hooks/useVisibility.js +25 -0
- package/dist/icons/icons.d.ts +420 -0
- package/dist/{icons-lZYQ6Vlr.js → icons/icons.js} +1 -1
- package/dist/src/components/index.d.ts +51 -905
- package/dist/src/components/index.js +49 -4179
- package/dist/src/hooks/index.d.ts +3 -14
- package/dist/src/hooks/index.js +3 -42
- package/dist/src/icons/index.d.ts +1 -419
- package/dist/src/icons/index.js +1 -1
- package/dist/src/styles/index.js +1 -1
- package/dist/src/utils/index.d.ts +5 -37
- package/dist/src/utils/index.js +5 -124
- package/dist/utils/auth/callback.d.ts +14 -0
- package/dist/utils/auth/callback.js +53 -0
- package/dist/utils/auth/getDomain.js +6 -0
- package/dist/utils/auth/login.d.ts +12 -0
- package/dist/utils/auth/login.js +17 -0
- package/dist/utils/auth/logout.d.ts +10 -0
- package/dist/utils/auth/logout.js +20 -0
- package/dist/utils/auth/token.d.ts +10 -0
- package/dist/utils/auth/token.js +30 -0
- package/dist/utils/logoConsoleOutput/logoConsoleOutput.d.ts +4 -0
- package/dist/utils/logoConsoleOutput/logoConsoleOutput.js +11 -0
- package/package.json +1 -1
- package/src/components/buttons/button.tsx +2 -0
- package/src/components/footer/footer.tsx +60 -42
- package/src/components/index.ts +0 -1
- package/src/components/inputs/checkbox.tsx +2 -0
- package/src/components/inputs/input.tsx +2 -0
- package/src/components/inputs/radio.tsx +2 -0
- package/src/components/inputs/range.tsx +2 -0
- package/src/components/inputs/shared/colorPickerPopup.tsx +2 -0
- package/src/components/inputs/shared/dateTimePickerPopup.tsx +2 -0
- package/src/components/inputs/textarea.tsx +2 -0
- package/src/components/inputs/toggle.tsx +2 -0
- package/src/components/toast/toastItem.tsx +2 -0
- package/src/globals.css +5 -0
- package/tsdown.config.ts +1 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/inputs/shared/dateTimePickerPopup.tsx
|
|
6
|
+
const DAYS = [
|
|
7
|
+
"Mo",
|
|
8
|
+
"Tu",
|
|
9
|
+
"We",
|
|
10
|
+
"Th",
|
|
11
|
+
"Fr",
|
|
12
|
+
"Sa",
|
|
13
|
+
"Su"
|
|
14
|
+
];
|
|
15
|
+
const MONTHS = [
|
|
16
|
+
"January",
|
|
17
|
+
"February",
|
|
18
|
+
"March",
|
|
19
|
+
"April",
|
|
20
|
+
"May",
|
|
21
|
+
"June",
|
|
22
|
+
"July",
|
|
23
|
+
"August",
|
|
24
|
+
"September",
|
|
25
|
+
"October",
|
|
26
|
+
"November",
|
|
27
|
+
"December"
|
|
28
|
+
];
|
|
29
|
+
function DateTimePickerPopup({ value, onChange, type, onClose, anchorName }) {
|
|
30
|
+
const [currentDate, setCurrentDate] = useState(/* @__PURE__ */ new Date());
|
|
31
|
+
const [timeInput, setTimeInput] = useState({
|
|
32
|
+
hours: value ? value.getHours().toString() : "0",
|
|
33
|
+
minutes: value ? value.getMinutes().toString() : "0"
|
|
34
|
+
});
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (value) {
|
|
37
|
+
setCurrentDate(value);
|
|
38
|
+
setTimeInput((prev) => ({
|
|
39
|
+
hours: prev.hours === "" && value.getHours() === 0 ? "" : value.getHours().toString(),
|
|
40
|
+
minutes: prev.minutes === "" && value.getMinutes() === 0 ? "" : value.getMinutes().toString()
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}, [value]);
|
|
44
|
+
function handleDateSelect(day) {
|
|
45
|
+
const newDate = new Date(currentDate);
|
|
46
|
+
newDate.setDate(day);
|
|
47
|
+
if (value) {
|
|
48
|
+
newDate.setHours(value.getHours());
|
|
49
|
+
newDate.setMinutes(value.getMinutes());
|
|
50
|
+
} else newDate.setHours(0, 0, 0, 0);
|
|
51
|
+
onChange(newDate);
|
|
52
|
+
if (type === "date" && onClose) onClose();
|
|
53
|
+
}
|
|
54
|
+
function handleTimeChange(timeUnit, val) {
|
|
55
|
+
const newDate = value ? new Date(value) : /* @__PURE__ */ new Date();
|
|
56
|
+
if (!value) newDate.setHours(0, 0, 0, 0);
|
|
57
|
+
if (timeUnit === "hours") {
|
|
58
|
+
if (val < 0 || val > 23) return;
|
|
59
|
+
newDate.setHours(val);
|
|
60
|
+
}
|
|
61
|
+
if (timeUnit === "minutes") {
|
|
62
|
+
if (val < 0 || val > 59) return;
|
|
63
|
+
newDate.setMinutes(val);
|
|
64
|
+
}
|
|
65
|
+
onChange(newDate);
|
|
66
|
+
}
|
|
67
|
+
function onTimeInputChange(unit, val) {
|
|
68
|
+
if (val === "") {
|
|
69
|
+
setTimeInput((prev) => ({
|
|
70
|
+
...prev,
|
|
71
|
+
[unit]: ""
|
|
72
|
+
}));
|
|
73
|
+
handleTimeChange(unit, 0);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!/^\d+$/.test(val)) return;
|
|
77
|
+
const num = parseInt(val);
|
|
78
|
+
if (unit === "hours" && num > 23) return;
|
|
79
|
+
if (unit === "minutes" && num > 59) return;
|
|
80
|
+
setTimeInput((prev) => ({
|
|
81
|
+
...prev,
|
|
82
|
+
[unit]: val
|
|
83
|
+
}));
|
|
84
|
+
handleTimeChange(unit, num);
|
|
85
|
+
}
|
|
86
|
+
function onTimeInputBlur(unit) {
|
|
87
|
+
if (timeInput[unit] === "") {
|
|
88
|
+
const num = unit === "hours" ? value?.getHours() ?? 0 : value?.getMinutes() ?? 0;
|
|
89
|
+
setTimeInput((prev) => ({
|
|
90
|
+
...prev,
|
|
91
|
+
[unit]: num.toString()
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function getDaysInMonth(year, month) {
|
|
96
|
+
return new Date(year, month + 1, 0).getDate();
|
|
97
|
+
}
|
|
98
|
+
function getFirstDayOfMonth(year, month) {
|
|
99
|
+
return new Date(year, month, 1).getDay();
|
|
100
|
+
}
|
|
101
|
+
function renderCalendar() {
|
|
102
|
+
const year = currentDate.getFullYear();
|
|
103
|
+
const month = currentDate.getMonth();
|
|
104
|
+
const daysInMonth = getDaysInMonth(year, month);
|
|
105
|
+
const firstDay = getFirstDayOfMonth(year, month);
|
|
106
|
+
const days = [];
|
|
107
|
+
const adjustedFirstDay = firstDay === 0 ? 6 : firstDay - 1;
|
|
108
|
+
for (let i = 0; i < adjustedFirstDay; i++) days.push(/* @__PURE__ */ jsx("div", { className: "w-8 h-8" }, `empty-${i}`));
|
|
109
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
110
|
+
const isSelected = value && value.getDate() === i && value.getMonth() === month && value.getFullYear() === year;
|
|
111
|
+
const isToday = (/* @__PURE__ */ new Date()).getDate() === i && (/* @__PURE__ */ new Date()).getMonth() === month && (/* @__PURE__ */ new Date()).getFullYear() === year;
|
|
112
|
+
days.push(/* @__PURE__ */ jsx("button", {
|
|
113
|
+
type: "button",
|
|
114
|
+
onClick: () => handleDateSelect(i),
|
|
115
|
+
className: `
|
|
116
|
+
w-8 h-8 flex items-center justify-center rounded-full text-sm
|
|
117
|
+
hover:bg-login-600 transition-colors
|
|
118
|
+
${isSelected ? "bg-login! text-white! hover:bg-login!" : ""}
|
|
119
|
+
${!isSelected && isToday ? "text-login! font-bold" : ""}
|
|
120
|
+
${!isSelected && !isToday ? "text-login-text!" : ""}
|
|
121
|
+
`,
|
|
122
|
+
children: i
|
|
123
|
+
}, i));
|
|
124
|
+
}
|
|
125
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
126
|
+
className: "p-2",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsxs("div", {
|
|
129
|
+
className: "flex items-center justify-between mb-2",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx("button", {
|
|
132
|
+
type: "button",
|
|
133
|
+
onClick: () => setCurrentDate(new Date(year, month - 1)),
|
|
134
|
+
className: "p-1 hover:bg-login-600 rounded-full text-login-text transition-colors",
|
|
135
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "w-4 h-4" })
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsxs("span", {
|
|
138
|
+
className: "font-medium text-login-text",
|
|
139
|
+
children: [
|
|
140
|
+
MONTHS[month],
|
|
141
|
+
" ",
|
|
142
|
+
year
|
|
143
|
+
]
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ jsx("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
onClick: () => setCurrentDate(new Date(year, month + 1)),
|
|
148
|
+
className: "p-1 hover:bg-login-600 rounded-full text-login-text transition-colors",
|
|
149
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "w-4 h-4" })
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ jsx("div", {
|
|
154
|
+
className: "grid grid-cols-7 gap-1 mb-1",
|
|
155
|
+
children: DAYS.map((d) => /* @__PURE__ */ jsx("div", {
|
|
156
|
+
className: "w-8 text-center text-xs text-login-200 font-medium",
|
|
157
|
+
children: d
|
|
158
|
+
}, d))
|
|
159
|
+
}),
|
|
160
|
+
/* @__PURE__ */ jsx("div", {
|
|
161
|
+
className: "grid grid-cols-7 gap-1",
|
|
162
|
+
children: days
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function renderTimePicker() {
|
|
168
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
169
|
+
className: "p-2 border-t border-login-500/25 flex justify-center gap-2",
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ jsxs("div", {
|
|
172
|
+
className: "flex flex-col items-center",
|
|
173
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
174
|
+
className: "text-xs text-login-200 mb-1",
|
|
175
|
+
children: "Hour"
|
|
176
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
177
|
+
type: "text",
|
|
178
|
+
inputMode: "numeric",
|
|
179
|
+
value: timeInput.hours,
|
|
180
|
+
onChange: (e) => onTimeInputChange("hours", e.target.value),
|
|
181
|
+
onBlur: () => onTimeInputBlur("hours"),
|
|
182
|
+
className: `
|
|
183
|
+
w-16 p-1 bg-login-600 rounded text-center text-login-text text-sm
|
|
184
|
+
border border-login-500/50 focus:border-login/60 focus:ring-1 focus:ring-login/30 outline-none
|
|
185
|
+
`
|
|
186
|
+
})]
|
|
187
|
+
}),
|
|
188
|
+
/* @__PURE__ */ jsx("div", {
|
|
189
|
+
className: "flex items-end pb-2 text-login-text",
|
|
190
|
+
children: ":"
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ jsxs("div", {
|
|
193
|
+
className: "flex flex-col items-center",
|
|
194
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
195
|
+
className: "text-xs text-login-200 mb-1",
|
|
196
|
+
children: "Minute"
|
|
197
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
198
|
+
type: "text",
|
|
199
|
+
inputMode: "numeric",
|
|
200
|
+
value: timeInput.minutes,
|
|
201
|
+
onChange: (e) => onTimeInputChange("minutes", e.target.value),
|
|
202
|
+
onBlur: () => onTimeInputBlur("minutes"),
|
|
203
|
+
className: `
|
|
204
|
+
w-16 p-1 bg-login-600 rounded text-center text-login-text text-sm
|
|
205
|
+
border border-login-500/50 focus:border-login/60 focus:ring-1 focus:ring-login/30 outline-none
|
|
206
|
+
`
|
|
207
|
+
})]
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
213
|
+
className: "fixed z-50 bg-login-700 border border-login-500/50 rounded-md shadow-xl p-1 min-w-70 anchor-popup",
|
|
214
|
+
style: {
|
|
215
|
+
positionAnchor: anchorName,
|
|
216
|
+
positionArea: "bottom span-right",
|
|
217
|
+
insetArea: "bottom span-right",
|
|
218
|
+
positionTryFallbacks: "flip-block",
|
|
219
|
+
margin: "0.25rem 0"
|
|
220
|
+
},
|
|
221
|
+
children: [type !== "time" && renderCalendar(), (type === "time" || type === "datetime-local") && renderTimePicker()]
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
225
|
+
export { DateTimePickerPopup as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import InputLabel from "./inputLabel.js";
|
|
2
|
+
import InputInfo from "./inputInfo.js";
|
|
3
|
+
import InputError from "./inputError.js";
|
|
4
|
+
import MarkdownRender from "../../markdownrender/markdownRender.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/inputs/shared/fieldWrapper.tsx
|
|
7
|
+
function FieldWrapper({ label, name, required, info, error, description, textSize = "sm", children, className }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
9
|
+
className: `flex flex-col gap-1 w-full relative ${className || ""}`,
|
|
10
|
+
children: [
|
|
11
|
+
(label || info) && /* @__PURE__ */ jsxs("div", {
|
|
12
|
+
className: "flex items-center justify-between mb-1",
|
|
13
|
+
children: [label && /* @__PURE__ */ jsx(InputLabel, {
|
|
14
|
+
label,
|
|
15
|
+
name,
|
|
16
|
+
required,
|
|
17
|
+
className: `ml-1 ${textSize === "sm" ? "text-sm!" : "text-base!"}`
|
|
18
|
+
}), info && /* @__PURE__ */ jsx(InputInfo, { info })]
|
|
19
|
+
}),
|
|
20
|
+
description && /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "text-login-100 **:text-xs! ml-1 mb-1",
|
|
22
|
+
children: /* @__PURE__ */ jsx(MarkdownRender, { MDstr: String(description || "") })
|
|
23
|
+
}),
|
|
24
|
+
children,
|
|
25
|
+
/* @__PURE__ */ jsx(InputError, {
|
|
26
|
+
error,
|
|
27
|
+
id: `${name}-error`
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { FieldWrapper as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/inputs/shared/inputError.tsx
|
|
3
|
+
function InputError({ error, id }) {
|
|
4
|
+
if (!error) return /* @__PURE__ */ jsx("div", { className: "h-4" });
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: "h-4",
|
|
7
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
8
|
+
id,
|
|
9
|
+
className: "text-xs text-red-400 ml-1 truncate block",
|
|
10
|
+
role: "alert",
|
|
11
|
+
title: error,
|
|
12
|
+
children: error
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { InputError as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CircleHelp } from "lucide-react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/inputs/shared/inputInfo.tsx
|
|
4
|
+
function InputInfo({ info }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: "text-login-200 hover:text-login-text transition-colors",
|
|
7
|
+
"aria-label": info,
|
|
8
|
+
title: info,
|
|
9
|
+
children: /* @__PURE__ */ jsx(CircleHelp, { className: "w-4 h-4" })
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { InputInfo as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/inputs/shared/inputLabel.tsx
|
|
3
|
+
function InputLabel({ label, name, required, disabled, className }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
5
|
+
htmlFor: name,
|
|
6
|
+
className: `text-sm font-medium text-login-text ${disabled ? "opacity-50 cursor-not-allowed" : ""} ${className || ""}`,
|
|
7
|
+
title: label,
|
|
8
|
+
children: [
|
|
9
|
+
label,
|
|
10
|
+
" ",
|
|
11
|
+
required && /* @__PURE__ */ jsx("span", {
|
|
12
|
+
className: "text-red-500",
|
|
13
|
+
children: "*"
|
|
14
|
+
})
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { InputLabel as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/components/inputs/switch.d.ts
|
|
2
|
+
type SwitchProps = Omit<React.ComponentProps<'input'>, 'name'> & {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
info?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
switchOnly?: boolean;
|
|
10
|
+
textSize?: 'sm' | 'md';
|
|
11
|
+
};
|
|
12
|
+
declare function Switch(props: SwitchProps): import("react").JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SwitchProps, Switch as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import FieldWrapper from "./shared/fieldWrapper.js";
|
|
2
|
+
import "./shared/index.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/inputs/switch.tsx
|
|
5
|
+
function Switch(props) {
|
|
6
|
+
const { name, label, error, info, description, className, switchOnly, textSize = "sm", ...inputProps } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx(FieldWrapper, {
|
|
8
|
+
label,
|
|
9
|
+
name,
|
|
10
|
+
required: inputProps.required,
|
|
11
|
+
info,
|
|
12
|
+
error,
|
|
13
|
+
description,
|
|
14
|
+
textSize,
|
|
15
|
+
className,
|
|
16
|
+
children: /* @__PURE__ */ jsxs("label", {
|
|
17
|
+
className: `group/sw inline-flex items-center cursor-pointer ${switchOnly ? "h-fit" : "h-10"}`,
|
|
18
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
19
|
+
...inputProps,
|
|
20
|
+
type: "checkbox",
|
|
21
|
+
id: name,
|
|
22
|
+
name,
|
|
23
|
+
className: "sr-only"
|
|
24
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: `
|
|
26
|
+
relative flex items-center w-11 h-6 rounded-full transition-colors
|
|
27
|
+
bg-login-600 group-has-[input:checked]/sw:bg-login
|
|
28
|
+
${inputProps.disabled ? "opacity-40 cursor-not-allowed" : ""}
|
|
29
|
+
${error ? "ring-1 ring-red-500/60" : ""}
|
|
30
|
+
`,
|
|
31
|
+
children: /* @__PURE__ */ jsx("span", { className: "\n absolute inset-y-0 my-auto left-0.5 h-5 w-5\n rounded-full bg-white shadow-sm transition-all\n group-has-[input:checked]/sw:translate-x-full\n " })
|
|
32
|
+
})]
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Switch as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/components/inputs/tagInput.d.ts
|
|
2
|
+
type TagInputProps = {
|
|
3
|
+
label?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
value?: string[];
|
|
6
|
+
onChange?: (value: string[]) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
info?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
textSize?: 'sm' | 'md';
|
|
15
|
+
};
|
|
16
|
+
declare function TagInput({
|
|
17
|
+
label,
|
|
18
|
+
name,
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
placeholder,
|
|
22
|
+
error,
|
|
23
|
+
className,
|
|
24
|
+
disabled,
|
|
25
|
+
required,
|
|
26
|
+
info,
|
|
27
|
+
description,
|
|
28
|
+
textSize
|
|
29
|
+
}: TagInputProps): import("react").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { TagInputProps, TagInput as default };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import FieldWrapper from "./shared/fieldWrapper.js";
|
|
3
|
+
import "./shared/index.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { X } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/inputs/tagInput.tsx
|
|
8
|
+
function TagInput({ label, name, value = [], onChange, placeholder = "Add...", error, className, disabled, required, info, description, textSize = "sm" }) {
|
|
9
|
+
const [inputValue, setInputValue] = useState("");
|
|
10
|
+
function handleKeyDown(e) {
|
|
11
|
+
if ((e.key === "Enter" || e.key === ",") && inputValue.trim()) {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
const val = inputValue.trim().replace(/,$/, "");
|
|
14
|
+
if (val && !value.includes(val)) {
|
|
15
|
+
const newValue = [...value, val];
|
|
16
|
+
if (onChange) onChange(newValue);
|
|
17
|
+
}
|
|
18
|
+
setInputValue("");
|
|
19
|
+
} else if (e.key === "Backspace" && !inputValue && value.length > 0) {
|
|
20
|
+
const newValue = value.slice(0, -1);
|
|
21
|
+
if (onChange) onChange(newValue);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function removeTag(index) {
|
|
25
|
+
if (disabled) return;
|
|
26
|
+
const newValue = value.filter((_, i) => i !== index);
|
|
27
|
+
if (onChange) onChange(newValue);
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, {
|
|
30
|
+
label,
|
|
31
|
+
name,
|
|
32
|
+
required,
|
|
33
|
+
info,
|
|
34
|
+
description,
|
|
35
|
+
error,
|
|
36
|
+
className,
|
|
37
|
+
textSize,
|
|
38
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: `
|
|
40
|
+
flex flex-wrap gap-2 p-2 rounded-md bg-login-500/50 border border-login-500
|
|
41
|
+
text-login-text min-h-10
|
|
42
|
+
focus-within:border-login/60 focus-within:ring-1 focus-within:ring-login/30
|
|
43
|
+
transition-all duration-150
|
|
44
|
+
${error ? "border-red-500/70 focus-within:border-red-500/70 focus-within:ring-red-500/30" : ""}
|
|
45
|
+
`,
|
|
46
|
+
children: [value.map((tag, index) => /* @__PURE__ */ jsxs("span", {
|
|
47
|
+
className: "flex items-center gap-1 px-2 py-0.5 bg-login-600 text-login-100 border border-login-500 rounded text-sm",
|
|
48
|
+
children: [tag, !disabled && /* @__PURE__ */ jsx("button", {
|
|
49
|
+
type: "button",
|
|
50
|
+
onClick: () => removeTag(index),
|
|
51
|
+
className: "hover:text-red-200 transition-colors",
|
|
52
|
+
children: /* @__PURE__ */ jsx(X, { size: 14 })
|
|
53
|
+
})]
|
|
54
|
+
}, index)), /* @__PURE__ */ jsx("input", {
|
|
55
|
+
type: "text",
|
|
56
|
+
value: inputValue,
|
|
57
|
+
required: required && value.length === 0,
|
|
58
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
59
|
+
onKeyDown: handleKeyDown,
|
|
60
|
+
disabled,
|
|
61
|
+
placeholder: value.length === 0 ? placeholder : "",
|
|
62
|
+
className: "flex-1 bg-transparent outline-none min-w-30 text-login-text placeholder:text-login-200"
|
|
63
|
+
})]
|
|
64
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
65
|
+
type: "hidden",
|
|
66
|
+
name,
|
|
67
|
+
value: value.join(",")
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { TagInput as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/components/inputs/textarea.d.ts
|
|
2
|
+
type TextareaProps = Omit<React.ComponentProps<'textarea'>, 'name'> & {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
info?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
type?: 'markdown' | 'json' | 'text';
|
|
10
|
+
textSize?: 'sm' | 'md';
|
|
11
|
+
};
|
|
12
|
+
declare function Textarea(props: TextareaProps): import("react").JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TextareaProps, Textarea as default };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import MarkdownRender from "../markdownrender/markdownRender.js";
|
|
3
|
+
import FieldWrapper from "./shared/fieldWrapper.js";
|
|
4
|
+
import "./shared/index.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Eye, Pencil } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/inputs/textarea.tsx
|
|
9
|
+
function isValidJson(str) {
|
|
10
|
+
try {
|
|
11
|
+
JSON.parse(str);
|
|
12
|
+
return null;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
return error.message;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function Textarea(props) {
|
|
18
|
+
const { name, label, error, className, info, description, type = "text", rows = 4, textSize = "sm", ...textareaProps } = props;
|
|
19
|
+
const { value } = textareaProps;
|
|
20
|
+
const [preview, setPreview] = useState(false);
|
|
21
|
+
const displayError = (type === "json" && value ? isValidJson(value) : void 0) || error;
|
|
22
|
+
return /* @__PURE__ */ jsx(FieldWrapper, {
|
|
23
|
+
label,
|
|
24
|
+
name,
|
|
25
|
+
required: textareaProps.required,
|
|
26
|
+
info,
|
|
27
|
+
description,
|
|
28
|
+
error: displayError,
|
|
29
|
+
textSize,
|
|
30
|
+
className,
|
|
31
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: "relative",
|
|
33
|
+
children: [
|
|
34
|
+
type === "markdown" && /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: "absolute right-2 top-2 z-10 flex gap-2",
|
|
36
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
onClick: () => setPreview(!preview),
|
|
39
|
+
className: "p-1 rounded hover:bg-login-500/50 text-login-text transition-colors",
|
|
40
|
+
title: preview ? "Edit" : "Preview",
|
|
41
|
+
children: preview ? /* @__PURE__ */ jsx(Pencil, { size: 16 }) : /* @__PURE__ */ jsx(Eye, { size: 16 })
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
type === "markdown" && preview && /* @__PURE__ */ jsx("div", {
|
|
45
|
+
className: `
|
|
46
|
+
w-full rounded-md bg-login-500/50 border border-login-500
|
|
47
|
+
p-3 overflow-y-auto ${error ? "border-red-500/70" : ""}
|
|
48
|
+
`,
|
|
49
|
+
children: /* @__PURE__ */ jsx(MarkdownRender, { MDstr: String(value || "") })
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
52
|
+
...textareaProps,
|
|
53
|
+
id: name,
|
|
54
|
+
name,
|
|
55
|
+
rows,
|
|
56
|
+
title: label,
|
|
57
|
+
"aria-invalid": !!error,
|
|
58
|
+
"aria-describedby": error ? `${name}-error` : void 0,
|
|
59
|
+
className: `
|
|
60
|
+
${type === "markdown" && preview ? "hidden" : ""}
|
|
61
|
+
w-full rounded-md bg-login-500/50 border border-login-500
|
|
62
|
+
text-login-text placeholder-login-200 text-sm
|
|
63
|
+
focus:outline-none focus:border-login/60 focus:ring-1 focus:ring-login/30
|
|
64
|
+
disabled:opacity-40 disabled:cursor-not-allowed
|
|
65
|
+
p-3 pr-10
|
|
66
|
+
transition-all duration-150
|
|
67
|
+
resize-y
|
|
68
|
+
${error ? "border-red-500/70 focus:border-red-500/70 focus:ring-red-500/30" : ""}
|
|
69
|
+
`
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { Textarea as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/components/inputs/toggle.d.ts
|
|
2
|
+
type ToggleOption<T> = {
|
|
3
|
+
value: T;
|
|
4
|
+
label?: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
type ToggleProps<T> = {
|
|
9
|
+
value: T;
|
|
10
|
+
onChange: (value: T) => void;
|
|
11
|
+
left: ToggleOption<T>;
|
|
12
|
+
right: ToggleOption<T>;
|
|
13
|
+
};
|
|
14
|
+
declare function Toggle<T>({
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
left,
|
|
18
|
+
right
|
|
19
|
+
}: ToggleProps<T>): import("react").JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Toggle as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/inputs/toggle.tsx
|
|
4
|
+
function Toggle({ value, onChange, left, right }) {
|
|
5
|
+
const active = "bg-login text-white shadow-sm";
|
|
6
|
+
const idle = "text-login-200 hover:text-login-50 hover:bg-login-500/50";
|
|
7
|
+
const base = "flex items-center justify-center rounded-md px-3 h-7 transition-all duration-150 gap-1.5 text-sm";
|
|
8
|
+
function renderContent(opt) {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [opt.icon, opt.text && /* @__PURE__ */ jsx("span", { children: opt.text })] });
|
|
10
|
+
}
|
|
11
|
+
const isLeftActive = value === left.value;
|
|
12
|
+
const isRightActive = value === right.value;
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
14
|
+
className: "flex items-center w-fit bg-login-500/50 border border-login-500 rounded-lg p-1 gap-0.5",
|
|
15
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
16
|
+
type: "button",
|
|
17
|
+
onClick: () => onChange(left.value),
|
|
18
|
+
"aria-label": left.label ?? left.text,
|
|
19
|
+
"aria-pressed": isLeftActive,
|
|
20
|
+
className: `${base} ${isLeftActive ? active : idle}`,
|
|
21
|
+
children: renderContent(left)
|
|
22
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
23
|
+
type: "button",
|
|
24
|
+
onClick: () => onChange(right.value),
|
|
25
|
+
"aria-label": right.label ?? right.text,
|
|
26
|
+
"aria-pressed": isRightActive,
|
|
27
|
+
className: `${base} ${isRightActive ? active : idle}`,
|
|
28
|
+
children: renderContent(right)
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Toggle as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LoginPageProps } from "uibee/components";
|
|
2
|
+
|
|
3
|
+
//#region src/components/login/loginPage.d.ts
|
|
4
|
+
declare function LoginPage({
|
|
5
|
+
title,
|
|
6
|
+
description,
|
|
7
|
+
redirectPath,
|
|
8
|
+
version,
|
|
9
|
+
btg,
|
|
10
|
+
handleSubmit,
|
|
11
|
+
guestRedirectPath,
|
|
12
|
+
guestText
|
|
13
|
+
}: LoginPageProps): import("react").JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { LoginPage as default };
|