@teach-in/react 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +9 -9
- package/dist/chunk-3YOW5DEZ.mjs +45 -0
- package/dist/{chunk-QCLLPJMB.mjs → chunk-544SDU73.mjs} +2 -2
- package/dist/{chunk-2CEZXLZR.mjs → chunk-AFVGHUW2.mjs} +1 -1
- package/dist/{chunk-IU2JYI7W.mjs → chunk-CETCW7DS.mjs} +1 -1
- package/dist/{chunk-5FFWQB7D.mjs → chunk-JDFRAN4S.mjs} +2 -12
- package/dist/{chunk-KTWHCUYV.mjs → chunk-KTUGFQWJ.mjs} +1 -1
- package/dist/{chunk-46SKVFMZ.mjs → chunk-LJIVY6GU.mjs} +1 -1
- package/dist/{chunk-CKJ5U5Q4.mjs → chunk-NLHQDWUK.mjs} +1 -1
- package/dist/{chunk-R46SWVWL.mjs → chunk-R7LDL5CU.mjs} +1 -1
- package/dist/chunk-V2G5QHZZ.mjs +14 -0
- package/dist/{chunk-2ASQXBDD.mjs → chunk-WFNNN6WU.mjs} +1 -1
- package/dist/index.js +230 -575
- package/dist/index.mjs +125 -141
- package/dist/ui/data/index.mjs +8 -8
- package/dist/ui/feedback/index.mjs +14 -14
- package/dist/ui/form/index.js +106 -447
- package/dist/ui/form/index.mjs +21 -31
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/email-field.js +10 -147
- package/dist/ui/form/rhf/fields/email-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/index.d.ts +0 -1
- package/dist/ui/form/rhf/fields/index.js +102 -443
- package/dist/ui/form/rhf/fields/index.mjs +21 -31
- package/dist/ui/form/rhf/fields/input-field.js +6 -153
- package/dist/ui/form/rhf/fields/input-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/radio-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/select-field.js +26 -136
- package/dist/ui/form/rhf/fields/select-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/switch-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/text-field.js +10 -147
- package/dist/ui/form/rhf/fields/text-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/textarea-field.mjs +14 -20
- package/dist/ui/form/rhf/index.js +102 -443
- package/dist/ui/form/rhf/index.mjs +21 -31
- package/dist/ui/format/index.mjs +3 -3
- package/dist/ui/index.js +230 -575
- package/dist/ui/index.mjs +125 -141
- package/dist/ui/inputs/checkbox/index.mjs +3 -3
- package/dist/ui/inputs/email/email.js +7 -144
- package/dist/ui/inputs/email/email.mjs +2 -4
- package/dist/ui/inputs/email/index.js +7 -144
- package/dist/ui/inputs/email/index.mjs +2 -4
- package/dist/ui/inputs/index.d.ts +0 -2
- package/dist/ui/inputs/index.js +56 -363
- package/dist/ui/inputs/index.mjs +25 -37
- package/dist/ui/inputs/input/index.js +3 -140
- package/dist/ui/inputs/input/index.mjs +1 -3
- package/dist/ui/inputs/input/input.d.ts +0 -1
- package/dist/ui/inputs/input/input.js +3 -140
- package/dist/ui/inputs/input/input.mjs +1 -3
- package/dist/ui/inputs/select/index.js +22 -132
- package/dist/ui/inputs/select/index.mjs +1 -3
- package/dist/ui/inputs/select/select.d.ts +0 -4
- package/dist/ui/inputs/select/select.js +22 -132
- package/dist/ui/inputs/select/select.mjs +1 -3
- package/dist/ui/inputs/text/index.js +7 -144
- package/dist/ui/inputs/text/index.mjs +2 -4
- package/dist/ui/inputs/text/text.js +7 -144
- package/dist/ui/inputs/text/text.mjs +2 -4
- package/dist/ui/layout/container/container.mjs +64 -71
- package/dist/ui/layout/container/index.mjs +64 -71
- package/dist/ui/layout/index.mjs +69 -76
- package/dist/ui/layout/page/index.mjs +3 -3
- package/dist/ui/layout/page/page-loading.mjs +3 -3
- package/dist/ui/layout/page/section-loading.mjs +3 -3
- package/dist/ui/navigation/index.mjs +5 -5
- package/dist/ui/overlays/index.mjs +4 -4
- package/dist/ui/provider/index.mjs +3 -3
- package/dist/ui/provider/ui-provider.mjs +3 -3
- package/dist/ui/theme/colors/common.mjs +3 -3
- package/dist/ui/theme/colors/index.mjs +6 -6
- package/dist/ui/theme/colors/semantic.mjs +4 -4
- package/dist/ui/theme/colors.mjs +6 -6
- package/dist/ui/theme/index.mjs +6 -6
- package/dist/ui/theme/theme.mjs +6 -6
- package/package.json +1 -1
- package/dist/chunk-2UHA3DYG.mjs +0 -62
- package/dist/chunk-C2VWADF5.mjs +0 -34
- package/dist/chunk-CUEG2BFV.mjs +0 -34
- package/dist/chunk-MCQGBAUS.mjs +0 -73
- package/dist/chunk-NSU66J5E.mjs +0 -59
- package/dist/chunk-SEJXJZSK.mjs +0 -64
- package/dist/chunk-TUIN5YJW.mjs +0 -33
- package/dist/chunk-UQAG7TKJ.mjs +0 -1
- package/dist/chunk-VXYV37IM.mjs +0 -74
- package/dist/ui/form/rhf/fields/search-field.d.ts +0 -10
- package/dist/ui/form/rhf/fields/search-field.js +0 -296
- package/dist/ui/form/rhf/fields/search-field.mjs +0 -37
- package/dist/ui/inputs/clear-button.d.ts +0 -5
- package/dist/ui/inputs/clear-button.js +0 -67
- package/dist/ui/inputs/clear-button.mjs +0 -8
- package/dist/ui/inputs/input/use-input.d.ts +0 -19
- package/dist/ui/inputs/input/use-input.js +0 -82
- package/dist/ui/inputs/input/use-input.mjs +0 -7
- package/dist/ui/inputs/search/index.d.ts +0 -1
- package/dist/ui/inputs/search/index.js +0 -270
- package/dist/ui/inputs/search/index.mjs +0 -13
- package/dist/ui/inputs/search/search.d.ts +0 -7
- package/dist/ui/inputs/search/search.js +0 -268
- package/dist/ui/inputs/search/search.mjs +0 -12
- package/dist/ui/inputs/search/use-search.d.ts +0 -12
- package/dist/ui/inputs/search/use-search.js +0 -57
- package/dist/ui/inputs/search/use-search.mjs +0 -7
- package/dist/ui/inputs/select/use-select.d.ts +0 -17
- package/dist/ui/inputs/select/use-select.js +0 -85
- package/dist/ui/inputs/select/use-select.mjs +0 -7
- package/dist/{chunk-IXPMUODA.mjs → chunk-5WDV3PDI.mjs} +6 -6
- /package/dist/{chunk-5RNCFTW5.mjs → chunk-CZEO3U25.mjs} +0 -0
- /package/dist/{chunk-PTCNYQVY.mjs → chunk-Q6JSJOU4.mjs} +0 -0
package/dist/ui/inputs/index.js
CHANGED
|
@@ -34,14 +34,12 @@ __export(inputs_exports, {
|
|
|
34
34
|
Autocomplete: () => Autocomplete,
|
|
35
35
|
Checkbox: () => Checkbox,
|
|
36
36
|
CheckboxGroup: () => CheckboxGroup,
|
|
37
|
-
ClearButton: () => ClearButton,
|
|
38
37
|
DatePicker: () => DatePicker,
|
|
39
38
|
Email: () => Email,
|
|
40
39
|
FavoriteSwitch: () => FavoriteSwitch,
|
|
41
40
|
Input: () => Input,
|
|
42
41
|
Radio: () => Radio,
|
|
43
42
|
RadioGroup: () => RadioGroup,
|
|
44
|
-
Search: () => Search,
|
|
45
43
|
Select: () => Select,
|
|
46
44
|
Switch: () => Switch,
|
|
47
45
|
Text: () => Text,
|
|
@@ -91,361 +89,58 @@ var DatePicker = import_react4.default.forwardRef(
|
|
|
91
89
|
DatePicker.displayName = "TeachInUI.DatePicker";
|
|
92
90
|
|
|
93
91
|
// src/ui/inputs/email/email.tsx
|
|
94
|
-
var
|
|
92
|
+
var import_react6 = __toESM(require("react"));
|
|
95
93
|
|
|
96
94
|
// src/ui/inputs/input/input.tsx
|
|
97
|
-
var import_react7 = __toESM(require("react"));
|
|
98
|
-
var import_input = require("@heroui/input");
|
|
99
|
-
var import_tailwind_variants = require("tailwind-variants");
|
|
100
|
-
|
|
101
|
-
// src/ui/inputs/clear-button.tsx
|
|
102
95
|
var import_react5 = __toESM(require("react"));
|
|
103
|
-
var
|
|
104
|
-
var import_lucide_react = require("lucide-react");
|
|
96
|
+
var import_input = require("@heroui/input");
|
|
105
97
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
109
|
-
import_button.Button,
|
|
110
|
-
{
|
|
111
|
-
ref,
|
|
112
|
-
isIconOnly: true,
|
|
113
|
-
"aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
114
|
-
as: "span",
|
|
115
|
-
className: "opacity-0 transition-opacity group-hover:opacity-100",
|
|
116
|
-
color: "default",
|
|
117
|
-
radius: "full",
|
|
118
|
-
size: "sm",
|
|
119
|
-
tabIndex: 0,
|
|
120
|
-
variant: "light",
|
|
121
|
-
onPress: onClear,
|
|
122
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
ClearButton.displayName = "TeachInUI.ClearButton";
|
|
128
|
-
|
|
129
|
-
// src/ui/inputs/input/use-input.ts
|
|
130
|
-
var import_react6 = require("react");
|
|
131
|
-
function useInput({
|
|
132
|
-
value,
|
|
133
|
-
defaultValue,
|
|
134
|
-
onValueChange,
|
|
135
|
-
onClear,
|
|
136
|
-
isReadOnly,
|
|
137
|
-
isClearable = true,
|
|
138
|
-
ref
|
|
139
|
-
}) {
|
|
140
|
-
const inputRef = (0, import_react6.useRef)(null);
|
|
141
|
-
const [internalValue, setInternalValue] = (0, import_react6.useState)(defaultValue != null ? defaultValue : "");
|
|
142
|
-
const isControlled = value !== void 0;
|
|
143
|
-
const currentValue = isControlled ? value : internalValue;
|
|
144
|
-
const hasValue = String(currentValue).length > 0;
|
|
145
|
-
const handleValueChange = (0, import_react6.useCallback)(
|
|
146
|
-
(newValue) => {
|
|
147
|
-
if (!isControlled) {
|
|
148
|
-
setInternalValue(newValue);
|
|
149
|
-
}
|
|
150
|
-
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
151
|
-
},
|
|
152
|
-
[isControlled, onValueChange]
|
|
153
|
-
);
|
|
154
|
-
const handleClear = (0, import_react6.useCallback)(() => {
|
|
155
|
-
var _a;
|
|
156
|
-
onClear == null ? void 0 : onClear();
|
|
157
|
-
handleValueChange("");
|
|
158
|
-
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
159
|
-
}, [onClear, handleValueChange]);
|
|
160
|
-
const mergedRef = (0, import_react6.useCallback)(
|
|
161
|
-
(node) => {
|
|
162
|
-
inputRef.current = node;
|
|
163
|
-
if (typeof ref === "function") {
|
|
164
|
-
ref(node);
|
|
165
|
-
} else if (ref) {
|
|
166
|
-
ref.current = node;
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
[ref]
|
|
170
|
-
);
|
|
171
|
-
const showClearButton = hasValue && !isReadOnly && isClearable;
|
|
172
|
-
return {
|
|
173
|
-
inputRef,
|
|
174
|
-
currentValue,
|
|
175
|
-
hasValue,
|
|
176
|
-
handleValueChange,
|
|
177
|
-
handleClear,
|
|
178
|
-
mergedRef,
|
|
179
|
-
showClearButton
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// src/ui/inputs/input/input.tsx
|
|
184
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
185
|
-
var inputWrapperVariants = (0, import_tailwind_variants.tv)({
|
|
186
|
-
variants: {
|
|
187
|
-
variant: {
|
|
188
|
-
flat: "",
|
|
189
|
-
underlined: "",
|
|
190
|
-
bordered: "border-1",
|
|
191
|
-
faded: "border-1"
|
|
192
|
-
}
|
|
193
|
-
}
|
|
98
|
+
var Input = import_react5.default.forwardRef(({ ...props }, ref) => {
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_input.Input, { ref, ...props });
|
|
194
100
|
});
|
|
195
|
-
var Input = import_react7.default.forwardRef(
|
|
196
|
-
({
|
|
197
|
-
value,
|
|
198
|
-
defaultValue,
|
|
199
|
-
onClear,
|
|
200
|
-
onValueChange,
|
|
201
|
-
variant,
|
|
202
|
-
classNames,
|
|
203
|
-
endContent,
|
|
204
|
-
isReadOnly,
|
|
205
|
-
isClearable,
|
|
206
|
-
...props
|
|
207
|
-
}, ref) => {
|
|
208
|
-
const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
|
|
209
|
-
value,
|
|
210
|
-
defaultValue,
|
|
211
|
-
onValueChange,
|
|
212
|
-
onClear,
|
|
213
|
-
isReadOnly,
|
|
214
|
-
isClearable,
|
|
215
|
-
ref
|
|
216
|
-
});
|
|
217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
218
|
-
import_input.Input,
|
|
219
|
-
{
|
|
220
|
-
ref: mergedRef,
|
|
221
|
-
classNames: {
|
|
222
|
-
...classNames,
|
|
223
|
-
inputWrapper: inputWrapperVariants({ variant }),
|
|
224
|
-
innerWrapper: "group"
|
|
225
|
-
},
|
|
226
|
-
defaultValue,
|
|
227
|
-
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
228
|
-
endContent,
|
|
229
|
-
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ClearButton, { onClear: handleClear })
|
|
230
|
-
] }),
|
|
231
|
-
isReadOnly,
|
|
232
|
-
value: currentValue,
|
|
233
|
-
variant,
|
|
234
|
-
onValueChange: handleValueChange,
|
|
235
|
-
...props
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
101
|
Input.displayName = "TeachInUI.Input";
|
|
241
102
|
|
|
242
103
|
// src/ui/inputs/email/email.tsx
|
|
243
|
-
var
|
|
244
|
-
var Email =
|
|
245
|
-
return /* @__PURE__ */ (0,
|
|
104
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
105
|
+
var Email = import_react6.default.forwardRef(({ ...props }, ref) => {
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Input, { ref, autoComplete: "email", type: "email", ...props });
|
|
246
107
|
});
|
|
247
108
|
Email.displayName = "TeachInUI.Email";
|
|
248
109
|
|
|
249
|
-
// src/ui/inputs/search/search.tsx
|
|
250
|
-
var import_react10 = __toESM(require("react"));
|
|
251
|
-
var import_lucide_react2 = require("lucide-react");
|
|
252
|
-
var import_button2 = require("@heroui/button");
|
|
253
|
-
var import_tailwind_variants2 = require("tailwind-variants");
|
|
254
|
-
|
|
255
|
-
// src/ui/inputs/search/use-search.ts
|
|
256
|
-
var import_react9 = require("react");
|
|
257
|
-
function useSearch({ value, onSearch, onCancel, onKeyDown }) {
|
|
258
|
-
const handleKeyDown = (0, import_react9.useCallback)(
|
|
259
|
-
(event) => {
|
|
260
|
-
if (event.key === "Enter") {
|
|
261
|
-
event.preventDefault();
|
|
262
|
-
onSearch == null ? void 0 : onSearch(event.target.value);
|
|
263
|
-
} else if (event.key === "Escape") {
|
|
264
|
-
event.preventDefault();
|
|
265
|
-
onCancel == null ? void 0 : onCancel();
|
|
266
|
-
}
|
|
267
|
-
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
268
|
-
},
|
|
269
|
-
[onSearch, onCancel, onKeyDown]
|
|
270
|
-
);
|
|
271
|
-
const hasValue = value !== void 0 && String(value).length > 0;
|
|
272
|
-
const handleSearchClick = (0, import_react9.useCallback)(() => {
|
|
273
|
-
if (hasValue) {
|
|
274
|
-
onSearch == null ? void 0 : onSearch(value);
|
|
275
|
-
}
|
|
276
|
-
}, [value, onSearch]);
|
|
277
|
-
return {
|
|
278
|
-
handleKeyDown,
|
|
279
|
-
handleSearchClick,
|
|
280
|
-
hasValue
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// src/ui/inputs/search/search.tsx
|
|
285
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
286
|
-
var searchIconVariants = (0, import_tailwind_variants2.tv)({
|
|
287
|
-
base: "size-5 shrink-0",
|
|
288
|
-
variants: {
|
|
289
|
-
variant: {
|
|
290
|
-
faded: "text-default-400",
|
|
291
|
-
flat: "text-default-foreground",
|
|
292
|
-
bordered: "text-default-400",
|
|
293
|
-
underlined: "text-default-foreground"
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
var Search = import_react10.default.forwardRef(
|
|
298
|
-
({ variant = "bordered", radius = "full", value, onSearch, onCancel, onKeyDown, ...props }, ref) => {
|
|
299
|
-
const { handleKeyDown, handleSearchClick, hasValue } = useSearch({
|
|
300
|
-
value,
|
|
301
|
-
onSearch,
|
|
302
|
-
onCancel,
|
|
303
|
-
onKeyDown
|
|
304
|
-
});
|
|
305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
306
|
-
Input,
|
|
307
|
-
{
|
|
308
|
-
ref,
|
|
309
|
-
radius,
|
|
310
|
-
startContent: onSearch ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
311
|
-
import_button2.Button,
|
|
312
|
-
{
|
|
313
|
-
isIconOnly: true,
|
|
314
|
-
"aria-label": "\u041F\u043E\u0438\u0441\u043A",
|
|
315
|
-
isDisabled: !hasValue,
|
|
316
|
-
radius: "full",
|
|
317
|
-
size: "sm",
|
|
318
|
-
variant: "light",
|
|
319
|
-
onPress: handleSearchClick,
|
|
320
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) })
|
|
321
|
-
}
|
|
322
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) }),
|
|
323
|
-
value,
|
|
324
|
-
variant,
|
|
325
|
-
onKeyDown: handleKeyDown,
|
|
326
|
-
...props
|
|
327
|
-
}
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
);
|
|
331
|
-
Search.displayName = "TeachInUI.Search";
|
|
332
|
-
|
|
333
110
|
// src/ui/inputs/select/select.tsx
|
|
334
|
-
var
|
|
111
|
+
var import_react7 = __toESM(require("react"));
|
|
335
112
|
var import_select = require("@heroui/select");
|
|
336
|
-
var
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
if (isMultiple) {
|
|
360
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
361
|
-
} else {
|
|
362
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
[isControlled, onChange, isMultiple]
|
|
366
|
-
);
|
|
367
|
-
const handleClear = (0, import_react11.useCallback)(() => {
|
|
368
|
-
onClear == null ? void 0 : onClear();
|
|
369
|
-
handleChange(isMultiple ? [] : null);
|
|
370
|
-
}, [onClear, handleChange, isMultiple]);
|
|
371
|
-
const selectedKeys = (0, import_react11.useMemo)(() => {
|
|
372
|
-
if (currentValue == null) return /* @__PURE__ */ new Set();
|
|
373
|
-
return new Set(Array.isArray(currentValue) ? currentValue : [currentValue]);
|
|
374
|
-
}, [currentValue]);
|
|
375
|
-
const handleSelectionChange = (0, import_react11.useCallback)(
|
|
376
|
-
(keys) => {
|
|
377
|
-
var _a;
|
|
378
|
-
if (keys === "all") return;
|
|
379
|
-
const selected = Array.from(keys).filter((key) => typeof key === "string");
|
|
380
|
-
handleChange(isMultiple ? selected : (_a = selected[0]) != null ? _a : null);
|
|
381
|
-
},
|
|
382
|
-
[handleChange, isMultiple]
|
|
383
|
-
);
|
|
384
|
-
const showClearButton = hasValue && isClearable;
|
|
385
|
-
return {
|
|
386
|
-
currentValue,
|
|
387
|
-
hasValue,
|
|
388
|
-
selectedKeys,
|
|
389
|
-
handleSelectionChange,
|
|
390
|
-
handleClear,
|
|
391
|
-
showClearButton
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// src/ui/inputs/select/select.tsx
|
|
396
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
397
|
-
var selectWrapperVariants = (0, import_tailwind_variants3.tv)({
|
|
398
|
-
variants: {
|
|
399
|
-
variant: {
|
|
400
|
-
flat: "",
|
|
401
|
-
underlined: "",
|
|
402
|
-
bordered: "border-1",
|
|
403
|
-
faded: "border-1"
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
var Select = import_react12.default.forwardRef(
|
|
408
|
-
({
|
|
409
|
-
value,
|
|
410
|
-
defaultSelectedKeys,
|
|
411
|
-
items,
|
|
412
|
-
onChange,
|
|
413
|
-
selectionMode,
|
|
414
|
-
onClear,
|
|
415
|
-
variant,
|
|
416
|
-
classNames,
|
|
417
|
-
endContent,
|
|
418
|
-
isClearable,
|
|
419
|
-
...props
|
|
420
|
-
}, ref) => {
|
|
421
|
-
const { selectedKeys, handleSelectionChange, handleClear, showClearButton } = useSelect({
|
|
422
|
-
value,
|
|
423
|
-
onChange,
|
|
424
|
-
onClear,
|
|
425
|
-
selectionMode,
|
|
426
|
-
isClearable
|
|
427
|
-
});
|
|
428
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
113
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
114
|
+
var Select = import_react7.default.forwardRef(
|
|
115
|
+
({ value, items, onChange, selectionMode, ...props }, ref) => {
|
|
116
|
+
const isMultiple = selectionMode === "multiple";
|
|
117
|
+
const selectedKeys = import_react7.default.useMemo(() => {
|
|
118
|
+
if (value == null) return /* @__PURE__ */ new Set();
|
|
119
|
+
return new Set(Array.isArray(value) ? value : [value]);
|
|
120
|
+
}, [value]);
|
|
121
|
+
const handleSelectionChange = import_react7.default.useCallback(
|
|
122
|
+
(keys) => {
|
|
123
|
+
var _a;
|
|
124
|
+
if (keys === "all") return;
|
|
125
|
+
const selected = Array.from(keys).filter((key) => typeof key === "string");
|
|
126
|
+
if (isMultiple) {
|
|
127
|
+
onChange == null ? void 0 : onChange(selected);
|
|
128
|
+
} else {
|
|
129
|
+
onChange == null ? void 0 : onChange((_a = selected[0]) != null ? _a : null);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
[onChange, isMultiple]
|
|
133
|
+
);
|
|
134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
429
135
|
import_select.Select,
|
|
430
136
|
{
|
|
431
137
|
ref,
|
|
432
|
-
classNames: {
|
|
433
|
-
...classNames,
|
|
434
|
-
trigger: selectWrapperVariants({ variant }),
|
|
435
|
-
innerWrapper: "group"
|
|
436
|
-
},
|
|
437
|
-
defaultSelectedKeys,
|
|
438
|
-
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
439
|
-
endContent,
|
|
440
|
-
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ClearButton, { onClear: handleClear })
|
|
441
|
-
] }),
|
|
442
138
|
items,
|
|
443
139
|
selectedKeys,
|
|
444
140
|
selectionMode,
|
|
445
|
-
variant,
|
|
446
141
|
onSelectionChange: handleSelectionChange,
|
|
447
142
|
...props,
|
|
448
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
143
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select.SelectItem, { children: item.label }, item.key)
|
|
449
144
|
}
|
|
450
145
|
);
|
|
451
146
|
}
|
|
@@ -453,20 +148,20 @@ var Select = import_react12.default.forwardRef(
|
|
|
453
148
|
Select.displayName = "TeachInUI.Select";
|
|
454
149
|
|
|
455
150
|
// src/ui/inputs/switch/switch.tsx
|
|
456
|
-
var
|
|
151
|
+
var import_react8 = __toESM(require("react"));
|
|
457
152
|
var import_switch = require("@heroui/switch");
|
|
458
|
-
var
|
|
459
|
-
var Switch =
|
|
460
|
-
return /* @__PURE__ */ (0,
|
|
153
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
154
|
+
var Switch = import_react8.default.forwardRef(({ ...props }, ref) => {
|
|
155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_switch.Switch, { ref, ...props });
|
|
461
156
|
});
|
|
462
157
|
Switch.displayName = "TeachInUI.Switch";
|
|
463
158
|
|
|
464
159
|
// src/ui/inputs/switch/favorite-switch.tsx
|
|
465
160
|
var import_switch2 = require("@heroui/switch");
|
|
466
|
-
var
|
|
467
|
-
var
|
|
468
|
-
var
|
|
469
|
-
var bookmarkVariants = (0,
|
|
161
|
+
var import_lucide_react = require("lucide-react");
|
|
162
|
+
var import_tailwind_variants = require("tailwind-variants");
|
|
163
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
164
|
+
var bookmarkVariants = (0, import_tailwind_variants.tv)({
|
|
470
165
|
base: "size-6 stroke-default-400 group-hover:fill-primary-100 group-hover:stroke-default-400",
|
|
471
166
|
variants: {
|
|
472
167
|
isSelected: {
|
|
@@ -479,16 +174,16 @@ function FavoriteSwitch({ isSelected, onValueChange }) {
|
|
|
479
174
|
isSelected,
|
|
480
175
|
onValueChange
|
|
481
176
|
});
|
|
482
|
-
return /* @__PURE__ */ (0,
|
|
483
|
-
/* @__PURE__ */ (0,
|
|
484
|
-
/* @__PURE__ */ (0,
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Component, { ...getBaseProps(), children: [
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sr-only", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { ...getInputProps() }) }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
485
180
|
"div",
|
|
486
181
|
{
|
|
487
182
|
...getWrapperProps(),
|
|
488
183
|
className: slots.wrapper({
|
|
489
184
|
class: "flex h-8 w-8 cursor-pointer items-center justify-center rounded-sm !bg-transparent"
|
|
490
185
|
}),
|
|
491
|
-
children: /* @__PURE__ */ (0,
|
|
186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react.Bookmark, { className: bookmarkVariants({ isSelected }) })
|
|
492
187
|
}
|
|
493
188
|
)
|
|
494
189
|
] });
|
|
@@ -499,31 +194,31 @@ var import_radio = require("@heroui/radio");
|
|
|
499
194
|
var Radio = Object.assign(import_radio.Radio, { displayName: "TeachInUI.Radio" });
|
|
500
195
|
|
|
501
196
|
// src/ui/inputs/radio/radio-group.tsx
|
|
502
|
-
var
|
|
197
|
+
var import_react9 = __toESM(require("react"));
|
|
503
198
|
var import_radio2 = require("@heroui/radio");
|
|
504
|
-
var
|
|
505
|
-
var RadioGroup =
|
|
199
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
200
|
+
var RadioGroup = import_react9.default.forwardRef(
|
|
506
201
|
(props, ref) => {
|
|
507
|
-
return /* @__PURE__ */ (0,
|
|
202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_radio2.RadioGroup, { ref, ...props });
|
|
508
203
|
}
|
|
509
204
|
);
|
|
510
205
|
RadioGroup.displayName = "TeachInUI.RadioGroup";
|
|
511
206
|
|
|
512
207
|
// src/ui/inputs/text/text.tsx
|
|
513
|
-
var
|
|
514
|
-
var
|
|
515
|
-
var Text =
|
|
516
|
-
return /* @__PURE__ */ (0,
|
|
208
|
+
var import_react10 = __toESM(require("react"));
|
|
209
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
210
|
+
var Text = import_react10.default.forwardRef(({ ...props }, ref) => {
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input, { ref, type: "text", ...props });
|
|
517
212
|
});
|
|
518
213
|
Text.displayName = "TeachInUI.Text";
|
|
519
214
|
|
|
520
215
|
// src/ui/inputs/textarea/textarea.tsx
|
|
521
|
-
var
|
|
522
|
-
var
|
|
523
|
-
var
|
|
524
|
-
var Textarea =
|
|
216
|
+
var import_input5 = require("@heroui/input");
|
|
217
|
+
var import_react11 = __toESM(require("react"));
|
|
218
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
219
|
+
var Textarea = import_react11.default.forwardRef(
|
|
525
220
|
({ minRows = 4, ...props }, ref) => {
|
|
526
|
-
return /* @__PURE__ */ (0,
|
|
221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_input5.Textarea, { ref, minRows, ...props });
|
|
527
222
|
}
|
|
528
223
|
);
|
|
529
224
|
Textarea.displayName = "TeachInUI.Textarea";
|
|
@@ -532,14 +227,12 @@ Textarea.displayName = "TeachInUI.Textarea";
|
|
|
532
227
|
Autocomplete,
|
|
533
228
|
Checkbox,
|
|
534
229
|
CheckboxGroup,
|
|
535
|
-
ClearButton,
|
|
536
230
|
DatePicker,
|
|
537
231
|
Email,
|
|
538
232
|
FavoriteSwitch,
|
|
539
233
|
Input,
|
|
540
234
|
Radio,
|
|
541
235
|
RadioGroup,
|
|
542
|
-
Search,
|
|
543
236
|
Select,
|
|
544
237
|
Switch,
|
|
545
238
|
Text,
|
package/dist/ui/inputs/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../../chunk-
|
|
3
|
-
import "../../chunk-
|
|
2
|
+
import "../../chunk-CZEO3U25.mjs";
|
|
3
|
+
import "../../chunk-5HK7HRTR.mjs";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "../../chunk-
|
|
5
|
+
Textarea
|
|
6
|
+
} from "../../chunk-HJUZTISD.mjs";
|
|
7
7
|
import "../../chunk-LLP2PTPK.mjs";
|
|
8
8
|
import {
|
|
9
9
|
FavoriteSwitch
|
|
@@ -11,29 +11,6 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
Switch
|
|
13
13
|
} from "../../chunk-N3EAW6UO.mjs";
|
|
14
|
-
import "../../chunk-5HK7HRTR.mjs";
|
|
15
|
-
import {
|
|
16
|
-
Textarea
|
|
17
|
-
} from "../../chunk-HJUZTISD.mjs";
|
|
18
|
-
import "../../chunk-V3KKDSQP.mjs";
|
|
19
|
-
import {
|
|
20
|
-
Email
|
|
21
|
-
} from "../../chunk-46SKVFMZ.mjs";
|
|
22
|
-
import "../../chunk-AQ3ISJKU.mjs";
|
|
23
|
-
import {
|
|
24
|
-
Select
|
|
25
|
-
} from "../../chunk-VXYV37IM.mjs";
|
|
26
|
-
import "../../chunk-2UHA3DYG.mjs";
|
|
27
|
-
import "../../chunk-5RNCFTW5.mjs";
|
|
28
|
-
import {
|
|
29
|
-
Search
|
|
30
|
-
} from "../../chunk-SEJXJZSK.mjs";
|
|
31
|
-
import "../../chunk-C2VWADF5.mjs";
|
|
32
|
-
import "../../chunk-UUKS7JYX.mjs";
|
|
33
|
-
import "../../chunk-V2HNFTTX.mjs";
|
|
34
|
-
import {
|
|
35
|
-
DatePicker
|
|
36
|
-
} from "../../chunk-IAJ6G633.mjs";
|
|
37
14
|
import "../../chunk-RRA7GWP2.mjs";
|
|
38
15
|
import {
|
|
39
16
|
RadioGroup
|
|
@@ -41,36 +18,47 @@ import {
|
|
|
41
18
|
import {
|
|
42
19
|
Radio
|
|
43
20
|
} from "../../chunk-2SNKT7I4.mjs";
|
|
21
|
+
import "../../chunk-DUQFM3QS.mjs";
|
|
22
|
+
import {
|
|
23
|
+
Text
|
|
24
|
+
} from "../../chunk-KTUGFQWJ.mjs";
|
|
25
|
+
import "../../chunk-UUKS7JYX.mjs";
|
|
26
|
+
import {
|
|
27
|
+
Checkbox
|
|
28
|
+
} from "../../chunk-N3QOXWJI.mjs";
|
|
29
|
+
import "../../chunk-V3KKDSQP.mjs";
|
|
30
|
+
import {
|
|
31
|
+
Email
|
|
32
|
+
} from "../../chunk-LJIVY6GU.mjs";
|
|
44
33
|
import "../../chunk-ZRHEFEFS.mjs";
|
|
45
34
|
import {
|
|
46
35
|
Input
|
|
47
|
-
} from "../../chunk-
|
|
48
|
-
import "../../chunk-
|
|
36
|
+
} from "../../chunk-V2G5QHZZ.mjs";
|
|
37
|
+
import "../../chunk-AQ3ISJKU.mjs";
|
|
38
|
+
import {
|
|
39
|
+
Select
|
|
40
|
+
} from "../../chunk-3YOW5DEZ.mjs";
|
|
49
41
|
import "../../chunk-WYJW5NNA.mjs";
|
|
50
42
|
import {
|
|
51
43
|
Autocomplete
|
|
52
44
|
} from "../../chunk-C3MURCMZ.mjs";
|
|
45
|
+
import "../../chunk-V2HNFTTX.mjs";
|
|
46
|
+
import {
|
|
47
|
+
DatePicker
|
|
48
|
+
} from "../../chunk-IAJ6G633.mjs";
|
|
53
49
|
import {
|
|
54
50
|
CheckboxGroup
|
|
55
51
|
} from "../../chunk-C4PCTOGM.mjs";
|
|
56
|
-
import {
|
|
57
|
-
Checkbox
|
|
58
|
-
} from "../../chunk-N3QOXWJI.mjs";
|
|
59
|
-
import {
|
|
60
|
-
ClearButton
|
|
61
|
-
} from "../../chunk-TUIN5YJW.mjs";
|
|
62
52
|
export {
|
|
63
53
|
Autocomplete,
|
|
64
54
|
Checkbox,
|
|
65
55
|
CheckboxGroup,
|
|
66
|
-
ClearButton,
|
|
67
56
|
DatePicker,
|
|
68
57
|
Email,
|
|
69
58
|
FavoriteSwitch,
|
|
70
59
|
Input,
|
|
71
60
|
Radio,
|
|
72
61
|
RadioGroup,
|
|
73
|
-
Search,
|
|
74
62
|
Select,
|
|
75
63
|
Switch,
|
|
76
64
|
Text,
|