analytica-frontend-lib 1.0.68 → 1.0.71

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