analytica-frontend-lib 1.0.70 → 1.0.72
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/Accordation/index.d.mts +12 -0
- package/dist/Accordation/index.d.ts +12 -0
- package/dist/Accordation/index.js +1663 -0
- package/dist/Accordation/index.js.map +1 -0
- package/dist/Accordation/index.mjs +1654 -0
- package/dist/Accordation/index.mjs.map +1 -0
- package/dist/AlertDialog/index.d.mts +40 -0
- package/dist/AlertDialog/index.d.ts +40 -0
- package/dist/AlertDialog/index.js +233 -0
- package/dist/AlertDialog/index.js.map +1 -0
- package/dist/AlertDialog/index.mjs +212 -0
- package/dist/AlertDialog/index.mjs.map +1 -0
- package/dist/Alternative/index.d.mts +81 -0
- package/dist/Alternative/index.d.ts +81 -0
- package/dist/Alternative/index.js +745 -0
- package/dist/Alternative/index.js.map +1 -0
- package/dist/Alternative/index.mjs +728 -0
- package/dist/Alternative/index.mjs.map +1 -0
- package/dist/Badge/index.js +1 -1
- package/dist/Badge/index.js.map +1 -1
- package/dist/Badge/index.mjs +1 -1
- package/dist/Badge/index.mjs.map +1 -1
- package/dist/Card/index.js +1 -1
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +1 -1
- package/dist/Card/index.mjs.map +1 -1
- package/dist/Radio/index.d.mts +120 -2
- package/dist/Radio/index.d.ts +120 -2
- package/dist/Radio/index.js +176 -3
- package/dist/Radio/index.js.map +1 -1
- package/dist/Radio/index.mjs +176 -4
- package/dist/Radio/index.mjs.map +1 -1
- package/dist/Skeleton/index.d.mts +10 -9
- package/dist/Skeleton/index.d.ts +10 -9
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Skeleton/index.mjs.map +1 -1
- package/dist/index.css +173 -83
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2361 -1916
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2412 -1962
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +173 -83
- package/dist/styles.css.map +1 -1
- package/package.json +4 -2
- package/dist/Tab/index.d.mts +0 -37
- package/dist/Tab/index.d.ts +0 -37
- package/dist/Tab/index.js +0 -182
- package/dist/Tab/index.js.map +0 -1
- package/dist/Tab/index.mjs +0 -161
- package/dist/Tab/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -21,10 +21,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
Alert: () => Alert_default,
|
|
24
|
+
AlertDialog: () => AlertDialog,
|
|
25
|
+
AlternativesList: () => AlternativesList,
|
|
24
26
|
AuthProvider: () => AuthProvider,
|
|
25
27
|
Badge: () => Badge_default,
|
|
26
28
|
Button: () => Button_default,
|
|
27
29
|
Calendar: () => Calendar_default,
|
|
30
|
+
CardAccordation: () => CardAccordation,
|
|
28
31
|
CardActivitiesResults: () => CardActivitiesResults,
|
|
29
32
|
CardPerformance: () => CardPerformance,
|
|
30
33
|
CardProgress: () => CardProgress,
|
|
@@ -60,6 +63,8 @@ __export(src_exports, {
|
|
|
60
63
|
ProtectedRoute: () => ProtectedRoute,
|
|
61
64
|
PublicRoute: () => PublicRoute,
|
|
62
65
|
Radio: () => Radio_default,
|
|
66
|
+
RadioGroup: () => RadioGroup,
|
|
67
|
+
RadioGroupItem: () => RadioGroupItem,
|
|
63
68
|
Select: () => Select_default,
|
|
64
69
|
SelectContent: () => SelectContent,
|
|
65
70
|
SelectItem: () => SelectItem,
|
|
@@ -75,7 +80,6 @@ __export(src_exports, {
|
|
|
75
80
|
SkeletonTable: () => SkeletonTable,
|
|
76
81
|
SkeletonText: () => SkeletonText,
|
|
77
82
|
Stepper: () => Stepper_default,
|
|
78
|
-
Tab: () => Tab_default,
|
|
79
83
|
Table: () => Table_default,
|
|
80
84
|
Text: () => Text_default,
|
|
81
85
|
TextArea: () => TextArea_default,
|
|
@@ -203,7 +207,7 @@ var import_phosphor_react = require("phosphor-react");
|
|
|
203
207
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
204
208
|
var VARIANT_ACTION_CLASSES2 = {
|
|
205
209
|
solid: {
|
|
206
|
-
error: "bg-error text-error-700 focus-visible:outline-none",
|
|
210
|
+
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
207
211
|
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
208
212
|
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
209
213
|
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
@@ -855,6 +859,7 @@ var CheckBox_default = CheckBox;
|
|
|
855
859
|
|
|
856
860
|
// src/components/Radio/Radio.tsx
|
|
857
861
|
var import_react6 = require("react");
|
|
862
|
+
var import_zustand = require("zustand");
|
|
858
863
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
859
864
|
var SIZE_CLASSES4 = {
|
|
860
865
|
small: {
|
|
@@ -940,6 +945,7 @@ var Radio = (0, import_react6.forwardRef)(
|
|
|
940
945
|
}, ref) => {
|
|
941
946
|
const generatedId = (0, import_react6.useId)();
|
|
942
947
|
const inputId = id ?? `radio-${generatedId}`;
|
|
948
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
943
949
|
const [internalChecked, setInternalChecked] = (0, import_react6.useState)(defaultChecked);
|
|
944
950
|
const isControlled = checkedProp !== void 0;
|
|
945
951
|
const checked = isControlled ? checkedProp : internalChecked;
|
|
@@ -948,6 +954,9 @@ var Radio = (0, import_react6.forwardRef)(
|
|
|
948
954
|
if (!isControlled) {
|
|
949
955
|
setInternalChecked(newChecked);
|
|
950
956
|
}
|
|
957
|
+
if (event.target) {
|
|
958
|
+
event.target.blur();
|
|
959
|
+
}
|
|
951
960
|
onChange?.(event);
|
|
952
961
|
};
|
|
953
962
|
const currentState = disabled ? "disabled" : state;
|
|
@@ -988,7 +997,11 @@ var Radio = (0, import_react6.forwardRef)(
|
|
|
988
997
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
989
998
|
"input",
|
|
990
999
|
{
|
|
991
|
-
ref
|
|
1000
|
+
ref: (node) => {
|
|
1001
|
+
inputRef.current = node;
|
|
1002
|
+
if (typeof ref === "function") ref(node);
|
|
1003
|
+
else if (ref) ref.current = node;
|
|
1004
|
+
},
|
|
992
1005
|
type: "radio",
|
|
993
1006
|
id: inputId,
|
|
994
1007
|
checked,
|
|
@@ -997,10 +1010,42 @@ var Radio = (0, import_react6.forwardRef)(
|
|
|
997
1010
|
value,
|
|
998
1011
|
onChange: handleChange,
|
|
999
1012
|
className: "sr-only",
|
|
1013
|
+
style: {
|
|
1014
|
+
position: "absolute",
|
|
1015
|
+
left: "-9999px",
|
|
1016
|
+
visibility: "hidden"
|
|
1017
|
+
},
|
|
1000
1018
|
...props
|
|
1001
1019
|
}
|
|
1002
1020
|
),
|
|
1003
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1022
|
+
"button",
|
|
1023
|
+
{
|
|
1024
|
+
type: "button",
|
|
1025
|
+
className: radioClasses,
|
|
1026
|
+
disabled,
|
|
1027
|
+
"aria-pressed": checked,
|
|
1028
|
+
onClick: (e) => {
|
|
1029
|
+
e.preventDefault();
|
|
1030
|
+
if (!disabled) {
|
|
1031
|
+
if (inputRef.current) {
|
|
1032
|
+
inputRef.current.click();
|
|
1033
|
+
inputRef.current.blur();
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
onKeyDown: (e) => {
|
|
1038
|
+
if ((e.key === "Enter" || e.key === " ") && !disabled) {
|
|
1039
|
+
e.preventDefault();
|
|
1040
|
+
if (inputRef.current) {
|
|
1041
|
+
inputRef.current.click();
|
|
1042
|
+
inputRef.current.blur();
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: dotClasses })
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1004
1049
|
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1005
1050
|
"div",
|
|
1006
1051
|
{
|
|
@@ -1046,6 +1091,129 @@ var Radio = (0, import_react6.forwardRef)(
|
|
|
1046
1091
|
}
|
|
1047
1092
|
);
|
|
1048
1093
|
Radio.displayName = "Radio";
|
|
1094
|
+
var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => (0, import_zustand.create)((set, get) => ({
|
|
1095
|
+
value: defaultValue,
|
|
1096
|
+
setValue: (value) => {
|
|
1097
|
+
if (!get().disabled) {
|
|
1098
|
+
set({ value });
|
|
1099
|
+
get().onValueChange?.(value);
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
onValueChange,
|
|
1103
|
+
disabled,
|
|
1104
|
+
name
|
|
1105
|
+
}));
|
|
1106
|
+
var useRadioGroupStore = (externalStore) => {
|
|
1107
|
+
if (!externalStore) {
|
|
1108
|
+
throw new Error("RadioGroupItem must be used within a RadioGroup");
|
|
1109
|
+
}
|
|
1110
|
+
return externalStore;
|
|
1111
|
+
};
|
|
1112
|
+
var injectStore = (children, store) => import_react6.Children.map(children, (child) => {
|
|
1113
|
+
if (!(0, import_react6.isValidElement)(child)) return child;
|
|
1114
|
+
const typedChild = child;
|
|
1115
|
+
const shouldInject = typedChild.type === RadioGroupItem;
|
|
1116
|
+
return (0, import_react6.cloneElement)(typedChild, {
|
|
1117
|
+
...shouldInject ? { store } : {},
|
|
1118
|
+
...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
|
|
1119
|
+
});
|
|
1120
|
+
});
|
|
1121
|
+
var RadioGroup = (0, import_react6.forwardRef)(
|
|
1122
|
+
({
|
|
1123
|
+
value: propValue,
|
|
1124
|
+
defaultValue = "",
|
|
1125
|
+
onValueChange,
|
|
1126
|
+
name: propName,
|
|
1127
|
+
disabled = false,
|
|
1128
|
+
className = "",
|
|
1129
|
+
children,
|
|
1130
|
+
...props
|
|
1131
|
+
}, ref) => {
|
|
1132
|
+
const generatedId = (0, import_react6.useId)();
|
|
1133
|
+
const name = propName || `radio-group-${generatedId}`;
|
|
1134
|
+
const storeRef = (0, import_react6.useRef)(null);
|
|
1135
|
+
storeRef.current ??= createRadioGroupStore(
|
|
1136
|
+
name,
|
|
1137
|
+
defaultValue,
|
|
1138
|
+
disabled,
|
|
1139
|
+
onValueChange
|
|
1140
|
+
);
|
|
1141
|
+
const store = storeRef.current;
|
|
1142
|
+
const { setValue } = (0, import_zustand.useStore)(store, (s) => s);
|
|
1143
|
+
(0, import_react6.useEffect)(() => {
|
|
1144
|
+
const currentValue = store.getState().value;
|
|
1145
|
+
if (currentValue && onValueChange) {
|
|
1146
|
+
onValueChange(currentValue);
|
|
1147
|
+
}
|
|
1148
|
+
}, []);
|
|
1149
|
+
(0, import_react6.useEffect)(() => {
|
|
1150
|
+
if (propValue !== void 0) {
|
|
1151
|
+
setValue(propValue);
|
|
1152
|
+
}
|
|
1153
|
+
}, [propValue, setValue]);
|
|
1154
|
+
(0, import_react6.useEffect)(() => {
|
|
1155
|
+
store.setState({ disabled });
|
|
1156
|
+
}, [disabled, store]);
|
|
1157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1158
|
+
"div",
|
|
1159
|
+
{
|
|
1160
|
+
ref,
|
|
1161
|
+
className,
|
|
1162
|
+
role: "radiogroup",
|
|
1163
|
+
"aria-label": name,
|
|
1164
|
+
...props,
|
|
1165
|
+
children: injectStore(children, store)
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
);
|
|
1170
|
+
RadioGroup.displayName = "RadioGroup";
|
|
1171
|
+
var RadioGroupItem = (0, import_react6.forwardRef)(
|
|
1172
|
+
({
|
|
1173
|
+
value,
|
|
1174
|
+
store: externalStore,
|
|
1175
|
+
disabled: itemDisabled,
|
|
1176
|
+
size = "medium",
|
|
1177
|
+
state = "default",
|
|
1178
|
+
className = "",
|
|
1179
|
+
id,
|
|
1180
|
+
...props
|
|
1181
|
+
}, ref) => {
|
|
1182
|
+
const store = useRadioGroupStore(externalStore);
|
|
1183
|
+
const {
|
|
1184
|
+
value: groupValue,
|
|
1185
|
+
setValue,
|
|
1186
|
+
disabled: groupDisabled,
|
|
1187
|
+
name
|
|
1188
|
+
} = (0, import_zustand.useStore)(store);
|
|
1189
|
+
const generatedId = (0, import_react6.useId)();
|
|
1190
|
+
const inputId = id ?? `radio-item-${generatedId}`;
|
|
1191
|
+
const isChecked = groupValue === value;
|
|
1192
|
+
const isDisabled = groupDisabled || itemDisabled;
|
|
1193
|
+
const currentState = isDisabled ? "disabled" : state;
|
|
1194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1195
|
+
Radio,
|
|
1196
|
+
{
|
|
1197
|
+
ref,
|
|
1198
|
+
id: inputId,
|
|
1199
|
+
name,
|
|
1200
|
+
value,
|
|
1201
|
+
checked: isChecked,
|
|
1202
|
+
disabled: isDisabled,
|
|
1203
|
+
size,
|
|
1204
|
+
state: currentState,
|
|
1205
|
+
className,
|
|
1206
|
+
onChange: (e) => {
|
|
1207
|
+
if (e.target.checked && !isDisabled) {
|
|
1208
|
+
setValue(value);
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
...props
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
RadioGroupItem.displayName = "RadioGroupItem";
|
|
1049
1217
|
var Radio_default = Radio;
|
|
1050
1218
|
|
|
1051
1219
|
// src/components/TextArea/TextArea.tsx
|
|
@@ -1251,8 +1419,8 @@ var Toast = ({
|
|
|
1251
1419
|
var Toast_default = Toast;
|
|
1252
1420
|
|
|
1253
1421
|
// src/components/Toast/utils/ToastStore.ts
|
|
1254
|
-
var
|
|
1255
|
-
var useToastStore = (0,
|
|
1422
|
+
var import_zustand2 = require("zustand");
|
|
1423
|
+
var useToastStore = (0, import_zustand2.create)((set) => ({
|
|
1256
1424
|
toasts: [],
|
|
1257
1425
|
addToast: (toast) => {
|
|
1258
1426
|
const id = crypto.randomUUID();
|
|
@@ -2997,623 +3165,881 @@ var Modal = ({
|
|
|
2997
3165
|
};
|
|
2998
3166
|
var Modal_default = Modal;
|
|
2999
3167
|
|
|
3000
|
-
// src/components/
|
|
3001
|
-
var
|
|
3168
|
+
// src/components/Accordation/Accordation.tsx
|
|
3169
|
+
var import_react12 = require("react");
|
|
3170
|
+
|
|
3171
|
+
// src/components/Card/Card.tsx
|
|
3002
3172
|
var import_react11 = require("react");
|
|
3003
|
-
var
|
|
3173
|
+
var import_phosphor_react10 = require("phosphor-react");
|
|
3004
3174
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
}));
|
|
3010
|
-
}
|
|
3011
|
-
var useDropdownStore = (externalStore) => {
|
|
3012
|
-
if (!externalStore) {
|
|
3013
|
-
throw new Error(
|
|
3014
|
-
"Component must be used within a DropdownMenu (store is missing)"
|
|
3015
|
-
);
|
|
3016
|
-
}
|
|
3017
|
-
return externalStore;
|
|
3018
|
-
};
|
|
3019
|
-
var injectStore = (children, store) => {
|
|
3020
|
-
return import_react11.Children.map(children, (child) => {
|
|
3021
|
-
if ((0, import_react11.isValidElement)(child)) {
|
|
3022
|
-
const typedChild = child;
|
|
3023
|
-
const newProps = {
|
|
3024
|
-
store
|
|
3025
|
-
};
|
|
3026
|
-
if (typedChild.props.children) {
|
|
3027
|
-
newProps.children = injectStore(typedChild.props.children, store);
|
|
3028
|
-
}
|
|
3029
|
-
return (0, import_react11.cloneElement)(typedChild, newProps);
|
|
3030
|
-
}
|
|
3031
|
-
return child;
|
|
3032
|
-
});
|
|
3033
|
-
};
|
|
3034
|
-
var DropdownMenu = ({
|
|
3035
|
-
children,
|
|
3036
|
-
open: propOpen,
|
|
3037
|
-
onOpenChange
|
|
3038
|
-
}) => {
|
|
3039
|
-
const storeRef = (0, import_react11.useRef)(null);
|
|
3040
|
-
storeRef.current ??= createDropdownStore();
|
|
3041
|
-
const store = storeRef.current;
|
|
3042
|
-
const { open, setOpen: storeSetOpen } = (0, import_zustand2.useStore)(store, (s) => s);
|
|
3043
|
-
const setOpen = (newOpen) => {
|
|
3044
|
-
storeSetOpen(newOpen);
|
|
3045
|
-
};
|
|
3046
|
-
const menuRef = (0, import_react11.useRef)(null);
|
|
3047
|
-
const handleArrowDownOrArrowUp = (event) => {
|
|
3048
|
-
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
3049
|
-
if (menuContent) {
|
|
3050
|
-
event.preventDefault();
|
|
3051
|
-
const items = Array.from(
|
|
3052
|
-
menuContent.querySelectorAll(
|
|
3053
|
-
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
3054
|
-
)
|
|
3055
|
-
).filter((el) => el instanceof HTMLElement);
|
|
3056
|
-
if (items.length === 0) return;
|
|
3057
|
-
const focusedItem = document.activeElement;
|
|
3058
|
-
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
3059
|
-
let nextIndex;
|
|
3060
|
-
if (event.key === "ArrowDown") {
|
|
3061
|
-
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
3062
|
-
} else {
|
|
3063
|
-
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
3064
|
-
}
|
|
3065
|
-
items[nextIndex]?.focus();
|
|
3066
|
-
}
|
|
3067
|
-
};
|
|
3068
|
-
const handleDownkey = (event) => {
|
|
3069
|
-
if (event.key === "Escape") {
|
|
3070
|
-
setOpen(false);
|
|
3071
|
-
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
3072
|
-
handleArrowDownOrArrowUp(event);
|
|
3073
|
-
}
|
|
3074
|
-
};
|
|
3075
|
-
const handleClickOutside = (event) => {
|
|
3076
|
-
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
3077
|
-
setOpen(false);
|
|
3078
|
-
}
|
|
3079
|
-
};
|
|
3080
|
-
(0, import_react11.useEffect)(() => {
|
|
3081
|
-
if (open) {
|
|
3082
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
3083
|
-
document.addEventListener("keydown", handleDownkey);
|
|
3084
|
-
}
|
|
3085
|
-
return () => {
|
|
3086
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
3087
|
-
document.removeEventListener("keydown", handleDownkey);
|
|
3088
|
-
};
|
|
3089
|
-
}, [open]);
|
|
3090
|
-
(0, import_react11.useEffect)(() => {
|
|
3091
|
-
setOpen(open);
|
|
3092
|
-
onOpenChange?.(open);
|
|
3093
|
-
}, [open, onOpenChange]);
|
|
3094
|
-
(0, import_react11.useEffect)(() => {
|
|
3095
|
-
if (propOpen) {
|
|
3096
|
-
setOpen(propOpen);
|
|
3097
|
-
}
|
|
3098
|
-
}, [propOpen]);
|
|
3099
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
3100
|
-
};
|
|
3101
|
-
var DropdownMenuTrigger = ({
|
|
3102
|
-
className,
|
|
3103
|
-
children,
|
|
3104
|
-
onClick,
|
|
3105
|
-
store: externalStore,
|
|
3106
|
-
...props
|
|
3107
|
-
}) => {
|
|
3108
|
-
const store = useDropdownStore(externalStore);
|
|
3109
|
-
const open = (0, import_zustand2.useStore)(store, (s) => s.open);
|
|
3110
|
-
const toggleOpen = () => store.setState({ open: !open });
|
|
3111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3112
|
-
"button",
|
|
3113
|
-
{
|
|
3114
|
-
onClick: (e) => {
|
|
3115
|
-
e.stopPropagation();
|
|
3116
|
-
toggleOpen();
|
|
3117
|
-
if (onClick) onClick(e);
|
|
3118
|
-
},
|
|
3119
|
-
"aria-expanded": open,
|
|
3120
|
-
className: `${className}`,
|
|
3121
|
-
...props,
|
|
3122
|
-
children
|
|
3123
|
-
}
|
|
3124
|
-
);
|
|
3175
|
+
var CARD_BASE_CLASSES = {
|
|
3176
|
+
default: "w-full bg-background border border-border-50 rounded-xl",
|
|
3177
|
+
compact: "w-full bg-background border border-border-50 rounded-lg",
|
|
3178
|
+
minimal: "w-full bg-background border border-border-100 rounded-md"
|
|
3125
3179
|
};
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
small: "
|
|
3129
|
-
medium: "
|
|
3180
|
+
var CARD_PADDING_CLASSES = {
|
|
3181
|
+
none: "",
|
|
3182
|
+
small: "p-2",
|
|
3183
|
+
medium: "p-4",
|
|
3184
|
+
large: "p-6"
|
|
3130
3185
|
};
|
|
3131
|
-
var
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3186
|
+
var CARD_MIN_HEIGHT_CLASSES = {
|
|
3187
|
+
none: "",
|
|
3188
|
+
small: "min-h-16",
|
|
3189
|
+
medium: "min-h-20",
|
|
3190
|
+
large: "min-h-24"
|
|
3136
3191
|
};
|
|
3137
|
-
var
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
end: "right-0"
|
|
3192
|
+
var CARD_LAYOUT_CLASSES = {
|
|
3193
|
+
horizontal: "flex flex-row",
|
|
3194
|
+
vertical: "flex flex-col"
|
|
3141
3195
|
};
|
|
3142
|
-
var
|
|
3143
|
-
|
|
3144
|
-
|
|
3196
|
+
var CARD_CURSOR_CLASSES = {
|
|
3197
|
+
default: "",
|
|
3198
|
+
pointer: "cursor-pointer"
|
|
3145
3199
|
};
|
|
3146
|
-
var
|
|
3147
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3148
|
-
"div",
|
|
3149
|
-
{
|
|
3150
|
-
ref,
|
|
3151
|
-
className: `text-sm w-full ${inset ? "pl-8" : ""} ${className ?? ""}`,
|
|
3152
|
-
...props
|
|
3153
|
-
}
|
|
3154
|
-
);
|
|
3155
|
-
});
|
|
3156
|
-
MenuLabel.displayName = "MenuLabel";
|
|
3157
|
-
var DropdownMenuContent = (0, import_react11.forwardRef)(
|
|
3200
|
+
var CardBase = (0, import_react11.forwardRef)(
|
|
3158
3201
|
({
|
|
3159
|
-
className,
|
|
3160
|
-
align = "start",
|
|
3161
|
-
side = "bottom",
|
|
3162
|
-
variant = "menu",
|
|
3163
|
-
sideOffset = 4,
|
|
3164
3202
|
children,
|
|
3165
|
-
|
|
3203
|
+
variant = "default",
|
|
3204
|
+
layout = "horizontal",
|
|
3205
|
+
padding = "medium",
|
|
3206
|
+
minHeight = "medium",
|
|
3207
|
+
cursor = "default",
|
|
3208
|
+
className = "",
|
|
3166
3209
|
...props
|
|
3167
3210
|
}, ref) => {
|
|
3168
|
-
const
|
|
3169
|
-
const
|
|
3170
|
-
const
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3211
|
+
const baseClasses = CARD_BASE_CLASSES[variant];
|
|
3212
|
+
const paddingClasses = CARD_PADDING_CLASSES[padding];
|
|
3213
|
+
const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
|
|
3214
|
+
const layoutClasses = CARD_LAYOUT_CLASSES[layout];
|
|
3215
|
+
const cursorClasses = CARD_CURSOR_CLASSES[cursor];
|
|
3216
|
+
const combinedClasses = [
|
|
3217
|
+
baseClasses,
|
|
3218
|
+
paddingClasses,
|
|
3219
|
+
minHeightClasses,
|
|
3220
|
+
layoutClasses,
|
|
3221
|
+
cursorClasses,
|
|
3222
|
+
className
|
|
3223
|
+
].filter(Boolean).join(" ");
|
|
3224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: combinedClasses, ...props, children });
|
|
3225
|
+
}
|
|
3226
|
+
);
|
|
3227
|
+
var ACTION_CARD_CLASSES = {
|
|
3228
|
+
warning: "bg-warning-background",
|
|
3229
|
+
success: "bg-success-300",
|
|
3230
|
+
error: "bg-error-100",
|
|
3231
|
+
info: "bg-info-background"
|
|
3232
|
+
};
|
|
3233
|
+
var ACTION_ICON_CLASSES = {
|
|
3234
|
+
warning: "bg-warning-300 text-text",
|
|
3235
|
+
success: "bg-yellow-300 text-text-950",
|
|
3236
|
+
error: "bg-error-500 text-text",
|
|
3237
|
+
info: "bg-info-500 text-text"
|
|
3238
|
+
};
|
|
3239
|
+
var ACTION_SUBTITLE_CLASSES = {
|
|
3240
|
+
warning: "text-warning-600",
|
|
3241
|
+
success: "text-success-700",
|
|
3242
|
+
error: "text-error-700",
|
|
3243
|
+
info: "text-info-700"
|
|
3244
|
+
};
|
|
3245
|
+
var ACTION_HEADER_CLASSES = {
|
|
3246
|
+
warning: "text-warning-300",
|
|
3247
|
+
success: "text-success-300",
|
|
3248
|
+
error: "text-error-300",
|
|
3249
|
+
info: "text-info-300"
|
|
3250
|
+
};
|
|
3251
|
+
var CardActivitiesResults = (0, import_react11.forwardRef)(
|
|
3252
|
+
({
|
|
3253
|
+
icon,
|
|
3254
|
+
title,
|
|
3255
|
+
subTitle,
|
|
3256
|
+
header,
|
|
3257
|
+
extended = false,
|
|
3258
|
+
action = "success",
|
|
3259
|
+
description,
|
|
3260
|
+
className,
|
|
3261
|
+
...props
|
|
3262
|
+
}, ref) => {
|
|
3263
|
+
const actionCardClasses = ACTION_CARD_CLASSES[action];
|
|
3264
|
+
const actionIconClasses = ACTION_ICON_CLASSES[action];
|
|
3265
|
+
const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
|
|
3266
|
+
const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
|
|
3267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3187
3268
|
"div",
|
|
3188
3269
|
{
|
|
3189
3270
|
ref,
|
|
3190
|
-
|
|
3191
|
-
className: `
|
|
3192
|
-
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
|
|
3193
|
-
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
3194
|
-
${getPositionClasses()}
|
|
3195
|
-
${variantClasses}
|
|
3196
|
-
${className}
|
|
3197
|
-
`,
|
|
3198
|
-
style: {
|
|
3199
|
-
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
3200
|
-
marginBottom: side === "top" ? sideOffset : void 0,
|
|
3201
|
-
marginLeft: side === "right" ? sideOffset : void 0,
|
|
3202
|
-
marginRight: side === "left" ? sideOffset : void 0
|
|
3203
|
-
},
|
|
3271
|
+
className: `w-full flex flex-col border border-border-50 bg-background rounded-xl ${className}`,
|
|
3204
3272
|
...props,
|
|
3205
|
-
children
|
|
3273
|
+
children: [
|
|
3274
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3275
|
+
"div",
|
|
3276
|
+
{
|
|
3277
|
+
className: `
|
|
3278
|
+
flex flex-col gap-1 items-center justify-center p-4
|
|
3279
|
+
${actionCardClasses}
|
|
3280
|
+
${extended ? "rounded-t-xl" : "rounded-xl"}`,
|
|
3281
|
+
children: [
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3283
|
+
"span",
|
|
3284
|
+
{
|
|
3285
|
+
className: `size-7.5 rounded-full flex items-center justify-center ${actionIconClasses}`,
|
|
3286
|
+
children: icon
|
|
3287
|
+
}
|
|
3288
|
+
),
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3290
|
+
Text_default,
|
|
3291
|
+
{
|
|
3292
|
+
size: "2xs",
|
|
3293
|
+
weight: "medium",
|
|
3294
|
+
className: "text-text-800 uppercase truncate",
|
|
3295
|
+
children: title
|
|
3296
|
+
}
|
|
3297
|
+
),
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: `text-lg font-bold truncate ${actionSubTitleClasses}`, children: subTitle })
|
|
3299
|
+
]
|
|
3300
|
+
}
|
|
3301
|
+
),
|
|
3302
|
+
extended && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
|
|
3303
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3304
|
+
"p",
|
|
3305
|
+
{
|
|
3306
|
+
className: `text-2xs font-medium uppercase truncate ${actionHeaderClasses}`,
|
|
3307
|
+
children: header
|
|
3308
|
+
}
|
|
3309
|
+
),
|
|
3310
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge_default, { size: "large", action: "info", children: description })
|
|
3311
|
+
] })
|
|
3312
|
+
]
|
|
3206
3313
|
}
|
|
3207
3314
|
);
|
|
3208
3315
|
}
|
|
3209
3316
|
);
|
|
3210
|
-
|
|
3211
|
-
var DropdownMenuItem = (0, import_react11.forwardRef)(
|
|
3317
|
+
var CardQuestions = (0, import_react11.forwardRef)(
|
|
3212
3318
|
({
|
|
3319
|
+
header,
|
|
3320
|
+
state = "undone",
|
|
3213
3321
|
className,
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
iconRight,
|
|
3217
|
-
iconLeft,
|
|
3218
|
-
disabled = false,
|
|
3219
|
-
onClick,
|
|
3220
|
-
variant = "menu",
|
|
3221
|
-
store: externalStore,
|
|
3322
|
+
onClickButton,
|
|
3323
|
+
valueButton,
|
|
3222
3324
|
...props
|
|
3223
3325
|
}, ref) => {
|
|
3224
|
-
const
|
|
3225
|
-
const
|
|
3226
|
-
const
|
|
3227
|
-
const handleClick = (e) => {
|
|
3228
|
-
if (disabled) {
|
|
3229
|
-
e.preventDefault();
|
|
3230
|
-
e.stopPropagation();
|
|
3231
|
-
return;
|
|
3232
|
-
}
|
|
3233
|
-
onClick?.(e);
|
|
3234
|
-
setOpen(false);
|
|
3235
|
-
};
|
|
3236
|
-
const getVariantClasses = () => {
|
|
3237
|
-
if (variant === "profile") {
|
|
3238
|
-
return "relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-4 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0";
|
|
3239
|
-
}
|
|
3240
|
-
return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
|
|
3241
|
-
};
|
|
3242
|
-
const getVariantProps = () => {
|
|
3243
|
-
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
3244
|
-
};
|
|
3326
|
+
const isDone = state === "done";
|
|
3327
|
+
const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
|
|
3328
|
+
const buttonLabel = isDone ? "Ver Quest\xE3o" : "Responder";
|
|
3245
3329
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3246
|
-
|
|
3330
|
+
CardBase,
|
|
3247
3331
|
{
|
|
3248
3332
|
ref,
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
"
|
|
3252
|
-
className: `
|
|
3253
|
-
focus-visible:bg-background-50
|
|
3254
|
-
${getVariantClasses()}
|
|
3255
|
-
${sizeClasses}
|
|
3256
|
-
${className}
|
|
3257
|
-
${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
3258
|
-
`,
|
|
3259
|
-
onClick: handleClick,
|
|
3260
|
-
onKeyDown: (e) => {
|
|
3261
|
-
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
3262
|
-
},
|
|
3263
|
-
tabIndex: disabled ? -1 : 0,
|
|
3333
|
+
layout: "horizontal",
|
|
3334
|
+
padding: "medium",
|
|
3335
|
+
minHeight: "medium",
|
|
3336
|
+
className: `justify-between gap-4 ${className}`,
|
|
3264
3337
|
...props,
|
|
3265
3338
|
children: [
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
|
|
3341
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row gap-6 items-center", children: [
|
|
3342
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3343
|
+
Badge_default,
|
|
3344
|
+
{
|
|
3345
|
+
size: "medium",
|
|
3346
|
+
variant: "solid",
|
|
3347
|
+
action: isDone ? "success" : "error",
|
|
3348
|
+
children: stateLabel
|
|
3349
|
+
}
|
|
3350
|
+
),
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row items-center gap-1 text-text-700 text-xs", children: [
|
|
3352
|
+
isDone ? "Nota" : "Sem nota",
|
|
3353
|
+
isDone && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge_default, { size: "medium", action: "success", children: "00" })
|
|
3354
|
+
] })
|
|
3355
|
+
] })
|
|
3356
|
+
] }),
|
|
3357
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3358
|
+
Button_default,
|
|
3359
|
+
{
|
|
3360
|
+
size: "extra-small",
|
|
3361
|
+
onClick: () => onClickButton?.(valueButton),
|
|
3362
|
+
className: "min-w-fit",
|
|
3363
|
+
children: buttonLabel
|
|
3364
|
+
}
|
|
3365
|
+
) })
|
|
3269
3366
|
]
|
|
3270
3367
|
}
|
|
3271
3368
|
);
|
|
3272
3369
|
}
|
|
3273
3370
|
);
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3371
|
+
var CardProgress = (0, import_react11.forwardRef)(
|
|
3372
|
+
({
|
|
3373
|
+
header,
|
|
3374
|
+
subhead,
|
|
3375
|
+
initialDate,
|
|
3376
|
+
endDate,
|
|
3377
|
+
progress = 0,
|
|
3378
|
+
direction = "horizontal",
|
|
3379
|
+
icon,
|
|
3380
|
+
color = "#B7DFFF",
|
|
3381
|
+
progressVariant = "blue",
|
|
3382
|
+
showDates = true,
|
|
3383
|
+
className,
|
|
3280
3384
|
...props
|
|
3281
|
-
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
}
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
}
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
}
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3385
|
+
}, ref) => {
|
|
3386
|
+
const isHorizontal = direction === "horizontal";
|
|
3387
|
+
const contentComponent = {
|
|
3388
|
+
horizontal: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
3389
|
+
showDates && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row gap-6 items-center", children: [
|
|
3390
|
+
initialDate && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
|
|
3391
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
|
|
3392
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-600", children: initialDate })
|
|
3393
|
+
] }),
|
|
3394
|
+
endDate && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
|
|
3395
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 font-semibold", children: "Fim" }),
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-600", children: endDate })
|
|
3397
|
+
] })
|
|
3398
|
+
] }),
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
3400
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3401
|
+
ProgressBar_default,
|
|
3402
|
+
{
|
|
3403
|
+
size: "small",
|
|
3404
|
+
value: progress,
|
|
3405
|
+
variant: progressVariant,
|
|
3406
|
+
"data-testid": "progress-bar"
|
|
3407
|
+
}
|
|
3408
|
+
),
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3410
|
+
Text_default,
|
|
3411
|
+
{
|
|
3412
|
+
size: "xs",
|
|
3413
|
+
weight: "medium",
|
|
3414
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none`,
|
|
3415
|
+
children: [
|
|
3416
|
+
Math.round(progress),
|
|
3417
|
+
"%"
|
|
3418
|
+
]
|
|
3419
|
+
}
|
|
3420
|
+
)
|
|
3421
|
+
] })
|
|
3422
|
+
] }),
|
|
3423
|
+
vertical: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-800", children: subhead })
|
|
3424
|
+
};
|
|
3425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3426
|
+
CardBase,
|
|
3427
|
+
{
|
|
3428
|
+
ref,
|
|
3429
|
+
layout: isHorizontal ? "horizontal" : "vertical",
|
|
3430
|
+
padding: "none",
|
|
3431
|
+
minHeight: "medium",
|
|
3432
|
+
cursor: "pointer",
|
|
3433
|
+
className: `${isHorizontal ? "h-20" : ""} ${className}`,
|
|
3434
|
+
...props,
|
|
3435
|
+
children: [
|
|
3436
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3437
|
+
"div",
|
|
3438
|
+
{
|
|
3439
|
+
className: `
|
|
3440
|
+
flex justify-center items-center [&>svg]:size-6 text-text-950
|
|
3441
|
+
${isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl"}
|
|
3442
|
+
${!color.startsWith("#") ? `bg-${color}` : ""}
|
|
3443
|
+
`,
|
|
3444
|
+
style: color.startsWith("#") ? { backgroundColor: color } : void 0,
|
|
3445
|
+
"data-testid": "icon-container",
|
|
3446
|
+
children: icon
|
|
3447
|
+
}
|
|
3448
|
+
),
|
|
3449
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3450
|
+
"div",
|
|
3451
|
+
{
|
|
3452
|
+
className: `
|
|
3453
|
+
p-4 flex flex-col justify-between w-full h-full
|
|
3454
|
+
${!isHorizontal && "gap-4"}
|
|
3455
|
+
`,
|
|
3456
|
+
children: [
|
|
3457
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
|
|
3458
|
+
contentComponent[direction]
|
|
3459
|
+
]
|
|
3460
|
+
}
|
|
3461
|
+
)
|
|
3462
|
+
]
|
|
3463
|
+
}
|
|
3464
|
+
);
|
|
3465
|
+
}
|
|
3466
|
+
);
|
|
3467
|
+
var CardTopic = (0, import_react11.forwardRef)(
|
|
3468
|
+
({
|
|
3469
|
+
header,
|
|
3470
|
+
subHead,
|
|
3471
|
+
progress,
|
|
3472
|
+
showPercentage = false,
|
|
3473
|
+
progressVariant = "blue",
|
|
3474
|
+
className = "",
|
|
3475
|
+
...props
|
|
3476
|
+
}, ref) => {
|
|
3477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3478
|
+
CardBase,
|
|
3479
|
+
{
|
|
3480
|
+
ref,
|
|
3481
|
+
layout: "vertical",
|
|
3482
|
+
padding: "small",
|
|
3483
|
+
minHeight: "medium",
|
|
3484
|
+
cursor: "pointer",
|
|
3485
|
+
className: `justify-center gap-2 py-2 px-4 ${className}`,
|
|
3486
|
+
...props,
|
|
3487
|
+
children: [
|
|
3488
|
+
subHead && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react11.Fragment, { children: [
|
|
3489
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: text }),
|
|
3490
|
+
index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: "\u2022" })
|
|
3491
|
+
] }, `${text} - ${index}`)) }),
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3495
|
+
ProgressBar_default,
|
|
3496
|
+
{
|
|
3497
|
+
size: "small",
|
|
3498
|
+
value: progress,
|
|
3499
|
+
variant: progressVariant,
|
|
3500
|
+
"data-testid": "progress-bar"
|
|
3501
|
+
}
|
|
3502
|
+
),
|
|
3503
|
+
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3504
|
+
Text_default,
|
|
3505
|
+
{
|
|
3506
|
+
size: "xs",
|
|
3507
|
+
weight: "medium",
|
|
3508
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none`,
|
|
3509
|
+
children: [
|
|
3510
|
+
Math.round(progress),
|
|
3511
|
+
"%"
|
|
3512
|
+
]
|
|
3513
|
+
}
|
|
3514
|
+
)
|
|
3515
|
+
] })
|
|
3516
|
+
]
|
|
3517
|
+
}
|
|
3518
|
+
);
|
|
3519
|
+
}
|
|
3520
|
+
);
|
|
3521
|
+
var CardPerformance = (0, import_react11.forwardRef)(
|
|
3522
|
+
({
|
|
3523
|
+
header,
|
|
3524
|
+
progress,
|
|
3525
|
+
description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
|
|
3526
|
+
actionVariant = "button",
|
|
3527
|
+
progressVariant = "blue",
|
|
3528
|
+
labelProgress = "",
|
|
3529
|
+
className = "",
|
|
3530
|
+
onClickButton,
|
|
3531
|
+
valueButton,
|
|
3532
|
+
...props
|
|
3533
|
+
}, ref) => {
|
|
3534
|
+
const hasProgress = progress !== void 0;
|
|
3535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3536
|
+
CardBase,
|
|
3537
|
+
{
|
|
3538
|
+
ref,
|
|
3539
|
+
layout: "horizontal",
|
|
3540
|
+
padding: "medium",
|
|
3541
|
+
minHeight: "none",
|
|
3542
|
+
className: `justify-between gap-2 ${actionVariant == "caret" ? "cursor-pointer" : ""} ${className}`,
|
|
3543
|
+
onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
|
|
3544
|
+
...props,
|
|
3545
|
+
children: [
|
|
3546
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full flex flex-col justify-between gap-2", children: [
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row justify-between items-center gap-2", children: [
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
3549
|
+
actionVariant === "button" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3550
|
+
Button_default,
|
|
3551
|
+
{
|
|
3552
|
+
variant: "outline",
|
|
3553
|
+
size: "extra-small",
|
|
3554
|
+
onClick: () => onClickButton?.(valueButton),
|
|
3555
|
+
className: "min-w-fit flex-shrink-0",
|
|
3556
|
+
children: "Ver Aula"
|
|
3557
|
+
}
|
|
3558
|
+
)
|
|
3559
|
+
] }),
|
|
3560
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3561
|
+
ProgressBar_default,
|
|
3562
|
+
{
|
|
3563
|
+
value: progress,
|
|
3564
|
+
label: `${progress}% ${labelProgress}`,
|
|
3565
|
+
variant: progressVariant
|
|
3566
|
+
}
|
|
3567
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-text-600 truncate", children: description }) })
|
|
3568
|
+
] }),
|
|
3569
|
+
actionVariant == "caret" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3570
|
+
import_phosphor_react10.CaretRight,
|
|
3571
|
+
{
|
|
3572
|
+
className: "size-4.5 text-text-800 cursor-pointer",
|
|
3573
|
+
"data-testid": "caret-icon"
|
|
3574
|
+
}
|
|
3575
|
+
)
|
|
3576
|
+
]
|
|
3577
|
+
}
|
|
3578
|
+
);
|
|
3579
|
+
}
|
|
3580
|
+
);
|
|
3581
|
+
var CardResults = (0, import_react11.forwardRef)(
|
|
3582
|
+
({
|
|
3583
|
+
header,
|
|
3584
|
+
correct_answers,
|
|
3585
|
+
incorrect_answers,
|
|
3586
|
+
icon,
|
|
3587
|
+
direction = "col",
|
|
3588
|
+
color = "#B7DFFF",
|
|
3589
|
+
className,
|
|
3590
|
+
...props
|
|
3591
|
+
}, ref) => {
|
|
3592
|
+
const isRow = direction == "row";
|
|
3593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3594
|
+
CardBase,
|
|
3595
|
+
{
|
|
3596
|
+
ref,
|
|
3597
|
+
layout: "horizontal",
|
|
3598
|
+
padding: "none",
|
|
3599
|
+
minHeight: "medium",
|
|
3600
|
+
className: `items-center pr-4 ${className}`,
|
|
3601
|
+
...props,
|
|
3602
|
+
children: [
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3604
|
+
"div",
|
|
3605
|
+
{
|
|
3606
|
+
className: `
|
|
3607
|
+
flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-20 h-full rounded-l-xl
|
|
3608
|
+
`,
|
|
3609
|
+
style: {
|
|
3610
|
+
backgroundColor: color
|
|
3611
|
+
},
|
|
3612
|
+
children: icon
|
|
3613
|
+
}
|
|
3614
|
+
),
|
|
3615
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3616
|
+
"div",
|
|
3617
|
+
{
|
|
3618
|
+
className: `
|
|
3619
|
+
p-4 flex justify-between w-full h-full
|
|
3620
|
+
${isRow ? "flex-row items-center gap-2" : "flex-col"}
|
|
3621
|
+
`,
|
|
3622
|
+
children: [
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center", children: [
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3626
|
+
Badge_default,
|
|
3627
|
+
{
|
|
3628
|
+
action: "success",
|
|
3629
|
+
variant: "solid",
|
|
3630
|
+
size: "medium",
|
|
3631
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CheckCircle, {}),
|
|
3632
|
+
children: [
|
|
3633
|
+
correct_answers,
|
|
3634
|
+
" Corretas"
|
|
3635
|
+
]
|
|
3636
|
+
}
|
|
3637
|
+
),
|
|
3638
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3639
|
+
Badge_default,
|
|
3640
|
+
{
|
|
3641
|
+
action: "error",
|
|
3642
|
+
variant: "solid",
|
|
3643
|
+
size: "medium",
|
|
3644
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.XCircle, {}),
|
|
3645
|
+
children: [
|
|
3646
|
+
incorrect_answers,
|
|
3647
|
+
" Incorretas"
|
|
3648
|
+
]
|
|
3649
|
+
}
|
|
3650
|
+
)
|
|
3651
|
+
] })
|
|
3652
|
+
]
|
|
3653
|
+
}
|
|
3654
|
+
),
|
|
3655
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
3656
|
+
]
|
|
3657
|
+
}
|
|
3658
|
+
);
|
|
3659
|
+
}
|
|
3660
|
+
);
|
|
3661
|
+
var CardStatus = (0, import_react11.forwardRef)(
|
|
3662
|
+
({ header, className, status, ...props }, ref) => {
|
|
3663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3664
|
+
CardBase,
|
|
3665
|
+
{
|
|
3666
|
+
ref,
|
|
3667
|
+
layout: "horizontal",
|
|
3668
|
+
padding: "medium",
|
|
3669
|
+
minHeight: "medium",
|
|
3670
|
+
className: `items-center ${className}`,
|
|
3671
|
+
...props,
|
|
3672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
3674
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
|
|
3675
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3676
|
+
Badge_default,
|
|
3677
|
+
{
|
|
3678
|
+
action: status == "correct" ? "success" : "error",
|
|
3679
|
+
variant: "solid",
|
|
3680
|
+
size: "medium",
|
|
3681
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CheckCircle, {}),
|
|
3682
|
+
children: status == "correct" ? "Correta" : "Incorreta"
|
|
3683
|
+
}
|
|
3684
|
+
),
|
|
3685
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-800", children: "Respondida" })
|
|
3686
|
+
] }),
|
|
3687
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
|
|
3688
|
+
] })
|
|
3689
|
+
}
|
|
3690
|
+
);
|
|
3691
|
+
}
|
|
3692
|
+
);
|
|
3693
|
+
var CardSettings = (0, import_react11.forwardRef)(
|
|
3694
|
+
({ header, className, icon, ...props }, ref) => {
|
|
3695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3696
|
+
CardBase,
|
|
3697
|
+
{
|
|
3698
|
+
ref,
|
|
3699
|
+
layout: "horizontal",
|
|
3700
|
+
padding: "small",
|
|
3701
|
+
minHeight: "none",
|
|
3702
|
+
className: `border-none items-center gap-2 text-text-700 ${className}`,
|
|
3703
|
+
...props,
|
|
3704
|
+
children: [
|
|
3705
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
|
|
3706
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "w-full text-sm truncate", children: header }),
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { size: 24, className: "cursor-pointer" })
|
|
3708
|
+
]
|
|
3709
|
+
}
|
|
3710
|
+
);
|
|
3711
|
+
}
|
|
3712
|
+
);
|
|
3713
|
+
var CardSupport = (0, import_react11.forwardRef)(
|
|
3714
|
+
({ header, className, direction = "col", children, ...props }, ref) => {
|
|
3715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3716
|
+
CardBase,
|
|
3717
|
+
{
|
|
3718
|
+
ref,
|
|
3719
|
+
layout: "horizontal",
|
|
3720
|
+
padding: "medium",
|
|
3721
|
+
minHeight: "none",
|
|
3722
|
+
className: `border-none items-center gap-2 text-text-700 ${className}`,
|
|
3723
|
+
...props,
|
|
3724
|
+
children: [
|
|
3725
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3726
|
+
"div",
|
|
3727
|
+
{
|
|
3728
|
+
className: `
|
|
3729
|
+
w-full flex ${direction == "col" ? "flex-col" : "flex-row items-center"} gap-2
|
|
3730
|
+
`,
|
|
3731
|
+
children: [
|
|
3732
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
|
|
3733
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex flex-row gap-1", children })
|
|
3734
|
+
]
|
|
3735
|
+
}
|
|
3736
|
+
),
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
|
|
3738
|
+
]
|
|
3739
|
+
}
|
|
3740
|
+
);
|
|
3741
|
+
}
|
|
3742
|
+
);
|
|
3743
|
+
var CardForum = (0, import_react11.forwardRef)(
|
|
3744
|
+
({
|
|
3745
|
+
title,
|
|
3746
|
+
content,
|
|
3747
|
+
comments,
|
|
3748
|
+
onClickComments,
|
|
3749
|
+
valueComments,
|
|
3750
|
+
onClickProfile,
|
|
3751
|
+
valueProfile,
|
|
3752
|
+
className = "",
|
|
3753
|
+
date,
|
|
3754
|
+
hour,
|
|
3755
|
+
...props
|
|
3756
|
+
}, ref) => {
|
|
3757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3758
|
+
CardBase,
|
|
3759
|
+
{
|
|
3760
|
+
ref,
|
|
3761
|
+
layout: "horizontal",
|
|
3762
|
+
padding: "medium",
|
|
3763
|
+
minHeight: "none",
|
|
3764
|
+
variant: "minimal",
|
|
3765
|
+
className: `w-auto h-auto gap-3 ${className}`,
|
|
3766
|
+
...props,
|
|
3767
|
+
children: [
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3769
|
+
"button",
|
|
3770
|
+
{
|
|
3771
|
+
type: "button",
|
|
3772
|
+
"aria-label": "Ver perfil",
|
|
3773
|
+
onClick: () => onClickProfile?.(valueProfile),
|
|
3774
|
+
className: "min-w-8 h-8 rounded-full bg-background-950"
|
|
3775
|
+
}
|
|
3776
|
+
),
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
|
|
3780
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "text-xs text-text-600", children: [
|
|
3781
|
+
"\u2022 ",
|
|
3782
|
+
date,
|
|
3783
|
+
" \u2022 ",
|
|
3784
|
+
hour
|
|
3785
|
+
] })
|
|
3786
|
+
] }),
|
|
3787
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
|
|
3788
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3789
|
+
"button",
|
|
3790
|
+
{
|
|
3791
|
+
type: "button",
|
|
3792
|
+
"aria-label": "Ver coment\xE1rios",
|
|
3793
|
+
onClick: () => onClickComments?.(valueComments),
|
|
3794
|
+
className: "text-text-600 flex flex-row gap-2 items-center",
|
|
3795
|
+
children: [
|
|
3796
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.ChatCircleText, { "aria-hidden": "true", size: 16 }),
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "text-xs", children: [
|
|
3798
|
+
comments,
|
|
3799
|
+
" respostas"
|
|
3800
|
+
] })
|
|
3801
|
+
]
|
|
3802
|
+
}
|
|
3803
|
+
)
|
|
3804
|
+
] })
|
|
3805
|
+
]
|
|
3806
|
+
}
|
|
3426
3807
|
);
|
|
3427
3808
|
}
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3809
|
+
);
|
|
3810
|
+
var CardAudio = (0, import_react11.forwardRef)(
|
|
3811
|
+
({
|
|
3812
|
+
src,
|
|
3813
|
+
title,
|
|
3814
|
+
onPlay,
|
|
3815
|
+
onPause,
|
|
3816
|
+
onEnded,
|
|
3817
|
+
onAudioTimeUpdate,
|
|
3818
|
+
loop = false,
|
|
3819
|
+
preload = "metadata",
|
|
3820
|
+
tracks,
|
|
3821
|
+
className,
|
|
3822
|
+
...props
|
|
3823
|
+
}, ref) => {
|
|
3824
|
+
const [isPlaying, setIsPlaying] = (0, import_react11.useState)(false);
|
|
3825
|
+
const [currentTime, setCurrentTime] = (0, import_react11.useState)(0);
|
|
3826
|
+
const [duration, setDuration] = (0, import_react11.useState)(0);
|
|
3827
|
+
const [volume, setVolume] = (0, import_react11.useState)(1);
|
|
3828
|
+
const [showVolumeControl, setShowVolumeControl] = (0, import_react11.useState)(false);
|
|
3829
|
+
const audioRef = (0, import_react11.useRef)(null);
|
|
3830
|
+
const formatTime = (time) => {
|
|
3831
|
+
const minutes = Math.floor(time / 60);
|
|
3832
|
+
const seconds = Math.floor(time % 60);
|
|
3833
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
3834
|
+
};
|
|
3835
|
+
const handlePlayPause = () => {
|
|
3836
|
+
if (isPlaying) {
|
|
3837
|
+
audioRef.current?.pause();
|
|
3838
|
+
setIsPlaying(false);
|
|
3839
|
+
onPause?.();
|
|
3840
|
+
} else {
|
|
3841
|
+
audioRef.current?.play();
|
|
3842
|
+
setIsPlaying(true);
|
|
3843
|
+
onPlay?.();
|
|
3456
3844
|
}
|
|
3457
|
-
return (0, import_react12.cloneElement)(typedChild, newProps);
|
|
3458
|
-
}
|
|
3459
|
-
return child;
|
|
3460
|
-
});
|
|
3461
|
-
};
|
|
3462
|
-
var Select = ({
|
|
3463
|
-
children,
|
|
3464
|
-
defaultValue = "",
|
|
3465
|
-
value: propValue,
|
|
3466
|
-
onValueChange,
|
|
3467
|
-
size = "small",
|
|
3468
|
-
label,
|
|
3469
|
-
helperText,
|
|
3470
|
-
errorMessage,
|
|
3471
|
-
id
|
|
3472
|
-
}) => {
|
|
3473
|
-
const storeRef = (0, import_react12.useRef)(null);
|
|
3474
|
-
storeRef.current ??= createSelectStore(onValueChange);
|
|
3475
|
-
const store = storeRef.current;
|
|
3476
|
-
const selectRef = (0, import_react12.useRef)(null);
|
|
3477
|
-
const { open, setOpen, setValue, selectedLabel } = (0, import_zustand3.useStore)(store, (s) => s);
|
|
3478
|
-
const generatedId = (0, import_react12.useId)();
|
|
3479
|
-
const selectId = id ?? `select-${generatedId}`;
|
|
3480
|
-
const findLabelForValue = (children2, targetValue) => {
|
|
3481
|
-
let found = null;
|
|
3482
|
-
const search = (nodes) => {
|
|
3483
|
-
import_react12.Children.forEach(nodes, (child) => {
|
|
3484
|
-
if (!(0, import_react12.isValidElement)(child)) return;
|
|
3485
|
-
const typedChild = child;
|
|
3486
|
-
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
3487
|
-
if (typeof typedChild.props.children === "string")
|
|
3488
|
-
found = typedChild.props.children;
|
|
3489
|
-
}
|
|
3490
|
-
if (typedChild.props.children && !found)
|
|
3491
|
-
search(typedChild.props.children);
|
|
3492
|
-
});
|
|
3493
3845
|
};
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
const
|
|
3505
|
-
|
|
3506
|
-
|
|
3846
|
+
const handleTimeUpdate = () => {
|
|
3847
|
+
const current = audioRef.current?.currentTime ?? 0;
|
|
3848
|
+
const total = audioRef.current?.duration ?? 0;
|
|
3849
|
+
setCurrentTime(current);
|
|
3850
|
+
setDuration(total);
|
|
3851
|
+
onAudioTimeUpdate?.(current, total);
|
|
3852
|
+
};
|
|
3853
|
+
const handleLoadedMetadata = () => {
|
|
3854
|
+
setDuration(audioRef.current?.duration ?? 0);
|
|
3855
|
+
};
|
|
3856
|
+
const handleEnded = () => {
|
|
3857
|
+
setIsPlaying(false);
|
|
3858
|
+
setCurrentTime(0);
|
|
3859
|
+
onEnded?.();
|
|
3860
|
+
};
|
|
3861
|
+
const handleProgressClick = (e) => {
|
|
3862
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
3863
|
+
const clickX = e.clientX - rect.left;
|
|
3864
|
+
const width = rect.width;
|
|
3865
|
+
const percentage = clickX / width;
|
|
3866
|
+
const newTime = percentage * duration;
|
|
3867
|
+
if (audioRef.current) {
|
|
3868
|
+
audioRef.current.currentTime = newTime;
|
|
3507
3869
|
}
|
|
3870
|
+
setCurrentTime(newTime);
|
|
3508
3871
|
};
|
|
3509
|
-
const
|
|
3510
|
-
const
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
selectContent.querySelectorAll(
|
|
3515
|
-
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
3516
|
-
)
|
|
3517
|
-
).filter((el) => el instanceof HTMLElement);
|
|
3518
|
-
const focused = document.activeElement;
|
|
3519
|
-
const currentIndex = items.findIndex((item) => item === focused);
|
|
3520
|
-
let nextIndex = 0;
|
|
3521
|
-
if (event.key === "ArrowDown") {
|
|
3522
|
-
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
3523
|
-
} else {
|
|
3524
|
-
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
3525
|
-
}
|
|
3526
|
-
items[nextIndex]?.focus();
|
|
3872
|
+
const handleVolumeChange = (e) => {
|
|
3873
|
+
const newVolume = parseFloat(e.target.value);
|
|
3874
|
+
setVolume(newVolume);
|
|
3875
|
+
if (audioRef.current) {
|
|
3876
|
+
audioRef.current.volume = newVolume;
|
|
3527
3877
|
}
|
|
3528
3878
|
};
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
document.addEventListener("keydown", handleArrowKeys);
|
|
3532
|
-
}
|
|
3533
|
-
return () => {
|
|
3534
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
3535
|
-
document.removeEventListener("keydown", handleArrowKeys);
|
|
3879
|
+
const toggleVolumeControl = () => {
|
|
3880
|
+
setShowVolumeControl(!showVolumeControl);
|
|
3536
3881
|
};
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
setValue(propValue);
|
|
3541
|
-
const label2 = findLabelForValue(children, propValue);
|
|
3542
|
-
if (label2) store.setState({ selectedLabel: label2 });
|
|
3543
|
-
}
|
|
3544
|
-
}, [propValue]);
|
|
3545
|
-
const sizeClasses = SIZE_CLASSES11[size];
|
|
3546
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "w-full", children: [
|
|
3547
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3548
|
-
"label",
|
|
3549
|
-
{
|
|
3550
|
-
htmlFor: selectId,
|
|
3551
|
-
className: `block font-bold text-text-900 mb-1.5 ${sizeClasses}`,
|
|
3552
|
-
children: label
|
|
3882
|
+
const getVolumeIcon = () => {
|
|
3883
|
+
if (volume === 0) {
|
|
3884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.SpeakerSimpleX, {});
|
|
3553
3885
|
}
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
errorMessage
|
|
3562
|
-
] })
|
|
3563
|
-
] })
|
|
3564
|
-
] });
|
|
3565
|
-
};
|
|
3566
|
-
var SelectValue = ({
|
|
3567
|
-
placeholder,
|
|
3568
|
-
store: externalStore
|
|
3569
|
-
}) => {
|
|
3570
|
-
const store = useSelectStore(externalStore);
|
|
3571
|
-
const selectedLabel = (0, import_zustand3.useStore)(store, (s) => s.selectedLabel);
|
|
3572
|
-
const value = (0, import_zustand3.useStore)(store, (s) => s.value);
|
|
3573
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
|
|
3574
|
-
};
|
|
3575
|
-
var SelectTrigger = (0, import_react12.forwardRef)(
|
|
3576
|
-
({
|
|
3577
|
-
className,
|
|
3578
|
-
invalid = false,
|
|
3579
|
-
variant = "outlined",
|
|
3580
|
-
store: externalStore,
|
|
3581
|
-
disabled,
|
|
3582
|
-
size = "medium",
|
|
3583
|
-
selectId,
|
|
3584
|
-
...props
|
|
3585
|
-
}, ref) => {
|
|
3586
|
-
const store = useSelectStore(externalStore);
|
|
3587
|
-
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
3588
|
-
const toggleOpen = () => store.setState({ open: !open });
|
|
3589
|
-
const variantClasses = VARIANT_CLASSES4[variant];
|
|
3590
|
-
const heightClasses = HEIGHT_CLASSES[size];
|
|
3591
|
-
const paddingClasses = PADDING_CLASSES[size];
|
|
3592
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3593
|
-
"button",
|
|
3886
|
+
if (volume < 0.5) {
|
|
3887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.SpeakerLow, {});
|
|
3888
|
+
}
|
|
3889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.SpeakerHigh, {});
|
|
3890
|
+
};
|
|
3891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3892
|
+
CardBase,
|
|
3594
3893
|
{
|
|
3595
3894
|
ref,
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
${invalid && `${variant == "underlined" ? "border-b-2" : "border-2"} border-indicator-error text-text-600`}
|
|
3601
|
-
${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
3602
|
-
${!invalid && !disabled ? "text-text-700" : ""}
|
|
3603
|
-
${variantClasses}
|
|
3604
|
-
${className}
|
|
3605
|
-
`,
|
|
3606
|
-
onClick: toggleOpen,
|
|
3607
|
-
"aria-expanded": open,
|
|
3608
|
-
"aria-haspopup": "listbox",
|
|
3609
|
-
"aria-controls": open ? "select-content" : void 0,
|
|
3895
|
+
layout: "horizontal",
|
|
3896
|
+
padding: "medium",
|
|
3897
|
+
minHeight: "none",
|
|
3898
|
+
className: `w-auto h-14 items-center gap-2 ${className}`,
|
|
3610
3899
|
...props,
|
|
3611
3900
|
children: [
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3902
|
+
"audio",
|
|
3903
|
+
{
|
|
3904
|
+
ref: audioRef,
|
|
3905
|
+
src,
|
|
3906
|
+
loop,
|
|
3907
|
+
preload,
|
|
3908
|
+
onTimeUpdate: handleTimeUpdate,
|
|
3909
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
3910
|
+
onEnded: handleEnded,
|
|
3911
|
+
"data-testid": "audio-element",
|
|
3912
|
+
"aria-label": title,
|
|
3913
|
+
children: tracks ? tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3914
|
+
"track",
|
|
3915
|
+
{
|
|
3916
|
+
kind: track.kind,
|
|
3917
|
+
src: track.src,
|
|
3918
|
+
srcLang: track.srcLang,
|
|
3919
|
+
label: track.label,
|
|
3920
|
+
default: track.default
|
|
3921
|
+
},
|
|
3922
|
+
track.src
|
|
3923
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3924
|
+
"track",
|
|
3925
|
+
{
|
|
3926
|
+
kind: "captions",
|
|
3927
|
+
src: "data:text/vtt;base64,",
|
|
3928
|
+
srcLang: "pt",
|
|
3929
|
+
label: "Sem legendas dispon\xEDveis"
|
|
3930
|
+
}
|
|
3931
|
+
)
|
|
3932
|
+
}
|
|
3933
|
+
),
|
|
3934
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3935
|
+
"button",
|
|
3615
3936
|
{
|
|
3616
|
-
|
|
3937
|
+
type: "button",
|
|
3938
|
+
onClick: handlePlayPause,
|
|
3939
|
+
disabled: !src,
|
|
3940
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
|
|
3941
|
+
"aria-label": isPlaying ? "Pausar" : "Reproduzir",
|
|
3942
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-0.5", children: [
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
|
|
3944
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
|
|
3945
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Play, { size: 24 })
|
|
3946
|
+
}
|
|
3947
|
+
),
|
|
3948
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
|
|
3949
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3950
|
+
"button",
|
|
3951
|
+
{
|
|
3952
|
+
type: "button",
|
|
3953
|
+
className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
|
|
3954
|
+
onClick: handleProgressClick,
|
|
3955
|
+
onKeyDown: (e) => {
|
|
3956
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3957
|
+
e.preventDefault();
|
|
3958
|
+
handleProgressClick(
|
|
3959
|
+
e
|
|
3960
|
+
);
|
|
3961
|
+
}
|
|
3962
|
+
},
|
|
3963
|
+
"aria-label": "Barra de progresso do \xE1udio",
|
|
3964
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3965
|
+
"div",
|
|
3966
|
+
{
|
|
3967
|
+
className: "h-full bg-primary-600 rounded-full transition-all duration-100",
|
|
3968
|
+
style: {
|
|
3969
|
+
width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
)
|
|
3973
|
+
}
|
|
3974
|
+
) }),
|
|
3975
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(duration) }),
|
|
3976
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", children: [
|
|
3977
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3978
|
+
"button",
|
|
3979
|
+
{
|
|
3980
|
+
type: "button",
|
|
3981
|
+
onClick: toggleVolumeControl,
|
|
3982
|
+
className: "cursor-pointer text-text-950 hover:text-primary-600",
|
|
3983
|
+
"aria-label": "Controle de volume",
|
|
3984
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
|
|
3985
|
+
}
|
|
3986
|
+
),
|
|
3987
|
+
showVolumeControl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3988
|
+
"button",
|
|
3989
|
+
{
|
|
3990
|
+
type: "button",
|
|
3991
|
+
className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
3992
|
+
onKeyDown: (e) => {
|
|
3993
|
+
if (e.key === "Escape") {
|
|
3994
|
+
setShowVolumeControl(false);
|
|
3995
|
+
}
|
|
3996
|
+
},
|
|
3997
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3998
|
+
"input",
|
|
3999
|
+
{
|
|
4000
|
+
type: "range",
|
|
4001
|
+
min: "0",
|
|
4002
|
+
max: "1",
|
|
4003
|
+
step: "0.1",
|
|
4004
|
+
value: volume,
|
|
4005
|
+
onChange: handleVolumeChange,
|
|
4006
|
+
onKeyDown: (e) => {
|
|
4007
|
+
if (e.key === "ArrowUp" || e.key === "ArrowRight") {
|
|
4008
|
+
e.preventDefault();
|
|
4009
|
+
const newVolume = Math.min(
|
|
4010
|
+
1,
|
|
4011
|
+
Math.round((volume + 0.1) * 10) / 10
|
|
4012
|
+
);
|
|
4013
|
+
setVolume(newVolume);
|
|
4014
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
4015
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
|
|
4016
|
+
e.preventDefault();
|
|
4017
|
+
const newVolume = Math.max(
|
|
4018
|
+
0,
|
|
4019
|
+
Math.round((volume - 0.1) * 10) / 10
|
|
4020
|
+
);
|
|
4021
|
+
setVolume(newVolume);
|
|
4022
|
+
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
4023
|
+
}
|
|
4024
|
+
},
|
|
4025
|
+
className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
|
|
4026
|
+
style: {
|
|
4027
|
+
background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
|
|
4028
|
+
},
|
|
4029
|
+
"aria-label": "Volume",
|
|
4030
|
+
"aria-valuenow": Math.round(volume * 100),
|
|
4031
|
+
"aria-valuemin": 0,
|
|
4032
|
+
"aria-valuemax": 100
|
|
4033
|
+
}
|
|
4034
|
+
)
|
|
4035
|
+
}
|
|
4036
|
+
)
|
|
4037
|
+
] }),
|
|
4038
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4039
|
+
import_phosphor_react10.DotsThreeVertical,
|
|
4040
|
+
{
|
|
4041
|
+
size: 24,
|
|
4042
|
+
className: "text-text-950 cursor-pointer hover:text-primary-600"
|
|
3617
4043
|
}
|
|
3618
4044
|
)
|
|
3619
4045
|
]
|
|
@@ -3621,776 +4047,1095 @@ var SelectTrigger = (0, import_react12.forwardRef)(
|
|
|
3621
4047
|
);
|
|
3622
4048
|
}
|
|
3623
4049
|
);
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
3636
|
-
if (!open) return null;
|
|
3637
|
-
const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES2[side]} ${ALIGN_CLASSES2[align]}`;
|
|
3638
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3639
|
-
"div",
|
|
4050
|
+
var SIMULADO_BACKGROUND_CLASSES = {
|
|
4051
|
+
enem: "bg-exam-1",
|
|
4052
|
+
prova: "bg-exam-2",
|
|
4053
|
+
simuladao: "bg-exam-3",
|
|
4054
|
+
vestibular: "bg-exam-4"
|
|
4055
|
+
};
|
|
4056
|
+
var CardSimulado = (0, import_react11.forwardRef)(
|
|
4057
|
+
({ title, duration, info, backgroundColor, className, ...props }, ref) => {
|
|
4058
|
+
const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
|
|
4059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4060
|
+
CardBase,
|
|
3640
4061
|
{
|
|
3641
|
-
role: "menu",
|
|
3642
4062
|
ref,
|
|
3643
|
-
|
|
4063
|
+
layout: "horizontal",
|
|
4064
|
+
padding: "medium",
|
|
4065
|
+
minHeight: "none",
|
|
4066
|
+
cursor: "pointer",
|
|
4067
|
+
className: `${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200 ${className}`,
|
|
3644
4068
|
...props,
|
|
3645
|
-
children
|
|
4069
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between items-center w-full gap-4", children: [
|
|
4070
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
|
|
4071
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
|
|
4072
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-4 text-text-700", children: [
|
|
4073
|
+
duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4074
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Clock, { size: 16, className: "flex-shrink-0" }),
|
|
4075
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "sm", children: duration })
|
|
4076
|
+
] }),
|
|
4077
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "sm", className: "truncate", children: info })
|
|
4078
|
+
] })
|
|
4079
|
+
] }),
|
|
4080
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4081
|
+
import_phosphor_react10.CaretRight,
|
|
4082
|
+
{
|
|
4083
|
+
size: 24,
|
|
4084
|
+
className: "text-text-800 flex-shrink-0",
|
|
4085
|
+
"data-testid": "caret-icon"
|
|
4086
|
+
}
|
|
4087
|
+
)
|
|
4088
|
+
] })
|
|
3646
4089
|
}
|
|
3647
4090
|
);
|
|
3648
4091
|
}
|
|
3649
4092
|
);
|
|
3650
|
-
|
|
3651
|
-
|
|
4093
|
+
|
|
4094
|
+
// src/components/Accordation/Accordation.tsx
|
|
4095
|
+
var import_phosphor_react11 = require("phosphor-react");
|
|
4096
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4097
|
+
var CardAccordation = (0, import_react12.forwardRef)(
|
|
3652
4098
|
({
|
|
3653
|
-
|
|
4099
|
+
title,
|
|
3654
4100
|
children,
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
4101
|
+
className,
|
|
4102
|
+
defaultExpanded = false,
|
|
4103
|
+
onToggleExpanded,
|
|
3658
4104
|
...props
|
|
3659
4105
|
}, ref) => {
|
|
3660
|
-
const
|
|
3661
|
-
const
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
onValueChange
|
|
3667
|
-
} = (0, import_zustand3.useStore)(store, (s) => s);
|
|
3668
|
-
const handleClick = (e) => {
|
|
3669
|
-
const labelNode = getLabelAsNode(children);
|
|
3670
|
-
if (!disabled) {
|
|
3671
|
-
setValue(value);
|
|
3672
|
-
setSelectedLabel(labelNode);
|
|
3673
|
-
setOpen(false);
|
|
3674
|
-
onValueChange?.(value);
|
|
3675
|
-
}
|
|
3676
|
-
props.onClick?.(e);
|
|
4106
|
+
const [isExpanded, setIsExpanded] = (0, import_react12.useState)(defaultExpanded);
|
|
4107
|
+
const contentId = (0, import_react12.useId)();
|
|
4108
|
+
const handleToggle = () => {
|
|
4109
|
+
const newExpanded = !isExpanded;
|
|
4110
|
+
setIsExpanded(newExpanded);
|
|
4111
|
+
onToggleExpanded?.(newExpanded);
|
|
3677
4112
|
};
|
|
3678
4113
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3679
|
-
|
|
4114
|
+
CardBase,
|
|
3680
4115
|
{
|
|
3681
|
-
role: "menuitem",
|
|
3682
|
-
"aria-disabled": disabled,
|
|
3683
4116
|
ref,
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
3689
|
-
${selectedValue === value && "bg-background-50"}
|
|
3690
|
-
`,
|
|
3691
|
-
onClick: handleClick,
|
|
3692
|
-
onKeyDown: (e) => {
|
|
3693
|
-
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
3694
|
-
},
|
|
3695
|
-
tabIndex: disabled ? -1 : 0,
|
|
4117
|
+
layout: "vertical",
|
|
4118
|
+
padding: "none",
|
|
4119
|
+
minHeight: "none",
|
|
4120
|
+
className: `overflow-hidden ${className}`,
|
|
3696
4121
|
...props,
|
|
3697
4122
|
children: [
|
|
3698
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.
|
|
3699
|
-
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4124
|
+
"button",
|
|
4125
|
+
{
|
|
4126
|
+
onClick: handleToggle,
|
|
4127
|
+
className: "w-full cursor-pointer p-4 flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-inset",
|
|
4128
|
+
"aria-expanded": isExpanded,
|
|
4129
|
+
"aria-controls": "accordion-content",
|
|
4130
|
+
children: [
|
|
4131
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4132
|
+
Text_default,
|
|
4133
|
+
{
|
|
4134
|
+
size: "sm",
|
|
4135
|
+
weight: "bold",
|
|
4136
|
+
className: "text-text-950 truncate flex-1",
|
|
4137
|
+
children: title
|
|
4138
|
+
}
|
|
4139
|
+
),
|
|
4140
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4141
|
+
import_phosphor_react11.CaretRight,
|
|
4142
|
+
{
|
|
4143
|
+
size: 20,
|
|
4144
|
+
className: `text-text-700 transition-transform duration-200 flex-shrink-0 ${isExpanded ? "rotate-90" : "rotate-0"}`,
|
|
4145
|
+
"data-testid": "accordion-caret"
|
|
4146
|
+
}
|
|
4147
|
+
)
|
|
4148
|
+
]
|
|
4149
|
+
}
|
|
4150
|
+
),
|
|
4151
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4152
|
+
"div",
|
|
4153
|
+
{
|
|
4154
|
+
id: contentId,
|
|
4155
|
+
className: `transition-all duration-300 ease-in-out overflow-hidden ${isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"}`,
|
|
4156
|
+
"data-testid": "accordion-content",
|
|
4157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "p-4 pt-0 border-border-50", children })
|
|
4158
|
+
}
|
|
4159
|
+
)
|
|
3700
4160
|
]
|
|
3701
4161
|
}
|
|
3702
4162
|
);
|
|
3703
4163
|
}
|
|
3704
4164
|
);
|
|
3705
|
-
SelectItem.displayName = "SelectItem";
|
|
3706
|
-
var Select_default = Select;
|
|
3707
4165
|
|
|
3708
|
-
// src/components/
|
|
3709
|
-
var import_zustand4 = require("zustand");
|
|
3710
|
-
var import_react13 = require("react");
|
|
4166
|
+
// src/components/Alternative/Alternative.tsx
|
|
3711
4167
|
var import_phosphor_react12 = require("phosphor-react");
|
|
4168
|
+
var import_react13 = require("react");
|
|
3712
4169
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3713
|
-
var
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
4170
|
+
var AlternativesList = ({
|
|
4171
|
+
alternatives,
|
|
4172
|
+
name,
|
|
4173
|
+
defaultValue,
|
|
4174
|
+
value,
|
|
4175
|
+
onValueChange,
|
|
4176
|
+
disabled = false,
|
|
4177
|
+
layout = "default",
|
|
4178
|
+
className = "",
|
|
4179
|
+
mode = "interactive",
|
|
4180
|
+
selectedValue
|
|
4181
|
+
}) => {
|
|
4182
|
+
const uniqueId = (0, import_react13.useId)();
|
|
4183
|
+
const groupName = name || `alternatives-${uniqueId}`;
|
|
4184
|
+
const isReadonly = mode === "readonly";
|
|
4185
|
+
const getStatusStyles = (status, isReadonly2) => {
|
|
4186
|
+
const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
|
|
4187
|
+
switch (status) {
|
|
4188
|
+
case "correct":
|
|
4189
|
+
return "bg-success-background border-success-300";
|
|
4190
|
+
case "incorrect":
|
|
4191
|
+
return "bg-error-background border-error-300";
|
|
4192
|
+
default:
|
|
4193
|
+
return `bg-background border-border-100 ${hoverClass}`;
|
|
4194
|
+
}
|
|
4195
|
+
};
|
|
4196
|
+
const getStatusBadge = (status) => {
|
|
4197
|
+
switch (status) {
|
|
4198
|
+
case "correct":
|
|
4199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_phosphor_react12.CheckCircle, {}), children: "Resposta correta" });
|
|
4200
|
+
case "incorrect":
|
|
4201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_phosphor_react12.XCircle, {}), children: "Resposta incorreta" });
|
|
4202
|
+
default:
|
|
4203
|
+
return null;
|
|
4204
|
+
}
|
|
4205
|
+
};
|
|
4206
|
+
const getLayoutClasses = () => {
|
|
4207
|
+
switch (layout) {
|
|
4208
|
+
case "compact":
|
|
4209
|
+
return "gap-2";
|
|
4210
|
+
case "detailed":
|
|
4211
|
+
return "gap-4";
|
|
4212
|
+
default:
|
|
4213
|
+
return "gap-3.5";
|
|
4214
|
+
}
|
|
4215
|
+
};
|
|
4216
|
+
const renderReadonlyAlternative = (alternative) => {
|
|
4217
|
+
const alternativeId = alternative.value;
|
|
4218
|
+
const isUserSelected = selectedValue === alternative.value;
|
|
4219
|
+
const isCorrectAnswer = alternative.status === "correct";
|
|
4220
|
+
let displayStatus = void 0;
|
|
4221
|
+
if (isUserSelected && !isCorrectAnswer) {
|
|
4222
|
+
displayStatus = "incorrect";
|
|
4223
|
+
} else if (isCorrectAnswer) {
|
|
4224
|
+
displayStatus = "correct";
|
|
4225
|
+
}
|
|
4226
|
+
const statusStyles = getStatusStyles(displayStatus, true);
|
|
4227
|
+
const statusBadge = getStatusBadge(displayStatus);
|
|
4228
|
+
const renderRadio = () => {
|
|
4229
|
+
const radioClasses = `w-6 h-6 rounded-full border-2 cursor-default transition-all duration-200 flex items-center justify-center ${isUserSelected ? "border-primary-950 bg-background" : "border-border-400 bg-background"}`;
|
|
4230
|
+
const dotClasses = "w-3 h-3 rounded-full bg-primary-950 transition-all duration-200";
|
|
4231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: radioClasses, children: isUserSelected && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: dotClasses }) });
|
|
4232
|
+
};
|
|
4233
|
+
if (layout === "detailed") {
|
|
4234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4235
|
+
"div",
|
|
4236
|
+
{
|
|
4237
|
+
className: `border-2 rounded-lg p-4 w-full ${statusStyles} ${alternative.disabled ? "opacity-50" : ""}`,
|
|
4238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
4239
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
4240
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mt-1", children: renderRadio() }),
|
|
4241
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1", children: [
|
|
4242
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "block font-medium text-text-950", children: alternative.label }),
|
|
4243
|
+
alternative.description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
|
|
4244
|
+
] })
|
|
4245
|
+
] }),
|
|
4246
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
4247
|
+
] })
|
|
4248
|
+
},
|
|
4249
|
+
alternativeId
|
|
4250
|
+
);
|
|
4251
|
+
}
|
|
4252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4253
|
+
"div",
|
|
4254
|
+
{
|
|
4255
|
+
className: `flex flex-row justify-between items-start gap-2 p-2 rounded-lg w-full ${statusStyles} ${alternative.disabled ? "opacity-50" : ""}`,
|
|
4256
|
+
children: [
|
|
4257
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
4258
|
+
renderRadio(),
|
|
4259
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "flex-1", children: alternative.label })
|
|
4260
|
+
] }),
|
|
4261
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
4262
|
+
]
|
|
4263
|
+
},
|
|
4264
|
+
alternativeId
|
|
4265
|
+
);
|
|
4266
|
+
};
|
|
4267
|
+
if (isReadonly) {
|
|
3749
4268
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3750
4269
|
"div",
|
|
3751
4270
|
{
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
${className ?? ""}
|
|
3757
|
-
`,
|
|
3758
|
-
...props,
|
|
3759
|
-
children: injectStore3(children, store)
|
|
4271
|
+
className: `flex flex-col ${getLayoutClasses()} w-full ${className}`,
|
|
4272
|
+
children: alternatives.map(
|
|
4273
|
+
(alternative) => renderReadonlyAlternative(alternative)
|
|
4274
|
+
)
|
|
3760
4275
|
}
|
|
3761
4276
|
);
|
|
3762
4277
|
}
|
|
3763
|
-
)
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
4278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4279
|
+
RadioGroup,
|
|
4280
|
+
{
|
|
4281
|
+
name: groupName,
|
|
4282
|
+
defaultValue,
|
|
4283
|
+
value,
|
|
4284
|
+
onValueChange,
|
|
4285
|
+
disabled,
|
|
4286
|
+
className: `flex flex-col ${getLayoutClasses()} ${className}`,
|
|
4287
|
+
children: alternatives.map((alternative, index) => {
|
|
4288
|
+
const alternativeId = alternative.value || `alt-${index}`;
|
|
4289
|
+
const statusStyles = getStatusStyles(alternative.status, false);
|
|
4290
|
+
const statusBadge = getStatusBadge(alternative.status);
|
|
4291
|
+
if (layout === "detailed") {
|
|
4292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4293
|
+
"div",
|
|
4294
|
+
{
|
|
4295
|
+
className: `border-2 rounded-lg p-4 transition-all ${statusStyles} ${alternative.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
|
|
4296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
4297
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4299
|
+
RadioGroupItem,
|
|
4300
|
+
{
|
|
4301
|
+
value: alternative.value,
|
|
4302
|
+
id: alternativeId,
|
|
4303
|
+
disabled: alternative.disabled,
|
|
4304
|
+
className: "mt-1"
|
|
4305
|
+
}
|
|
4306
|
+
),
|
|
4307
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1", children: [
|
|
4308
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4309
|
+
"label",
|
|
4310
|
+
{
|
|
4311
|
+
htmlFor: alternativeId,
|
|
4312
|
+
className: `block font-medium text-text-950 ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
|
|
4313
|
+
children: alternative.label
|
|
4314
|
+
}
|
|
4315
|
+
),
|
|
4316
|
+
alternative.description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
|
|
4317
|
+
] })
|
|
4318
|
+
] }),
|
|
4319
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
4320
|
+
] })
|
|
4321
|
+
},
|
|
4322
|
+
alternativeId
|
|
4323
|
+
);
|
|
4324
|
+
}
|
|
4325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4326
|
+
"div",
|
|
4327
|
+
{
|
|
4328
|
+
className: `flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all ${statusStyles} ${alternative.disabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
4329
|
+
children: [
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
4331
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4332
|
+
RadioGroupItem,
|
|
4333
|
+
{
|
|
4334
|
+
value: alternative.value,
|
|
4335
|
+
id: alternativeId,
|
|
4336
|
+
disabled: alternative.disabled
|
|
4337
|
+
}
|
|
4338
|
+
),
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4340
|
+
"label",
|
|
4341
|
+
{
|
|
4342
|
+
htmlFor: alternativeId,
|
|
4343
|
+
className: `flex-1 ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
|
|
4344
|
+
children: alternative.label
|
|
4345
|
+
}
|
|
4346
|
+
)
|
|
4347
|
+
] }),
|
|
4348
|
+
statusBadge && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
|
|
4349
|
+
]
|
|
4350
|
+
},
|
|
4351
|
+
alternativeId
|
|
4352
|
+
);
|
|
4353
|
+
})
|
|
4354
|
+
}
|
|
4355
|
+
);
|
|
4356
|
+
};
|
|
4357
|
+
var HeaderAlternative = (0, import_react13.forwardRef)(
|
|
4358
|
+
({ className, title, subTitle, content, ...props }, ref) => {
|
|
4359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4360
|
+
"div",
|
|
3771
4361
|
{
|
|
3772
4362
|
ref,
|
|
3773
|
-
className: `
|
|
3774
|
-
${baseClasses}
|
|
3775
|
-
${variantClasses}
|
|
3776
|
-
${variant == "breadcrumb" ? "flex-wrap" : ""}
|
|
3777
|
-
${className ?? ""}
|
|
3778
|
-
`,
|
|
3779
|
-
style: variant === "menu2" ? { scrollbarWidth: "none", msOverflowStyle: "none" } : void 0,
|
|
4363
|
+
className: `bg-background p-4 flex flex-col gap-4 rounded-xl ${className}`,
|
|
3780
4364
|
...props,
|
|
3781
|
-
children
|
|
4365
|
+
children: [
|
|
4366
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex flex-col", children: [
|
|
4367
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-text-950 font-bold text-lg", children: title }),
|
|
4368
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-text-700 text-sm ", children: subTitle })
|
|
4369
|
+
] }),
|
|
4370
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-text-950 text-md", children: content })
|
|
4371
|
+
]
|
|
3782
4372
|
}
|
|
3783
4373
|
);
|
|
3784
4374
|
}
|
|
3785
4375
|
);
|
|
3786
|
-
|
|
3787
|
-
|
|
4376
|
+
|
|
4377
|
+
// src/components/AlertDialog/AlertDialog.tsx
|
|
4378
|
+
var import_react14 = require("react");
|
|
4379
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4380
|
+
var SIZE_CLASSES11 = {
|
|
4381
|
+
"extra-small": "w-screen max-w-[324px]",
|
|
4382
|
+
small: "w-screen max-w-[378px]",
|
|
4383
|
+
medium: "w-screen max-w-[459px]",
|
|
4384
|
+
large: "w-screen max-w-[578px]",
|
|
4385
|
+
"extra-large": "w-screen max-w-[912px]"
|
|
4386
|
+
};
|
|
4387
|
+
var AlertDialog = (0, import_react14.forwardRef)(
|
|
3788
4388
|
({
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
4389
|
+
trigger,
|
|
4390
|
+
description,
|
|
4391
|
+
cancelButtonLabel = "Cancelar",
|
|
4392
|
+
submitButtonLabel = "Deletar",
|
|
4393
|
+
title,
|
|
4394
|
+
isOpen: controlledIsOpen,
|
|
4395
|
+
onOpen,
|
|
4396
|
+
onClose,
|
|
4397
|
+
closeOnBackdropClick = true,
|
|
4398
|
+
closeOnEscape = true,
|
|
4399
|
+
className = "",
|
|
4400
|
+
onSubmit,
|
|
4401
|
+
submitValue,
|
|
4402
|
+
onCancel,
|
|
4403
|
+
cancelValue,
|
|
4404
|
+
size = "medium",
|
|
3796
4405
|
...props
|
|
3797
4406
|
}, ref) => {
|
|
3798
|
-
const
|
|
3799
|
-
const
|
|
3800
|
-
const
|
|
3801
|
-
if (
|
|
3802
|
-
|
|
4407
|
+
const [internalIsOpen, setInternalIsOpen] = (0, import_react14.useState)(false);
|
|
4408
|
+
const isOpen = controlledIsOpen ?? internalIsOpen;
|
|
4409
|
+
const setIsOpen = (open) => {
|
|
4410
|
+
if (controlledIsOpen === void 0) {
|
|
4411
|
+
setInternalIsOpen(open);
|
|
3803
4412
|
}
|
|
3804
|
-
|
|
4413
|
+
if (open && onOpen) onOpen();
|
|
4414
|
+
if (!open && onClose) onClose();
|
|
3805
4415
|
};
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
onKeyDown: (e) => {
|
|
3812
|
-
if (["Enter", " "].includes(e.key)) handleClick(e);
|
|
3813
|
-
},
|
|
3814
|
-
tabIndex: disabled ? -1 : 0,
|
|
3815
|
-
onMouseDown: (e) => {
|
|
3816
|
-
e.preventDefault();
|
|
3817
|
-
},
|
|
3818
|
-
...props
|
|
3819
|
-
};
|
|
3820
|
-
const variants = {
|
|
3821
|
-
menu: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3822
|
-
"li",
|
|
3823
|
-
{
|
|
3824
|
-
"data-variant": "menu",
|
|
3825
|
-
className: `
|
|
3826
|
-
w-full flex flex-col items-center justify-center gap-0.5 py-1 px-2 rounded-sm font-medium text-xs
|
|
3827
|
-
[&>svg]:size-6 cursor-pointer hover:bg-primary-600 hover:text-text
|
|
3828
|
-
focus:outline-none focus:border-indicator-info focus:border-2
|
|
3829
|
-
${selectedValue === value ? "bg-primary-50 text-primary-950" : "text-text-950"}
|
|
3830
|
-
${className ?? ""}
|
|
3831
|
-
`,
|
|
3832
|
-
...commonProps,
|
|
3833
|
-
children
|
|
4416
|
+
(0, import_react14.useEffect)(() => {
|
|
4417
|
+
if (!isOpen || !closeOnEscape) return;
|
|
4418
|
+
const handleEscape = (event) => {
|
|
4419
|
+
if (event.key === "Escape") {
|
|
4420
|
+
setIsOpen(false);
|
|
3834
4421
|
}
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
4422
|
+
};
|
|
4423
|
+
document.addEventListener("keydown", handleEscape);
|
|
4424
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
4425
|
+
}, [isOpen, closeOnEscape]);
|
|
4426
|
+
(0, import_react14.useEffect)(() => {
|
|
4427
|
+
if (isOpen) {
|
|
4428
|
+
document.body.style.overflow = "hidden";
|
|
4429
|
+
} else {
|
|
4430
|
+
document.body.style.overflow = "unset";
|
|
4431
|
+
}
|
|
4432
|
+
return () => {
|
|
4433
|
+
document.body.style.overflow = "unset";
|
|
4434
|
+
};
|
|
4435
|
+
}, [isOpen]);
|
|
4436
|
+
const handleBackdropClick = (event) => {
|
|
4437
|
+
if (event.target === event.currentTarget && closeOnBackdropClick) {
|
|
4438
|
+
setIsOpen(false);
|
|
4439
|
+
}
|
|
4440
|
+
};
|
|
4441
|
+
const handleBackdropKeyDown = (event) => {
|
|
4442
|
+
if (event.key === "Escape" && closeOnEscape) {
|
|
4443
|
+
setIsOpen(false);
|
|
4444
|
+
}
|
|
4445
|
+
};
|
|
4446
|
+
const handleTriggerClick = () => {
|
|
4447
|
+
setIsOpen(true);
|
|
4448
|
+
};
|
|
4449
|
+
const handleSubmit = () => {
|
|
4450
|
+
setIsOpen(false);
|
|
4451
|
+
onSubmit?.(submitValue);
|
|
4452
|
+
};
|
|
4453
|
+
const handleCancel = () => {
|
|
4454
|
+
setIsOpen(false);
|
|
4455
|
+
onCancel?.(cancelValue);
|
|
4456
|
+
};
|
|
4457
|
+
const sizeClasses = SIZE_CLASSES11[size];
|
|
4458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4460
|
+
"button",
|
|
3838
4461
|
{
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
`,
|
|
3845
|
-
...commonProps,
|
|
3846
|
-
children: [
|
|
3847
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3848
|
-
"span",
|
|
3849
|
-
{
|
|
3850
|
-
className: `flex flex-row items-center gap-2 px-4 text-text-950 text-xs font-bold ${className ?? ""}`,
|
|
3851
|
-
children
|
|
3852
|
-
}
|
|
3853
|
-
),
|
|
3854
|
-
selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-1 w-full bg-primary-950 rounded-lg" })
|
|
3855
|
-
]
|
|
4462
|
+
onClick: handleTriggerClick,
|
|
4463
|
+
"aria-label": "Open dialog",
|
|
4464
|
+
type: "button",
|
|
4465
|
+
className: "border-none bg-transparent p-0 cursor-pointer",
|
|
4466
|
+
children: trigger
|
|
3856
4467
|
}
|
|
3857
4468
|
),
|
|
3858
|
-
|
|
3859
|
-
"
|
|
4469
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4470
|
+
"div",
|
|
3860
4471
|
{
|
|
3861
|
-
"
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
4472
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",
|
|
4473
|
+
onClick: handleBackdropClick,
|
|
4474
|
+
onKeyDown: handleBackdropKeyDown,
|
|
4475
|
+
"data-testid": "alert-dialog-overlay",
|
|
4476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4477
|
+
"div",
|
|
4478
|
+
{
|
|
4479
|
+
ref,
|
|
4480
|
+
className: `bg-background border border-border-100 rounded-lg shadow-lg p-6 m-3 ${sizeClasses} ${className}`,
|
|
4481
|
+
...props,
|
|
4482
|
+
children: [
|
|
4483
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4484
|
+
"h2",
|
|
4485
|
+
{
|
|
4486
|
+
id: "alert-dialog-title",
|
|
4487
|
+
className: "pb-3 text-xl font-semibold",
|
|
4488
|
+
children: title
|
|
4489
|
+
}
|
|
4490
|
+
),
|
|
4491
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4492
|
+
"p",
|
|
4493
|
+
{
|
|
4494
|
+
id: "alert-dialog-description",
|
|
4495
|
+
className: "text-text-700 text-sm",
|
|
4496
|
+
children: description
|
|
4497
|
+
}
|
|
4498
|
+
),
|
|
4499
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-row items-center justify-end pt-4 gap-3", children: [
|
|
4500
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button_default, { variant: "outline", size: "small", onClick: handleCancel, children: cancelButtonLabel }),
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4502
|
+
Button_default,
|
|
4503
|
+
{
|
|
4504
|
+
variant: "solid",
|
|
4505
|
+
size: "small",
|
|
4506
|
+
action: "negative",
|
|
4507
|
+
onClick: handleSubmit,
|
|
4508
|
+
children: submitButtonLabel
|
|
4509
|
+
}
|
|
4510
|
+
)
|
|
4511
|
+
] })
|
|
4512
|
+
]
|
|
4513
|
+
}
|
|
4514
|
+
)
|
|
3889
4515
|
}
|
|
3890
4516
|
)
|
|
4517
|
+
] });
|
|
4518
|
+
}
|
|
4519
|
+
);
|
|
4520
|
+
AlertDialog.displayName = "AlertDialog";
|
|
4521
|
+
|
|
4522
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
4523
|
+
var import_phosphor_react13 = require("phosphor-react");
|
|
4524
|
+
var import_react15 = require("react");
|
|
4525
|
+
var import_zustand3 = require("zustand");
|
|
4526
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4527
|
+
function createDropdownStore() {
|
|
4528
|
+
return (0, import_zustand3.create)((set) => ({
|
|
4529
|
+
open: false,
|
|
4530
|
+
setOpen: (open) => set({ open })
|
|
4531
|
+
}));
|
|
4532
|
+
}
|
|
4533
|
+
var useDropdownStore = (externalStore) => {
|
|
4534
|
+
if (!externalStore) {
|
|
4535
|
+
throw new Error(
|
|
4536
|
+
"Component must be used within a DropdownMenu (store is missing)"
|
|
4537
|
+
);
|
|
4538
|
+
}
|
|
4539
|
+
return externalStore;
|
|
4540
|
+
};
|
|
4541
|
+
var injectStore2 = (children, store) => {
|
|
4542
|
+
return import_react15.Children.map(children, (child) => {
|
|
4543
|
+
if ((0, import_react15.isValidElement)(child)) {
|
|
4544
|
+
const typedChild = child;
|
|
4545
|
+
const newProps = {
|
|
4546
|
+
store
|
|
4547
|
+
};
|
|
4548
|
+
if (typedChild.props.children) {
|
|
4549
|
+
newProps.children = injectStore2(typedChild.props.children, store);
|
|
4550
|
+
}
|
|
4551
|
+
return (0, import_react15.cloneElement)(typedChild, newProps);
|
|
4552
|
+
}
|
|
4553
|
+
return child;
|
|
4554
|
+
});
|
|
4555
|
+
};
|
|
4556
|
+
var DropdownMenu = ({
|
|
4557
|
+
children,
|
|
4558
|
+
open: propOpen,
|
|
4559
|
+
onOpenChange
|
|
4560
|
+
}) => {
|
|
4561
|
+
const storeRef = (0, import_react15.useRef)(null);
|
|
4562
|
+
storeRef.current ??= createDropdownStore();
|
|
4563
|
+
const store = storeRef.current;
|
|
4564
|
+
const { open, setOpen: storeSetOpen } = (0, import_zustand3.useStore)(store, (s) => s);
|
|
4565
|
+
const setOpen = (newOpen) => {
|
|
4566
|
+
storeSetOpen(newOpen);
|
|
4567
|
+
};
|
|
4568
|
+
const menuRef = (0, import_react15.useRef)(null);
|
|
4569
|
+
const handleArrowDownOrArrowUp = (event) => {
|
|
4570
|
+
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
4571
|
+
if (menuContent) {
|
|
4572
|
+
event.preventDefault();
|
|
4573
|
+
const items = Array.from(
|
|
4574
|
+
menuContent.querySelectorAll(
|
|
4575
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
4576
|
+
)
|
|
4577
|
+
).filter((el) => el instanceof HTMLElement);
|
|
4578
|
+
if (items.length === 0) return;
|
|
4579
|
+
const focusedItem = document.activeElement;
|
|
4580
|
+
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
4581
|
+
let nextIndex;
|
|
4582
|
+
if (event.key === "ArrowDown") {
|
|
4583
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
4584
|
+
} else {
|
|
4585
|
+
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
4586
|
+
}
|
|
4587
|
+
items[nextIndex]?.focus();
|
|
4588
|
+
}
|
|
4589
|
+
};
|
|
4590
|
+
const handleDownkey = (event) => {
|
|
4591
|
+
if (event.key === "Escape") {
|
|
4592
|
+
setOpen(false);
|
|
4593
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
4594
|
+
handleArrowDownOrArrowUp(event);
|
|
4595
|
+
}
|
|
4596
|
+
};
|
|
4597
|
+
const handleClickOutside = (event) => {
|
|
4598
|
+
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
4599
|
+
setOpen(false);
|
|
4600
|
+
}
|
|
4601
|
+
};
|
|
4602
|
+
(0, import_react15.useEffect)(() => {
|
|
4603
|
+
if (open) {
|
|
4604
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
4605
|
+
document.addEventListener("keydown", handleDownkey);
|
|
4606
|
+
}
|
|
4607
|
+
return () => {
|
|
4608
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
4609
|
+
document.removeEventListener("keydown", handleDownkey);
|
|
3891
4610
|
};
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
);
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
});
|
|
3902
|
-
};
|
|
3903
|
-
var internalCheckScroll = (container, setShowLeftArrow, setShowRightArrow) => {
|
|
3904
|
-
if (!container) return;
|
|
3905
|
-
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
3906
|
-
setShowLeftArrow(scrollLeft > 0);
|
|
3907
|
-
setShowRightArrow(scrollLeft + clientWidth < scrollWidth);
|
|
4611
|
+
}, [open]);
|
|
4612
|
+
(0, import_react15.useEffect)(() => {
|
|
4613
|
+
setOpen(open);
|
|
4614
|
+
onOpenChange?.(open);
|
|
4615
|
+
}, [open, onOpenChange]);
|
|
4616
|
+
(0, import_react15.useEffect)(() => {
|
|
4617
|
+
if (propOpen) {
|
|
4618
|
+
setOpen(propOpen);
|
|
4619
|
+
}
|
|
4620
|
+
}, [propOpen]);
|
|
4621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "relative", ref: menuRef, children: injectStore2(children, store) });
|
|
3908
4622
|
};
|
|
3909
|
-
var
|
|
3910
|
-
children,
|
|
4623
|
+
var DropdownMenuTrigger = ({
|
|
3911
4624
|
className,
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
4625
|
+
children,
|
|
4626
|
+
onClick,
|
|
4627
|
+
store: externalStore,
|
|
3915
4628
|
...props
|
|
3916
4629
|
}) => {
|
|
3917
|
-
const
|
|
3918
|
-
const
|
|
3919
|
-
const
|
|
3920
|
-
(0,
|
|
3921
|
-
|
|
3922
|
-
containerRef.current,
|
|
3923
|
-
setShowLeftArrow,
|
|
3924
|
-
setShowRightArrow
|
|
3925
|
-
);
|
|
3926
|
-
checkScroll();
|
|
3927
|
-
const container = containerRef.current;
|
|
3928
|
-
container?.addEventListener("scroll", checkScroll);
|
|
3929
|
-
window.addEventListener("resize", checkScroll);
|
|
3930
|
-
return () => {
|
|
3931
|
-
container?.removeEventListener("scroll", checkScroll);
|
|
3932
|
-
window.removeEventListener("resize", checkScroll);
|
|
3933
|
-
};
|
|
3934
|
-
}, []);
|
|
3935
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3936
|
-
"div",
|
|
4630
|
+
const store = useDropdownStore(externalStore);
|
|
4631
|
+
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
4632
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
4633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4634
|
+
"button",
|
|
3937
4635
|
{
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
children: [
|
|
3948
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_phosphor_react12.CaretLeft, { size: 16 }),
|
|
3949
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "sr-only", children: "Scroll left" })
|
|
3950
|
-
]
|
|
3951
|
-
}
|
|
3952
|
-
),
|
|
3953
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3954
|
-
Menu,
|
|
3955
|
-
{
|
|
3956
|
-
defaultValue,
|
|
3957
|
-
onValueChange,
|
|
3958
|
-
value,
|
|
3959
|
-
variant: "menu2",
|
|
3960
|
-
...props,
|
|
3961
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MenuContent, { ref: containerRef, variant: "menu2", children })
|
|
3962
|
-
}
|
|
3963
|
-
),
|
|
3964
|
-
showRightArrow && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3965
|
-
"button",
|
|
3966
|
-
{
|
|
3967
|
-
onClick: () => internalScroll(containerRef.current, "right"),
|
|
3968
|
-
className: "absolute right-0 top-1/2 -translate-y-1/2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md cursor-pointer",
|
|
3969
|
-
"data-testid": "scroll-right-button",
|
|
3970
|
-
children: [
|
|
3971
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_phosphor_react12.CaretRight, { size: 16 }),
|
|
3972
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "sr-only", children: "Scroll right" })
|
|
3973
|
-
]
|
|
3974
|
-
}
|
|
3975
|
-
)
|
|
3976
|
-
]
|
|
4636
|
+
onClick: (e) => {
|
|
4637
|
+
e.stopPropagation();
|
|
4638
|
+
toggleOpen();
|
|
4639
|
+
if (onClick) onClick(e);
|
|
4640
|
+
},
|
|
4641
|
+
"aria-expanded": open,
|
|
4642
|
+
className: `${className}`,
|
|
4643
|
+
...props,
|
|
4644
|
+
children
|
|
3977
4645
|
}
|
|
3978
4646
|
);
|
|
3979
4647
|
};
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
return (0, import_react13.cloneElement)(typedChild, {
|
|
3985
|
-
...shouldInject ? { store } : {},
|
|
3986
|
-
...typedChild.props.children ? { children: injectStore3(typedChild.props.children, store) } : {}
|
|
3987
|
-
});
|
|
3988
|
-
});
|
|
3989
|
-
var Menu_default = Menu;
|
|
3990
|
-
|
|
3991
|
-
// src/components/Card/Card.tsx
|
|
3992
|
-
var import_react14 = require("react");
|
|
3993
|
-
var import_phosphor_react13 = require("phosphor-react");
|
|
3994
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3995
|
-
var CARD_BASE_CLASSES = {
|
|
3996
|
-
default: "w-full bg-background border border-border-50 rounded-xl",
|
|
3997
|
-
compact: "w-full bg-background border border-border-50 rounded-lg",
|
|
3998
|
-
minimal: "w-full bg-background border border-border-100 rounded-md"
|
|
3999
|
-
};
|
|
4000
|
-
var CARD_PADDING_CLASSES = {
|
|
4001
|
-
none: "",
|
|
4002
|
-
small: "p-2",
|
|
4003
|
-
medium: "p-4",
|
|
4004
|
-
large: "p-6"
|
|
4005
|
-
};
|
|
4006
|
-
var CARD_MIN_HEIGHT_CLASSES = {
|
|
4007
|
-
none: "",
|
|
4008
|
-
small: "min-h-16",
|
|
4009
|
-
medium: "min-h-20",
|
|
4010
|
-
large: "min-h-24"
|
|
4011
|
-
};
|
|
4012
|
-
var CARD_LAYOUT_CLASSES = {
|
|
4013
|
-
horizontal: "flex flex-row",
|
|
4014
|
-
vertical: "flex flex-col"
|
|
4015
|
-
};
|
|
4016
|
-
var CARD_CURSOR_CLASSES = {
|
|
4017
|
-
default: "",
|
|
4018
|
-
pointer: "cursor-pointer"
|
|
4019
|
-
};
|
|
4020
|
-
var CardBase = (0, import_react14.forwardRef)(
|
|
4021
|
-
({
|
|
4022
|
-
children,
|
|
4023
|
-
variant = "default",
|
|
4024
|
-
layout = "horizontal",
|
|
4025
|
-
padding = "medium",
|
|
4026
|
-
minHeight = "medium",
|
|
4027
|
-
cursor = "default",
|
|
4028
|
-
className = "",
|
|
4029
|
-
...props
|
|
4030
|
-
}, ref) => {
|
|
4031
|
-
const baseClasses = CARD_BASE_CLASSES[variant];
|
|
4032
|
-
const paddingClasses = CARD_PADDING_CLASSES[padding];
|
|
4033
|
-
const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
|
|
4034
|
-
const layoutClasses = CARD_LAYOUT_CLASSES[layout];
|
|
4035
|
-
const cursorClasses = CARD_CURSOR_CLASSES[cursor];
|
|
4036
|
-
const combinedClasses = [
|
|
4037
|
-
baseClasses,
|
|
4038
|
-
paddingClasses,
|
|
4039
|
-
minHeightClasses,
|
|
4040
|
-
layoutClasses,
|
|
4041
|
-
cursorClasses,
|
|
4042
|
-
className
|
|
4043
|
-
].filter(Boolean).join(" ");
|
|
4044
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref, className: combinedClasses, ...props, children });
|
|
4045
|
-
}
|
|
4046
|
-
);
|
|
4047
|
-
var ACTION_CARD_CLASSES = {
|
|
4048
|
-
warning: "bg-warning-background",
|
|
4049
|
-
success: "bg-success-300",
|
|
4050
|
-
error: "bg-error-100",
|
|
4051
|
-
info: "bg-info-background"
|
|
4648
|
+
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
4649
|
+
var ITEM_SIZE_CLASSES = {
|
|
4650
|
+
small: "text-sm",
|
|
4651
|
+
medium: "text-md"
|
|
4052
4652
|
};
|
|
4053
|
-
var
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4653
|
+
var SIDE_CLASSES = {
|
|
4654
|
+
top: "bottom-full",
|
|
4655
|
+
right: "top-full",
|
|
4656
|
+
bottom: "top-full",
|
|
4657
|
+
left: "top-full"
|
|
4058
4658
|
};
|
|
4059
|
-
var
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
info: "text-info-700"
|
|
4659
|
+
var ALIGN_CLASSES = {
|
|
4660
|
+
start: "left-0",
|
|
4661
|
+
center: "left-1/2 -translate-x-1/2",
|
|
4662
|
+
end: "right-0"
|
|
4064
4663
|
};
|
|
4065
|
-
var
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
error: "text-error-300",
|
|
4069
|
-
info: "text-info-300"
|
|
4664
|
+
var MENUCONTENT_VARIANT_CLASSES = {
|
|
4665
|
+
menu: "p-1",
|
|
4666
|
+
profile: "p-6"
|
|
4070
4667
|
};
|
|
4071
|
-
var
|
|
4668
|
+
var MenuLabel = (0, import_react15.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
|
|
4669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4670
|
+
"div",
|
|
4671
|
+
{
|
|
4672
|
+
ref,
|
|
4673
|
+
className: `text-sm w-full ${inset ? "pl-8" : ""} ${className ?? ""}`,
|
|
4674
|
+
...props
|
|
4675
|
+
}
|
|
4676
|
+
);
|
|
4677
|
+
});
|
|
4678
|
+
MenuLabel.displayName = "MenuLabel";
|
|
4679
|
+
var DropdownMenuContent = (0, import_react15.forwardRef)(
|
|
4072
4680
|
({
|
|
4073
|
-
icon,
|
|
4074
|
-
title,
|
|
4075
|
-
subTitle,
|
|
4076
|
-
header,
|
|
4077
|
-
extended = false,
|
|
4078
|
-
action = "success",
|
|
4079
|
-
description,
|
|
4080
4681
|
className,
|
|
4682
|
+
align = "start",
|
|
4683
|
+
side = "bottom",
|
|
4684
|
+
variant = "menu",
|
|
4685
|
+
sideOffset = 4,
|
|
4686
|
+
children,
|
|
4687
|
+
store: externalStore,
|
|
4081
4688
|
...props
|
|
4082
4689
|
}, ref) => {
|
|
4083
|
-
const
|
|
4084
|
-
const
|
|
4085
|
-
const
|
|
4086
|
-
|
|
4087
|
-
|
|
4690
|
+
const store = useDropdownStore(externalStore);
|
|
4691
|
+
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
4692
|
+
const [isVisible, setIsVisible] = (0, import_react15.useState)(open);
|
|
4693
|
+
(0, import_react15.useEffect)(() => {
|
|
4694
|
+
if (open) {
|
|
4695
|
+
setIsVisible(true);
|
|
4696
|
+
} else {
|
|
4697
|
+
const timer = setTimeout(() => setIsVisible(false), 200);
|
|
4698
|
+
return () => clearTimeout(timer);
|
|
4699
|
+
}
|
|
4700
|
+
}, [open]);
|
|
4701
|
+
if (!isVisible) return null;
|
|
4702
|
+
const getPositionClasses = () => {
|
|
4703
|
+
const vertical = SIDE_CLASSES[side];
|
|
4704
|
+
const horizontal = ALIGN_CLASSES[align];
|
|
4705
|
+
return `absolute ${vertical} ${horizontal}`;
|
|
4706
|
+
};
|
|
4707
|
+
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
4708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4088
4709
|
"div",
|
|
4089
4710
|
{
|
|
4090
4711
|
ref,
|
|
4091
|
-
|
|
4712
|
+
role: "menu",
|
|
4713
|
+
className: `
|
|
4714
|
+
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
|
|
4715
|
+
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
4716
|
+
${getPositionClasses()}
|
|
4717
|
+
${variantClasses}
|
|
4718
|
+
${className}
|
|
4719
|
+
`,
|
|
4720
|
+
style: {
|
|
4721
|
+
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
4722
|
+
marginBottom: side === "top" ? sideOffset : void 0,
|
|
4723
|
+
marginLeft: side === "right" ? sideOffset : void 0,
|
|
4724
|
+
marginRight: side === "left" ? sideOffset : void 0
|
|
4725
|
+
},
|
|
4092
4726
|
...props,
|
|
4093
|
-
children
|
|
4094
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4095
|
-
"div",
|
|
4096
|
-
{
|
|
4097
|
-
className: `
|
|
4098
|
-
flex flex-col gap-1 items-center justify-center p-4
|
|
4099
|
-
${actionCardClasses}
|
|
4100
|
-
${extended ? "rounded-t-xl" : "rounded-xl"}`,
|
|
4101
|
-
children: [
|
|
4102
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4103
|
-
"span",
|
|
4104
|
-
{
|
|
4105
|
-
className: `size-7.5 rounded-full flex items-center justify-center ${actionIconClasses}`,
|
|
4106
|
-
children: icon
|
|
4107
|
-
}
|
|
4108
|
-
),
|
|
4109
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4110
|
-
Text_default,
|
|
4111
|
-
{
|
|
4112
|
-
size: "2xs",
|
|
4113
|
-
weight: "medium",
|
|
4114
|
-
className: "text-text-800 uppercase truncate",
|
|
4115
|
-
children: title
|
|
4116
|
-
}
|
|
4117
|
-
),
|
|
4118
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: `text-lg font-bold truncate ${actionSubTitleClasses}`, children: subTitle })
|
|
4119
|
-
]
|
|
4120
|
-
}
|
|
4121
|
-
),
|
|
4122
|
-
extended && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
|
|
4123
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4124
|
-
"p",
|
|
4125
|
-
{
|
|
4126
|
-
className: `text-2xs font-medium uppercase truncate ${actionHeaderClasses}`,
|
|
4127
|
-
children: header
|
|
4128
|
-
}
|
|
4129
|
-
),
|
|
4130
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Badge_default, { size: "large", action: "info", children: description })
|
|
4131
|
-
] })
|
|
4132
|
-
]
|
|
4727
|
+
children
|
|
4133
4728
|
}
|
|
4134
4729
|
);
|
|
4135
4730
|
}
|
|
4136
4731
|
);
|
|
4137
|
-
|
|
4732
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
4733
|
+
var DropdownMenuItem = (0, import_react15.forwardRef)(
|
|
4138
4734
|
({
|
|
4139
|
-
header,
|
|
4140
|
-
state = "undone",
|
|
4141
4735
|
className,
|
|
4142
|
-
|
|
4143
|
-
|
|
4736
|
+
size = "small",
|
|
4737
|
+
children,
|
|
4738
|
+
iconRight,
|
|
4739
|
+
iconLeft,
|
|
4740
|
+
disabled = false,
|
|
4741
|
+
onClick,
|
|
4742
|
+
variant = "menu",
|
|
4743
|
+
store: externalStore,
|
|
4144
4744
|
...props
|
|
4145
4745
|
}, ref) => {
|
|
4146
|
-
const
|
|
4147
|
-
const
|
|
4148
|
-
const
|
|
4149
|
-
|
|
4150
|
-
|
|
4746
|
+
const store = useDropdownStore(externalStore);
|
|
4747
|
+
const setOpen = (0, import_zustand3.useStore)(store, (s) => s.setOpen);
|
|
4748
|
+
const sizeClasses = ITEM_SIZE_CLASSES[size];
|
|
4749
|
+
const handleClick = (e) => {
|
|
4750
|
+
if (disabled) {
|
|
4751
|
+
e.preventDefault();
|
|
4752
|
+
e.stopPropagation();
|
|
4753
|
+
return;
|
|
4754
|
+
}
|
|
4755
|
+
onClick?.(e);
|
|
4756
|
+
setOpen(false);
|
|
4757
|
+
};
|
|
4758
|
+
const getVariantClasses = () => {
|
|
4759
|
+
if (variant === "profile") {
|
|
4760
|
+
return "relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-4 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0";
|
|
4761
|
+
}
|
|
4762
|
+
return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
|
|
4763
|
+
};
|
|
4764
|
+
const getVariantProps = () => {
|
|
4765
|
+
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
4766
|
+
};
|
|
4767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4768
|
+
"div",
|
|
4151
4769
|
{
|
|
4152
4770
|
ref,
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
className: `
|
|
4771
|
+
role: "menuitem",
|
|
4772
|
+
...getVariantProps(),
|
|
4773
|
+
"aria-disabled": disabled,
|
|
4774
|
+
className: `
|
|
4775
|
+
focus-visible:bg-background-50
|
|
4776
|
+
${getVariantClasses()}
|
|
4777
|
+
${sizeClasses}
|
|
4778
|
+
${className}
|
|
4779
|
+
${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
4780
|
+
`,
|
|
4781
|
+
onClick: handleClick,
|
|
4782
|
+
onKeyDown: (e) => {
|
|
4783
|
+
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
4784
|
+
},
|
|
4785
|
+
tabIndex: disabled ? -1 : 0,
|
|
4157
4786
|
...props,
|
|
4158
4787
|
children: [
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4163
|
-
Badge_default,
|
|
4164
|
-
{
|
|
4165
|
-
size: "medium",
|
|
4166
|
-
variant: "solid",
|
|
4167
|
-
action: isDone ? "success" : "error",
|
|
4168
|
-
children: stateLabel
|
|
4169
|
-
}
|
|
4170
|
-
),
|
|
4171
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex flex-row items-center gap-1 text-text-700 text-xs", children: [
|
|
4172
|
-
isDone ? "Nota" : "Sem nota",
|
|
4173
|
-
isDone && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Badge_default, { size: "medium", action: "success", children: "00" })
|
|
4174
|
-
] })
|
|
4175
|
-
] })
|
|
4176
|
-
] }),
|
|
4177
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4178
|
-
Button_default,
|
|
4179
|
-
{
|
|
4180
|
-
size: "extra-small",
|
|
4181
|
-
onClick: () => onClickButton?.(valueButton),
|
|
4182
|
-
className: "min-w-fit",
|
|
4183
|
-
children: buttonLabel
|
|
4184
|
-
}
|
|
4185
|
-
) })
|
|
4788
|
+
iconLeft,
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "w-full text-md", children }),
|
|
4790
|
+
iconRight
|
|
4186
4791
|
]
|
|
4187
4792
|
}
|
|
4188
4793
|
);
|
|
4189
4794
|
}
|
|
4190
|
-
);
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4795
|
+
);
|
|
4796
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
4797
|
+
var DropdownMenuSeparator = (0, import_react15.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4798
|
+
"div",
|
|
4799
|
+
{
|
|
4800
|
+
ref,
|
|
4801
|
+
className: `my-1 h-px bg-border-200 ${className}`,
|
|
4802
|
+
...props
|
|
4803
|
+
}
|
|
4804
|
+
));
|
|
4805
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
4806
|
+
var ProfileMenuTrigger = (0, import_react15.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
4807
|
+
const store = useDropdownStore(externalStore);
|
|
4808
|
+
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
4809
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
4810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4811
|
+
"button",
|
|
4812
|
+
{
|
|
4813
|
+
ref,
|
|
4814
|
+
className: `rounded-lg size-10 bg-primary-50 flex items-center justify-center cursor-pointer ${className}`,
|
|
4815
|
+
onClick: (e) => {
|
|
4816
|
+
e.stopPropagation();
|
|
4817
|
+
toggleOpen();
|
|
4818
|
+
onClick?.(e);
|
|
4819
|
+
},
|
|
4820
|
+
"aria-expanded": open,
|
|
4821
|
+
...props,
|
|
4822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_phosphor_react13.User, { className: "text-primary-950", size: 18 }) })
|
|
4823
|
+
}
|
|
4824
|
+
);
|
|
4825
|
+
});
|
|
4826
|
+
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
4827
|
+
var ProfileMenuHeader = (0, import_react15.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
|
|
4828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4829
|
+
"div",
|
|
4830
|
+
{
|
|
4831
|
+
ref,
|
|
4832
|
+
"data-component": "ProfileMenuHeader",
|
|
4833
|
+
className: `
|
|
4834
|
+
flex flex-row gap-4 items-center
|
|
4835
|
+
${className}
|
|
4836
|
+
`,
|
|
4837
|
+
...props,
|
|
4838
|
+
children: [
|
|
4839
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "size-16 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_phosphor_react13.User, { size: 34, className: "text-primary-950" }) }),
|
|
4840
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col ", children: [
|
|
4841
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
|
|
4842
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-md text-text-600", children: email })
|
|
4843
|
+
] })
|
|
4844
|
+
]
|
|
4845
|
+
}
|
|
4846
|
+
);
|
|
4847
|
+
});
|
|
4848
|
+
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
4849
|
+
var ProfileMenuSection = (0, import_react15.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
|
|
4850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4851
|
+
"div",
|
|
4852
|
+
{
|
|
4853
|
+
ref,
|
|
4854
|
+
className: `
|
|
4855
|
+
flex flex-col p-2
|
|
4856
|
+
${className}
|
|
4857
|
+
`,
|
|
4858
|
+
...props,
|
|
4859
|
+
children
|
|
4860
|
+
}
|
|
4861
|
+
);
|
|
4862
|
+
});
|
|
4863
|
+
ProfileMenuSection.displayName = "ProfileMenuSection";
|
|
4864
|
+
var ProfileMenuFooter = ({
|
|
4865
|
+
className,
|
|
4866
|
+
disabled = false,
|
|
4867
|
+
onClick,
|
|
4868
|
+
store: externalStore,
|
|
4869
|
+
...props
|
|
4870
|
+
}) => {
|
|
4871
|
+
const store = useDropdownStore(externalStore);
|
|
4872
|
+
const setOpen = (0, import_zustand3.useStore)(store, (s) => s.setOpen);
|
|
4873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4874
|
+
Button_default,
|
|
4875
|
+
{
|
|
4876
|
+
variant: "outline",
|
|
4877
|
+
className: `w-full ${className}`,
|
|
4878
|
+
disabled,
|
|
4879
|
+
onClick: (e) => {
|
|
4880
|
+
setOpen(false);
|
|
4881
|
+
onClick?.(e);
|
|
4882
|
+
},
|
|
4883
|
+
...props,
|
|
4884
|
+
children: [
|
|
4885
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_phosphor_react13.SignOut, {}) }),
|
|
4886
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Sair" })
|
|
4887
|
+
]
|
|
4888
|
+
}
|
|
4889
|
+
);
|
|
4890
|
+
};
|
|
4891
|
+
ProfileMenuFooter.displayName = "ProfileMenuFooter";
|
|
4892
|
+
var DropdownMenu_default = DropdownMenu;
|
|
4893
|
+
|
|
4894
|
+
// src/components/Select/Select.tsx
|
|
4895
|
+
var import_zustand4 = require("zustand");
|
|
4896
|
+
var import_react16 = require("react");
|
|
4897
|
+
var import_phosphor_react14 = require("phosphor-react");
|
|
4898
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4899
|
+
var VARIANT_CLASSES4 = {
|
|
4900
|
+
outlined: "border rounded-lg focus:border-primary-950",
|
|
4901
|
+
underlined: "border-b focus:border-primary-950",
|
|
4902
|
+
rounded: "border rounded-full focus:border-primary-950"
|
|
4903
|
+
};
|
|
4904
|
+
var SIZE_CLASSES12 = {
|
|
4905
|
+
small: "text-sm",
|
|
4906
|
+
medium: "text-md",
|
|
4907
|
+
large: "text-lg",
|
|
4908
|
+
"extra-large": "text-lg"
|
|
4909
|
+
};
|
|
4910
|
+
var HEIGHT_CLASSES = {
|
|
4911
|
+
small: "h-8",
|
|
4912
|
+
medium: "h-9",
|
|
4913
|
+
large: "h-10",
|
|
4914
|
+
"extra-large": "h-12"
|
|
4915
|
+
};
|
|
4916
|
+
var PADDING_CLASSES = {
|
|
4917
|
+
small: "px-2 py-1",
|
|
4918
|
+
medium: "px-3 py-2",
|
|
4919
|
+
large: "px-4 py-3",
|
|
4920
|
+
"extra-large": "px-5 py-4"
|
|
4921
|
+
};
|
|
4922
|
+
var SIDE_CLASSES2 = {
|
|
4923
|
+
top: "bottom-full -translate-y-1",
|
|
4924
|
+
right: "top-full translate-y-1",
|
|
4925
|
+
bottom: "top-full translate-y-1",
|
|
4926
|
+
left: "top-full translate-y-1"
|
|
4927
|
+
};
|
|
4928
|
+
var ALIGN_CLASSES2 = {
|
|
4929
|
+
start: "left-0",
|
|
4930
|
+
center: "left-1/2 -translate-x-1/2",
|
|
4931
|
+
end: "right-0"
|
|
4932
|
+
};
|
|
4933
|
+
function createSelectStore(onValueChange) {
|
|
4934
|
+
return (0, import_zustand4.create)((set) => ({
|
|
4935
|
+
open: false,
|
|
4936
|
+
setOpen: (open) => set({ open }),
|
|
4937
|
+
value: "",
|
|
4938
|
+
setValue: (value) => set({ value }),
|
|
4939
|
+
selectedLabel: "",
|
|
4940
|
+
setSelectedLabel: (label) => set({ selectedLabel: label }),
|
|
4941
|
+
onValueChange
|
|
4942
|
+
}));
|
|
4943
|
+
}
|
|
4944
|
+
var useSelectStore = (externalStore) => {
|
|
4945
|
+
if (!externalStore) {
|
|
4946
|
+
throw new Error(
|
|
4947
|
+
"Component must be used within a Select (store is missing)"
|
|
4948
|
+
);
|
|
4949
|
+
}
|
|
4950
|
+
return externalStore;
|
|
4951
|
+
};
|
|
4952
|
+
function getLabelAsNode(children) {
|
|
4953
|
+
if (typeof children === "string" || typeof children === "number") {
|
|
4954
|
+
return children;
|
|
4955
|
+
}
|
|
4956
|
+
const flattened = import_react16.Children.toArray(children);
|
|
4957
|
+
if (flattened.length === 1) return flattened[0];
|
|
4958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: flattened });
|
|
4959
|
+
}
|
|
4960
|
+
var injectStore3 = (children, store, size, selectId) => {
|
|
4961
|
+
return import_react16.Children.map(children, (child) => {
|
|
4962
|
+
if ((0, import_react16.isValidElement)(child)) {
|
|
4963
|
+
const typedChild = child;
|
|
4964
|
+
const newProps = {
|
|
4965
|
+
store
|
|
4966
|
+
};
|
|
4967
|
+
if (typedChild.type === SelectTrigger) {
|
|
4968
|
+
newProps.size = size;
|
|
4969
|
+
newProps.selectId = selectId;
|
|
4970
|
+
}
|
|
4971
|
+
if (typedChild.props.children) {
|
|
4972
|
+
newProps.children = injectStore3(
|
|
4973
|
+
typedChild.props.children,
|
|
4974
|
+
store,
|
|
4975
|
+
size,
|
|
4976
|
+
selectId
|
|
4977
|
+
);
|
|
4978
|
+
}
|
|
4979
|
+
return (0, import_react16.cloneElement)(typedChild, newProps);
|
|
4980
|
+
}
|
|
4981
|
+
return child;
|
|
4982
|
+
});
|
|
4983
|
+
};
|
|
4984
|
+
var Select = ({
|
|
4985
|
+
children,
|
|
4986
|
+
defaultValue = "",
|
|
4987
|
+
value: propValue,
|
|
4988
|
+
onValueChange,
|
|
4989
|
+
size = "small",
|
|
4990
|
+
label,
|
|
4991
|
+
helperText,
|
|
4992
|
+
errorMessage,
|
|
4993
|
+
id
|
|
4994
|
+
}) => {
|
|
4995
|
+
const storeRef = (0, import_react16.useRef)(null);
|
|
4996
|
+
storeRef.current ??= createSelectStore(onValueChange);
|
|
4997
|
+
const store = storeRef.current;
|
|
4998
|
+
const selectRef = (0, import_react16.useRef)(null);
|
|
4999
|
+
const { open, setOpen, setValue, selectedLabel } = (0, import_zustand4.useStore)(store, (s) => s);
|
|
5000
|
+
const generatedId = (0, import_react16.useId)();
|
|
5001
|
+
const selectId = id ?? `select-${generatedId}`;
|
|
5002
|
+
const findLabelForValue = (children2, targetValue) => {
|
|
5003
|
+
let found = null;
|
|
5004
|
+
const search = (nodes) => {
|
|
5005
|
+
import_react16.Children.forEach(nodes, (child) => {
|
|
5006
|
+
if (!(0, import_react16.isValidElement)(child)) return;
|
|
5007
|
+
const typedChild = child;
|
|
5008
|
+
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
5009
|
+
if (typeof typedChild.props.children === "string")
|
|
5010
|
+
found = typedChild.props.children;
|
|
5011
|
+
}
|
|
5012
|
+
if (typedChild.props.children && !found)
|
|
5013
|
+
search(typedChild.props.children);
|
|
5014
|
+
});
|
|
4244
5015
|
};
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
}
|
|
4268
|
-
),
|
|
4269
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4270
|
-
"div",
|
|
4271
|
-
{
|
|
4272
|
-
className: `
|
|
4273
|
-
p-4 flex flex-col justify-between w-full h-full
|
|
4274
|
-
${!isHorizontal && "gap-4"}
|
|
4275
|
-
`,
|
|
4276
|
-
children: [
|
|
4277
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
|
|
4278
|
-
contentComponent[direction]
|
|
4279
|
-
]
|
|
4280
|
-
}
|
|
5016
|
+
search(children2);
|
|
5017
|
+
return found;
|
|
5018
|
+
};
|
|
5019
|
+
(0, import_react16.useEffect)(() => {
|
|
5020
|
+
if (!selectedLabel && defaultValue) {
|
|
5021
|
+
const label2 = findLabelForValue(children, defaultValue);
|
|
5022
|
+
if (label2) store.setState({ selectedLabel: label2 });
|
|
5023
|
+
}
|
|
5024
|
+
}, [children, defaultValue, selectedLabel]);
|
|
5025
|
+
(0, import_react16.useEffect)(() => {
|
|
5026
|
+
const handleClickOutside = (event) => {
|
|
5027
|
+
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
5028
|
+
setOpen(false);
|
|
5029
|
+
}
|
|
5030
|
+
};
|
|
5031
|
+
const handleArrowKeys = (event) => {
|
|
5032
|
+
const selectContent = selectRef.current?.querySelector('[role="menu"]');
|
|
5033
|
+
if (selectContent) {
|
|
5034
|
+
event.preventDefault();
|
|
5035
|
+
const items = Array.from(
|
|
5036
|
+
selectContent.querySelectorAll(
|
|
5037
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
4281
5038
|
)
|
|
4282
|
-
|
|
5039
|
+
).filter((el) => el instanceof HTMLElement);
|
|
5040
|
+
const focused = document.activeElement;
|
|
5041
|
+
const currentIndex = items.findIndex((item) => item === focused);
|
|
5042
|
+
let nextIndex = 0;
|
|
5043
|
+
if (event.key === "ArrowDown") {
|
|
5044
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
5045
|
+
} else {
|
|
5046
|
+
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
5047
|
+
}
|
|
5048
|
+
items[nextIndex]?.focus();
|
|
4283
5049
|
}
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
);
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
5050
|
+
};
|
|
5051
|
+
if (open) {
|
|
5052
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
5053
|
+
document.addEventListener("keydown", handleArrowKeys);
|
|
5054
|
+
}
|
|
5055
|
+
return () => {
|
|
5056
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
5057
|
+
document.removeEventListener("keydown", handleArrowKeys);
|
|
5058
|
+
};
|
|
5059
|
+
}, [open]);
|
|
5060
|
+
(0, import_react16.useEffect)(() => {
|
|
5061
|
+
if (propValue) {
|
|
5062
|
+
setValue(propValue);
|
|
5063
|
+
const label2 = findLabelForValue(children, propValue);
|
|
5064
|
+
if (label2) store.setState({ selectedLabel: label2 });
|
|
5065
|
+
}
|
|
5066
|
+
}, [propValue]);
|
|
5067
|
+
const sizeClasses = SIZE_CLASSES12[size];
|
|
5068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full", children: [
|
|
5069
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5070
|
+
"label",
|
|
4299
5071
|
{
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
minHeight: "medium",
|
|
4304
|
-
cursor: "pointer",
|
|
4305
|
-
className: `justify-center gap-2 py-2 px-4 ${className}`,
|
|
4306
|
-
...props,
|
|
4307
|
-
children: [
|
|
4308
|
-
subHead && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react14.Fragment, { children: [
|
|
4309
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: text }),
|
|
4310
|
-
index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: "\u2022" })
|
|
4311
|
-
] }, `${text} - ${index}`)) }),
|
|
4312
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
|
|
4313
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
|
|
4314
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4315
|
-
ProgressBar_default,
|
|
4316
|
-
{
|
|
4317
|
-
size: "small",
|
|
4318
|
-
value: progress,
|
|
4319
|
-
variant: progressVariant,
|
|
4320
|
-
"data-testid": "progress-bar"
|
|
4321
|
-
}
|
|
4322
|
-
),
|
|
4323
|
-
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4324
|
-
Text_default,
|
|
4325
|
-
{
|
|
4326
|
-
size: "xs",
|
|
4327
|
-
weight: "medium",
|
|
4328
|
-
className: `text-text-950 leading-none tracking-normal text-center flex-none`,
|
|
4329
|
-
children: [
|
|
4330
|
-
Math.round(progress),
|
|
4331
|
-
"%"
|
|
4332
|
-
]
|
|
4333
|
-
}
|
|
4334
|
-
)
|
|
4335
|
-
] })
|
|
4336
|
-
]
|
|
5072
|
+
htmlFor: selectId,
|
|
5073
|
+
className: `block font-bold text-text-900 mb-1.5 ${sizeClasses}`,
|
|
5074
|
+
children: label
|
|
4337
5075
|
}
|
|
4338
|
-
)
|
|
4339
|
-
|
|
4340
|
-
)
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
5076
|
+
),
|
|
5077
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `relative ${sizeClasses}`, ref: selectRef, children: injectStore3(children, store, size, selectId) }),
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mt-1.5 gap-1.5", children: [
|
|
5079
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-sm text-text-500", children: helperText }),
|
|
5080
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_phosphor_react14.WarningCircle, { size: 16 }),
|
|
5082
|
+
" ",
|
|
5083
|
+
errorMessage
|
|
5084
|
+
] })
|
|
5085
|
+
] })
|
|
5086
|
+
] });
|
|
5087
|
+
};
|
|
5088
|
+
var SelectValue = ({
|
|
5089
|
+
placeholder,
|
|
5090
|
+
store: externalStore
|
|
5091
|
+
}) => {
|
|
5092
|
+
const store = useSelectStore(externalStore);
|
|
5093
|
+
const selectedLabel = (0, import_zustand4.useStore)(store, (s) => s.selectedLabel);
|
|
5094
|
+
const value = (0, import_zustand4.useStore)(store, (s) => s.value);
|
|
5095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
|
|
5096
|
+
};
|
|
5097
|
+
var SelectTrigger = (0, import_react16.forwardRef)(
|
|
5098
|
+
({
|
|
5099
|
+
className,
|
|
5100
|
+
invalid = false,
|
|
5101
|
+
variant = "outlined",
|
|
5102
|
+
store: externalStore,
|
|
5103
|
+
disabled,
|
|
5104
|
+
size = "medium",
|
|
5105
|
+
selectId,
|
|
4352
5106
|
...props
|
|
4353
5107
|
}, ref) => {
|
|
4354
|
-
const
|
|
4355
|
-
|
|
4356
|
-
|
|
5108
|
+
const store = useSelectStore(externalStore);
|
|
5109
|
+
const open = (0, import_zustand4.useStore)(store, (s) => s.open);
|
|
5110
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
5111
|
+
const variantClasses = VARIANT_CLASSES4[variant];
|
|
5112
|
+
const heightClasses = HEIGHT_CLASSES[size];
|
|
5113
|
+
const paddingClasses = PADDING_CLASSES[size];
|
|
5114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5115
|
+
"button",
|
|
4357
5116
|
{
|
|
4358
5117
|
ref,
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
5118
|
+
id: selectId,
|
|
5119
|
+
className: `
|
|
5120
|
+
flex min-w-[220px] w-full items-center justify-between border-border-300
|
|
5121
|
+
${heightClasses} ${paddingClasses}
|
|
5122
|
+
${invalid && `${variant == "underlined" ? "border-b-2" : "border-2"} border-indicator-error text-text-600`}
|
|
5123
|
+
${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
5124
|
+
${!invalid && !disabled ? "text-text-700" : ""}
|
|
5125
|
+
${variantClasses}
|
|
5126
|
+
${className}
|
|
5127
|
+
`,
|
|
5128
|
+
onClick: toggleOpen,
|
|
5129
|
+
"aria-expanded": open,
|
|
5130
|
+
"aria-haspopup": "listbox",
|
|
5131
|
+
"aria-controls": open ? "select-content" : void 0,
|
|
4364
5132
|
...props,
|
|
4365
5133
|
children: [
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
actionVariant === "button" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4370
|
-
Button_default,
|
|
4371
|
-
{
|
|
4372
|
-
variant: "outline",
|
|
4373
|
-
size: "extra-small",
|
|
4374
|
-
onClick: () => onClickButton?.(valueButton),
|
|
4375
|
-
className: "min-w-fit flex-shrink-0",
|
|
4376
|
-
children: "Ver Aula"
|
|
4377
|
-
}
|
|
4378
|
-
)
|
|
4379
|
-
] }),
|
|
4380
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4381
|
-
ProgressBar_default,
|
|
4382
|
-
{
|
|
4383
|
-
value: progress,
|
|
4384
|
-
label: `${progress}% ${labelProgress}`,
|
|
4385
|
-
variant: progressVariant
|
|
4386
|
-
}
|
|
4387
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-text-600 truncate", children: description }) })
|
|
4388
|
-
] }),
|
|
4389
|
-
actionVariant == "caret" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4390
|
-
import_phosphor_react13.CaretRight,
|
|
5134
|
+
props.children,
|
|
5135
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5136
|
+
import_phosphor_react14.CaretDown,
|
|
4391
5137
|
{
|
|
4392
|
-
className:
|
|
4393
|
-
"data-testid": "caret-icon"
|
|
5138
|
+
className: `h-[1em] w-[1em] opacity-50 transition-transform ${open ? "rotate-180" : ""}`
|
|
4394
5139
|
}
|
|
4395
5140
|
)
|
|
4396
5141
|
]
|
|
@@ -4398,522 +5143,376 @@ var CardPerformance = (0, import_react14.forwardRef)(
|
|
|
4398
5143
|
);
|
|
4399
5144
|
}
|
|
4400
5145
|
);
|
|
4401
|
-
|
|
5146
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
5147
|
+
var SelectContent = (0, import_react16.forwardRef)(
|
|
4402
5148
|
({
|
|
4403
|
-
|
|
4404
|
-
correct_answers,
|
|
4405
|
-
incorrect_answers,
|
|
4406
|
-
icon,
|
|
4407
|
-
direction = "col",
|
|
4408
|
-
color = "#B7DFFF",
|
|
5149
|
+
children,
|
|
4409
5150
|
className,
|
|
5151
|
+
align = "start",
|
|
5152
|
+
side = "bottom",
|
|
5153
|
+
store: externalStore,
|
|
4410
5154
|
...props
|
|
4411
5155
|
}, ref) => {
|
|
4412
|
-
const
|
|
4413
|
-
|
|
4414
|
-
|
|
5156
|
+
const store = useSelectStore(externalStore);
|
|
5157
|
+
const open = (0, import_zustand4.useStore)(store, (s) => s.open);
|
|
5158
|
+
if (!open) return null;
|
|
5159
|
+
const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES2[side]} ${ALIGN_CLASSES2[align]}`;
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5161
|
+
"div",
|
|
4415
5162
|
{
|
|
5163
|
+
role: "menu",
|
|
4416
5164
|
ref,
|
|
4417
|
-
|
|
4418
|
-
padding: "none",
|
|
4419
|
-
minHeight: "medium",
|
|
4420
|
-
className: `items-center pr-4 ${className}`,
|
|
5165
|
+
className: `bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border-100 ${getPositionClasses()} ${className}`,
|
|
4421
5166
|
...props,
|
|
4422
|
-
children
|
|
4423
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4424
|
-
"div",
|
|
4425
|
-
{
|
|
4426
|
-
className: `
|
|
4427
|
-
flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-20 h-full rounded-l-xl
|
|
4428
|
-
`,
|
|
4429
|
-
style: {
|
|
4430
|
-
backgroundColor: color
|
|
4431
|
-
},
|
|
4432
|
-
children: icon
|
|
4433
|
-
}
|
|
4434
|
-
),
|
|
4435
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4436
|
-
"div",
|
|
4437
|
-
{
|
|
4438
|
-
className: `
|
|
4439
|
-
p-4 flex justify-between w-full h-full
|
|
4440
|
-
${isRow ? "flex-row items-center gap-2" : "flex-col"}
|
|
4441
|
-
`,
|
|
4442
|
-
children: [
|
|
4443
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
|
|
4444
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex flex-row gap-1 items-center", children: [
|
|
4445
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4446
|
-
Badge_default,
|
|
4447
|
-
{
|
|
4448
|
-
action: "success",
|
|
4449
|
-
variant: "solid",
|
|
4450
|
-
size: "medium",
|
|
4451
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CheckCircle, {}),
|
|
4452
|
-
children: [
|
|
4453
|
-
correct_answers,
|
|
4454
|
-
" Corretas"
|
|
4455
|
-
]
|
|
4456
|
-
}
|
|
4457
|
-
),
|
|
4458
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4459
|
-
Badge_default,
|
|
4460
|
-
{
|
|
4461
|
-
action: "error",
|
|
4462
|
-
variant: "solid",
|
|
4463
|
-
size: "medium",
|
|
4464
|
-
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.XCircle, {}),
|
|
4465
|
-
children: [
|
|
4466
|
-
incorrect_answers,
|
|
4467
|
-
" Incorretas"
|
|
4468
|
-
]
|
|
4469
|
-
}
|
|
4470
|
-
)
|
|
4471
|
-
] })
|
|
4472
|
-
]
|
|
4473
|
-
}
|
|
4474
|
-
),
|
|
4475
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer" })
|
|
4476
|
-
]
|
|
5167
|
+
children
|
|
4477
5168
|
}
|
|
4478
5169
|
);
|
|
4479
5170
|
}
|
|
4480
5171
|
);
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
] }),
|
|
4507
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
|
|
4508
|
-
] })
|
|
5172
|
+
SelectContent.displayName = "SelectContent";
|
|
5173
|
+
var SelectItem = (0, import_react16.forwardRef)(
|
|
5174
|
+
({
|
|
5175
|
+
className,
|
|
5176
|
+
children,
|
|
5177
|
+
value,
|
|
5178
|
+
disabled = false,
|
|
5179
|
+
store: externalStore,
|
|
5180
|
+
...props
|
|
5181
|
+
}, ref) => {
|
|
5182
|
+
const store = useSelectStore(externalStore);
|
|
5183
|
+
const {
|
|
5184
|
+
value: selectedValue,
|
|
5185
|
+
setValue,
|
|
5186
|
+
setOpen,
|
|
5187
|
+
setSelectedLabel,
|
|
5188
|
+
onValueChange
|
|
5189
|
+
} = (0, import_zustand4.useStore)(store, (s) => s);
|
|
5190
|
+
const handleClick = (e) => {
|
|
5191
|
+
const labelNode = getLabelAsNode(children);
|
|
5192
|
+
if (!disabled) {
|
|
5193
|
+
setValue(value);
|
|
5194
|
+
setSelectedLabel(labelNode);
|
|
5195
|
+
setOpen(false);
|
|
5196
|
+
onValueChange?.(value);
|
|
4509
5197
|
}
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
)
|
|
4513
|
-
|
|
4514
|
-
({ header, className, icon, ...props }, ref) => {
|
|
4515
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4516
|
-
CardBase,
|
|
5198
|
+
props.onClick?.(e);
|
|
5199
|
+
};
|
|
5200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5201
|
+
"div",
|
|
4517
5202
|
{
|
|
5203
|
+
role: "menuitem",
|
|
5204
|
+
"aria-disabled": disabled,
|
|
4518
5205
|
ref,
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
5206
|
+
className: `
|
|
5207
|
+
focus-visible:bg-background-50
|
|
5208
|
+
relative flex select-none items-center gap-2 rounded-sm p-3 outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
|
|
5209
|
+
${className}
|
|
5210
|
+
${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
5211
|
+
${selectedValue === value && "bg-background-50"}
|
|
5212
|
+
`,
|
|
5213
|
+
onClick: handleClick,
|
|
5214
|
+
onKeyDown: (e) => {
|
|
5215
|
+
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
5216
|
+
},
|
|
5217
|
+
tabIndex: disabled ? -1 : 0,
|
|
4523
5218
|
...props,
|
|
4524
5219
|
children: [
|
|
4525
|
-
/* @__PURE__ */ (0,
|
|
4526
|
-
|
|
4527
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { size: 24, className: "cursor-pointer" })
|
|
5220
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_phosphor_react14.Check, { className: "" }) }),
|
|
5221
|
+
children
|
|
4528
5222
|
]
|
|
4529
5223
|
}
|
|
4530
5224
|
);
|
|
4531
5225
|
}
|
|
4532
5226
|
);
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
5227
|
+
SelectItem.displayName = "SelectItem";
|
|
5228
|
+
var Select_default = Select;
|
|
5229
|
+
|
|
5230
|
+
// src/components/Menu/Menu.tsx
|
|
5231
|
+
var import_zustand5 = require("zustand");
|
|
5232
|
+
var import_react17 = require("react");
|
|
5233
|
+
var import_phosphor_react15 = require("phosphor-react");
|
|
5234
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5235
|
+
var createMenuStore = (onValueChange) => (0, import_zustand5.create)((set) => ({
|
|
5236
|
+
value: "",
|
|
5237
|
+
setValue: (value) => {
|
|
5238
|
+
set({ value });
|
|
5239
|
+
onValueChange?.(value);
|
|
5240
|
+
},
|
|
5241
|
+
onValueChange
|
|
5242
|
+
}));
|
|
5243
|
+
var useMenuStore = (externalStore) => {
|
|
5244
|
+
if (!externalStore) throw new Error("MenuItem must be inside Menu");
|
|
5245
|
+
return externalStore;
|
|
5246
|
+
};
|
|
5247
|
+
var VARIANT_CLASSES5 = {
|
|
5248
|
+
menu: "bg-background shadow-soft-shadow-1 px-6",
|
|
5249
|
+
menu2: "",
|
|
5250
|
+
breadcrumb: ""
|
|
5251
|
+
};
|
|
5252
|
+
var Menu = (0, import_react17.forwardRef)(
|
|
5253
|
+
({
|
|
5254
|
+
className,
|
|
5255
|
+
children,
|
|
5256
|
+
defaultValue,
|
|
5257
|
+
value: propValue,
|
|
5258
|
+
variant = "menu",
|
|
5259
|
+
onValueChange,
|
|
5260
|
+
...props
|
|
5261
|
+
}, ref) => {
|
|
5262
|
+
const storeRef = (0, import_react17.useRef)(null);
|
|
5263
|
+
storeRef.current ??= createMenuStore(onValueChange);
|
|
5264
|
+
const store = storeRef.current;
|
|
5265
|
+
const { setValue } = (0, import_zustand5.useStore)(store, (s) => s);
|
|
5266
|
+
(0, import_react17.useEffect)(() => {
|
|
5267
|
+
setValue(propValue ?? defaultValue);
|
|
5268
|
+
}, [defaultValue, propValue, setValue]);
|
|
5269
|
+
const baseClasses = "w-full py-2 flex flex-row items-center justify-center";
|
|
5270
|
+
const variantClasses = VARIANT_CLASSES5[variant];
|
|
5271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5272
|
+
"div",
|
|
4537
5273
|
{
|
|
4538
5274
|
ref,
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
"div",
|
|
4547
|
-
{
|
|
4548
|
-
className: `
|
|
4549
|
-
w-full flex ${direction == "col" ? "flex-col" : "flex-row items-center"} gap-2
|
|
4550
|
-
`,
|
|
4551
|
-
children: [
|
|
4552
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
|
|
4553
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "flex flex-row gap-1", children })
|
|
4554
|
-
]
|
|
4555
|
-
}
|
|
4556
|
-
),
|
|
4557
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
|
|
4558
|
-
]
|
|
5275
|
+
className: `
|
|
5276
|
+
${baseClasses}
|
|
5277
|
+
${variantClasses}
|
|
5278
|
+
${className ?? ""}
|
|
5279
|
+
`,
|
|
5280
|
+
...props,
|
|
5281
|
+
children: injectStore4(children, store)
|
|
4559
5282
|
}
|
|
4560
5283
|
);
|
|
4561
5284
|
}
|
|
4562
5285
|
);
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
onClickProfile,
|
|
4571
|
-
valueProfile,
|
|
4572
|
-
className = "",
|
|
4573
|
-
date,
|
|
4574
|
-
hour,
|
|
4575
|
-
...props
|
|
4576
|
-
}, ref) => {
|
|
4577
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4578
|
-
CardBase,
|
|
5286
|
+
Menu.displayName = "Menu";
|
|
5287
|
+
var MenuContent = (0, import_react17.forwardRef)(
|
|
5288
|
+
({ className, children, variant = "menu", ...props }, ref) => {
|
|
5289
|
+
const baseClasses = "w-full flex flex-row items-center gap-2";
|
|
5290
|
+
const variantClasses = variant === "menu2" ? "overflow-x-auto scroll-smooth" : "";
|
|
5291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5292
|
+
"ul",
|
|
4579
5293
|
{
|
|
4580
5294
|
ref,
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
5295
|
+
className: `
|
|
5296
|
+
${baseClasses}
|
|
5297
|
+
${variantClasses}
|
|
5298
|
+
${variant == "breadcrumb" ? "flex-wrap" : ""}
|
|
5299
|
+
${className ?? ""}
|
|
5300
|
+
`,
|
|
5301
|
+
style: variant === "menu2" ? { scrollbarWidth: "none", msOverflowStyle: "none" } : void 0,
|
|
4586
5302
|
...props,
|
|
4587
|
-
children
|
|
4588
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4589
|
-
"button",
|
|
4590
|
-
{
|
|
4591
|
-
type: "button",
|
|
4592
|
-
"aria-label": "Ver perfil",
|
|
4593
|
-
onClick: () => onClickProfile?.(valueProfile),
|
|
4594
|
-
className: "min-w-8 h-8 rounded-full bg-background-950"
|
|
4595
|
-
}
|
|
4596
|
-
),
|
|
4597
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
|
|
4598
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
|
|
4599
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
|
|
4600
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-xs text-text-600", children: [
|
|
4601
|
-
"\u2022 ",
|
|
4602
|
-
date,
|
|
4603
|
-
" \u2022 ",
|
|
4604
|
-
hour
|
|
4605
|
-
] })
|
|
4606
|
-
] }),
|
|
4607
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
|
|
4608
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4609
|
-
"button",
|
|
4610
|
-
{
|
|
4611
|
-
type: "button",
|
|
4612
|
-
"aria-label": "Ver coment\xE1rios",
|
|
4613
|
-
onClick: () => onClickComments?.(valueComments),
|
|
4614
|
-
className: "text-text-600 flex flex-row gap-2 items-center",
|
|
4615
|
-
children: [
|
|
4616
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.ChatCircleText, { "aria-hidden": "true", size: 16 }),
|
|
4617
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-xs", children: [
|
|
4618
|
-
comments,
|
|
4619
|
-
" respostas"
|
|
4620
|
-
] })
|
|
4621
|
-
]
|
|
4622
|
-
}
|
|
4623
|
-
)
|
|
4624
|
-
] })
|
|
4625
|
-
]
|
|
5303
|
+
children
|
|
4626
5304
|
}
|
|
4627
5305
|
);
|
|
4628
5306
|
}
|
|
4629
5307
|
);
|
|
4630
|
-
|
|
5308
|
+
MenuContent.displayName = "MenuContent";
|
|
5309
|
+
var MenuItem = (0, import_react17.forwardRef)(
|
|
4631
5310
|
({
|
|
4632
|
-
src,
|
|
4633
|
-
title,
|
|
4634
|
-
onPlay,
|
|
4635
|
-
onPause,
|
|
4636
|
-
onEnded,
|
|
4637
|
-
onAudioTimeUpdate,
|
|
4638
|
-
loop = false,
|
|
4639
|
-
preload = "metadata",
|
|
4640
|
-
tracks,
|
|
4641
5311
|
className,
|
|
5312
|
+
children,
|
|
5313
|
+
value,
|
|
5314
|
+
disabled = false,
|
|
5315
|
+
store: externalStore,
|
|
5316
|
+
variant = "menu",
|
|
5317
|
+
separator = false,
|
|
4642
5318
|
...props
|
|
4643
5319
|
}, ref) => {
|
|
4644
|
-
const
|
|
4645
|
-
const
|
|
4646
|
-
const
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
const audioRef = (0, import_react14.useRef)(null);
|
|
4650
|
-
const formatTime = (time) => {
|
|
4651
|
-
const minutes = Math.floor(time / 60);
|
|
4652
|
-
const seconds = Math.floor(time % 60);
|
|
4653
|
-
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
4654
|
-
};
|
|
4655
|
-
const handlePlayPause = () => {
|
|
4656
|
-
if (isPlaying) {
|
|
4657
|
-
audioRef.current?.pause();
|
|
4658
|
-
setIsPlaying(false);
|
|
4659
|
-
onPause?.();
|
|
4660
|
-
} else {
|
|
4661
|
-
audioRef.current?.play();
|
|
4662
|
-
setIsPlaying(true);
|
|
4663
|
-
onPlay?.();
|
|
4664
|
-
}
|
|
4665
|
-
};
|
|
4666
|
-
const handleTimeUpdate = () => {
|
|
4667
|
-
const current = audioRef.current?.currentTime ?? 0;
|
|
4668
|
-
const total = audioRef.current?.duration ?? 0;
|
|
4669
|
-
setCurrentTime(current);
|
|
4670
|
-
setDuration(total);
|
|
4671
|
-
onAudioTimeUpdate?.(current, total);
|
|
4672
|
-
};
|
|
4673
|
-
const handleLoadedMetadata = () => {
|
|
4674
|
-
setDuration(audioRef.current?.duration ?? 0);
|
|
4675
|
-
};
|
|
4676
|
-
const handleEnded = () => {
|
|
4677
|
-
setIsPlaying(false);
|
|
4678
|
-
setCurrentTime(0);
|
|
4679
|
-
onEnded?.();
|
|
4680
|
-
};
|
|
4681
|
-
const handleProgressClick = (e) => {
|
|
4682
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
4683
|
-
const clickX = e.clientX - rect.left;
|
|
4684
|
-
const width = rect.width;
|
|
4685
|
-
const percentage = clickX / width;
|
|
4686
|
-
const newTime = percentage * duration;
|
|
4687
|
-
if (audioRef.current) {
|
|
4688
|
-
audioRef.current.currentTime = newTime;
|
|
4689
|
-
}
|
|
4690
|
-
setCurrentTime(newTime);
|
|
4691
|
-
};
|
|
4692
|
-
const handleVolumeChange = (e) => {
|
|
4693
|
-
const newVolume = parseFloat(e.target.value);
|
|
4694
|
-
setVolume(newVolume);
|
|
4695
|
-
if (audioRef.current) {
|
|
4696
|
-
audioRef.current.volume = newVolume;
|
|
5320
|
+
const store = useMenuStore(externalStore);
|
|
5321
|
+
const { value: selectedValue, setValue } = (0, import_zustand5.useStore)(store, (s) => s);
|
|
5322
|
+
const handleClick = (e) => {
|
|
5323
|
+
if (!disabled) {
|
|
5324
|
+
setValue(value);
|
|
4697
5325
|
}
|
|
5326
|
+
props.onClick?.(e);
|
|
4698
5327
|
};
|
|
4699
|
-
const
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
5328
|
+
const commonProps = {
|
|
5329
|
+
role: "menuitem",
|
|
5330
|
+
"aria-disabled": disabled,
|
|
5331
|
+
ref,
|
|
5332
|
+
onClick: handleClick,
|
|
5333
|
+
onKeyDown: (e) => {
|
|
5334
|
+
if (["Enter", " "].includes(e.key)) handleClick(e);
|
|
5335
|
+
},
|
|
5336
|
+
tabIndex: disabled ? -1 : 0,
|
|
5337
|
+
onMouseDown: (e) => {
|
|
5338
|
+
e.preventDefault();
|
|
5339
|
+
},
|
|
5340
|
+
...props
|
|
4710
5341
|
};
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
}
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
{
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
|
|
4764
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
|
|
4765
|
-
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_phosphor_react13.Play, { size: 24 })
|
|
4766
|
-
}
|
|
4767
|
-
),
|
|
4768
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
|
|
4769
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4770
|
-
"button",
|
|
4771
|
-
{
|
|
4772
|
-
type: "button",
|
|
4773
|
-
className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
|
|
4774
|
-
onClick: handleProgressClick,
|
|
4775
|
-
onKeyDown: (e) => {
|
|
4776
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
4777
|
-
e.preventDefault();
|
|
4778
|
-
handleProgressClick(
|
|
4779
|
-
e
|
|
4780
|
-
);
|
|
4781
|
-
}
|
|
4782
|
-
},
|
|
4783
|
-
"aria-label": "Barra de progresso do \xE1udio",
|
|
4784
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4785
|
-
"div",
|
|
4786
|
-
{
|
|
4787
|
-
className: "h-full bg-primary-600 rounded-full transition-all duration-100",
|
|
4788
|
-
style: {
|
|
4789
|
-
width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
|
|
4790
|
-
}
|
|
4791
|
-
}
|
|
4792
|
-
)
|
|
4793
|
-
}
|
|
4794
|
-
) }),
|
|
4795
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(duration) }),
|
|
4796
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative", children: [
|
|
4797
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4798
|
-
"button",
|
|
5342
|
+
const variants = {
|
|
5343
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5344
|
+
"li",
|
|
5345
|
+
{
|
|
5346
|
+
"data-variant": "menu",
|
|
5347
|
+
className: `
|
|
5348
|
+
w-full flex flex-col items-center justify-center gap-0.5 py-1 px-2 rounded-sm font-medium text-xs
|
|
5349
|
+
[&>svg]:size-6 cursor-pointer hover:bg-primary-600 hover:text-text
|
|
5350
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
5351
|
+
${selectedValue === value ? "bg-primary-50 text-primary-950" : "text-text-950"}
|
|
5352
|
+
${className ?? ""}
|
|
5353
|
+
`,
|
|
5354
|
+
...commonProps,
|
|
5355
|
+
children
|
|
5356
|
+
}
|
|
5357
|
+
),
|
|
5358
|
+
menu2: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5359
|
+
"li",
|
|
5360
|
+
{
|
|
5361
|
+
"data-variant": "menu2",
|
|
5362
|
+
className: `
|
|
5363
|
+
w-full flex flex-col items-center px-2 pt-4 gap-3 cursor-pointer focus:rounded-sm justify-center hover:bg-background-100 rounded-lg
|
|
5364
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
5365
|
+
${selectedValue === value ? "" : "pb-4"}
|
|
5366
|
+
`,
|
|
5367
|
+
...commonProps,
|
|
5368
|
+
children: [
|
|
5369
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5370
|
+
"span",
|
|
5371
|
+
{
|
|
5372
|
+
className: `flex flex-row items-center gap-2 px-4 text-text-950 text-xs font-bold ${className ?? ""}`,
|
|
5373
|
+
children
|
|
5374
|
+
}
|
|
5375
|
+
),
|
|
5376
|
+
selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "h-1 w-full bg-primary-950 rounded-lg" })
|
|
5377
|
+
]
|
|
5378
|
+
}
|
|
5379
|
+
),
|
|
5380
|
+
breadcrumb: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5381
|
+
"li",
|
|
5382
|
+
{
|
|
5383
|
+
"data-variant": "breadcrumb",
|
|
5384
|
+
className: `
|
|
5385
|
+
flex flex-row gap-2 items-center w-fit p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs
|
|
5386
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
5387
|
+
${selectedValue === value ? "text-text-950" : "text-text-600"}
|
|
5388
|
+
${className ?? ""}
|
|
5389
|
+
`,
|
|
5390
|
+
...commonProps,
|
|
5391
|
+
children: [
|
|
5392
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5393
|
+
"span",
|
|
4799
5394
|
{
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
children
|
|
5395
|
+
className: `
|
|
5396
|
+
border-b border-text-600 hover:border-primary-600 text-inherit text-xs
|
|
5397
|
+
${selectedValue === value ? "border-b-0 font-bold" : "border-b-text-600"}
|
|
5398
|
+
`,
|
|
5399
|
+
children
|
|
4805
5400
|
}
|
|
4806
5401
|
),
|
|
4807
|
-
|
|
4808
|
-
|
|
5402
|
+
separator && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5403
|
+
import_phosphor_react15.CaretRight,
|
|
4809
5404
|
{
|
|
4810
|
-
|
|
4811
|
-
className: "
|
|
4812
|
-
|
|
4813
|
-
if (e.key === "Escape") {
|
|
4814
|
-
setShowVolumeControl(false);
|
|
4815
|
-
}
|
|
4816
|
-
},
|
|
4817
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4818
|
-
"input",
|
|
4819
|
-
{
|
|
4820
|
-
type: "range",
|
|
4821
|
-
min: "0",
|
|
4822
|
-
max: "1",
|
|
4823
|
-
step: "0.1",
|
|
4824
|
-
value: volume,
|
|
4825
|
-
onChange: handleVolumeChange,
|
|
4826
|
-
onKeyDown: (e) => {
|
|
4827
|
-
if (e.key === "ArrowUp" || e.key === "ArrowRight") {
|
|
4828
|
-
e.preventDefault();
|
|
4829
|
-
const newVolume = Math.min(
|
|
4830
|
-
1,
|
|
4831
|
-
Math.round((volume + 0.1) * 10) / 10
|
|
4832
|
-
);
|
|
4833
|
-
setVolume(newVolume);
|
|
4834
|
-
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
4835
|
-
} else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
|
|
4836
|
-
e.preventDefault();
|
|
4837
|
-
const newVolume = Math.max(
|
|
4838
|
-
0,
|
|
4839
|
-
Math.round((volume - 0.1) * 10) / 10
|
|
4840
|
-
);
|
|
4841
|
-
setVolume(newVolume);
|
|
4842
|
-
if (audioRef.current) audioRef.current.volume = newVolume;
|
|
4843
|
-
}
|
|
4844
|
-
},
|
|
4845
|
-
className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
|
|
4846
|
-
style: {
|
|
4847
|
-
background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
|
|
4848
|
-
},
|
|
4849
|
-
"aria-label": "Volume",
|
|
4850
|
-
"aria-valuenow": Math.round(volume * 100),
|
|
4851
|
-
"aria-valuemin": 0,
|
|
4852
|
-
"aria-valuemax": 100
|
|
4853
|
-
}
|
|
4854
|
-
)
|
|
5405
|
+
size: 16,
|
|
5406
|
+
className: "text-text-600",
|
|
5407
|
+
"data-testid": "separator"
|
|
4855
5408
|
}
|
|
4856
5409
|
)
|
|
4857
|
-
]
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
className: "text-text-950 cursor-pointer hover:text-primary-600"
|
|
4863
|
-
}
|
|
4864
|
-
)
|
|
4865
|
-
]
|
|
4866
|
-
}
|
|
4867
|
-
);
|
|
5410
|
+
]
|
|
5411
|
+
}
|
|
5412
|
+
)
|
|
5413
|
+
};
|
|
5414
|
+
return variants[variant] ?? variants["menu"];
|
|
4868
5415
|
}
|
|
4869
5416
|
);
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
5417
|
+
MenuItem.displayName = "MenuItem";
|
|
5418
|
+
var internalScroll = (container, direction) => {
|
|
5419
|
+
if (!container) return;
|
|
5420
|
+
container.scrollBy({
|
|
5421
|
+
left: direction === "left" ? -150 : 150,
|
|
5422
|
+
behavior: "smooth"
|
|
5423
|
+
});
|
|
4875
5424
|
};
|
|
4876
|
-
var
|
|
4877
|
-
(
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
] })
|
|
4899
|
-
] }),
|
|
4900
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4901
|
-
import_phosphor_react13.CaretRight,
|
|
4902
|
-
{
|
|
4903
|
-
size: 24,
|
|
4904
|
-
className: "text-text-800 flex-shrink-0",
|
|
4905
|
-
"data-testid": "caret-icon"
|
|
4906
|
-
}
|
|
4907
|
-
)
|
|
4908
|
-
] })
|
|
4909
|
-
}
|
|
5425
|
+
var internalCheckScroll = (container, setShowLeftArrow, setShowRightArrow) => {
|
|
5426
|
+
if (!container) return;
|
|
5427
|
+
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
5428
|
+
setShowLeftArrow(scrollLeft > 0);
|
|
5429
|
+
setShowRightArrow(scrollLeft + clientWidth < scrollWidth);
|
|
5430
|
+
};
|
|
5431
|
+
var MenuOverflow = ({
|
|
5432
|
+
children,
|
|
5433
|
+
className,
|
|
5434
|
+
defaultValue,
|
|
5435
|
+
value,
|
|
5436
|
+
onValueChange,
|
|
5437
|
+
...props
|
|
5438
|
+
}) => {
|
|
5439
|
+
const containerRef = (0, import_react17.useRef)(null);
|
|
5440
|
+
const [showLeftArrow, setShowLeftArrow] = (0, import_react17.useState)(false);
|
|
5441
|
+
const [showRightArrow, setShowRightArrow] = (0, import_react17.useState)(false);
|
|
5442
|
+
(0, import_react17.useEffect)(() => {
|
|
5443
|
+
const checkScroll = () => internalCheckScroll(
|
|
5444
|
+
containerRef.current,
|
|
5445
|
+
setShowLeftArrow,
|
|
5446
|
+
setShowRightArrow
|
|
4910
5447
|
);
|
|
4911
|
-
|
|
4912
|
-
|
|
5448
|
+
checkScroll();
|
|
5449
|
+
const container = containerRef.current;
|
|
5450
|
+
container?.addEventListener("scroll", checkScroll);
|
|
5451
|
+
window.addEventListener("resize", checkScroll);
|
|
5452
|
+
return () => {
|
|
5453
|
+
container?.removeEventListener("scroll", checkScroll);
|
|
5454
|
+
window.removeEventListener("resize", checkScroll);
|
|
5455
|
+
};
|
|
5456
|
+
}, []);
|
|
5457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5458
|
+
"div",
|
|
5459
|
+
{
|
|
5460
|
+
"data-testid": "menu-overflow-wrapper",
|
|
5461
|
+
className: `relative w-full overflow-hidden ${className ?? ""}`,
|
|
5462
|
+
children: [
|
|
5463
|
+
showLeftArrow && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5464
|
+
"button",
|
|
5465
|
+
{
|
|
5466
|
+
onClick: () => internalScroll(containerRef.current, "left"),
|
|
5467
|
+
className: "absolute left-0 top-1/2 -translate-y-1/2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md cursor-pointer",
|
|
5468
|
+
"data-testid": "scroll-left-button",
|
|
5469
|
+
children: [
|
|
5470
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_phosphor_react15.CaretLeft, { size: 16 }),
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sr-only", children: "Scroll left" })
|
|
5472
|
+
]
|
|
5473
|
+
}
|
|
5474
|
+
),
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5476
|
+
Menu,
|
|
5477
|
+
{
|
|
5478
|
+
defaultValue,
|
|
5479
|
+
onValueChange,
|
|
5480
|
+
value,
|
|
5481
|
+
variant: "menu2",
|
|
5482
|
+
...props,
|
|
5483
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MenuContent, { ref: containerRef, variant: "menu2", children })
|
|
5484
|
+
}
|
|
5485
|
+
),
|
|
5486
|
+
showRightArrow && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5487
|
+
"button",
|
|
5488
|
+
{
|
|
5489
|
+
onClick: () => internalScroll(containerRef.current, "right"),
|
|
5490
|
+
className: "absolute right-0 top-1/2 -translate-y-1/2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md cursor-pointer",
|
|
5491
|
+
"data-testid": "scroll-right-button",
|
|
5492
|
+
children: [
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_phosphor_react15.CaretRight, { size: 16 }),
|
|
5494
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sr-only", children: "Scroll right" })
|
|
5495
|
+
]
|
|
5496
|
+
}
|
|
5497
|
+
)
|
|
5498
|
+
]
|
|
5499
|
+
}
|
|
5500
|
+
);
|
|
5501
|
+
};
|
|
5502
|
+
var injectStore4 = (children, store) => import_react17.Children.map(children, (child) => {
|
|
5503
|
+
if (!(0, import_react17.isValidElement)(child)) return child;
|
|
5504
|
+
const typedChild = child;
|
|
5505
|
+
const shouldInject = typedChild.type === MenuItem;
|
|
5506
|
+
return (0, import_react17.cloneElement)(typedChild, {
|
|
5507
|
+
...shouldInject ? { store } : {},
|
|
5508
|
+
...typedChild.props.children ? { children: injectStore4(typedChild.props.children, store) } : {}
|
|
5509
|
+
});
|
|
5510
|
+
});
|
|
5511
|
+
var Menu_default = Menu;
|
|
4913
5512
|
|
|
4914
5513
|
// src/components/Skeleton/Skeleton.tsx
|
|
4915
|
-
var
|
|
4916
|
-
var
|
|
5514
|
+
var import_react18 = require("react");
|
|
5515
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4917
5516
|
var SKELETON_ANIMATION_CLASSES = {
|
|
4918
5517
|
pulse: "animate-pulse",
|
|
4919
5518
|
none: ""
|
|
@@ -4930,7 +5529,7 @@ var SPACING_CLASSES = {
|
|
|
4930
5529
|
medium: "space-y-2",
|
|
4931
5530
|
large: "space-y-3"
|
|
4932
5531
|
};
|
|
4933
|
-
var Skeleton = (0,
|
|
5532
|
+
var Skeleton = (0, import_react18.forwardRef)(
|
|
4934
5533
|
({
|
|
4935
5534
|
variant = "text",
|
|
4936
5535
|
width,
|
|
@@ -4950,13 +5549,13 @@ var Skeleton = (0, import_react15.forwardRef)(
|
|
|
4950
5549
|
height: typeof height === "number" ? `${height}px` : height
|
|
4951
5550
|
};
|
|
4952
5551
|
if (variant === "text" && lines > 1) {
|
|
4953
|
-
return /* @__PURE__ */ (0,
|
|
5552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4954
5553
|
"div",
|
|
4955
5554
|
{
|
|
4956
5555
|
ref,
|
|
4957
5556
|
className: `flex flex-col ${spacingClass} ${className}`,
|
|
4958
5557
|
...props,
|
|
4959
|
-
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0,
|
|
5558
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4960
5559
|
"div",
|
|
4961
5560
|
{
|
|
4962
5561
|
className: `${variantClass} ${animationClass}`,
|
|
@@ -4967,7 +5566,7 @@ var Skeleton = (0, import_react15.forwardRef)(
|
|
|
4967
5566
|
}
|
|
4968
5567
|
);
|
|
4969
5568
|
}
|
|
4970
|
-
return /* @__PURE__ */ (0,
|
|
5569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4971
5570
|
"div",
|
|
4972
5571
|
{
|
|
4973
5572
|
ref,
|
|
@@ -4979,13 +5578,13 @@ var Skeleton = (0, import_react15.forwardRef)(
|
|
|
4979
5578
|
);
|
|
4980
5579
|
}
|
|
4981
5580
|
);
|
|
4982
|
-
var SkeletonText = (0,
|
|
4983
|
-
(props, ref) => /* @__PURE__ */ (0,
|
|
5581
|
+
var SkeletonText = (0, import_react18.forwardRef)(
|
|
5582
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
4984
5583
|
);
|
|
4985
|
-
var SkeletonCircle = (0,
|
|
4986
|
-
var SkeletonRectangle = (0,
|
|
4987
|
-
var SkeletonRounded = (0,
|
|
4988
|
-
var SkeletonCard = (0,
|
|
5584
|
+
var SkeletonCircle = (0, import_react18.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
5585
|
+
var SkeletonRectangle = (0, import_react18.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
5586
|
+
var SkeletonRounded = (0, import_react18.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
5587
|
+
var SkeletonCard = (0, import_react18.forwardRef)(
|
|
4989
5588
|
({
|
|
4990
5589
|
showAvatar = true,
|
|
4991
5590
|
showTitle = true,
|
|
@@ -4995,30 +5594,30 @@ var SkeletonCard = (0, import_react15.forwardRef)(
|
|
|
4995
5594
|
className = "",
|
|
4996
5595
|
...props
|
|
4997
5596
|
}, ref) => {
|
|
4998
|
-
return /* @__PURE__ */ (0,
|
|
5597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4999
5598
|
"div",
|
|
5000
5599
|
{
|
|
5001
5600
|
ref,
|
|
5002
5601
|
className: `w-full p-4 bg-background border border-border-200 rounded-lg ${className}`,
|
|
5003
5602
|
...props,
|
|
5004
5603
|
children: [
|
|
5005
|
-
/* @__PURE__ */ (0,
|
|
5006
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
5007
|
-
/* @__PURE__ */ (0,
|
|
5008
|
-
showTitle && /* @__PURE__ */ (0,
|
|
5009
|
-
showDescription && /* @__PURE__ */ (0,
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
5605
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonCircle, { width: 40, height: 40 }),
|
|
5606
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
5607
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonText, { width: "60%", height: 20 }),
|
|
5608
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
5010
5609
|
] })
|
|
5011
5610
|
] }),
|
|
5012
|
-
showActions && /* @__PURE__ */ (0,
|
|
5013
|
-
/* @__PURE__ */ (0,
|
|
5014
|
-
/* @__PURE__ */ (0,
|
|
5611
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
5612
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
|
|
5613
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonRectangle, { width: 80, height: 32 })
|
|
5015
5614
|
] })
|
|
5016
5615
|
]
|
|
5017
5616
|
}
|
|
5018
5617
|
);
|
|
5019
5618
|
}
|
|
5020
5619
|
);
|
|
5021
|
-
var SkeletonList = (0,
|
|
5620
|
+
var SkeletonList = (0, import_react18.forwardRef)(
|
|
5022
5621
|
({
|
|
5023
5622
|
items = 3,
|
|
5024
5623
|
showAvatar = true,
|
|
@@ -5028,19 +5627,19 @@ var SkeletonList = (0, import_react15.forwardRef)(
|
|
|
5028
5627
|
className = "",
|
|
5029
5628
|
...props
|
|
5030
5629
|
}, ref) => {
|
|
5031
|
-
return /* @__PURE__ */ (0,
|
|
5032
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
5033
|
-
/* @__PURE__ */ (0,
|
|
5034
|
-
showTitle && /* @__PURE__ */ (0,
|
|
5035
|
-
showDescription && /* @__PURE__ */ (0,
|
|
5630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref, className: `space-y-3 ${className}`, ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
5631
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonCircle, { width: 32, height: 32 }),
|
|
5632
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
5633
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonText, { width: "40%", height: 16 }),
|
|
5634
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
5036
5635
|
] })
|
|
5037
5636
|
] }, index)) });
|
|
5038
5637
|
}
|
|
5039
5638
|
);
|
|
5040
|
-
var SkeletonTable = (0,
|
|
5639
|
+
var SkeletonTable = (0, import_react18.forwardRef)(
|
|
5041
5640
|
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
5042
|
-
return /* @__PURE__ */ (0,
|
|
5043
|
-
showHeader && /* @__PURE__ */ (0,
|
|
5641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { ref, className: `w-full ${className}`, ...props, children: [
|
|
5642
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5044
5643
|
SkeletonText,
|
|
5045
5644
|
{
|
|
5046
5645
|
width: `${100 / columns}%`,
|
|
@@ -5048,7 +5647,7 @@ var SkeletonTable = (0, import_react15.forwardRef)(
|
|
|
5048
5647
|
},
|
|
5049
5648
|
index
|
|
5050
5649
|
)) }),
|
|
5051
|
-
/* @__PURE__ */ (0,
|
|
5650
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5052
5651
|
SkeletonText,
|
|
5053
5652
|
{
|
|
5054
5653
|
width: `${100 / columns}%`,
|
|
@@ -5061,10 +5660,10 @@ var SkeletonTable = (0, import_react15.forwardRef)(
|
|
|
5061
5660
|
);
|
|
5062
5661
|
|
|
5063
5662
|
// src/components/Auth/Auth.tsx
|
|
5064
|
-
var
|
|
5663
|
+
var import_react19 = require("react");
|
|
5065
5664
|
var import_react_router_dom = require("react-router-dom");
|
|
5066
|
-
var
|
|
5067
|
-
var AuthContext = (0,
|
|
5665
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5666
|
+
var AuthContext = (0, import_react19.createContext)(void 0);
|
|
5068
5667
|
var AuthProvider = ({
|
|
5069
5668
|
children,
|
|
5070
5669
|
checkAuthFn,
|
|
@@ -5074,12 +5673,12 @@ var AuthProvider = ({
|
|
|
5074
5673
|
getSessionFn,
|
|
5075
5674
|
getTokensFn
|
|
5076
5675
|
}) => {
|
|
5077
|
-
const [authState, setAuthState] = (0,
|
|
5676
|
+
const [authState, setAuthState] = (0, import_react19.useState)({
|
|
5078
5677
|
isAuthenticated: false,
|
|
5079
5678
|
isLoading: true,
|
|
5080
5679
|
...initialAuthState
|
|
5081
5680
|
});
|
|
5082
|
-
const checkAuth = (0,
|
|
5681
|
+
const checkAuth = (0, import_react19.useCallback)(async () => {
|
|
5083
5682
|
try {
|
|
5084
5683
|
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
5085
5684
|
if (!checkAuthFn) {
|
|
@@ -5110,7 +5709,7 @@ var AuthProvider = ({
|
|
|
5110
5709
|
return false;
|
|
5111
5710
|
}
|
|
5112
5711
|
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
5113
|
-
const signOut = (0,
|
|
5712
|
+
const signOut = (0, import_react19.useCallback)(() => {
|
|
5114
5713
|
if (signOutFn) {
|
|
5115
5714
|
signOutFn();
|
|
5116
5715
|
}
|
|
@@ -5122,10 +5721,10 @@ var AuthProvider = ({
|
|
|
5122
5721
|
tokens: void 0
|
|
5123
5722
|
}));
|
|
5124
5723
|
}, [signOutFn]);
|
|
5125
|
-
(0,
|
|
5724
|
+
(0, import_react19.useEffect)(() => {
|
|
5126
5725
|
checkAuth();
|
|
5127
5726
|
}, [checkAuth]);
|
|
5128
|
-
const contextValue = (0,
|
|
5727
|
+
const contextValue = (0, import_react19.useMemo)(
|
|
5129
5728
|
() => ({
|
|
5130
5729
|
...authState,
|
|
5131
5730
|
checkAuth,
|
|
@@ -5133,10 +5732,10 @@ var AuthProvider = ({
|
|
|
5133
5732
|
}),
|
|
5134
5733
|
[authState, checkAuth, signOut]
|
|
5135
5734
|
);
|
|
5136
|
-
return /* @__PURE__ */ (0,
|
|
5735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AuthContext.Provider, { value: contextValue, children });
|
|
5137
5736
|
};
|
|
5138
5737
|
var useAuth = () => {
|
|
5139
|
-
const context = (0,
|
|
5738
|
+
const context = (0, import_react19.useContext)(AuthContext);
|
|
5140
5739
|
if (context === void 0) {
|
|
5141
5740
|
throw new Error("useAuth deve ser usado dentro de um AuthProvider");
|
|
5142
5741
|
}
|
|
@@ -5149,17 +5748,17 @@ var ProtectedRoute = ({
|
|
|
5149
5748
|
additionalCheck
|
|
5150
5749
|
}) => {
|
|
5151
5750
|
const { isAuthenticated, isLoading, ...authState } = useAuth();
|
|
5152
|
-
const defaultLoadingComponent = /* @__PURE__ */ (0,
|
|
5751
|
+
const defaultLoadingComponent = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
|
|
5153
5752
|
if (isLoading) {
|
|
5154
|
-
return /* @__PURE__ */ (0,
|
|
5753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: loadingComponent || defaultLoadingComponent });
|
|
5155
5754
|
}
|
|
5156
5755
|
if (!isAuthenticated) {
|
|
5157
|
-
return /* @__PURE__ */ (0,
|
|
5756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom.Navigate, { to: redirectTo, replace: true });
|
|
5158
5757
|
}
|
|
5159
5758
|
if (additionalCheck && !additionalCheck({ isAuthenticated, isLoading, ...authState })) {
|
|
5160
|
-
return /* @__PURE__ */ (0,
|
|
5759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom.Navigate, { to: redirectTo, replace: true });
|
|
5161
5760
|
}
|
|
5162
|
-
return /* @__PURE__ */ (0,
|
|
5761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
|
5163
5762
|
};
|
|
5164
5763
|
var PublicRoute = ({
|
|
5165
5764
|
children,
|
|
@@ -5169,15 +5768,15 @@ var PublicRoute = ({
|
|
|
5169
5768
|
}) => {
|
|
5170
5769
|
const { isAuthenticated, isLoading } = useAuth();
|
|
5171
5770
|
if (checkAuthBeforeRender && isLoading) {
|
|
5172
|
-
return /* @__PURE__ */ (0,
|
|
5771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "text-text-950 text-lg", children: "Carregando..." }) });
|
|
5173
5772
|
}
|
|
5174
5773
|
if (isAuthenticated && redirectIfAuthenticated) {
|
|
5175
|
-
return /* @__PURE__ */ (0,
|
|
5774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom.Navigate, { to: redirectTo, replace: true });
|
|
5176
5775
|
}
|
|
5177
|
-
return /* @__PURE__ */ (0,
|
|
5776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
|
5178
5777
|
};
|
|
5179
5778
|
var withAuth = (Component, options = {}) => {
|
|
5180
|
-
return (props) => /* @__PURE__ */ (0,
|
|
5779
|
+
return (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ProtectedRoute, { ...options, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Component, { ...props }) });
|
|
5181
5780
|
};
|
|
5182
5781
|
var useAuthGuard = (options = {}) => {
|
|
5183
5782
|
const authState = useAuth();
|
|
@@ -5192,178 +5791,23 @@ var useAuthGuard = (options = {}) => {
|
|
|
5192
5791
|
var useRouteAuth = (fallbackPath = "/") => {
|
|
5193
5792
|
const { isAuthenticated, isLoading } = useAuth();
|
|
5194
5793
|
const location = (0, import_react_router_dom.useLocation)();
|
|
5195
|
-
const redirectToLogin = () => /* @__PURE__ */ (0,
|
|
5794
|
+
const redirectToLogin = () => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom.Navigate, { to: fallbackPath, state: { from: location }, replace: true });
|
|
5196
5795
|
return {
|
|
5197
5796
|
isAuthenticated,
|
|
5198
5797
|
isLoading,
|
|
5199
5798
|
redirectToLogin
|
|
5200
5799
|
};
|
|
5201
5800
|
};
|
|
5202
|
-
|
|
5203
|
-
// src/components/Tab/Tab.tsx
|
|
5204
|
-
var import_react17 = require("react");
|
|
5205
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5206
|
-
var TAB_SIZE_CLASSES = {
|
|
5207
|
-
small: {
|
|
5208
|
-
container: "h-10 gap-1",
|
|
5209
|
-
tab: "px-3 py-2 text-sm",
|
|
5210
|
-
indicator: "h-0.5"
|
|
5211
|
-
},
|
|
5212
|
-
medium: {
|
|
5213
|
-
container: "h-12 gap-2",
|
|
5214
|
-
tab: "px-4 py-4 text-sm",
|
|
5215
|
-
indicator: "h-1"
|
|
5216
|
-
},
|
|
5217
|
-
large: {
|
|
5218
|
-
container: "h-14 gap-2",
|
|
5219
|
-
tab: "px-6 py-4 text-base",
|
|
5220
|
-
indicator: "h-1"
|
|
5221
|
-
}
|
|
5222
|
-
};
|
|
5223
|
-
var RESPONSIVE_WIDTH_CLASSES = {
|
|
5224
|
-
twoTabs: "w-[115px] sm:w-[204px]",
|
|
5225
|
-
threeTabs: "w-[100px] sm:w-[160px]",
|
|
5226
|
-
fourTabs: "w-[80px] sm:w-[140px]",
|
|
5227
|
-
fiveTabs: "w-[70px] sm:w-[120px]",
|
|
5228
|
-
default: "flex-1"
|
|
5229
|
-
};
|
|
5230
|
-
var Tab = (0, import_react17.forwardRef)(
|
|
5231
|
-
({
|
|
5232
|
-
tabs,
|
|
5233
|
-
activeTab,
|
|
5234
|
-
onTabChange,
|
|
5235
|
-
size = "medium",
|
|
5236
|
-
responsive = true,
|
|
5237
|
-
className = "",
|
|
5238
|
-
...props
|
|
5239
|
-
}, ref) => {
|
|
5240
|
-
const sizeClasses = TAB_SIZE_CLASSES[size];
|
|
5241
|
-
const getResponsiveWidthClass = (tabCount) => {
|
|
5242
|
-
if (!responsive) return RESPONSIVE_WIDTH_CLASSES.default;
|
|
5243
|
-
switch (tabCount) {
|
|
5244
|
-
case 2:
|
|
5245
|
-
return RESPONSIVE_WIDTH_CLASSES.twoTabs;
|
|
5246
|
-
case 3:
|
|
5247
|
-
return RESPONSIVE_WIDTH_CLASSES.threeTabs;
|
|
5248
|
-
case 4:
|
|
5249
|
-
return RESPONSIVE_WIDTH_CLASSES.fourTabs;
|
|
5250
|
-
case 5:
|
|
5251
|
-
return RESPONSIVE_WIDTH_CLASSES.fiveTabs;
|
|
5252
|
-
default:
|
|
5253
|
-
return RESPONSIVE_WIDTH_CLASSES.default;
|
|
5254
|
-
}
|
|
5255
|
-
};
|
|
5256
|
-
const handleTabClick = (tabId) => {
|
|
5257
|
-
const tab = tabs.find((t) => t.id === tabId);
|
|
5258
|
-
if (tab && !tab.disabled) {
|
|
5259
|
-
onTabChange(tabId);
|
|
5260
|
-
}
|
|
5261
|
-
};
|
|
5262
|
-
const wrapAroundIndex = (index, maxLength) => {
|
|
5263
|
-
if (index < 0) return maxLength - 1;
|
|
5264
|
-
if (index >= maxLength) return 0;
|
|
5265
|
-
return index;
|
|
5266
|
-
};
|
|
5267
|
-
const findNextValidTab = (startIndex, direction) => {
|
|
5268
|
-
let nextIndex = wrapAroundIndex(startIndex + direction, tabs.length);
|
|
5269
|
-
let attempts = 0;
|
|
5270
|
-
while (tabs[nextIndex]?.disabled && attempts < tabs.length) {
|
|
5271
|
-
nextIndex = wrapAroundIndex(nextIndex + direction, tabs.length);
|
|
5272
|
-
attempts++;
|
|
5273
|
-
}
|
|
5274
|
-
return nextIndex;
|
|
5275
|
-
};
|
|
5276
|
-
const handleArrowNavigation = (direction) => {
|
|
5277
|
-
const currentIndex = tabs.findIndex((tab) => tab.id === activeTab);
|
|
5278
|
-
const nextIndex = findNextValidTab(currentIndex, direction);
|
|
5279
|
-
if (!tabs[nextIndex]?.disabled && nextIndex !== currentIndex) {
|
|
5280
|
-
handleTabClick(tabs[nextIndex].id);
|
|
5281
|
-
}
|
|
5282
|
-
};
|
|
5283
|
-
const handleKeyDown = (event, tabId) => {
|
|
5284
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
5285
|
-
event.preventDefault();
|
|
5286
|
-
handleTabClick(tabId);
|
|
5287
|
-
return;
|
|
5288
|
-
}
|
|
5289
|
-
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
5290
|
-
event.preventDefault();
|
|
5291
|
-
const direction = event.key === "ArrowLeft" ? -1 : 1;
|
|
5292
|
-
handleArrowNavigation(direction);
|
|
5293
|
-
}
|
|
5294
|
-
};
|
|
5295
|
-
const getTabClassNames = (isDisabled, isActive) => {
|
|
5296
|
-
if (isDisabled) {
|
|
5297
|
-
return "text-text-400 cursor-not-allowed opacity-50";
|
|
5298
|
-
}
|
|
5299
|
-
if (isActive) {
|
|
5300
|
-
return "text-text-950";
|
|
5301
|
-
}
|
|
5302
|
-
return "text-text-700 hover:text-text-800";
|
|
5303
|
-
};
|
|
5304
|
-
const tabWidthClass = getResponsiveWidthClass(tabs.length);
|
|
5305
|
-
const containerWidth = responsive && tabs.length <= 2 ? "w-[240px] sm:w-[416px]" : "w-full";
|
|
5306
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5307
|
-
"div",
|
|
5308
|
-
{
|
|
5309
|
-
ref,
|
|
5310
|
-
className: `flex flex-row items-start ${sizeClasses.container} ${containerWidth} ${className}`,
|
|
5311
|
-
role: "tablist",
|
|
5312
|
-
...props,
|
|
5313
|
-
children: tabs.map((tab) => {
|
|
5314
|
-
const isActive = tab.id === activeTab;
|
|
5315
|
-
const isDisabled = Boolean(tab.disabled);
|
|
5316
|
-
const tabClassNames = getTabClassNames(isDisabled, isActive);
|
|
5317
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5318
|
-
"button",
|
|
5319
|
-
{
|
|
5320
|
-
type: "button",
|
|
5321
|
-
role: "tab",
|
|
5322
|
-
"aria-selected": isActive,
|
|
5323
|
-
"aria-disabled": isDisabled,
|
|
5324
|
-
tabIndex: isActive ? 0 : -1,
|
|
5325
|
-
className: `
|
|
5326
|
-
relative flex flex-row justify-center items-center gap-2 rounded transition-colors isolate
|
|
5327
|
-
${sizeClasses.tab}
|
|
5328
|
-
${tabWidthClass}
|
|
5329
|
-
${tabClassNames}
|
|
5330
|
-
${!isDisabled && !isActive ? "hover:bg-background-50" : ""}
|
|
5331
|
-
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2
|
|
5332
|
-
`,
|
|
5333
|
-
onClick: () => handleTabClick(tab.id),
|
|
5334
|
-
onKeyDown: (e) => handleKeyDown(e, tab.id),
|
|
5335
|
-
disabled: isDisabled,
|
|
5336
|
-
"data-testid": `tab-${tab.id}`,
|
|
5337
|
-
children: [
|
|
5338
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "font-bold leading-4 tracking-[0.2px] truncate", children: responsive && tab.mobileLabel ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5339
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sm:hidden", children: tab.mobileLabel }),
|
|
5340
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "hidden sm:inline", children: tab.label })
|
|
5341
|
-
] }) : tab.label }),
|
|
5342
|
-
isActive && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5343
|
-
"div",
|
|
5344
|
-
{
|
|
5345
|
-
className: `absolute bottom-0 left-2 right-2 bg-primary-700 rounded-lg z-[2] ${sizeClasses.indicator}`,
|
|
5346
|
-
"data-testid": "active-indicator"
|
|
5347
|
-
}
|
|
5348
|
-
)
|
|
5349
|
-
]
|
|
5350
|
-
},
|
|
5351
|
-
tab.id
|
|
5352
|
-
);
|
|
5353
|
-
})
|
|
5354
|
-
}
|
|
5355
|
-
);
|
|
5356
|
-
}
|
|
5357
|
-
);
|
|
5358
|
-
Tab.displayName = "Tab";
|
|
5359
|
-
var Tab_default = Tab;
|
|
5360
5801
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5361
5802
|
0 && (module.exports = {
|
|
5362
5803
|
Alert,
|
|
5804
|
+
AlertDialog,
|
|
5805
|
+
AlternativesList,
|
|
5363
5806
|
AuthProvider,
|
|
5364
5807
|
Badge,
|
|
5365
5808
|
Button,
|
|
5366
5809
|
Calendar,
|
|
5810
|
+
CardAccordation,
|
|
5367
5811
|
CardActivitiesResults,
|
|
5368
5812
|
CardPerformance,
|
|
5369
5813
|
CardProgress,
|
|
@@ -5399,6 +5843,8 @@ var Tab_default = Tab;
|
|
|
5399
5843
|
ProtectedRoute,
|
|
5400
5844
|
PublicRoute,
|
|
5401
5845
|
Radio,
|
|
5846
|
+
RadioGroup,
|
|
5847
|
+
RadioGroupItem,
|
|
5402
5848
|
Select,
|
|
5403
5849
|
SelectContent,
|
|
5404
5850
|
SelectItem,
|
|
@@ -5414,7 +5860,6 @@ var Tab_default = Tab;
|
|
|
5414
5860
|
SkeletonTable,
|
|
5415
5861
|
SkeletonText,
|
|
5416
5862
|
Stepper,
|
|
5417
|
-
Tab,
|
|
5418
5863
|
Table,
|
|
5419
5864
|
Text,
|
|
5420
5865
|
TextArea,
|