Skip to content

Commit

Permalink
Add utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwooding committed Aug 15, 2024
1 parent 7acd0ed commit a8d366b
Show file tree
Hide file tree
Showing 529 changed files with 571 additions and 531 deletions.
15 changes: 9 additions & 6 deletions packages/core/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
export {
getRefFromChildren,
makePrefixer,
useId,
useIdMemo,
setRef,
useControlled,
useForkRef,
} from "@salt-ds/utils";
export * from "./capitalize";
export * from "./createChainedFunction";
export * from "./createContext";
export * from "./debounce";
export * from "./inferElementType";
export * from "./makePrefixer";
export * from "./marginMiddleware";
export * from "./ownerDocument";
export * from "./ownerWindow";
export * from "./polymorphicTypes";
export * from "./renderProps";
export * from "./setRef";
export * from "./useControlled";
export * from "./useFloatingUI";
export * from "./useForkRef";
export * from "./useId";
export * from "./useIsFocusVisible";
export * from "./useIsomorphicLayoutEffect";
export * from "./usePrevious";
Expand All @@ -22,4 +26,3 @@ export * from "./mergeProps";
export * from "./useValueEffect";
export * from "./useResizeObserver";
export * from "./useEventCallback";
export * from "./getRefFromChildren";
2 changes: 1 addition & 1 deletion packages/core/src/utils/useValueEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/

import { type Dispatch, type MutableRefObject, useRef, useState } from "react";
import { useIsomorphicLayoutEffect } from "../index";
import { useEventCallback } from "./useEventCallback";
import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect";

type SetValueAction<S> = (prev: S) => Generator<any, void, unknown>;

Expand Down
2 changes: 1 addition & 1 deletion packages/countries/scripts/templateCountrySymbol.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";
import { useId } from "@salt-ds/core";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";

Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AD.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AD_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AE.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AE_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AF.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AF_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AG.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AG_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AI.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AI_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AL.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AL_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AM.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AM_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AO.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AO_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AQ.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AQ_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AR.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AR_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AS.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AS_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AT.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AT_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AU.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AU_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AW.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AW_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AX.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AX_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AZ.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/AZ_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BA.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BA_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BB.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BB_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BD.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BD_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BE.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BE_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BF.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BF_Sharp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
2 changes: 1 addition & 1 deletion packages/countries/src/components/BG.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// WARNING: This file was generated by a script. Do not modify it manually

import { useId } from "@salt-ds/core";
import { useId } from "@salt-ds/utils";
import { forwardRef } from "react";

import { CountrySymbol, type CountrySymbolProps } from "../country-symbol";
Expand Down
Loading

0 comments on commit a8d366b

Please sign in to comment.