dirk-cfx-react 1.1.65 → 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.
- package/dist/components/index.cjs +105 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +39 -1
- package/dist/components/index.d.ts +39 -1
- package/dist/components/index.js +103 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +178 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +108 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/index.cjs +19 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +29 -1
- package/dist/utils/index.d.ts +29 -1
- package/dist/utils/index.js +18 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
|
|
2
|
-
export { INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, gameToMap, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.cjs';
|
|
1
|
+
export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
|
|
2
|
+
export { FrameworkGrade, FrameworkGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, gameToMap, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useFrameworkGroups, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.cjs';
|
|
3
3
|
export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, TornEdgeSVGFilter, ValidationRules, ValidatorFn, createFormStore, createScriptConfig, getScriptConfigInstance, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges } from './hooks/index.cjs';
|
|
4
4
|
export { DirkProvider, DirkProviderProps } from './providers/index.cjs';
|
|
5
5
|
import 'react/jsx-runtime';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
|
|
2
|
-
export { INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, gameToMap, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.js';
|
|
1
|
+
export { AdminPageTitle, AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, TestBed, TestBedItem, TestBedProps, Title, TitleProps, Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
|
|
2
|
+
export { FrameworkGrade, FrameworkGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, gameToMap, getImageShape, getItemImageUrl, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useFrameworkGroups, useItems, useItemsList, useProfanityStore, useSettings } from './utils/index.js';
|
|
3
3
|
export { FormProvider, FormState, NuiHandlerSignature, NuiMessageData, ScriptConfigHistoryChange, ScriptConfigHistoryEntry, ScriptConfigHistoryRequest, ScriptConfigHistoryResponse, ScriptConfigInstance, TornEdgeSVGFilter, ValidationRules, ValidatorFn, createFormStore, createScriptConfig, getScriptConfigInstance, useAudio, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useNuiEvent, useTornEdges } from './hooks/index.js';
|
|
4
4
|
export { DirkProvider, DirkProviderProps } from './providers/index.js';
|
|
5
5
|
import 'react/jsx-runtime';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flex, Text, Image as Image$1, createTheme, Box, Stack, Title as Title$1, Code, TextInput, Select, useMantineTheme, Tooltip, alpha, Progress, RingProgress, Portal, Button, NumberInput, Loader, ActionIcon, MantineProvider, BackgroundImage, Group, JsonInput } from '@mantine/core';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
3
|
+
import React6, { createContext, useContext, useEffect, useRef, useState, useMemo, useLayoutEffect } from 'react';
|
|
4
4
|
import { create, useStore, createStore } from 'zustand';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
@@ -1937,6 +1937,23 @@ registerInitialFetch("FETCH_ALL_ITEMS", null, {
|
|
|
1937
1937
|
useItems.setState(fetchedItems);
|
|
1938
1938
|
}).catch(() => {
|
|
1939
1939
|
});
|
|
1940
|
+
var useFrameworkGroups = create(() => ({
|
|
1941
|
+
jobs: [],
|
|
1942
|
+
gangs: [],
|
|
1943
|
+
loaded: false
|
|
1944
|
+
}));
|
|
1945
|
+
registerInitialFetch("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
|
|
1946
|
+
useFrameworkGroups.setState({
|
|
1947
|
+
jobs: Array.isArray(data?.jobs) ? data.jobs : [],
|
|
1948
|
+
gangs: Array.isArray(data?.gangs) ? data.gangs : [],
|
|
1949
|
+
loaded: true
|
|
1950
|
+
});
|
|
1951
|
+
}).catch(() => {
|
|
1952
|
+
useFrameworkGroups.setState({ loaded: true });
|
|
1953
|
+
});
|
|
1954
|
+
function selectAllGroups(state) {
|
|
1955
|
+
return [...state.jobs, ...state.gangs];
|
|
1956
|
+
}
|
|
1940
1957
|
|
|
1941
1958
|
// src/utils/inputMapper.ts
|
|
1942
1959
|
var INPUT_MAPPER_PRIMARY_OPTIONS = [
|
|
@@ -4981,6 +4998,94 @@ function PickerButton({
|
|
|
4981
4998
|
}
|
|
4982
4999
|
) });
|
|
4983
5000
|
}
|
|
5001
|
+
var GroupSelectContext = createContext(null);
|
|
5002
|
+
function GroupSelect({
|
|
5003
|
+
value,
|
|
5004
|
+
onChange,
|
|
5005
|
+
type,
|
|
5006
|
+
children,
|
|
5007
|
+
style
|
|
5008
|
+
}) {
|
|
5009
|
+
return /* @__PURE__ */ jsx(GroupSelectContext.Provider, { value: { value, onChange, type }, children: /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.4vh", ...style }, children }) });
|
|
5010
|
+
}
|
|
5011
|
+
function filterByType(jobs, gangs, type) {
|
|
5012
|
+
if (type === "job") return jobs;
|
|
5013
|
+
if (type === "gang") return gangs;
|
|
5014
|
+
return [...jobs, ...gangs];
|
|
5015
|
+
}
|
|
5016
|
+
function GroupName(props) {
|
|
5017
|
+
const ctx = useContext(GroupSelectContext);
|
|
5018
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
5019
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
5020
|
+
const inCompound = ctx !== null;
|
|
5021
|
+
const currentValue = inCompound ? ctx.value.name : props.value;
|
|
5022
|
+
const filterType = inCompound ? ctx.type : props.type;
|
|
5023
|
+
const list = filterByType(jobs, gangs, filterType);
|
|
5024
|
+
const data = filterType === void 0 ? [
|
|
5025
|
+
{ group: locale("Jobs") || "Jobs", items: jobs.map((g) => ({ value: g.name, label: g.label })) },
|
|
5026
|
+
{ group: locale("Gangs") || "Gangs", items: gangs.map((g) => ({ value: g.name, label: g.label })) }
|
|
5027
|
+
] : list.map((g) => ({ value: g.name, label: g.label }));
|
|
5028
|
+
return /* @__PURE__ */ jsx(
|
|
5029
|
+
Select,
|
|
5030
|
+
{
|
|
5031
|
+
label: props.label,
|
|
5032
|
+
description: props.description,
|
|
5033
|
+
placeholder: props.placeholder ?? (locale("SelectGroup") || "Select\u2026"),
|
|
5034
|
+
size: props.size ?? "xs",
|
|
5035
|
+
disabled: props.disabled,
|
|
5036
|
+
style: props.style,
|
|
5037
|
+
data,
|
|
5038
|
+
value: currentValue ?? null,
|
|
5039
|
+
searchable: true,
|
|
5040
|
+
onChange: (v) => {
|
|
5041
|
+
const name = v ?? "";
|
|
5042
|
+
if (inCompound) {
|
|
5043
|
+
ctx.onChange({ name: name || void 0, grade: void 0 });
|
|
5044
|
+
} else if (props.onChange) {
|
|
5045
|
+
props.onChange(name);
|
|
5046
|
+
}
|
|
5047
|
+
},
|
|
5048
|
+
allowDeselect: false
|
|
5049
|
+
}
|
|
5050
|
+
);
|
|
5051
|
+
}
|
|
5052
|
+
function GroupRank(props) {
|
|
5053
|
+
const ctx = useContext(GroupSelectContext);
|
|
5054
|
+
if (ctx === null) {
|
|
5055
|
+
throw new Error("<GroupRank> must be a child of <GroupSelect>");
|
|
5056
|
+
}
|
|
5057
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
5058
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
5059
|
+
const all = [...jobs, ...gangs];
|
|
5060
|
+
const selectedGroup = all.find((g) => g.name === ctx.value.name) ?? null;
|
|
5061
|
+
const grades = selectedGroup?.grades ?? [];
|
|
5062
|
+
const data = grades.map((g) => ({
|
|
5063
|
+
value: String(g.grade),
|
|
5064
|
+
label: `${g.grade} \u2014 ${g.label || g.name}${g.isBoss ? " (boss)" : ""}`
|
|
5065
|
+
}));
|
|
5066
|
+
return /* @__PURE__ */ jsx(
|
|
5067
|
+
Select,
|
|
5068
|
+
{
|
|
5069
|
+
label: props.label,
|
|
5070
|
+
description: props.description,
|
|
5071
|
+
placeholder: props.placeholder ?? (locale("SelectGrade") || "Select grade\u2026"),
|
|
5072
|
+
size: props.size ?? "xs",
|
|
5073
|
+
style: props.style,
|
|
5074
|
+
data,
|
|
5075
|
+
value: ctx.value.grade != null ? String(ctx.value.grade) : null,
|
|
5076
|
+
onChange: (v) => {
|
|
5077
|
+
ctx.onChange({
|
|
5078
|
+
...ctx.value,
|
|
5079
|
+
grade: v != null ? Number(v) : void 0
|
|
5080
|
+
});
|
|
5081
|
+
},
|
|
5082
|
+
disabled: !selectedGroup || grades.length === 0,
|
|
5083
|
+
allowDeselect: false
|
|
5084
|
+
}
|
|
5085
|
+
);
|
|
5086
|
+
}
|
|
5087
|
+
GroupSelect.Name = GroupName;
|
|
5088
|
+
GroupSelect.Rank = GroupRank;
|
|
4984
5089
|
var KeyBindContext = createContext(null);
|
|
4985
5090
|
function useKeyBindContext() {
|
|
4986
5091
|
const ctx = useContext(KeyBindContext);
|
|
@@ -5458,7 +5563,7 @@ function mergeMantineThemeSafe(base, custom, override) {
|
|
|
5458
5563
|
}
|
|
5459
5564
|
};
|
|
5460
5565
|
}
|
|
5461
|
-
var DirkErrorBoundary = class extends
|
|
5566
|
+
var DirkErrorBoundary = class extends React6.Component {
|
|
5462
5567
|
constructor() {
|
|
5463
5568
|
super(...arguments);
|
|
5464
5569
|
__publicField(this, "state", { error: null, stack: void 0 });
|
|
@@ -5569,6 +5674,6 @@ function DirkProvider({ children, overideResourceName, themeOverride }) {
|
|
|
5569
5674
|
return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(DirkErrorBoundary, { children: content }) });
|
|
5570
5675
|
}
|
|
5571
5676
|
|
|
5572
|
-
export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, Counter, DirkProvider, FiveMKeyBindInput, FloatingParticles, FormProvider, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createFormStore, createScriptConfig, createSkill, extractDefaults, fetchLuaTable, fetchNui, gameToMap, getImageShape, getItemImageUrl, getScriptConfigInstance, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, splitFAString, updatePresignedURL, uploadImage, useAudio, useAutoFetcher, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useItems, useItemsList, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
|
|
5677
|
+
export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, Counter, DirkProvider, FiveMKeyBindInput, FloatingParticles, FormProvider, GroupName, GroupRank, GroupSelect, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createFormStore, createScriptConfig, createSkill, extractDefaults, fetchLuaTable, fetchNui, gameToMap, getImageShape, getItemImageUrl, getScriptConfigInstance, initialFetches, internalEvent, isEnvBrowser, isProfanity, latPr100, locale, localeStore, mapCenter, mapToGame, noop, numberToRoman, openLink, registerInitialFetch, registerInitialLuaTableFetch, runFetches, selectAllGroups, splitFAString, updatePresignedURL, uploadImage, useAudio, useAutoFetcher, useForm, useFormActions, useFormError, useFormErrors, useFormField, useFormFields, useFrameworkGroups, useItems, useItemsList, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
|
|
5573
5678
|
//# sourceMappingURL=index.js.map
|
|
5574
5679
|
//# sourceMappingURL=index.js.map
|