@teach-in/react 1.2.0 → 1.3.0
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/LICENSE +21 -21
- package/README.md +9 -9
- package/dist/chunk-3YOW5DEZ.mjs +45 -0
- package/dist/{chunk-QCLLPJMB.mjs → chunk-544SDU73.mjs} +2 -2
- package/dist/{chunk-2CEZXLZR.mjs → chunk-AFVGHUW2.mjs} +1 -1
- package/dist/{chunk-IU2JYI7W.mjs → chunk-CETCW7DS.mjs} +1 -1
- package/dist/{chunk-5FFWQB7D.mjs → chunk-JDFRAN4S.mjs} +2 -12
- package/dist/{chunk-KTWHCUYV.mjs → chunk-KTUGFQWJ.mjs} +1 -1
- package/dist/{chunk-46SKVFMZ.mjs → chunk-LJIVY6GU.mjs} +1 -1
- package/dist/{chunk-CKJ5U5Q4.mjs → chunk-NLHQDWUK.mjs} +1 -1
- package/dist/{chunk-R46SWVWL.mjs → chunk-R7LDL5CU.mjs} +1 -1
- package/dist/chunk-V2G5QHZZ.mjs +14 -0
- package/dist/{chunk-2ASQXBDD.mjs → chunk-WFNNN6WU.mjs} +1 -1
- package/dist/index.js +230 -575
- package/dist/index.mjs +125 -141
- package/dist/ui/data/index.mjs +8 -8
- package/dist/ui/feedback/index.mjs +14 -14
- package/dist/ui/form/index.js +106 -447
- package/dist/ui/form/index.mjs +21 -31
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/email-field.js +10 -147
- package/dist/ui/form/rhf/fields/email-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/index.d.ts +0 -1
- package/dist/ui/form/rhf/fields/index.js +102 -443
- package/dist/ui/form/rhf/fields/index.mjs +21 -31
- package/dist/ui/form/rhf/fields/input-field.js +6 -153
- package/dist/ui/form/rhf/fields/input-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/radio-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/select-field.js +26 -136
- package/dist/ui/form/rhf/fields/select-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/switch-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/text-field.js +10 -147
- package/dist/ui/form/rhf/fields/text-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/textarea-field.mjs +14 -20
- package/dist/ui/form/rhf/index.js +102 -443
- package/dist/ui/form/rhf/index.mjs +21 -31
- package/dist/ui/format/index.mjs +3 -3
- package/dist/ui/index.js +230 -575
- package/dist/ui/index.mjs +125 -141
- package/dist/ui/inputs/checkbox/index.mjs +3 -3
- package/dist/ui/inputs/email/email.js +7 -144
- package/dist/ui/inputs/email/email.mjs +2 -4
- package/dist/ui/inputs/email/index.js +7 -144
- package/dist/ui/inputs/email/index.mjs +2 -4
- package/dist/ui/inputs/index.d.ts +0 -2
- package/dist/ui/inputs/index.js +56 -363
- package/dist/ui/inputs/index.mjs +25 -37
- package/dist/ui/inputs/input/index.js +3 -140
- package/dist/ui/inputs/input/index.mjs +1 -3
- package/dist/ui/inputs/input/input.d.ts +0 -1
- package/dist/ui/inputs/input/input.js +3 -140
- package/dist/ui/inputs/input/input.mjs +1 -3
- package/dist/ui/inputs/select/index.js +22 -132
- package/dist/ui/inputs/select/index.mjs +1 -3
- package/dist/ui/inputs/select/select.d.ts +0 -4
- package/dist/ui/inputs/select/select.js +22 -132
- package/dist/ui/inputs/select/select.mjs +1 -3
- package/dist/ui/inputs/text/index.js +7 -144
- package/dist/ui/inputs/text/index.mjs +2 -4
- package/dist/ui/inputs/text/text.js +7 -144
- package/dist/ui/inputs/text/text.mjs +2 -4
- package/dist/ui/layout/container/container.mjs +64 -71
- package/dist/ui/layout/container/index.mjs +64 -71
- package/dist/ui/layout/index.mjs +69 -76
- package/dist/ui/layout/page/index.mjs +3 -3
- package/dist/ui/layout/page/page-loading.mjs +3 -3
- package/dist/ui/layout/page/section-loading.mjs +3 -3
- package/dist/ui/navigation/index.mjs +5 -5
- package/dist/ui/overlays/index.mjs +4 -4
- package/dist/ui/provider/index.mjs +3 -3
- package/dist/ui/provider/ui-provider.mjs +3 -3
- package/dist/ui/theme/colors/common.mjs +3 -3
- package/dist/ui/theme/colors/index.mjs +6 -6
- package/dist/ui/theme/colors/semantic.mjs +4 -4
- package/dist/ui/theme/colors.mjs +6 -6
- package/dist/ui/theme/index.mjs +6 -6
- package/dist/ui/theme/theme.mjs +6 -6
- package/package.json +1 -1
- package/dist/chunk-2UHA3DYG.mjs +0 -62
- package/dist/chunk-C2VWADF5.mjs +0 -34
- package/dist/chunk-CUEG2BFV.mjs +0 -34
- package/dist/chunk-MCQGBAUS.mjs +0 -73
- package/dist/chunk-NSU66J5E.mjs +0 -59
- package/dist/chunk-SEJXJZSK.mjs +0 -64
- package/dist/chunk-TUIN5YJW.mjs +0 -33
- package/dist/chunk-UQAG7TKJ.mjs +0 -1
- package/dist/chunk-VXYV37IM.mjs +0 -74
- package/dist/ui/form/rhf/fields/search-field.d.ts +0 -10
- package/dist/ui/form/rhf/fields/search-field.js +0 -296
- package/dist/ui/form/rhf/fields/search-field.mjs +0 -37
- package/dist/ui/inputs/clear-button.d.ts +0 -5
- package/dist/ui/inputs/clear-button.js +0 -67
- package/dist/ui/inputs/clear-button.mjs +0 -8
- package/dist/ui/inputs/input/use-input.d.ts +0 -19
- package/dist/ui/inputs/input/use-input.js +0 -82
- package/dist/ui/inputs/input/use-input.mjs +0 -7
- package/dist/ui/inputs/search/index.d.ts +0 -1
- package/dist/ui/inputs/search/index.js +0 -270
- package/dist/ui/inputs/search/index.mjs +0 -13
- package/dist/ui/inputs/search/search.d.ts +0 -7
- package/dist/ui/inputs/search/search.js +0 -268
- package/dist/ui/inputs/search/search.mjs +0 -12
- package/dist/ui/inputs/search/use-search.d.ts +0 -12
- package/dist/ui/inputs/search/use-search.js +0 -57
- package/dist/ui/inputs/search/use-search.mjs +0 -7
- package/dist/ui/inputs/select/use-select.d.ts +0 -17
- package/dist/ui/inputs/select/use-select.js +0 -85
- package/dist/ui/inputs/select/use-select.mjs +0 -7
- package/dist/{chunk-IXPMUODA.mjs → chunk-5WDV3PDI.mjs} +6 -6
- /package/dist/{chunk-5RNCFTW5.mjs → chunk-CZEO3U25.mjs} +0 -0
- /package/dist/{chunk-PTCNYQVY.mjs → chunk-Q6JSJOU4.mjs} +0 -0
|
@@ -37,7 +37,6 @@ __export(fields_exports, {
|
|
|
37
37
|
EmailField: () => EmailField,
|
|
38
38
|
InputField: () => InputField,
|
|
39
39
|
RadioField: () => RadioField,
|
|
40
|
-
SearchField: () => SearchField,
|
|
41
40
|
SelectField: () => SelectField,
|
|
42
41
|
SwitchField: () => SwitchField,
|
|
43
42
|
TextField: () => TextField,
|
|
@@ -83,361 +82,58 @@ var DatePicker = import_react3.default.forwardRef(
|
|
|
83
82
|
DatePicker.displayName = "TeachInUI.DatePicker";
|
|
84
83
|
|
|
85
84
|
// src/ui/inputs/email/email.tsx
|
|
86
|
-
var
|
|
85
|
+
var import_react5 = __toESM(require("react"));
|
|
87
86
|
|
|
88
87
|
// src/ui/inputs/input/input.tsx
|
|
89
|
-
var import_react6 = __toESM(require("react"));
|
|
90
|
-
var import_input = require("@heroui/input");
|
|
91
|
-
var import_tailwind_variants = require("tailwind-variants");
|
|
92
|
-
|
|
93
|
-
// src/ui/inputs/clear-button.tsx
|
|
94
88
|
var import_react4 = __toESM(require("react"));
|
|
95
|
-
var
|
|
96
|
-
var import_lucide_react = require("lucide-react");
|
|
89
|
+
var import_input = require("@heroui/input");
|
|
97
90
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
101
|
-
import_button.Button,
|
|
102
|
-
{
|
|
103
|
-
ref,
|
|
104
|
-
isIconOnly: true,
|
|
105
|
-
"aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
106
|
-
as: "span",
|
|
107
|
-
className: "opacity-0 transition-opacity group-hover:opacity-100",
|
|
108
|
-
color: "default",
|
|
109
|
-
radius: "full",
|
|
110
|
-
size: "sm",
|
|
111
|
-
tabIndex: 0,
|
|
112
|
-
variant: "light",
|
|
113
|
-
onPress: onClear,
|
|
114
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
ClearButton.displayName = "TeachInUI.ClearButton";
|
|
120
|
-
|
|
121
|
-
// src/ui/inputs/input/use-input.ts
|
|
122
|
-
var import_react5 = require("react");
|
|
123
|
-
function useInput({
|
|
124
|
-
value,
|
|
125
|
-
defaultValue,
|
|
126
|
-
onValueChange,
|
|
127
|
-
onClear,
|
|
128
|
-
isReadOnly,
|
|
129
|
-
isClearable = true,
|
|
130
|
-
ref
|
|
131
|
-
}) {
|
|
132
|
-
const inputRef = (0, import_react5.useRef)(null);
|
|
133
|
-
const [internalValue, setInternalValue] = (0, import_react5.useState)(defaultValue != null ? defaultValue : "");
|
|
134
|
-
const isControlled = value !== void 0;
|
|
135
|
-
const currentValue = isControlled ? value : internalValue;
|
|
136
|
-
const hasValue = String(currentValue).length > 0;
|
|
137
|
-
const handleValueChange = (0, import_react5.useCallback)(
|
|
138
|
-
(newValue) => {
|
|
139
|
-
if (!isControlled) {
|
|
140
|
-
setInternalValue(newValue);
|
|
141
|
-
}
|
|
142
|
-
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
143
|
-
},
|
|
144
|
-
[isControlled, onValueChange]
|
|
145
|
-
);
|
|
146
|
-
const handleClear = (0, import_react5.useCallback)(() => {
|
|
147
|
-
var _a;
|
|
148
|
-
onClear == null ? void 0 : onClear();
|
|
149
|
-
handleValueChange("");
|
|
150
|
-
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
151
|
-
}, [onClear, handleValueChange]);
|
|
152
|
-
const mergedRef = (0, import_react5.useCallback)(
|
|
153
|
-
(node) => {
|
|
154
|
-
inputRef.current = node;
|
|
155
|
-
if (typeof ref === "function") {
|
|
156
|
-
ref(node);
|
|
157
|
-
} else if (ref) {
|
|
158
|
-
ref.current = node;
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
[ref]
|
|
162
|
-
);
|
|
163
|
-
const showClearButton = hasValue && !isReadOnly && isClearable;
|
|
164
|
-
return {
|
|
165
|
-
inputRef,
|
|
166
|
-
currentValue,
|
|
167
|
-
hasValue,
|
|
168
|
-
handleValueChange,
|
|
169
|
-
handleClear,
|
|
170
|
-
mergedRef,
|
|
171
|
-
showClearButton
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// src/ui/inputs/input/input.tsx
|
|
176
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
177
|
-
var inputWrapperVariants = (0, import_tailwind_variants.tv)({
|
|
178
|
-
variants: {
|
|
179
|
-
variant: {
|
|
180
|
-
flat: "",
|
|
181
|
-
underlined: "",
|
|
182
|
-
bordered: "border-1",
|
|
183
|
-
faded: "border-1"
|
|
184
|
-
}
|
|
185
|
-
}
|
|
91
|
+
var Input = import_react4.default.forwardRef(({ ...props }, ref) => {
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_input.Input, { ref, ...props });
|
|
186
93
|
});
|
|
187
|
-
var Input = import_react6.default.forwardRef(
|
|
188
|
-
({
|
|
189
|
-
value,
|
|
190
|
-
defaultValue,
|
|
191
|
-
onClear,
|
|
192
|
-
onValueChange,
|
|
193
|
-
variant,
|
|
194
|
-
classNames,
|
|
195
|
-
endContent,
|
|
196
|
-
isReadOnly,
|
|
197
|
-
isClearable,
|
|
198
|
-
...props
|
|
199
|
-
}, ref) => {
|
|
200
|
-
const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
|
|
201
|
-
value,
|
|
202
|
-
defaultValue,
|
|
203
|
-
onValueChange,
|
|
204
|
-
onClear,
|
|
205
|
-
isReadOnly,
|
|
206
|
-
isClearable,
|
|
207
|
-
ref
|
|
208
|
-
});
|
|
209
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
210
|
-
import_input.Input,
|
|
211
|
-
{
|
|
212
|
-
ref: mergedRef,
|
|
213
|
-
classNames: {
|
|
214
|
-
...classNames,
|
|
215
|
-
inputWrapper: inputWrapperVariants({ variant }),
|
|
216
|
-
innerWrapper: "group"
|
|
217
|
-
},
|
|
218
|
-
defaultValue,
|
|
219
|
-
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
220
|
-
endContent,
|
|
221
|
-
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton, { onClear: handleClear })
|
|
222
|
-
] }),
|
|
223
|
-
isReadOnly,
|
|
224
|
-
value: currentValue,
|
|
225
|
-
variant,
|
|
226
|
-
onValueChange: handleValueChange,
|
|
227
|
-
...props
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
);
|
|
232
94
|
Input.displayName = "TeachInUI.Input";
|
|
233
95
|
|
|
234
96
|
// src/ui/inputs/email/email.tsx
|
|
235
|
-
var
|
|
236
|
-
var Email =
|
|
237
|
-
return /* @__PURE__ */ (0,
|
|
97
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
98
|
+
var Email = import_react5.default.forwardRef(({ ...props }, ref) => {
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Input, { ref, autoComplete: "email", type: "email", ...props });
|
|
238
100
|
});
|
|
239
101
|
Email.displayName = "TeachInUI.Email";
|
|
240
102
|
|
|
241
|
-
// src/ui/inputs/search/search.tsx
|
|
242
|
-
var import_react9 = __toESM(require("react"));
|
|
243
|
-
var import_lucide_react2 = require("lucide-react");
|
|
244
|
-
var import_button2 = require("@heroui/button");
|
|
245
|
-
var import_tailwind_variants2 = require("tailwind-variants");
|
|
246
|
-
|
|
247
|
-
// src/ui/inputs/search/use-search.ts
|
|
248
|
-
var import_react8 = require("react");
|
|
249
|
-
function useSearch({ value, onSearch, onCancel, onKeyDown }) {
|
|
250
|
-
const handleKeyDown = (0, import_react8.useCallback)(
|
|
251
|
-
(event) => {
|
|
252
|
-
if (event.key === "Enter") {
|
|
253
|
-
event.preventDefault();
|
|
254
|
-
onSearch == null ? void 0 : onSearch(event.target.value);
|
|
255
|
-
} else if (event.key === "Escape") {
|
|
256
|
-
event.preventDefault();
|
|
257
|
-
onCancel == null ? void 0 : onCancel();
|
|
258
|
-
}
|
|
259
|
-
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
260
|
-
},
|
|
261
|
-
[onSearch, onCancel, onKeyDown]
|
|
262
|
-
);
|
|
263
|
-
const hasValue = value !== void 0 && String(value).length > 0;
|
|
264
|
-
const handleSearchClick = (0, import_react8.useCallback)(() => {
|
|
265
|
-
if (hasValue) {
|
|
266
|
-
onSearch == null ? void 0 : onSearch(value);
|
|
267
|
-
}
|
|
268
|
-
}, [value, onSearch]);
|
|
269
|
-
return {
|
|
270
|
-
handleKeyDown,
|
|
271
|
-
handleSearchClick,
|
|
272
|
-
hasValue
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// src/ui/inputs/search/search.tsx
|
|
277
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
278
|
-
var searchIconVariants = (0, import_tailwind_variants2.tv)({
|
|
279
|
-
base: "size-5 shrink-0",
|
|
280
|
-
variants: {
|
|
281
|
-
variant: {
|
|
282
|
-
faded: "text-default-400",
|
|
283
|
-
flat: "text-default-foreground",
|
|
284
|
-
bordered: "text-default-400",
|
|
285
|
-
underlined: "text-default-foreground"
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
var Search = import_react9.default.forwardRef(
|
|
290
|
-
({ variant = "bordered", radius = "full", value, onSearch, onCancel, onKeyDown, ...props }, ref) => {
|
|
291
|
-
const { handleKeyDown, handleSearchClick, hasValue } = useSearch({
|
|
292
|
-
value,
|
|
293
|
-
onSearch,
|
|
294
|
-
onCancel,
|
|
295
|
-
onKeyDown
|
|
296
|
-
});
|
|
297
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
298
|
-
Input,
|
|
299
|
-
{
|
|
300
|
-
ref,
|
|
301
|
-
radius,
|
|
302
|
-
startContent: onSearch ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
303
|
-
import_button2.Button,
|
|
304
|
-
{
|
|
305
|
-
isIconOnly: true,
|
|
306
|
-
"aria-label": "\u041F\u043E\u0438\u0441\u043A",
|
|
307
|
-
isDisabled: !hasValue,
|
|
308
|
-
radius: "full",
|
|
309
|
-
size: "sm",
|
|
310
|
-
variant: "light",
|
|
311
|
-
onPress: handleSearchClick,
|
|
312
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) })
|
|
313
|
-
}
|
|
314
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) }),
|
|
315
|
-
value,
|
|
316
|
-
variant,
|
|
317
|
-
onKeyDown: handleKeyDown,
|
|
318
|
-
...props
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
);
|
|
323
|
-
Search.displayName = "TeachInUI.Search";
|
|
324
|
-
|
|
325
103
|
// src/ui/inputs/select/select.tsx
|
|
326
|
-
var
|
|
104
|
+
var import_react6 = __toESM(require("react"));
|
|
327
105
|
var import_select = require("@heroui/select");
|
|
328
|
-
var
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
if (isMultiple) {
|
|
352
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
353
|
-
} else {
|
|
354
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
[isControlled, onChange, isMultiple]
|
|
358
|
-
);
|
|
359
|
-
const handleClear = (0, import_react10.useCallback)(() => {
|
|
360
|
-
onClear == null ? void 0 : onClear();
|
|
361
|
-
handleChange(isMultiple ? [] : null);
|
|
362
|
-
}, [onClear, handleChange, isMultiple]);
|
|
363
|
-
const selectedKeys = (0, import_react10.useMemo)(() => {
|
|
364
|
-
if (currentValue == null) return /* @__PURE__ */ new Set();
|
|
365
|
-
return new Set(Array.isArray(currentValue) ? currentValue : [currentValue]);
|
|
366
|
-
}, [currentValue]);
|
|
367
|
-
const handleSelectionChange = (0, import_react10.useCallback)(
|
|
368
|
-
(keys) => {
|
|
369
|
-
var _a;
|
|
370
|
-
if (keys === "all") return;
|
|
371
|
-
const selected = Array.from(keys).filter((key) => typeof key === "string");
|
|
372
|
-
handleChange(isMultiple ? selected : (_a = selected[0]) != null ? _a : null);
|
|
373
|
-
},
|
|
374
|
-
[handleChange, isMultiple]
|
|
375
|
-
);
|
|
376
|
-
const showClearButton = hasValue && isClearable;
|
|
377
|
-
return {
|
|
378
|
-
currentValue,
|
|
379
|
-
hasValue,
|
|
380
|
-
selectedKeys,
|
|
381
|
-
handleSelectionChange,
|
|
382
|
-
handleClear,
|
|
383
|
-
showClearButton
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// src/ui/inputs/select/select.tsx
|
|
388
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
389
|
-
var selectWrapperVariants = (0, import_tailwind_variants3.tv)({
|
|
390
|
-
variants: {
|
|
391
|
-
variant: {
|
|
392
|
-
flat: "",
|
|
393
|
-
underlined: "",
|
|
394
|
-
bordered: "border-1",
|
|
395
|
-
faded: "border-1"
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
var Select = import_react11.default.forwardRef(
|
|
400
|
-
({
|
|
401
|
-
value,
|
|
402
|
-
defaultSelectedKeys,
|
|
403
|
-
items,
|
|
404
|
-
onChange,
|
|
405
|
-
selectionMode,
|
|
406
|
-
onClear,
|
|
407
|
-
variant,
|
|
408
|
-
classNames,
|
|
409
|
-
endContent,
|
|
410
|
-
isClearable,
|
|
411
|
-
...props
|
|
412
|
-
}, ref) => {
|
|
413
|
-
const { selectedKeys, handleSelectionChange, handleClear, showClearButton } = useSelect({
|
|
414
|
-
value,
|
|
415
|
-
onChange,
|
|
416
|
-
onClear,
|
|
417
|
-
selectionMode,
|
|
418
|
-
isClearable
|
|
419
|
-
});
|
|
420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
106
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
107
|
+
var Select = import_react6.default.forwardRef(
|
|
108
|
+
({ value, items, onChange, selectionMode, ...props }, ref) => {
|
|
109
|
+
const isMultiple = selectionMode === "multiple";
|
|
110
|
+
const selectedKeys = import_react6.default.useMemo(() => {
|
|
111
|
+
if (value == null) return /* @__PURE__ */ new Set();
|
|
112
|
+
return new Set(Array.isArray(value) ? value : [value]);
|
|
113
|
+
}, [value]);
|
|
114
|
+
const handleSelectionChange = import_react6.default.useCallback(
|
|
115
|
+
(keys) => {
|
|
116
|
+
var _a;
|
|
117
|
+
if (keys === "all") return;
|
|
118
|
+
const selected = Array.from(keys).filter((key) => typeof key === "string");
|
|
119
|
+
if (isMultiple) {
|
|
120
|
+
onChange == null ? void 0 : onChange(selected);
|
|
121
|
+
} else {
|
|
122
|
+
onChange == null ? void 0 : onChange((_a = selected[0]) != null ? _a : null);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
[onChange, isMultiple]
|
|
126
|
+
);
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
421
128
|
import_select.Select,
|
|
422
129
|
{
|
|
423
130
|
ref,
|
|
424
|
-
classNames: {
|
|
425
|
-
...classNames,
|
|
426
|
-
trigger: selectWrapperVariants({ variant }),
|
|
427
|
-
innerWrapper: "group"
|
|
428
|
-
},
|
|
429
|
-
defaultSelectedKeys,
|
|
430
|
-
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
431
|
-
endContent,
|
|
432
|
-
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ClearButton, { onClear: handleClear })
|
|
433
|
-
] }),
|
|
434
131
|
items,
|
|
435
132
|
selectedKeys,
|
|
436
133
|
selectionMode,
|
|
437
|
-
variant,
|
|
438
134
|
onSelectionChange: handleSelectionChange,
|
|
439
135
|
...props,
|
|
440
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
136
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_select.SelectItem, { children: item.label }, item.key)
|
|
441
137
|
}
|
|
442
138
|
);
|
|
443
139
|
}
|
|
@@ -445,64 +141,54 @@ var Select = import_react11.default.forwardRef(
|
|
|
445
141
|
Select.displayName = "TeachInUI.Select";
|
|
446
142
|
|
|
447
143
|
// src/ui/inputs/switch/switch.tsx
|
|
448
|
-
var
|
|
144
|
+
var import_react7 = __toESM(require("react"));
|
|
449
145
|
var import_switch = require("@heroui/switch");
|
|
450
|
-
var
|
|
451
|
-
var Switch =
|
|
452
|
-
return /* @__PURE__ */ (0,
|
|
146
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
147
|
+
var Switch = import_react7.default.forwardRef(({ ...props }, ref) => {
|
|
148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_switch.Switch, { ref, ...props });
|
|
453
149
|
});
|
|
454
150
|
Switch.displayName = "TeachInUI.Switch";
|
|
455
151
|
|
|
456
152
|
// src/ui/inputs/radio/radio-group.tsx
|
|
457
|
-
var
|
|
153
|
+
var import_react8 = __toESM(require("react"));
|
|
458
154
|
var import_radio = require("@heroui/radio");
|
|
459
|
-
var
|
|
460
|
-
var RadioGroup =
|
|
155
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
156
|
+
var RadioGroup = import_react8.default.forwardRef(
|
|
461
157
|
(props, ref) => {
|
|
462
|
-
return /* @__PURE__ */ (0,
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_radio.RadioGroup, { ref, ...props });
|
|
463
159
|
}
|
|
464
160
|
);
|
|
465
161
|
RadioGroup.displayName = "TeachInUI.RadioGroup";
|
|
466
162
|
|
|
467
163
|
// src/ui/inputs/text/text.tsx
|
|
468
|
-
var
|
|
469
|
-
var
|
|
470
|
-
var Text =
|
|
471
|
-
return /* @__PURE__ */ (0,
|
|
164
|
+
var import_react9 = __toESM(require("react"));
|
|
165
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
166
|
+
var Text = import_react9.default.forwardRef(({ ...props }, ref) => {
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Input, { ref, type: "text", ...props });
|
|
472
168
|
});
|
|
473
169
|
Text.displayName = "TeachInUI.Text";
|
|
474
170
|
|
|
475
171
|
// src/ui/inputs/textarea/textarea.tsx
|
|
476
|
-
var
|
|
477
|
-
var
|
|
478
|
-
var
|
|
479
|
-
var Textarea =
|
|
172
|
+
var import_input5 = require("@heroui/input");
|
|
173
|
+
var import_react10 = __toESM(require("react"));
|
|
174
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
175
|
+
var Textarea = import_react10.default.forwardRef(
|
|
480
176
|
({ minRows = 4, ...props }, ref) => {
|
|
481
|
-
return /* @__PURE__ */ (0,
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_input5.Textarea, { ref, minRows, ...props });
|
|
482
178
|
}
|
|
483
179
|
);
|
|
484
180
|
Textarea.displayName = "TeachInUI.Textarea";
|
|
485
181
|
|
|
486
182
|
// src/ui/form/rhf/fields/input-field.tsx
|
|
487
|
-
var
|
|
183
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
488
184
|
function InputField({ name, ...props }) {
|
|
489
185
|
const { control } = (0, import_react_hook_form.useFormContext)();
|
|
490
|
-
return /* @__PURE__ */ (0,
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
491
187
|
import_react_hook_form.Controller,
|
|
492
188
|
{
|
|
493
189
|
control,
|
|
494
190
|
name,
|
|
495
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
496
|
-
Input,
|
|
497
|
-
{
|
|
498
|
-
...props,
|
|
499
|
-
...field,
|
|
500
|
-
ref,
|
|
501
|
-
errorMessage: error == null ? void 0 : error.message,
|
|
502
|
-
isInvalid: !!error,
|
|
503
|
-
onValueChange: field.onChange
|
|
504
|
-
}
|
|
505
|
-
)
|
|
191
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
|
|
506
192
|
}
|
|
507
193
|
);
|
|
508
194
|
}
|
|
@@ -510,15 +196,15 @@ InputField.displayName = "TeachInUI.InputField";
|
|
|
510
196
|
|
|
511
197
|
// src/ui/form/rhf/fields/text-field.tsx
|
|
512
198
|
var import_react_hook_form2 = require("react-hook-form");
|
|
513
|
-
var
|
|
199
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
514
200
|
function TextField({ name, ...props }) {
|
|
515
201
|
const { control } = (0, import_react_hook_form2.useFormContext)();
|
|
516
|
-
return /* @__PURE__ */ (0,
|
|
202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
517
203
|
import_react_hook_form2.Controller,
|
|
518
204
|
{
|
|
519
205
|
control,
|
|
520
206
|
name,
|
|
521
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
207
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
|
|
522
208
|
}
|
|
523
209
|
);
|
|
524
210
|
}
|
|
@@ -526,57 +212,31 @@ TextField.displayName = "TeachInUI.TextField";
|
|
|
526
212
|
|
|
527
213
|
// src/ui/form/rhf/fields/email-field.tsx
|
|
528
214
|
var import_react_hook_form3 = require("react-hook-form");
|
|
529
|
-
var
|
|
215
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
530
216
|
function EmailField({ name, ...props }) {
|
|
531
217
|
const { control } = (0, import_react_hook_form3.useFormContext)();
|
|
532
|
-
return /* @__PURE__ */ (0,
|
|
218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
533
219
|
import_react_hook_form3.Controller,
|
|
534
220
|
{
|
|
535
221
|
control,
|
|
536
222
|
name,
|
|
537
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
223
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Email, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
|
|
538
224
|
}
|
|
539
225
|
);
|
|
540
226
|
}
|
|
541
227
|
EmailField.displayName = "TeachInUI.EmailField";
|
|
542
228
|
|
|
543
|
-
// src/ui/form/rhf/fields/
|
|
229
|
+
// src/ui/form/rhf/fields/textarea-field.tsx
|
|
544
230
|
var import_react_hook_form4 = require("react-hook-form");
|
|
545
|
-
var
|
|
546
|
-
function
|
|
231
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
232
|
+
function TextareaField({ name, ...props }) {
|
|
547
233
|
const { control } = (0, import_react_hook_form4.useFormContext)();
|
|
548
|
-
return /* @__PURE__ */ (0,
|
|
234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
549
235
|
import_react_hook_form4.Controller,
|
|
550
236
|
{
|
|
551
237
|
control,
|
|
552
238
|
name,
|
|
553
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
554
|
-
Search,
|
|
555
|
-
{
|
|
556
|
-
...props,
|
|
557
|
-
...field,
|
|
558
|
-
ref,
|
|
559
|
-
errorMessage: error == null ? void 0 : error.message,
|
|
560
|
-
isInvalid: !!error,
|
|
561
|
-
onValueChange: field.onChange
|
|
562
|
-
}
|
|
563
|
-
)
|
|
564
|
-
}
|
|
565
|
-
);
|
|
566
|
-
}
|
|
567
|
-
SearchField.displayName = "TeachInUI.SearchField";
|
|
568
|
-
|
|
569
|
-
// src/ui/form/rhf/fields/textarea-field.tsx
|
|
570
|
-
var import_react_hook_form5 = require("react-hook-form");
|
|
571
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
572
|
-
function TextareaField({ name, ...props }) {
|
|
573
|
-
const { control } = (0, import_react_hook_form5.useFormContext)();
|
|
574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
575
|
-
import_react_hook_form5.Controller,
|
|
576
|
-
{
|
|
577
|
-
control,
|
|
578
|
-
name,
|
|
579
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
239
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
580
240
|
Textarea,
|
|
581
241
|
{
|
|
582
242
|
...props,
|
|
@@ -592,16 +252,16 @@ function TextareaField({ name, ...props }) {
|
|
|
592
252
|
TextareaField.displayName = "TeachInUI.TextareaField";
|
|
593
253
|
|
|
594
254
|
// src/ui/form/rhf/fields/select-field.tsx
|
|
595
|
-
var
|
|
596
|
-
var
|
|
255
|
+
var import_react_hook_form5 = require("react-hook-form");
|
|
256
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
597
257
|
function SelectField({ name, selectionMode, ...props }) {
|
|
598
|
-
const { control } = (0,
|
|
599
|
-
return /* @__PURE__ */ (0,
|
|
600
|
-
|
|
258
|
+
const { control } = (0, import_react_hook_form5.useFormContext)();
|
|
259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
260
|
+
import_react_hook_form5.Controller,
|
|
601
261
|
{
|
|
602
262
|
control,
|
|
603
263
|
name,
|
|
604
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
264
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
605
265
|
Select,
|
|
606
266
|
{
|
|
607
267
|
selectionMode,
|
|
@@ -618,16 +278,16 @@ function SelectField({ name, selectionMode, ...props }) {
|
|
|
618
278
|
SelectField.displayName = "TeachInUI.SelectField";
|
|
619
279
|
|
|
620
280
|
// src/ui/form/rhf/fields/autocomplete-field.tsx
|
|
621
|
-
var
|
|
622
|
-
var
|
|
281
|
+
var import_react_hook_form6 = require("react-hook-form");
|
|
282
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
623
283
|
function AutocompleteField({ name, ...props }) {
|
|
624
|
-
const { control } = (0,
|
|
625
|
-
return /* @__PURE__ */ (0,
|
|
626
|
-
|
|
284
|
+
const { control } = (0, import_react_hook_form6.useFormContext)();
|
|
285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
286
|
+
import_react_hook_form6.Controller,
|
|
627
287
|
{
|
|
628
288
|
control,
|
|
629
289
|
name,
|
|
630
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
290
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
631
291
|
Autocomplete,
|
|
632
292
|
{
|
|
633
293
|
...props,
|
|
@@ -643,16 +303,16 @@ function AutocompleteField({ name, ...props }) {
|
|
|
643
303
|
AutocompleteField.displayName = "TeachInUI.AutocompleteField";
|
|
644
304
|
|
|
645
305
|
// src/ui/form/rhf/fields/date-picker-field.tsx
|
|
646
|
-
var
|
|
647
|
-
var
|
|
306
|
+
var import_react_hook_form7 = require("react-hook-form");
|
|
307
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
648
308
|
function DatePickerField({ name, ...props }) {
|
|
649
|
-
const { control } = (0,
|
|
650
|
-
return /* @__PURE__ */ (0,
|
|
651
|
-
|
|
309
|
+
const { control } = (0, import_react_hook_form7.useFormContext)();
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
311
|
+
import_react_hook_form7.Controller,
|
|
652
312
|
{
|
|
653
313
|
control,
|
|
654
314
|
name,
|
|
655
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
315
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
656
316
|
DatePicker,
|
|
657
317
|
{
|
|
658
318
|
...props,
|
|
@@ -668,18 +328,18 @@ function DatePickerField({ name, ...props }) {
|
|
|
668
328
|
DatePickerField.displayName = "TeachInUI.DatePickerField";
|
|
669
329
|
|
|
670
330
|
// src/ui/form/rhf/fields/checkbox-field.tsx
|
|
671
|
-
var
|
|
672
|
-
var
|
|
331
|
+
var import_react_hook_form8 = require("react-hook-form");
|
|
332
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
673
333
|
function CheckboxField({ name, ...props }) {
|
|
674
|
-
const { control } = (0,
|
|
675
|
-
return /* @__PURE__ */ (0,
|
|
676
|
-
|
|
334
|
+
const { control } = (0, import_react_hook_form8.useFormContext)();
|
|
335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
336
|
+
import_react_hook_form8.Controller,
|
|
677
337
|
{
|
|
678
338
|
control,
|
|
679
339
|
name,
|
|
680
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
681
|
-
/* @__PURE__ */ (0,
|
|
682
|
-
error && /* @__PURE__ */ (0,
|
|
340
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Checkbox, { ...props, isSelected: field.value, onValueChange: field.onChange }),
|
|
342
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-tiny text-danger", children: error.message })
|
|
683
343
|
] })
|
|
684
344
|
}
|
|
685
345
|
);
|
|
@@ -687,18 +347,18 @@ function CheckboxField({ name, ...props }) {
|
|
|
687
347
|
CheckboxField.displayName = "TeachInUI.CheckboxField";
|
|
688
348
|
|
|
689
349
|
// src/ui/form/rhf/fields/switch-field.tsx
|
|
690
|
-
var
|
|
691
|
-
var
|
|
350
|
+
var import_react_hook_form9 = require("react-hook-form");
|
|
351
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
692
352
|
function SwitchField({ name, ...props }) {
|
|
693
|
-
const { control } = (0,
|
|
694
|
-
return /* @__PURE__ */ (0,
|
|
695
|
-
|
|
353
|
+
const { control } = (0, import_react_hook_form9.useFormContext)();
|
|
354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
355
|
+
import_react_hook_form9.Controller,
|
|
696
356
|
{
|
|
697
357
|
control,
|
|
698
358
|
name,
|
|
699
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
700
|
-
/* @__PURE__ */ (0,
|
|
701
|
-
error && /* @__PURE__ */ (0,
|
|
359
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Switch, { ...props, isSelected: field.value, onValueChange: field.onChange }),
|
|
361
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-tiny text-danger", children: error.message })
|
|
702
362
|
] })
|
|
703
363
|
}
|
|
704
364
|
);
|
|
@@ -706,16 +366,16 @@ function SwitchField({ name, ...props }) {
|
|
|
706
366
|
SwitchField.displayName = "TeachInUI.SwitchField";
|
|
707
367
|
|
|
708
368
|
// src/ui/form/rhf/fields/radio-field.tsx
|
|
709
|
-
var
|
|
710
|
-
var
|
|
369
|
+
var import_react_hook_form10 = require("react-hook-form");
|
|
370
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
711
371
|
function RadioField({ name, ...props }) {
|
|
712
|
-
const { control } = (0,
|
|
713
|
-
return /* @__PURE__ */ (0,
|
|
714
|
-
|
|
372
|
+
const { control } = (0, import_react_hook_form10.useFormContext)();
|
|
373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
374
|
+
import_react_hook_form10.Controller,
|
|
715
375
|
{
|
|
716
376
|
control,
|
|
717
377
|
name,
|
|
718
|
-
render: ({ field: { ref, value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
378
|
+
render: ({ field: { ref, value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
719
379
|
RadioGroup,
|
|
720
380
|
{
|
|
721
381
|
...props,
|
|
@@ -739,7 +399,6 @@ RadioField.displayName = "TeachInUI.RadioField";
|
|
|
739
399
|
EmailField,
|
|
740
400
|
InputField,
|
|
741
401
|
RadioField,
|
|
742
|
-
SearchField,
|
|
743
402
|
SelectField,
|
|
744
403
|
SwitchField,
|
|
745
404
|
TextField,
|