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