@teach-in/react 1.5.0 → 1.6.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/dist/{chunk-2UHA3DYG.mjs → chunk-6BWSC6ZH.mjs} +3 -10
- package/dist/chunk-7WIZONLU.mjs +81 -0
- package/dist/chunk-ALGSVEUS.mjs +1 -0
- package/dist/chunk-BHOCYKBI.mjs +81 -0
- package/dist/{chunk-VXYV37IM.mjs → chunk-C5FQB2UN.mjs} +16 -8
- package/dist/{chunk-CKJ5U5Q4.mjs → chunk-DEKPRZIQ.mjs} +1 -1
- package/dist/chunk-GEPCSZCU.mjs +71 -0
- package/dist/chunk-VDPROXMN.mjs +57 -0
- package/dist/{chunk-R46SWVWL.mjs → chunk-ZK6VZMUJ.mjs} +1 -1
- package/dist/index.js +487 -248
- package/dist/index.mjs +189 -181
- package/dist/ui/data/index.js +56 -7
- package/dist/ui/data/index.mjs +10 -8
- package/dist/ui/data/user/index.js +51 -2
- package/dist/ui/data/user/index.mjs +3 -1
- package/dist/ui/data/user/user.d.ts +24 -2
- package/dist/ui/data/user/user.js +52 -2
- package/dist/ui/data/user/user.mjs +4 -1
- package/dist/ui/feedback/index.mjs +12 -12
- package/dist/ui/feedback/progress/index.mjs +3 -3
- package/dist/ui/form/index.js +76 -18
- package/dist/ui/form/index.mjs +24 -19
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/email-field.js +58 -3
- package/dist/ui/form/rhf/fields/email-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/index.js +76 -18
- package/dist/ui/form/rhf/fields/index.mjs +21 -16
- package/dist/ui/form/rhf/fields/input-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/radio-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/search-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/select-field.js +18 -15
- package/dist/ui/form/rhf/fields/select-field.mjs +20 -15
- package/dist/ui/form/rhf/fields/switch-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/text-field.mjs +19 -14
- package/dist/ui/form/rhf/fields/textarea-field.mjs +19 -14
- package/dist/ui/form/rhf/index.js +76 -18
- package/dist/ui/form/rhf/index.mjs +21 -16
- package/dist/ui/format/index.mjs +6 -6
- package/dist/ui/index.js +487 -248
- package/dist/ui/index.mjs +189 -181
- package/dist/ui/inputs/checkbox/index.mjs +3 -3
- package/dist/ui/inputs/email/email.js +58 -3
- package/dist/ui/inputs/email/email.mjs +1 -1
- package/dist/ui/inputs/email/index.js +58 -3
- package/dist/ui/inputs/email/index.mjs +1 -1
- package/dist/ui/inputs/index.d.ts +1 -0
- package/dist/ui/inputs/index.js +273 -67
- package/dist/ui/inputs/index.mjs +36 -26
- package/dist/ui/inputs/number/index.d.ts +1 -0
- package/dist/ui/inputs/number/index.js +218 -0
- package/dist/ui/inputs/number/index.mjs +12 -0
- package/dist/ui/inputs/number/number.d.ts +12 -0
- package/dist/ui/inputs/number/number.js +219 -0
- package/dist/ui/inputs/number/number.mjs +13 -0
- package/dist/ui/inputs/number/use-number.d.ts +20 -0
- package/dist/ui/inputs/number/use-number.js +104 -0
- package/dist/ui/inputs/number/use-number.mjs +7 -0
- package/dist/ui/inputs/radio/index.mjs +3 -3
- package/dist/ui/inputs/select/index.d.ts +1 -1
- package/dist/ui/inputs/select/index.js +23 -17
- package/dist/ui/inputs/select/index.mjs +8 -4
- package/dist/ui/inputs/select/select.d.ts +11 -22
- package/dist/ui/inputs/select/select.js +23 -17
- package/dist/ui/inputs/select/select.mjs +8 -4
- package/dist/ui/inputs/select/use-select.d.ts +0 -1
- package/dist/ui/inputs/select/use-select.js +2 -9
- package/dist/ui/inputs/select/use-select.mjs +1 -1
- package/dist/ui/inputs/switch/index.mjs +3 -3
- package/dist/ui/layout/container/container.mjs +88 -85
- package/dist/ui/layout/container/index.mjs +88 -85
- package/dist/ui/layout/index.js +7 -7
- package/dist/ui/layout/index.mjs +95 -92
- package/dist/ui/layout/page/index.mjs +6 -6
- package/dist/ui/layout/page/page-loading.mjs +5 -5
- package/dist/ui/layout/page/section-loading.mjs +5 -5
- package/dist/ui/navigation/index.mjs +5 -5
- package/dist/ui/overlays/index.mjs +4 -4
- package/dist/ui/provider/index.mjs +5 -5
- package/dist/ui/provider/ui-provider.mjs +5 -5
- package/dist/ui/surface/index.mjs +1 -1
- package/dist/ui/theme/colors/index.mjs +1 -1
- package/dist/ui/theme/colors.mjs +1 -1
- package/dist/ui/theme/index.mjs +1 -1
- package/dist/ui/theme/theme.d.ts +2 -1
- package/dist/ui/theme/theme.mjs +1 -1
- package/package.json +13 -9
- package/LICENSE +0 -21
- package/dist/chunk-46SKVFMZ.mjs +0 -16
- package/dist/chunk-XHCXM5MU.mjs +0 -14
- /package/dist/{chunk-UQAG7TKJ.mjs → chunk-37MCHF7U.mjs} +0 -0
package/dist/ui/inputs/index.js
CHANGED
|
@@ -39,10 +39,12 @@ __export(inputs_exports, {
|
|
|
39
39
|
Email: () => Email,
|
|
40
40
|
FavoriteSwitch: () => FavoriteSwitch,
|
|
41
41
|
Input: () => Input,
|
|
42
|
+
Number: () => Number2,
|
|
42
43
|
Radio: () => Radio,
|
|
43
44
|
RadioGroup: () => RadioGroup,
|
|
44
45
|
Search: () => Search,
|
|
45
46
|
Select: () => Select,
|
|
47
|
+
SelectItem: () => SelectItem,
|
|
46
48
|
Switch: () => Switch,
|
|
47
49
|
Text: () => Text,
|
|
48
50
|
Textarea: () => Textarea
|
|
@@ -241,21 +243,226 @@ Input.displayName = "TeachInUI.Input";
|
|
|
241
243
|
|
|
242
244
|
// src/ui/inputs/email/email.tsx
|
|
243
245
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
244
|
-
var
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
var EMAIL_REGEX = /^(?!\.)(?!.*\.\.)[A-Za-zА-Яа-яЁё0-9._+%-]+(?<!\.)@(?:(?:[A-Za-zА-Яа-яЁё0-9](?:[A-Za-zА-Яа-яЁё0-9-]*[A-Za-zА-Яа-яЁё0-9])?)\.)+[A-Za-zА-Яа-яЁё]{2,}$/u;
|
|
247
|
+
var DEFAULT_ERROR_MESSAGE = "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 email";
|
|
248
|
+
var defaultValidateEmail = (value) => {
|
|
249
|
+
if (!value) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
return EMAIL_REGEX.test(value) ? true : DEFAULT_ERROR_MESSAGE;
|
|
253
|
+
};
|
|
254
|
+
function getValidationMessage(result) {
|
|
255
|
+
if (typeof result === "string") {
|
|
256
|
+
return result;
|
|
257
|
+
}
|
|
258
|
+
if (Array.isArray(result)) {
|
|
259
|
+
return result.join(" ");
|
|
260
|
+
}
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
var Email = import_react8.default.forwardRef(
|
|
264
|
+
({
|
|
265
|
+
defaultValue,
|
|
266
|
+
errorMessage,
|
|
267
|
+
isInvalid,
|
|
268
|
+
onValueChange,
|
|
269
|
+
validate = defaultValidateEmail,
|
|
270
|
+
value,
|
|
271
|
+
...props
|
|
272
|
+
}, ref) => {
|
|
273
|
+
const [internalValue, setInternalValue] = import_react8.default.useState(defaultValue != null ? defaultValue : "");
|
|
274
|
+
const isControlled = value !== void 0;
|
|
275
|
+
const currentValue = isControlled ? value : internalValue;
|
|
276
|
+
const handleValueChange = import_react8.default.useCallback(
|
|
277
|
+
(nextValue) => {
|
|
278
|
+
if (!isControlled) {
|
|
279
|
+
setInternalValue(nextValue);
|
|
280
|
+
}
|
|
281
|
+
onValueChange == null ? void 0 : onValueChange(nextValue);
|
|
282
|
+
},
|
|
283
|
+
[isControlled, onValueChange]
|
|
284
|
+
);
|
|
285
|
+
const validationMessage = getValidationMessage(validate(currentValue != null ? currentValue : ""));
|
|
286
|
+
const resolvedErrorMessage = errorMessage != null ? errorMessage : validationMessage;
|
|
287
|
+
const resolvedIsInvalid = isInvalid != null ? isInvalid : Boolean(validationMessage);
|
|
288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
289
|
+
Input,
|
|
290
|
+
{
|
|
291
|
+
ref,
|
|
292
|
+
autoComplete: "email",
|
|
293
|
+
errorMessage: resolvedErrorMessage,
|
|
294
|
+
isInvalid: resolvedIsInvalid,
|
|
295
|
+
type: "email",
|
|
296
|
+
validate,
|
|
297
|
+
value: currentValue,
|
|
298
|
+
onValueChange: handleValueChange,
|
|
299
|
+
...props
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
);
|
|
247
304
|
Email.displayName = "TeachInUI.Email";
|
|
248
305
|
|
|
249
|
-
// src/ui/inputs/
|
|
306
|
+
// src/ui/inputs/number/number.tsx
|
|
250
307
|
var import_react10 = __toESM(require("react"));
|
|
308
|
+
var import_number_input = require("@heroui/number-input");
|
|
309
|
+
var import_tailwind_variants2 = require("tailwind-variants");
|
|
310
|
+
|
|
311
|
+
// src/ui/style/css.ts
|
|
312
|
+
var import_clsx = require("clsx");
|
|
313
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
314
|
+
function cn(...inputs) {
|
|
315
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/ui/inputs/number/use-number.ts
|
|
319
|
+
var import_number = require("@internationalized/number");
|
|
320
|
+
var import_react9 = require("react");
|
|
321
|
+
function normalizeNumberValue(value) {
|
|
322
|
+
if (value == null || Number.isNaN(value)) {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
return value;
|
|
326
|
+
}
|
|
327
|
+
function useNumber({
|
|
328
|
+
locale,
|
|
329
|
+
value,
|
|
330
|
+
onChange,
|
|
331
|
+
onValueChange,
|
|
332
|
+
onClear,
|
|
333
|
+
isReadOnly,
|
|
334
|
+
isClearable = true,
|
|
335
|
+
ref
|
|
336
|
+
}) {
|
|
337
|
+
const inputRef = (0, import_react9.useRef)(null);
|
|
338
|
+
const currentValue = normalizeNumberValue(value);
|
|
339
|
+
const hasValue = currentValue !== null;
|
|
340
|
+
const currentLocale = locale != null ? locale : Intl.NumberFormat().resolvedOptions().locale;
|
|
341
|
+
const numberParser = (0, import_react9.useMemo)(() => new import_number.NumberParser(currentLocale), [currentLocale]);
|
|
342
|
+
const emitValueChange = (0, import_react9.useCallback)(
|
|
343
|
+
(newValue) => {
|
|
344
|
+
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
345
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
346
|
+
},
|
|
347
|
+
[onChange, onValueChange]
|
|
348
|
+
);
|
|
349
|
+
const handleValueChange = (0, import_react9.useCallback)(
|
|
350
|
+
(incomingValue) => {
|
|
351
|
+
let newValue = null;
|
|
352
|
+
if (incomingValue === null) {
|
|
353
|
+
newValue = null;
|
|
354
|
+
} else if (typeof incomingValue === "number") {
|
|
355
|
+
newValue = Number.isNaN(incomingValue) ? null : incomingValue;
|
|
356
|
+
} else {
|
|
357
|
+
const rawValue = incomingValue.target.value;
|
|
358
|
+
newValue = rawValue === "" ? null : numberParser.parse(rawValue);
|
|
359
|
+
newValue = Number.isNaN(newValue) ? null : newValue;
|
|
360
|
+
}
|
|
361
|
+
emitValueChange(newValue);
|
|
362
|
+
},
|
|
363
|
+
[emitValueChange, numberParser]
|
|
364
|
+
);
|
|
365
|
+
const handleClear = (0, import_react9.useCallback)(() => {
|
|
366
|
+
var _a;
|
|
367
|
+
onClear == null ? void 0 : onClear();
|
|
368
|
+
emitValueChange(null);
|
|
369
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
370
|
+
}, [emitValueChange, onClear]);
|
|
371
|
+
const mergedRef = (0, import_react9.useCallback)(
|
|
372
|
+
(node) => {
|
|
373
|
+
inputRef.current = node;
|
|
374
|
+
if (typeof ref === "function") {
|
|
375
|
+
ref(node);
|
|
376
|
+
} else if (ref) {
|
|
377
|
+
ref.current = node;
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
[ref]
|
|
381
|
+
);
|
|
382
|
+
const showClearButton = hasValue && !isReadOnly && isClearable;
|
|
383
|
+
return {
|
|
384
|
+
inputRef,
|
|
385
|
+
currentValue,
|
|
386
|
+
hasValue,
|
|
387
|
+
handleValueChange,
|
|
388
|
+
handleClear,
|
|
389
|
+
mergedRef,
|
|
390
|
+
showClearButton
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// src/ui/inputs/number/number.tsx
|
|
395
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
396
|
+
var inputWrapperVariants2 = (0, import_tailwind_variants2.tv)({
|
|
397
|
+
variants: {
|
|
398
|
+
variant: {
|
|
399
|
+
flat: "",
|
|
400
|
+
underlined: "",
|
|
401
|
+
bordered: "border-1",
|
|
402
|
+
faded: "border-1"
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
var Number2 = import_react10.default.forwardRef(
|
|
407
|
+
({
|
|
408
|
+
locale,
|
|
409
|
+
value,
|
|
410
|
+
onChange,
|
|
411
|
+
onValueChange,
|
|
412
|
+
onClear,
|
|
413
|
+
variant,
|
|
414
|
+
classNames,
|
|
415
|
+
endContent,
|
|
416
|
+
isReadOnly,
|
|
417
|
+
isClearable,
|
|
418
|
+
...props
|
|
419
|
+
}, ref) => {
|
|
420
|
+
const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useNumber({
|
|
421
|
+
locale,
|
|
422
|
+
value,
|
|
423
|
+
onChange,
|
|
424
|
+
onValueChange,
|
|
425
|
+
onClear,
|
|
426
|
+
isReadOnly,
|
|
427
|
+
isClearable,
|
|
428
|
+
ref
|
|
429
|
+
});
|
|
430
|
+
const normalizedValue = currentValue === null ? globalThis.Number.NaN : currentValue;
|
|
431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
432
|
+
import_number_input.NumberInput,
|
|
433
|
+
{
|
|
434
|
+
ref: mergedRef,
|
|
435
|
+
classNames: {
|
|
436
|
+
...classNames,
|
|
437
|
+
inputWrapper: cn(inputWrapperVariants2({ variant }), classNames == null ? void 0 : classNames.inputWrapper),
|
|
438
|
+
innerWrapper: cn("group", classNames == null ? void 0 : classNames.innerWrapper)
|
|
439
|
+
},
|
|
440
|
+
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
441
|
+
endContent,
|
|
442
|
+
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ClearButton, { onClear: handleClear })
|
|
443
|
+
] }),
|
|
444
|
+
inputMode: "decimal",
|
|
445
|
+
isReadOnly,
|
|
446
|
+
value: normalizedValue,
|
|
447
|
+
variant,
|
|
448
|
+
onChange: handleValueChange,
|
|
449
|
+
...props
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
);
|
|
454
|
+
Number2.displayName = "TeachInUI.Number";
|
|
455
|
+
|
|
456
|
+
// src/ui/inputs/search/search.tsx
|
|
457
|
+
var import_react12 = __toESM(require("react"));
|
|
251
458
|
var import_lucide_react2 = require("lucide-react");
|
|
252
459
|
var import_button2 = require("@heroui/button");
|
|
253
|
-
var
|
|
460
|
+
var import_tailwind_variants3 = require("tailwind-variants");
|
|
254
461
|
|
|
255
462
|
// src/ui/inputs/search/use-search.ts
|
|
256
|
-
var
|
|
463
|
+
var import_react11 = require("react");
|
|
257
464
|
function useSearch({ value, onSearch, onCancel, onKeyDown }) {
|
|
258
|
-
const handleKeyDown = (0,
|
|
465
|
+
const handleKeyDown = (0, import_react11.useCallback)(
|
|
259
466
|
(event) => {
|
|
260
467
|
if (event.key === "Enter") {
|
|
261
468
|
event.preventDefault();
|
|
@@ -269,7 +476,7 @@ function useSearch({ value, onSearch, onCancel, onKeyDown }) {
|
|
|
269
476
|
[onSearch, onCancel, onKeyDown]
|
|
270
477
|
);
|
|
271
478
|
const hasValue = value !== void 0 && String(value).length > 0;
|
|
272
|
-
const handleSearchClick = (0,
|
|
479
|
+
const handleSearchClick = (0, import_react11.useCallback)(() => {
|
|
273
480
|
if (hasValue) {
|
|
274
481
|
onSearch == null ? void 0 : onSearch(value);
|
|
275
482
|
}
|
|
@@ -282,8 +489,8 @@ function useSearch({ value, onSearch, onCancel, onKeyDown }) {
|
|
|
282
489
|
}
|
|
283
490
|
|
|
284
491
|
// src/ui/inputs/search/search.tsx
|
|
285
|
-
var
|
|
286
|
-
var searchIconVariants = (0,
|
|
492
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
493
|
+
var searchIconVariants = (0, import_tailwind_variants3.tv)({
|
|
287
494
|
base: "size-5 shrink-0",
|
|
288
495
|
variants: {
|
|
289
496
|
variant: {
|
|
@@ -294,7 +501,7 @@ var searchIconVariants = (0, import_tailwind_variants2.tv)({
|
|
|
294
501
|
}
|
|
295
502
|
}
|
|
296
503
|
});
|
|
297
|
-
var Search =
|
|
504
|
+
var Search = import_react12.default.forwardRef(
|
|
298
505
|
({ variant = "bordered", radius = "full", value, onSearch, onCancel, onKeyDown, ...props }, ref) => {
|
|
299
506
|
const { handleKeyDown, handleSearchClick, hasValue } = useSearch({
|
|
300
507
|
value,
|
|
@@ -302,12 +509,12 @@ var Search = import_react10.default.forwardRef(
|
|
|
302
509
|
onCancel,
|
|
303
510
|
onKeyDown
|
|
304
511
|
});
|
|
305
|
-
return /* @__PURE__ */ (0,
|
|
512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
306
513
|
Input,
|
|
307
514
|
{
|
|
308
515
|
ref,
|
|
309
516
|
radius,
|
|
310
|
-
startContent: onSearch ? /* @__PURE__ */ (0,
|
|
517
|
+
startContent: onSearch ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
311
518
|
import_button2.Button,
|
|
312
519
|
{
|
|
313
520
|
isIconOnly: true,
|
|
@@ -317,9 +524,9 @@ var Search = import_react10.default.forwardRef(
|
|
|
317
524
|
size: "sm",
|
|
318
525
|
variant: "light",
|
|
319
526
|
onPress: handleSearchClick,
|
|
320
|
-
children: /* @__PURE__ */ (0,
|
|
527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) })
|
|
321
528
|
}
|
|
322
|
-
) : /* @__PURE__ */ (0,
|
|
529
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) }),
|
|
323
530
|
value,
|
|
324
531
|
variant,
|
|
325
532
|
onKeyDown: handleKeyDown,
|
|
@@ -331,12 +538,12 @@ var Search = import_react10.default.forwardRef(
|
|
|
331
538
|
Search.displayName = "TeachInUI.Search";
|
|
332
539
|
|
|
333
540
|
// src/ui/inputs/select/select.tsx
|
|
334
|
-
var
|
|
541
|
+
var import_react14 = __toESM(require("react"));
|
|
335
542
|
var import_select = require("@heroui/select");
|
|
336
|
-
var
|
|
543
|
+
var import_tailwind_variants4 = require("tailwind-variants");
|
|
337
544
|
|
|
338
545
|
// src/ui/inputs/select/use-select.ts
|
|
339
|
-
var
|
|
546
|
+
var import_react13 = require("react");
|
|
340
547
|
function useSelect({
|
|
341
548
|
value,
|
|
342
549
|
onChange,
|
|
@@ -345,34 +552,27 @@ function useSelect({
|
|
|
345
552
|
isClearable = true
|
|
346
553
|
}) {
|
|
347
554
|
const isMultiple = selectionMode === "multiple";
|
|
348
|
-
const [
|
|
349
|
-
isMultiple ? [] : null
|
|
350
|
-
);
|
|
351
|
-
const isControlled = value !== void 0;
|
|
352
|
-
const currentValue = isControlled ? value : internalValue;
|
|
555
|
+
const currentValue = value != null ? value : isMultiple ? [] : null;
|
|
353
556
|
const hasValue = currentValue != null && (Array.isArray(currentValue) ? currentValue.length > 0 : currentValue !== "");
|
|
354
|
-
const handleChange = (0,
|
|
557
|
+
const handleChange = (0, import_react13.useCallback)(
|
|
355
558
|
(newValue) => {
|
|
356
|
-
if (!isControlled) {
|
|
357
|
-
setInternalValue(newValue);
|
|
358
|
-
}
|
|
359
559
|
if (isMultiple) {
|
|
360
560
|
onChange == null ? void 0 : onChange(newValue);
|
|
361
561
|
} else {
|
|
362
562
|
onChange == null ? void 0 : onChange(newValue);
|
|
363
563
|
}
|
|
364
564
|
},
|
|
365
|
-
[
|
|
565
|
+
[onChange, isMultiple]
|
|
366
566
|
);
|
|
367
|
-
const handleClear = (0,
|
|
567
|
+
const handleClear = (0, import_react13.useCallback)(() => {
|
|
368
568
|
onClear == null ? void 0 : onClear();
|
|
369
569
|
handleChange(isMultiple ? [] : null);
|
|
370
570
|
}, [onClear, handleChange, isMultiple]);
|
|
371
|
-
const selectedKeys = (0,
|
|
571
|
+
const selectedKeys = (0, import_react13.useMemo)(() => {
|
|
372
572
|
if (currentValue == null) return /* @__PURE__ */ new Set();
|
|
373
573
|
return new Set(Array.isArray(currentValue) ? currentValue : [currentValue]);
|
|
374
574
|
}, [currentValue]);
|
|
375
|
-
const handleSelectionChange = (0,
|
|
575
|
+
const handleSelectionChange = (0, import_react13.useCallback)(
|
|
376
576
|
(keys) => {
|
|
377
577
|
var _a;
|
|
378
578
|
if (keys === "all") return;
|
|
@@ -393,8 +593,8 @@ function useSelect({
|
|
|
393
593
|
}
|
|
394
594
|
|
|
395
595
|
// src/ui/inputs/select/select.tsx
|
|
396
|
-
var
|
|
397
|
-
var selectWrapperVariants = (0,
|
|
596
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
597
|
+
var selectWrapperVariants = (0, import_tailwind_variants4.tv)({
|
|
398
598
|
variants: {
|
|
399
599
|
variant: {
|
|
400
600
|
flat: "",
|
|
@@ -404,12 +604,14 @@ var selectWrapperVariants = (0, import_tailwind_variants3.tv)({
|
|
|
404
604
|
}
|
|
405
605
|
}
|
|
406
606
|
});
|
|
407
|
-
var Select =
|
|
607
|
+
var Select = import_react14.default.forwardRef(
|
|
408
608
|
({
|
|
409
609
|
value,
|
|
410
|
-
defaultSelectedKeys,
|
|
411
610
|
items,
|
|
611
|
+
children,
|
|
612
|
+
selectedKeys: selectedKeysProp,
|
|
412
613
|
onChange,
|
|
614
|
+
onSelectionChange,
|
|
413
615
|
selectionMode,
|
|
414
616
|
onClear,
|
|
415
617
|
variant,
|
|
@@ -418,6 +620,8 @@ var Select = import_react12.default.forwardRef(
|
|
|
418
620
|
isClearable,
|
|
419
621
|
...props
|
|
420
622
|
}, ref) => {
|
|
623
|
+
const usesExternalSelectionControl = selectedKeysProp !== void 0 || onSelectionChange !== void 0;
|
|
624
|
+
const selectChildren = children != null ? children : (item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_select.SelectItem, { children: item.label }, item.key);
|
|
421
625
|
const { selectedKeys, handleSelectionChange, handleClear, showClearButton } = useSelect({
|
|
422
626
|
value,
|
|
423
627
|
onChange,
|
|
@@ -425,48 +629,48 @@ var Select = import_react12.default.forwardRef(
|
|
|
425
629
|
selectionMode,
|
|
426
630
|
isClearable
|
|
427
631
|
});
|
|
428
|
-
return /* @__PURE__ */ (0,
|
|
632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
429
633
|
import_select.Select,
|
|
430
634
|
{
|
|
431
635
|
ref,
|
|
432
636
|
classNames: {
|
|
433
637
|
...classNames,
|
|
434
|
-
trigger: selectWrapperVariants({ variant }),
|
|
638
|
+
trigger: cn(selectWrapperVariants({ variant }), classNames == null ? void 0 : classNames.trigger),
|
|
435
639
|
innerWrapper: "group"
|
|
436
640
|
},
|
|
437
|
-
|
|
438
|
-
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
641
|
+
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
439
642
|
endContent,
|
|
440
|
-
showClearButton && /* @__PURE__ */ (0,
|
|
643
|
+
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ClearButton, { onClear: handleClear })
|
|
441
644
|
] }),
|
|
442
645
|
items,
|
|
443
|
-
selectedKeys,
|
|
646
|
+
selectedKeys: usesExternalSelectionControl ? selectedKeysProp : selectedKeys,
|
|
444
647
|
selectionMode,
|
|
445
648
|
variant,
|
|
446
|
-
onSelectionChange: handleSelectionChange,
|
|
649
|
+
onSelectionChange: usesExternalSelectionControl ? onSelectionChange : handleSelectionChange,
|
|
447
650
|
...props,
|
|
448
|
-
children:
|
|
651
|
+
children: selectChildren
|
|
449
652
|
}
|
|
450
653
|
);
|
|
451
654
|
}
|
|
452
655
|
);
|
|
453
656
|
Select.displayName = "TeachInUI.Select";
|
|
657
|
+
var SelectItem = import_select.SelectItem;
|
|
454
658
|
|
|
455
659
|
// src/ui/inputs/switch/switch.tsx
|
|
456
|
-
var
|
|
660
|
+
var import_react15 = __toESM(require("react"));
|
|
457
661
|
var import_switch = require("@heroui/switch");
|
|
458
|
-
var
|
|
459
|
-
var Switch =
|
|
460
|
-
return /* @__PURE__ */ (0,
|
|
662
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
663
|
+
var Switch = import_react15.default.forwardRef(({ ...props }, ref) => {
|
|
664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_switch.Switch, { ref, ...props });
|
|
461
665
|
});
|
|
462
666
|
Switch.displayName = "TeachInUI.Switch";
|
|
463
667
|
|
|
464
668
|
// src/ui/inputs/switch/favorite-switch.tsx
|
|
465
669
|
var import_switch2 = require("@heroui/switch");
|
|
466
670
|
var import_lucide_react3 = require("lucide-react");
|
|
467
|
-
var
|
|
468
|
-
var
|
|
469
|
-
var bookmarkVariants = (0,
|
|
671
|
+
var import_tailwind_variants5 = require("tailwind-variants");
|
|
672
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
673
|
+
var bookmarkVariants = (0, import_tailwind_variants5.tv)({
|
|
470
674
|
base: "stroke-default-400 group-hover:fill-primary-100 group-hover:stroke-default-400",
|
|
471
675
|
variants: {
|
|
472
676
|
size: {
|
|
@@ -482,7 +686,7 @@ var bookmarkVariants = (0, import_tailwind_variants4.tv)({
|
|
|
482
686
|
size: "md"
|
|
483
687
|
}
|
|
484
688
|
});
|
|
485
|
-
var wrapperVariants = (0,
|
|
689
|
+
var wrapperVariants = (0, import_tailwind_variants5.tv)({
|
|
486
690
|
base: "flex cursor-pointer items-center justify-center rounded-sm bg-transparent!",
|
|
487
691
|
variants: {
|
|
488
692
|
size: {
|
|
@@ -500,16 +704,16 @@ function FavoriteSwitch({ isSelected, onValueChange, size }) {
|
|
|
500
704
|
isSelected,
|
|
501
705
|
onValueChange
|
|
502
706
|
});
|
|
503
|
-
return /* @__PURE__ */ (0,
|
|
504
|
-
/* @__PURE__ */ (0,
|
|
505
|
-
/* @__PURE__ */ (0,
|
|
707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Component, { ...getBaseProps(), children: [
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "sr-only", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { ...getInputProps() }) }),
|
|
709
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
506
710
|
"div",
|
|
507
711
|
{
|
|
508
712
|
...getWrapperProps(),
|
|
509
713
|
className: slots.wrapper({
|
|
510
714
|
class: wrapperVariants({ size })
|
|
511
715
|
}),
|
|
512
|
-
children: /* @__PURE__ */ (0,
|
|
716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
513
717
|
import_lucide_react3.BookmarkIcon,
|
|
514
718
|
{
|
|
515
719
|
absoluteStrokeWidth: true,
|
|
@@ -529,31 +733,31 @@ var import_radio = require("@heroui/radio");
|
|
|
529
733
|
var Radio = Object.assign(import_radio.Radio, { displayName: "TeachInUI.Radio" });
|
|
530
734
|
|
|
531
735
|
// src/ui/inputs/radio/radio-group.tsx
|
|
532
|
-
var
|
|
736
|
+
var import_react16 = __toESM(require("react"));
|
|
533
737
|
var import_radio2 = require("@heroui/radio");
|
|
534
|
-
var
|
|
535
|
-
var RadioGroup =
|
|
738
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
739
|
+
var RadioGroup = import_react16.default.forwardRef(
|
|
536
740
|
(props, ref) => {
|
|
537
|
-
return /* @__PURE__ */ (0,
|
|
741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_radio2.RadioGroup, { ref, ...props });
|
|
538
742
|
}
|
|
539
743
|
);
|
|
540
744
|
RadioGroup.displayName = "TeachInUI.RadioGroup";
|
|
541
745
|
|
|
542
746
|
// src/ui/inputs/text/text.tsx
|
|
543
|
-
var
|
|
544
|
-
var
|
|
545
|
-
var Text =
|
|
546
|
-
return /* @__PURE__ */ (0,
|
|
747
|
+
var import_react17 = __toESM(require("react"));
|
|
748
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
749
|
+
var Text = import_react17.default.forwardRef(({ ...props }, ref) => {
|
|
750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Input, { ref, type: "text", ...props });
|
|
547
751
|
});
|
|
548
752
|
Text.displayName = "TeachInUI.Text";
|
|
549
753
|
|
|
550
754
|
// src/ui/inputs/textarea/textarea.tsx
|
|
551
755
|
var import_input6 = require("@heroui/input");
|
|
552
|
-
var
|
|
553
|
-
var
|
|
554
|
-
var Textarea =
|
|
756
|
+
var import_react18 = __toESM(require("react"));
|
|
757
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
758
|
+
var Textarea = import_react18.default.forwardRef(
|
|
555
759
|
({ minRows = 4, ...props }, ref) => {
|
|
556
|
-
return /* @__PURE__ */ (0,
|
|
760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_input6.Textarea, { ref, minRows, ...props });
|
|
557
761
|
}
|
|
558
762
|
);
|
|
559
763
|
Textarea.displayName = "TeachInUI.Textarea";
|
|
@@ -567,10 +771,12 @@ Textarea.displayName = "TeachInUI.Textarea";
|
|
|
567
771
|
Email,
|
|
568
772
|
FavoriteSwitch,
|
|
569
773
|
Input,
|
|
774
|
+
Number,
|
|
570
775
|
Radio,
|
|
571
776
|
RadioGroup,
|
|
572
777
|
Search,
|
|
573
778
|
Select,
|
|
779
|
+
SelectItem,
|
|
574
780
|
Switch,
|
|
575
781
|
Text,
|
|
576
782
|
Textarea
|
package/dist/ui/inputs/index.mjs
CHANGED
|
@@ -1,64 +1,72 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../../chunk-
|
|
2
|
+
import "../../chunk-37MCHF7U.mjs";
|
|
3
3
|
import "../../chunk-DUQFM3QS.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Text
|
|
6
6
|
} from "../../chunk-KTWHCUYV.mjs";
|
|
7
|
-
import "../../chunk-5HK7HRTR.mjs";
|
|
8
|
-
import {
|
|
9
|
-
Textarea
|
|
10
|
-
} from "../../chunk-HJUZTISD.mjs";
|
|
11
7
|
import "../../chunk-LLP2PTPK.mjs";
|
|
8
|
+
import {
|
|
9
|
+
FavoriteSwitch
|
|
10
|
+
} from "../../chunk-GTE5VEBV.mjs";
|
|
12
11
|
import {
|
|
13
12
|
Switch
|
|
14
13
|
} from "../../chunk-N3EAW6UO.mjs";
|
|
14
|
+
import "../../chunk-5HK7HRTR.mjs";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
} from "../../chunk-
|
|
16
|
+
Textarea
|
|
17
|
+
} from "../../chunk-HJUZTISD.mjs";
|
|
18
18
|
import "../../chunk-5RNCFTW5.mjs";
|
|
19
19
|
import {
|
|
20
20
|
Search
|
|
21
21
|
} from "../../chunk-SEJXJZSK.mjs";
|
|
22
22
|
import "../../chunk-C2VWADF5.mjs";
|
|
23
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-RRA7GWP2.mjs";
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
} from "../../chunk-
|
|
27
|
-
import "../../chunk-2UHA3DYG.mjs";
|
|
28
|
-
import "../../chunk-UUKS7JYX.mjs";
|
|
25
|
+
RadioGroup
|
|
26
|
+
} from "../../chunk-NOXFF2KJ.mjs";
|
|
29
27
|
import {
|
|
30
|
-
|
|
31
|
-
} from "../../chunk-
|
|
32
|
-
import "../../chunk-
|
|
28
|
+
Radio
|
|
29
|
+
} from "../../chunk-2SNKT7I4.mjs";
|
|
30
|
+
import "../../chunk-AQ3ISJKU.mjs";
|
|
33
31
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
Select,
|
|
33
|
+
SelectItem
|
|
34
|
+
} from "../../chunk-C5FQB2UN.mjs";
|
|
35
|
+
import "../../chunk-6BWSC6ZH.mjs";
|
|
36
|
+
import "../../chunk-V2HNFTTX.mjs";
|
|
36
37
|
import "../../chunk-V3KKDSQP.mjs";
|
|
37
38
|
import {
|
|
38
39
|
Email
|
|
39
|
-
} from "../../chunk-
|
|
40
|
+
} from "../../chunk-GEPCSZCU.mjs";
|
|
40
41
|
import "../../chunk-ZRHEFEFS.mjs";
|
|
41
42
|
import {
|
|
42
43
|
Input
|
|
43
44
|
} from "../../chunk-MCQGBAUS.mjs";
|
|
44
45
|
import "../../chunk-NSU66J5E.mjs";
|
|
45
|
-
import "../../chunk-
|
|
46
|
+
import "../../chunk-UUKS7JYX.mjs";
|
|
46
47
|
import {
|
|
47
|
-
|
|
48
|
-
} from "../../chunk-
|
|
48
|
+
CheckboxGroup
|
|
49
|
+
} from "../../chunk-C4PCTOGM.mjs";
|
|
49
50
|
import {
|
|
50
|
-
|
|
51
|
-
} from "../../chunk-
|
|
51
|
+
Checkbox
|
|
52
|
+
} from "../../chunk-N3QOXWJI.mjs";
|
|
53
|
+
import "../../chunk-ALGSVEUS.mjs";
|
|
54
|
+
import {
|
|
55
|
+
Number
|
|
56
|
+
} from "../../chunk-BHOCYKBI.mjs";
|
|
57
|
+
import "../../chunk-7WIZONLU.mjs";
|
|
58
|
+
import {
|
|
59
|
+
DatePicker
|
|
60
|
+
} from "../../chunk-IAJ6G633.mjs";
|
|
52
61
|
import "../../chunk-WYJW5NNA.mjs";
|
|
53
62
|
import {
|
|
54
63
|
Autocomplete
|
|
55
64
|
} from "../../chunk-C3MURCMZ.mjs";
|
|
56
|
-
import {
|
|
57
|
-
CheckboxGroup
|
|
58
|
-
} from "../../chunk-C4PCTOGM.mjs";
|
|
59
65
|
import {
|
|
60
66
|
ClearButton
|
|
61
67
|
} from "../../chunk-TUIN5YJW.mjs";
|
|
68
|
+
import "../../chunk-Q6XJI7Q2.mjs";
|
|
69
|
+
import "../../chunk-LOMRTWX5.mjs";
|
|
62
70
|
export {
|
|
63
71
|
Autocomplete,
|
|
64
72
|
Checkbox,
|
|
@@ -68,10 +76,12 @@ export {
|
|
|
68
76
|
Email,
|
|
69
77
|
FavoriteSwitch,
|
|
70
78
|
Input,
|
|
79
|
+
Number,
|
|
71
80
|
Radio,
|
|
72
81
|
RadioGroup,
|
|
73
82
|
Search,
|
|
74
83
|
Select,
|
|
84
|
+
SelectItem,
|
|
75
85
|
Switch,
|
|
76
86
|
Text,
|
|
77
87
|
Textarea
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Number, type NumberProps } from "./number";
|