@teach-in/react 0.2.0 → 0.4.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/dist/chunk-2SNKT7I4.mjs +9 -0
- package/dist/chunk-3YOW5DEZ.mjs +45 -0
- package/dist/chunk-4N3FFVKQ.mjs +14 -0
- package/dist/{chunk-PFLROV3C.mjs → chunk-544SDU73.mjs} +2 -2
- package/dist/chunk-7BTEKEON.mjs +11 -0
- package/dist/{chunk-X7ER4IDJ.mjs → chunk-AFVGHUW2.mjs} +2 -2
- package/dist/chunk-C4PCTOGM.mjs +12 -0
- package/dist/chunk-CA2EAK5M.mjs +40 -0
- package/dist/chunk-E5QSNLSR.mjs +38 -0
- package/dist/chunk-EEGPGLDC.mjs +26 -0
- package/dist/chunk-FKHR6G3R.mjs +1 -0
- package/dist/chunk-FQUYFYMS.mjs +24 -0
- package/dist/chunk-ICRO6HS3.mjs +1 -0
- package/dist/chunk-J3GK2CGQ.mjs +1 -0
- package/dist/chunk-JTPBZJ4S.mjs +14 -0
- package/dist/chunk-L6XIUULU.mjs +14 -0
- package/dist/chunk-LLP2PTPK.mjs +1 -0
- package/dist/{chunk-6UIBJVXP.mjs → chunk-MCZBJUTN.mjs} +1 -1
- package/dist/chunk-MJTSZFLC.mjs +1 -0
- package/dist/{chunk-WTXPB253.mjs → chunk-N3QOXWJI.mjs} +1 -1
- package/dist/chunk-N7GOJBLM.mjs +1 -0
- package/dist/{chunk-GEJLG5RP.mjs → chunk-NLHQDWUK.mjs} +3 -2
- package/dist/chunk-NOXFF2KJ.mjs +16 -0
- package/dist/chunk-NVLF7L4R.mjs +1 -0
- package/dist/chunk-OZSO3C5Q.mjs +14 -0
- package/dist/chunk-PKZZEODR.mjs +29 -0
- package/dist/chunk-PSK7I7V4.mjs +30 -0
- package/dist/chunk-Q2ILWL7L.mjs +1 -0
- package/dist/chunk-Q6JSJOU4.mjs +1 -0
- package/dist/chunk-QUMDPADZ.mjs +14 -0
- package/dist/chunk-RRA7GWP2.mjs +1 -0
- package/dist/chunk-SAYYLTIE.mjs +52 -0
- package/dist/chunk-TSD6GU35.mjs +16 -0
- package/dist/chunk-U4FAPNVK.mjs +1 -0
- package/dist/chunk-UFYLYN5Z.mjs +37 -0
- package/dist/chunk-UNBE67YJ.mjs +1 -0
- package/dist/chunk-UON5ACST.mjs +1 -0
- package/dist/chunk-UT5RUCAT.mjs +1 -0
- package/dist/chunk-UUKS7JYX.mjs +1 -0
- package/dist/chunk-VWGY6KWP.mjs +15 -0
- package/dist/chunk-W2A6C27Y.mjs +35 -0
- package/dist/{chunk-545OBZ4O.mjs → chunk-WFNNN6WU.mjs} +1 -1
- package/dist/chunk-XHCXM5MU.mjs +14 -0
- package/dist/chunk-YNCISHAU.mjs +27 -0
- package/dist/chunk-ZSYIKEXW.mjs +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +606 -193
- package/dist/index.mjs +261 -112
- package/dist/ui/data/image/image.d.ts +6 -0
- package/dist/ui/data/image/image.js +47 -0
- package/dist/ui/data/image/image.mjs +7 -0
- package/dist/ui/data/image/index.d.ts +1 -0
- package/dist/ui/data/image/index.js +49 -0
- package/dist/ui/data/image/index.mjs +8 -0
- package/dist/ui/data/index.d.ts +3 -0
- package/dist/ui/data/index.js +48 -2
- package/dist/ui/data/index.mjs +32 -5
- package/dist/ui/data/table/index.d.ts +1 -0
- package/dist/ui/data/table/index.js +52 -0
- package/dist/ui/data/table/index.mjs +20 -0
- package/dist/ui/data/table/table.d.ts +23 -0
- package/dist/ui/data/table/table.js +50 -0
- package/dist/ui/data/table/table.mjs +19 -0
- package/dist/ui/data/user/index.d.ts +1 -0
- package/dist/ui/data/user/index.js +49 -0
- package/dist/ui/data/user/index.mjs +8 -0
- package/dist/ui/data/user/user.d.ts +6 -0
- package/dist/ui/data/user/user.js +47 -0
- package/dist/ui/data/user/user.mjs +7 -0
- package/dist/ui/feedback/chip/chip.js +18 -1
- package/dist/ui/feedback/chip/chip.mjs +3 -1
- package/dist/ui/feedback/chip/index.js +18 -1
- package/dist/ui/feedback/chip/index.mjs +3 -1
- package/dist/ui/feedback/index.d.ts +2 -0
- package/dist/ui/feedback/index.js +85 -11
- package/dist/ui/feedback/index.mjs +32 -3
- package/dist/ui/feedback/progress/circular-progress.d.ts +9 -0
- package/dist/ui/feedback/progress/circular-progress.js +47 -0
- package/dist/ui/feedback/progress/circular-progress.mjs +7 -0
- package/dist/ui/feedback/progress/index.d.ts +2 -0
- package/dist/ui/feedback/progress/index.js +60 -0
- package/dist/ui/feedback/progress/index.mjs +12 -0
- package/dist/ui/feedback/progress/progress.d.ts +9 -0
- package/dist/ui/feedback/progress/progress.js +47 -0
- package/dist/ui/feedback/progress/progress.mjs +7 -0
- package/dist/ui/feedback/toast/index.d.ts +1 -0
- package/dist/ui/feedback/toast/index.js +73 -0
- package/dist/ui/feedback/toast/index.mjs +21 -0
- package/dist/ui/feedback/toast/toast.d.ts +17 -0
- package/dist/ui/feedback/toast/toast.js +71 -0
- package/dist/ui/feedback/toast/toast.mjs +21 -0
- package/dist/ui/form/index.js +106 -53
- package/dist/ui/form/index.mjs +30 -21
- package/dist/ui/form/rhf/fields/autocomplete-field.mjs +13 -8
- package/dist/ui/form/rhf/fields/checkbox-field.js +1 -1
- package/dist/ui/form/rhf/fields/checkbox-field.mjs +14 -9
- package/dist/ui/form/rhf/fields/date-picker-field.mjs +13 -8
- package/dist/ui/form/rhf/fields/email-field.mjs +13 -8
- package/dist/ui/form/rhf/fields/index.d.ts +1 -0
- package/dist/ui/form/rhf/fields/index.js +102 -49
- package/dist/ui/form/rhf/fields/index.mjs +28 -19
- package/dist/ui/form/rhf/fields/input-field.mjs +13 -8
- package/dist/ui/form/rhf/fields/radio-field.d.ts +10 -0
- package/dist/ui/form/rhf/fields/radio-field.js +78 -0
- package/dist/ui/form/rhf/fields/radio-field.mjs +31 -0
- package/dist/ui/form/rhf/fields/select-field.d.ts +8 -3
- package/dist/ui/form/rhf/fields/select-field.js +23 -10
- package/dist/ui/form/rhf/fields/select-field.mjs +14 -9
- package/dist/ui/form/rhf/fields/switch-field.mjs +13 -8
- package/dist/ui/form/rhf/fields/text-field.mjs +13 -8
- package/dist/ui/form/rhf/fields/textarea-field.mjs +13 -8
- package/dist/ui/form/rhf/index.js +102 -49
- package/dist/ui/form/rhf/index.mjs +28 -19
- package/dist/ui/format/index.mjs +9 -9
- package/dist/ui/index.js +604 -193
- package/dist/ui/index.mjs +258 -112
- package/dist/ui/inputs/checkbox/checkbox-group.d.ts +9 -0
- package/dist/ui/inputs/checkbox/checkbox-group.js +45 -0
- package/dist/ui/inputs/checkbox/checkbox-group.mjs +7 -0
- package/dist/ui/inputs/checkbox/checkbox.js +1 -1
- package/dist/ui/inputs/checkbox/checkbox.mjs +1 -1
- package/dist/ui/inputs/checkbox/index.d.ts +1 -0
- package/dist/ui/inputs/checkbox/index.js +12 -3
- package/dist/ui/inputs/checkbox/index.mjs +7 -3
- package/dist/ui/inputs/index.d.ts +1 -0
- package/dist/ui/inputs/index.js +114 -39
- package/dist/ui/inputs/index.mjs +28 -11
- package/dist/ui/inputs/radio/index.d.ts +2 -0
- package/dist/ui/inputs/radio/index.js +57 -0
- package/dist/ui/inputs/radio/index.mjs +12 -0
- package/dist/ui/inputs/radio/radio-group.d.ts +9 -0
- package/dist/ui/inputs/radio/radio-group.js +49 -0
- package/dist/ui/inputs/radio/radio-group.mjs +7 -0
- package/dist/ui/inputs/radio/radio.d.ts +6 -0
- package/dist/ui/inputs/radio/radio.js +32 -0
- package/dist/ui/inputs/radio/radio.mjs +7 -0
- package/dist/ui/inputs/select/index.js +21 -9
- package/dist/ui/inputs/select/index.mjs +1 -1
- package/dist/ui/inputs/select/select.d.ts +18 -5
- package/dist/ui/inputs/select/select.js +21 -9
- package/dist/ui/inputs/select/select.mjs +1 -1
- package/dist/ui/inputs/switch/favorite-switch.d.ts +6 -0
- package/dist/ui/inputs/switch/favorite-switch.js +62 -0
- package/dist/ui/inputs/switch/favorite-switch.mjs +8 -0
- package/dist/ui/inputs/switch/index.d.ts +1 -0
- package/dist/ui/inputs/switch/index.js +35 -0
- package/dist/ui/inputs/switch/index.mjs +5 -1
- package/dist/ui/layout/accordion/accordion.d.ts +10 -0
- package/dist/ui/layout/accordion/accordion.js +35 -0
- package/dist/ui/layout/accordion/accordion.mjs +9 -0
- package/dist/ui/layout/accordion/index.d.ts +1 -0
- package/dist/ui/layout/accordion/index.js +37 -0
- package/dist/ui/layout/accordion/index.mjs +10 -0
- package/dist/ui/layout/container/container.mjs +99 -63
- package/dist/ui/layout/container/index.mjs +99 -63
- package/dist/ui/layout/divider/divider.d.ts +6 -0
- package/dist/ui/layout/divider/divider.js +48 -0
- package/dist/ui/layout/divider/divider.mjs +7 -0
- package/dist/ui/layout/divider/index.d.ts +1 -0
- package/dist/ui/layout/divider/index.js +50 -0
- package/dist/ui/layout/divider/index.mjs +8 -0
- package/dist/ui/layout/index.d.ts +3 -0
- package/dist/ui/layout/index.js +32 -0
- package/dist/ui/layout/index.mjs +113 -66
- package/dist/ui/layout/page/index.mjs +11 -5
- package/dist/ui/layout/page/page-loading.mjs +8 -2
- package/dist/ui/layout/page/section-loading.mjs +8 -2
- package/dist/ui/layout/scroll-shadow/index.d.ts +1 -0
- package/dist/ui/layout/scroll-shadow/index.js +49 -0
- package/dist/ui/layout/scroll-shadow/index.mjs +8 -0
- package/dist/ui/layout/scroll-shadow/scroll-shadow.d.ts +9 -0
- package/dist/ui/layout/scroll-shadow/scroll-shadow.js +47 -0
- package/dist/ui/layout/scroll-shadow/scroll-shadow.mjs +7 -0
- package/dist/ui/navigation/breadcrumbs/breadcrumbs.d.ts +10 -0
- package/dist/ui/navigation/breadcrumbs/breadcrumbs.js +37 -0
- package/dist/ui/navigation/breadcrumbs/breadcrumbs.mjs +9 -0
- package/dist/ui/navigation/breadcrumbs/index.d.ts +1 -0
- package/dist/ui/navigation/breadcrumbs/index.js +39 -0
- package/dist/ui/navigation/breadcrumbs/index.mjs +10 -0
- package/dist/ui/navigation/index.d.ts +3 -0
- package/dist/ui/navigation/index.js +88 -2
- package/dist/ui/navigation/index.mjs +31 -2
- package/dist/ui/navigation/navbar/index.d.ts +1 -0
- package/dist/ui/navigation/navbar/index.js +85 -0
- package/dist/ui/navigation/navbar/index.mjs +20 -0
- package/dist/ui/navigation/navbar/navbar.d.ts +26 -0
- package/dist/ui/navigation/navbar/navbar.js +83 -0
- package/dist/ui/navigation/navbar/navbar.mjs +19 -0
- package/dist/ui/navigation/tabs/index.d.ts +1 -0
- package/dist/ui/navigation/tabs/index.js +56 -0
- package/dist/ui/navigation/tabs/index.mjs +8 -0
- package/dist/ui/navigation/tabs/tabs.d.ts +7 -0
- package/dist/ui/navigation/tabs/tabs.js +54 -0
- package/dist/ui/navigation/tabs/tabs.mjs +7 -0
- package/dist/ui/overlays/dropdown/dropdown.d.ts +28 -0
- package/dist/ui/overlays/dropdown/dropdown.js +48 -0
- package/dist/ui/overlays/dropdown/dropdown.mjs +15 -0
- package/dist/ui/overlays/dropdown/index.d.ts +1 -0
- package/dist/ui/overlays/dropdown/index.js +50 -0
- package/dist/ui/overlays/dropdown/index.mjs +16 -0
- package/dist/ui/overlays/index.d.ts +2 -0
- package/dist/ui/overlays/index.js +47 -2
- package/dist/ui/overlays/index.mjs +20 -2
- package/dist/ui/overlays/popover/index.d.ts +1 -0
- package/dist/ui/overlays/popover/index.js +51 -0
- package/dist/ui/overlays/popover/index.mjs +8 -0
- package/dist/ui/overlays/popover/popover.d.ts +10 -0
- package/dist/ui/overlays/popover/popover.js +49 -0
- package/dist/ui/overlays/popover/popover.mjs +7 -0
- package/dist/ui/provider/index.js +31 -2
- package/dist/ui/provider/index.mjs +16 -1
- package/dist/ui/provider/ui-provider.d.ts +3 -1
- package/dist/ui/provider/ui-provider.js +31 -2
- package/dist/ui/provider/ui-provider.mjs +16 -1
- package/dist/ui/surface/card/card.d.ts +36 -0
- package/dist/ui/surface/card/card.js +65 -0
- package/dist/ui/surface/card/card.mjs +7 -0
- package/dist/ui/surface/card/index.d.ts +1 -0
- package/dist/ui/surface/card/index.js +67 -0
- package/dist/ui/surface/card/index.mjs +8 -0
- package/dist/ui/surface/index.d.ts +1 -0
- package/dist/ui/surface/index.js +39 -0
- package/dist/ui/surface/index.mjs +6 -1
- package/dist/ui/theme/colors/common.mjs +5 -5
- package/dist/ui/theme/colors/index.js +1 -1
- package/dist/ui/theme/colors/index.mjs +7 -7
- package/dist/ui/theme/colors/semantic.js +1 -1
- package/dist/ui/theme/colors/semantic.mjs +6 -6
- package/dist/ui/theme/colors.js +1 -1
- package/dist/ui/theme/colors.mjs +7 -7
- package/dist/ui/theme/index.js +1 -1
- package/dist/ui/theme/index.mjs +8 -8
- package/dist/ui/theme/theme.js +1 -1
- package/dist/ui/theme/theme.mjs +8 -8
- package/dist/utils/extend-variants.d.ts +41 -0
- package/dist/utils/extend-variants.js +34 -0
- package/dist/utils/extend-variants.mjs +7 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +36 -0
- package/dist/utils/index.mjs +8 -0
- package/package.json +18 -3
- package/dist/chunk-6WK4W5LL.mjs +0 -17
- package/dist/chunk-GQ3LBZ2Q.mjs +0 -33
- package/dist/chunk-ONQIPN3G.mjs +0 -14
- package/dist/{chunk-54ZSBA6H.mjs → chunk-3C4DPNCD.mjs} +0 -0
- package/dist/{chunk-5EWHMXCP.mjs → chunk-54FA62HL.mjs} +0 -0
- package/dist/{chunk-5HUR2CNH.mjs → chunk-57JRJHSH.mjs} +0 -0
- package/dist/{chunk-NCM6KIQH.mjs → chunk-5WDV3PDI.mjs} +12 -12
- /package/dist/{chunk-IZ5KKF6P.mjs → chunk-773RYGHT.mjs} +0 -0
- /package/dist/{chunk-5YMUHF45.mjs → chunk-AR4IYKG5.mjs} +0 -0
- /package/dist/{chunk-CAJWTQDB.mjs → chunk-AT6DX4DN.mjs} +0 -0
- /package/dist/{chunk-JJHHWDZT.mjs → chunk-BGNMWHME.mjs} +0 -0
- /package/dist/{chunk-OEHJDT6R.mjs → chunk-CTKWGSNJ.mjs} +0 -0
- /package/dist/{chunk-UURZJWWV.mjs → chunk-CZEO3U25.mjs} +0 -0
- /package/dist/{chunk-WJXIRSSW.mjs → chunk-DRZAPJZH.mjs} +0 -0
|
@@ -36,6 +36,7 @@ __export(fields_exports, {
|
|
|
36
36
|
DatePickerField: () => DatePickerField,
|
|
37
37
|
EmailField: () => EmailField,
|
|
38
38
|
InputField: () => InputField,
|
|
39
|
+
RadioField: () => RadioField,
|
|
39
40
|
SelectField: () => SelectField,
|
|
40
41
|
SwitchField: () => SwitchField,
|
|
41
42
|
TextField: () => TextField,
|
|
@@ -63,7 +64,7 @@ var import_react2 = __toESM(require("react"));
|
|
|
63
64
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
64
65
|
var Checkbox = import_react2.default.forwardRef(
|
|
65
66
|
({ label, ...props }, ref) => {
|
|
66
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_checkbox.Checkbox, { ref,
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_checkbox.Checkbox, { ref, ...props, children: label });
|
|
67
68
|
}
|
|
68
69
|
);
|
|
69
70
|
Checkbox.displayName = "TeachInUI.Checkbox";
|
|
@@ -104,21 +105,33 @@ var import_react6 = __toESM(require("react"));
|
|
|
104
105
|
var import_select = require("@heroui/select");
|
|
105
106
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
106
107
|
var Select = import_react6.default.forwardRef(
|
|
107
|
-
({ value, items, onChange, ...props }, ref) => {
|
|
108
|
-
const
|
|
108
|
+
({ value, items, onChange, selectionMode, ...props }, ref) => {
|
|
109
|
+
const isMultiple = selectionMode === "multiple";
|
|
110
|
+
const selectedKeys = import_react6.default.useMemo(() => {
|
|
111
|
+
if (value == null) return /* @__PURE__ */ new Set();
|
|
112
|
+
return new Set(Array.isArray(value) ? value : [value]);
|
|
113
|
+
}, [value]);
|
|
114
|
+
const handleSelectionChange = import_react6.default.useCallback(
|
|
115
|
+
(keys) => {
|
|
116
|
+
var _a;
|
|
117
|
+
if (keys === "all") return;
|
|
118
|
+
const selected = Array.from(keys).filter((key) => typeof key === "string");
|
|
119
|
+
if (isMultiple) {
|
|
120
|
+
onChange == null ? void 0 : onChange(selected);
|
|
121
|
+
} else {
|
|
122
|
+
onChange == null ? void 0 : onChange((_a = selected[0]) != null ? _a : null);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
[onChange, isMultiple]
|
|
126
|
+
);
|
|
109
127
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
110
128
|
import_select.Select,
|
|
111
129
|
{
|
|
112
130
|
ref,
|
|
113
131
|
items,
|
|
114
|
-
placeholder: " ",
|
|
115
132
|
selectedKeys,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (typeof selected === "string") {
|
|
119
|
-
onChange == null ? void 0 : onChange(selected);
|
|
120
|
-
}
|
|
121
|
-
},
|
|
133
|
+
selectionMode,
|
|
134
|
+
onSelectionChange: handleSelectionChange,
|
|
122
135
|
...props,
|
|
123
136
|
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_select.SelectItem, { children: item.label }, item.key)
|
|
124
137
|
}
|
|
@@ -136,35 +149,46 @@ var Switch = import_react7.default.forwardRef(({ ...props }, ref) => {
|
|
|
136
149
|
});
|
|
137
150
|
Switch.displayName = "TeachInUI.Switch";
|
|
138
151
|
|
|
139
|
-
// src/ui/inputs/
|
|
152
|
+
// src/ui/inputs/radio/radio-group.tsx
|
|
140
153
|
var import_react8 = __toESM(require("react"));
|
|
154
|
+
var import_radio = require("@heroui/radio");
|
|
141
155
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
142
|
-
var
|
|
143
|
-
|
|
156
|
+
var RadioGroup = import_react8.default.forwardRef(
|
|
157
|
+
(props, ref) => {
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_radio.RadioGroup, { ref, ...props });
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
RadioGroup.displayName = "TeachInUI.RadioGroup";
|
|
162
|
+
|
|
163
|
+
// src/ui/inputs/text/text.tsx
|
|
164
|
+
var import_react9 = __toESM(require("react"));
|
|
165
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
166
|
+
var Text = import_react9.default.forwardRef(({ ...props }, ref) => {
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Input, { ref, type: "text", ...props });
|
|
144
168
|
});
|
|
145
169
|
Text.displayName = "TeachInUI.Text";
|
|
146
170
|
|
|
147
171
|
// src/ui/inputs/textarea/textarea.tsx
|
|
148
172
|
var import_input5 = require("@heroui/input");
|
|
149
|
-
var
|
|
150
|
-
var
|
|
151
|
-
var Textarea =
|
|
173
|
+
var import_react10 = __toESM(require("react"));
|
|
174
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
175
|
+
var Textarea = import_react10.default.forwardRef(
|
|
152
176
|
({ minRows = 4, ...props }, ref) => {
|
|
153
|
-
return /* @__PURE__ */ (0,
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_input5.Textarea, { ref, minRows, ...props });
|
|
154
178
|
}
|
|
155
179
|
);
|
|
156
180
|
Textarea.displayName = "TeachInUI.Textarea";
|
|
157
181
|
|
|
158
182
|
// src/ui/form/rhf/fields/input-field.tsx
|
|
159
|
-
var
|
|
183
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
160
184
|
function InputField({ name, ...props }) {
|
|
161
185
|
const { control } = (0, import_react_hook_form.useFormContext)();
|
|
162
|
-
return /* @__PURE__ */ (0,
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
163
187
|
import_react_hook_form.Controller,
|
|
164
188
|
{
|
|
165
189
|
control,
|
|
166
190
|
name,
|
|
167
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
191
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
|
|
168
192
|
}
|
|
169
193
|
);
|
|
170
194
|
}
|
|
@@ -172,15 +196,15 @@ InputField.displayName = "TeachInUI.InputField";
|
|
|
172
196
|
|
|
173
197
|
// src/ui/form/rhf/fields/text-field.tsx
|
|
174
198
|
var import_react_hook_form2 = require("react-hook-form");
|
|
175
|
-
var
|
|
199
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
176
200
|
function TextField({ name, ...props }) {
|
|
177
201
|
const { control } = (0, import_react_hook_form2.useFormContext)();
|
|
178
|
-
return /* @__PURE__ */ (0,
|
|
202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
179
203
|
import_react_hook_form2.Controller,
|
|
180
204
|
{
|
|
181
205
|
control,
|
|
182
206
|
name,
|
|
183
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
207
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
|
|
184
208
|
}
|
|
185
209
|
);
|
|
186
210
|
}
|
|
@@ -188,15 +212,15 @@ TextField.displayName = "TeachInUI.TextField";
|
|
|
188
212
|
|
|
189
213
|
// src/ui/form/rhf/fields/email-field.tsx
|
|
190
214
|
var import_react_hook_form3 = require("react-hook-form");
|
|
191
|
-
var
|
|
215
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
192
216
|
function EmailField({ name, ...props }) {
|
|
193
217
|
const { control } = (0, import_react_hook_form3.useFormContext)();
|
|
194
|
-
return /* @__PURE__ */ (0,
|
|
218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
195
219
|
import_react_hook_form3.Controller,
|
|
196
220
|
{
|
|
197
221
|
control,
|
|
198
222
|
name,
|
|
199
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
223
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Email, { ...props, ...field, ref, errorMessage: error == null ? void 0 : error.message, isInvalid: !!error })
|
|
200
224
|
}
|
|
201
225
|
);
|
|
202
226
|
}
|
|
@@ -204,15 +228,15 @@ EmailField.displayName = "TeachInUI.EmailField";
|
|
|
204
228
|
|
|
205
229
|
// src/ui/form/rhf/fields/textarea-field.tsx
|
|
206
230
|
var import_react_hook_form4 = require("react-hook-form");
|
|
207
|
-
var
|
|
231
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
208
232
|
function TextareaField({ name, ...props }) {
|
|
209
233
|
const { control } = (0, import_react_hook_form4.useFormContext)();
|
|
210
|
-
return /* @__PURE__ */ (0,
|
|
234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
211
235
|
import_react_hook_form4.Controller,
|
|
212
236
|
{
|
|
213
237
|
control,
|
|
214
238
|
name,
|
|
215
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
239
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
216
240
|
Textarea,
|
|
217
241
|
{
|
|
218
242
|
...props,
|
|
@@ -229,17 +253,18 @@ TextareaField.displayName = "TeachInUI.TextareaField";
|
|
|
229
253
|
|
|
230
254
|
// src/ui/form/rhf/fields/select-field.tsx
|
|
231
255
|
var import_react_hook_form5 = require("react-hook-form");
|
|
232
|
-
var
|
|
233
|
-
function SelectField({ name, ...props }) {
|
|
256
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
257
|
+
function SelectField({ name, selectionMode, ...props }) {
|
|
234
258
|
const { control } = (0, import_react_hook_form5.useFormContext)();
|
|
235
|
-
return /* @__PURE__ */ (0,
|
|
259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
236
260
|
import_react_hook_form5.Controller,
|
|
237
261
|
{
|
|
238
262
|
control,
|
|
239
263
|
name,
|
|
240
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
264
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
241
265
|
Select,
|
|
242
266
|
{
|
|
267
|
+
selectionMode,
|
|
243
268
|
value: field.value,
|
|
244
269
|
onChange: (value) => field.onChange(value),
|
|
245
270
|
...props,
|
|
@@ -254,15 +279,15 @@ SelectField.displayName = "TeachInUI.SelectField";
|
|
|
254
279
|
|
|
255
280
|
// src/ui/form/rhf/fields/autocomplete-field.tsx
|
|
256
281
|
var import_react_hook_form6 = require("react-hook-form");
|
|
257
|
-
var
|
|
282
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
258
283
|
function AutocompleteField({ name, ...props }) {
|
|
259
284
|
const { control } = (0, import_react_hook_form6.useFormContext)();
|
|
260
|
-
return /* @__PURE__ */ (0,
|
|
285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
261
286
|
import_react_hook_form6.Controller,
|
|
262
287
|
{
|
|
263
288
|
control,
|
|
264
289
|
name,
|
|
265
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
290
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
266
291
|
Autocomplete,
|
|
267
292
|
{
|
|
268
293
|
...props,
|
|
@@ -279,15 +304,15 @@ AutocompleteField.displayName = "TeachInUI.AutocompleteField";
|
|
|
279
304
|
|
|
280
305
|
// src/ui/form/rhf/fields/date-picker-field.tsx
|
|
281
306
|
var import_react_hook_form7 = require("react-hook-form");
|
|
282
|
-
var
|
|
307
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
283
308
|
function DatePickerField({ name, ...props }) {
|
|
284
309
|
const { control } = (0, import_react_hook_form7.useFormContext)();
|
|
285
|
-
return /* @__PURE__ */ (0,
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
286
311
|
import_react_hook_form7.Controller,
|
|
287
312
|
{
|
|
288
313
|
control,
|
|
289
314
|
name,
|
|
290
|
-
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
315
|
+
render: ({ field: { ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
291
316
|
DatePicker,
|
|
292
317
|
{
|
|
293
318
|
...props,
|
|
@@ -304,17 +329,17 @@ DatePickerField.displayName = "TeachInUI.DatePickerField";
|
|
|
304
329
|
|
|
305
330
|
// src/ui/form/rhf/fields/checkbox-field.tsx
|
|
306
331
|
var import_react_hook_form8 = require("react-hook-form");
|
|
307
|
-
var
|
|
332
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
308
333
|
function CheckboxField({ name, ...props }) {
|
|
309
334
|
const { control } = (0, import_react_hook_form8.useFormContext)();
|
|
310
|
-
return /* @__PURE__ */ (0,
|
|
335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
311
336
|
import_react_hook_form8.Controller,
|
|
312
337
|
{
|
|
313
338
|
control,
|
|
314
339
|
name,
|
|
315
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
316
|
-
/* @__PURE__ */ (0,
|
|
317
|
-
error && /* @__PURE__ */ (0,
|
|
340
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Checkbox, { ...props, isSelected: field.value, onValueChange: field.onChange }),
|
|
342
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-tiny text-danger", children: error.message })
|
|
318
343
|
] })
|
|
319
344
|
}
|
|
320
345
|
);
|
|
@@ -323,22 +348,49 @@ CheckboxField.displayName = "TeachInUI.CheckboxField";
|
|
|
323
348
|
|
|
324
349
|
// src/ui/form/rhf/fields/switch-field.tsx
|
|
325
350
|
var import_react_hook_form9 = require("react-hook-form");
|
|
326
|
-
var
|
|
351
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
327
352
|
function SwitchField({ name, ...props }) {
|
|
328
353
|
const { control } = (0, import_react_hook_form9.useFormContext)();
|
|
329
|
-
return /* @__PURE__ */ (0,
|
|
354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
330
355
|
import_react_hook_form9.Controller,
|
|
331
356
|
{
|
|
332
357
|
control,
|
|
333
358
|
name,
|
|
334
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0,
|
|
335
|
-
/* @__PURE__ */ (0,
|
|
336
|
-
error && /* @__PURE__ */ (0,
|
|
359
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Switch, { ...props, isSelected: field.value, onValueChange: field.onChange }),
|
|
361
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-tiny text-danger", children: error.message })
|
|
337
362
|
] })
|
|
338
363
|
}
|
|
339
364
|
);
|
|
340
365
|
}
|
|
341
366
|
SwitchField.displayName = "TeachInUI.SwitchField";
|
|
367
|
+
|
|
368
|
+
// src/ui/form/rhf/fields/radio-field.tsx
|
|
369
|
+
var import_react_hook_form10 = require("react-hook-form");
|
|
370
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
371
|
+
function RadioField({ name, ...props }) {
|
|
372
|
+
const { control } = (0, import_react_hook_form10.useFormContext)();
|
|
373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
374
|
+
import_react_hook_form10.Controller,
|
|
375
|
+
{
|
|
376
|
+
control,
|
|
377
|
+
name,
|
|
378
|
+
render: ({ field: { ref, value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
379
|
+
RadioGroup,
|
|
380
|
+
{
|
|
381
|
+
...props,
|
|
382
|
+
...field,
|
|
383
|
+
ref,
|
|
384
|
+
errorMessage: error == null ? void 0 : error.message,
|
|
385
|
+
isInvalid: !!error,
|
|
386
|
+
value,
|
|
387
|
+
onValueChange: onChange
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
RadioField.displayName = "TeachInUI.RadioField";
|
|
342
394
|
// Annotate the CommonJS export names for ESM import in node:
|
|
343
395
|
0 && (module.exports = {
|
|
344
396
|
AutocompleteField,
|
|
@@ -346,6 +398,7 @@ SwitchField.displayName = "TeachInUI.SwitchField";
|
|
|
346
398
|
DatePickerField,
|
|
347
399
|
EmailField,
|
|
348
400
|
InputField,
|
|
401
|
+
RadioField,
|
|
349
402
|
SelectField,
|
|
350
403
|
SwitchField,
|
|
351
404
|
TextField,
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../../../../chunk-
|
|
2
|
+
import "../../../../chunk-Q6JSJOU4.mjs";
|
|
3
|
+
import {
|
|
4
|
+
InputField
|
|
5
|
+
} from "../../../../chunk-JDFRAN4S.mjs";
|
|
6
|
+
import {
|
|
7
|
+
RadioField
|
|
8
|
+
} from "../../../../chunk-W2A6C27Y.mjs";
|
|
9
|
+
import {
|
|
10
|
+
SelectField
|
|
11
|
+
} from "../../../../chunk-NLHQDWUK.mjs";
|
|
12
|
+
import {
|
|
13
|
+
SwitchField
|
|
14
|
+
} from "../../../../chunk-EC3NSPHR.mjs";
|
|
3
15
|
import {
|
|
4
16
|
TextField
|
|
5
17
|
} from "../../../../chunk-CETCW7DS.mjs";
|
|
@@ -11,29 +23,24 @@ import {
|
|
|
11
23
|
} from "../../../../chunk-S3ET5HKP.mjs";
|
|
12
24
|
import {
|
|
13
25
|
CheckboxField
|
|
14
|
-
} from "../../../../chunk-
|
|
26
|
+
} from "../../../../chunk-MCZBJUTN.mjs";
|
|
15
27
|
import {
|
|
16
28
|
DatePickerField
|
|
17
29
|
} from "../../../../chunk-7GHK5XYK.mjs";
|
|
18
30
|
import {
|
|
19
31
|
EmailField
|
|
20
32
|
} from "../../../../chunk-R7LDL5CU.mjs";
|
|
21
|
-
import
|
|
22
|
-
InputField
|
|
23
|
-
} from "../../../../chunk-JDFRAN4S.mjs";
|
|
24
|
-
import {
|
|
25
|
-
SelectField
|
|
26
|
-
} from "../../../../chunk-GEJLG5RP.mjs";
|
|
27
|
-
import {
|
|
28
|
-
SwitchField
|
|
29
|
-
} from "../../../../chunk-EC3NSPHR.mjs";
|
|
30
|
-
import "../../../../chunk-5YMUHF45.mjs";
|
|
31
|
-
import "../../../../chunk-5HK7HRTR.mjs";
|
|
32
|
-
import "../../../../chunk-HJUZTISD.mjs";
|
|
33
|
-
import "../../../../chunk-5EWHMXCP.mjs";
|
|
34
|
-
import "../../../../chunk-N3EAW6UO.mjs";
|
|
33
|
+
import "../../../../chunk-CZEO3U25.mjs";
|
|
35
34
|
import "../../../../chunk-DUQFM3QS.mjs";
|
|
36
35
|
import "../../../../chunk-KTUGFQWJ.mjs";
|
|
36
|
+
import "../../../../chunk-RRA7GWP2.mjs";
|
|
37
|
+
import "../../../../chunk-NOXFF2KJ.mjs";
|
|
38
|
+
import "../../../../chunk-2SNKT7I4.mjs";
|
|
39
|
+
import "../../../../chunk-LLP2PTPK.mjs";
|
|
40
|
+
import "../../../../chunk-E5QSNLSR.mjs";
|
|
41
|
+
import "../../../../chunk-N3EAW6UO.mjs";
|
|
42
|
+
import "../../../../chunk-5HK7HRTR.mjs";
|
|
43
|
+
import "../../../../chunk-HJUZTISD.mjs";
|
|
37
44
|
import "../../../../chunk-V2HNFTTX.mjs";
|
|
38
45
|
import "../../../../chunk-IAJ6G633.mjs";
|
|
39
46
|
import "../../../../chunk-V3KKDSQP.mjs";
|
|
@@ -41,17 +48,19 @@ import "../../../../chunk-LJIVY6GU.mjs";
|
|
|
41
48
|
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
42
49
|
import "../../../../chunk-V2G5QHZZ.mjs";
|
|
43
50
|
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
44
|
-
import "../../../../chunk-
|
|
51
|
+
import "../../../../chunk-3YOW5DEZ.mjs";
|
|
45
52
|
import "../../../../chunk-WYJW5NNA.mjs";
|
|
46
53
|
import "../../../../chunk-C3MURCMZ.mjs";
|
|
47
|
-
import "../../../../chunk-
|
|
48
|
-
import "../../../../chunk-
|
|
54
|
+
import "../../../../chunk-UUKS7JYX.mjs";
|
|
55
|
+
import "../../../../chunk-C4PCTOGM.mjs";
|
|
56
|
+
import "../../../../chunk-N3QOXWJI.mjs";
|
|
49
57
|
export {
|
|
50
58
|
AutocompleteField,
|
|
51
59
|
CheckboxField,
|
|
52
60
|
DatePickerField,
|
|
53
61
|
EmailField,
|
|
54
62
|
InputField,
|
|
63
|
+
RadioField,
|
|
55
64
|
SelectField,
|
|
56
65
|
SwitchField,
|
|
57
66
|
TextField,
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
InputField
|
|
4
4
|
} from "../../../../chunk-JDFRAN4S.mjs";
|
|
5
|
-
import "../../../../chunk-
|
|
6
|
-
import "../../../../chunk-5HK7HRTR.mjs";
|
|
7
|
-
import "../../../../chunk-HJUZTISD.mjs";
|
|
8
|
-
import "../../../../chunk-5EWHMXCP.mjs";
|
|
9
|
-
import "../../../../chunk-N3EAW6UO.mjs";
|
|
5
|
+
import "../../../../chunk-CZEO3U25.mjs";
|
|
10
6
|
import "../../../../chunk-DUQFM3QS.mjs";
|
|
11
7
|
import "../../../../chunk-KTUGFQWJ.mjs";
|
|
8
|
+
import "../../../../chunk-RRA7GWP2.mjs";
|
|
9
|
+
import "../../../../chunk-NOXFF2KJ.mjs";
|
|
10
|
+
import "../../../../chunk-2SNKT7I4.mjs";
|
|
11
|
+
import "../../../../chunk-LLP2PTPK.mjs";
|
|
12
|
+
import "../../../../chunk-E5QSNLSR.mjs";
|
|
13
|
+
import "../../../../chunk-N3EAW6UO.mjs";
|
|
14
|
+
import "../../../../chunk-5HK7HRTR.mjs";
|
|
15
|
+
import "../../../../chunk-HJUZTISD.mjs";
|
|
12
16
|
import "../../../../chunk-V2HNFTTX.mjs";
|
|
13
17
|
import "../../../../chunk-IAJ6G633.mjs";
|
|
14
18
|
import "../../../../chunk-V3KKDSQP.mjs";
|
|
@@ -16,11 +20,12 @@ import "../../../../chunk-LJIVY6GU.mjs";
|
|
|
16
20
|
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
17
21
|
import "../../../../chunk-V2G5QHZZ.mjs";
|
|
18
22
|
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
19
|
-
import "../../../../chunk-
|
|
23
|
+
import "../../../../chunk-3YOW5DEZ.mjs";
|
|
20
24
|
import "../../../../chunk-WYJW5NNA.mjs";
|
|
21
25
|
import "../../../../chunk-C3MURCMZ.mjs";
|
|
22
|
-
import "../../../../chunk-
|
|
23
|
-
import "../../../../chunk-
|
|
26
|
+
import "../../../../chunk-UUKS7JYX.mjs";
|
|
27
|
+
import "../../../../chunk-C4PCTOGM.mjs";
|
|
28
|
+
import "../../../../chunk-N3QOXWJI.mjs";
|
|
24
29
|
export {
|
|
25
30
|
InputField
|
|
26
31
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RadioGroupProps } from "../../../inputs";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface Props extends Omit<RadioGroupProps, "name" | "value" | "defaultValue" | "onValueChange"> {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function RadioField({ name, ...props }: Props): React.JSX.Element;
|
|
7
|
+
export declare namespace RadioField {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
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/radio-field.tsx
|
|
32
|
+
var radio_field_exports = {};
|
|
33
|
+
__export(radio_field_exports, {
|
|
34
|
+
RadioField: () => RadioField
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(radio_field_exports);
|
|
37
|
+
var import_react_hook_form = require("react-hook-form");
|
|
38
|
+
|
|
39
|
+
// src/ui/inputs/radio/radio-group.tsx
|
|
40
|
+
var import_react = __toESM(require("react"));
|
|
41
|
+
var import_radio = require("@heroui/radio");
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var RadioGroup = import_react.default.forwardRef(
|
|
44
|
+
(props, ref) => {
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radio.RadioGroup, { ref, ...props });
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
RadioGroup.displayName = "TeachInUI.RadioGroup";
|
|
49
|
+
|
|
50
|
+
// src/ui/form/rhf/fields/radio-field.tsx
|
|
51
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
52
|
+
function RadioField({ name, ...props }) {
|
|
53
|
+
const { control } = (0, import_react_hook_form.useFormContext)();
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
55
|
+
import_react_hook_form.Controller,
|
|
56
|
+
{
|
|
57
|
+
control,
|
|
58
|
+
name,
|
|
59
|
+
render: ({ field: { ref, value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
60
|
+
RadioGroup,
|
|
61
|
+
{
|
|
62
|
+
...props,
|
|
63
|
+
...field,
|
|
64
|
+
ref,
|
|
65
|
+
errorMessage: error == null ? void 0 : error.message,
|
|
66
|
+
isInvalid: !!error,
|
|
67
|
+
value,
|
|
68
|
+
onValueChange: onChange
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
RadioField.displayName = "TeachInUI.RadioField";
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
RadioField
|
|
78
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
RadioField
|
|
4
|
+
} from "../../../../chunk-W2A6C27Y.mjs";
|
|
5
|
+
import "../../../../chunk-CZEO3U25.mjs";
|
|
6
|
+
import "../../../../chunk-DUQFM3QS.mjs";
|
|
7
|
+
import "../../../../chunk-KTUGFQWJ.mjs";
|
|
8
|
+
import "../../../../chunk-RRA7GWP2.mjs";
|
|
9
|
+
import "../../../../chunk-NOXFF2KJ.mjs";
|
|
10
|
+
import "../../../../chunk-2SNKT7I4.mjs";
|
|
11
|
+
import "../../../../chunk-LLP2PTPK.mjs";
|
|
12
|
+
import "../../../../chunk-E5QSNLSR.mjs";
|
|
13
|
+
import "../../../../chunk-N3EAW6UO.mjs";
|
|
14
|
+
import "../../../../chunk-5HK7HRTR.mjs";
|
|
15
|
+
import "../../../../chunk-HJUZTISD.mjs";
|
|
16
|
+
import "../../../../chunk-V2HNFTTX.mjs";
|
|
17
|
+
import "../../../../chunk-IAJ6G633.mjs";
|
|
18
|
+
import "../../../../chunk-V3KKDSQP.mjs";
|
|
19
|
+
import "../../../../chunk-LJIVY6GU.mjs";
|
|
20
|
+
import "../../../../chunk-ZRHEFEFS.mjs";
|
|
21
|
+
import "../../../../chunk-V2G5QHZZ.mjs";
|
|
22
|
+
import "../../../../chunk-AQ3ISJKU.mjs";
|
|
23
|
+
import "../../../../chunk-3YOW5DEZ.mjs";
|
|
24
|
+
import "../../../../chunk-WYJW5NNA.mjs";
|
|
25
|
+
import "../../../../chunk-C3MURCMZ.mjs";
|
|
26
|
+
import "../../../../chunk-UUKS7JYX.mjs";
|
|
27
|
+
import "../../../../chunk-C4PCTOGM.mjs";
|
|
28
|
+
import "../../../../chunk-N3QOXWJI.mjs";
|
|
29
|
+
export {
|
|
30
|
+
RadioField
|
|
31
|
+
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { SelectProps } from "../../../inputs";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
3
|
+
type BaseProps = Omit<SelectProps, "name" | "errorMessage" | "isInvalid" | "value" | "onChange">;
|
|
4
|
+
export type SelectFieldProps = (Omit<BaseProps, "selectionMode"> & {
|
|
4
5
|
readonly name: string;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
selectionMode?: "single";
|
|
7
|
+
}) | (Omit<BaseProps, "selectionMode"> & {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
selectionMode: "multiple";
|
|
10
|
+
});
|
|
11
|
+
export declare function SelectField({ name, selectionMode, ...props }: SelectFieldProps): React.JSX.Element;
|
|
7
12
|
export declare namespace SelectField {
|
|
8
13
|
var displayName: string;
|
|
9
14
|
}
|
|
@@ -41,21 +41,33 @@ var import_react = __toESM(require("react"));
|
|
|
41
41
|
var import_select = require("@heroui/select");
|
|
42
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
43
|
var Select = import_react.default.forwardRef(
|
|
44
|
-
({ value, items, onChange, ...props }, ref) => {
|
|
45
|
-
const
|
|
44
|
+
({ value, items, onChange, selectionMode, ...props }, ref) => {
|
|
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
|
+
);
|
|
46
63
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
64
|
import_select.Select,
|
|
48
65
|
{
|
|
49
66
|
ref,
|
|
50
67
|
items,
|
|
51
|
-
placeholder: " ",
|
|
52
68
|
selectedKeys,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (typeof selected === "string") {
|
|
56
|
-
onChange == null ? void 0 : onChange(selected);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
69
|
+
selectionMode,
|
|
70
|
+
onSelectionChange: handleSelectionChange,
|
|
59
71
|
...props,
|
|
60
72
|
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectItem, { children: item.label }, item.key)
|
|
61
73
|
}
|
|
@@ -66,7 +78,7 @@ Select.displayName = "TeachInUI.Select";
|
|
|
66
78
|
|
|
67
79
|
// src/ui/form/rhf/fields/select-field.tsx
|
|
68
80
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
69
|
-
function SelectField({ name, ...props }) {
|
|
81
|
+
function SelectField({ name, selectionMode, ...props }) {
|
|
70
82
|
const { control } = (0, import_react_hook_form.useFormContext)();
|
|
71
83
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
72
84
|
import_react_hook_form.Controller,
|
|
@@ -76,6 +88,7 @@ function SelectField({ name, ...props }) {
|
|
|
76
88
|
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
77
89
|
Select,
|
|
78
90
|
{
|
|
91
|
+
selectionMode,
|
|
79
92
|
value: field.value,
|
|
80
93
|
onChange: (value) => field.onChange(value),
|
|
81
94
|
...props,
|