dirk-cfx-react 1.1.64 → 1.1.66

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.
@@ -18,6 +18,11 @@ type BlipColorSelectProps = Omit<SelectProps, "data" | "value" | "onChange" | "s
18
18
  onChange: (id: number) => void;
19
19
  };
20
20
  declare function BlipColorSelect({ value, onChange, label, size, ...rest }: BlipColorSelectProps): react_jsx_runtime.JSX.Element;
21
+ type BlipDisplaySelectProps = Omit<SelectProps, "data" | "value" | "onChange"> & {
22
+ value: number | null;
23
+ onChange: (id: number) => void;
24
+ };
25
+ declare function BlipDisplaySelect({ value, onChange, label, size, ...rest }: BlipDisplaySelectProps): react_jsx_runtime.JSX.Element;
21
26
 
22
27
  type BorderedIconProps = {
23
28
  icon: string;
@@ -820,6 +825,72 @@ type SelectItemProps = {
820
825
  };
821
826
  declare function SelectItem(props: SelectItemProps): react_jsx_runtime.JSX.Element;
822
827
 
828
+ type Vector4Value = {
829
+ x: number;
830
+ y: number;
831
+ z: number;
832
+ w: number;
833
+ };
834
+ type PositionPickerProps = {
835
+ label?: string;
836
+ value: Vector4Value;
837
+ onChange: (v: Vector4Value) => void;
838
+ /**
839
+ * If set, the picker treats `value` as an offset from this entity reference
840
+ * (e.g. "shell"). The Lua side must handle GET_POSITION + relativeTo by
841
+ * returning (playerCoords - entityCoords) instead of world coords, and must
842
+ * resolve the same reference when previewing.
843
+ */
844
+ relativeTo?: string;
845
+ /** Optional NUI event name to fetch the current position. Defaults to GET_POSITION. */
846
+ fetchEvent?: string;
847
+ /** Optional NUI event name to draw a marker at the value. Defaults to PREVIEW_POSITION. */
848
+ previewEvent?: string;
849
+ /** Optional NUI event name to clear the preview marker. Defaults to STOP_PREVIEW_POSITION. */
850
+ stopPreviewEvent?: string;
851
+ description?: string;
852
+ showHeading?: boolean;
853
+ };
854
+ declare function PositionPicker(props: PositionPickerProps): react_jsx_runtime.JSX.Element;
855
+
856
+ type GroupValue = {
857
+ name?: string;
858
+ grade?: number;
859
+ };
860
+ type GroupType = "job" | "gang";
861
+ type GroupSelectProps = {
862
+ value: GroupValue;
863
+ onChange: (next: GroupValue) => void;
864
+ type?: GroupType;
865
+ children: React__default.ReactNode;
866
+ style?: React__default.CSSProperties;
867
+ };
868
+ declare function GroupSelect({ value, onChange, type, children, style, }: GroupSelectProps): react_jsx_runtime.JSX.Element;
869
+ declare namespace GroupSelect {
870
+ var Name: typeof GroupName;
871
+ var Rank: typeof GroupRank;
872
+ }
873
+ type GroupNameProps = {
874
+ value?: string;
875
+ onChange?: (name: string) => void;
876
+ type?: GroupType;
877
+ label?: string;
878
+ description?: string;
879
+ placeholder?: string;
880
+ size?: string;
881
+ disabled?: boolean;
882
+ style?: React__default.CSSProperties;
883
+ };
884
+ declare function GroupName(props: GroupNameProps): react_jsx_runtime.JSX.Element;
885
+ type GroupRankProps = {
886
+ label?: string;
887
+ description?: string;
888
+ placeholder?: string;
889
+ size?: string;
890
+ style?: React__default.CSSProperties;
891
+ };
892
+ declare function GroupRank(props: GroupRankProps): react_jsx_runtime.JSX.Element;
893
+
823
894
  type FiveMControls = {
824
895
  _type: string;
825
896
  _key: string;
@@ -874,4 +945,4 @@ interface TestBedProps {
874
945
  }
875
946
  declare function TestBed({ items, storageKey, disablePersistence, title, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
876
947
 
877
- export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, TestBed, type TestBedItem, type TestBedProps, Title, type TitleProps, useModal, useModalActions, useNavigation, useNavigationStore };
948
+ export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, GroupName, type GroupNameProps, GroupRank, type GroupRankProps, GroupSelect, type GroupSelectProps, type GroupType, type GroupValue, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, PositionPicker, type PositionPickerProps, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, TestBed, type TestBedItem, type TestBedProps, Title, type TitleProps, type Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore };
@@ -18,6 +18,11 @@ type BlipColorSelectProps = Omit<SelectProps, "data" | "value" | "onChange" | "s
18
18
  onChange: (id: number) => void;
19
19
  };
20
20
  declare function BlipColorSelect({ value, onChange, label, size, ...rest }: BlipColorSelectProps): react_jsx_runtime.JSX.Element;
21
+ type BlipDisplaySelectProps = Omit<SelectProps, "data" | "value" | "onChange"> & {
22
+ value: number | null;
23
+ onChange: (id: number) => void;
24
+ };
25
+ declare function BlipDisplaySelect({ value, onChange, label, size, ...rest }: BlipDisplaySelectProps): react_jsx_runtime.JSX.Element;
21
26
 
22
27
  type BorderedIconProps = {
23
28
  icon: string;
@@ -820,6 +825,72 @@ type SelectItemProps = {
820
825
  };
821
826
  declare function SelectItem(props: SelectItemProps): react_jsx_runtime.JSX.Element;
822
827
 
828
+ type Vector4Value = {
829
+ x: number;
830
+ y: number;
831
+ z: number;
832
+ w: number;
833
+ };
834
+ type PositionPickerProps = {
835
+ label?: string;
836
+ value: Vector4Value;
837
+ onChange: (v: Vector4Value) => void;
838
+ /**
839
+ * If set, the picker treats `value` as an offset from this entity reference
840
+ * (e.g. "shell"). The Lua side must handle GET_POSITION + relativeTo by
841
+ * returning (playerCoords - entityCoords) instead of world coords, and must
842
+ * resolve the same reference when previewing.
843
+ */
844
+ relativeTo?: string;
845
+ /** Optional NUI event name to fetch the current position. Defaults to GET_POSITION. */
846
+ fetchEvent?: string;
847
+ /** Optional NUI event name to draw a marker at the value. Defaults to PREVIEW_POSITION. */
848
+ previewEvent?: string;
849
+ /** Optional NUI event name to clear the preview marker. Defaults to STOP_PREVIEW_POSITION. */
850
+ stopPreviewEvent?: string;
851
+ description?: string;
852
+ showHeading?: boolean;
853
+ };
854
+ declare function PositionPicker(props: PositionPickerProps): react_jsx_runtime.JSX.Element;
855
+
856
+ type GroupValue = {
857
+ name?: string;
858
+ grade?: number;
859
+ };
860
+ type GroupType = "job" | "gang";
861
+ type GroupSelectProps = {
862
+ value: GroupValue;
863
+ onChange: (next: GroupValue) => void;
864
+ type?: GroupType;
865
+ children: React__default.ReactNode;
866
+ style?: React__default.CSSProperties;
867
+ };
868
+ declare function GroupSelect({ value, onChange, type, children, style, }: GroupSelectProps): react_jsx_runtime.JSX.Element;
869
+ declare namespace GroupSelect {
870
+ var Name: typeof GroupName;
871
+ var Rank: typeof GroupRank;
872
+ }
873
+ type GroupNameProps = {
874
+ value?: string;
875
+ onChange?: (name: string) => void;
876
+ type?: GroupType;
877
+ label?: string;
878
+ description?: string;
879
+ placeholder?: string;
880
+ size?: string;
881
+ disabled?: boolean;
882
+ style?: React__default.CSSProperties;
883
+ };
884
+ declare function GroupName(props: GroupNameProps): react_jsx_runtime.JSX.Element;
885
+ type GroupRankProps = {
886
+ label?: string;
887
+ description?: string;
888
+ placeholder?: string;
889
+ size?: string;
890
+ style?: React__default.CSSProperties;
891
+ };
892
+ declare function GroupRank(props: GroupRankProps): react_jsx_runtime.JSX.Element;
893
+
823
894
  type FiveMControls = {
824
895
  _type: string;
825
896
  _key: string;
@@ -874,4 +945,4 @@ interface TestBedProps {
874
945
  }
875
946
  declare function TestBed({ items, storageKey, disablePersistence, title, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
876
947
 
877
- export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, TestBed, type TestBedItem, type TestBedProps, Title, type TitleProps, useModal, useModalActions, useNavigation, useNavigationStore };
948
+ export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, GroupName, type GroupNameProps, GroupRank, type GroupRankProps, GroupSelect, type GroupSelectProps, type GroupType, type GroupValue, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, PositionPicker, type PositionPickerProps, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, TestBed, type TestBedItem, type TestBedProps, Title, type TitleProps, type Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore };
@@ -1,10 +1,10 @@
1
- import { Flex, Text, Image, TextInput, Select, Box, useMantineTheme, Tooltip, alpha, Progress, RingProgress, Portal, Button, Loader, ActionIcon, Stack, Group, JsonInput } from '@mantine/core';
1
+ import { Flex, Text, Image, TextInput, Select, Box, useMantineTheme, Tooltip, alpha, Progress, RingProgress, Portal, Button, NumberInput, Loader, ActionIcon, Stack, Group, JsonInput } from '@mantine/core';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { createContext, useContext, useRef, useState, useEffect, useMemo } from 'react';
4
4
  import { create, useStore, createStore } from 'zustand';
5
5
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
6
6
  import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
7
- import { Info, X, AlertTriangle, Trash2, Check, FlaskConical, ChevronUp, ChevronDown, ArrowLeft, Undo2, Redo2, Save, History, XCircle, Code2, RotateCcw, Search, Filter, User } from 'lucide-react';
7
+ import { Info, X, AlertTriangle, Trash2, MapPin, Crosshair, EyeOff, Eye, RotateCcw, Check, FlaskConical, ChevronUp, ChevronDown, ArrowLeft, Undo2, Redo2, Save, History, XCircle, Code2, Search, Filter, User } from 'lucide-react';
8
8
  import clickSoundUrl from '../click_sound-PNCRRTM4.mp3';
9
9
  import hoverSoundUrl from '../hover_sound-NBUA222C.mp3';
10
10
  import { QueryClient, QueryClientProvider, useInfiniteQuery } from '@tanstack/react-query';
@@ -1057,6 +1057,31 @@ function BlipColorSelect({ value, onChange, label = "Blip Color", size = "xs", .
1057
1057
  }
1058
1058
  );
1059
1059
  }
1060
+ var BLIP_DISPLAY_DATA = [
1061
+ { value: "2", label: "2 \u2014 Main map + minimap (selectable)" },
1062
+ { value: "3", label: "3 \u2014 Main map only (selectable)" },
1063
+ { value: "4", label: "4 \u2014 Main map only (selectable)" },
1064
+ { value: "5", label: "5 \u2014 Minimap only" },
1065
+ { value: "6", label: "6 \u2014 Main map + minimap (selectable)" },
1066
+ { value: "8", label: "8 \u2014 Main map + minimap (not selectable)" },
1067
+ { value: "9", label: "9 \u2014 Minimap only" },
1068
+ { value: "10", label: "10 \u2014 Main map + minimap (not selectable)" }
1069
+ ];
1070
+ function BlipDisplaySelect({ value, onChange, label = "Blip Display", size = "xs", ...rest }) {
1071
+ return /* @__PURE__ */ jsx(
1072
+ Select,
1073
+ {
1074
+ label,
1075
+ size,
1076
+ ...rest,
1077
+ data: BLIP_DISPLAY_DATA,
1078
+ value: value != null ? String(value) : null,
1079
+ onChange: (val) => val != null && onChange(Number(val)),
1080
+ allowDeselect: false,
1081
+ maxDropdownHeight: 300
1082
+ }
1083
+ );
1084
+ }
1060
1085
 
1061
1086
  // src/utils/colorWithAlpha.ts
1062
1087
  var colorNames = {
@@ -1203,11 +1228,11 @@ var colorNames = {
1203
1228
  Yellow: { r: 255, g: 255, b: 0 },
1204
1229
  YellowGreen: { r: 154, g: 205, b: 50 }
1205
1230
  };
1206
- function colorWithAlpha(color, alpha8) {
1231
+ function colorWithAlpha(color, alpha9) {
1207
1232
  const lowerCasedColor = color.toLowerCase();
1208
1233
  if (colorNames[lowerCasedColor]) {
1209
1234
  const rgb = colorNames[lowerCasedColor];
1210
- return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha8})`;
1235
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha9})`;
1211
1236
  }
1212
1237
  if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
1213
1238
  const hex = color.slice(1);
@@ -1215,12 +1240,12 @@ function colorWithAlpha(color, alpha8) {
1215
1240
  const r = bigint >> 16 & 255;
1216
1241
  const g = bigint >> 8 & 255;
1217
1242
  const b = bigint & 255;
1218
- return `rgba(${r}, ${g}, ${b}, ${alpha8})`;
1243
+ return `rgba(${r}, ${g}, ${b}, ${alpha9})`;
1219
1244
  }
1220
1245
  if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
1221
1246
  const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
1222
1247
  if (result) {
1223
- return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha8})`;
1248
+ return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha9})`;
1224
1249
  }
1225
1250
  }
1226
1251
  return color;
@@ -1328,6 +1353,20 @@ registerInitialFetch("FETCH_ALL_ITEMS", null, {
1328
1353
  useItems.setState(fetchedItems);
1329
1354
  }).catch(() => {
1330
1355
  });
1356
+ var useFrameworkGroups = create(() => ({
1357
+ jobs: [],
1358
+ gangs: [],
1359
+ loaded: false
1360
+ }));
1361
+ registerInitialFetch("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
1362
+ useFrameworkGroups.setState({
1363
+ jobs: Array.isArray(data?.jobs) ? data.jobs : [],
1364
+ gangs: Array.isArray(data?.gangs) ? data.gangs : [],
1365
+ loaded: true
1366
+ });
1367
+ }).catch(() => {
1368
+ useFrameworkGroups.setState({ loaded: true });
1369
+ });
1331
1370
 
1332
1371
  // src/utils/inputMapper.ts
1333
1372
  var INPUT_MAPPER_PRIMARY_OPTIONS = [
@@ -4016,6 +4055,307 @@ function SelectItem(props) {
4016
4055
  }
4017
4056
  );
4018
4057
  }
4058
+ var ZERO = { x: 0, y: 0, z: 0, w: 0 };
4059
+ function PositionPicker(props) {
4060
+ const {
4061
+ label,
4062
+ value,
4063
+ onChange,
4064
+ relativeTo,
4065
+ fetchEvent = "GET_POSITION",
4066
+ previewEvent = "PREVIEW_POSITION",
4067
+ stopPreviewEvent = "STOP_PREVIEW_POSITION",
4068
+ description,
4069
+ showHeading = true
4070
+ } = props;
4071
+ const theme = useMantineTheme();
4072
+ const color = theme.colors[theme.primaryColor][5];
4073
+ const [previewing, setPreviewing] = useState(false);
4074
+ const previewingRef = useRef(false);
4075
+ useEffect(() => {
4076
+ return () => {
4077
+ if (previewingRef.current) {
4078
+ fetchNui(stopPreviewEvent, { relativeTo }).catch(() => {
4079
+ });
4080
+ }
4081
+ };
4082
+ }, [stopPreviewEvent, relativeTo]);
4083
+ const set = (key, val) => {
4084
+ const next = { ...value, [key]: val };
4085
+ onChange(next);
4086
+ if (previewingRef.current) {
4087
+ fetchNui(previewEvent, { value: next, relativeTo }).catch(() => {
4088
+ });
4089
+ }
4090
+ };
4091
+ const grab = async () => {
4092
+ try {
4093
+ const resp = await fetchNui(fetchEvent, { relativeTo }, value);
4094
+ if (resp && typeof resp === "object") {
4095
+ const next = {
4096
+ x: Number(resp.x ?? 0),
4097
+ y: Number(resp.y ?? 0),
4098
+ z: Number(resp.z ?? 0),
4099
+ w: Number(resp.w ?? 0)
4100
+ };
4101
+ onChange(next);
4102
+ if (previewingRef.current) {
4103
+ fetchNui(previewEvent, { value: next, relativeTo }).catch(() => {
4104
+ });
4105
+ }
4106
+ }
4107
+ } catch {
4108
+ }
4109
+ };
4110
+ const togglePreview = async () => {
4111
+ const nextState = !previewing;
4112
+ setPreviewing(nextState);
4113
+ previewingRef.current = nextState;
4114
+ if (nextState) {
4115
+ await fetchNui(previewEvent, { value, relativeTo }).catch(() => {
4116
+ });
4117
+ } else {
4118
+ await fetchNui(stopPreviewEvent, { relativeTo }).catch(() => {
4119
+ });
4120
+ }
4121
+ };
4122
+ const reset = () => {
4123
+ onChange({ ...ZERO });
4124
+ if (previewingRef.current) {
4125
+ fetchNui(previewEvent, { value: ZERO, relativeTo }).catch(() => {
4126
+ });
4127
+ }
4128
+ };
4129
+ const numberStyles = {
4130
+ input: { textAlign: "right", fontFamily: "monospace" }
4131
+ };
4132
+ return /* @__PURE__ */ jsxs(
4133
+ Flex,
4134
+ {
4135
+ direction: "column",
4136
+ gap: "xxs",
4137
+ p: "xs",
4138
+ style: {
4139
+ background: alpha(theme.colors.dark[5], 0.35),
4140
+ border: "0.1vh solid rgba(255,255,255,0.05)",
4141
+ borderRadius: theme.radius.xs
4142
+ },
4143
+ children: [
4144
+ (label || description) && /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: "xs", children: [
4145
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 0, style: { minWidth: 0 }, children: [
4146
+ label && /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "xxs", children: [
4147
+ /* @__PURE__ */ jsx(MapPin, { size: "1.4vh", color: alpha(color, 0.7) }),
4148
+ /* @__PURE__ */ jsx(
4149
+ Text,
4150
+ {
4151
+ ff: "Akrobat Bold",
4152
+ size: "xxs",
4153
+ tt: "uppercase",
4154
+ lts: "0.05em",
4155
+ c: "rgba(255,255,255,0.75)",
4156
+ children: locale(label)
4157
+ }
4158
+ ),
4159
+ relativeTo && /* @__PURE__ */ jsxs(Text, { ff: "Akrobat Bold", size: "xxs", c: alpha(color, 0.5), lts: "0.05em", children: [
4160
+ "\xB7 ",
4161
+ locale("RelativeTo"),
4162
+ " ",
4163
+ relativeTo
4164
+ ] })
4165
+ ] }),
4166
+ description && /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", c: "dimmed", lh: 1.3, children: locale(description) })
4167
+ ] }),
4168
+ /* @__PURE__ */ jsxs(Flex, { gap: "xxs", style: { flexShrink: 0 }, children: [
4169
+ /* @__PURE__ */ jsx(PickerButton, { tooltip: locale("GrabMyPosition"), onClick: grab, color, children: /* @__PURE__ */ jsx(Crosshair, { size: "1.4vh", color }) }),
4170
+ /* @__PURE__ */ jsx(
4171
+ PickerButton,
4172
+ {
4173
+ tooltip: previewing ? locale("StopPreview") : locale("PreviewInWorld"),
4174
+ onClick: togglePreview,
4175
+ color,
4176
+ active: previewing,
4177
+ children: previewing ? /* @__PURE__ */ jsx(EyeOff, { size: "1.4vh", color }) : /* @__PURE__ */ jsx(Eye, { size: "1.4vh", color: alpha(color, 0.7) })
4178
+ }
4179
+ ),
4180
+ /* @__PURE__ */ jsx(PickerButton, { tooltip: locale("Reset"), onClick: reset, color: "#ef4444", children: /* @__PURE__ */ jsx(RotateCcw, { size: "1.4vh", color: "#ef4444" }) })
4181
+ ] })
4182
+ ] }),
4183
+ /* @__PURE__ */ jsxs(Flex, { gap: "xxs", children: [
4184
+ /* @__PURE__ */ jsx(
4185
+ NumberInput,
4186
+ {
4187
+ size: "xs",
4188
+ label: "X",
4189
+ value: value.x,
4190
+ onChange: (v) => set("x", Number(v)),
4191
+ decimalScale: 4,
4192
+ step: 0.1,
4193
+ style: { flex: 1 },
4194
+ styles: numberStyles
4195
+ }
4196
+ ),
4197
+ /* @__PURE__ */ jsx(
4198
+ NumberInput,
4199
+ {
4200
+ size: "xs",
4201
+ label: "Y",
4202
+ value: value.y,
4203
+ onChange: (v) => set("y", Number(v)),
4204
+ decimalScale: 4,
4205
+ step: 0.1,
4206
+ style: { flex: 1 },
4207
+ styles: numberStyles
4208
+ }
4209
+ ),
4210
+ /* @__PURE__ */ jsx(
4211
+ NumberInput,
4212
+ {
4213
+ size: "xs",
4214
+ label: "Z",
4215
+ value: value.z,
4216
+ onChange: (v) => set("z", Number(v)),
4217
+ decimalScale: 4,
4218
+ step: 0.1,
4219
+ style: { flex: 1 },
4220
+ styles: numberStyles
4221
+ }
4222
+ ),
4223
+ showHeading && /* @__PURE__ */ jsx(
4224
+ NumberInput,
4225
+ {
4226
+ size: "xs",
4227
+ label: "W",
4228
+ value: value.w,
4229
+ onChange: (v) => set("w", Number(v)),
4230
+ decimalScale: 2,
4231
+ step: 1,
4232
+ min: 0,
4233
+ max: 360,
4234
+ style: { flex: 1 },
4235
+ styles: numberStyles
4236
+ }
4237
+ )
4238
+ ] })
4239
+ ]
4240
+ }
4241
+ );
4242
+ }
4243
+ function PickerButton({
4244
+ children,
4245
+ onClick,
4246
+ tooltip,
4247
+ color,
4248
+ active
4249
+ }) {
4250
+ const theme = useMantineTheme();
4251
+ return /* @__PURE__ */ jsx(Tooltip, { label: tooltip, position: "top", withArrow: true, children: /* @__PURE__ */ jsx(
4252
+ motion.button,
4253
+ {
4254
+ onClick,
4255
+ whileHover: { background: alpha(color, 0.18) },
4256
+ whileTap: { scale: 0.95 },
4257
+ style: {
4258
+ background: active ? alpha(color, 0.22) : alpha(color, 0.08),
4259
+ border: `0.1vh solid ${alpha(color, active ? 0.5 : 0.3)}`,
4260
+ borderRadius: theme.radius.xs,
4261
+ padding: "0.4vh 0.6vh",
4262
+ cursor: "pointer",
4263
+ display: "flex",
4264
+ alignItems: "center",
4265
+ justifyContent: "center"
4266
+ },
4267
+ children
4268
+ }
4269
+ ) });
4270
+ }
4271
+ var GroupSelectContext = createContext(null);
4272
+ function GroupSelect({
4273
+ value,
4274
+ onChange,
4275
+ type,
4276
+ children,
4277
+ style
4278
+ }) {
4279
+ return /* @__PURE__ */ jsx(GroupSelectContext.Provider, { value: { value, onChange, type }, children: /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.4vh", ...style }, children }) });
4280
+ }
4281
+ function filterByType(jobs, gangs, type) {
4282
+ if (type === "job") return jobs;
4283
+ if (type === "gang") return gangs;
4284
+ return [...jobs, ...gangs];
4285
+ }
4286
+ function GroupName(props) {
4287
+ const ctx = useContext(GroupSelectContext);
4288
+ const jobs = useFrameworkGroups((s) => s.jobs);
4289
+ const gangs = useFrameworkGroups((s) => s.gangs);
4290
+ const inCompound = ctx !== null;
4291
+ const currentValue = inCompound ? ctx.value.name : props.value;
4292
+ const filterType = inCompound ? ctx.type : props.type;
4293
+ const list = filterByType(jobs, gangs, filterType);
4294
+ const data = filterType === void 0 ? [
4295
+ { group: locale("Jobs") || "Jobs", items: jobs.map((g) => ({ value: g.name, label: g.label })) },
4296
+ { group: locale("Gangs") || "Gangs", items: gangs.map((g) => ({ value: g.name, label: g.label })) }
4297
+ ] : list.map((g) => ({ value: g.name, label: g.label }));
4298
+ return /* @__PURE__ */ jsx(
4299
+ Select,
4300
+ {
4301
+ label: props.label,
4302
+ description: props.description,
4303
+ placeholder: props.placeholder ?? (locale("SelectGroup") || "Select\u2026"),
4304
+ size: props.size ?? "xs",
4305
+ disabled: props.disabled,
4306
+ style: props.style,
4307
+ data,
4308
+ value: currentValue ?? null,
4309
+ searchable: true,
4310
+ onChange: (v) => {
4311
+ const name = v ?? "";
4312
+ if (inCompound) {
4313
+ ctx.onChange({ name: name || void 0, grade: void 0 });
4314
+ } else if (props.onChange) {
4315
+ props.onChange(name);
4316
+ }
4317
+ },
4318
+ allowDeselect: false
4319
+ }
4320
+ );
4321
+ }
4322
+ function GroupRank(props) {
4323
+ const ctx = useContext(GroupSelectContext);
4324
+ if (ctx === null) {
4325
+ throw new Error("<GroupRank> must be a child of <GroupSelect>");
4326
+ }
4327
+ const jobs = useFrameworkGroups((s) => s.jobs);
4328
+ const gangs = useFrameworkGroups((s) => s.gangs);
4329
+ const all = [...jobs, ...gangs];
4330
+ const selectedGroup = all.find((g) => g.name === ctx.value.name) ?? null;
4331
+ const grades = selectedGroup?.grades ?? [];
4332
+ const data = grades.map((g) => ({
4333
+ value: String(g.grade),
4334
+ label: `${g.grade} \u2014 ${g.label || g.name}${g.isBoss ? " (boss)" : ""}`
4335
+ }));
4336
+ return /* @__PURE__ */ jsx(
4337
+ Select,
4338
+ {
4339
+ label: props.label,
4340
+ description: props.description,
4341
+ placeholder: props.placeholder ?? (locale("SelectGrade") || "Select grade\u2026"),
4342
+ size: props.size ?? "xs",
4343
+ style: props.style,
4344
+ data,
4345
+ value: ctx.value.grade != null ? String(ctx.value.grade) : null,
4346
+ onChange: (v) => {
4347
+ ctx.onChange({
4348
+ ...ctx.value,
4349
+ grade: v != null ? Number(v) : void 0
4350
+ });
4351
+ },
4352
+ disabled: !selectedGroup || grades.length === 0,
4353
+ allowDeselect: false
4354
+ }
4355
+ );
4356
+ }
4357
+ GroupSelect.Name = GroupName;
4358
+ GroupSelect.Rank = GroupRank;
4019
4359
  var KeyBindContext = createContext(null);
4020
4360
  function useKeyBindContext() {
4021
4361
  const ctx = useContext(KeyBindContext);
@@ -4299,6 +4639,6 @@ function TestBed({
4299
4639
  );
4300
4640
  }
4301
4641
 
4302
- export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, Counter, FiveMKeyBindInput, FloatingParticles, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, useModal, useModalActions, useNavigation, useNavigationStore };
4642
+ export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, Counter, FiveMKeyBindInput, FloatingParticles, GroupName, GroupRank, GroupSelect, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, useModal, useModalActions, useNavigation, useNavigationStore };
4303
4643
  //# sourceMappingURL=index.js.map
4304
4644
  //# sourceMappingURL=index.js.map