dirk-cfx-react 1.0.47 → 1.0.49

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,5 +1,5 @@
1
- export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
2
- export { InitialFetch, InternalEvent, SkillSettings, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useProfanityStore } from './utils/index.cjs';
1
+ export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.cjs';
2
+ export { InitialFetch, InternalEvent, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, fetchNui, getImageShape, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useProfanityStore } from './utils/index.cjs';
3
3
  export { FormProvider, FormState, TornEdgeSVGFilter, ValidationRules, createFormStore, useForm, useNuiEvent, useTornEdges } from './hooks/index.cjs';
4
4
  export { DirkProvider, DirkProviderProps, useSettings } from './providers/index.cjs';
5
5
  import 'react/jsx-runtime';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
2
- export { InitialFetch, InternalEvent, SkillSettings, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useProfanityStore } from './utils/index.js';
1
+ export { BorderedIcon, BorderedIconProps, ButtonProps, Counter, FloatingParticles, FloatingParticlesProps, InfoBox, InfoBoxProps, InputContainer, InputContainerProps, LevelBanner, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, NavigationStore, ParticleState, ProgressProps, SegmentProps, SegmentedControl, SegmentedControlProps, SegmentedProgress, Title, TitleProps, useModal, useModalActions, useNavigation, useNavigationStore } from './components/index.js';
2
+ export { InitialFetch, InternalEvent, SkillSettings, UploadImageProps, colorWithAlpha, copyToClipboard, createSkill, fetchNui, getImageShape, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useProfanityStore } from './utils/index.js';
3
3
  export { FormProvider, FormState, TornEdgeSVGFilter, ValidationRules, createFormStore, useForm, useNuiEvent, useTornEdges } from './hooks/index.js';
4
4
  export { DirkProvider, DirkProviderProps, useSettings } from './providers/index.js';
5
5
  import 'react/jsx-runtime';
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { createContext, useEffect, useRef, useState, useContext, useMemo } from 'react';
2
2
  import { create, useStore, createStore } from 'zustand';
3
+ import axios from 'axios';
3
4
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
- import { Flex, Text, Image, createTheme, useMantineTheme, alpha, MantineProvider, BackgroundImage } from '@mantine/core';
5
+ import { Flex, Text, Image as Image$1, createTheme, useMantineTheme, alpha, Progress, MantineProvider, BackgroundImage } from '@mantine/core';
5
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
7
  import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
7
8
  import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
@@ -742,6 +743,42 @@ function createSkill(defaultSettings) {
742
743
  useSkill
743
744
  };
744
745
  }
746
+ var dummyURL = "https://fmapi.net/api/v2/presigned-url/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJON0UxM0tzejFRM0NuSzRHWFBPbmUiLCJ0ZWFtSWQiOiJlMDQ1YnpwZzg5TGpoaUFTaURIdVoiLCJmaWxlVHlwZSI6ImltYWdlIiwidG9rZW5JZCI6ImpwczJ4Z0M1eFZqcnRoeWZTZnFsYSIsInNldHRpbmdzIjp7IlRlYW1JRCI6ImUwNDVienBnODlMamhpQVNpREh1WiIsIkltYWdlTm90aWZpY2F0aW9uVHlwZSI6IiIsIkRpc2NvcmRXZWJob29rIjoiIiwiRGlzY29yZEltYWdlQ2hhbm5lbCI6IiIsIlZpZGVvTm90aWZpY2F0aW9uVHlwZSI6IiIsIkRpc2NvcmRWaWRlb1dlYmhvb2siOiIiLCJEaXNjb3JkVmlkZW9DaGFubmVsIjoiIiwiQXVkaW9Ob3RpZmljYXRpb25UeXBlIjoiIiwiRGlzY29yZEF1ZGlvV2ViaG9vayI6IiIsIkRpc2NvcmRBdWRpb0NoYW5uZWwiOiIiLCJEaXNjb3JkQm90VG9rZW4iOiIiLCJSZXRlbnRpb25FbmFibGVkIjpmYWxzZSwiUmV0ZW50aW9uRGF5cyI6NywiVmlkZW9SZXRlbnRpb25FbmFibGVkIjpmYWxzZSwiVmlkZW9SZXRlbnRpb25EYXlzIjo3LCJBdWRpb1JldGVudGlvbkVuYWJsZWQiOmZhbHNlLCJBdWRpb1JldGVudGlvbkRheXMiOjcsIkxvZ0FsZXJ0RW5hYmxlZCI6ZmFsc2UsIkxvZ0FsZXJ0TGV2ZWxzIjpbXSwiTG9nQWxlcnREaXNjb3JkV2ViaG9vayI6IiIsIk92ZXJyaWRlSW1hZ2VRdWFsaXR5IjpmYWxzZSwiSW1hZ2VRdWFsaXR5Ijo1MH0sImV4cCI6MTc2MTg1MTEzNH0.fpPeQ0GCm5GNTddjttUQ78VMqRUAufXoOvv5C7Vh3WA";
747
+ async function updatePresignedURL() {
748
+ return await fetchNui("GET_PRESIGNED_URL", void 0, dummyURL);
749
+ }
750
+ async function uploadImage(props) {
751
+ const uploadURL = await updatePresignedURL();
752
+ const response = await fetch(props.fileURL);
753
+ const blob = await response.blob();
754
+ const file = new File([blob], "upload.png", { type: blob.type });
755
+ const formData = new FormData();
756
+ formData.append("file", file);
757
+ formData.append(
758
+ "metadata",
759
+ JSON.stringify({
760
+ name: props.name || file.name,
761
+ description: props.description || "Uploaded via DirkScripts"
762
+ })
763
+ );
764
+ const uploadRes = await axios.post(uploadURL, formData, {
765
+ headers: { "Content-Type": "multipart/form-data" }
766
+ });
767
+ const finalUrl = uploadRes.data?.data?.url ?? uploadRes.data?.url;
768
+ if (!finalUrl) throw new Error("Upload succeeded but no URL returned");
769
+ return finalUrl;
770
+ }
771
+ async function getImageShape(file) {
772
+ return new Promise((resolve, reject) => {
773
+ const img = new Image();
774
+ img.onload = () => {
775
+ if (img.width > img.height) resolve("wide");
776
+ else resolve("square");
777
+ };
778
+ img.onerror = () => reject(new Error("Failed to load image"));
779
+ img.src = typeof file === "string" ? file : URL.createObjectURL(file);
780
+ });
781
+ }
745
782
  function BorderedIcon(props) {
746
783
  const theme2 = useMantineTheme();
747
784
  return /* @__PURE__ */ jsx(
@@ -766,7 +803,7 @@ function BorderedIcon(props) {
766
803
  }
767
804
  var MotionFlex = motion.create(Flex);
768
805
  var MotionText = motion.create(Text);
769
- var MotionImage = motion.create(Image);
806
+ var MotionImage = motion.create(Image$1);
770
807
  var MotionIcon = motion.create(FontAwesomeIcon);
771
808
  function Counter(props) {
772
809
  return /* @__PURE__ */ jsx(AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsx(
@@ -1509,6 +1546,93 @@ function Title(props) {
1509
1546
  }
1510
1547
  );
1511
1548
  }
1549
+ function LevelBanner(props) {
1550
+ return /* @__PURE__ */ jsxs(
1551
+ MotionFlex,
1552
+ {
1553
+ w: "35vh",
1554
+ pos: "absolute",
1555
+ left: "50%",
1556
+ align: "center",
1557
+ gap: "xs",
1558
+ style: {
1559
+ borderRadius: useMantineTheme().radius.xxs
1560
+ },
1561
+ initial: { opacity: 0, y: -10, transform: "translateX(-50%)" },
1562
+ animate: { opacity: 1, y: 0, transform: "translateX(-50%)" },
1563
+ exit: { opacity: 0, y: -10, transform: "translateX(-50%)" },
1564
+ transition: { duration: 0.3 },
1565
+ direction: "column",
1566
+ children: [
1567
+ /* @__PURE__ */ jsxs(
1568
+ Flex,
1569
+ {
1570
+ w: "100%",
1571
+ justify: "space-between",
1572
+ children: [
1573
+ /* @__PURE__ */ jsxs(
1574
+ Text,
1575
+ {
1576
+ size: "xxs",
1577
+ c: "rgba(255, 255, 255, 0.9)",
1578
+ style: {
1579
+ fontFamily: "Akrobat Bold",
1580
+ letterSpacing: "0.1em"
1581
+ },
1582
+ children: [
1583
+ "LVL ",
1584
+ props.level
1585
+ ]
1586
+ }
1587
+ ),
1588
+ /* @__PURE__ */ jsxs(
1589
+ Text,
1590
+ {
1591
+ size: "xxs",
1592
+ c: "rgba(255, 255, 255, 0.7)",
1593
+ style: {
1594
+ fontFamily: "Akrobat Bold",
1595
+ letterSpacing: "0.1em"
1596
+ },
1597
+ children: [
1598
+ props.exp,
1599
+ "/",
1600
+ props.nextLevelXP,
1601
+ " XP"
1602
+ ]
1603
+ }
1604
+ ),
1605
+ /* @__PURE__ */ jsxs(
1606
+ Text,
1607
+ {
1608
+ size: "xxs",
1609
+ c: "rgba(255, 255, 255, 0.7)",
1610
+ style: {
1611
+ fontFamily: "Akrobat Bold",
1612
+ letterSpacing: "0.1em"
1613
+ },
1614
+ children: [
1615
+ "LVL ",
1616
+ props.level + 1
1617
+ ]
1618
+ }
1619
+ )
1620
+ ]
1621
+ }
1622
+ ),
1623
+ /* @__PURE__ */ jsx(
1624
+ Progress,
1625
+ {
1626
+ color: props.color,
1627
+ w: "100%",
1628
+ size: "sm",
1629
+ value: props.progressToLevel
1630
+ }
1631
+ )
1632
+ ]
1633
+ }
1634
+ );
1635
+ }
1512
1636
  var ModalContext = createContext(null);
1513
1637
  function useModal(selector) {
1514
1638
  const modal = useContext(ModalContext);
@@ -2125,6 +2249,6 @@ function TornEdgeSVGFilter() {
2125
2249
  );
2126
2250
  }
2127
2251
 
2128
- export { BorderedIcon, Counter, DirkProvider, FloatingParticles, FormProvider, InfoBox, InputContainer, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createFormStore, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useForm, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
2252
+ export { BorderedIcon, Counter, DirkProvider, FloatingParticles, FormProvider, InfoBox, InputContainer, LevelBanner, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createFormStore, createSkill, fetchNui, getImageShape, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useForm, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
2129
2253
  //# sourceMappingURL=index.js.map
2130
2254
  //# sourceMappingURL=index.js.map