@teach-in/react 1.1.0 → 1.2.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 (115) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +9 -9
  3. package/dist/{chunk-AMNORHD6.mjs → chunk-2ASQXBDD.mjs} +1 -1
  4. package/dist/{chunk-3VAZY2QK.mjs → chunk-2CEZXLZR.mjs} +1 -1
  5. package/dist/chunk-2UHA3DYG.mjs +62 -0
  6. package/dist/{chunk-LJIVY6GU.mjs → chunk-46SKVFMZ.mjs} +1 -1
  7. package/dist/{chunk-JDFRAN4S.mjs → chunk-5FFWQB7D.mjs} +12 -2
  8. package/dist/chunk-C2VWADF5.mjs +34 -0
  9. package/dist/{chunk-NLHQDWUK.mjs → chunk-CKJ5U5Q4.mjs} +1 -1
  10. package/dist/chunk-CUEG2BFV.mjs +34 -0
  11. package/dist/{chunk-CETCW7DS.mjs → chunk-IU2JYI7W.mjs} +1 -1
  12. package/dist/{chunk-KTUGFQWJ.mjs → chunk-KTWHCUYV.mjs} +1 -1
  13. package/dist/chunk-MCQGBAUS.mjs +73 -0
  14. package/dist/chunk-NSU66J5E.mjs +59 -0
  15. package/dist/{chunk-CFG5V7VB.mjs → chunk-QCLLPJMB.mjs} +2 -2
  16. package/dist/{chunk-R7LDL5CU.mjs → chunk-R46SWVWL.mjs} +1 -1
  17. package/dist/chunk-SEJXJZSK.mjs +64 -0
  18. package/dist/chunk-TUIN5YJW.mjs +33 -0
  19. package/dist/chunk-UQAG7TKJ.mjs +1 -0
  20. package/dist/chunk-VXYV37IM.mjs +74 -0
  21. package/dist/index.js +575 -230
  22. package/dist/index.mjs +163 -147
  23. package/dist/ui/data/index.mjs +4 -4
  24. package/dist/ui/feedback/index.mjs +5 -5
  25. package/dist/ui/form/index.js +447 -106
  26. package/dist/ui/form/index.mjs +31 -21
  27. package/dist/ui/form/rhf/fields/autocomplete-field.mjs +20 -14
  28. package/dist/ui/form/rhf/fields/checkbox-field.mjs +20 -14
  29. package/dist/ui/form/rhf/fields/date-picker-field.mjs +20 -14
  30. package/dist/ui/form/rhf/fields/email-field.js +147 -10
  31. package/dist/ui/form/rhf/fields/email-field.mjs +21 -15
  32. package/dist/ui/form/rhf/fields/index.d.ts +1 -0
  33. package/dist/ui/form/rhf/fields/index.js +443 -102
  34. package/dist/ui/form/rhf/fields/index.mjs +31 -21
  35. package/dist/ui/form/rhf/fields/input-field.js +153 -6
  36. package/dist/ui/form/rhf/fields/input-field.mjs +21 -15
  37. package/dist/ui/form/rhf/fields/radio-field.mjs +20 -14
  38. package/dist/ui/form/rhf/fields/search-field.d.ts +10 -0
  39. package/dist/ui/form/rhf/fields/search-field.js +296 -0
  40. package/dist/ui/form/rhf/fields/search-field.mjs +37 -0
  41. package/dist/ui/form/rhf/fields/select-field.js +136 -26
  42. package/dist/ui/form/rhf/fields/select-field.mjs +21 -15
  43. package/dist/ui/form/rhf/fields/switch-field.mjs +20 -14
  44. package/dist/ui/form/rhf/fields/text-field.js +147 -10
  45. package/dist/ui/form/rhf/fields/text-field.mjs +21 -15
  46. package/dist/ui/form/rhf/fields/textarea-field.mjs +20 -14
  47. package/dist/ui/form/rhf/index.js +443 -102
  48. package/dist/ui/form/rhf/index.mjs +31 -21
  49. package/dist/ui/format/index.mjs +15 -15
  50. package/dist/ui/index.js +575 -230
  51. package/dist/ui/index.mjs +161 -145
  52. package/dist/ui/inputs/checkbox/index.mjs +3 -3
  53. package/dist/ui/inputs/clear-button.d.ts +5 -0
  54. package/dist/ui/inputs/clear-button.js +67 -0
  55. package/dist/ui/inputs/clear-button.mjs +8 -0
  56. package/dist/ui/inputs/email/email.js +144 -7
  57. package/dist/ui/inputs/email/email.mjs +4 -2
  58. package/dist/ui/inputs/email/index.js +144 -7
  59. package/dist/ui/inputs/email/index.mjs +4 -2
  60. package/dist/ui/inputs/index.d.ts +2 -0
  61. package/dist/ui/inputs/index.js +363 -56
  62. package/dist/ui/inputs/index.mjs +35 -23
  63. package/dist/ui/inputs/input/index.js +140 -3
  64. package/dist/ui/inputs/input/index.mjs +3 -1
  65. package/dist/ui/inputs/input/input.d.ts +1 -0
  66. package/dist/ui/inputs/input/input.js +140 -3
  67. package/dist/ui/inputs/input/input.mjs +3 -1
  68. package/dist/ui/inputs/input/use-input.d.ts +19 -0
  69. package/dist/ui/inputs/input/use-input.js +82 -0
  70. package/dist/ui/inputs/input/use-input.mjs +7 -0
  71. package/dist/ui/inputs/radio/index.mjs +3 -3
  72. package/dist/ui/inputs/search/index.d.ts +1 -0
  73. package/dist/ui/inputs/search/index.js +270 -0
  74. package/dist/ui/inputs/search/index.mjs +13 -0
  75. package/dist/ui/inputs/search/search.d.ts +7 -0
  76. package/dist/ui/inputs/search/search.js +268 -0
  77. package/dist/ui/inputs/search/search.mjs +12 -0
  78. package/dist/ui/inputs/search/use-search.d.ts +12 -0
  79. package/dist/ui/inputs/search/use-search.js +57 -0
  80. package/dist/ui/inputs/search/use-search.mjs +7 -0
  81. package/dist/ui/inputs/select/index.js +132 -22
  82. package/dist/ui/inputs/select/index.mjs +3 -1
  83. package/dist/ui/inputs/select/select.d.ts +4 -0
  84. package/dist/ui/inputs/select/select.js +132 -22
  85. package/dist/ui/inputs/select/select.mjs +3 -1
  86. package/dist/ui/inputs/select/use-select.d.ts +17 -0
  87. package/dist/ui/inputs/select/use-select.js +85 -0
  88. package/dist/ui/inputs/select/use-select.mjs +7 -0
  89. package/dist/ui/inputs/text/index.js +144 -7
  90. package/dist/ui/inputs/text/index.mjs +4 -2
  91. package/dist/ui/inputs/text/text.js +144 -7
  92. package/dist/ui/inputs/text/text.mjs +4 -2
  93. package/dist/ui/layout/container/container.mjs +81 -74
  94. package/dist/ui/layout/container/index.mjs +81 -74
  95. package/dist/ui/layout/index.mjs +84 -77
  96. package/dist/ui/layout/page/index.mjs +4 -4
  97. package/dist/ui/layout/page/page-loading.mjs +3 -3
  98. package/dist/ui/layout/page/section-loading.mjs +3 -3
  99. package/dist/ui/navigation/index.mjs +11 -11
  100. package/dist/ui/overlays/index.mjs +5 -5
  101. package/dist/ui/provider/index.mjs +3 -3
  102. package/dist/ui/provider/ui-provider.mjs +3 -3
  103. package/dist/ui/surface/index.mjs +3 -3
  104. package/dist/ui/theme/colors/common.mjs +5 -5
  105. package/dist/ui/theme/colors/index.mjs +7 -7
  106. package/dist/ui/theme/colors/semantic.mjs +6 -6
  107. package/dist/ui/theme/colors.mjs +7 -7
  108. package/dist/ui/theme/index.mjs +8 -8
  109. package/dist/ui/theme/theme.mjs +8 -8
  110. package/package.json +1 -1
  111. package/dist/chunk-3YOW5DEZ.mjs +0 -45
  112. package/dist/chunk-V2G5QHZZ.mjs +0 -14
  113. package/dist/{chunk-CZEO3U25.mjs → chunk-5RNCFTW5.mjs} +0 -0
  114. package/dist/{chunk-STVN4B47.mjs → chunk-IXPMUODA.mjs} +12 -12
  115. /package/dist/{chunk-Q6JSJOU4.mjs → chunk-PTCNYQVY.mjs} +0 -0
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Next UI Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Next UI Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # @teach-in/react
2
-
3
- ## Installation
4
-
5
- ```sh
6
- yarn add @teach-in/react
7
- # or
8
- npm i @teach-in/react
9
- ```
1
+ # @teach-in/react
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ yarn add @teach-in/react
7
+ # or
8
+ npm i @teach-in/react
9
+ ```
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  semanticColors
4
- } from "./chunk-3VAZY2QK.mjs";
4
+ } from "./chunk-2CEZXLZR.mjs";
5
5
 
6
6
  // src/ui/theme/theme.ts
7
7
  import { heroui } from "@heroui/theme";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  commonColors
4
- } from "./chunk-STVN4B47.mjs";
4
+ } from "./chunk-IXPMUODA.mjs";
5
5
  import {
6
6
  swapColorValues
7
7
  } from "./chunk-VIPLRFPR.mjs";
@@ -0,0 +1,62 @@
1
+ "use client";
2
+
3
+ // src/ui/inputs/select/use-select.ts
4
+ import { useCallback, useMemo, useState } from "react";
5
+ function useSelect({
6
+ value,
7
+ onChange,
8
+ onClear,
9
+ selectionMode,
10
+ isClearable = true
11
+ }) {
12
+ const isMultiple = selectionMode === "multiple";
13
+ const [internalValue, setInternalValue] = useState(
14
+ isMultiple ? [] : null
15
+ );
16
+ const isControlled = value !== void 0;
17
+ const currentValue = isControlled ? value : internalValue;
18
+ const hasValue = currentValue != null && (Array.isArray(currentValue) ? currentValue.length > 0 : currentValue !== "");
19
+ const handleChange = useCallback(
20
+ (newValue) => {
21
+ if (!isControlled) {
22
+ setInternalValue(newValue);
23
+ }
24
+ if (isMultiple) {
25
+ onChange == null ? void 0 : onChange(newValue);
26
+ } else {
27
+ onChange == null ? void 0 : onChange(newValue);
28
+ }
29
+ },
30
+ [isControlled, onChange, isMultiple]
31
+ );
32
+ const handleClear = useCallback(() => {
33
+ onClear == null ? void 0 : onClear();
34
+ handleChange(isMultiple ? [] : null);
35
+ }, [onClear, handleChange, isMultiple]);
36
+ const selectedKeys = useMemo(() => {
37
+ if (currentValue == null) return /* @__PURE__ */ new Set();
38
+ return new Set(Array.isArray(currentValue) ? currentValue : [currentValue]);
39
+ }, [currentValue]);
40
+ const handleSelectionChange = useCallback(
41
+ (keys) => {
42
+ var _a;
43
+ if (keys === "all") return;
44
+ const selected = Array.from(keys).filter((key) => typeof key === "string");
45
+ handleChange(isMultiple ? selected : (_a = selected[0]) != null ? _a : null);
46
+ },
47
+ [handleChange, isMultiple]
48
+ );
49
+ const showClearButton = hasValue && isClearable;
50
+ return {
51
+ currentValue,
52
+ hasValue,
53
+ selectedKeys,
54
+ handleSelectionChange,
55
+ handleClear,
56
+ showClearButton
57
+ };
58
+ }
59
+
60
+ export {
61
+ useSelect
62
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Input
4
- } from "./chunk-V2G5QHZZ.mjs";
4
+ } from "./chunk-MCQGBAUS.mjs";
5
5
 
6
6
  // src/ui/inputs/email/email.tsx
7
7
  import React from "react";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Input
4
- } from "./chunk-V2G5QHZZ.mjs";
4
+ } from "./chunk-MCQGBAUS.mjs";
5
5
 
6
6
  // src/ui/form/rhf/fields/input-field.tsx
7
7
  import { Controller, useFormContext } from "react-hook-form";
@@ -13,7 +13,17 @@ function InputField({ name, ...props }) {
13
13
  {
14
14
  control,
15
15
  name,
16
- render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx(Input, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
16
+ render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx(
17
+ Input,
18
+ {
19
+ ...props,
20
+ ...field,
21
+ ref,
22
+ errorMessage: error == null ? void 0 : error.message,
23
+ isInvalid: !!error,
24
+ onValueChange: field.onChange
25
+ }
26
+ )
17
27
  }
18
28
  );
19
29
  }
@@ -0,0 +1,34 @@
1
+ "use client";
2
+
3
+ // src/ui/inputs/search/use-search.ts
4
+ import { useCallback } from "react";
5
+ function useSearch({ value, onSearch, onCancel, onKeyDown }) {
6
+ const handleKeyDown = useCallback(
7
+ (event) => {
8
+ if (event.key === "Enter") {
9
+ event.preventDefault();
10
+ onSearch == null ? void 0 : onSearch(event.target.value);
11
+ } else if (event.key === "Escape") {
12
+ event.preventDefault();
13
+ onCancel == null ? void 0 : onCancel();
14
+ }
15
+ onKeyDown == null ? void 0 : onKeyDown(event);
16
+ },
17
+ [onSearch, onCancel, onKeyDown]
18
+ );
19
+ const hasValue = value !== void 0 && String(value).length > 0;
20
+ const handleSearchClick = useCallback(() => {
21
+ if (hasValue) {
22
+ onSearch == null ? void 0 : onSearch(value);
23
+ }
24
+ }, [value, onSearch]);
25
+ return {
26
+ handleKeyDown,
27
+ handleSearchClick,
28
+ hasValue
29
+ };
30
+ }
31
+
32
+ export {
33
+ useSearch
34
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Select
4
- } from "./chunk-3YOW5DEZ.mjs";
4
+ } from "./chunk-VXYV37IM.mjs";
5
5
 
6
6
  // src/ui/form/rhf/fields/select-field.tsx
7
7
  import { Controller, useFormContext } from "react-hook-form";
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import {
3
+ Search
4
+ } from "./chunk-SEJXJZSK.mjs";
5
+
6
+ // src/ui/form/rhf/fields/search-field.tsx
7
+ import { Controller, useFormContext } from "react-hook-form";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function SearchField({ name, ...props }) {
10
+ const { control } = useFormContext();
11
+ return /* @__PURE__ */ jsx(
12
+ Controller,
13
+ {
14
+ control,
15
+ name,
16
+ render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx(
17
+ Search,
18
+ {
19
+ ...props,
20
+ ...field,
21
+ ref,
22
+ errorMessage: error == null ? void 0 : error.message,
23
+ isInvalid: !!error,
24
+ onValueChange: field.onChange
25
+ }
26
+ )
27
+ }
28
+ );
29
+ }
30
+ SearchField.displayName = "TeachInUI.SearchField";
31
+
32
+ export {
33
+ SearchField
34
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Text
4
- } from "./chunk-KTUGFQWJ.mjs";
4
+ } from "./chunk-KTWHCUYV.mjs";
5
5
 
6
6
  // src/ui/form/rhf/fields/text-field.tsx
7
7
  import { Controller, useFormContext } from "react-hook-form";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Input
4
- } from "./chunk-V2G5QHZZ.mjs";
4
+ } from "./chunk-MCQGBAUS.mjs";
5
5
 
6
6
  // src/ui/inputs/text/text.tsx
7
7
  import React from "react";
@@ -0,0 +1,73 @@
1
+ "use client";
2
+ import {
3
+ useInput
4
+ } from "./chunk-NSU66J5E.mjs";
5
+ import {
6
+ ClearButton
7
+ } from "./chunk-TUIN5YJW.mjs";
8
+
9
+ // src/ui/inputs/input/input.tsx
10
+ import React from "react";
11
+ import { Input as HeroUIInput } from "@heroui/input";
12
+ import { tv } from "tailwind-variants";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ var inputWrapperVariants = tv({
15
+ variants: {
16
+ variant: {
17
+ flat: "",
18
+ underlined: "",
19
+ bordered: "border-1",
20
+ faded: "border-1"
21
+ }
22
+ }
23
+ });
24
+ var Input = React.forwardRef(
25
+ ({
26
+ value,
27
+ defaultValue,
28
+ onClear,
29
+ onValueChange,
30
+ variant,
31
+ classNames,
32
+ endContent,
33
+ isReadOnly,
34
+ isClearable,
35
+ ...props
36
+ }, ref) => {
37
+ const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
38
+ value,
39
+ defaultValue,
40
+ onValueChange,
41
+ onClear,
42
+ isReadOnly,
43
+ isClearable,
44
+ ref
45
+ });
46
+ return /* @__PURE__ */ jsx(
47
+ HeroUIInput,
48
+ {
49
+ ref: mergedRef,
50
+ classNames: {
51
+ ...classNames,
52
+ inputWrapper: inputWrapperVariants({ variant }),
53
+ innerWrapper: "group"
54
+ },
55
+ defaultValue,
56
+ endContent: (endContent || showClearButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
57
+ endContent,
58
+ showClearButton && /* @__PURE__ */ jsx(ClearButton, { onClear: handleClear })
59
+ ] }),
60
+ isReadOnly,
61
+ value: currentValue,
62
+ variant,
63
+ onValueChange: handleValueChange,
64
+ ...props
65
+ }
66
+ );
67
+ }
68
+ );
69
+ Input.displayName = "TeachInUI.Input";
70
+
71
+ export {
72
+ Input
73
+ };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+
3
+ // src/ui/inputs/input/use-input.ts
4
+ import { useCallback, useRef, useState } from "react";
5
+ function useInput({
6
+ value,
7
+ defaultValue,
8
+ onValueChange,
9
+ onClear,
10
+ isReadOnly,
11
+ isClearable = true,
12
+ ref
13
+ }) {
14
+ const inputRef = useRef(null);
15
+ const [internalValue, setInternalValue] = useState(defaultValue != null ? defaultValue : "");
16
+ const isControlled = value !== void 0;
17
+ const currentValue = isControlled ? value : internalValue;
18
+ const hasValue = String(currentValue).length > 0;
19
+ const handleValueChange = useCallback(
20
+ (newValue) => {
21
+ if (!isControlled) {
22
+ setInternalValue(newValue);
23
+ }
24
+ onValueChange == null ? void 0 : onValueChange(newValue);
25
+ },
26
+ [isControlled, onValueChange]
27
+ );
28
+ const handleClear = useCallback(() => {
29
+ var _a;
30
+ onClear == null ? void 0 : onClear();
31
+ handleValueChange("");
32
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
33
+ }, [onClear, handleValueChange]);
34
+ const mergedRef = useCallback(
35
+ (node) => {
36
+ inputRef.current = node;
37
+ if (typeof ref === "function") {
38
+ ref(node);
39
+ } else if (ref) {
40
+ ref.current = node;
41
+ }
42
+ },
43
+ [ref]
44
+ );
45
+ const showClearButton = hasValue && !isReadOnly && isClearable;
46
+ return {
47
+ inputRef,
48
+ currentValue,
49
+ hasValue,
50
+ handleValueChange,
51
+ handleClear,
52
+ mergedRef,
53
+ showClearButton
54
+ };
55
+ }
56
+
57
+ export {
58
+ useInput
59
+ };
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  semanticColors
4
- } from "./chunk-3VAZY2QK.mjs";
4
+ } from "./chunk-2CEZXLZR.mjs";
5
5
  import {
6
6
  commonColors
7
- } from "./chunk-STVN4B47.mjs";
7
+ } from "./chunk-IXPMUODA.mjs";
8
8
 
9
9
  // src/ui/theme/colors/index.ts
10
10
  var colors = {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Email
4
- } from "./chunk-LJIVY6GU.mjs";
4
+ } from "./chunk-46SKVFMZ.mjs";
5
5
 
6
6
  // src/ui/form/rhf/fields/email-field.tsx
7
7
  import { Controller, useFormContext } from "react-hook-form";
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import {
3
+ useSearch
4
+ } from "./chunk-C2VWADF5.mjs";
5
+ import {
6
+ Input
7
+ } from "./chunk-MCQGBAUS.mjs";
8
+
9
+ // src/ui/inputs/search/search.tsx
10
+ import React from "react";
11
+ import { SearchIcon } from "lucide-react";
12
+ import { Button } from "@heroui/button";
13
+ import { tv } from "tailwind-variants";
14
+ import { jsx } from "react/jsx-runtime";
15
+ var searchIconVariants = tv({
16
+ base: "size-5 shrink-0",
17
+ variants: {
18
+ variant: {
19
+ faded: "text-default-400",
20
+ flat: "text-default-foreground",
21
+ bordered: "text-default-400",
22
+ underlined: "text-default-foreground"
23
+ }
24
+ }
25
+ });
26
+ var Search = React.forwardRef(
27
+ ({ variant = "bordered", radius = "full", value, onSearch, onCancel, onKeyDown, ...props }, ref) => {
28
+ const { handleKeyDown, handleSearchClick, hasValue } = useSearch({
29
+ value,
30
+ onSearch,
31
+ onCancel,
32
+ onKeyDown
33
+ });
34
+ return /* @__PURE__ */ jsx(
35
+ Input,
36
+ {
37
+ ref,
38
+ radius,
39
+ startContent: onSearch ? /* @__PURE__ */ jsx(
40
+ Button,
41
+ {
42
+ isIconOnly: true,
43
+ "aria-label": "\u041F\u043E\u0438\u0441\u043A",
44
+ isDisabled: !hasValue,
45
+ radius: "full",
46
+ size: "sm",
47
+ variant: "light",
48
+ onPress: handleSearchClick,
49
+ children: /* @__PURE__ */ jsx(SearchIcon, { className: searchIconVariants({ variant }) })
50
+ }
51
+ ) : /* @__PURE__ */ jsx(SearchIcon, { className: searchIconVariants({ variant }) }),
52
+ value,
53
+ variant,
54
+ onKeyDown: handleKeyDown,
55
+ ...props
56
+ }
57
+ );
58
+ }
59
+ );
60
+ Search.displayName = "TeachInUI.Search";
61
+
62
+ export {
63
+ Search
64
+ };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+
3
+ // src/ui/inputs/clear-button.tsx
4
+ import React from "react";
5
+ import { Button } from "@heroui/button";
6
+ import { XIcon } from "lucide-react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var ClearButton = React.forwardRef(
9
+ ({ onClear }, ref) => {
10
+ return /* @__PURE__ */ jsx(
11
+ Button,
12
+ {
13
+ ref,
14
+ isIconOnly: true,
15
+ "aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
16
+ as: "span",
17
+ className: "opacity-0 transition-opacity group-hover:opacity-100",
18
+ color: "default",
19
+ radius: "full",
20
+ size: "sm",
21
+ tabIndex: 0,
22
+ variant: "light",
23
+ onPress: onClear,
24
+ children: /* @__PURE__ */ jsx(XIcon, { className: "size-4 text-default-500" })
25
+ }
26
+ );
27
+ }
28
+ );
29
+ ClearButton.displayName = "TeachInUI.ClearButton";
30
+
31
+ export {
32
+ ClearButton
33
+ };
@@ -0,0 +1 @@
1
+ "use client";
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ import {
3
+ useSelect
4
+ } from "./chunk-2UHA3DYG.mjs";
5
+ import {
6
+ ClearButton
7
+ } from "./chunk-TUIN5YJW.mjs";
8
+
9
+ // src/ui/inputs/select/select.tsx
10
+ import React from "react";
11
+ import { Select as HeroUISelect, SelectItem as HeroUISelectItem } from "@heroui/select";
12
+ import { tv } from "tailwind-variants";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ var selectWrapperVariants = tv({
15
+ variants: {
16
+ variant: {
17
+ flat: "",
18
+ underlined: "",
19
+ bordered: "border-1",
20
+ faded: "border-1"
21
+ }
22
+ }
23
+ });
24
+ var Select = React.forwardRef(
25
+ ({
26
+ value,
27
+ defaultSelectedKeys,
28
+ items,
29
+ onChange,
30
+ selectionMode,
31
+ onClear,
32
+ variant,
33
+ classNames,
34
+ endContent,
35
+ isClearable,
36
+ ...props
37
+ }, ref) => {
38
+ const { selectedKeys, handleSelectionChange, handleClear, showClearButton } = useSelect({
39
+ value,
40
+ onChange,
41
+ onClear,
42
+ selectionMode,
43
+ isClearable
44
+ });
45
+ return /* @__PURE__ */ jsx(
46
+ HeroUISelect,
47
+ {
48
+ ref,
49
+ classNames: {
50
+ ...classNames,
51
+ trigger: selectWrapperVariants({ variant }),
52
+ innerWrapper: "group"
53
+ },
54
+ defaultSelectedKeys,
55
+ endContent: (endContent || showClearButton) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
56
+ endContent,
57
+ showClearButton && /* @__PURE__ */ jsx(ClearButton, { onClear: handleClear })
58
+ ] }),
59
+ items,
60
+ selectedKeys,
61
+ selectionMode,
62
+ variant,
63
+ onSelectionChange: handleSelectionChange,
64
+ ...props,
65
+ children: (item) => /* @__PURE__ */ jsx(HeroUISelectItem, { children: item.label }, item.key)
66
+ }
67
+ );
68
+ }
69
+ );
70
+ Select.displayName = "TeachInUI.Select";
71
+
72
+ export {
73
+ Select
74
+ };