dirk-cfx-react 1.1.66 → 1.1.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2262,6 +2262,122 @@ function extractDefaults(schema) {
2262
2262
  }
2263
2263
  return void 0;
2264
2264
  }
2265
+
2266
+ // src/utils/gtaControls.ts
2267
+ var GTA_CONTROLS = [
2268
+ // ── Camera ─────────────────────────────────────────────────────────────────
2269
+ { id: 0, symbol: "INPUT_NEXT_CAMERA", label: "Switch Camera", defaultKey: "V", group: "Camera" },
2270
+ { id: 1, symbol: "INPUT_LOOK_LR", label: "Look Left/Right", defaultKey: "Mouse X", group: "Camera" },
2271
+ { id: 2, symbol: "INPUT_LOOK_UD", label: "Look Up/Down", defaultKey: "Mouse Y", group: "Camera" },
2272
+ { id: 3, symbol: "INPUT_LOOK_UP_ONLY", label: "Look Up Only", group: "Camera" },
2273
+ { id: 4, symbol: "INPUT_LOOK_DOWN_ONLY", label: "Look Down Only", group: "Camera" },
2274
+ { id: 5, symbol: "INPUT_LOOK_LEFT_ONLY", label: "Look Left Only", group: "Camera" },
2275
+ { id: 6, symbol: "INPUT_LOOK_RIGHT_ONLY", label: "Look Right Only", group: "Camera" },
2276
+ { id: 8, symbol: "INPUT_CINEMATIC_SLOWMO", label: "Cinematic Slowmo", defaultKey: "Insert", group: "Camera" },
2277
+ { id: 26, symbol: "INPUT_LOOK_BEHIND", label: "Look Behind", defaultKey: "C", group: "Camera" },
2278
+ { id: 27, symbol: "INPUT_PHONE", label: "Phone", defaultKey: "Up Arrow", group: "Phone" },
2279
+ // ── Movement ───────────────────────────────────────────────────────────────
2280
+ { id: 21, symbol: "INPUT_SPRINT", label: "Sprint", defaultKey: "Left Shift", group: "Movement" },
2281
+ { id: 22, symbol: "INPUT_JUMP", label: "Jump", defaultKey: "Space", group: "Movement" },
2282
+ { id: 23, symbol: "INPUT_ENTER", label: "Enter Vehicle", defaultKey: "F", group: "Movement" },
2283
+ { id: 30, symbol: "INPUT_MOVE_LR", label: "Move Left/Right", group: "Movement" },
2284
+ { id: 31, symbol: "INPUT_MOVE_UD", label: "Move Up/Down", group: "Movement" },
2285
+ { id: 32, symbol: "INPUT_MOVE_UP_ONLY", label: "Move Forward (W)", group: "Movement" },
2286
+ { id: 33, symbol: "INPUT_MOVE_DOWN_ONLY", label: "Move Back (S)", group: "Movement" },
2287
+ { id: 34, symbol: "INPUT_MOVE_LEFT_ONLY", label: "Move Left (A)", group: "Movement" },
2288
+ { id: 35, symbol: "INPUT_MOVE_RIGHT_ONLY", label: "Move Right (D)", group: "Movement" },
2289
+ { id: 36, symbol: "INPUT_DUCK", label: "Duck / Stealth", defaultKey: "Left Ctrl", group: "Movement" },
2290
+ { id: 37, symbol: "INPUT_SELECT_WEAPON", label: "Weapon Wheel", defaultKey: "Tab", group: "Combat" },
2291
+ { id: 38, symbol: "INPUT_PICKUP", label: "Pickup / Interact", defaultKey: "E", group: "Movement" },
2292
+ // ── Combat ─────────────────────────────────────────────────────────────────
2293
+ { id: 24, symbol: "INPUT_ATTACK", label: "Attack / Fire", defaultKey: "Mouse 1", group: "Combat" },
2294
+ { id: 25, symbol: "INPUT_AIM", label: "Aim", defaultKey: "Mouse 2", group: "Combat" },
2295
+ { id: 45, symbol: "INPUT_RELOAD", label: "Reload", defaultKey: "R", group: "Combat" },
2296
+ { id: 47, symbol: "INPUT_DETONATE", label: "Detonate", defaultKey: "G", group: "Combat" },
2297
+ { id: 257, symbol: "INPUT_ATTACK2", label: "Attack 2", group: "Combat" },
2298
+ { id: 140, symbol: "INPUT_MELEE_ATTACK_LIGHT", label: "Melee Light", defaultKey: "R", group: "Combat" },
2299
+ { id: 141, symbol: "INPUT_MELEE_ATTACK_HEAVY", label: "Melee Heavy", defaultKey: "Q", group: "Combat" },
2300
+ { id: 142, symbol: "INPUT_MELEE_ATTACK_ALTERNATE", label: "Melee Alternate", defaultKey: "Mouse 1", group: "Combat" },
2301
+ { id: 263, symbol: "INPUT_MELEE_ATTACK1", label: "Melee Attack 1", group: "Combat" },
2302
+ { id: 264, symbol: "INPUT_MELEE_ATTACK2", label: "Melee Attack 2", group: "Combat" },
2303
+ // ── Cover ──────────────────────────────────────────────────────────────────
2304
+ { id: 44, symbol: "INPUT_COVER", label: "Cover", defaultKey: "Q", group: "Cover" },
2305
+ // ── Vehicle (general) ──────────────────────────────────────────────────────
2306
+ { id: 59, symbol: "INPUT_VEH_MOVE_LR", label: "Vehicle Steering", group: "Vehicle" },
2307
+ { id: 63, symbol: "INPUT_VEH_MOVE_LEFT_ONLY", label: "Vehicle Steer Left", group: "Vehicle" },
2308
+ { id: 64, symbol: "INPUT_VEH_MOVE_RIGHT_ONLY", label: "Vehicle Steer Right", group: "Vehicle" },
2309
+ { id: 71, symbol: "INPUT_VEH_ACCELERATE", label: "Vehicle Accelerate", defaultKey: "W", group: "Vehicle" },
2310
+ { id: 72, symbol: "INPUT_VEH_BRAKE", label: "Vehicle Brake", defaultKey: "S", group: "Vehicle" },
2311
+ { id: 73, symbol: "INPUT_VEH_DUCK", label: "Vehicle Duck", defaultKey: "X", group: "Vehicle" },
2312
+ { id: 74, symbol: "INPUT_VEH_HEADLIGHT", label: "Headlights", defaultKey: "H", group: "Vehicle" },
2313
+ { id: 75, symbol: "INPUT_VEH_EXIT", label: "Exit Vehicle", defaultKey: "F", group: "Vehicle" },
2314
+ { id: 76, symbol: "INPUT_VEH_HANDBRAKE", label: "Handbrake", defaultKey: "Space", group: "Vehicle" },
2315
+ { id: 80, symbol: "INPUT_VEH_CIN_CAM", label: "Cinematic Cam", defaultKey: "R", group: "Vehicle" },
2316
+ { id: 81, symbol: "INPUT_VEH_NEXT_RADIO", label: "Radio Next", group: "Vehicle" },
2317
+ { id: 82, symbol: "INPUT_VEH_PREV_RADIO", label: "Radio Prev", group: "Vehicle" },
2318
+ { id: 83, symbol: "INPUT_VEH_NEXT_RADIO_TRACK", label: "Radio Next Track", group: "Vehicle" },
2319
+ { id: 84, symbol: "INPUT_VEH_PREV_RADIO_TRACK", label: "Radio Prev Track", group: "Vehicle" },
2320
+ { id: 85, symbol: "INPUT_VEH_RADIO_WHEEL", label: "Radio Wheel", defaultKey: "Q", group: "Vehicle" },
2321
+ { id: 86, symbol: "INPUT_VEH_HORN", label: "Horn", defaultKey: "E", group: "Vehicle" },
2322
+ { id: 90, symbol: "INPUT_VEH_AIM", label: "Vehicle Aim", group: "Vehicle" },
2323
+ { id: 91, symbol: "INPUT_VEH_ATTACK", label: "Vehicle Attack", group: "Vehicle" },
2324
+ { id: 92, symbol: "INPUT_VEH_ATTACK2", label: "Vehicle Attack 2", group: "Vehicle" },
2325
+ { id: 99, symbol: "INPUT_VEH_SELECT_NEXT_WEAPON", label: "Veh Next Weapon", group: "Vehicle" },
2326
+ { id: 100, symbol: "INPUT_VEH_SELECT_PREV_WEAPON", label: "Veh Prev Weapon", group: "Vehicle" },
2327
+ // ── Vehicle (Plane/Heli) ───────────────────────────────────────────────────
2328
+ { id: 152, symbol: "INPUT_VEH_FLY_THROTTLE_UP", label: "Plane Throttle Up", defaultKey: "W", group: "Vehicle (Plane/Heli)" },
2329
+ { id: 153, symbol: "INPUT_VEH_FLY_THROTTLE_DOWN", label: "Plane Throttle Down", defaultKey: "S", group: "Vehicle (Plane/Heli)" },
2330
+ { id: 154, symbol: "INPUT_VEH_FLY_YAW_LEFT", label: "Plane Yaw Left", defaultKey: "A", group: "Vehicle (Plane/Heli)" },
2331
+ { id: 155, symbol: "INPUT_VEH_FLY_YAW_RIGHT", label: "Plane Yaw Right", defaultKey: "D", group: "Vehicle (Plane/Heli)" },
2332
+ { id: 158, symbol: "INPUT_VEH_FLY_ATTACK", label: "Plane Attack", defaultKey: "Mouse 1", group: "Vehicle (Plane/Heli)" },
2333
+ // ── Vehicle (Boat / Bike) ──────────────────────────────────────────────────
2334
+ { id: 198, symbol: "INPUT_VEH_BICYCLE_PEDAL", label: "Bike Pedal", group: "Vehicle (Boat/Bike)" },
2335
+ // ── Phone ──────────────────────────────────────────────────────────────────
2336
+ { id: 137, symbol: "INPUT_FRONTEND_SOCIAL_CLUB_SECONDARY", label: "Toggle Phone (alt)", group: "Phone" },
2337
+ // ── Frontend / UI ──────────────────────────────────────────────────────────
2338
+ { id: 199, symbol: "INPUT_FRONTEND_PAUSE", label: "Pause Menu", defaultKey: "P", group: "Frontend / UI" },
2339
+ { id: 200, symbol: "INPUT_FRONTEND_PAUSE_ALTERNATE", label: "Pause Menu (alt)", defaultKey: "Esc", group: "Frontend / UI" },
2340
+ { id: 201, symbol: "INPUT_FRONTEND_ACCEPT", label: "Accept", defaultKey: "Enter", group: "Frontend / UI" },
2341
+ { id: 202, symbol: "INPUT_FRONTEND_CANCEL", label: "Cancel", defaultKey: "Esc", group: "Frontend / UI" },
2342
+ { id: 244, symbol: "INPUT_INTERACTION_MENU", label: "Interaction Menu", defaultKey: "M", group: "Frontend / UI" },
2343
+ // ── Multiplayer ────────────────────────────────────────────────────────────
2344
+ { id: 245, symbol: "INPUT_MP_TEXT_CHAT_ALL", label: "Chat (All)", defaultKey: "T", group: "Multiplayer" },
2345
+ { id: 246, symbol: "INPUT_MP_TEXT_CHAT_TEAM", label: "Chat (Team)", defaultKey: "Y", group: "Multiplayer" },
2346
+ { id: 247, symbol: "INPUT_MP_TEXT_CHAT_FRIENDS", label: "Chat (Friends)", group: "Multiplayer" },
2347
+ { id: 248, symbol: "INPUT_MP_TEXT_CHAT_CREW", label: "Chat (Crew)", group: "Multiplayer" },
2348
+ { id: 249, symbol: "INPUT_PUSH_TO_TALK", label: "Push To Talk", defaultKey: "N", group: "Multiplayer" },
2349
+ // ── Misc ───────────────────────────────────────────────────────────────────
2350
+ { id: 51, symbol: "INPUT_CONTEXT", label: "Context (E)", defaultKey: "E", group: "Misc" },
2351
+ { id: 52, symbol: "INPUT_CONTEXT_SECONDARY", label: "Context Secondary", defaultKey: "Q", group: "Misc" },
2352
+ { id: 73, symbol: "INPUT_CHARACTER_WHEEL", label: "Character Wheel", defaultKey: "Left Alt", group: "Misc" },
2353
+ { id: 105, symbol: "INPUT_HUD_SPECIAL", label: "Special Ability", defaultKey: "Caps Lock", group: "Misc" },
2354
+ { id: 121, symbol: "INPUT_MULTIPLAYER_INFO", label: "Player List", defaultKey: "Z", group: "Misc" },
2355
+ { id: 170, symbol: "INPUT_SAVE_REPLAY_CLIP", label: "Save Replay Clip", defaultKey: "F1", group: "Misc" },
2356
+ { id: 288, symbol: "INPUT_REPLAY_START_STOP_RECORDING", label: "Replay Record", defaultKey: "F1", group: "Misc" },
2357
+ { id: 289, symbol: "INPUT_REPLAY_START_STOP_RECORDING_SECONDARY", label: "Replay Record (alt)", group: "Misc" }
2358
+ ];
2359
+ var BY_ID = new Map(GTA_CONTROLS.map((c) => [c.id, c]));
2360
+ function getGtaControl(id) {
2361
+ return BY_ID.get(id);
2362
+ }
2363
+ function formatGtaControl(id) {
2364
+ const c = BY_ID.get(id);
2365
+ if (!c) return `Control ${id}`;
2366
+ return c.defaultKey ? `${c.label} (${id} \xB7 ${c.defaultKey})` : `${c.label} (${id})`;
2367
+ }
2368
+ var GTA_CONTROL_GROUP_ORDER = [
2369
+ "Camera",
2370
+ "Movement",
2371
+ "Combat",
2372
+ "Cover",
2373
+ "Vehicle",
2374
+ "Vehicle (Plane/Heli)",
2375
+ "Vehicle (Boat/Bike)",
2376
+ "Phone",
2377
+ "Frontend / UI",
2378
+ "Multiplayer",
2379
+ "Misc"
2380
+ ];
2265
2381
  function BorderedIcon(props) {
2266
2382
  const theme2 = core.useMantineTheme();
2267
2383
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4764,6 +4880,7 @@ function SelectItem(props) {
4764
4880
  data: formattedItems,
4765
4881
  allowDeselect: false,
4766
4882
  searchable: true,
4883
+ comboboxProps: { withinPortal: true, zIndex: 2e3 },
4767
4884
  leftSectionWidth: "4vh",
4768
4885
  leftSection: props.value ? /* @__PURE__ */ jsxRuntime.jsx(
4769
4886
  core.Image,
@@ -5169,6 +5286,83 @@ var FiveMKeyBindInput = Object.assign(Root, {
5169
5286
  Category,
5170
5287
  Key
5171
5288
  });
5289
+ function buildGroupedData(extraIds = []) {
5290
+ const groups = /* @__PURE__ */ new Map();
5291
+ for (const c of GTA_CONTROLS) {
5292
+ if (!groups.has(c.group)) groups.set(c.group, []);
5293
+ groups.get(c.group).push(c);
5294
+ }
5295
+ const data = GTA_CONTROL_GROUP_ORDER.flatMap((g) => {
5296
+ const items = groups.get(g);
5297
+ if (!items || items.length === 0) return [];
5298
+ return [
5299
+ {
5300
+ group: g,
5301
+ items: items.map((c) => ({
5302
+ value: String(c.id),
5303
+ label: formatGtaControl(c.id)
5304
+ }))
5305
+ }
5306
+ ];
5307
+ });
5308
+ const knownIds = new Set(GTA_CONTROLS.map((c) => c.id));
5309
+ const customs = extraIds.filter((id) => !knownIds.has(id));
5310
+ if (customs.length > 0) {
5311
+ data.push({
5312
+ group: "Custom",
5313
+ items: customs.map((id) => ({ value: String(id), label: `Control ${id}` }))
5314
+ });
5315
+ }
5316
+ return data;
5317
+ }
5318
+ function ControlSelect({
5319
+ value,
5320
+ onChange,
5321
+ label: label2 = "Control",
5322
+ size = "xs",
5323
+ searchable = true,
5324
+ ...rest
5325
+ }) {
5326
+ const data = buildGroupedData(value != null ? [value] : []);
5327
+ return /* @__PURE__ */ jsxRuntime.jsx(
5328
+ core.Select,
5329
+ {
5330
+ label: label2,
5331
+ size,
5332
+ searchable,
5333
+ maxDropdownHeight: 320,
5334
+ nothingFoundMessage: "No matching controls",
5335
+ ...rest,
5336
+ data,
5337
+ value: value != null ? String(value) : null,
5338
+ onChange: (v) => onChange(v == null ? null : Number(v))
5339
+ }
5340
+ );
5341
+ }
5342
+ function ControlMultiSelect({
5343
+ value,
5344
+ onChange,
5345
+ label: label2 = "Controls",
5346
+ size = "xs",
5347
+ searchable = true,
5348
+ ...rest
5349
+ }) {
5350
+ const data = buildGroupedData(value);
5351
+ return /* @__PURE__ */ jsxRuntime.jsx(
5352
+ core.MultiSelect,
5353
+ {
5354
+ label: label2,
5355
+ size,
5356
+ searchable,
5357
+ maxDropdownHeight: 320,
5358
+ nothingFoundMessage: "No matching controls",
5359
+ ...rest,
5360
+ data,
5361
+ value: value.map(String),
5362
+ onChange: (vals) => onChange(vals.map((v) => Number(v)).filter((n) => Number.isFinite(n)))
5363
+ }
5364
+ );
5365
+ }
5172
5366
  function AsyncSaveButton({
5173
5367
  onSave,
5174
5368
  color,
@@ -5691,11 +5885,15 @@ exports.BlipIconSelect = BlipIconSelect;
5691
5885
  exports.BorderedIcon = BorderedIcon;
5692
5886
  exports.ConfigPanel = ConfigPanel;
5693
5887
  exports.ConfirmModal = ConfirmModal;
5888
+ exports.ControlMultiSelect = ControlMultiSelect;
5889
+ exports.ControlSelect = ControlSelect;
5694
5890
  exports.Counter = Counter;
5695
5891
  exports.DirkProvider = DirkProvider;
5696
5892
  exports.FiveMKeyBindInput = FiveMKeyBindInput;
5697
5893
  exports.FloatingParticles = FloatingParticles;
5698
5894
  exports.FormProvider = FormProvider;
5895
+ exports.GTA_CONTROLS = GTA_CONTROLS;
5896
+ exports.GTA_CONTROL_GROUP_ORDER = GTA_CONTROL_GROUP_ORDER;
5699
5897
  exports.GroupName = GroupName;
5700
5898
  exports.GroupRank = GroupRank;
5701
5899
  exports.GroupSelect = GroupSelect;
@@ -5731,7 +5929,9 @@ exports.createSkill = createSkill;
5731
5929
  exports.extractDefaults = extractDefaults;
5732
5930
  exports.fetchLuaTable = fetchLuaTable;
5733
5931
  exports.fetchNui = fetchNui;
5932
+ exports.formatGtaControl = formatGtaControl;
5734
5933
  exports.gameToMap = gameToMap;
5934
+ exports.getGtaControl = getGtaControl;
5735
5935
  exports.getImageShape = getImageShape;
5736
5936
  exports.getItemImageUrl = getItemImageUrl;
5737
5937
  exports.getScriptConfigInstance = getScriptConfigInstance;