@teach-in/react 1.4.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.
Files changed (109) hide show
  1. package/dist/{chunk-2UHA3DYG.mjs → chunk-6BWSC6ZH.mjs} +3 -10
  2. package/dist/chunk-7WIZONLU.mjs +81 -0
  3. package/dist/chunk-ALGSVEUS.mjs +1 -0
  4. package/dist/chunk-BHOCYKBI.mjs +81 -0
  5. package/dist/{chunk-VXYV37IM.mjs → chunk-C5FQB2UN.mjs} +16 -8
  6. package/dist/{chunk-CKJ5U5Q4.mjs → chunk-DEKPRZIQ.mjs} +1 -1
  7. package/dist/chunk-GEPCSZCU.mjs +71 -0
  8. package/dist/chunk-GTE5VEBV.mjs +68 -0
  9. package/dist/{chunk-UFYLYN5Z.mjs → chunk-QFWSQOF6.mjs} +20 -2
  10. package/dist/chunk-VDPROXMN.mjs +57 -0
  11. package/dist/{chunk-J3OZNLTZ.mjs → chunk-WG4IPOHE.mjs} +5 -5
  12. package/dist/{chunk-R46SWVWL.mjs → chunk-ZK6VZMUJ.mjs} +1 -1
  13. package/dist/index.js +536 -253
  14. package/dist/index.mjs +140 -132
  15. package/dist/ui/data/index.js +56 -7
  16. package/dist/ui/data/index.mjs +12 -10
  17. package/dist/ui/data/user/index.js +51 -2
  18. package/dist/ui/data/user/index.mjs +3 -1
  19. package/dist/ui/data/user/user.d.ts +24 -2
  20. package/dist/ui/data/user/user.js +52 -2
  21. package/dist/ui/data/user/user.mjs +4 -1
  22. package/dist/ui/feedback/index.mjs +7 -7
  23. package/dist/ui/form/index.js +76 -18
  24. package/dist/ui/form/index.mjs +25 -20
  25. package/dist/ui/form/rhf/fields/autocomplete-field.mjs +20 -15
  26. package/dist/ui/form/rhf/fields/checkbox-field.mjs +20 -15
  27. package/dist/ui/form/rhf/fields/date-picker-field.mjs +20 -15
  28. package/dist/ui/form/rhf/fields/email-field.js +58 -3
  29. package/dist/ui/form/rhf/fields/email-field.mjs +21 -16
  30. package/dist/ui/form/rhf/fields/index.js +76 -18
  31. package/dist/ui/form/rhf/fields/index.mjs +22 -17
  32. package/dist/ui/form/rhf/fields/input-field.mjs +20 -15
  33. package/dist/ui/form/rhf/fields/radio-field.mjs +20 -15
  34. package/dist/ui/form/rhf/fields/search-field.mjs +20 -15
  35. package/dist/ui/form/rhf/fields/select-field.js +18 -15
  36. package/dist/ui/form/rhf/fields/select-field.mjs +21 -16
  37. package/dist/ui/form/rhf/fields/switch-field.mjs +20 -15
  38. package/dist/ui/form/rhf/fields/text-field.mjs +20 -15
  39. package/dist/ui/form/rhf/fields/textarea-field.mjs +20 -15
  40. package/dist/ui/form/rhf/index.js +76 -18
  41. package/dist/ui/form/rhf/index.mjs +22 -17
  42. package/dist/ui/format/index.mjs +12 -12
  43. package/dist/ui/index.js +536 -253
  44. package/dist/ui/index.mjs +140 -132
  45. package/dist/ui/inputs/checkbox/index.mjs +3 -3
  46. package/dist/ui/inputs/email/email.js +58 -3
  47. package/dist/ui/inputs/email/email.mjs +1 -1
  48. package/dist/ui/inputs/email/index.js +58 -3
  49. package/dist/ui/inputs/email/index.mjs +1 -1
  50. package/dist/ui/inputs/index.d.ts +1 -0
  51. package/dist/ui/inputs/index.js +305 -69
  52. package/dist/ui/inputs/index.mjs +35 -25
  53. package/dist/ui/inputs/number/index.d.ts +1 -0
  54. package/dist/ui/inputs/number/index.js +218 -0
  55. package/dist/ui/inputs/number/index.mjs +12 -0
  56. package/dist/ui/inputs/number/number.d.ts +12 -0
  57. package/dist/ui/inputs/number/number.js +219 -0
  58. package/dist/ui/inputs/number/number.mjs +13 -0
  59. package/dist/ui/inputs/number/use-number.d.ts +20 -0
  60. package/dist/ui/inputs/number/use-number.js +104 -0
  61. package/dist/ui/inputs/number/use-number.mjs +7 -0
  62. package/dist/ui/inputs/select/index.d.ts +1 -1
  63. package/dist/ui/inputs/select/index.js +23 -17
  64. package/dist/ui/inputs/select/index.mjs +8 -4
  65. package/dist/ui/inputs/select/select.d.ts +11 -22
  66. package/dist/ui/inputs/select/select.js +23 -17
  67. package/dist/ui/inputs/select/select.mjs +8 -4
  68. package/dist/ui/inputs/select/use-select.d.ts +0 -1
  69. package/dist/ui/inputs/select/use-select.js +2 -9
  70. package/dist/ui/inputs/select/use-select.mjs +1 -1
  71. package/dist/ui/inputs/switch/favorite-switch.d.ts +23 -2
  72. package/dist/ui/inputs/switch/favorite-switch.js +34 -4
  73. package/dist/ui/inputs/switch/favorite-switch.mjs +1 -1
  74. package/dist/ui/inputs/switch/index.js +34 -4
  75. package/dist/ui/inputs/switch/index.mjs +1 -1
  76. package/dist/ui/layout/container/container.mjs +67 -64
  77. package/dist/ui/layout/container/index.mjs +67 -64
  78. package/dist/ui/layout/index.js +7 -7
  79. package/dist/ui/layout/index.mjs +71 -68
  80. package/dist/ui/layout/page/index.mjs +4 -4
  81. package/dist/ui/layout/page/page-loading.mjs +4 -4
  82. package/dist/ui/layout/page/section-loading.mjs +4 -4
  83. package/dist/ui/navigation/index.mjs +5 -5
  84. package/dist/ui/overlays/index.mjs +4 -4
  85. package/dist/ui/provider/index.mjs +4 -4
  86. package/dist/ui/provider/ui-provider.mjs +4 -4
  87. package/dist/ui/surface/bento/bento.d.ts +2 -2
  88. package/dist/ui/surface/bento/bento.js +5 -5
  89. package/dist/ui/surface/bento/bento.mjs +1 -1
  90. package/dist/ui/surface/bento/index.js +5 -5
  91. package/dist/ui/surface/bento/index.mjs +1 -1
  92. package/dist/ui/surface/card/card.d.ts +2427 -5
  93. package/dist/ui/surface/card/card.js +29 -2
  94. package/dist/ui/surface/card/card.mjs +5 -1
  95. package/dist/ui/surface/card/index.js +29 -2
  96. package/dist/ui/surface/card/index.mjs +5 -1
  97. package/dist/ui/surface/index.js +34 -7
  98. package/dist/ui/surface/index.mjs +9 -5
  99. package/dist/ui/theme/colors/index.mjs +1 -1
  100. package/dist/ui/theme/colors.mjs +1 -1
  101. package/dist/ui/theme/index.mjs +1 -1
  102. package/dist/ui/theme/theme.d.ts +2 -1
  103. package/dist/ui/theme/theme.mjs +1 -1
  104. package/package.json +13 -9
  105. package/LICENSE +0 -21
  106. package/dist/chunk-46SKVFMZ.mjs +0 -16
  107. package/dist/chunk-E5QSNLSR.mjs +0 -38
  108. package/dist/chunk-XHCXM5MU.mjs +0 -14
  109. /package/dist/{chunk-UQAG7TKJ.mjs → chunk-37MCHF7U.mjs} +0 -0
@@ -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 Email = import_react8.default.forwardRef(({ ...props }, ref) => {
245
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Input, { ref, autoComplete: "email", type: "email", ...props });
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/search/search.tsx
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 import_tailwind_variants2 = require("tailwind-variants");
460
+ var import_tailwind_variants3 = require("tailwind-variants");
254
461
 
255
462
  // src/ui/inputs/search/use-search.ts
256
- var import_react9 = require("react");
463
+ var import_react11 = require("react");
257
464
  function useSearch({ value, onSearch, onCancel, onKeyDown }) {
258
- const handleKeyDown = (0, import_react9.useCallback)(
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, import_react9.useCallback)(() => {
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 import_jsx_runtime8 = require("react/jsx-runtime");
286
- var searchIconVariants = (0, import_tailwind_variants2.tv)({
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 = import_react10.default.forwardRef(
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, import_jsx_runtime8.jsx)(
512
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
306
513
  Input,
307
514
  {
308
515
  ref,
309
516
  radius,
310
- startContent: onSearch ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
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, import_jsx_runtime8.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) })
527
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) })
321
528
  }
322
- ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) }),
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 import_react12 = __toESM(require("react"));
541
+ var import_react14 = __toESM(require("react"));
335
542
  var import_select = require("@heroui/select");
336
- var import_tailwind_variants3 = require("tailwind-variants");
543
+ var import_tailwind_variants4 = require("tailwind-variants");
337
544
 
338
545
  // src/ui/inputs/select/use-select.ts
339
- var import_react11 = require("react");
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 [internalValue, setInternalValue] = (0, import_react11.useState)(
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, import_react11.useCallback)(
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
- [isControlled, onChange, isMultiple]
565
+ [onChange, isMultiple]
366
566
  );
367
- const handleClear = (0, import_react11.useCallback)(() => {
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, import_react11.useMemo)(() => {
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, import_react11.useCallback)(
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 import_jsx_runtime9 = require("react/jsx-runtime");
397
- var selectWrapperVariants = (0, import_tailwind_variants3.tv)({
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 = import_react12.default.forwardRef(
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,70 +629,100 @@ var Select = import_react12.default.forwardRef(
425
629
  selectionMode,
426
630
  isClearable
427
631
  });
428
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
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
- defaultSelectedKeys,
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, import_jsx_runtime9.jsx)(ClearButton, { onClear: handleClear })
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: (item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_select.SelectItem, { children: item.label }, item.key)
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 import_react13 = __toESM(require("react"));
660
+ var import_react15 = __toESM(require("react"));
457
661
  var import_switch = require("@heroui/switch");
458
- var import_jsx_runtime10 = require("react/jsx-runtime");
459
- var Switch = import_react13.default.forwardRef(({ ...props }, ref) => {
460
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_switch.Switch, { ref, ...props });
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 import_tailwind_variants4 = require("tailwind-variants");
468
- var import_jsx_runtime11 = require("react/jsx-runtime");
469
- var bookmarkVariants = (0, import_tailwind_variants4.tv)({
470
- base: "size-6 stroke-default-400 group-hover:fill-primary-100 group-hover:stroke-default-400",
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)({
674
+ base: "stroke-default-400 group-hover:fill-primary-100 group-hover:stroke-default-400",
471
675
  variants: {
676
+ size: {
677
+ sm: "size-6",
678
+ md: "size-8",
679
+ lg: "size-10"
680
+ },
472
681
  isSelected: {
473
682
  true: "stroke-primary fill-primary-100"
474
683
  }
684
+ },
685
+ defaultVariants: {
686
+ size: "md"
475
687
  }
476
688
  });
477
- function FavoriteSwitch({ isSelected, onValueChange }) {
689
+ var wrapperVariants = (0, import_tailwind_variants5.tv)({
690
+ base: "flex cursor-pointer items-center justify-center rounded-sm bg-transparent!",
691
+ variants: {
692
+ size: {
693
+ sm: "h-8 w-8",
694
+ md: "h-10 w-10",
695
+ lg: "h-12 w-12"
696
+ }
697
+ },
698
+ defaultVariants: {
699
+ size: "md"
700
+ }
701
+ });
702
+ function FavoriteSwitch({ isSelected, onValueChange, size }) {
478
703
  const { Component, slots, getBaseProps, getInputProps, getWrapperProps } = (0, import_switch2.useSwitch)({
479
704
  isSelected,
480
705
  onValueChange
481
706
  });
482
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Component, { ...getBaseProps(), children: [
483
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "sr-only", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { ...getInputProps() }) }),
484
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
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)(
485
710
  "div",
486
711
  {
487
712
  ...getWrapperProps(),
488
713
  className: slots.wrapper({
489
- class: "flex h-8 w-8 cursor-pointer items-center justify-center rounded-sm !bg-transparent"
714
+ class: wrapperVariants({ size })
490
715
  }),
491
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.Bookmark, { className: bookmarkVariants({ isSelected }) })
716
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
717
+ import_lucide_react3.BookmarkIcon,
718
+ {
719
+ absoluteStrokeWidth: true,
720
+ className: bookmarkVariants({ isSelected, size }),
721
+ strokeLinecap: "round",
722
+ strokeLinejoin: "round",
723
+ strokeWidth: 1.5
724
+ }
725
+ )
492
726
  }
493
727
  )
494
728
  ] });
@@ -499,31 +733,31 @@ var import_radio = require("@heroui/radio");
499
733
  var Radio = Object.assign(import_radio.Radio, { displayName: "TeachInUI.Radio" });
500
734
 
501
735
  // src/ui/inputs/radio/radio-group.tsx
502
- var import_react14 = __toESM(require("react"));
736
+ var import_react16 = __toESM(require("react"));
503
737
  var import_radio2 = require("@heroui/radio");
504
- var import_jsx_runtime12 = require("react/jsx-runtime");
505
- var RadioGroup = import_react14.default.forwardRef(
738
+ var import_jsx_runtime13 = require("react/jsx-runtime");
739
+ var RadioGroup = import_react16.default.forwardRef(
506
740
  (props, ref) => {
507
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_radio2.RadioGroup, { ref, ...props });
741
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_radio2.RadioGroup, { ref, ...props });
508
742
  }
509
743
  );
510
744
  RadioGroup.displayName = "TeachInUI.RadioGroup";
511
745
 
512
746
  // src/ui/inputs/text/text.tsx
513
- var import_react15 = __toESM(require("react"));
514
- var import_jsx_runtime13 = require("react/jsx-runtime");
515
- var Text = import_react15.default.forwardRef(({ ...props }, ref) => {
516
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Input, { ref, type: "text", ...props });
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 });
517
751
  });
518
752
  Text.displayName = "TeachInUI.Text";
519
753
 
520
754
  // src/ui/inputs/textarea/textarea.tsx
521
755
  var import_input6 = require("@heroui/input");
522
- var import_react16 = __toESM(require("react"));
523
- var import_jsx_runtime14 = require("react/jsx-runtime");
524
- var Textarea = import_react16.default.forwardRef(
756
+ var import_react18 = __toESM(require("react"));
757
+ var import_jsx_runtime15 = require("react/jsx-runtime");
758
+ var Textarea = import_react18.default.forwardRef(
525
759
  ({ minRows = 4, ...props }, ref) => {
526
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_input6.Textarea, { ref, minRows, ...props });
760
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_input6.Textarea, { ref, minRows, ...props });
527
761
  }
528
762
  );
529
763
  Textarea.displayName = "TeachInUI.Textarea";
@@ -537,10 +771,12 @@ Textarea.displayName = "TeachInUI.Textarea";
537
771
  Email,
538
772
  FavoriteSwitch,
539
773
  Input,
774
+ Number,
540
775
  Radio,
541
776
  RadioGroup,
542
777
  Search,
543
778
  Select,
779
+ SelectItem,
544
780
  Switch,
545
781
  Text,
546
782
  Textarea
@@ -1,25 +1,25 @@
1
1
  "use client";
2
- import "../../chunk-UQAG7TKJ.mjs";
2
+ import "../../chunk-37MCHF7U.mjs";
3
+ import "../../chunk-DUQFM3QS.mjs";
4
+ import {
5
+ Text
6
+ } from "../../chunk-KTWHCUYV.mjs";
3
7
  import "../../chunk-LLP2PTPK.mjs";
4
8
  import {
5
9
  FavoriteSwitch
6
- } from "../../chunk-E5QSNLSR.mjs";
10
+ } from "../../chunk-GTE5VEBV.mjs";
7
11
  import {
8
12
  Switch
9
13
  } from "../../chunk-N3EAW6UO.mjs";
10
- import "../../chunk-DUQFM3QS.mjs";
11
- import {
12
- Text
13
- } from "../../chunk-KTWHCUYV.mjs";
14
14
  import "../../chunk-5HK7HRTR.mjs";
15
15
  import {
16
16
  Textarea
17
17
  } from "../../chunk-HJUZTISD.mjs";
18
- import "../../chunk-AQ3ISJKU.mjs";
18
+ import "../../chunk-5RNCFTW5.mjs";
19
19
  import {
20
- Select
21
- } from "../../chunk-VXYV37IM.mjs";
22
- import "../../chunk-2UHA3DYG.mjs";
20
+ Search
21
+ } from "../../chunk-SEJXJZSK.mjs";
22
+ import "../../chunk-C2VWADF5.mjs";
23
23
  import "../../chunk-RRA7GWP2.mjs";
24
24
  import {
25
25
  RadioGroup
@@ -27,38 +27,46 @@ import {
27
27
  import {
28
28
  Radio
29
29
  } from "../../chunk-2SNKT7I4.mjs";
30
- import "../../chunk-UUKS7JYX.mjs";
30
+ import "../../chunk-AQ3ISJKU.mjs";
31
31
  import {
32
- Checkbox
33
- } from "../../chunk-N3QOXWJI.mjs";
32
+ Select,
33
+ SelectItem
34
+ } from "../../chunk-C5FQB2UN.mjs";
35
+ import "../../chunk-6BWSC6ZH.mjs";
34
36
  import "../../chunk-V2HNFTTX.mjs";
35
- import {
36
- DatePicker
37
- } from "../../chunk-IAJ6G633.mjs";
38
37
  import "../../chunk-V3KKDSQP.mjs";
39
38
  import {
40
39
  Email
41
- } from "../../chunk-46SKVFMZ.mjs";
42
- import "../../chunk-5RNCFTW5.mjs";
43
- import {
44
- Search
45
- } from "../../chunk-SEJXJZSK.mjs";
46
- import "../../chunk-C2VWADF5.mjs";
40
+ } from "../../chunk-GEPCSZCU.mjs";
47
41
  import "../../chunk-ZRHEFEFS.mjs";
48
42
  import {
49
43
  Input
50
44
  } from "../../chunk-MCQGBAUS.mjs";
51
45
  import "../../chunk-NSU66J5E.mjs";
46
+ import "../../chunk-UUKS7JYX.mjs";
47
+ import {
48
+ CheckboxGroup
49
+ } from "../../chunk-C4PCTOGM.mjs";
50
+ import {
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";