@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.
Files changed (92) 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-VDPROXMN.mjs +57 -0
  9. package/dist/{chunk-R46SWVWL.mjs → chunk-ZK6VZMUJ.mjs} +1 -1
  10. package/dist/index.js +487 -248
  11. package/dist/index.mjs +189 -181
  12. package/dist/ui/data/index.js +56 -7
  13. package/dist/ui/data/index.mjs +10 -8
  14. package/dist/ui/data/user/index.js +51 -2
  15. package/dist/ui/data/user/index.mjs +3 -1
  16. package/dist/ui/data/user/user.d.ts +24 -2
  17. package/dist/ui/data/user/user.js +52 -2
  18. package/dist/ui/data/user/user.mjs +4 -1
  19. package/dist/ui/feedback/index.mjs +12 -12
  20. package/dist/ui/feedback/progress/index.mjs +3 -3
  21. package/dist/ui/form/index.js +76 -18
  22. package/dist/ui/form/index.mjs +24 -19
  23. package/dist/ui/form/rhf/fields/autocomplete-field.mjs +19 -14
  24. package/dist/ui/form/rhf/fields/checkbox-field.mjs +19 -14
  25. package/dist/ui/form/rhf/fields/date-picker-field.mjs +19 -14
  26. package/dist/ui/form/rhf/fields/email-field.js +58 -3
  27. package/dist/ui/form/rhf/fields/email-field.mjs +20 -15
  28. package/dist/ui/form/rhf/fields/index.js +76 -18
  29. package/dist/ui/form/rhf/fields/index.mjs +21 -16
  30. package/dist/ui/form/rhf/fields/input-field.mjs +19 -14
  31. package/dist/ui/form/rhf/fields/radio-field.mjs +19 -14
  32. package/dist/ui/form/rhf/fields/search-field.mjs +19 -14
  33. package/dist/ui/form/rhf/fields/select-field.js +18 -15
  34. package/dist/ui/form/rhf/fields/select-field.mjs +20 -15
  35. package/dist/ui/form/rhf/fields/switch-field.mjs +19 -14
  36. package/dist/ui/form/rhf/fields/text-field.mjs +19 -14
  37. package/dist/ui/form/rhf/fields/textarea-field.mjs +19 -14
  38. package/dist/ui/form/rhf/index.js +76 -18
  39. package/dist/ui/form/rhf/index.mjs +21 -16
  40. package/dist/ui/format/index.mjs +6 -6
  41. package/dist/ui/index.js +487 -248
  42. package/dist/ui/index.mjs +189 -181
  43. package/dist/ui/inputs/checkbox/index.mjs +3 -3
  44. package/dist/ui/inputs/email/email.js +58 -3
  45. package/dist/ui/inputs/email/email.mjs +1 -1
  46. package/dist/ui/inputs/email/index.js +58 -3
  47. package/dist/ui/inputs/email/index.mjs +1 -1
  48. package/dist/ui/inputs/index.d.ts +1 -0
  49. package/dist/ui/inputs/index.js +273 -67
  50. package/dist/ui/inputs/index.mjs +36 -26
  51. package/dist/ui/inputs/number/index.d.ts +1 -0
  52. package/dist/ui/inputs/number/index.js +218 -0
  53. package/dist/ui/inputs/number/index.mjs +12 -0
  54. package/dist/ui/inputs/number/number.d.ts +12 -0
  55. package/dist/ui/inputs/number/number.js +219 -0
  56. package/dist/ui/inputs/number/number.mjs +13 -0
  57. package/dist/ui/inputs/number/use-number.d.ts +20 -0
  58. package/dist/ui/inputs/number/use-number.js +104 -0
  59. package/dist/ui/inputs/number/use-number.mjs +7 -0
  60. package/dist/ui/inputs/radio/index.mjs +3 -3
  61. package/dist/ui/inputs/select/index.d.ts +1 -1
  62. package/dist/ui/inputs/select/index.js +23 -17
  63. package/dist/ui/inputs/select/index.mjs +8 -4
  64. package/dist/ui/inputs/select/select.d.ts +11 -22
  65. package/dist/ui/inputs/select/select.js +23 -17
  66. package/dist/ui/inputs/select/select.mjs +8 -4
  67. package/dist/ui/inputs/select/use-select.d.ts +0 -1
  68. package/dist/ui/inputs/select/use-select.js +2 -9
  69. package/dist/ui/inputs/select/use-select.mjs +1 -1
  70. package/dist/ui/inputs/switch/index.mjs +3 -3
  71. package/dist/ui/layout/container/container.mjs +88 -85
  72. package/dist/ui/layout/container/index.mjs +88 -85
  73. package/dist/ui/layout/index.js +7 -7
  74. package/dist/ui/layout/index.mjs +95 -92
  75. package/dist/ui/layout/page/index.mjs +6 -6
  76. package/dist/ui/layout/page/page-loading.mjs +5 -5
  77. package/dist/ui/layout/page/section-loading.mjs +5 -5
  78. package/dist/ui/navigation/index.mjs +5 -5
  79. package/dist/ui/overlays/index.mjs +4 -4
  80. package/dist/ui/provider/index.mjs +5 -5
  81. package/dist/ui/provider/ui-provider.mjs +5 -5
  82. package/dist/ui/surface/index.mjs +1 -1
  83. package/dist/ui/theme/colors/index.mjs +1 -1
  84. package/dist/ui/theme/colors.mjs +1 -1
  85. package/dist/ui/theme/index.mjs +1 -1
  86. package/dist/ui/theme/theme.d.ts +2 -1
  87. package/dist/ui/theme/theme.mjs +1 -1
  88. package/package.json +13 -9
  89. package/LICENSE +0 -21
  90. package/dist/chunk-46SKVFMZ.mjs +0 -16
  91. package/dist/chunk-XHCXM5MU.mjs +0 -14
  92. /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,48 +629,48 @@ 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)({
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, import_tailwind_variants4.tv)({
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, import_jsx_runtime11.jsxs)(Component, { ...getBaseProps(), children: [
504
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "sr-only", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { ...getInputProps() }) }),
505
- /* @__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)(
506
710
  "div",
507
711
  {
508
712
  ...getWrapperProps(),
509
713
  className: slots.wrapper({
510
714
  class: wrapperVariants({ size })
511
715
  }),
512
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
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 import_react14 = __toESM(require("react"));
736
+ var import_react16 = __toESM(require("react"));
533
737
  var import_radio2 = require("@heroui/radio");
534
- var import_jsx_runtime12 = require("react/jsx-runtime");
535
- var RadioGroup = import_react14.default.forwardRef(
738
+ var import_jsx_runtime13 = require("react/jsx-runtime");
739
+ var RadioGroup = import_react16.default.forwardRef(
536
740
  (props, ref) => {
537
- 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 });
538
742
  }
539
743
  );
540
744
  RadioGroup.displayName = "TeachInUI.RadioGroup";
541
745
 
542
746
  // src/ui/inputs/text/text.tsx
543
- var import_react15 = __toESM(require("react"));
544
- var import_jsx_runtime13 = require("react/jsx-runtime");
545
- var Text = import_react15.default.forwardRef(({ ...props }, ref) => {
546
- 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 });
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 import_react16 = __toESM(require("react"));
553
- var import_jsx_runtime14 = require("react/jsx-runtime");
554
- 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(
555
759
  ({ minRows = 4, ...props }, ref) => {
556
- 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 });
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
@@ -1,64 +1,72 @@
1
1
  "use client";
2
- import "../../chunk-UQAG7TKJ.mjs";
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
- FavoriteSwitch
17
- } from "../../chunk-GTE5VEBV.mjs";
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-AQ3ISJKU.mjs";
23
+ import "../../chunk-RRA7GWP2.mjs";
24
24
  import {
25
- Select
26
- } from "../../chunk-VXYV37IM.mjs";
27
- import "../../chunk-2UHA3DYG.mjs";
28
- import "../../chunk-UUKS7JYX.mjs";
25
+ RadioGroup
26
+ } from "../../chunk-NOXFF2KJ.mjs";
29
27
  import {
30
- Checkbox
31
- } from "../../chunk-N3QOXWJI.mjs";
32
- import "../../chunk-V2HNFTTX.mjs";
28
+ Radio
29
+ } from "../../chunk-2SNKT7I4.mjs";
30
+ import "../../chunk-AQ3ISJKU.mjs";
33
31
  import {
34
- DatePicker
35
- } from "../../chunk-IAJ6G633.mjs";
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-46SKVFMZ.mjs";
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-RRA7GWP2.mjs";
46
+ import "../../chunk-UUKS7JYX.mjs";
46
47
  import {
47
- Radio
48
- } from "../../chunk-2SNKT7I4.mjs";
48
+ CheckboxGroup
49
+ } from "../../chunk-C4PCTOGM.mjs";
49
50
  import {
50
- RadioGroup
51
- } from "../../chunk-NOXFF2KJ.mjs";
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";