@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
@@ -37,6 +37,7 @@ __export(rhf_exports, {
37
37
  EmailField: () => EmailField,
38
38
  InputField: () => InputField,
39
39
  RadioField: () => RadioField,
40
+ SearchField: () => SearchField,
40
41
  SelectField: () => SelectField,
41
42
  SwitchField: () => SwitchField,
42
43
  TextField: () => TextField,
@@ -82,58 +83,361 @@ var DatePicker = import_react3.default.forwardRef(
82
83
  DatePicker.displayName = "TeachInUI.DatePicker";
83
84
 
84
85
  // src/ui/inputs/email/email.tsx
85
- var import_react5 = __toESM(require("react"));
86
+ var import_react7 = __toESM(require("react"));
86
87
 
87
88
  // src/ui/inputs/input/input.tsx
88
- var import_react4 = __toESM(require("react"));
89
+ var import_react6 = __toESM(require("react"));
89
90
  var import_input = require("@heroui/input");
91
+ var import_tailwind_variants = require("tailwind-variants");
92
+
93
+ // src/ui/inputs/clear-button.tsx
94
+ var import_react4 = __toESM(require("react"));
95
+ var import_button = require("@heroui/button");
96
+ var import_lucide_react = require("lucide-react");
90
97
  var import_jsx_runtime4 = require("react/jsx-runtime");
91
- var Input = import_react4.default.forwardRef(({ ...props }, ref) => {
92
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_input.Input, { ref, ...props });
98
+ var ClearButton = import_react4.default.forwardRef(
99
+ ({ onClear }, ref) => {
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
+ }
93
186
  });
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
+ );
94
232
  Input.displayName = "TeachInUI.Input";
95
233
 
96
234
  // src/ui/inputs/email/email.tsx
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 });
235
+ var import_jsx_runtime6 = require("react/jsx-runtime");
236
+ var Email = import_react7.default.forwardRef(({ ...props }, ref) => {
237
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Input, { ref, autoComplete: "email", type: "email", ...props });
100
238
  });
101
239
  Email.displayName = "TeachInUI.Email";
102
240
 
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
+
103
325
  // src/ui/inputs/select/select.tsx
104
- var import_react6 = __toESM(require("react"));
326
+ var import_react11 = __toESM(require("react"));
105
327
  var import_select = require("@heroui/select");
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)(
328
+ var import_tailwind_variants3 = require("tailwind-variants");
329
+
330
+ // src/ui/inputs/select/use-select.ts
331
+ var import_react10 = require("react");
332
+ function useSelect({
333
+ value,
334
+ onChange,
335
+ onClear,
336
+ selectionMode,
337
+ isClearable = true
338
+ }) {
339
+ const isMultiple = selectionMode === "multiple";
340
+ const [internalValue, setInternalValue] = (0, import_react10.useState)(
341
+ isMultiple ? [] : null
342
+ );
343
+ const isControlled = value !== void 0;
344
+ const currentValue = isControlled ? value : internalValue;
345
+ const hasValue = currentValue != null && (Array.isArray(currentValue) ? currentValue.length > 0 : currentValue !== "");
346
+ const handleChange = (0, import_react10.useCallback)(
347
+ (newValue) => {
348
+ if (!isControlled) {
349
+ setInternalValue(newValue);
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)(
128
421
  import_select.Select,
129
422
  {
130
423
  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
+ ] }),
131
434
  items,
132
435
  selectedKeys,
133
436
  selectionMode,
437
+ variant,
134
438
  onSelectionChange: handleSelectionChange,
135
439
  ...props,
136
- children: (item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_select.SelectItem, { children: item.label }, item.key)
440
+ children: (item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_select.SelectItem, { children: item.label }, item.key)
137
441
  }
138
442
  );
139
443
  }
@@ -141,54 +445,64 @@ var Select = import_react6.default.forwardRef(
141
445
  Select.displayName = "TeachInUI.Select";
142
446
 
143
447
  // src/ui/inputs/switch/switch.tsx
144
- var import_react7 = __toESM(require("react"));
448
+ var import_react12 = __toESM(require("react"));
145
449
  var import_switch = require("@heroui/switch");
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 });
450
+ var import_jsx_runtime9 = require("react/jsx-runtime");
451
+ var Switch = import_react12.default.forwardRef(({ ...props }, ref) => {
452
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_switch.Switch, { ref, ...props });
149
453
  });
150
454
  Switch.displayName = "TeachInUI.Switch";
151
455
 
152
456
  // src/ui/inputs/radio/radio-group.tsx
153
- var import_react8 = __toESM(require("react"));
457
+ var import_react13 = __toESM(require("react"));
154
458
  var import_radio = require("@heroui/radio");
155
- var import_jsx_runtime8 = require("react/jsx-runtime");
156
- var RadioGroup = import_react8.default.forwardRef(
459
+ var import_jsx_runtime10 = require("react/jsx-runtime");
460
+ var RadioGroup = import_react13.default.forwardRef(
157
461
  (props, ref) => {
158
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_radio.RadioGroup, { ref, ...props });
462
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_radio.RadioGroup, { ref, ...props });
159
463
  }
160
464
  );
161
465
  RadioGroup.displayName = "TeachInUI.RadioGroup";
162
466
 
163
467
  // src/ui/inputs/text/text.tsx
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 });
468
+ var import_react14 = __toESM(require("react"));
469
+ var import_jsx_runtime11 = require("react/jsx-runtime");
470
+ var Text = import_react14.default.forwardRef(({ ...props }, ref) => {
471
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input, { ref, type: "text", ...props });
168
472
  });
169
473
  Text.displayName = "TeachInUI.Text";
170
474
 
171
475
  // src/ui/inputs/textarea/textarea.tsx
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(
476
+ var import_input6 = require("@heroui/input");
477
+ var import_react15 = __toESM(require("react"));
478
+ var import_jsx_runtime12 = require("react/jsx-runtime");
479
+ var Textarea = import_react15.default.forwardRef(
176
480
  ({ minRows = 4, ...props }, ref) => {
177
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_input5.Textarea, { ref, minRows, ...props });
481
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_input6.Textarea, { ref, minRows, ...props });
178
482
  }
179
483
  );
180
484
  Textarea.displayName = "TeachInUI.Textarea";
181
485
 
182
486
  // src/ui/form/rhf/fields/input-field.tsx
183
- var import_jsx_runtime11 = require("react/jsx-runtime");
487
+ var import_jsx_runtime13 = require("react/jsx-runtime");
184
488
  function InputField({ name, ...props }) {
185
489
  const { control } = (0, import_react_hook_form.useFormContext)();
186
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
490
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
187
491
  import_react_hook_form.Controller,
188
492
  {
189
493
  control,
190
494
  name,
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 })
495
+ render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
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
+ )
192
506
  }
193
507
  );
194
508
  }
@@ -196,15 +510,15 @@ InputField.displayName = "TeachInUI.InputField";
196
510
 
197
511
  // src/ui/form/rhf/fields/text-field.tsx
198
512
  var import_react_hook_form2 = require("react-hook-form");
199
- var import_jsx_runtime12 = require("react/jsx-runtime");
513
+ var import_jsx_runtime14 = require("react/jsx-runtime");
200
514
  function TextField({ name, ...props }) {
201
515
  const { control } = (0, import_react_hook_form2.useFormContext)();
202
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
516
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
203
517
  import_react_hook_form2.Controller,
204
518
  {
205
519
  control,
206
520
  name,
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 })
521
+ 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 })
208
522
  }
209
523
  );
210
524
  }
@@ -212,31 +526,57 @@ TextField.displayName = "TeachInUI.TextField";
212
526
 
213
527
  // src/ui/form/rhf/fields/email-field.tsx
214
528
  var import_react_hook_form3 = require("react-hook-form");
215
- var import_jsx_runtime13 = require("react/jsx-runtime");
529
+ var import_jsx_runtime15 = require("react/jsx-runtime");
216
530
  function EmailField({ name, ...props }) {
217
531
  const { control } = (0, import_react_hook_form3.useFormContext)();
218
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
532
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
219
533
  import_react_hook_form3.Controller,
220
534
  {
221
535
  control,
222
536
  name,
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 })
537
+ 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 })
224
538
  }
225
539
  );
226
540
  }
227
541
  EmailField.displayName = "TeachInUI.EmailField";
228
542
 
229
- // src/ui/form/rhf/fields/textarea-field.tsx
543
+ // src/ui/form/rhf/fields/search-field.tsx
230
544
  var import_react_hook_form4 = require("react-hook-form");
231
- var import_jsx_runtime14 = require("react/jsx-runtime");
232
- function TextareaField({ name, ...props }) {
545
+ var import_jsx_runtime16 = require("react/jsx-runtime");
546
+ function SearchField({ name, ...props }) {
233
547
  const { control } = (0, import_react_hook_form4.useFormContext)();
234
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
548
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
235
549
  import_react_hook_form4.Controller,
236
550
  {
237
551
  control,
238
552
  name,
239
- render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
553
+ render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
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)(
240
580
  Textarea,
241
581
  {
242
582
  ...props,
@@ -252,16 +592,16 @@ function TextareaField({ name, ...props }) {
252
592
  TextareaField.displayName = "TeachInUI.TextareaField";
253
593
 
254
594
  // src/ui/form/rhf/fields/select-field.tsx
255
- var import_react_hook_form5 = require("react-hook-form");
256
- var import_jsx_runtime15 = require("react/jsx-runtime");
595
+ var import_react_hook_form6 = require("react-hook-form");
596
+ var import_jsx_runtime18 = require("react/jsx-runtime");
257
597
  function SelectField({ name, selectionMode, ...props }) {
258
- const { control } = (0, import_react_hook_form5.useFormContext)();
259
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
260
- import_react_hook_form5.Controller,
598
+ const { control } = (0, import_react_hook_form6.useFormContext)();
599
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
600
+ import_react_hook_form6.Controller,
261
601
  {
262
602
  control,
263
603
  name,
264
- render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
604
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
265
605
  Select,
266
606
  {
267
607
  selectionMode,
@@ -278,16 +618,16 @@ function SelectField({ name, selectionMode, ...props }) {
278
618
  SelectField.displayName = "TeachInUI.SelectField";
279
619
 
280
620
  // src/ui/form/rhf/fields/autocomplete-field.tsx
281
- var import_react_hook_form6 = require("react-hook-form");
282
- var import_jsx_runtime16 = require("react/jsx-runtime");
621
+ var import_react_hook_form7 = require("react-hook-form");
622
+ var import_jsx_runtime19 = require("react/jsx-runtime");
283
623
  function AutocompleteField({ name, ...props }) {
284
- const { control } = (0, import_react_hook_form6.useFormContext)();
285
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
286
- import_react_hook_form6.Controller,
624
+ const { control } = (0, import_react_hook_form7.useFormContext)();
625
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
626
+ import_react_hook_form7.Controller,
287
627
  {
288
628
  control,
289
629
  name,
290
- render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
630
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
291
631
  Autocomplete,
292
632
  {
293
633
  ...props,
@@ -303,16 +643,16 @@ function AutocompleteField({ name, ...props }) {
303
643
  AutocompleteField.displayName = "TeachInUI.AutocompleteField";
304
644
 
305
645
  // src/ui/form/rhf/fields/date-picker-field.tsx
306
- var import_react_hook_form7 = require("react-hook-form");
307
- var import_jsx_runtime17 = require("react/jsx-runtime");
646
+ var import_react_hook_form8 = require("react-hook-form");
647
+ var import_jsx_runtime20 = require("react/jsx-runtime");
308
648
  function DatePickerField({ name, ...props }) {
309
- const { control } = (0, import_react_hook_form7.useFormContext)();
310
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
311
- import_react_hook_form7.Controller,
649
+ const { control } = (0, import_react_hook_form8.useFormContext)();
650
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
651
+ import_react_hook_form8.Controller,
312
652
  {
313
653
  control,
314
654
  name,
315
- render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
655
+ render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
316
656
  DatePicker,
317
657
  {
318
658
  ...props,
@@ -328,18 +668,18 @@ function DatePickerField({ name, ...props }) {
328
668
  DatePickerField.displayName = "TeachInUI.DatePickerField";
329
669
 
330
670
  // src/ui/form/rhf/fields/checkbox-field.tsx
331
- var import_react_hook_form8 = require("react-hook-form");
332
- var import_jsx_runtime18 = require("react/jsx-runtime");
671
+ var import_react_hook_form9 = require("react-hook-form");
672
+ var import_jsx_runtime21 = require("react/jsx-runtime");
333
673
  function CheckboxField({ name, ...props }) {
334
- const { control } = (0, import_react_hook_form8.useFormContext)();
335
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
336
- import_react_hook_form8.Controller,
674
+ const { control } = (0, import_react_hook_form9.useFormContext)();
675
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
676
+ import_react_hook_form9.Controller,
337
677
  {
338
678
  control,
339
679
  name,
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 })
680
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
681
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Checkbox, { ...props, isSelected: field.value, onValueChange: field.onChange }),
682
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-tiny text-danger", children: error.message })
343
683
  ] })
344
684
  }
345
685
  );
@@ -347,18 +687,18 @@ function CheckboxField({ name, ...props }) {
347
687
  CheckboxField.displayName = "TeachInUI.CheckboxField";
348
688
 
349
689
  // src/ui/form/rhf/fields/switch-field.tsx
350
- var import_react_hook_form9 = require("react-hook-form");
351
- var import_jsx_runtime19 = require("react/jsx-runtime");
690
+ var import_react_hook_form10 = require("react-hook-form");
691
+ var import_jsx_runtime22 = require("react/jsx-runtime");
352
692
  function SwitchField({ name, ...props }) {
353
- const { control } = (0, import_react_hook_form9.useFormContext)();
354
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
355
- import_react_hook_form9.Controller,
693
+ const { control } = (0, import_react_hook_form10.useFormContext)();
694
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
695
+ import_react_hook_form10.Controller,
356
696
  {
357
697
  control,
358
698
  name,
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 })
699
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
700
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Switch, { ...props, isSelected: field.value, onValueChange: field.onChange }),
701
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-tiny text-danger", children: error.message })
362
702
  ] })
363
703
  }
364
704
  );
@@ -366,16 +706,16 @@ function SwitchField({ name, ...props }) {
366
706
  SwitchField.displayName = "TeachInUI.SwitchField";
367
707
 
368
708
  // src/ui/form/rhf/fields/radio-field.tsx
369
- var import_react_hook_form10 = require("react-hook-form");
370
- var import_jsx_runtime20 = require("react/jsx-runtime");
709
+ var import_react_hook_form11 = require("react-hook-form");
710
+ var import_jsx_runtime23 = require("react/jsx-runtime");
371
711
  function RadioField({ name, ...props }) {
372
- const { control } = (0, import_react_hook_form10.useFormContext)();
373
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
374
- import_react_hook_form10.Controller,
712
+ const { control } = (0, import_react_hook_form11.useFormContext)();
713
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
714
+ import_react_hook_form11.Controller,
375
715
  {
376
716
  control,
377
717
  name,
378
- render: ({ field: { ref, value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
718
+ render: ({ field: { ref, value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
379
719
  RadioGroup,
380
720
  {
381
721
  ...props,
@@ -399,6 +739,7 @@ RadioField.displayName = "TeachInUI.RadioField";
399
739
  EmailField,
400
740
  InputField,
401
741
  RadioField,
742
+ SearchField,
402
743
  SelectField,
403
744
  SwitchField,
404
745
  TextField,