dirk-cfx-react 1.1.67 → 1.1.69

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: 19, 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(
@@ -5170,6 +5286,86 @@ var FiveMKeyBindInput = Object.assign(Root, {
5170
5286
  Category,
5171
5287
  Key
5172
5288
  });
5289
+ function buildGroupedData(extraIds = []) {
5290
+ const groups = /* @__PURE__ */ new Map();
5291
+ const seen = /* @__PURE__ */ new Set();
5292
+ for (const c of GTA_CONTROLS) {
5293
+ if (seen.has(c.id)) continue;
5294
+ seen.add(c.id);
5295
+ if (!groups.has(c.group)) groups.set(c.group, []);
5296
+ groups.get(c.group).push(c);
5297
+ }
5298
+ const data = GTA_CONTROL_GROUP_ORDER.flatMap((g) => {
5299
+ const items = groups.get(g);
5300
+ if (!items || items.length === 0) return [];
5301
+ return [
5302
+ {
5303
+ group: g,
5304
+ items: items.map((c) => ({
5305
+ value: String(c.id),
5306
+ label: formatGtaControl(c.id)
5307
+ }))
5308
+ }
5309
+ ];
5310
+ });
5311
+ const knownIds = new Set(GTA_CONTROLS.map((c) => c.id));
5312
+ const customs = extraIds.filter((id) => !knownIds.has(id));
5313
+ if (customs.length > 0) {
5314
+ data.push({
5315
+ group: "Custom",
5316
+ items: customs.map((id) => ({ value: String(id), label: `Control ${id}` }))
5317
+ });
5318
+ }
5319
+ return data;
5320
+ }
5321
+ function ControlSelect({
5322
+ value,
5323
+ onChange,
5324
+ label: label2 = "Control",
5325
+ size = "xs",
5326
+ searchable = true,
5327
+ ...rest
5328
+ }) {
5329
+ const data = buildGroupedData(value != null ? [value] : []);
5330
+ return /* @__PURE__ */ jsxRuntime.jsx(
5331
+ core.Select,
5332
+ {
5333
+ label: label2,
5334
+ size,
5335
+ searchable,
5336
+ maxDropdownHeight: 320,
5337
+ nothingFoundMessage: "No matching controls",
5338
+ ...rest,
5339
+ data,
5340
+ value: value != null ? String(value) : null,
5341
+ onChange: (v) => onChange(v == null ? null : Number(v))
5342
+ }
5343
+ );
5344
+ }
5345
+ function ControlMultiSelect({
5346
+ value,
5347
+ onChange,
5348
+ label: label2 = "Controls",
5349
+ size = "xs",
5350
+ searchable = true,
5351
+ ...rest
5352
+ }) {
5353
+ const data = buildGroupedData(value);
5354
+ return /* @__PURE__ */ jsxRuntime.jsx(
5355
+ core.MultiSelect,
5356
+ {
5357
+ label: label2,
5358
+ size,
5359
+ searchable,
5360
+ maxDropdownHeight: 320,
5361
+ nothingFoundMessage: "No matching controls",
5362
+ ...rest,
5363
+ data,
5364
+ value: value.map(String),
5365
+ onChange: (vals) => onChange(vals.map((v) => Number(v)).filter((n) => Number.isFinite(n)))
5366
+ }
5367
+ );
5368
+ }
5173
5369
  function AsyncSaveButton({
5174
5370
  onSave,
5175
5371
  color,
@@ -5692,11 +5888,15 @@ exports.BlipIconSelect = BlipIconSelect;
5692
5888
  exports.BorderedIcon = BorderedIcon;
5693
5889
  exports.ConfigPanel = ConfigPanel;
5694
5890
  exports.ConfirmModal = ConfirmModal;
5891
+ exports.ControlMultiSelect = ControlMultiSelect;
5892
+ exports.ControlSelect = ControlSelect;
5695
5893
  exports.Counter = Counter;
5696
5894
  exports.DirkProvider = DirkProvider;
5697
5895
  exports.FiveMKeyBindInput = FiveMKeyBindInput;
5698
5896
  exports.FloatingParticles = FloatingParticles;
5699
5897
  exports.FormProvider = FormProvider;
5898
+ exports.GTA_CONTROLS = GTA_CONTROLS;
5899
+ exports.GTA_CONTROL_GROUP_ORDER = GTA_CONTROL_GROUP_ORDER;
5700
5900
  exports.GroupName = GroupName;
5701
5901
  exports.GroupRank = GroupRank;
5702
5902
  exports.GroupSelect = GroupSelect;
@@ -5732,7 +5932,9 @@ exports.createSkill = createSkill;
5732
5932
  exports.extractDefaults = extractDefaults;
5733
5933
  exports.fetchLuaTable = fetchLuaTable;
5734
5934
  exports.fetchNui = fetchNui;
5935
+ exports.formatGtaControl = formatGtaControl;
5735
5936
  exports.gameToMap = gameToMap;
5937
+ exports.getGtaControl = getGtaControl;
5736
5938
  exports.getImageShape = getImageShape;
5737
5939
  exports.getItemImageUrl = getItemImageUrl;
5738
5940
  exports.getScriptConfigInstance = getScriptConfigInstance;