dirk-cfx-react 1.0.38 → 1.0.40

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.js CHANGED
@@ -1750,6 +1750,36 @@ function Title(props) {
1750
1750
  }
1751
1751
  );
1752
1752
  }
1753
+ var ModalContext = createContext(null);
1754
+ function useModal(selector) {
1755
+ const modal = useContext(ModalContext);
1756
+ if (!modal) {
1757
+ throw new Error("useModal must be used within a ModalProvider");
1758
+ }
1759
+ return useStore(modal, selector);
1760
+ }
1761
+ function ModalProvider({ children, defaultPage }) {
1762
+ const storeRef = useRef(
1763
+ create(() => ({
1764
+ active: null
1765
+ }))
1766
+ );
1767
+ return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: storeRef.current, children: [
1768
+ /* @__PURE__ */ jsx(Modal, {}),
1769
+ children
1770
+ ] });
1771
+ }
1772
+ function useModalActions() {
1773
+ const modal = useContext(ModalContext);
1774
+ if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
1775
+ const showModal = (openModal) => {
1776
+ modal.setState({ active: openModal });
1777
+ };
1778
+ const hideModal = () => {
1779
+ modal.setState({ active: null });
1780
+ };
1781
+ return { showModal, hideModal };
1782
+ }
1753
1783
  function Modal() {
1754
1784
  const active = useModal((state) => state.active);
1755
1785
  const { hideModal } = useModalActions();
@@ -1869,36 +1899,6 @@ function Modal() {
1869
1899
  }
1870
1900
  ) });
1871
1901
  }
1872
- var ModalContext = createContext(null);
1873
- function useModal(selector) {
1874
- const modal = useContext(ModalContext);
1875
- if (!modal) {
1876
- throw new Error("useModal must be used within a ModalProvider");
1877
- }
1878
- return useStore(modal, selector);
1879
- }
1880
- function ModalProvider({ children, defaultPage }) {
1881
- const storeRef = useRef(
1882
- create(() => ({
1883
- active: null
1884
- }))
1885
- );
1886
- return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: storeRef.current, children: [
1887
- /* @__PURE__ */ jsx(Modal, {}),
1888
- children
1889
- ] });
1890
- }
1891
- function useModalActions() {
1892
- const modal = useContext(ModalContext);
1893
- if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
1894
- const showModal = (openModal) => {
1895
- modal.setState({ active: openModal });
1896
- };
1897
- const hideModal = () => {
1898
- modal.setState({ active: null });
1899
- };
1900
- return { showModal, hideModal };
1901
- }
1902
1902
 
1903
1903
  export { BorderedIcon, Counter, DirkProvider, FloatingParticles, InfoBox, InputContainer, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
1904
1904
  //# sourceMappingURL=index.js.map