@teach-in/react 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +9 -9
- package/dist/chunk-3YOW5DEZ.mjs +45 -0
- package/dist/{chunk-QCLLPJMB.mjs → chunk-544SDU73.mjs} +2 -2
- package/dist/{chunk-2CEZXLZR.mjs → chunk-AFVGHUW2.mjs} +1 -1
- package/dist/{chunk-IU2JYI7W.mjs → chunk-CETCW7DS.mjs} +1 -1
- package/dist/{chunk-5FFWQB7D.mjs → chunk-JDFRAN4S.mjs} +2 -12
- package/dist/{chunk-KTWHCUYV.mjs → chunk-KTUGFQWJ.mjs} +1 -1
- package/dist/{chunk-46SKVFMZ.mjs → chunk-LJIVY6GU.mjs} +1 -1
- package/dist/{chunk-CKJ5U5Q4.mjs → chunk-NLHQDWUK.mjs} +1 -1
- package/dist/{chunk-R46SWVWL.mjs → chunk-R7LDL5CU.mjs} +1 -1
- package/dist/chunk-V2G5QHZZ.mjs +14 -0
- package/dist/{chunk-2ASQXBDD.mjs → chunk-WFNNN6WU.mjs} +1 -1
- package/dist/index.js +230 -575
- package/dist/index.mjs +125 -141
- package/dist/ui/data/index.mjs +8 -8
- package/dist/ui/feedback/index.mjs +14 -14
- package/dist/ui/form/index.js +106 -447
- package/dist/ui/form/index.mjs +21 -31
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/email-field.js +10 -147
- package/dist/ui/form/rhf/fields/email-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/index.d.ts +0 -1
- package/dist/ui/form/rhf/fields/index.js +102 -443
- package/dist/ui/form/rhf/fields/index.mjs +21 -31
- package/dist/ui/form/rhf/fields/input-field.js +6 -153
- package/dist/ui/form/rhf/fields/input-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/radio-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/select-field.js +26 -136
- package/dist/ui/form/rhf/fields/select-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/switch-field.mjs +14 -20
- package/dist/ui/form/rhf/fields/text-field.js +10 -147
- package/dist/ui/form/rhf/fields/text-field.mjs +15 -21
- package/dist/ui/form/rhf/fields/textarea-field.mjs +14 -20
- package/dist/ui/form/rhf/index.js +102 -443
- package/dist/ui/form/rhf/index.mjs +21 -31
- package/dist/ui/format/index.mjs +3 -3
- package/dist/ui/index.js +230 -575
- package/dist/ui/index.mjs +125 -141
- package/dist/ui/inputs/checkbox/index.mjs +3 -3
- package/dist/ui/inputs/email/email.js +7 -144
- package/dist/ui/inputs/email/email.mjs +2 -4
- package/dist/ui/inputs/email/index.js +7 -144
- package/dist/ui/inputs/email/index.mjs +2 -4
- package/dist/ui/inputs/index.d.ts +0 -2
- package/dist/ui/inputs/index.js +56 -363
- package/dist/ui/inputs/index.mjs +25 -37
- package/dist/ui/inputs/input/index.js +3 -140
- package/dist/ui/inputs/input/index.mjs +1 -3
- package/dist/ui/inputs/input/input.d.ts +0 -1
- package/dist/ui/inputs/input/input.js +3 -140
- package/dist/ui/inputs/input/input.mjs +1 -3
- package/dist/ui/inputs/select/index.js +22 -132
- package/dist/ui/inputs/select/index.mjs +1 -3
- package/dist/ui/inputs/select/select.d.ts +0 -4
- package/dist/ui/inputs/select/select.js +22 -132
- package/dist/ui/inputs/select/select.mjs +1 -3
- package/dist/ui/inputs/text/index.js +7 -144
- package/dist/ui/inputs/text/index.mjs +2 -4
- package/dist/ui/inputs/text/text.js +7 -144
- package/dist/ui/inputs/text/text.mjs +2 -4
- package/dist/ui/layout/container/container.mjs +64 -71
- package/dist/ui/layout/container/index.mjs +64 -71
- package/dist/ui/layout/index.mjs +69 -76
- package/dist/ui/layout/page/index.mjs +3 -3
- package/dist/ui/layout/page/page-loading.mjs +3 -3
- package/dist/ui/layout/page/section-loading.mjs +3 -3
- package/dist/ui/navigation/index.mjs +5 -5
- package/dist/ui/overlays/index.mjs +4 -4
- package/dist/ui/provider/index.mjs +3 -3
- package/dist/ui/provider/ui-provider.mjs +3 -3
- package/dist/ui/theme/colors/common.mjs +3 -3
- package/dist/ui/theme/colors/index.mjs +6 -6
- package/dist/ui/theme/colors/semantic.mjs +4 -4
- package/dist/ui/theme/colors.mjs +6 -6
- package/dist/ui/theme/index.mjs +6 -6
- package/dist/ui/theme/theme.mjs +6 -6
- package/package.json +1 -1
- package/dist/chunk-2UHA3DYG.mjs +0 -62
- package/dist/chunk-C2VWADF5.mjs +0 -34
- package/dist/chunk-CUEG2BFV.mjs +0 -34
- package/dist/chunk-MCQGBAUS.mjs +0 -73
- package/dist/chunk-NSU66J5E.mjs +0 -59
- package/dist/chunk-SEJXJZSK.mjs +0 -64
- package/dist/chunk-TUIN5YJW.mjs +0 -33
- package/dist/chunk-UQAG7TKJ.mjs +0 -1
- package/dist/chunk-VXYV37IM.mjs +0 -74
- package/dist/ui/form/rhf/fields/search-field.d.ts +0 -10
- package/dist/ui/form/rhf/fields/search-field.js +0 -296
- package/dist/ui/form/rhf/fields/search-field.mjs +0 -37
- package/dist/ui/inputs/clear-button.d.ts +0 -5
- package/dist/ui/inputs/clear-button.js +0 -67
- package/dist/ui/inputs/clear-button.mjs +0 -8
- package/dist/ui/inputs/input/use-input.d.ts +0 -19
- package/dist/ui/inputs/input/use-input.js +0 -82
- package/dist/ui/inputs/input/use-input.mjs +0 -7
- package/dist/ui/inputs/search/index.d.ts +0 -1
- package/dist/ui/inputs/search/index.js +0 -270
- package/dist/ui/inputs/search/index.mjs +0 -13
- package/dist/ui/inputs/search/search.d.ts +0 -7
- package/dist/ui/inputs/search/search.js +0 -268
- package/dist/ui/inputs/search/search.mjs +0 -12
- package/dist/ui/inputs/search/use-search.d.ts +0 -12
- package/dist/ui/inputs/search/use-search.js +0 -57
- package/dist/ui/inputs/search/use-search.mjs +0 -7
- package/dist/ui/inputs/select/use-select.d.ts +0 -17
- package/dist/ui/inputs/select/use-select.js +0 -85
- package/dist/ui/inputs/select/use-select.mjs +0 -7
- package/dist/{chunk-IXPMUODA.mjs → chunk-5WDV3PDI.mjs} +6 -6
- /package/dist/{chunk-5RNCFTW5.mjs → chunk-CZEO3U25.mjs} +0 -0
- /package/dist/{chunk-PTCNYQVY.mjs → chunk-Q6JSJOU4.mjs} +0 -0
package/dist/chunk-TUIN5YJW.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/chunk-UQAG7TKJ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";
|
package/dist/chunk-VXYV37IM.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { SearchProps } from "../../../inputs";
|
|
2
|
-
import React from "react";
|
|
3
|
-
interface Props extends Omit<SearchProps, "name" | "errorMessage" | "isInvalid"> {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function SearchField({ name, ...props }: Props): React.JSX.Element;
|
|
7
|
-
export declare namespace SearchField {
|
|
8
|
-
var displayName: string;
|
|
9
|
-
}
|
|
10
|
-
export {};
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
|
|
31
|
-
// src/ui/form/rhf/fields/search-field.tsx
|
|
32
|
-
var search_field_exports = {};
|
|
33
|
-
__export(search_field_exports, {
|
|
34
|
-
SearchField: () => SearchField
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(search_field_exports);
|
|
37
|
-
var import_react_hook_form = require("react-hook-form");
|
|
38
|
-
|
|
39
|
-
// src/ui/inputs/input/input.tsx
|
|
40
|
-
var import_react3 = __toESM(require("react"));
|
|
41
|
-
var import_input = require("@heroui/input");
|
|
42
|
-
var import_tailwind_variants = require("tailwind-variants");
|
|
43
|
-
|
|
44
|
-
// src/ui/inputs/clear-button.tsx
|
|
45
|
-
var import_react = __toESM(require("react"));
|
|
46
|
-
var import_button = require("@heroui/button");
|
|
47
|
-
var import_lucide_react = require("lucide-react");
|
|
48
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
-
var ClearButton = import_react.default.forwardRef(
|
|
50
|
-
({ onClear }, ref) => {
|
|
51
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
-
import_button.Button,
|
|
53
|
-
{
|
|
54
|
-
ref,
|
|
55
|
-
isIconOnly: true,
|
|
56
|
-
"aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
57
|
-
as: "span",
|
|
58
|
-
className: "opacity-0 transition-opacity group-hover:opacity-100",
|
|
59
|
-
color: "default",
|
|
60
|
-
radius: "full",
|
|
61
|
-
size: "sm",
|
|
62
|
-
tabIndex: 0,
|
|
63
|
-
variant: "light",
|
|
64
|
-
onPress: onClear,
|
|
65
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
ClearButton.displayName = "TeachInUI.ClearButton";
|
|
71
|
-
|
|
72
|
-
// src/ui/inputs/input/use-input.ts
|
|
73
|
-
var import_react2 = require("react");
|
|
74
|
-
function useInput({
|
|
75
|
-
value,
|
|
76
|
-
defaultValue,
|
|
77
|
-
onValueChange,
|
|
78
|
-
onClear,
|
|
79
|
-
isReadOnly,
|
|
80
|
-
isClearable = true,
|
|
81
|
-
ref
|
|
82
|
-
}) {
|
|
83
|
-
const inputRef = (0, import_react2.useRef)(null);
|
|
84
|
-
const [internalValue, setInternalValue] = (0, import_react2.useState)(defaultValue != null ? defaultValue : "");
|
|
85
|
-
const isControlled = value !== void 0;
|
|
86
|
-
const currentValue = isControlled ? value : internalValue;
|
|
87
|
-
const hasValue = String(currentValue).length > 0;
|
|
88
|
-
const handleValueChange = (0, import_react2.useCallback)(
|
|
89
|
-
(newValue) => {
|
|
90
|
-
if (!isControlled) {
|
|
91
|
-
setInternalValue(newValue);
|
|
92
|
-
}
|
|
93
|
-
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
94
|
-
},
|
|
95
|
-
[isControlled, onValueChange]
|
|
96
|
-
);
|
|
97
|
-
const handleClear = (0, import_react2.useCallback)(() => {
|
|
98
|
-
var _a;
|
|
99
|
-
onClear == null ? void 0 : onClear();
|
|
100
|
-
handleValueChange("");
|
|
101
|
-
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
102
|
-
}, [onClear, handleValueChange]);
|
|
103
|
-
const mergedRef = (0, import_react2.useCallback)(
|
|
104
|
-
(node) => {
|
|
105
|
-
inputRef.current = node;
|
|
106
|
-
if (typeof ref === "function") {
|
|
107
|
-
ref(node);
|
|
108
|
-
} else if (ref) {
|
|
109
|
-
ref.current = node;
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
[ref]
|
|
113
|
-
);
|
|
114
|
-
const showClearButton = hasValue && !isReadOnly && isClearable;
|
|
115
|
-
return {
|
|
116
|
-
inputRef,
|
|
117
|
-
currentValue,
|
|
118
|
-
hasValue,
|
|
119
|
-
handleValueChange,
|
|
120
|
-
handleClear,
|
|
121
|
-
mergedRef,
|
|
122
|
-
showClearButton
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// src/ui/inputs/input/input.tsx
|
|
127
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
128
|
-
var inputWrapperVariants = (0, import_tailwind_variants.tv)({
|
|
129
|
-
variants: {
|
|
130
|
-
variant: {
|
|
131
|
-
flat: "",
|
|
132
|
-
underlined: "",
|
|
133
|
-
bordered: "border-1",
|
|
134
|
-
faded: "border-1"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
var Input = import_react3.default.forwardRef(
|
|
139
|
-
({
|
|
140
|
-
value,
|
|
141
|
-
defaultValue,
|
|
142
|
-
onClear,
|
|
143
|
-
onValueChange,
|
|
144
|
-
variant,
|
|
145
|
-
classNames,
|
|
146
|
-
endContent,
|
|
147
|
-
isReadOnly,
|
|
148
|
-
isClearable,
|
|
149
|
-
...props
|
|
150
|
-
}, ref) => {
|
|
151
|
-
const { currentValue, handleValueChange, handleClear, mergedRef, showClearButton } = useInput({
|
|
152
|
-
value,
|
|
153
|
-
defaultValue,
|
|
154
|
-
onValueChange,
|
|
155
|
-
onClear,
|
|
156
|
-
isReadOnly,
|
|
157
|
-
isClearable,
|
|
158
|
-
ref
|
|
159
|
-
});
|
|
160
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
161
|
-
import_input.Input,
|
|
162
|
-
{
|
|
163
|
-
ref: mergedRef,
|
|
164
|
-
classNames: {
|
|
165
|
-
...classNames,
|
|
166
|
-
inputWrapper: inputWrapperVariants({ variant }),
|
|
167
|
-
innerWrapper: "group"
|
|
168
|
-
},
|
|
169
|
-
defaultValue,
|
|
170
|
-
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
171
|
-
endContent,
|
|
172
|
-
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
|
|
173
|
-
] }),
|
|
174
|
-
isReadOnly,
|
|
175
|
-
value: currentValue,
|
|
176
|
-
variant,
|
|
177
|
-
onValueChange: handleValueChange,
|
|
178
|
-
...props
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
Input.displayName = "TeachInUI.Input";
|
|
184
|
-
|
|
185
|
-
// src/ui/inputs/search/search.tsx
|
|
186
|
-
var import_react5 = __toESM(require("react"));
|
|
187
|
-
var import_lucide_react2 = require("lucide-react");
|
|
188
|
-
var import_button2 = require("@heroui/button");
|
|
189
|
-
var import_tailwind_variants2 = require("tailwind-variants");
|
|
190
|
-
|
|
191
|
-
// src/ui/inputs/search/use-search.ts
|
|
192
|
-
var import_react4 = require("react");
|
|
193
|
-
function useSearch({ value, onSearch, onCancel, onKeyDown }) {
|
|
194
|
-
const handleKeyDown = (0, import_react4.useCallback)(
|
|
195
|
-
(event) => {
|
|
196
|
-
if (event.key === "Enter") {
|
|
197
|
-
event.preventDefault();
|
|
198
|
-
onSearch == null ? void 0 : onSearch(event.target.value);
|
|
199
|
-
} else if (event.key === "Escape") {
|
|
200
|
-
event.preventDefault();
|
|
201
|
-
onCancel == null ? void 0 : onCancel();
|
|
202
|
-
}
|
|
203
|
-
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
204
|
-
},
|
|
205
|
-
[onSearch, onCancel, onKeyDown]
|
|
206
|
-
);
|
|
207
|
-
const hasValue = value !== void 0 && String(value).length > 0;
|
|
208
|
-
const handleSearchClick = (0, import_react4.useCallback)(() => {
|
|
209
|
-
if (hasValue) {
|
|
210
|
-
onSearch == null ? void 0 : onSearch(value);
|
|
211
|
-
}
|
|
212
|
-
}, [value, onSearch]);
|
|
213
|
-
return {
|
|
214
|
-
handleKeyDown,
|
|
215
|
-
handleSearchClick,
|
|
216
|
-
hasValue
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// src/ui/inputs/search/search.tsx
|
|
221
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
222
|
-
var searchIconVariants = (0, import_tailwind_variants2.tv)({
|
|
223
|
-
base: "size-5 shrink-0",
|
|
224
|
-
variants: {
|
|
225
|
-
variant: {
|
|
226
|
-
faded: "text-default-400",
|
|
227
|
-
flat: "text-default-foreground",
|
|
228
|
-
bordered: "text-default-400",
|
|
229
|
-
underlined: "text-default-foreground"
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
var Search = import_react5.default.forwardRef(
|
|
234
|
-
({ variant = "bordered", radius = "full", value, onSearch, onCancel, onKeyDown, ...props }, ref) => {
|
|
235
|
-
const { handleKeyDown, handleSearchClick, hasValue } = useSearch({
|
|
236
|
-
value,
|
|
237
|
-
onSearch,
|
|
238
|
-
onCancel,
|
|
239
|
-
onKeyDown
|
|
240
|
-
});
|
|
241
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
242
|
-
Input,
|
|
243
|
-
{
|
|
244
|
-
ref,
|
|
245
|
-
radius,
|
|
246
|
-
startContent: onSearch ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
247
|
-
import_button2.Button,
|
|
248
|
-
{
|
|
249
|
-
isIconOnly: true,
|
|
250
|
-
"aria-label": "\u041F\u043E\u0438\u0441\u043A",
|
|
251
|
-
isDisabled: !hasValue,
|
|
252
|
-
radius: "full",
|
|
253
|
-
size: "sm",
|
|
254
|
-
variant: "light",
|
|
255
|
-
onPress: handleSearchClick,
|
|
256
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) })
|
|
257
|
-
}
|
|
258
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.SearchIcon, { className: searchIconVariants({ variant }) }),
|
|
259
|
-
value,
|
|
260
|
-
variant,
|
|
261
|
-
onKeyDown: handleKeyDown,
|
|
262
|
-
...props
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
);
|
|
267
|
-
Search.displayName = "TeachInUI.Search";
|
|
268
|
-
|
|
269
|
-
// src/ui/form/rhf/fields/search-field.tsx
|
|
270
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
271
|
-
function SearchField({ name, ...props }) {
|
|
272
|
-
const { control } = (0, import_react_hook_form.useFormContext)();
|
|
273
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
274
|
-
import_react_hook_form.Controller,
|
|
275
|
-
{
|
|
276
|
-
control,
|
|
277
|
-
name,
|
|
278
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
279
|
-
Search,
|
|
280
|
-
{
|
|
281
|
-
...props,
|
|
282
|
-
...field,
|
|
283
|
-
ref,
|
|
284
|
-
errorMessage: error == null ? void 0 : error.message,
|
|
285
|
-
isInvalid: !!error,
|
|
286
|
-
onValueChange: field.onChange
|
|
287
|
-
}
|
|
288
|
-
)
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
SearchField.displayName = "TeachInUI.SearchField";
|
|
293
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
294
|
-
0 && (module.exports = {
|
|
295
|
-
SearchField
|
|
296
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
SearchField
|
|
4
|
-
} from "../../../../chunk-CUEG2BFV.mjs";
|
|
5
|
-
import "../../../../chunk-UQAG7TKJ.mjs";
|
|
6
|
-
import "../../../../chunk-DUQFM3QS.mjs";
|
|
7
|
-
import "../../../../chunk-KTWHCUYV.mjs";
|
|
8
|
-
import "../../../../chunk-LLP2PTPK.mjs";
|
|
9
|
-
import "../../../../chunk-E5QSNLSR.mjs";
|
|
10
|
-
import "../../../../chunk-N3EAW6UO.mjs";
|
|
11
|
-
import "../../../../chunk-5HK7HRTR.mjs";
|
|
12
|
-
import "../../../../chunk-HJUZTISD.mjs";
|
|
13
|
-
import "../../../../chunk-V3KKDSQP.mjs";
|
|
14
|
-
import "../../../../chunk-46SKVFMZ.mjs";
|
|
15
|
-
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
16
|
-
import "../../../../chunk-VXYV37IM.mjs";
|
|
17
|
-
import "../../../../chunk-2UHA3DYG.mjs";
|
|
18
|
-
import "../../../../chunk-5RNCFTW5.mjs";
|
|
19
|
-
import "../../../../chunk-SEJXJZSK.mjs";
|
|
20
|
-
import "../../../../chunk-C2VWADF5.mjs";
|
|
21
|
-
import "../../../../chunk-UUKS7JYX.mjs";
|
|
22
|
-
import "../../../../chunk-V2HNFTTX.mjs";
|
|
23
|
-
import "../../../../chunk-IAJ6G633.mjs";
|
|
24
|
-
import "../../../../chunk-RRA7GWP2.mjs";
|
|
25
|
-
import "../../../../chunk-NOXFF2KJ.mjs";
|
|
26
|
-
import "../../../../chunk-2SNKT7I4.mjs";
|
|
27
|
-
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
28
|
-
import "../../../../chunk-MCQGBAUS.mjs";
|
|
29
|
-
import "../../../../chunk-NSU66J5E.mjs";
|
|
30
|
-
import "../../../../chunk-WYJW5NNA.mjs";
|
|
31
|
-
import "../../../../chunk-C3MURCMZ.mjs";
|
|
32
|
-
import "../../../../chunk-C4PCTOGM.mjs";
|
|
33
|
-
import "../../../../chunk-N3QOXWJI.mjs";
|
|
34
|
-
import "../../../../chunk-TUIN5YJW.mjs";
|
|
35
|
-
export {
|
|
36
|
-
SearchField
|
|
37
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
"use client";
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
-
mod
|
|
29
|
-
));
|
|
30
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
-
|
|
32
|
-
// src/ui/inputs/clear-button.tsx
|
|
33
|
-
var clear_button_exports = {};
|
|
34
|
-
__export(clear_button_exports, {
|
|
35
|
-
ClearButton: () => ClearButton
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(clear_button_exports);
|
|
38
|
-
var import_react = __toESM(require("react"));
|
|
39
|
-
var import_button = require("@heroui/button");
|
|
40
|
-
var import_lucide_react = require("lucide-react");
|
|
41
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
-
var ClearButton = import_react.default.forwardRef(
|
|
43
|
-
({ onClear }, ref) => {
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
|
-
import_button.Button,
|
|
46
|
-
{
|
|
47
|
-
ref,
|
|
48
|
-
isIconOnly: true,
|
|
49
|
-
"aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
50
|
-
as: "span",
|
|
51
|
-
className: "opacity-0 transition-opacity group-hover:opacity-100",
|
|
52
|
-
color: "default",
|
|
53
|
-
radius: "full",
|
|
54
|
-
size: "sm",
|
|
55
|
-
tabIndex: 0,
|
|
56
|
-
variant: "light",
|
|
57
|
-
onPress: onClear,
|
|
58
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
ClearButton.displayName = "TeachInUI.ClearButton";
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
ClearButton
|
|
67
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface UseInputProps {
|
|
2
|
-
value?: string;
|
|
3
|
-
defaultValue?: string;
|
|
4
|
-
onValueChange?: (value: string) => void;
|
|
5
|
-
onClear?: () => void;
|
|
6
|
-
isReadOnly?: boolean;
|
|
7
|
-
isClearable?: boolean;
|
|
8
|
-
ref?: React.Ref<HTMLInputElement>;
|
|
9
|
-
}
|
|
10
|
-
export declare function useInput({ value, defaultValue, onValueChange, onClear, isReadOnly, isClearable, ref, }: UseInputProps): {
|
|
11
|
-
inputRef: import("react").RefObject<HTMLInputElement | null>;
|
|
12
|
-
currentValue: string;
|
|
13
|
-
hasValue: boolean;
|
|
14
|
-
handleValueChange: (newValue: string) => void;
|
|
15
|
-
handleClear: () => void;
|
|
16
|
-
mergedRef: (node: HTMLInputElement | null) => void;
|
|
17
|
-
showClearButton: boolean;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/ui/inputs/input/use-input.ts
|
|
22
|
-
var use_input_exports = {};
|
|
23
|
-
__export(use_input_exports, {
|
|
24
|
-
useInput: () => useInput
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(use_input_exports);
|
|
27
|
-
var import_react = require("react");
|
|
28
|
-
function useInput({
|
|
29
|
-
value,
|
|
30
|
-
defaultValue,
|
|
31
|
-
onValueChange,
|
|
32
|
-
onClear,
|
|
33
|
-
isReadOnly,
|
|
34
|
-
isClearable = true,
|
|
35
|
-
ref
|
|
36
|
-
}) {
|
|
37
|
-
const inputRef = (0, import_react.useRef)(null);
|
|
38
|
-
const [internalValue, setInternalValue] = (0, import_react.useState)(defaultValue != null ? defaultValue : "");
|
|
39
|
-
const isControlled = value !== void 0;
|
|
40
|
-
const currentValue = isControlled ? value : internalValue;
|
|
41
|
-
const hasValue = String(currentValue).length > 0;
|
|
42
|
-
const handleValueChange = (0, import_react.useCallback)(
|
|
43
|
-
(newValue) => {
|
|
44
|
-
if (!isControlled) {
|
|
45
|
-
setInternalValue(newValue);
|
|
46
|
-
}
|
|
47
|
-
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
48
|
-
},
|
|
49
|
-
[isControlled, onValueChange]
|
|
50
|
-
);
|
|
51
|
-
const handleClear = (0, import_react.useCallback)(() => {
|
|
52
|
-
var _a;
|
|
53
|
-
onClear == null ? void 0 : onClear();
|
|
54
|
-
handleValueChange("");
|
|
55
|
-
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
56
|
-
}, [onClear, handleValueChange]);
|
|
57
|
-
const mergedRef = (0, import_react.useCallback)(
|
|
58
|
-
(node) => {
|
|
59
|
-
inputRef.current = node;
|
|
60
|
-
if (typeof ref === "function") {
|
|
61
|
-
ref(node);
|
|
62
|
-
} else if (ref) {
|
|
63
|
-
ref.current = node;
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
[ref]
|
|
67
|
-
);
|
|
68
|
-
const showClearButton = hasValue && !isReadOnly && isClearable;
|
|
69
|
-
return {
|
|
70
|
-
inputRef,
|
|
71
|
-
currentValue,
|
|
72
|
-
hasValue,
|
|
73
|
-
handleValueChange,
|
|
74
|
-
handleClear,
|
|
75
|
-
mergedRef,
|
|
76
|
-
showClearButton
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
-
0 && (module.exports = {
|
|
81
|
-
useInput
|
|
82
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Search, type SearchProps } from "./search";
|