dirk-cfx-react 1.1.72 → 1.1.73
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/components/index.cjs +70 -60
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +12 -2
- package/dist/components/index.d.ts +12 -2
- package/dist/components/index.js +70 -60
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +5 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +89 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +87 -61
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +5 -1
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +5 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs +5 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -1
|
@@ -678,6 +678,7 @@ type ButtonProps = {
|
|
|
678
678
|
icon: string;
|
|
679
679
|
onClick?: () => void;
|
|
680
680
|
};
|
|
681
|
+
type TitleSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
681
682
|
type TitleProps = {
|
|
682
683
|
title: string;
|
|
683
684
|
description: string;
|
|
@@ -688,6 +689,12 @@ type TitleProps = {
|
|
|
688
689
|
removeBorder?: boolean;
|
|
689
690
|
borderColor?: string;
|
|
690
691
|
p?: string;
|
|
692
|
+
/**
|
|
693
|
+
* Scale of the whole block — icon, title text, description text, and inner
|
|
694
|
+
* spacing all follow this single value. Defaults to "md" to preserve the
|
|
695
|
+
* historical look so existing consumers don't shift.
|
|
696
|
+
*/
|
|
697
|
+
size?: TitleSize;
|
|
691
698
|
rightSection?: React.ReactNode;
|
|
692
699
|
};
|
|
693
700
|
declare function Title(props: TitleProps): react_jsx_runtime.JSX.Element;
|
|
@@ -993,6 +1000,7 @@ interface TestBedItem {
|
|
|
993
1000
|
active: boolean;
|
|
994
1001
|
onToggle: (next: boolean) => void;
|
|
995
1002
|
}
|
|
1003
|
+
type TestBedPlacement = "top-left" | "top-center" | "top-right";
|
|
996
1004
|
interface TestBedProps {
|
|
997
1005
|
items: TestBedItem[];
|
|
998
1006
|
/** localStorage key used to persist toggled state across reloads. Default: "testbed:open-state". */
|
|
@@ -1001,7 +1009,9 @@ interface TestBedProps {
|
|
|
1001
1009
|
disablePersistence?: boolean;
|
|
1002
1010
|
/** Header label shown in the collapsed pill. Default: "TestBed". */
|
|
1003
1011
|
title?: string;
|
|
1012
|
+
/** Where to anchor the floating panel. Default: "top-left". */
|
|
1013
|
+
placement?: TestBedPlacement;
|
|
1004
1014
|
}
|
|
1005
|
-
declare function TestBed({ items, storageKey, disablePersistence, title, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
|
|
1015
|
+
declare function TestBed({ items, storageKey, disablePersistence, title, placement, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
|
|
1006
1016
|
|
|
1007
|
-
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, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, 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, MissingItemsBanner, 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, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
1017
|
+
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, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, 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, MissingItemsBanner, 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 TestBedPlacement, type TestBedProps, Title, type TitleProps, type TitleSize, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
@@ -678,6 +678,7 @@ type ButtonProps = {
|
|
|
678
678
|
icon: string;
|
|
679
679
|
onClick?: () => void;
|
|
680
680
|
};
|
|
681
|
+
type TitleSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
681
682
|
type TitleProps = {
|
|
682
683
|
title: string;
|
|
683
684
|
description: string;
|
|
@@ -688,6 +689,12 @@ type TitleProps = {
|
|
|
688
689
|
removeBorder?: boolean;
|
|
689
690
|
borderColor?: string;
|
|
690
691
|
p?: string;
|
|
692
|
+
/**
|
|
693
|
+
* Scale of the whole block — icon, title text, description text, and inner
|
|
694
|
+
* spacing all follow this single value. Defaults to "md" to preserve the
|
|
695
|
+
* historical look so existing consumers don't shift.
|
|
696
|
+
*/
|
|
697
|
+
size?: TitleSize;
|
|
691
698
|
rightSection?: React.ReactNode;
|
|
692
699
|
};
|
|
693
700
|
declare function Title(props: TitleProps): react_jsx_runtime.JSX.Element;
|
|
@@ -993,6 +1000,7 @@ interface TestBedItem {
|
|
|
993
1000
|
active: boolean;
|
|
994
1001
|
onToggle: (next: boolean) => void;
|
|
995
1002
|
}
|
|
1003
|
+
type TestBedPlacement = "top-left" | "top-center" | "top-right";
|
|
996
1004
|
interface TestBedProps {
|
|
997
1005
|
items: TestBedItem[];
|
|
998
1006
|
/** localStorage key used to persist toggled state across reloads. Default: "testbed:open-state". */
|
|
@@ -1001,7 +1009,9 @@ interface TestBedProps {
|
|
|
1001
1009
|
disablePersistence?: boolean;
|
|
1002
1010
|
/** Header label shown in the collapsed pill. Default: "TestBed". */
|
|
1003
1011
|
title?: string;
|
|
1012
|
+
/** Where to anchor the floating panel. Default: "top-left". */
|
|
1013
|
+
placement?: TestBedPlacement;
|
|
1004
1014
|
}
|
|
1005
|
-
declare function TestBed({ items, storageKey, disablePersistence, title, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
|
|
1015
|
+
declare function TestBed({ items, storageKey, disablePersistence, title, placement, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
|
|
1006
1016
|
|
|
1007
|
-
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, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, 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, MissingItemsBanner, 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, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
1017
|
+
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, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, 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, MissingItemsBanner, 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 TestBedPlacement, type TestBedProps, Title, type TitleProps, type TitleSize, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
|
package/dist/components/index.js
CHANGED
|
@@ -1292,7 +1292,11 @@ async function fetchNui(eventName, data, mockData) {
|
|
|
1292
1292
|
return {};
|
|
1293
1293
|
}
|
|
1294
1294
|
const overrideResourceName = useSettings.getState().overideResourceName;
|
|
1295
|
-
const
|
|
1295
|
+
const hasResourceContext = typeof window.GetParentResourceName === "function" || !!overrideResourceName;
|
|
1296
|
+
if (!hasResourceContext) {
|
|
1297
|
+
return mockData ?? {};
|
|
1298
|
+
}
|
|
1299
|
+
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : overrideResourceName;
|
|
1296
1300
|
try {
|
|
1297
1301
|
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
1298
1302
|
return await resp.json();
|
|
@@ -2465,9 +2469,25 @@ function SegmentedProgress(props) {
|
|
|
2465
2469
|
}
|
|
2466
2470
|
);
|
|
2467
2471
|
}
|
|
2472
|
+
function getSizePreset(size, themeMdFontSize) {
|
|
2473
|
+
switch (size) {
|
|
2474
|
+
case "xs":
|
|
2475
|
+
return { iconFontSize: "1.2vh", iconPadding: "xxs", titleSize: "xxs", titleLineHeight: "1.2vh", descriptionSize: "xxs", innerGap: "xs", bottomPad: "xs" };
|
|
2476
|
+
case "sm":
|
|
2477
|
+
return { iconFontSize: "1.6vh", iconPadding: "xxs", titleSize: "xs", titleLineHeight: "1.6vh", descriptionSize: "xxs", innerGap: "xs", bottomPad: "xs" };
|
|
2478
|
+
case "lg":
|
|
2479
|
+
return { iconFontSize: "2.6vh", iconPadding: "sm", titleSize: "md", titleLineHeight: "2.6vh", descriptionSize: "sm", innerGap: "sm", bottomPad: "sm" };
|
|
2480
|
+
case "xl":
|
|
2481
|
+
return { iconFontSize: "3.2vh", iconPadding: "sm", titleSize: "lg", titleLineHeight: "3.2vh", descriptionSize: "md", innerGap: "md", bottomPad: "md" };
|
|
2482
|
+
case "md":
|
|
2483
|
+
default:
|
|
2484
|
+
return { iconFontSize: themeMdFontSize, iconPadding: "xs", titleSize: "sm", titleLineHeight: themeMdFontSize, descriptionSize: "xs", innerGap: "sm", bottomPad: "sm" };
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2468
2487
|
function Title(props) {
|
|
2469
2488
|
const game = useSettings((state) => state.game);
|
|
2470
2489
|
const theme = useMantineTheme();
|
|
2490
|
+
const preset = getSizePreset(props.size ?? "md", theme.fontSizes.md);
|
|
2471
2491
|
return /* @__PURE__ */ jsx(
|
|
2472
2492
|
Flex,
|
|
2473
2493
|
{
|
|
@@ -2476,71 +2496,50 @@ function Title(props) {
|
|
|
2476
2496
|
gap: "xs",
|
|
2477
2497
|
w: props.w || "100%",
|
|
2478
2498
|
p: props.p || "unset",
|
|
2479
|
-
pb: !props.p ?
|
|
2499
|
+
pb: !props.p ? preset.bottomPad : props.p,
|
|
2480
2500
|
style: {
|
|
2481
2501
|
userSelect: "none",
|
|
2482
2502
|
borderBottom: props.removeBorder ? "none" : `0.3vh solid ${props.borderColor || colorWithAlpha(theme.colors[theme.primaryColor][9], 0.5)}`
|
|
2483
2503
|
},
|
|
2484
|
-
children: /* @__PURE__ */ jsxs(
|
|
2485
|
-
Flex,
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2504
|
+
children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "center", children: [
|
|
2505
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: preset.innerGap, pr: "xs", children: [
|
|
2506
|
+
/* @__PURE__ */ jsx(
|
|
2507
|
+
BorderedIcon,
|
|
2508
|
+
{
|
|
2509
|
+
icon: props.icon,
|
|
2510
|
+
fontSize: preset.iconFontSize,
|
|
2511
|
+
color: props.iconColor,
|
|
2512
|
+
p: preset.iconPadding
|
|
2513
|
+
}
|
|
2514
|
+
),
|
|
2515
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "0.25vh", children: [
|
|
2516
|
+
/* @__PURE__ */ jsx(
|
|
2517
|
+
Text,
|
|
2492
2518
|
{
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
color: props.iconColor
|
|
2503
|
-
}
|
|
2504
|
-
),
|
|
2505
|
-
/* @__PURE__ */ jsxs(
|
|
2506
|
-
Flex,
|
|
2507
|
-
{
|
|
2508
|
-
direction: "column",
|
|
2509
|
-
gap: "0.25vh",
|
|
2510
|
-
children: [
|
|
2511
|
-
/* @__PURE__ */ jsx(Text, { p: "0", size: "sm", style: {
|
|
2512
|
-
lineHeight: theme.fontSizes.md,
|
|
2513
|
-
fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
|
|
2514
|
-
letterSpacing: "0.05em",
|
|
2515
|
-
textTransform: "uppercase"
|
|
2516
|
-
}, children: props.title }),
|
|
2517
|
-
/* @__PURE__ */ jsx(
|
|
2518
|
-
Text,
|
|
2519
|
-
{
|
|
2520
|
-
size: "xs",
|
|
2521
|
-
c: "grey",
|
|
2522
|
-
style: { whiteSpace: "normal", wordWrap: "break-word" },
|
|
2523
|
-
children: props.description
|
|
2524
|
-
}
|
|
2525
|
-
)
|
|
2526
|
-
]
|
|
2527
|
-
}
|
|
2528
|
-
)
|
|
2529
|
-
]
|
|
2519
|
+
p: "0",
|
|
2520
|
+
size: preset.titleSize,
|
|
2521
|
+
style: {
|
|
2522
|
+
lineHeight: preset.titleLineHeight,
|
|
2523
|
+
fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
|
|
2524
|
+
letterSpacing: "0.05em",
|
|
2525
|
+
textTransform: "uppercase"
|
|
2526
|
+
},
|
|
2527
|
+
children: props.title
|
|
2530
2528
|
}
|
|
2531
2529
|
),
|
|
2532
2530
|
/* @__PURE__ */ jsx(
|
|
2533
|
-
|
|
2531
|
+
Text,
|
|
2534
2532
|
{
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
children: props.
|
|
2533
|
+
size: preset.descriptionSize,
|
|
2534
|
+
c: "grey",
|
|
2535
|
+
style: { whiteSpace: "normal", wordWrap: "break-word" },
|
|
2536
|
+
children: props.description
|
|
2539
2537
|
}
|
|
2540
2538
|
)
|
|
2541
|
-
]
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2539
|
+
] })
|
|
2540
|
+
] }),
|
|
2541
|
+
/* @__PURE__ */ jsx(Flex, { ml: "auto", align: "center", gap: "xs", children: props.rightSection })
|
|
2542
|
+
] })
|
|
2544
2543
|
}
|
|
2545
2544
|
);
|
|
2546
2545
|
}
|
|
@@ -4161,8 +4160,8 @@ function ConfigPanelInner({
|
|
|
4161
4160
|
children: /* @__PURE__ */ jsx(ArrowLeft, { size: "1.4vh", color })
|
|
4162
4161
|
}
|
|
4163
4162
|
),
|
|
4164
|
-
/* @__PURE__ */ jsxs(Flex, { direction: "column", style: { minWidth: 0, lineHeight: 1 }, children: [
|
|
4165
|
-
/* @__PURE__ */ jsx(Text, { size: "
|
|
4163
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", style: { minWidth: 0, flex: 1, lineHeight: 1, overflow: "hidden" }, children: [
|
|
4164
|
+
/* @__PURE__ */ jsx(Text, { size: "md", ff: "Akrobat Bold", tt: "uppercase", lts: "0.04em", truncate: true, children: title }),
|
|
4166
4165
|
subtitle && /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.08em", c: color, truncate: true, children: subtitle })
|
|
4167
4166
|
] })
|
|
4168
4167
|
] }),
|
|
@@ -5103,6 +5102,17 @@ function AdminPageTitle(props) {
|
|
|
5103
5102
|
/* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", tt: "uppercase", lts: "0.1em", size: "sm", c: "rgba(255,255,255,0.6)", children: locale(props.title) })
|
|
5104
5103
|
] });
|
|
5105
5104
|
}
|
|
5105
|
+
var placementStyle = (placement) => {
|
|
5106
|
+
switch (placement) {
|
|
5107
|
+
case "top-center":
|
|
5108
|
+
return { top: "1vh", left: "50%", transform: "translateX(-50%)" };
|
|
5109
|
+
case "top-right":
|
|
5110
|
+
return { top: "1vh", right: "1vh" };
|
|
5111
|
+
case "top-left":
|
|
5112
|
+
default:
|
|
5113
|
+
return { top: "1vh", left: "1vh" };
|
|
5114
|
+
}
|
|
5115
|
+
};
|
|
5106
5116
|
var loadPersistedState = (storageKey) => {
|
|
5107
5117
|
try {
|
|
5108
5118
|
const raw = localStorage.getItem(storageKey);
|
|
@@ -5121,7 +5131,8 @@ function TestBed({
|
|
|
5121
5131
|
items,
|
|
5122
5132
|
storageKey = "testbed:open-state",
|
|
5123
5133
|
disablePersistence = false,
|
|
5124
|
-
title = "TestBed"
|
|
5134
|
+
title = "TestBed",
|
|
5135
|
+
placement = "top-left"
|
|
5125
5136
|
}) {
|
|
5126
5137
|
const [open, setOpen] = useState(false);
|
|
5127
5138
|
const itemsRef = useRef(items);
|
|
@@ -5151,8 +5162,7 @@ function TestBed({
|
|
|
5151
5162
|
{
|
|
5152
5163
|
style: {
|
|
5153
5164
|
position: "fixed",
|
|
5154
|
-
|
|
5155
|
-
left: "1vh",
|
|
5165
|
+
...placementStyle(placement),
|
|
5156
5166
|
zIndex: 2147483647,
|
|
5157
5167
|
pointerEvents: "auto",
|
|
5158
5168
|
fontSize: "1.4vh"
|