@teach-in/react 1.0.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.
- package/LICENSE +21 -21
- package/README.md +9 -9
- package/dist/{chunk-AMNORHD6.mjs → chunk-2ASQXBDD.mjs} +1 -1
- package/dist/{chunk-3VAZY2QK.mjs → chunk-2CEZXLZR.mjs} +1 -1
- package/dist/chunk-2UHA3DYG.mjs +62 -0
- package/dist/{chunk-LJIVY6GU.mjs → chunk-46SKVFMZ.mjs} +1 -1
- package/dist/{chunk-JDFRAN4S.mjs → chunk-5FFWQB7D.mjs} +12 -2
- package/dist/chunk-C2VWADF5.mjs +34 -0
- package/dist/{chunk-NLHQDWUK.mjs → chunk-CKJ5U5Q4.mjs} +1 -1
- package/dist/chunk-CUEG2BFV.mjs +34 -0
- package/dist/{chunk-CETCW7DS.mjs → chunk-IU2JYI7W.mjs} +1 -1
- package/dist/{chunk-KTUGFQWJ.mjs → chunk-KTWHCUYV.mjs} +1 -1
- package/dist/chunk-M5G6RR4Q.mjs +39 -0
- package/dist/chunk-MCQGBAUS.mjs +73 -0
- package/dist/chunk-NSU66J5E.mjs +59 -0
- package/dist/{chunk-CFG5V7VB.mjs → chunk-QCLLPJMB.mjs} +2 -2
- package/dist/{chunk-R7LDL5CU.mjs → chunk-R46SWVWL.mjs} +1 -1
- package/dist/chunk-SEJXJZSK.mjs +64 -0
- package/dist/chunk-TUIN5YJW.mjs +33 -0
- package/dist/chunk-UQAG7TKJ.mjs +1 -0
- package/dist/chunk-VXYV37IM.mjs +74 -0
- package/dist/index.js +609 -228
- package/dist/index.mjs +106 -86
- package/dist/ui/data/index.mjs +10 -10
- package/dist/ui/feedback/index.mjs +8 -8
- package/dist/ui/form/index.js +447 -106
- package/dist/ui/form/index.mjs +25 -15
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/email-field.js +147 -10
- package/dist/ui/form/rhf/fields/email-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/index.d.ts +1 -0
- package/dist/ui/form/rhf/fields/index.js +443 -102
- package/dist/ui/form/rhf/fields/index.mjs +25 -15
- package/dist/ui/form/rhf/fields/input-field.js +153 -6
- package/dist/ui/form/rhf/fields/input-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/radio-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/search-field.d.ts +10 -0
- package/dist/ui/form/rhf/fields/search-field.js +296 -0
- package/dist/ui/form/rhf/fields/search-field.mjs +37 -0
- package/dist/ui/form/rhf/fields/select-field.js +136 -26
- package/dist/ui/form/rhf/fields/select-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/switch-field.mjs +16 -10
- package/dist/ui/form/rhf/fields/text-field.js +147 -10
- package/dist/ui/form/rhf/fields/text-field.mjs +17 -11
- package/dist/ui/form/rhf/fields/textarea-field.mjs +16 -10
- package/dist/ui/form/rhf/index.js +443 -102
- package/dist/ui/form/rhf/index.mjs +25 -15
- package/dist/ui/format/index.d.ts +1 -0
- package/dist/ui/format/index.js +41 -5
- package/dist/ui/format/index.mjs +15 -11
- package/dist/ui/format/uuid.d.ts +12 -0
- package/dist/ui/format/uuid.js +62 -0
- package/dist/ui/format/uuid.mjs +7 -0
- package/dist/ui/index.js +609 -228
- package/dist/ui/index.mjs +106 -86
- package/dist/ui/inputs/clear-button.d.ts +5 -0
- package/dist/ui/inputs/clear-button.js +67 -0
- package/dist/ui/inputs/clear-button.mjs +8 -0
- package/dist/ui/inputs/email/email.js +144 -7
- package/dist/ui/inputs/email/email.mjs +4 -2
- package/dist/ui/inputs/email/index.js +144 -7
- package/dist/ui/inputs/email/index.mjs +4 -2
- package/dist/ui/inputs/index.d.ts +2 -0
- package/dist/ui/inputs/index.js +363 -56
- package/dist/ui/inputs/index.mjs +27 -15
- package/dist/ui/inputs/input/index.js +140 -3
- package/dist/ui/inputs/input/index.mjs +3 -1
- package/dist/ui/inputs/input/input.d.ts +1 -0
- package/dist/ui/inputs/input/input.js +140 -3
- package/dist/ui/inputs/input/input.mjs +3 -1
- package/dist/ui/inputs/input/use-input.d.ts +19 -0
- package/dist/ui/inputs/input/use-input.js +82 -0
- package/dist/ui/inputs/input/use-input.mjs +7 -0
- package/dist/ui/inputs/radio/index.mjs +3 -3
- package/dist/ui/inputs/search/index.d.ts +1 -0
- package/dist/ui/inputs/search/index.js +270 -0
- package/dist/ui/inputs/search/index.mjs +13 -0
- package/dist/ui/inputs/search/search.d.ts +7 -0
- package/dist/ui/inputs/search/search.js +268 -0
- package/dist/ui/inputs/search/search.mjs +12 -0
- package/dist/ui/inputs/search/use-search.d.ts +12 -0
- package/dist/ui/inputs/search/use-search.js +57 -0
- package/dist/ui/inputs/search/use-search.mjs +7 -0
- package/dist/ui/inputs/select/index.js +132 -22
- package/dist/ui/inputs/select/index.mjs +3 -1
- package/dist/ui/inputs/select/select.d.ts +4 -0
- package/dist/ui/inputs/select/select.js +132 -22
- package/dist/ui/inputs/select/select.mjs +3 -1
- package/dist/ui/inputs/select/use-select.d.ts +17 -0
- package/dist/ui/inputs/select/use-select.js +85 -0
- package/dist/ui/inputs/select/use-select.mjs +7 -0
- package/dist/ui/inputs/text/index.js +144 -7
- package/dist/ui/inputs/text/index.mjs +4 -2
- package/dist/ui/inputs/text/text.js +144 -7
- package/dist/ui/inputs/text/text.mjs +4 -2
- package/dist/ui/layout/container/container.mjs +56 -48
- package/dist/ui/layout/container/index.mjs +56 -48
- package/dist/ui/layout/index.mjs +62 -54
- package/dist/ui/layout/page/index.mjs +4 -4
- package/dist/ui/layout/page/page-loading.mjs +4 -4
- package/dist/ui/layout/page/section-loading.mjs +4 -4
- package/dist/ui/navigation/index.mjs +8 -8
- package/dist/ui/overlays/index.mjs +5 -5
- package/dist/ui/provider/index.mjs +4 -4
- package/dist/ui/provider/ui-provider.mjs +4 -4
- package/dist/ui/theme/colors/common.mjs +5 -5
- package/dist/ui/theme/colors/index.mjs +8 -8
- package/dist/ui/theme/colors/semantic.mjs +6 -6
- package/dist/ui/theme/colors.mjs +8 -8
- package/dist/ui/theme/index.mjs +8 -8
- package/dist/ui/theme/theme.mjs +8 -8
- package/package.json +1 -1
- package/dist/chunk-3YOW5DEZ.mjs +0 -45
- package/dist/chunk-V2G5QHZZ.mjs +0 -14
- package/dist/{chunk-5IHVMMCK.mjs → chunk-5N3SIZHF.mjs} +0 -0
- package/dist/{chunk-CZEO3U25.mjs → chunk-5RNCFTW5.mjs} +0 -0
- package/dist/{chunk-STVN4B47.mjs → chunk-IXPMUODA.mjs} +12 -12
- /package/dist/{chunk-Q6JSJOU4.mjs → chunk-PTCNYQVY.mjs} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
};
|
|
@@ -36,40 +36,150 @@ __export(select_field_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(select_field_exports);
|
|
37
37
|
var import_react_hook_form = require("react-hook-form");
|
|
38
38
|
|
|
39
|
-
// src/ui/inputs/
|
|
39
|
+
// src/ui/inputs/clear-button.tsx
|
|
40
40
|
var import_react = __toESM(require("react"));
|
|
41
|
-
var
|
|
41
|
+
var import_button = require("@heroui/button");
|
|
42
|
+
var import_lucide_react = require("lucide-react");
|
|
42
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
-
var
|
|
44
|
-
({
|
|
45
|
-
const isMultiple = selectionMode === "multiple";
|
|
46
|
-
const selectedKeys = import_react.default.useMemo(() => {
|
|
47
|
-
if (value == null) return /* @__PURE__ */ new Set();
|
|
48
|
-
return new Set(Array.isArray(value) ? value : [value]);
|
|
49
|
-
}, [value]);
|
|
50
|
-
const handleSelectionChange = import_react.default.useCallback(
|
|
51
|
-
(keys) => {
|
|
52
|
-
var _a;
|
|
53
|
-
if (keys === "all") return;
|
|
54
|
-
const selected = Array.from(keys).filter((key) => typeof key === "string");
|
|
55
|
-
if (isMultiple) {
|
|
56
|
-
onChange == null ? void 0 : onChange(selected);
|
|
57
|
-
} else {
|
|
58
|
-
onChange == null ? void 0 : onChange((_a = selected[0]) != null ? _a : null);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
[onChange, isMultiple]
|
|
62
|
-
);
|
|
44
|
+
var ClearButton = import_react.default.forwardRef(
|
|
45
|
+
({ onClear }, ref) => {
|
|
63
46
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
import_button.Button,
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
isIconOnly: true,
|
|
51
|
+
"aria-label": "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",
|
|
52
|
+
as: "span",
|
|
53
|
+
className: "opacity-0 transition-opacity group-hover:opacity-100",
|
|
54
|
+
color: "default",
|
|
55
|
+
radius: "full",
|
|
56
|
+
size: "sm",
|
|
57
|
+
tabIndex: 0,
|
|
58
|
+
variant: "light",
|
|
59
|
+
onPress: onClear,
|
|
60
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XIcon, { className: "size-4 text-default-500" })
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
ClearButton.displayName = "TeachInUI.ClearButton";
|
|
66
|
+
|
|
67
|
+
// src/ui/inputs/select/select.tsx
|
|
68
|
+
var import_react3 = __toESM(require("react"));
|
|
69
|
+
var import_select = require("@heroui/select");
|
|
70
|
+
var import_tailwind_variants = require("tailwind-variants");
|
|
71
|
+
|
|
72
|
+
// src/ui/inputs/select/use-select.ts
|
|
73
|
+
var import_react2 = require("react");
|
|
74
|
+
function useSelect({
|
|
75
|
+
value,
|
|
76
|
+
onChange,
|
|
77
|
+
onClear,
|
|
78
|
+
selectionMode,
|
|
79
|
+
isClearable = true
|
|
80
|
+
}) {
|
|
81
|
+
const isMultiple = selectionMode === "multiple";
|
|
82
|
+
const [internalValue, setInternalValue] = (0, import_react2.useState)(
|
|
83
|
+
isMultiple ? [] : null
|
|
84
|
+
);
|
|
85
|
+
const isControlled = value !== void 0;
|
|
86
|
+
const currentValue = isControlled ? value : internalValue;
|
|
87
|
+
const hasValue = currentValue != null && (Array.isArray(currentValue) ? currentValue.length > 0 : currentValue !== "");
|
|
88
|
+
const handleChange = (0, import_react2.useCallback)(
|
|
89
|
+
(newValue) => {
|
|
90
|
+
if (!isControlled) {
|
|
91
|
+
setInternalValue(newValue);
|
|
92
|
+
}
|
|
93
|
+
if (isMultiple) {
|
|
94
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
95
|
+
} else {
|
|
96
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
[isControlled, onChange, isMultiple]
|
|
100
|
+
);
|
|
101
|
+
const handleClear = (0, import_react2.useCallback)(() => {
|
|
102
|
+
onClear == null ? void 0 : onClear();
|
|
103
|
+
handleChange(isMultiple ? [] : null);
|
|
104
|
+
}, [onClear, handleChange, isMultiple]);
|
|
105
|
+
const selectedKeys = (0, import_react2.useMemo)(() => {
|
|
106
|
+
if (currentValue == null) return /* @__PURE__ */ new Set();
|
|
107
|
+
return new Set(Array.isArray(currentValue) ? currentValue : [currentValue]);
|
|
108
|
+
}, [currentValue]);
|
|
109
|
+
const handleSelectionChange = (0, import_react2.useCallback)(
|
|
110
|
+
(keys) => {
|
|
111
|
+
var _a;
|
|
112
|
+
if (keys === "all") return;
|
|
113
|
+
const selected = Array.from(keys).filter((key) => typeof key === "string");
|
|
114
|
+
handleChange(isMultiple ? selected : (_a = selected[0]) != null ? _a : null);
|
|
115
|
+
},
|
|
116
|
+
[handleChange, isMultiple]
|
|
117
|
+
);
|
|
118
|
+
const showClearButton = hasValue && isClearable;
|
|
119
|
+
return {
|
|
120
|
+
currentValue,
|
|
121
|
+
hasValue,
|
|
122
|
+
selectedKeys,
|
|
123
|
+
handleSelectionChange,
|
|
124
|
+
handleClear,
|
|
125
|
+
showClearButton
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/ui/inputs/select/select.tsx
|
|
130
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
131
|
+
var selectWrapperVariants = (0, import_tailwind_variants.tv)({
|
|
132
|
+
variants: {
|
|
133
|
+
variant: {
|
|
134
|
+
flat: "",
|
|
135
|
+
underlined: "",
|
|
136
|
+
bordered: "border-1",
|
|
137
|
+
faded: "border-1"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
var Select = import_react3.default.forwardRef(
|
|
142
|
+
({
|
|
143
|
+
value,
|
|
144
|
+
defaultSelectedKeys,
|
|
145
|
+
items,
|
|
146
|
+
onChange,
|
|
147
|
+
selectionMode,
|
|
148
|
+
onClear,
|
|
149
|
+
variant,
|
|
150
|
+
classNames,
|
|
151
|
+
endContent,
|
|
152
|
+
isClearable,
|
|
153
|
+
...props
|
|
154
|
+
}, ref) => {
|
|
155
|
+
const { selectedKeys, handleSelectionChange, handleClear, showClearButton } = useSelect({
|
|
156
|
+
value,
|
|
157
|
+
onChange,
|
|
158
|
+
onClear,
|
|
159
|
+
selectionMode,
|
|
160
|
+
isClearable
|
|
161
|
+
});
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
64
163
|
import_select.Select,
|
|
65
164
|
{
|
|
66
165
|
ref,
|
|
166
|
+
classNames: {
|
|
167
|
+
...classNames,
|
|
168
|
+
trigger: selectWrapperVariants({ variant }),
|
|
169
|
+
innerWrapper: "group"
|
|
170
|
+
},
|
|
171
|
+
defaultSelectedKeys,
|
|
172
|
+
endContent: (endContent || showClearButton) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
173
|
+
endContent,
|
|
174
|
+
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ClearButton, { onClear: handleClear })
|
|
175
|
+
] }),
|
|
67
176
|
items,
|
|
68
177
|
selectedKeys,
|
|
69
178
|
selectionMode,
|
|
179
|
+
variant,
|
|
70
180
|
onSelectionChange: handleSelectionChange,
|
|
71
181
|
...props,
|
|
72
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
182
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.SelectItem, { children: item.label }, item.key)
|
|
73
183
|
}
|
|
74
184
|
);
|
|
75
185
|
}
|
|
@@ -77,15 +187,15 @@ var Select = import_react.default.forwardRef(
|
|
|
77
187
|
Select.displayName = "TeachInUI.Select";
|
|
78
188
|
|
|
79
189
|
// src/ui/form/rhf/fields/select-field.tsx
|
|
80
|
-
var
|
|
190
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
81
191
|
function SelectField({ name, selectionMode, ...props }) {
|
|
82
192
|
const { control } = (0, import_react_hook_form.useFormContext)();
|
|
83
|
-
return /* @__PURE__ */ (0,
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
84
194
|
import_react_hook_form.Controller,
|
|
85
195
|
{
|
|
86
196
|
control,
|
|
87
197
|
name,
|
|
88
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
198
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
89
199
|
Select,
|
|
90
200
|
{
|
|
91
201
|
selectionMode,
|
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SelectField
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-CKJ5U5Q4.mjs";
|
|
5
|
+
import "../../../../chunk-UQAG7TKJ.mjs";
|
|
6
6
|
import "../../../../chunk-DUQFM3QS.mjs";
|
|
7
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-KTWHCUYV.mjs";
|
|
8
8
|
import "../../../../chunk-LLP2PTPK.mjs";
|
|
9
9
|
import "../../../../chunk-E5QSNLSR.mjs";
|
|
10
10
|
import "../../../../chunk-N3EAW6UO.mjs";
|
|
11
11
|
import "../../../../chunk-5HK7HRTR.mjs";
|
|
12
12
|
import "../../../../chunk-HJUZTISD.mjs";
|
|
13
13
|
import "../../../../chunk-V3KKDSQP.mjs";
|
|
14
|
-
import "../../../../chunk-
|
|
15
|
-
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
16
|
-
import "../../../../chunk-V2G5QHZZ.mjs";
|
|
14
|
+
import "../../../../chunk-46SKVFMZ.mjs";
|
|
17
15
|
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
18
|
-
import "../../../../chunk-
|
|
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";
|
|
19
24
|
import "../../../../chunk-RRA7GWP2.mjs";
|
|
20
|
-
import "../../../../chunk-2SNKT7I4.mjs";
|
|
21
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";
|
|
22
30
|
import "../../../../chunk-WYJW5NNA.mjs";
|
|
23
31
|
import "../../../../chunk-C3MURCMZ.mjs";
|
|
24
|
-
import "../../../../chunk-V2HNFTTX.mjs";
|
|
25
|
-
import "../../../../chunk-IAJ6G633.mjs";
|
|
26
|
-
import "../../../../chunk-UUKS7JYX.mjs";
|
|
27
32
|
import "../../../../chunk-C4PCTOGM.mjs";
|
|
28
33
|
import "../../../../chunk-N3QOXWJI.mjs";
|
|
34
|
+
import "../../../../chunk-TUIN5YJW.mjs";
|
|
29
35
|
export {
|
|
30
36
|
SelectField
|
|
31
37
|
};
|
|
@@ -2,30 +2,36 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SwitchField
|
|
4
4
|
} from "../../../../chunk-EC3NSPHR.mjs";
|
|
5
|
-
import "../../../../chunk-
|
|
5
|
+
import "../../../../chunk-UQAG7TKJ.mjs";
|
|
6
6
|
import "../../../../chunk-DUQFM3QS.mjs";
|
|
7
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-KTWHCUYV.mjs";
|
|
8
8
|
import "../../../../chunk-LLP2PTPK.mjs";
|
|
9
9
|
import "../../../../chunk-E5QSNLSR.mjs";
|
|
10
10
|
import "../../../../chunk-N3EAW6UO.mjs";
|
|
11
11
|
import "../../../../chunk-5HK7HRTR.mjs";
|
|
12
12
|
import "../../../../chunk-HJUZTISD.mjs";
|
|
13
13
|
import "../../../../chunk-V3KKDSQP.mjs";
|
|
14
|
-
import "../../../../chunk-
|
|
15
|
-
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
16
|
-
import "../../../../chunk-V2G5QHZZ.mjs";
|
|
14
|
+
import "../../../../chunk-46SKVFMZ.mjs";
|
|
17
15
|
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
18
|
-
import "../../../../chunk-
|
|
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";
|
|
19
24
|
import "../../../../chunk-RRA7GWP2.mjs";
|
|
20
|
-
import "../../../../chunk-2SNKT7I4.mjs";
|
|
21
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";
|
|
22
30
|
import "../../../../chunk-WYJW5NNA.mjs";
|
|
23
31
|
import "../../../../chunk-C3MURCMZ.mjs";
|
|
24
|
-
import "../../../../chunk-V2HNFTTX.mjs";
|
|
25
|
-
import "../../../../chunk-IAJ6G633.mjs";
|
|
26
|
-
import "../../../../chunk-UUKS7JYX.mjs";
|
|
27
32
|
import "../../../../chunk-C4PCTOGM.mjs";
|
|
28
33
|
import "../../../../chunk-N3QOXWJI.mjs";
|
|
34
|
+
import "../../../../chunk-TUIN5YJW.mjs";
|
|
29
35
|
export {
|
|
30
36
|
SwitchField
|
|
31
37
|
};
|
|
@@ -37,32 +37,169 @@ module.exports = __toCommonJS(text_field_exports);
|
|
|
37
37
|
var import_react_hook_form = require("react-hook-form");
|
|
38
38
|
|
|
39
39
|
// src/ui/inputs/input/input.tsx
|
|
40
|
-
var
|
|
40
|
+
var import_react3 = __toESM(require("react"));
|
|
41
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");
|
|
42
48
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
-
var
|
|
44
|
-
|
|
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
|
+
}
|
|
45
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
|
+
);
|
|
46
183
|
Input.displayName = "TeachInUI.Input";
|
|
47
184
|
|
|
48
185
|
// src/ui/inputs/text/text.tsx
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var Text =
|
|
52
|
-
return /* @__PURE__ */ (0,
|
|
186
|
+
var import_react4 = __toESM(require("react"));
|
|
187
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
188
|
+
var Text = import_react4.default.forwardRef(({ ...props }, ref) => {
|
|
189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Input, { ref, type: "text", ...props });
|
|
53
190
|
});
|
|
54
191
|
Text.displayName = "TeachInUI.Text";
|
|
55
192
|
|
|
56
193
|
// src/ui/form/rhf/fields/text-field.tsx
|
|
57
|
-
var
|
|
194
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
58
195
|
function TextField({ name, ...props }) {
|
|
59
196
|
const { control } = (0, import_react_hook_form.useFormContext)();
|
|
60
|
-
return /* @__PURE__ */ (0,
|
|
197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
61
198
|
import_react_hook_form.Controller,
|
|
62
199
|
{
|
|
63
200
|
control,
|
|
64
201
|
name,
|
|
65
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
202
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
|
|
66
203
|
}
|
|
67
204
|
);
|
|
68
205
|
}
|
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
TextField
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-IU2JYI7W.mjs";
|
|
5
|
+
import "../../../../chunk-UQAG7TKJ.mjs";
|
|
6
6
|
import "../../../../chunk-DUQFM3QS.mjs";
|
|
7
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-KTWHCUYV.mjs";
|
|
8
8
|
import "../../../../chunk-LLP2PTPK.mjs";
|
|
9
9
|
import "../../../../chunk-E5QSNLSR.mjs";
|
|
10
10
|
import "../../../../chunk-N3EAW6UO.mjs";
|
|
11
11
|
import "../../../../chunk-5HK7HRTR.mjs";
|
|
12
12
|
import "../../../../chunk-HJUZTISD.mjs";
|
|
13
13
|
import "../../../../chunk-V3KKDSQP.mjs";
|
|
14
|
-
import "../../../../chunk-
|
|
15
|
-
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
16
|
-
import "../../../../chunk-V2G5QHZZ.mjs";
|
|
14
|
+
import "../../../../chunk-46SKVFMZ.mjs";
|
|
17
15
|
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
18
|
-
import "../../../../chunk-
|
|
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";
|
|
19
24
|
import "../../../../chunk-RRA7GWP2.mjs";
|
|
20
|
-
import "../../../../chunk-2SNKT7I4.mjs";
|
|
21
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";
|
|
22
30
|
import "../../../../chunk-WYJW5NNA.mjs";
|
|
23
31
|
import "../../../../chunk-C3MURCMZ.mjs";
|
|
24
|
-
import "../../../../chunk-V2HNFTTX.mjs";
|
|
25
|
-
import "../../../../chunk-IAJ6G633.mjs";
|
|
26
|
-
import "../../../../chunk-UUKS7JYX.mjs";
|
|
27
32
|
import "../../../../chunk-C4PCTOGM.mjs";
|
|
28
33
|
import "../../../../chunk-N3QOXWJI.mjs";
|
|
34
|
+
import "../../../../chunk-TUIN5YJW.mjs";
|
|
29
35
|
export {
|
|
30
36
|
TextField
|
|
31
37
|
};
|
|
@@ -2,30 +2,36 @@
|
|
|
2
2
|
import {
|
|
3
3
|
TextareaField
|
|
4
4
|
} from "../../../../chunk-V4HKGJYK.mjs";
|
|
5
|
-
import "../../../../chunk-
|
|
5
|
+
import "../../../../chunk-UQAG7TKJ.mjs";
|
|
6
6
|
import "../../../../chunk-DUQFM3QS.mjs";
|
|
7
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-KTWHCUYV.mjs";
|
|
8
8
|
import "../../../../chunk-LLP2PTPK.mjs";
|
|
9
9
|
import "../../../../chunk-E5QSNLSR.mjs";
|
|
10
10
|
import "../../../../chunk-N3EAW6UO.mjs";
|
|
11
11
|
import "../../../../chunk-5HK7HRTR.mjs";
|
|
12
12
|
import "../../../../chunk-HJUZTISD.mjs";
|
|
13
13
|
import "../../../../chunk-V3KKDSQP.mjs";
|
|
14
|
-
import "../../../../chunk-
|
|
15
|
-
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
16
|
-
import "../../../../chunk-V2G5QHZZ.mjs";
|
|
14
|
+
import "../../../../chunk-46SKVFMZ.mjs";
|
|
17
15
|
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
18
|
-
import "../../../../chunk-
|
|
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";
|
|
19
24
|
import "../../../../chunk-RRA7GWP2.mjs";
|
|
20
|
-
import "../../../../chunk-2SNKT7I4.mjs";
|
|
21
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";
|
|
22
30
|
import "../../../../chunk-WYJW5NNA.mjs";
|
|
23
31
|
import "../../../../chunk-C3MURCMZ.mjs";
|
|
24
|
-
import "../../../../chunk-V2HNFTTX.mjs";
|
|
25
|
-
import "../../../../chunk-IAJ6G633.mjs";
|
|
26
|
-
import "../../../../chunk-UUKS7JYX.mjs";
|
|
27
32
|
import "../../../../chunk-C4PCTOGM.mjs";
|
|
28
33
|
import "../../../../chunk-N3QOXWJI.mjs";
|
|
34
|
+
import "../../../../chunk-TUIN5YJW.mjs";
|
|
29
35
|
export {
|
|
30
36
|
TextareaField
|
|
31
37
|
};
|