@teach-in/react 1.3.0 → 1.5.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 (137) hide show
  1. package/dist/chunk-2UHA3DYG.mjs +62 -0
  2. package/dist/{chunk-LJIVY6GU.mjs → chunk-46SKVFMZ.mjs} +1 -1
  3. package/dist/{chunk-JDFRAN4S.mjs → chunk-5FFWQB7D.mjs} +12 -2
  4. package/dist/{chunk-544SDU73.mjs → chunk-BBUPZCY6.mjs} +1 -1
  5. package/dist/chunk-C2VWADF5.mjs +34 -0
  6. package/dist/{chunk-NLHQDWUK.mjs → chunk-CKJ5U5Q4.mjs} +1 -1
  7. package/dist/chunk-CUEG2BFV.mjs +34 -0
  8. package/dist/chunk-GTE5VEBV.mjs +68 -0
  9. package/dist/{chunk-CETCW7DS.mjs → chunk-IU2JYI7W.mjs} +1 -1
  10. package/dist/{chunk-KTUGFQWJ.mjs → chunk-KTWHCUYV.mjs} +1 -1
  11. package/dist/chunk-MCQGBAUS.mjs +73 -0
  12. package/dist/chunk-NSU66J5E.mjs +59 -0
  13. package/dist/{chunk-UFYLYN5Z.mjs → chunk-QFWSQOF6.mjs} +20 -2
  14. package/dist/{chunk-R7LDL5CU.mjs → chunk-R46SWVWL.mjs} +1 -1
  15. package/dist/{chunk-WFNNN6WU.mjs → chunk-RPIOTLYT.mjs} +1 -1
  16. package/dist/chunk-SEJXJZSK.mjs +64 -0
  17. package/dist/chunk-TUIN5YJW.mjs +33 -0
  18. package/dist/chunk-UQAG7TKJ.mjs +1 -0
  19. package/dist/chunk-VXYV37IM.mjs +74 -0
  20. package/dist/{chunk-J3OZNLTZ.mjs → chunk-WG4IPOHE.mjs} +5 -5
  21. package/dist/{chunk-AFVGHUW2.mjs → chunk-YZB4VBX7.mjs} +24 -2
  22. package/dist/index.js +658 -247
  23. package/dist/index.mjs +200 -184
  24. package/dist/ui/data/index.mjs +8 -8
  25. package/dist/ui/feedback/index.mjs +11 -11
  26. package/dist/ui/feedback/progress/index.mjs +3 -3
  27. package/dist/ui/form/index.js +447 -106
  28. package/dist/ui/form/index.mjs +30 -20
  29. package/dist/ui/form/rhf/fields/autocomplete-field.mjs +19 -13
  30. package/dist/ui/form/rhf/fields/checkbox-field.mjs +19 -13
  31. package/dist/ui/form/rhf/fields/date-picker-field.mjs +19 -13
  32. package/dist/ui/form/rhf/fields/email-field.js +147 -10
  33. package/dist/ui/form/rhf/fields/email-field.mjs +20 -14
  34. package/dist/ui/form/rhf/fields/index.d.ts +1 -0
  35. package/dist/ui/form/rhf/fields/index.js +443 -102
  36. package/dist/ui/form/rhf/fields/index.mjs +30 -20
  37. package/dist/ui/form/rhf/fields/input-field.js +153 -6
  38. package/dist/ui/form/rhf/fields/input-field.mjs +20 -14
  39. package/dist/ui/form/rhf/fields/radio-field.mjs +19 -13
  40. package/dist/ui/form/rhf/fields/search-field.d.ts +10 -0
  41. package/dist/ui/form/rhf/fields/search-field.js +296 -0
  42. package/dist/ui/form/rhf/fields/search-field.mjs +37 -0
  43. package/dist/ui/form/rhf/fields/select-field.js +136 -26
  44. package/dist/ui/form/rhf/fields/select-field.mjs +20 -14
  45. package/dist/ui/form/rhf/fields/switch-field.mjs +19 -13
  46. package/dist/ui/form/rhf/fields/text-field.js +147 -10
  47. package/dist/ui/form/rhf/fields/text-field.mjs +20 -14
  48. package/dist/ui/form/rhf/fields/textarea-field.mjs +19 -13
  49. package/dist/ui/form/rhf/index.js +443 -102
  50. package/dist/ui/form/rhf/index.mjs +30 -20
  51. package/dist/ui/format/index.mjs +6 -6
  52. package/dist/ui/index.js +658 -247
  53. package/dist/ui/index.mjs +199 -183
  54. package/dist/ui/inputs/clear-button.d.ts +5 -0
  55. package/dist/ui/inputs/clear-button.js +67 -0
  56. package/dist/ui/inputs/clear-button.mjs +8 -0
  57. package/dist/ui/inputs/email/email.js +144 -7
  58. package/dist/ui/inputs/email/email.mjs +4 -2
  59. package/dist/ui/inputs/email/index.js +144 -7
  60. package/dist/ui/inputs/email/index.mjs +4 -2
  61. package/dist/ui/inputs/index.d.ts +2 -0
  62. package/dist/ui/inputs/index.js +396 -59
  63. package/dist/ui/inputs/index.mjs +33 -21
  64. package/dist/ui/inputs/input/index.js +140 -3
  65. package/dist/ui/inputs/input/index.mjs +3 -1
  66. package/dist/ui/inputs/input/input.d.ts +1 -0
  67. package/dist/ui/inputs/input/input.js +140 -3
  68. package/dist/ui/inputs/input/input.mjs +3 -1
  69. package/dist/ui/inputs/input/use-input.d.ts +19 -0
  70. package/dist/ui/inputs/input/use-input.js +82 -0
  71. package/dist/ui/inputs/input/use-input.mjs +7 -0
  72. package/dist/ui/inputs/radio/index.mjs +3 -3
  73. package/dist/ui/inputs/search/index.d.ts +1 -0
  74. package/dist/ui/inputs/search/index.js +270 -0
  75. package/dist/ui/inputs/search/index.mjs +13 -0
  76. package/dist/ui/inputs/search/search.d.ts +7 -0
  77. package/dist/ui/inputs/search/search.js +268 -0
  78. package/dist/ui/inputs/search/search.mjs +12 -0
  79. package/dist/ui/inputs/search/use-search.d.ts +12 -0
  80. package/dist/ui/inputs/search/use-search.js +57 -0
  81. package/dist/ui/inputs/search/use-search.mjs +7 -0
  82. package/dist/ui/inputs/select/index.js +132 -22
  83. package/dist/ui/inputs/select/index.mjs +3 -1
  84. package/dist/ui/inputs/select/select.d.ts +4 -0
  85. package/dist/ui/inputs/select/select.js +132 -22
  86. package/dist/ui/inputs/select/select.mjs +3 -1
  87. package/dist/ui/inputs/select/use-select.d.ts +17 -0
  88. package/dist/ui/inputs/select/use-select.js +85 -0
  89. package/dist/ui/inputs/select/use-select.mjs +7 -0
  90. package/dist/ui/inputs/switch/favorite-switch.d.ts +23 -2
  91. package/dist/ui/inputs/switch/favorite-switch.js +34 -4
  92. package/dist/ui/inputs/switch/favorite-switch.mjs +1 -1
  93. package/dist/ui/inputs/switch/index.js +34 -4
  94. package/dist/ui/inputs/switch/index.mjs +3 -3
  95. package/dist/ui/inputs/text/index.js +144 -7
  96. package/dist/ui/inputs/text/index.mjs +4 -2
  97. package/dist/ui/inputs/text/text.js +144 -7
  98. package/dist/ui/inputs/text/text.mjs +4 -2
  99. package/dist/ui/layout/container/container.mjs +96 -89
  100. package/dist/ui/layout/container/index.mjs +96 -89
  101. package/dist/ui/layout/index.mjs +101 -94
  102. package/dist/ui/layout/page/index.mjs +7 -7
  103. package/dist/ui/layout/page/page-loading.mjs +6 -6
  104. package/dist/ui/layout/page/section-loading.mjs +6 -6
  105. package/dist/ui/navigation/index.mjs +9 -9
  106. package/dist/ui/overlays/index.mjs +8 -8
  107. package/dist/ui/provider/index.mjs +6 -6
  108. package/dist/ui/provider/ui-provider.mjs +6 -6
  109. package/dist/ui/surface/bento/bento.d.ts +2 -2
  110. package/dist/ui/surface/bento/bento.js +5 -5
  111. package/dist/ui/surface/bento/bento.mjs +1 -1
  112. package/dist/ui/surface/bento/index.js +5 -5
  113. package/dist/ui/surface/bento/index.mjs +1 -1
  114. package/dist/ui/surface/card/card.d.ts +2427 -5
  115. package/dist/ui/surface/card/card.js +29 -2
  116. package/dist/ui/surface/card/card.mjs +5 -1
  117. package/dist/ui/surface/card/index.js +29 -2
  118. package/dist/ui/surface/card/index.mjs +5 -1
  119. package/dist/ui/surface/index.js +34 -7
  120. package/dist/ui/surface/index.mjs +7 -3
  121. package/dist/ui/theme/colors/index.js +24 -2
  122. package/dist/ui/theme/colors/index.mjs +2 -2
  123. package/dist/ui/theme/colors/semantic.js +24 -2
  124. package/dist/ui/theme/colors/semantic.mjs +1 -1
  125. package/dist/ui/theme/colors/types.d.ts +2 -0
  126. package/dist/ui/theme/colors.js +24 -2
  127. package/dist/ui/theme/colors.mjs +2 -2
  128. package/dist/ui/theme/index.js +24 -2
  129. package/dist/ui/theme/index.mjs +3 -3
  130. package/dist/ui/theme/theme.js +24 -2
  131. package/dist/ui/theme/theme.mjs +3 -3
  132. package/package.json +1 -1
  133. package/dist/chunk-3YOW5DEZ.mjs +0 -45
  134. package/dist/chunk-E5QSNLSR.mjs +0 -38
  135. package/dist/chunk-V2G5QHZZ.mjs +0 -14
  136. /package/dist/{chunk-CZEO3U25.mjs → chunk-5RNCFTW5.mjs} +0 -0
  137. /package/dist/{chunk-Q6JSJOU4.mjs → chunk-PTCNYQVY.mjs} +0 -0
@@ -1,23 +1,23 @@
1
1
  "use client";
2
- import "../../../../chunk-Q6JSJOU4.mjs";
3
- import {
4
- EmailField
5
- } from "../../../../chunk-R7LDL5CU.mjs";
2
+ import "../../../../chunk-PTCNYQVY.mjs";
6
3
  import {
7
4
  InputField
8
- } from "../../../../chunk-JDFRAN4S.mjs";
5
+ } from "../../../../chunk-5FFWQB7D.mjs";
9
6
  import {
10
7
  RadioField
11
8
  } from "../../../../chunk-W2A6C27Y.mjs";
9
+ import {
10
+ SearchField
11
+ } from "../../../../chunk-CUEG2BFV.mjs";
12
12
  import {
13
13
  SelectField
14
- } from "../../../../chunk-NLHQDWUK.mjs";
14
+ } from "../../../../chunk-CKJ5U5Q4.mjs";
15
15
  import {
16
16
  SwitchField
17
17
  } from "../../../../chunk-EC3NSPHR.mjs";
18
18
  import {
19
19
  TextField
20
- } from "../../../../chunk-CETCW7DS.mjs";
20
+ } from "../../../../chunk-IU2JYI7W.mjs";
21
21
  import {
22
22
  TextareaField
23
23
  } from "../../../../chunk-V4HKGJYK.mjs";
@@ -30,30 +30,39 @@ import {
30
30
  import {
31
31
  DatePickerField
32
32
  } from "../../../../chunk-7GHK5XYK.mjs";
33
- import "../../../../chunk-CZEO3U25.mjs";
33
+ import {
34
+ EmailField
35
+ } from "../../../../chunk-R46SWVWL.mjs";
36
+ import "../../../../chunk-UQAG7TKJ.mjs";
37
+ import "../../../../chunk-DUQFM3QS.mjs";
38
+ import "../../../../chunk-KTWHCUYV.mjs";
34
39
  import "../../../../chunk-5HK7HRTR.mjs";
35
40
  import "../../../../chunk-HJUZTISD.mjs";
36
41
  import "../../../../chunk-LLP2PTPK.mjs";
37
- import "../../../../chunk-E5QSNLSR.mjs";
38
42
  import "../../../../chunk-N3EAW6UO.mjs";
39
- import "../../../../chunk-RRA7GWP2.mjs";
40
- import "../../../../chunk-NOXFF2KJ.mjs";
41
- import "../../../../chunk-2SNKT7I4.mjs";
42
- import "../../../../chunk-DUQFM3QS.mjs";
43
- import "../../../../chunk-KTUGFQWJ.mjs";
43
+ import "../../../../chunk-GTE5VEBV.mjs";
44
+ import "../../../../chunk-5RNCFTW5.mjs";
45
+ import "../../../../chunk-SEJXJZSK.mjs";
46
+ import "../../../../chunk-C2VWADF5.mjs";
47
+ import "../../../../chunk-AQ3ISJKU.mjs";
48
+ import "../../../../chunk-VXYV37IM.mjs";
49
+ import "../../../../chunk-2UHA3DYG.mjs";
44
50
  import "../../../../chunk-UUKS7JYX.mjs";
45
51
  import "../../../../chunk-N3QOXWJI.mjs";
52
+ import "../../../../chunk-V2HNFTTX.mjs";
53
+ import "../../../../chunk-IAJ6G633.mjs";
46
54
  import "../../../../chunk-V3KKDSQP.mjs";
47
- import "../../../../chunk-LJIVY6GU.mjs";
55
+ import "../../../../chunk-46SKVFMZ.mjs";
48
56
  import "../../../../chunk-ZRHEFEFS.mjs";
49
- import "../../../../chunk-V2G5QHZZ.mjs";
50
- import "../../../../chunk-AQ3ISJKU.mjs";
51
- import "../../../../chunk-3YOW5DEZ.mjs";
57
+ import "../../../../chunk-MCQGBAUS.mjs";
58
+ import "../../../../chunk-NSU66J5E.mjs";
59
+ import "../../../../chunk-RRA7GWP2.mjs";
60
+ import "../../../../chunk-2SNKT7I4.mjs";
61
+ import "../../../../chunk-NOXFF2KJ.mjs";
52
62
  import "../../../../chunk-WYJW5NNA.mjs";
53
63
  import "../../../../chunk-C3MURCMZ.mjs";
54
- import "../../../../chunk-V2HNFTTX.mjs";
55
- import "../../../../chunk-IAJ6G633.mjs";
56
64
  import "../../../../chunk-C4PCTOGM.mjs";
65
+ import "../../../../chunk-TUIN5YJW.mjs";
57
66
  export {
58
67
  AutocompleteField,
59
68
  CheckboxField,
@@ -61,6 +70,7 @@ export {
61
70
  EmailField,
62
71
  InputField,
63
72
  RadioField,
73
+ SearchField,
64
74
  SelectField,
65
75
  SwitchField,
66
76
  TextField,
@@ -37,24 +37,171 @@ module.exports = __toCommonJS(input_field_exports);
37
37
  var import_react_hook_form = require("react-hook-form");
38
38
 
39
39
  // src/ui/inputs/input/input.tsx
40
- var import_react = __toESM(require("react"));
40
+ var import_react3 = __toESM(require("react"));
41
41
  var import_input = require("@heroui/input");
42
+ var import_tailwind_variants = require("tailwind-variants");
43
+
44
+ // src/ui/inputs/clear-button.tsx
45
+ var import_react = __toESM(require("react"));
46
+ var import_button = require("@heroui/button");
47
+ var import_lucide_react = require("lucide-react");
42
48
  var import_jsx_runtime = require("react/jsx-runtime");
43
- var Input = import_react.default.forwardRef(({ ...props }, ref) => {
44
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { ref, ...props });
49
+ var ClearButton = import_react.default.forwardRef(
50
+ ({ onClear }, ref) => {
51
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
52
+ import_button.Button,
53
+ {
54
+ ref,
55
+ isIconOnly: true,
56
+ "aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
57
+ as: "span",
58
+ className: "opacity-0 transition-opacity group-hover:opacity-100",
59
+ color: "default",
60
+ radius: "full",
61
+ size: "sm",
62
+ tabIndex: 0,
63
+ variant: "light",
64
+ onPress: onClear,
65
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
66
+ }
67
+ );
68
+ }
69
+ );
70
+ ClearButton.displayName = "TeachInUI.ClearButton";
71
+
72
+ // src/ui/inputs/input/use-input.ts
73
+ var import_react2 = require("react");
74
+ function useInput({
75
+ value,
76
+ defaultValue,
77
+ onValueChange,
78
+ onClear,
79
+ isReadOnly,
80
+ isClearable = true,
81
+ ref
82
+ }) {
83
+ const inputRef = (0, import_react2.useRef)(null);
84
+ const [internalValue, setInternalValue] = (0, import_react2.useState)(defaultValue != null ? defaultValue : "");
85
+ const isControlled = value !== void 0;
86
+ const currentValue = isControlled ? value : internalValue;
87
+ const hasValue = String(currentValue).length > 0;
88
+ const handleValueChange = (0, import_react2.useCallback)(
89
+ (newValue) => {
90
+ if (!isControlled) {
91
+ setInternalValue(newValue);
92
+ }
93
+ onValueChange == null ? void 0 : onValueChange(newValue);
94
+ },
95
+ [isControlled, onValueChange]
96
+ );
97
+ const handleClear = (0, import_react2.useCallback)(() => {
98
+ var _a;
99
+ onClear == null ? void 0 : onClear();
100
+ handleValueChange("");
101
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
102
+ }, [onClear, handleValueChange]);
103
+ const mergedRef = (0, import_react2.useCallback)(
104
+ (node) => {
105
+ inputRef.current = node;
106
+ if (typeof ref === "function") {
107
+ ref(node);
108
+ } else if (ref) {
109
+ ref.current = node;
110
+ }
111
+ },
112
+ [ref]
113
+ );
114
+ const showClearButton = hasValue && !isReadOnly && isClearable;
115
+ return {
116
+ inputRef,
117
+ currentValue,
118
+ hasValue,
119
+ handleValueChange,
120
+ handleClear,
121
+ mergedRef,
122
+ showClearButton
123
+ };
124
+ }
125
+
126
+ // src/ui/inputs/input/input.tsx
127
+ var import_jsx_runtime2 = require("react/jsx-runtime");
128
+ var inputWrapperVariants = (0, import_tailwind_variants.tv)({
129
+ variants: {
130
+ variant: {
131
+ flat: "",
132
+ underlined: "",
133
+ bordered: "border-1",
134
+ faded: "border-1"
135
+ }
136
+ }
45
137
  });
138
+ var Input = import_react3.default.forwardRef(
139
+ ({
140
+ value,
141
+ defaultValue,
142
+ onClear,
143
+ onValueChange,
144
+ variant,
145
+ classNames,
146
+ endContent,
147
+ isReadOnly,
148
+ isClearable,
149
+ ...props
150
+ }, ref) => {
151
+ const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
152
+ value,
153
+ defaultValue,
154
+ onValueChange,
155
+ onClear,
156
+ isReadOnly,
157
+ isClearable,
158
+ ref
159
+ });
160
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
161
+ import_input.Input,
162
+ {
163
+ ref: mergedRef,
164
+ classNames: {
165
+ ...classNames,
166
+ inputWrapper: inputWrapperVariants({ variant }),
167
+ innerWrapper: "group"
168
+ },
169
+ defaultValue,
170
+ endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
171
+ endContent,
172
+ showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
173
+ ] }),
174
+ isReadOnly,
175
+ value: currentValue,
176
+ variant,
177
+ onValueChange: handleValueChange,
178
+ ...props
179
+ }
180
+ );
181
+ }
182
+ );
46
183
  Input.displayName = "TeachInUI.Input";
47
184
 
48
185
  // src/ui/form/rhf/fields/input-field.tsx
49
- var import_jsx_runtime2 = require("react/jsx-runtime");
186
+ var import_jsx_runtime3 = require("react/jsx-runtime");
50
187
  function InputField({ name, ...props }) {
51
188
  const { control } = (0, import_react_hook_form.useFormContext)();
52
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
189
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
53
190
  import_react_hook_form.Controller,
54
191
  {
55
192
  control,
56
193
  name,
57
- render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Input, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
194
+ render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
195
+ Input,
196
+ {
197
+ ...props,
198
+ ...field,
199
+ ref,
200
+ errorMessage: error == null ? void 0 : error.message,
201
+ isInvalid: !!error,
202
+ onValueChange: field.onChange
203
+ }
204
+ )
58
205
  }
59
206
  );
60
207
  }
@@ -1,31 +1,37 @@
1
1
  "use client";
2
2
  import {
3
3
  InputField
4
- } from "../../../../chunk-JDFRAN4S.mjs";
5
- import "../../../../chunk-CZEO3U25.mjs";
4
+ } from "../../../../chunk-5FFWQB7D.mjs";
5
+ import "../../../../chunk-UQAG7TKJ.mjs";
6
+ import "../../../../chunk-DUQFM3QS.mjs";
7
+ import "../../../../chunk-KTWHCUYV.mjs";
6
8
  import "../../../../chunk-5HK7HRTR.mjs";
7
9
  import "../../../../chunk-HJUZTISD.mjs";
8
10
  import "../../../../chunk-LLP2PTPK.mjs";
9
- import "../../../../chunk-E5QSNLSR.mjs";
10
11
  import "../../../../chunk-N3EAW6UO.mjs";
11
- import "../../../../chunk-RRA7GWP2.mjs";
12
- import "../../../../chunk-NOXFF2KJ.mjs";
13
- import "../../../../chunk-2SNKT7I4.mjs";
14
- import "../../../../chunk-DUQFM3QS.mjs";
15
- import "../../../../chunk-KTUGFQWJ.mjs";
12
+ import "../../../../chunk-GTE5VEBV.mjs";
13
+ import "../../../../chunk-5RNCFTW5.mjs";
14
+ import "../../../../chunk-SEJXJZSK.mjs";
15
+ import "../../../../chunk-C2VWADF5.mjs";
16
+ import "../../../../chunk-AQ3ISJKU.mjs";
17
+ import "../../../../chunk-VXYV37IM.mjs";
18
+ import "../../../../chunk-2UHA3DYG.mjs";
16
19
  import "../../../../chunk-UUKS7JYX.mjs";
17
20
  import "../../../../chunk-N3QOXWJI.mjs";
21
+ import "../../../../chunk-V2HNFTTX.mjs";
22
+ import "../../../../chunk-IAJ6G633.mjs";
18
23
  import "../../../../chunk-V3KKDSQP.mjs";
19
- import "../../../../chunk-LJIVY6GU.mjs";
24
+ import "../../../../chunk-46SKVFMZ.mjs";
20
25
  import "../../../../chunk-ZRHEFEFS.mjs";
21
- import "../../../../chunk-V2G5QHZZ.mjs";
22
- import "../../../../chunk-AQ3ISJKU.mjs";
23
- import "../../../../chunk-3YOW5DEZ.mjs";
26
+ import "../../../../chunk-MCQGBAUS.mjs";
27
+ import "../../../../chunk-NSU66J5E.mjs";
28
+ import "../../../../chunk-RRA7GWP2.mjs";
29
+ import "../../../../chunk-2SNKT7I4.mjs";
30
+ import "../../../../chunk-NOXFF2KJ.mjs";
24
31
  import "../../../../chunk-WYJW5NNA.mjs";
25
32
  import "../../../../chunk-C3MURCMZ.mjs";
26
- import "../../../../chunk-V2HNFTTX.mjs";
27
- import "../../../../chunk-IAJ6G633.mjs";
28
33
  import "../../../../chunk-C4PCTOGM.mjs";
34
+ import "../../../../chunk-TUIN5YJW.mjs";
29
35
  export {
30
36
  InputField
31
37
  };
@@ -2,30 +2,36 @@
2
2
  import {
3
3
  RadioField
4
4
  } from "../../../../chunk-W2A6C27Y.mjs";
5
- import "../../../../chunk-CZEO3U25.mjs";
5
+ import "../../../../chunk-UQAG7TKJ.mjs";
6
+ import "../../../../chunk-DUQFM3QS.mjs";
7
+ import "../../../../chunk-KTWHCUYV.mjs";
6
8
  import "../../../../chunk-5HK7HRTR.mjs";
7
9
  import "../../../../chunk-HJUZTISD.mjs";
8
10
  import "../../../../chunk-LLP2PTPK.mjs";
9
- import "../../../../chunk-E5QSNLSR.mjs";
10
11
  import "../../../../chunk-N3EAW6UO.mjs";
11
- import "../../../../chunk-RRA7GWP2.mjs";
12
- import "../../../../chunk-NOXFF2KJ.mjs";
13
- import "../../../../chunk-2SNKT7I4.mjs";
14
- import "../../../../chunk-DUQFM3QS.mjs";
15
- import "../../../../chunk-KTUGFQWJ.mjs";
12
+ import "../../../../chunk-GTE5VEBV.mjs";
13
+ import "../../../../chunk-5RNCFTW5.mjs";
14
+ import "../../../../chunk-SEJXJZSK.mjs";
15
+ import "../../../../chunk-C2VWADF5.mjs";
16
+ import "../../../../chunk-AQ3ISJKU.mjs";
17
+ import "../../../../chunk-VXYV37IM.mjs";
18
+ import "../../../../chunk-2UHA3DYG.mjs";
16
19
  import "../../../../chunk-UUKS7JYX.mjs";
17
20
  import "../../../../chunk-N3QOXWJI.mjs";
21
+ import "../../../../chunk-V2HNFTTX.mjs";
22
+ import "../../../../chunk-IAJ6G633.mjs";
18
23
  import "../../../../chunk-V3KKDSQP.mjs";
19
- import "../../../../chunk-LJIVY6GU.mjs";
24
+ import "../../../../chunk-46SKVFMZ.mjs";
20
25
  import "../../../../chunk-ZRHEFEFS.mjs";
21
- import "../../../../chunk-V2G5QHZZ.mjs";
22
- import "../../../../chunk-AQ3ISJKU.mjs";
23
- import "../../../../chunk-3YOW5DEZ.mjs";
26
+ import "../../../../chunk-MCQGBAUS.mjs";
27
+ import "../../../../chunk-NSU66J5E.mjs";
28
+ import "../../../../chunk-RRA7GWP2.mjs";
29
+ import "../../../../chunk-2SNKT7I4.mjs";
30
+ import "../../../../chunk-NOXFF2KJ.mjs";
24
31
  import "../../../../chunk-WYJW5NNA.mjs";
25
32
  import "../../../../chunk-C3MURCMZ.mjs";
26
- import "../../../../chunk-V2HNFTTX.mjs";
27
- import "../../../../chunk-IAJ6G633.mjs";
28
33
  import "../../../../chunk-C4PCTOGM.mjs";
34
+ import "../../../../chunk-TUIN5YJW.mjs";
29
35
  export {
30
36
  RadioField
31
37
  };
@@ -0,0 +1,10 @@
1
+ import type { SearchProps } from "../../../inputs";
2
+ import React from "react";
3
+ interface Props extends Omit<SearchProps, "name" | "errorMessage" | "isInvalid"> {
4
+ readonly name: string;
5
+ }
6
+ export declare function SearchField({ name, ...props }: Props): React.JSX.Element;
7
+ export declare namespace SearchField {
8
+ var displayName: string;
9
+ }
10
+ export {};
@@ -0,0 +1,296 @@
1
+ "use client";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/ui/form/rhf/fields/search-field.tsx
32
+ var search_field_exports = {};
33
+ __export(search_field_exports, {
34
+ SearchField: () => SearchField
35
+ });
36
+ module.exports = __toCommonJS(search_field_exports);
37
+ var import_react_hook_form = require("react-hook-form");
38
+
39
+ // src/ui/inputs/input/input.tsx
40
+ var import_react3 = __toESM(require("react"));
41
+ var import_input = require("@heroui/input");
42
+ var import_tailwind_variants = require("tailwind-variants");
43
+
44
+ // src/ui/inputs/clear-button.tsx
45
+ var import_react = __toESM(require("react"));
46
+ var import_button = require("@heroui/button");
47
+ var import_lucide_react = require("lucide-react");
48
+ var import_jsx_runtime = require("react/jsx-runtime");
49
+ var ClearButton = import_react.default.forwardRef(
50
+ ({ onClear }, ref) => {
51
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
52
+ import_button.Button,
53
+ {
54
+ ref,
55
+ isIconOnly: true,
56
+ "aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
57
+ as: "span",
58
+ className: "opacity-0 transition-opacity group-hover:opacity-100",
59
+ color: "default",
60
+ radius: "full",
61
+ size: "sm",
62
+ tabIndex: 0,
63
+ variant: "light",
64
+ onPress: onClear,
65
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
66
+ }
67
+ );
68
+ }
69
+ );
70
+ ClearButton.displayName = "TeachInUI.ClearButton";
71
+
72
+ // src/ui/inputs/input/use-input.ts
73
+ var import_react2 = require("react");
74
+ function useInput({
75
+ value,
76
+ defaultValue,
77
+ onValueChange,
78
+ onClear,
79
+ isReadOnly,
80
+ isClearable = true,
81
+ ref
82
+ }) {
83
+ const inputRef = (0, import_react2.useRef)(null);
84
+ const [internalValue, setInternalValue] = (0, import_react2.useState)(defaultValue != null ? defaultValue : "");
85
+ const isControlled = value !== void 0;
86
+ const currentValue = isControlled ? value : internalValue;
87
+ const hasValue = String(currentValue).length > 0;
88
+ const handleValueChange = (0, import_react2.useCallback)(
89
+ (newValue) => {
90
+ if (!isControlled) {
91
+ setInternalValue(newValue);
92
+ }
93
+ onValueChange == null ? void 0 : onValueChange(newValue);
94
+ },
95
+ [isControlled, onValueChange]
96
+ );
97
+ const handleClear = (0, import_react2.useCallback)(() => {
98
+ var _a;
99
+ onClear == null ? void 0 : onClear();
100
+ handleValueChange("");
101
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
102
+ }, [onClear, handleValueChange]);
103
+ const mergedRef = (0, import_react2.useCallback)(
104
+ (node) => {
105
+ inputRef.current = node;
106
+ if (typeof ref === "function") {
107
+ ref(node);
108
+ } else if (ref) {
109
+ ref.current = node;
110
+ }
111
+ },
112
+ [ref]
113
+ );
114
+ const showClearButton = hasValue && !isReadOnly && isClearable;
115
+ return {
116
+ inputRef,
117
+ currentValue,
118
+ hasValue,
119
+ handleValueChange,
120
+ handleClear,
121
+ mergedRef,
122
+ showClearButton
123
+ };
124
+ }
125
+
126
+ // src/ui/inputs/input/input.tsx
127
+ var import_jsx_runtime2 = require("react/jsx-runtime");
128
+ var inputWrapperVariants = (0, import_tailwind_variants.tv)({
129
+ variants: {
130
+ variant: {
131
+ flat: "",
132
+ underlined: "",
133
+ bordered: "border-1",
134
+ faded: "border-1"
135
+ }
136
+ }
137
+ });
138
+ var Input = import_react3.default.forwardRef(
139
+ ({
140
+ value,
141
+ defaultValue,
142
+ onClear,
143
+ onValueChange,
144
+ variant,
145
+ classNames,
146
+ endContent,
147
+ isReadOnly,
148
+ isClearable,
149
+ ...props
150
+ }, ref) => {
151
+ const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
152
+ value,
153
+ defaultValue,
154
+ onValueChange,
155
+ onClear,
156
+ isReadOnly,
157
+ isClearable,
158
+ ref
159
+ });
160
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
161
+ import_input.Input,
162
+ {
163
+ ref: mergedRef,
164
+ classNames: {
165
+ ...classNames,
166
+ inputWrapper: inputWrapperVariants({ variant }),
167
+ innerWrapper: "group"
168
+ },
169
+ defaultValue,
170
+ endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
171
+ endContent,
172
+ showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
173
+ ] }),
174
+ isReadOnly,
175
+ value: currentValue,
176
+ variant,
177
+ onValueChange: handleValueChange,
178
+ ...props
179
+ }
180
+ );
181
+ }
182
+ );
183
+ Input.displayName = "TeachInUI.Input";
184
+
185
+ // src/ui/inputs/search/search.tsx
186
+ var import_react5 = __toESM(require("react"));
187
+ var import_lucide_react2 = require("lucide-react");
188
+ var import_button2 = require("@heroui/button");
189
+ var import_tailwind_variants2 = require("tailwind-variants");
190
+
191
+ // src/ui/inputs/search/use-search.ts
192
+ var import_react4 = require("react");
193
+ function useSearch({ value, onSearch, onCancel, onKeyDown }) {
194
+ const handleKeyDown = (0, import_react4.useCallback)(
195
+ (event) => {
196
+ if (event.key === "Enter") {
197
+ event.preventDefault();
198
+ onSearch == null ? void 0 : onSearch(event.target.value);
199
+ } else if (event.key === "Escape") {
200
+ event.preventDefault();
201
+ onCancel == null ? void 0 : onCancel();
202
+ }
203
+ onKeyDown == null ? void 0 : onKeyDown(event);
204
+ },
205
+ [onSearch, onCancel, onKeyDown]
206
+ );
207
+ const hasValue = value !== void 0 && String(value).length > 0;
208
+ const handleSearchClick = (0, import_react4.useCallback)(() => {
209
+ if (hasValue) {
210
+ onSearch == null ? void 0 : onSearch(value);
211
+ }
212
+ }, [value, onSearch]);
213
+ return {
214
+ handleKeyDown,
215
+ handleSearchClick,
216
+ hasValue
217
+ };
218
+ }
219
+
220
+ // src/ui/inputs/search/search.tsx
221
+ var import_jsx_runtime3 = require("react/jsx-runtime");
222
+ var searchIconVariants = (0, import_tailwind_variants2.tv)({
223
+ base: "size-5 shrink-0",
224
+ variants: {
225
+ variant: {
226
+ faded: "text-default-400",
227
+ flat: "text-default-foreground",
228
+ bordered: "text-default-400",
229
+ underlined: "text-default-foreground"
230
+ }
231
+ }
232
+ });
233
+ var Search = import_react5.default.forwardRef(
234
+ ({ variant = "bordered", radius = "full", value, onSearch, onCancel, onKeyDown, ...props }, ref) => {
235
+ const { handleKeyDown, handleSearchClick, hasValue } = useSearch({
236
+ value,
237
+ onSearch,
238
+ onCancel,
239
+ onKeyDown
240
+ });
241
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
242
+ Input,
243
+ {
244
+ ref,
245
+ radius,
246
+ startContent: onSearch ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
247
+ import_button2.Button,
248
+ {
249
+ isIconOnly: true,
250
+ "aria-label": "\u041F\u043E\u0438\u0441\u043A",
251
+ isDisabled: !hasValue,
252
+ radius: "full",
253
+ size: "sm",
254
+ variant: "light",
255
+ onPress: handleSearchClick,
256
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) })
257
+ }
258
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) }),
259
+ value,
260
+ variant,
261
+ onKeyDown: handleKeyDown,
262
+ ...props
263
+ }
264
+ );
265
+ }
266
+ );
267
+ Search.displayName = "TeachInUI.Search";
268
+
269
+ // src/ui/form/rhf/fields/search-field.tsx
270
+ var import_jsx_runtime4 = require("react/jsx-runtime");
271
+ function SearchField({ name, ...props }) {
272
+ const { control } = (0, import_react_hook_form.useFormContext)();
273
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
274
+ import_react_hook_form.Controller,
275
+ {
276
+ control,
277
+ name,
278
+ render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
279
+ Search,
280
+ {
281
+ ...props,
282
+ ...field,
283
+ ref,
284
+ errorMessage: error == null ? void 0 : error.message,
285
+ isInvalid: !!error,
286
+ onValueChange: field.onChange
287
+ }
288
+ )
289
+ }
290
+ );
291
+ }
292
+ SearchField.displayName = "TeachInUI.SearchField";
293
+ // Annotate the CommonJS export names for ESM import in node:
294
+ 0 && (module.exports = {
295
+ SearchField
296
+ });