dirk-cfx-react 1.1.82 → 1.1.84

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { AdminPageTitle, AdminPageTitleProps, AnimPostFxSelect, AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, ScenarioSelect, ScenarioSelectProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, SwitchPanel, SwitchPanelProps, TestBed, TestBedItem, TestBedPlacement, TestBedProps, ThemeOverrideSection, ThemeOverrideSectionProps, ThemeOverrideValue, Title, TitleProps, TitleSize, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
1
+ export { AdminPageTitle, AdminPageTitleProps, AnimPostFxSelect, AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, DiscordRole, DiscordRoleSelect, DiscordRoleSelectProps, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, ScenarioSelect, ScenarioSelectProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, SwitchPanel, SwitchPanelProps, TestBed, TestBedItem, TestBedPlacement, TestBedProps, ThemeOverrideSection, ThemeOverrideSectionProps, ThemeOverrideValue, Title, TitleProps, TitleSize, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
2
2
  export { FrameworkGrade, FrameworkGroup, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GtaControl, GtaControlGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, 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';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AdminPageTitle, AdminPageTitleProps, AnimPostFxSelect, AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, ScenarioSelect, ScenarioSelectProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, SwitchPanel, SwitchPanelProps, TestBed, TestBedItem, TestBedPlacement, TestBedProps, ThemeOverrideSection, ThemeOverrideSectionProps, ThemeOverrideValue, Title, TitleProps, TitleSize, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
1
+ export { AdminPageTitle, AdminPageTitleProps, AnimPostFxSelect, AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, BlipColorSelectProps, BlipDisplaySelect, BlipDisplaySelectProps, BlipIconSelect, BlipIconSelectProps, BorderedIcon, BorderedIconProps, ButtonProps, ConfigPanel, ConfigPanelProps, ConfirmModal, ConfirmModalProps, ControlMultiSelect, ControlMultiSelectProps, ControlSelect, ControlSelectProps, Counter, DiscordRole, DiscordRoleSelect, DiscordRoleSelectProps, FiveMControls, FiveMKeyBindInput, FloatingParticles, FloatingParticlesProps, GroupName, GroupNameProps, GroupRank, GroupRankProps, GroupSelect, GroupSelectProps, GroupType, GroupValue, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavItem, NavigationContext, NavigationProvider, NavigationStore, ParticleState, PositionPicker, PositionPickerProps, ProgressProps, Prompt, PromptButton, PromptModal, ScenarioSelect, ScenarioSelectProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, SelectItem, SelectItemProps, StoreModalProps, SwitchPanel, SwitchPanelProps, TestBed, TestBedItem, TestBedPlacement, TestBedProps, ThemeOverrideSection, ThemeOverrideSectionProps, ThemeOverrideValue, Title, TitleProps, TitleSize, Vector4DeleteButton, Vector4Display, Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
2
2
  export { FrameworkGrade, FrameworkGroup, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GtaControl, GtaControlGroup, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InitialFetch, InternalEvent, InventoryItem, InventoryItems, SettingsState, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, 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';
package/dist/index.js CHANGED
@@ -3694,11 +3694,11 @@ function ConfirmModal({
3694
3694
  placeholder: confirmText,
3695
3695
  value: typed,
3696
3696
  onChange: (e) => setTyped(e.currentTarget.value),
3697
- styles: (t) => ({
3697
+ styles: (t2) => ({
3698
3698
  input: {
3699
- backgroundColor: alpha(t.colors.dark[7], 0.5),
3699
+ backgroundColor: alpha(t2.colors.dark[7], 0.5),
3700
3700
  border: `0.1vh solid ${alpha(
3701
- typed === confirmText ? "#ef4444" : t.colors.dark[5],
3701
+ typed === confirmText ? "#ef4444" : t2.colors.dark[5],
3702
3702
  0.5
3703
3703
  )}`,
3704
3704
  color: "rgba(255,255,255,0.85)",
@@ -6924,6 +6924,182 @@ function ScenarioSelect({
6924
6924
  }
6925
6925
  );
6926
6926
  }
6927
+ var t = (key, fallback) => {
6928
+ const v = locale(key);
6929
+ return v === key ? fallback : v;
6930
+ };
6931
+ function decimalToHex(color) {
6932
+ if (!color || color === 0) return null;
6933
+ return "#" + color.toString(16).padStart(6, "0");
6934
+ }
6935
+ function RoleOption({ role }) {
6936
+ const swatch = decimalToHex(role.color) || "rgba(255,255,255,0.25)";
6937
+ return /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "0.6vh", children: [
6938
+ /* @__PURE__ */ jsx(
6939
+ "div",
6940
+ {
6941
+ style: {
6942
+ width: "1vh",
6943
+ height: "1vh",
6944
+ borderRadius: "50%",
6945
+ background: swatch,
6946
+ flexShrink: 0,
6947
+ boxShadow: role.color ? `0 0 0.4vh ${swatch}` : void 0
6948
+ }
6949
+ }
6950
+ ),
6951
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "rgba(255,255,255,0.9)", children: role.name })
6952
+ ] });
6953
+ }
6954
+ var NOT_CONFIGURED_TINT = "rgba(255,184,0,0.35)";
6955
+ var NOT_CONFIGURED_FILL = "rgba(255,184,0,0.05)";
6956
+ function DiscordRoleSelect(props) {
6957
+ const { endpoint, label: label2, size = "xs", placeholder, disabled, style, styles } = props;
6958
+ const [roles, setRoles] = useState(null);
6959
+ const [loading, setLoading] = useState(false);
6960
+ const [errorCode, setErrorCode] = useState(null);
6961
+ const refresh = async () => {
6962
+ setLoading(true);
6963
+ try {
6964
+ const res = await fetchNui(endpoint, {}, {
6965
+ // Browser dev fallback so the component renders something useful
6966
+ // outside FiveM.
6967
+ ok: true,
6968
+ roles: [
6969
+ { id: "1", name: "Admin", color: 15548997, position: 5 },
6970
+ { id: "2", name: "VIP Gold", color: 16426522, position: 4 },
6971
+ { id: "3", name: "Member", color: 5763719, position: 3 },
6972
+ { id: "4", name: "Guest", color: 0, position: 2 }
6973
+ ]
6974
+ });
6975
+ if (res?.ok) {
6976
+ setRoles(res.roles ?? []);
6977
+ setErrorCode(null);
6978
+ } else {
6979
+ setRoles(null);
6980
+ setErrorCode(res?._error || "FetchFailed");
6981
+ }
6982
+ } finally {
6983
+ setLoading(false);
6984
+ }
6985
+ };
6986
+ useEffect(() => {
6987
+ refresh();
6988
+ }, [endpoint]);
6989
+ const rolesById = useMemo(() => {
6990
+ const map = {};
6991
+ for (const r of roles ?? []) map[r.id] = r;
6992
+ return map;
6993
+ }, [roles]);
6994
+ if (errorCode === "NotConfigured") {
6995
+ const notConfiguredPlaceholder = t(
6996
+ "DiscordNotConfigured",
6997
+ "Not configured \u2014 set in /dirk_lib"
6998
+ );
6999
+ const notConfiguredStyles = {
7000
+ ...styles,
7001
+ input: {
7002
+ ...styles?.input ?? {},
7003
+ borderColor: NOT_CONFIGURED_TINT,
7004
+ backgroundColor: NOT_CONFIGURED_FILL
7005
+ }
7006
+ };
7007
+ const warnIcon = /* @__PURE__ */ jsx(AlertTriangle, { size: "1.2vh", color: NOT_CONFIGURED_TINT.replace(/0\.35\)$/, "0.85)") });
7008
+ if (props.multi) {
7009
+ return /* @__PURE__ */ jsx(
7010
+ MultiSelect,
7011
+ {
7012
+ label: label2,
7013
+ size,
7014
+ placeholder: notConfiguredPlaceholder,
7015
+ data: [],
7016
+ value: [],
7017
+ onChange: () => {
7018
+ },
7019
+ disabled: true,
7020
+ rightSection: warnIcon,
7021
+ style,
7022
+ styles: notConfiguredStyles
7023
+ }
7024
+ );
7025
+ }
7026
+ return /* @__PURE__ */ jsx(
7027
+ Select,
7028
+ {
7029
+ label: label2,
7030
+ size,
7031
+ placeholder: notConfiguredPlaceholder,
7032
+ data: [],
7033
+ value: null,
7034
+ onChange: () => {
7035
+ },
7036
+ disabled: true,
7037
+ rightSection: warnIcon,
7038
+ style,
7039
+ styles: notConfiguredStyles
7040
+ }
7041
+ );
7042
+ }
7043
+ const data = (roles ?? []).map((r) => ({
7044
+ value: r.id,
7045
+ label: r.name
7046
+ }));
7047
+ const renderOption = ({ option }) => {
7048
+ const role = rolesById[option.value];
7049
+ return role ? /* @__PURE__ */ jsx(RoleOption, { role }) : /* @__PURE__ */ jsx(Text, { size: "xs", children: option.label });
7050
+ };
7051
+ const refreshButton = /* @__PURE__ */ jsx(
7052
+ ActionIcon,
7053
+ {
7054
+ size: "xs",
7055
+ variant: "subtle",
7056
+ onClick: refresh,
7057
+ title: t("Refresh", "Refresh"),
7058
+ loading,
7059
+ children: /* @__PURE__ */ jsx(RefreshCw, { size: "1.2vh" })
7060
+ }
7061
+ );
7062
+ if (props.multi) {
7063
+ return /* @__PURE__ */ jsx(
7064
+ MultiSelect,
7065
+ {
7066
+ label: label2,
7067
+ size,
7068
+ placeholder: placeholder || t("PickRoles", "Pick roles..."),
7069
+ data,
7070
+ value: props.value || [],
7071
+ onChange: (ids) => props.onChange(ids),
7072
+ renderOption,
7073
+ searchable: true,
7074
+ clearable: true,
7075
+ disabled: disabled || loading && !roles,
7076
+ rightSection: refreshButton,
7077
+ style,
7078
+ styles,
7079
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7080
+ }
7081
+ );
7082
+ }
7083
+ return /* @__PURE__ */ jsx(
7084
+ Select,
7085
+ {
7086
+ label: label2,
7087
+ size,
7088
+ placeholder: placeholder || t("PickRole", "Pick a role..."),
7089
+ data,
7090
+ value: props.value || null,
7091
+ onChange: (id) => props.onChange(id),
7092
+ renderOption,
7093
+ searchable: true,
7094
+ clearable: true,
7095
+ disabled: disabled || loading && !roles,
7096
+ rightSection: refreshButton,
7097
+ style,
7098
+ styles,
7099
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7100
+ }
7101
+ );
7102
+ }
6927
7103
  function useTornEdges() {
6928
7104
  const game = useSettings((state) => state.game);
6929
7105
  return game === "rdr3" ? "torn-edge-wrapper" : "";
@@ -7284,6 +7460,6 @@ var Vector4Schema = z.object({
7284
7460
  w: z.number()
7285
7461
  });
7286
7462
 
7287
- export { AdminPageTitle, AnimPostFxSelect, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, ControlMultiSelect, ControlSelect, Counter, DirkProvider, FiveMKeyBindInput, FloatingParticles, FormProvider, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GroupName, GroupRank, GroupSelect, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InfoBox, InputContainer, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, ScenarioSelect, SegmentedControl, SegmentedProgress, SelectItem, SwitchPanel, TestBed, ThemeOverrideSection, Title, TornEdgeSVGFilter, Vector2Schema, Vector3Schema, Vector4DeleteButton, Vector4Display, Vector4Schema, WorldPositionGotoButton, WorldPositionSetButton, colorWithAlpha, copyToClipboard, createFormStore, createScriptConfig, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, 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, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
7463
+ export { AdminPageTitle, AnimPostFxSelect, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, ControlMultiSelect, ControlSelect, Counter, DirkProvider, DiscordRoleSelect, FiveMKeyBindInput, FloatingParticles, FormProvider, GTA_CONTROLS, GTA_CONTROL_GROUP_ORDER, GroupName, GroupRank, GroupSelect, INPUT_MAPPER_KEYS_BY_PRIMARY, INPUT_MAPPER_PRIMARY_OPTIONS, InfoBox, InputContainer, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, ScenarioSelect, SegmentedControl, SegmentedProgress, SelectItem, SwitchPanel, TestBed, ThemeOverrideSection, Title, TornEdgeSVGFilter, Vector2Schema, Vector3Schema, Vector4DeleteButton, Vector4Display, Vector4Schema, WorldPositionGotoButton, WorldPositionSetButton, colorWithAlpha, copyToClipboard, createFormStore, createScriptConfig, createSkill, extractDefaults, fetchLuaTable, fetchNui, formatGtaControl, gameToMap, getGtaControl, 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, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
7288
7464
  //# sourceMappingURL=index.js.map
7289
7465
  //# sourceMappingURL=index.js.map