@tipp/ui 2.3.33 → 2.3.35
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/app/index.cjs +456 -198
- package/dist/app/index.cjs.map +1 -1
- package/dist/app/index.js +72 -71
- package/dist/app/platform/coach-question-list.cjs +12 -4
- package/dist/app/platform/coach-question-list.cjs.map +1 -1
- package/dist/app/platform/coach-question-list.js +27 -27
- package/dist/app/platform/contents-card.cjs +12 -4
- package/dist/app/platform/contents-card.cjs.map +1 -1
- package/dist/app/platform/contents-card.js +27 -27
- package/dist/app/platform/curriculum-card.js +2 -2
- package/dist/app/platform/edit-coaching-time.cjs +286 -28
- package/dist/app/platform/edit-coaching-time.cjs.map +1 -1
- package/dist/app/platform/edit-coaching-time.js +55 -54
- package/dist/app/platform/edit-service-type.cjs +281 -23
- package/dist/app/platform/edit-service-type.cjs.map +1 -1
- package/dist/app/platform/edit-service-type.js +55 -54
- package/dist/app/platform/goal-manage-card-edit.cjs +289 -31
- package/dist/app/platform/goal-manage-card-edit.cjs.map +1 -1
- package/dist/app/platform/goal-manage-card-edit.js +56 -55
- package/dist/app/platform/goal-manage-card-read.cjs +12 -4
- package/dist/app/platform/goal-manage-card-read.cjs.map +1 -1
- package/dist/app/platform/goal-manage-card-read.js +27 -27
- package/dist/app/platform/on-offline-radio-card.cjs +314 -54
- package/dist/app/platform/on-offline-radio-card.cjs.map +1 -1
- package/dist/app/platform/on-offline-radio-card.js +55 -54
- package/dist/app/platform/report-card.cjs +12 -4
- package/dist/app/platform/report-card.cjs.map +1 -1
- package/dist/app/platform/report-card.js +27 -27
- package/dist/app/platform/reservation-card.cjs +305 -47
- package/dist/app/platform/reservation-card.cjs.map +1 -1
- package/dist/app/platform/reservation-card.js +56 -55
- package/dist/app/platform/session-card.cjs +331 -73
- package/dist/app/platform/session-card.cjs.map +1 -1
- package/dist/app/platform/session-card.js +57 -56
- package/dist/app/platform/session-review-simple-read.cjs +12 -4
- package/dist/app/platform/session-review-simple-read.cjs.map +1 -1
- package/dist/app/platform/session-review-simple-read.js +27 -27
- package/dist/app/platform/userInfos/coaching-customer-info/index.cjs +12 -4
- package/dist/app/platform/userInfos/coaching-customer-info/index.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/index.js +29 -29
- package/dist/app/platform/userInfos/coaching-customer-info/large.cjs +12 -4
- package/dist/app/platform/userInfos/coaching-customer-info/large.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/large.js +27 -27
- package/dist/app/platform/userInfos/coaching-customer-info/medium.cjs +12 -4
- package/dist/app/platform/userInfos/coaching-customer-info/medium.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/medium.js +27 -27
- package/dist/app/platform/userInfos/coaching-customer-info/small.cjs +12 -4
- package/dist/app/platform/userInfos/coaching-customer-info/small.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/small.js +26 -26
- package/dist/app/platform/userInfos/session-user-info-detail.cjs +12 -4
- package/dist/app/platform/userInfos/session-user-info-detail.cjs.map +1 -1
- package/dist/app/platform/userInfos/session-user-info-detail.js +26 -26
- package/dist/app/platform/userInfos/utils.cjs +12 -4
- package/dist/app/platform/userInfos/utils.cjs.map +1 -1
- package/dist/app/platform/userInfos/utils.js +26 -26
- package/dist/atoms/dropdown-menu.cjs +9 -1
- package/dist/atoms/dropdown-menu.cjs.map +1 -1
- package/dist/atoms/dropdown-menu.d.cts +4 -1
- package/dist/atoms/dropdown-menu.d.ts +4 -1
- package/dist/atoms/dropdown-menu.js +1 -1
- package/dist/atoms/index.cjs +29 -11
- package/dist/atoms/index.cjs.map +1 -1
- package/dist/atoms/index.js +61 -61
- package/dist/atoms/pagination.cjs +14 -4
- package/dist/atoms/pagination.cjs.map +1 -1
- package/dist/atoms/pagination.js +1 -1
- package/dist/{chunk-HLL4QJJY.js → chunk-2TNZVHXZ.js} +5 -5
- package/dist/{chunk-GXWE3QNN.js → chunk-2U7C7J5P.js} +4 -4
- package/dist/{chunk-ZVSATS4O.js → chunk-5OLJJUMC.js} +7 -7
- package/dist/{chunk-SSSGPTRM.js → chunk-5TZNUXBT.js} +4 -4
- package/dist/{chunk-GXPEADVY.js → chunk-5WX7CODZ.js} +7 -7
- package/dist/{chunk-KD6EXWP7.js → chunk-62HSZXVT.js} +4 -4
- package/dist/{chunk-RFXVHZAN.js → chunk-64XYTE54.js} +4 -4
- package/dist/{chunk-TTVJOFG5.js → chunk-6MQMVYEP.js} +3 -3
- package/dist/{chunk-3WNHPKHP.js → chunk-7R5KG7SJ.js} +7 -7
- package/dist/{chunk-6UXCNYVO.js → chunk-7R65MUL6.js} +4 -4
- package/dist/{chunk-MIATMZDP.js → chunk-AA6OYHCE.js} +4 -4
- package/dist/{chunk-CI2XFT7Y.js → chunk-AYWPBD4T.js} +4 -4
- package/dist/{chunk-4QHXYLE4.js → chunk-CIQ7ELE6.js} +4 -4
- package/dist/{chunk-SNPAB3HJ.js → chunk-DWBYAHIR.js} +4 -4
- package/dist/{chunk-WOAZK56Z.js → chunk-ESM3HX57.js} +5 -5
- package/dist/{chunk-SACH3XVV.js → chunk-F7JSPN5P.js} +4 -4
- package/dist/{chunk-MFIOT62L.js → chunk-F7LTJOOC.js} +22 -6
- package/dist/chunk-F7LTJOOC.js.map +1 -0
- package/dist/{chunk-KCAOUZCT.js → chunk-GTO7GG2K.js} +2 -2
- package/dist/{chunk-MPZJH3PI.js → chunk-HTNDVNLQ.js} +4 -4
- package/dist/{chunk-PWTMDEL2.js → chunk-LATTGN7W.js} +7 -7
- package/dist/chunk-LSDD4TAP.js +276 -0
- package/dist/chunk-LSDD4TAP.js.map +1 -0
- package/dist/{chunk-JFJ3N4V5.js → chunk-NTJLECYY.js} +4 -4
- package/dist/{chunk-GXG26SHU.js → chunk-OILH5J7Q.js} +4 -4
- package/dist/{chunk-PD7RTFGB.js → chunk-P5GENHKO.js} +10 -10
- package/dist/{chunk-TB3ZF5TJ.js → chunk-PGUDVR3V.js} +2 -2
- package/dist/{chunk-BFRNEBJN.js → chunk-QEDJOAP6.js} +4 -4
- package/dist/{chunk-3Z2XZ4ZG.js → chunk-QKZTZUWP.js} +4 -4
- package/dist/{chunk-3JRHAKLV.js → chunk-RM5CQ77X.js} +7 -7
- package/dist/{chunk-D4U2MCJG.js → chunk-SMLC2O3V.js} +10 -2
- package/dist/chunk-SMLC2O3V.js.map +1 -0
- package/dist/{chunk-R3ZYNS4D.js → chunk-SRZK4OC5.js} +2 -2
- package/dist/chunk-SYMOHU2B.js +1 -0
- package/dist/{chunk-XXMZLXDE.js → chunk-TCFXG4AX.js} +7 -7
- package/dist/{chunk-I5RQ5T4B.js → chunk-U3FBMFRL.js} +10 -10
- package/dist/{chunk-5J4YHHVX.js → chunk-V3F7KAR6.js} +19 -5
- package/dist/chunk-V3F7KAR6.js.map +1 -0
- package/dist/{chunk-3DEAIJBF.js → chunk-WH6QD4SY.js} +10 -10
- package/dist/{chunk-BKYPABII.js → chunk-YPEB36YK.js} +5 -5
- package/dist/{chunk-JRSZNGFD.js → chunk-ZA4NYPSW.js} +5 -5
- package/dist/context/index.js +1 -1
- package/dist/index.cjs +576 -296
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +131 -127
- package/dist/molecules/autocomplete-textfield.cjs +417 -0
- package/dist/molecules/autocomplete-textfield.cjs.map +1 -0
- package/dist/molecules/autocomplete-textfield.d.cts +26 -0
- package/dist/molecules/autocomplete-textfield.d.ts +26 -0
- package/dist/molecules/autocomplete-textfield.js +12 -0
- package/dist/molecules/autocomplete-textfield.js.map +1 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/index.js +8 -8
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-body.js +6 -6
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-radio.js +2 -2
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-option.js +2 -2
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-text.js +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-text.js +3 -3
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/index.js +11 -11
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/start-review.js +2 -2
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-review.js +12 -12
- package/dist/molecules/curriculumV2/CurriculumContents/index.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumSidebar/index.js +1 -1
- package/dist/molecules/curriculumV2/index.js +15 -15
- package/dist/molecules/description-json-render.js +2 -2
- package/dist/molecules/dynamic-field.js +3 -3
- package/dist/molecules/dynamic-form-editor-field-editor-panel.js +3 -3
- package/dist/molecules/dynamic-form-editor-field-list-panel.js +2 -2
- package/dist/molecules/dynamic-form-editor-issues-panel.js +2 -2
- package/dist/molecules/dynamic-form-editor-preview-panel.js +6 -6
- package/dist/molecules/dynamic-form-editor.js +11 -11
- package/dist/molecules/dynamic-form.js +4 -4
- package/dist/molecules/expand-table/index.cjs +26 -6
- package/dist/molecules/expand-table/index.cjs.map +1 -1
- package/dist/molecules/expand-table/index.d.cts +2 -0
- package/dist/molecules/expand-table/index.d.ts +2 -0
- package/dist/molecules/expand-table/index.js +3 -3
- package/dist/molecules/index.cjs +312 -6
- package/dist/molecules/index.cjs.map +1 -1
- package/dist/molecules/index.d.cts +2 -0
- package/dist/molecules/index.d.ts +2 -0
- package/dist/molecules/index.js +52 -47
- package/dist/molecules/learning-post.js +2 -2
- package/dist/molecules/stepper.js +2 -2
- package/dist/molecules/tag-selector.js +3 -3
- package/package.json +1 -1
- package/src/atoms/dropdown-menu.tsx +13 -0
- package/src/atoms/pagination.tsx +23 -5
- package/src/molecules/autocomplete-textfield.tsx +302 -0
- package/src/molecules/expand-table/index.tsx +16 -3
- package/src/molecules/index.ts +2 -1
- package/dist/chunk-5J4YHHVX.js.map +0 -1
- package/dist/chunk-D4U2MCJG.js.map +0 -1
- package/dist/chunk-MFIOT62L.js.map +0 -1
- package/dist/chunk-YWYYPYBK.js +0 -1
- /package/dist/{chunk-HLL4QJJY.js.map → chunk-2TNZVHXZ.js.map} +0 -0
- /package/dist/{chunk-GXWE3QNN.js.map → chunk-2U7C7J5P.js.map} +0 -0
- /package/dist/{chunk-ZVSATS4O.js.map → chunk-5OLJJUMC.js.map} +0 -0
- /package/dist/{chunk-SSSGPTRM.js.map → chunk-5TZNUXBT.js.map} +0 -0
- /package/dist/{chunk-GXPEADVY.js.map → chunk-5WX7CODZ.js.map} +0 -0
- /package/dist/{chunk-KD6EXWP7.js.map → chunk-62HSZXVT.js.map} +0 -0
- /package/dist/{chunk-RFXVHZAN.js.map → chunk-64XYTE54.js.map} +0 -0
- /package/dist/{chunk-TTVJOFG5.js.map → chunk-6MQMVYEP.js.map} +0 -0
- /package/dist/{chunk-3WNHPKHP.js.map → chunk-7R5KG7SJ.js.map} +0 -0
- /package/dist/{chunk-6UXCNYVO.js.map → chunk-7R65MUL6.js.map} +0 -0
- /package/dist/{chunk-MIATMZDP.js.map → chunk-AA6OYHCE.js.map} +0 -0
- /package/dist/{chunk-CI2XFT7Y.js.map → chunk-AYWPBD4T.js.map} +0 -0
- /package/dist/{chunk-4QHXYLE4.js.map → chunk-CIQ7ELE6.js.map} +0 -0
- /package/dist/{chunk-SNPAB3HJ.js.map → chunk-DWBYAHIR.js.map} +0 -0
- /package/dist/{chunk-WOAZK56Z.js.map → chunk-ESM3HX57.js.map} +0 -0
- /package/dist/{chunk-SACH3XVV.js.map → chunk-F7JSPN5P.js.map} +0 -0
- /package/dist/{chunk-KCAOUZCT.js.map → chunk-GTO7GG2K.js.map} +0 -0
- /package/dist/{chunk-MPZJH3PI.js.map → chunk-HTNDVNLQ.js.map} +0 -0
- /package/dist/{chunk-PWTMDEL2.js.map → chunk-LATTGN7W.js.map} +0 -0
- /package/dist/{chunk-JFJ3N4V5.js.map → chunk-NTJLECYY.js.map} +0 -0
- /package/dist/{chunk-GXG26SHU.js.map → chunk-OILH5J7Q.js.map} +0 -0
- /package/dist/{chunk-PD7RTFGB.js.map → chunk-P5GENHKO.js.map} +0 -0
- /package/dist/{chunk-TB3ZF5TJ.js.map → chunk-PGUDVR3V.js.map} +0 -0
- /package/dist/{chunk-BFRNEBJN.js.map → chunk-QEDJOAP6.js.map} +0 -0
- /package/dist/{chunk-3Z2XZ4ZG.js.map → chunk-QKZTZUWP.js.map} +0 -0
- /package/dist/{chunk-3JRHAKLV.js.map → chunk-RM5CQ77X.js.map} +0 -0
- /package/dist/{chunk-R3ZYNS4D.js.map → chunk-SRZK4OC5.js.map} +0 -0
- /package/dist/{chunk-YWYYPYBK.js.map → chunk-SYMOHU2B.js.map} +0 -0
- /package/dist/{chunk-XXMZLXDE.js.map → chunk-TCFXG4AX.js.map} +0 -0
- /package/dist/{chunk-I5RQ5T4B.js.map → chunk-U3FBMFRL.js.map} +0 -0
- /package/dist/{chunk-3DEAIJBF.js.map → chunk-WH6QD4SY.js.map} +0 -0
- /package/dist/{chunk-BKYPABII.js.map → chunk-YPEB36YK.js.map} +0 -0
- /package/dist/{chunk-JRSZNGFD.js.map → chunk-ZA4NYPSW.js.map} +0 -0
package/dist/molecules/index.cjs
CHANGED
|
@@ -79,6 +79,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
79
79
|
// src/molecules/index.ts
|
|
80
80
|
var molecules_exports = {};
|
|
81
81
|
__export(molecules_exports, {
|
|
82
|
+
AutocompleteTextfield: () => AutocompleteTextfield,
|
|
82
83
|
CurriculumBody: () => CurriculumBody,
|
|
83
84
|
CurriculumProvider: () => CurriculumProvider,
|
|
84
85
|
CurriculumSidebar: () => CurriculumSidebar,
|
|
@@ -782,14 +783,24 @@ function Pagination(props) {
|
|
|
782
783
|
}
|
|
783
784
|
return Array.from({ length: end - start + 1 }, (_, i) => i + start);
|
|
784
785
|
}, [count, page, siblingCount]);
|
|
786
|
+
const onChangeRef = (0, import_react3.useRef)(onChange);
|
|
785
787
|
(0, import_react3.useEffect)(() => {
|
|
786
|
-
|
|
787
|
-
}
|
|
788
|
+
onChangeRef.current = onChange;
|
|
789
|
+
});
|
|
790
|
+
const isFirstRender = (0, import_react3.useRef)(true);
|
|
791
|
+
(0, import_react3.useEffect)(() => {
|
|
792
|
+
var _a;
|
|
793
|
+
if (isFirstRender.current) {
|
|
794
|
+
isFirstRender.current = false;
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
(_a = onChangeRef.current) == null ? void 0 : _a.call(onChangeRef, page);
|
|
798
|
+
}, [page]);
|
|
788
799
|
(0, import_react3.useEffect)(() => {
|
|
789
|
-
if (props.page) {
|
|
800
|
+
if (props.page && props.page !== page) {
|
|
790
801
|
setPage(props.page);
|
|
791
802
|
}
|
|
792
|
-
}, [props.page]);
|
|
803
|
+
}, [props.page, page]);
|
|
793
804
|
const prev = (0, import_react3.useMemo)(() => {
|
|
794
805
|
const p = page - 1;
|
|
795
806
|
return p < 1 ? void 0 : p;
|
|
@@ -990,6 +1001,7 @@ function ExpandTable(props) {
|
|
|
990
1001
|
pageIndex = 0,
|
|
991
1002
|
pageSize = 10,
|
|
992
1003
|
siblingCount = 2,
|
|
1004
|
+
onPageChange,
|
|
993
1005
|
getRowStyle,
|
|
994
1006
|
getCellStyle,
|
|
995
1007
|
variant = "card"
|
|
@@ -999,6 +1011,13 @@ function ExpandTable(props) {
|
|
|
999
1011
|
pageIndex: pageIndex || 0,
|
|
1000
1012
|
pageSize: pageSize || 9999
|
|
1001
1013
|
});
|
|
1014
|
+
(0, import_react6.useEffect)(() => {
|
|
1015
|
+
setPagination((prev) => {
|
|
1016
|
+
const next = pageIndex;
|
|
1017
|
+
if (prev.pageIndex === next) return prev;
|
|
1018
|
+
return __spreadProps(__spreadValues({}, prev), { pageIndex: next });
|
|
1019
|
+
});
|
|
1020
|
+
}, [pageIndex]);
|
|
1002
1021
|
const [sorting, setSorting] = (0, import_react6.useState)([]);
|
|
1003
1022
|
const { getRowModel, getHeaderGroups, setPageIndex } = (0, import_react_table2.useReactTable)({
|
|
1004
1023
|
data: data || [],
|
|
@@ -1023,9 +1042,11 @@ function ExpandTable(props) {
|
|
|
1023
1042
|
const rowModels = getRowModel();
|
|
1024
1043
|
const onChangePagination = (0, import_react6.useCallback)(
|
|
1025
1044
|
(page) => {
|
|
1026
|
-
|
|
1045
|
+
const idx = page - 1;
|
|
1046
|
+
setPageIndex(idx);
|
|
1047
|
+
onPageChange == null ? void 0 : onPageChange(idx);
|
|
1027
1048
|
},
|
|
1028
|
-
[setPageIndex]
|
|
1049
|
+
[setPageIndex, onPageChange]
|
|
1029
1050
|
);
|
|
1030
1051
|
const helpCompRender = (0, import_react6.useCallback)(
|
|
1031
1052
|
(rowLength) => {
|
|
@@ -7131,8 +7152,293 @@ function DynamicFormEditor(props) {
|
|
|
7131
7152
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DynamicFormEditorPreviewPanel, { fields: effectiveSchema.fields, show: showPreview })
|
|
7132
7153
|
] });
|
|
7133
7154
|
}
|
|
7155
|
+
|
|
7156
|
+
// src/molecules/autocomplete-textfield.tsx
|
|
7157
|
+
var import_react47 = require("react");
|
|
7158
|
+
var import_themes42 = require("@radix-ui/themes");
|
|
7159
|
+
|
|
7160
|
+
// src/atoms/dropdown-menu.tsx
|
|
7161
|
+
var import_themes41 = require("@radix-ui/themes");
|
|
7162
|
+
var import_react46 = require("react");
|
|
7163
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
7164
|
+
var Content4 = (0, import_react46.forwardRef)((props, ref) => {
|
|
7165
|
+
const _a = props, { isNavigation, className } = _a, rest = __objRest(_a, ["isNavigation", "className"]);
|
|
7166
|
+
const contentClassName = (0, import_react46.useMemo)(() => {
|
|
7167
|
+
const cls = isNavigation ? "dropdown-navigation" : "";
|
|
7168
|
+
return [cls, className].join(" ");
|
|
7169
|
+
}, [isNavigation, className]);
|
|
7170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
7171
|
+
import_themes41.DropdownMenu.Content,
|
|
7172
|
+
__spreadProps(__spreadValues({
|
|
7173
|
+
ref
|
|
7174
|
+
}, rest), {
|
|
7175
|
+
className: contentClassName
|
|
7176
|
+
})
|
|
7177
|
+
);
|
|
7178
|
+
});
|
|
7179
|
+
Content4.displayName = "DropdownMenu.Content";
|
|
7180
|
+
var Trigger4 = (0, import_react46.forwardRef)(
|
|
7181
|
+
(_a, ref) => {
|
|
7182
|
+
var _b = _a, { asChild: _asChild } = _b, props = __objRest(_b, ["asChild"]);
|
|
7183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_themes41.DropdownMenu.Trigger, __spreadValues({ ref }, props));
|
|
7184
|
+
}
|
|
7185
|
+
);
|
|
7186
|
+
Trigger4.displayName = "DropdownMenu.Trigger";
|
|
7187
|
+
var DropdownMenu = __spreadProps(__spreadValues({}, import_themes41.DropdownMenu), {
|
|
7188
|
+
Content: Content4,
|
|
7189
|
+
Trigger: Trigger4
|
|
7190
|
+
});
|
|
7191
|
+
|
|
7192
|
+
// src/molecules/autocomplete-textfield.tsx
|
|
7193
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
7194
|
+
var AutocompleteTextfield = (0, import_react47.forwardRef)(
|
|
7195
|
+
(_a, ref) => {
|
|
7196
|
+
var _b = _a, {
|
|
7197
|
+
options,
|
|
7198
|
+
value: externalValue,
|
|
7199
|
+
onChange,
|
|
7200
|
+
onSelect,
|
|
7201
|
+
placeholder,
|
|
7202
|
+
emptyMessage = "\uAC80\uC0C9 \uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
7203
|
+
maxItems = 10,
|
|
7204
|
+
slotLeft,
|
|
7205
|
+
slotRight,
|
|
7206
|
+
error
|
|
7207
|
+
} = _b, rest = __objRest(_b, [
|
|
7208
|
+
"options",
|
|
7209
|
+
"value",
|
|
7210
|
+
"onChange",
|
|
7211
|
+
"onSelect",
|
|
7212
|
+
"placeholder",
|
|
7213
|
+
"emptyMessage",
|
|
7214
|
+
"maxItems",
|
|
7215
|
+
"slotLeft",
|
|
7216
|
+
"slotRight",
|
|
7217
|
+
"error"
|
|
7218
|
+
]);
|
|
7219
|
+
const isControlled = externalValue !== void 0;
|
|
7220
|
+
const [internalValue, setInternalValue] = (0, import_react47.useState)("");
|
|
7221
|
+
const inputValue = isControlled ? externalValue : internalValue;
|
|
7222
|
+
const [open, setOpen] = (0, import_react47.useState)(false);
|
|
7223
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react47.useState)(-1);
|
|
7224
|
+
const inputRef = (0, import_react47.useRef)(null);
|
|
7225
|
+
const listRef = (0, import_react47.useRef)(null);
|
|
7226
|
+
const listboxId = (0, import_react47.useId)();
|
|
7227
|
+
const justSelectedRef = (0, import_react47.useRef)(false);
|
|
7228
|
+
const filtered = options.filter(
|
|
7229
|
+
(opt) => opt.label.toLowerCase().includes(inputValue.toLowerCase())
|
|
7230
|
+
).slice(0, maxItems);
|
|
7231
|
+
const handleInputChange = (0, import_react47.useCallback)(
|
|
7232
|
+
(e) => {
|
|
7233
|
+
const next = e.target.value;
|
|
7234
|
+
if (!isControlled) setInternalValue(next);
|
|
7235
|
+
onChange == null ? void 0 : onChange(next);
|
|
7236
|
+
const nextFiltered = options.filter((opt) => opt.label.toLowerCase().includes(next.toLowerCase())).slice(0, maxItems);
|
|
7237
|
+
setOpen(nextFiltered.length > 0 || emptyMessage !== null);
|
|
7238
|
+
setHighlightedIndex(-1);
|
|
7239
|
+
},
|
|
7240
|
+
[isControlled, onChange, options, maxItems, emptyMessage]
|
|
7241
|
+
);
|
|
7242
|
+
const handleSelect = (0, import_react47.useCallback)(
|
|
7243
|
+
(option) => {
|
|
7244
|
+
var _a2;
|
|
7245
|
+
if (!isControlled) setInternalValue(option.label);
|
|
7246
|
+
onChange == null ? void 0 : onChange(option.label);
|
|
7247
|
+
onSelect == null ? void 0 : onSelect(option);
|
|
7248
|
+
setOpen(false);
|
|
7249
|
+
setHighlightedIndex(-1);
|
|
7250
|
+
justSelectedRef.current = true;
|
|
7251
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
7252
|
+
},
|
|
7253
|
+
[isControlled, onChange, onSelect]
|
|
7254
|
+
);
|
|
7255
|
+
const handleFocus = (0, import_react47.useCallback)(() => {
|
|
7256
|
+
if (justSelectedRef.current) {
|
|
7257
|
+
justSelectedRef.current = false;
|
|
7258
|
+
return;
|
|
7259
|
+
}
|
|
7260
|
+
const currentFiltered = options.filter((opt) => opt.label.toLowerCase().includes(inputValue.toLowerCase())).slice(0, maxItems);
|
|
7261
|
+
setOpen(currentFiltered.length > 0 || emptyMessage !== null);
|
|
7262
|
+
}, [options, inputValue, maxItems, emptyMessage]);
|
|
7263
|
+
const handleBlur = (0, import_react47.useCallback)((e) => {
|
|
7264
|
+
var _a2, _b2;
|
|
7265
|
+
if (e.relatedTarget && ((_b2 = (_a2 = inputRef.current) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b2.contains(e.relatedTarget))) {
|
|
7266
|
+
return;
|
|
7267
|
+
}
|
|
7268
|
+
setOpen(false);
|
|
7269
|
+
setHighlightedIndex(-1);
|
|
7270
|
+
}, []);
|
|
7271
|
+
const handleKeyDown = (0, import_react47.useCallback)(
|
|
7272
|
+
(e) => {
|
|
7273
|
+
if (!open) {
|
|
7274
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
7275
|
+
setOpen(true);
|
|
7276
|
+
setHighlightedIndex(0);
|
|
7277
|
+
e.preventDefault();
|
|
7278
|
+
}
|
|
7279
|
+
return;
|
|
7280
|
+
}
|
|
7281
|
+
switch (e.key) {
|
|
7282
|
+
case "ArrowDown":
|
|
7283
|
+
e.preventDefault();
|
|
7284
|
+
setHighlightedIndex(
|
|
7285
|
+
(prev) => prev < filtered.length - 1 ? prev + 1 : 0
|
|
7286
|
+
);
|
|
7287
|
+
break;
|
|
7288
|
+
case "ArrowUp":
|
|
7289
|
+
e.preventDefault();
|
|
7290
|
+
setHighlightedIndex(
|
|
7291
|
+
(prev) => prev > 0 ? prev - 1 : filtered.length - 1
|
|
7292
|
+
);
|
|
7293
|
+
break;
|
|
7294
|
+
case "Enter":
|
|
7295
|
+
e.preventDefault();
|
|
7296
|
+
if (highlightedIndex >= 0 && filtered[highlightedIndex]) {
|
|
7297
|
+
handleSelect(filtered[highlightedIndex]);
|
|
7298
|
+
}
|
|
7299
|
+
break;
|
|
7300
|
+
case "Escape":
|
|
7301
|
+
setOpen(false);
|
|
7302
|
+
setHighlightedIndex(-1);
|
|
7303
|
+
break;
|
|
7304
|
+
case "Tab":
|
|
7305
|
+
setOpen(false);
|
|
7306
|
+
setHighlightedIndex(-1);
|
|
7307
|
+
break;
|
|
7308
|
+
default:
|
|
7309
|
+
break;
|
|
7310
|
+
}
|
|
7311
|
+
},
|
|
7312
|
+
[open, filtered, highlightedIndex, handleSelect]
|
|
7313
|
+
);
|
|
7314
|
+
(0, import_react47.useEffect)(() => {
|
|
7315
|
+
if (!listRef.current || highlightedIndex < 0) return;
|
|
7316
|
+
const item = listRef.current.children[highlightedIndex];
|
|
7317
|
+
item.scrollIntoView({ block: "nearest" });
|
|
7318
|
+
}, [highlightedIndex]);
|
|
7319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_themes42.Box, { position: "relative", style: { width: "100%" }, children: [
|
|
7320
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
7321
|
+
TextField.Root,
|
|
7322
|
+
__spreadProps(__spreadValues({
|
|
7323
|
+
"aria-activedescendant": open && highlightedIndex >= 0 ? `${listboxId}-option-${highlightedIndex}` : void 0,
|
|
7324
|
+
"aria-autocomplete": "list",
|
|
7325
|
+
"aria-controls": open ? listboxId : void 0,
|
|
7326
|
+
"aria-expanded": open,
|
|
7327
|
+
error,
|
|
7328
|
+
onBlur: handleBlur,
|
|
7329
|
+
onChange: handleInputChange,
|
|
7330
|
+
onFocus: handleFocus,
|
|
7331
|
+
onKeyDown: handleKeyDown,
|
|
7332
|
+
placeholder,
|
|
7333
|
+
ref: (node) => {
|
|
7334
|
+
inputRef.current = node;
|
|
7335
|
+
if (typeof ref === "function") {
|
|
7336
|
+
ref(node);
|
|
7337
|
+
} else if (ref) {
|
|
7338
|
+
ref.current = node;
|
|
7339
|
+
}
|
|
7340
|
+
},
|
|
7341
|
+
role: "combobox",
|
|
7342
|
+
style: { width: "100%" },
|
|
7343
|
+
value: inputValue
|
|
7344
|
+
}, rest), {
|
|
7345
|
+
children: [
|
|
7346
|
+
slotLeft && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TextField.Slot, { side: "left", children: slotLeft }),
|
|
7347
|
+
slotRight && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TextField.Slot, { side: "right", children: slotRight })
|
|
7348
|
+
]
|
|
7349
|
+
})
|
|
7350
|
+
),
|
|
7351
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
7352
|
+
DropdownMenu.Root,
|
|
7353
|
+
{
|
|
7354
|
+
modal: false,
|
|
7355
|
+
onOpenChange: (nextOpen) => {
|
|
7356
|
+
if (!nextOpen && document.activeElement !== inputRef.current) {
|
|
7357
|
+
setOpen(false);
|
|
7358
|
+
setHighlightedIndex(-1);
|
|
7359
|
+
}
|
|
7360
|
+
},
|
|
7361
|
+
open,
|
|
7362
|
+
children: [
|
|
7363
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7364
|
+
"span",
|
|
7365
|
+
{
|
|
7366
|
+
"aria-hidden": "true",
|
|
7367
|
+
style: {
|
|
7368
|
+
bottom: 0,
|
|
7369
|
+
height: 0,
|
|
7370
|
+
left: 0,
|
|
7371
|
+
opacity: 0,
|
|
7372
|
+
pointerEvents: "none",
|
|
7373
|
+
position: "absolute",
|
|
7374
|
+
width: "100%"
|
|
7375
|
+
}
|
|
7376
|
+
}
|
|
7377
|
+
) }),
|
|
7378
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7379
|
+
DropdownMenu.Content,
|
|
7380
|
+
{
|
|
7381
|
+
align: "start",
|
|
7382
|
+
onCloseAutoFocus: (e) => {
|
|
7383
|
+
e.preventDefault();
|
|
7384
|
+
},
|
|
7385
|
+
onOpenAutoFocus: (e) => {
|
|
7386
|
+
e.preventDefault();
|
|
7387
|
+
},
|
|
7388
|
+
sideOffset: 4,
|
|
7389
|
+
style: {
|
|
7390
|
+
maxHeight: 240,
|
|
7391
|
+
overflowY: "auto",
|
|
7392
|
+
padding: 0,
|
|
7393
|
+
width: "var(--radix-dropdown-menu-trigger-width)"
|
|
7394
|
+
},
|
|
7395
|
+
children: filtered.length === 0 && emptyMessage !== null ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_themes42.Box, { px: "2", py: "2", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Typo, { color: "gray", children: emptyMessage }) }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7396
|
+
"ul",
|
|
7397
|
+
{
|
|
7398
|
+
id: listboxId,
|
|
7399
|
+
ref: listRef,
|
|
7400
|
+
role: "listbox",
|
|
7401
|
+
style: { listStyle: "none", margin: 0, padding: 0 },
|
|
7402
|
+
children: filtered.map((option, index) => {
|
|
7403
|
+
const isHighlighted = index === highlightedIndex;
|
|
7404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
7405
|
+
"li",
|
|
7406
|
+
{
|
|
7407
|
+
"aria-selected": isHighlighted,
|
|
7408
|
+
id: `${listboxId}-option-${index}`,
|
|
7409
|
+
onMouseEnter: () => {
|
|
7410
|
+
setHighlightedIndex(index);
|
|
7411
|
+
},
|
|
7412
|
+
onPointerDown: (e) => {
|
|
7413
|
+
e.preventDefault();
|
|
7414
|
+
handleSelect(option);
|
|
7415
|
+
},
|
|
7416
|
+
role: "option",
|
|
7417
|
+
style: {
|
|
7418
|
+
padding: "var(--spacing-4) var(--spacing-6)",
|
|
7419
|
+
cursor: "pointer",
|
|
7420
|
+
backgroundColor: isHighlighted ? "var(--accent-3)" : "transparent",
|
|
7421
|
+
transition: "background-color 80ms"
|
|
7422
|
+
},
|
|
7423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Typo, { variant: "body", children: option.label })
|
|
7424
|
+
},
|
|
7425
|
+
option.value
|
|
7426
|
+
);
|
|
7427
|
+
})
|
|
7428
|
+
}
|
|
7429
|
+
)
|
|
7430
|
+
}
|
|
7431
|
+
)
|
|
7432
|
+
]
|
|
7433
|
+
}
|
|
7434
|
+
)
|
|
7435
|
+
] });
|
|
7436
|
+
}
|
|
7437
|
+
);
|
|
7438
|
+
AutocompleteTextfield.displayName = "AutocompleteTextfield";
|
|
7134
7439
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7135
7440
|
0 && (module.exports = {
|
|
7441
|
+
AutocompleteTextfield,
|
|
7136
7442
|
CurriculumBody,
|
|
7137
7443
|
CurriculumProvider,
|
|
7138
7444
|
CurriculumSidebar,
|