@jobber/hooks 2.9.2-CJS-to-ESM.25 → 2.9.2-CJS-to-ESM.27

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/README.mdx CHANGED
@@ -18,7 +18,3 @@ Shared hooks for components in Atlantis.
18
18
  ## Installing
19
19
 
20
20
  `npm install hooks @jobber/hooks`
21
-
22
- ## Additional Information
23
-
24
- Additional Information
package/dist/index.cjs CHANGED
@@ -139,7 +139,7 @@ var src_exports = {};
139
139
  __export(src_exports, {
140
140
  BREAKPOINT_SIZES: () => BREAKPOINT_SIZES,
141
141
  Breakpoints: () => Breakpoints,
142
- mockViewportWidth: () => mockViewportWidth,
142
+ isAlreadyUpdated: () => isAlreadyUpdated,
143
143
  useAssert: () => useAssert,
144
144
  useBool: () => useBool,
145
145
  useBreakpoints: () => useBreakpoints,
@@ -220,71 +220,6 @@ function useBreakpoints() {
220
220
  };
221
221
  }
222
222
 
223
- // src/useBreakpoints/mockViewportWidth/mockViewportWidth.ts
224
- var defaultMatchMedia = window.matchMedia;
225
- var defaultResizeTo = window.resizeTo;
226
- var defaultInnerWidth = window.innerWidth;
227
- function mockViewportWidth() {
228
- return { cleanup, setViewportWidth };
229
- }
230
- function setViewportWidth(newWidth) {
231
- Object.defineProperty(window, "matchMedia", {
232
- writable: true,
233
- value: jest.fn().mockImplementation((query) => {
234
- const matches = isQueryMatching(query);
235
- const instance = {
236
- matches,
237
- media: query,
238
- onchange: null,
239
- addListener: jest.fn(),
240
- // Deprecated but some packages use it
241
- removeListener: jest.fn(),
242
- // Deprecated but some packages use it
243
- addEventListener: jest.fn(),
244
- removeEventListener: jest.fn(),
245
- dispatchEvent: jest.fn()
246
- };
247
- window.addEventListener("resize", () => {
248
- if (matches != instance.matches) {
249
- instance.matches = matches;
250
- instance.dispatchEvent("change");
251
- }
252
- });
253
- return instance;
254
- })
255
- });
256
- Object.defineProperty(window, "resizeTo", {
257
- value: (width) => {
258
- Object.defineProperty(window, "innerWidth", {
259
- configurable: true,
260
- writable: true,
261
- value: width
262
- });
263
- window.dispatchEvent(new Event("resize"));
264
- }
265
- });
266
- window.resizeTo(newWidth, window.innerHeight);
267
- }
268
- function cleanup() {
269
- window.matchMedia = defaultMatchMedia;
270
- window.resizeTo = defaultResizeTo;
271
- window.innerWidth = defaultInnerWidth;
272
- }
273
- function isQueryMatching(query) {
274
- const match = query.match(/(min-width|max-width):\s*(\d+)/);
275
- if (!match)
276
- return false;
277
- const { innerWidth } = window;
278
- const [, operator, value] = match;
279
- const breakpoint = parseInt(value, 10);
280
- switch (operator) {
281
- case "max-width":
282
- return innerWidth <= breakpoint;
283
- case "min-width":
284
- return innerWidth >= breakpoint;
285
- }
286
- }
287
-
288
223
  // src/useCollectionQuery/useCollectionQuery.ts
289
224
  var import_client = require("@apollo/client");
290
225
  var import_lodash = require("lodash");
@@ -786,7 +721,7 @@ function useShowClear({
786
721
  0 && (module.exports = {
787
722
  BREAKPOINT_SIZES,
788
723
  Breakpoints,
789
- mockViewportWidth,
724
+ isAlreadyUpdated,
790
725
  useAssert,
791
726
  useBool,
792
727
  useBreakpoints,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../formatters/dist/global.js","../../formatters/dist/config.js","../../formatters/dist/currency.js","../../formatters/dist/CurrencyType.js","../../formatters/dist/index.js","../src/index.ts","../src/useAssert/useAssert.tsx","../src/useBool/useBool.ts","../src/useBreakpoints/useMediaQuery.ts","../src/useBreakpoints/useBreakpoints.ts","../src/useBreakpoints/mockViewportWidth/mockViewportWidth.ts","../src/useCollectionQuery/useCollectionQuery.ts","../src/useCollectionQuery/uniqueNodes.tsx","../src/useCollectionQuery/uniqueEdges.tsx","../src/useIsMounted/useIsMounted.ts","../src/useSafeLayoutEffect/useSafeLayoutEffect.ts","../src/useFocusTrap/useFocusTrap.ts","../src/useFormState/useFormState.ts","../src/useInView/useInView.ts","../src/useLiveAnnounce/useLiveAnnounce.tsx","../src/useOnKeyDown/useOnKeyDown.ts","../src/usePasswordStrength/usePasswordStrength.ts","../src/useRefocusOnActivator/useRefocusOnActivator.ts","../src/useResizeObserver/useResizeObserver.ts","../src/useShowClear/useShowClear.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.global = void 0;\nfunction getGlobal() {\n if (typeof window !== \"undefined\") {\n return window;\n }\n return global;\n}\nconst glob = getGlobal();\nexports.global = glob;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.config = void 0;\nconst global_1 = require(\"./global\");\nconst configOverrides = (global_1.global.ATLANTIS_ENV || {}).config || {};\nexports.config = Object.freeze(Object.assign({ defaultCurrency: \"USD\", errorNotifier(message, error) {\n console.error(message, error);\n } }, configOverrides));\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatCurrency = void 0;\nconst config_1 = require(\"./config\");\nfunction formatCurrency(amount, currency = config_1.config.defaultCurrency) {\n return amount.toLocaleString(\"en\", {\n style: \"currency\",\n currency: currency,\n });\n}\nexports.formatCurrency = formatCurrency;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./currency\"), exports);\n__exportStar(require(\"./CurrencyType\"), exports);\n__exportStar(require(\"./config\"), exports);\n","export * from \"./useAssert\";\nexport * from \"./useBool\";\nexport * from \"./useBreakpoints\";\nexport * from \"./useCollectionQuery\";\nexport * from \"./useFocusTrap\";\nexport * from \"./useFormState\";\nexport * from \"./useInView\";\nexport * from \"./useIsMounted\";\nexport * from \"./useLiveAnnounce\";\nexport * from \"./useOnKeyDown\";\nexport * from \"./usePasswordStrength\";\nexport * from \"./useRefocusOnActivator\";\nexport * from \"./useResizeObserver\";\nexport * from \"./useSafeLayoutEffect\";\nexport * from \"./useShowClear\";\n","import process from \"process\";\n\ninterface Options {\n readonly warn: boolean;\n}\n\nexport function useAssert(\n shouldShow: boolean,\n message: string,\n options?: Options,\n) {\n if (process?.env?.NODE_ENV !== \"production\" && shouldShow) {\n if (options?.warn) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n }\n}\n","import { useCallback, useState } from \"react\";\n\ndeclare const brand: unique symbol;\n\ntype Callback = () => void;\n\nexport type SetTrue = Callback & {\n [brand]: \"SetTrue\";\n};\n\nexport type SetFalse = Callback & {\n [brand]: \"SetFalse\";\n};\n\nexport type Toggle = Callback & {\n [brand]: \"Toggle\";\n};\n\nexport function useBool(\n initialState = false,\n): [boolean, SetTrue, SetFalse, Toggle] {\n const [state, setState] = useState(initialState);\n const setTrue = useCallback(() => setState(true), []);\n const setFalse = useCallback(() => setState(false), []);\n const toggle = useCallback(() => setState(current => !current), []);\n\n return [state, setTrue as SetTrue, setFalse as SetFalse, toggle as Toggle];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Sets the JS media query listener. Internal use only.\n */\nexport function useMediaQuery(CSSMediaQuery: string) {\n const [matches, setMatches] = useState(\n window.matchMedia(CSSMediaQuery).matches,\n );\n\n useEffect(() => {\n const media = window.matchMedia(CSSMediaQuery);\n\n if (media.matches !== matches) {\n setMatches(media.matches);\n }\n\n const listener = () => setMatches(media.matches);\n media.addEventListener(\"change\", listener);\n\n return () => media.removeEventListener(\"change\", listener);\n }, [CSSMediaQuery]);\n\n return matches;\n}\n","import { useMediaQuery } from \"./useMediaQuery\";\n\nexport const BREAKPOINT_SIZES = { sm: 490, md: 768, lg: 1080, xl: 1440 };\n\n/**\n * Hook equivalent of CSS media queries with our\n * [supported breakpoints](https://atlantis.getjobber.com/?path=/docs/design-breakpoints--page).\n */\nexport function useBreakpoints() {\n const { sm, md, lg, xl } = BREAKPOINT_SIZES;\n const extraSmallOnly = useMediaQuery(`(max-width: ${sm - 1}px)`);\n const smallAndUp = useMediaQuery(`(min-width: ${sm}px)`);\n const mediumAndUp = useMediaQuery(`(min-width: ${md}px)`);\n const largeAndUp = useMediaQuery(`(min-width: ${lg}px)`);\n const extraLargeAndUp = useMediaQuery(`(min-width: ${xl}px)`);\n\n return {\n smallAndUp,\n mediumAndUp,\n largeAndUp,\n extraLargeAndUp,\n extraSmallOnly,\n smallOnly: smallAndUp && !mediumAndUp,\n mediumOnly: mediumAndUp && !largeAndUp,\n largeOnly: largeAndUp && !extraLargeAndUp,\n };\n}\n","const defaultMatchMedia = window.matchMedia;\nconst defaultResizeTo = window.resizeTo;\nconst defaultInnerWidth = window.innerWidth;\n\nexport function mockViewportWidth() {\n return { cleanup, setViewportWidth };\n}\n\nfunction setViewportWidth(newWidth: number) {\n Object.defineProperty(window, \"matchMedia\", {\n writable: true,\n value: jest.fn().mockImplementation((query: string) => {\n const matches = isQueryMatching(query);\n const instance = {\n matches: matches,\n media: query,\n onchange: null,\n addListener: jest.fn(), // Deprecated but some packages use it\n removeListener: jest.fn(), // Deprecated but some packages use it\n addEventListener: jest.fn(),\n removeEventListener: jest.fn(),\n dispatchEvent: jest.fn(),\n };\n\n window.addEventListener(\"resize\", () => {\n if (matches != instance.matches) {\n instance.matches = matches;\n instance.dispatchEvent(\"change\");\n }\n });\n\n return instance;\n }),\n });\n\n Object.defineProperty(window, \"resizeTo\", {\n value: (width: number) => {\n Object.defineProperty(window, \"innerWidth\", {\n configurable: true,\n writable: true,\n value: width,\n });\n window.dispatchEvent(new Event(\"resize\"));\n },\n });\n\n window.resizeTo(newWidth, window.innerHeight);\n}\n\nfunction cleanup() {\n window.matchMedia = defaultMatchMedia;\n window.resizeTo = defaultResizeTo;\n window.innerWidth = defaultInnerWidth;\n}\n\nexport function isQueryMatching(query: string) {\n const match = query.match(/(min-width|max-width):\\s*(\\d+)/);\n if (!match) return false;\n\n const { innerWidth } = window;\n const [, operator, value] = match;\n const breakpoint = parseInt(value, 10);\n\n switch (operator) {\n case \"max-width\":\n return innerWidth <= breakpoint;\n case \"min-width\":\n return innerWidth >= breakpoint;\n }\n}\n","import {\n ApolloError,\n DocumentNode,\n QueryHookOptions,\n SubscribeToMoreOptions,\n useQuery,\n} from \"@apollo/client\";\nimport { cloneDeep } from \"lodash\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { config } from \"@jobber/formatters\";\nimport { Node, uniqueNodes } from \"./uniqueNodes\";\nimport { Edge, createEdge, uniqueEdges } from \"./uniqueEdges\";\nimport { useIsMounted } from \"../useIsMounted\";\n\ninterface UseCollectionQueryArguments<TQuery, TSubscription> {\n /**\n * The graphQL query that fetches the collection\n */\n query: DocumentNode;\n\n /**\n * A list of options for us to pass into the apollo `useQuery` hook\n */\n queryOptions?: QueryHookOptions<TQuery>;\n\n /**\n * A function that returns the location where the {@link Collection} is located.\n *\n * The collection is the part of the result that needs to be paginated.\n */\n getCollectionByPath: GetCollectionByPathFunction<TQuery>;\n\n /**\n * A list of subscription options if you want to create a GraphQL\n * subscription to listen for more content.\n */\n subscription?: ListSubscription<TSubscription>;\n}\n\ninterface ListSubscription<TSubscription> {\n /**\n * The graphQL subscription that listens for more data. This query should\n * return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n document: DocumentNode;\n\n /**\n * A list of variables to pass into the apollo `subscribeToMore` function.\n */\n options?: Pick<SubscribeToMoreOptions<TSubscription>, \"variables\">;\n\n /**\n * A function that returns the location where the `Node` is located on the\n * `TSubscription` object.\n *\n * It should return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n getNodeByPath: GetNodeByPath<TSubscription>;\n}\n\ninterface Collection {\n edges?: Edge[];\n nodes?: Node[];\n pageInfo: {\n endCursor?: string | undefined;\n hasNextPage: boolean;\n [otherProperties: string]: unknown;\n };\n totalCount?: number;\n [otherProperties: string]: unknown;\n}\n\ninterface CollectionQueryResult<TQuery> {\n data: TQuery | undefined;\n error: ApolloError | undefined;\n loadingRefresh: boolean;\n loadingNextPage: boolean;\n loadingInitialContent: boolean;\n refresh(): void;\n nextPage(): void;\n}\n\ntype GetCollectionByPathFunction<TQuery> = (\n data: TQuery | undefined,\n) => Collection | undefined;\n\ntype GetNodeByPath<TSubscription> = (\n data: TSubscription | undefined,\n) => Node | undefined;\n\nexport function useCollectionQuery<TQuery, TSubscription = undefined>({\n query,\n queryOptions,\n getCollectionByPath,\n subscription,\n}: UseCollectionQueryArguments<\n TQuery,\n TSubscription\n>): CollectionQueryResult<TQuery> {\n const { data, loading, refetch, error, fetchMore, subscribeToMore } =\n useQuery<TQuery>(query, queryOptions);\n\n const isMounted = useIsMounted();\n const [loadingRefresh, setLoadingRefresh] = useState<boolean>(false);\n const [loadingNextPage, setLoadingNextPage] = useState<boolean>(false);\n const [hookError, setHookError] = useState<ApolloError | undefined>();\n const loadingInitialContent = loading && !loadingRefresh && !loadingNextPage;\n const isSearching = !!queryOptions?.variables?.searchTerm;\n\n const refresh = useCallback(() => {\n if (loadingInitialContent || loadingRefresh) {\n return;\n }\n\n setLoadingRefresh(true);\n\n fetchMore({\n // a workaround fix for the error described in this post\n // https://github.com/apollographql/apollo-client/issues/7491#issuecomment-767985363\n // These changes can be reverted once we can update to version 3.4\n // (the current release candidate)\n variables: {},\n updateQuery: (prev, { fetchMoreResult }) => fetchMoreResult || prev,\n })\n .catch(err => config.errorNotifier(\"Refetch Error\", err))\n .finally(() => {\n if (isMounted.current) {\n setLoadingRefresh(false);\n }\n });\n }, [\n loadingInitialContent,\n loadingRefresh,\n setLoadingRefresh,\n refetch,\n isMounted,\n ]);\n\n const nextPage = useCallback(() => {\n if (loadingInitialContent || loadingRefresh || loadingNextPage) {\n return;\n }\n\n const pageInfo = getCollectionByPath(data)?.pageInfo;\n\n if (!pageInfo || !pageInfo.hasNextPage) {\n return;\n }\n\n setLoadingNextPage(true);\n setHookError(undefined);\n\n fetchMore({\n variables: {\n cursor: pageInfo.endCursor,\n },\n updateQuery: (prev, { fetchMoreResult }) =>\n fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath),\n })\n .catch(err => {\n config.errorNotifier(\"FetchMore Error\", err);\n setHookError(err);\n })\n .finally(() => {\n if (isMounted.current) {\n setLoadingNextPage(false);\n }\n });\n }, [\n data,\n loadingInitialContent,\n loadingRefresh,\n fetchMore,\n loadingNextPage,\n setLoadingNextPage,\n getCollectionByPath,\n isMounted,\n ]);\n\n useEffect(\n () => {\n if (subscription == undefined) return;\n\n const subscriptionOptions = subscription.options || {};\n\n // Reset this state so we can handle errors from the subscription\n setHookError(undefined);\n\n return subscribeToMore<TSubscription>({\n ...subscriptionOptions,\n document: subscription.document,\n updateQuery: (prev, { subscriptionData }) =>\n subscribeToMoreHandler(\n isSearching,\n prev,\n getCollectionByPath,\n subscriptionData?.data,\n subscription.getNodeByPath,\n ),\n onError: err => {\n config.errorNotifier(\"Subscribe to More Error\", err);\n setHookError(err as ApolloError);\n },\n });\n },\n // Disabling this linter so we can force this only run once. If we didn't\n // do this we would need to ensure subscription, subscribeToMore, and getNodeByPath\n // all use useCallback.\n [queryOptions?.variables?.searchTerm],\n );\n\n const combinedError = error || hookError;\n\n return {\n data,\n error: combinedError,\n refresh,\n loadingRefresh,\n nextPage,\n loadingNextPage,\n loadingInitialContent,\n };\n}\n\n/**\n * The following method uses an `output` variable, and indirectly modifies it through the `outputCollection` variable.\n * This type of indirect modification is prone to bugs, but I couldn't think of a better way to write this code.\n *\n * Here's what I was balancing:\n * 1. We need to copy the structure of prev to ensure that when we're combining two objects, we're not losing properties\n * 2. We need to extract a key from an unknown path that's given to us by getCollectionByPath and then we need to modify\n * that, and ensure that it's properly set on the cloned output object.\n * 3. We want to keep the interface to this hook as simple and easy to use as possible\n *\n * The alternative approaches that were rejected:\n * 1. We replace the getCollectionByPath with a keyPath string. (Eg. \"data.conversation.message\") and then we use lodash\n * `get` and `set` which should remove all the object manipulation. But, this approach loses us the type safety that\n * getCollectionByPath gives us\n * 2. We could add a setCollection function to the list of arguments for this hook. This leaves us with type safety but\n * makes the `useCollectionQuery` interface more complicated by adding arguments\n */\nfunction fetchMoreUpdateQueryHandler<TQuery>(\n prev: TQuery,\n fetchMoreResult: TQuery | undefined,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n): TQuery {\n const nextCollection = getCollectionByPath(fetchMoreResult);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection === undefined || nextCollection === undefined) {\n return output;\n }\n\n if (outputCollection.nodes && nextCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n nextCollection.nodes,\n );\n }\n\n if (outputCollection.edges && nextCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n nextCollection.edges,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(nextCollection.pageInfo),\n ...getTotalCount(nextCollection.totalCount),\n });\n\n return output;\n}\n\nfunction subscribeToMoreHandler<TQuery, TSubscription>(\n isSearching: boolean,\n prev: TQuery,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n subscriptionData: TSubscription | undefined,\n getNodeByPath: GetNodeByPath<TSubscription>,\n): TQuery {\n const node = getNodeByPath(subscriptionData);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection == undefined || node == undefined) return output;\n\n if (isAlreadyUpdated(outputCollection, node) || isSearching) {\n return prev;\n }\n\n if (outputCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n [node],\n false,\n );\n }\n\n if (outputCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n [createEdge(node)],\n false,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(outputCollection.pageInfo),\n ...getTotalCount(outputCollection.totalCount, 1),\n });\n\n return output;\n}\n\ninterface TotalCountReturn {\n totalCount?: number;\n}\n\nfunction getTotalCount(\n totalCount: number | undefined,\n additionalCount = 0,\n): TotalCountReturn {\n return totalCount !== undefined\n ? { totalCount: totalCount + additionalCount }\n : {};\n}\n\nexport function isAlreadyUpdated(outputCollection: Collection, newNode: Node) {\n let edgesAlreadyUpdated = true;\n let nodesAlreadyUpdated = true;\n\n if (outputCollection.edges) {\n edgesAlreadyUpdated = outputCollection.edges.some(edge => {\n return edge.node.id === newNode.id;\n });\n }\n\n if (outputCollection.nodes) {\n nodesAlreadyUpdated = outputCollection.nodes.some(node => {\n return node.id === newNode.id;\n });\n }\n\n return edgesAlreadyUpdated && nodesAlreadyUpdated;\n}\n\nfunction getUpdatedEdges(\n prevEdges: Edge[],\n nextEdges: Edge[],\n appendToEnd = true,\n) {\n const newEdges = appendToEnd\n ? [...prevEdges, ...nextEdges]\n : [...nextEdges, ...prevEdges];\n\n return uniqueEdges(newEdges);\n}\n\nfunction getUpdatedNodes(\n prevNodes: Node[],\n nextNodes: Node[],\n appendToEnd = true,\n) {\n const newNodes = appendToEnd\n ? [...prevNodes, ...nextNodes]\n : [...nextNodes, ...prevNodes];\n\n return uniqueNodes(newNodes);\n}\n","export interface Node {\n id: unknown;\n __typename?: unknown;\n}\n\nexport function uniqueNodes(nodes: Node[]): Node[] {\n const result = new Map<string, Node>();\n nodes.forEach(node => {\n result.set(`${node.__typename}-${node.id}`, node);\n });\n\n return Array.from(result.values());\n}\n","import { Node } from \"./uniqueNodes\";\n\nexport interface Edge {\n __typename?: unknown;\n node: Node;\n cursor: string;\n}\n\nexport function createEdge(node: Node): Edge {\n return {\n node: node,\n cursor: \"\",\n __typename: `${node.__typename}Edge`,\n };\n}\n\nexport function uniqueEdges(edges: Edge[]): Edge[] {\n const result = new Map<string, Edge>();\n edges.forEach(edge => {\n result.set(\n `${edge.__typename}-${edge.node.__typename}-${edge.node.id}`,\n edge,\n );\n });\n\n return Array.from(result.values());\n}\n","import { useRef } from \"react\";\nimport { useSafeLayoutEffect } from \"../useSafeLayoutEffect\";\n\n/**\n * Why does this work?\n *\n * The following is from the react docs:\n * [The return function from `useLayoutEffect`] is the optional cleanup mechanism for effects.\n * Every effect may return a function that cleans up after it.\n *\n * When exactly does React clean up an effect? React performs the cleanup when the component unmounts.\n * The cleanup for useLayoutEffect is called after component unmounts and before before browser painting\n * the screen\n *\n * What does that mean for us? When this hook is initially loaded, we then trigger a `useLayoutEffect` that\n * sets the isMounted to true right after the component is mounted.\n * When the component unmounts, it calls the cleanup function that sets `isMounted` to false.\n * This `useLayoutEffect` hook will only be run once.\n */\nexport function useIsMounted(): { current: boolean } {\n const isMounted = useRef(false);\n\n useSafeLayoutEffect(() => {\n isMounted.current = true;\n\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n return isMounted;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useSafeLayoutEffect = globalThis?.document\n ? useLayoutEffect\n : useEffect;\n","import { useEffect, useRef } from \"react\";\n\n/**\n * Traps the focus within the children of the ref element.\n *\n * @param active - Turns the focus trapping on or off. Also adds aria-hidden on the\n * body but not the dialog.\n *\n * @returns ref\n */\nexport function useFocusTrap<T extends HTMLElement>(active: boolean) {\n // There's an ongoing issue with useRef return type clashing with an element's\n // ref prop type. TLDR: Use null because useRef doesn't expect undefined.\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572\n const ref = useRef<T>(null);\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!(active && ref.current) || event.key !== \"Tab\") {\n return;\n }\n\n const { firstElement, lastElement } = getElements(ref.current);\n\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n lastElement.focus();\n event.preventDefault();\n }\n } else {\n if (document.activeElement === lastElement) {\n firstElement.focus();\n event.preventDefault();\n }\n }\n }\n\n useEffect(() => {\n if (active && ref.current) {\n const { firstElement } = getElements(ref.current);\n firstElement.focus();\n ref.current.addEventListener(\"keydown\", handleKeyDown);\n }\n\n return () => {\n ref.current?.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [active]);\n\n return ref;\n}\n\nfunction getElements<T extends HTMLElement>(ref: T) {\n const focusables = [\n \"button\",\n \"[href]\",\n \"input\",\n \"select\",\n \"textarea\",\n '[tabindex]:not([tabindex=\"-1\"])',\n ];\n const elements = [\n ...ref.querySelectorAll<HTMLElement>(focusables.join(\", \")),\n ];\n\n // If the ref is focusable, ensure it's the first element to be focused.\n if (ref.getAttribute(\"tabindex\") === \"0\") {\n elements.unshift(ref);\n }\n\n const firstElement = elements[0];\n const lastElement = elements[elements.length - 1];\n\n return { firstElement, lastElement };\n}\n","import { useState } from \"react\";\n\nexport function useFormState() {\n const [formState, setFormState] = useState({\n isDirty: false,\n isValid: false,\n });\n\n return [formState, setFormState] as const;\n}\n","import { RefObject, useCallback, useEffect, useRef, useState } from \"react\";\n\nexport function useInView<T extends Element>(): [RefObject<T>, boolean] {\n const ref = useRef<T>(null);\n const [isInView, setIsInView] = useState(false);\n\n const handleIntersection: IntersectionObserverCallback = useCallback(\n entries => setIsInView(entries[0].isIntersecting),\n [setIsInView],\n );\n\n useEffect(() => {\n if (!window.IntersectionObserver) return;\n\n const observer = new IntersectionObserver(handleIntersection);\n ref.current && observer.observe(ref.current);\n\n return () => {\n ref.current && observer.unobserve(ref.current);\n };\n }, [handleIntersection, ref.current]);\n\n return [ref, isInView];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Announce a message on voice over whenever you do an action. This is\n * especially helpful when you have an action that adds or deletes an element\n * from the screen.\n */\nexport function useLiveAnnounce() {\n const [announcedMessage, setAnnouncedMessage] = useState(\"\");\n\n useEffect(() => {\n let target: HTMLElement;\n\n if (announcedMessage) {\n target = createAnnouncedElement();\n setTimeout(() => target.append(announcedMessage), 100);\n }\n\n return () => target?.remove();\n }, [announcedMessage]);\n\n return {\n liveAnnounce: (message: string) => {\n setAnnouncedMessage(message);\n },\n };\n}\n\n// eslint-disable-next-line max-statements\nfunction createAnnouncedElement() {\n const el = document.createElement(\"div\");\n\n el.style.position = \"absolute\";\n el.style.width = \"1px\";\n el.style.height = \"1px\";\n el.style.overflow = \"hidden\";\n el.style.clipPath = \" inset(100%)\";\n el.style.whiteSpace = \" nowrap\";\n el.style.top = \"0\";\n el.setAttribute(\"role\", \"status\");\n el.setAttribute(\"aria-atomic\", \"true\");\n el.setAttribute(\"aria-live\", \"assertive\");\n\n document.body.appendChild(el);\n\n return el;\n}\n","import { useEffect } from \"react\";\nimport { XOR } from \"ts-xor\";\n\ntype SimpleKeyComparator = KeyboardEvent[\"key\"];\n\ninterface VerboseKeyComparator {\n readonly key: SimpleKeyComparator;\n readonly shiftKey?: boolean;\n readonly ctrlKey?: boolean;\n readonly altKey?: boolean;\n readonly metaKey?: boolean;\n readonly [index: string]: boolean | string | undefined;\n}\n\ntype KeyComparator = XOR<VerboseKeyComparator, SimpleKeyComparator>;\n\nexport function useOnKeyDown(\n callback: (event: KeyboardEvent) => void,\n keys: KeyComparator[] | KeyComparator,\n) {\n useEffect(() => {\n window.addEventListener(\"keydown\", handler);\n\n return () => {\n window.removeEventListener(\"keydown\", handler);\n };\n }, [handler]);\n\n function handler(event: KeyboardEvent) {\n const keyboardEvent = event as unknown as VerboseKeyComparator;\n\n if (typeof keys === \"string\" && keyboardEvent.key === keys) {\n callback(event);\n\n return;\n }\n\n if (\n Array.isArray(keys) &&\n keys.some(item => {\n if (typeof item === \"string\") return keyboardEvent.key === item;\n\n return Object.keys(item).every(\n index => keyboardEvent[index] === item[index],\n );\n })\n ) {\n callback(event);\n\n return;\n }\n\n if (\n !Array.isArray(keys) &&\n typeof keys !== \"string\" &&\n Object.keys(keys).every(index => keyboardEvent[index] === keys[index])\n ) {\n callback(event);\n\n return;\n }\n }\n}\n","import { useMemo } from \"react\";\nimport calculateStrength from \"zxcvbn\";\n\nexport function usePasswordStrength(password: string, dictionary?: string[]) {\n const {\n guesses,\n score,\n feedback: { warning, suggestions },\n crack_times_display: { offline_fast_hashing_1e10_per_second: timeToCrack },\n } = useMemo(\n () => calculateStrength(password, dictionary),\n [password, dictionary],\n );\n\n return {\n guesses,\n score,\n warning,\n suggestions,\n timeToCrack,\n };\n}\n","import { useEffect } from \"react\";\n\n/**\n * Brings back the focus to the element that opened an overlaid element once\n * said overlaid element is dismissed.\n *\n * @param active - Determines if it should focus or not\n */\nexport function useRefocusOnActivator(active: boolean) {\n useEffect(() => {\n let activator: Element | null | undefined;\n\n if (active && !activator) {\n activator = document.activeElement;\n }\n\n return () => {\n if (active) {\n if (activator instanceof HTMLElement) {\n activator.focus();\n }\n activator = undefined;\n }\n };\n }, [active]);\n}\n","import { useMemo, useState } from \"react\";\n// Importing the polyfilled version of ResizeObserver\n// eslint-disable-next-line import/no-internal-modules\nimport useResizeObserverPackage from \"use-resize-observer/polyfilled\";\nimport { throttle } from \"lodash\";\n\nexport const Breakpoints = {\n base: 640,\n small: 500,\n smaller: 265,\n large: 750,\n larger: 1024,\n};\n\ninterface ObservedSize {\n width: number | undefined;\n height: number | undefined;\n}\n\ninterface ResizeObserverProps {\n widths?: object;\n heights?: object;\n}\n\nconst wait = 100;\n\nexport function useResizeObserver<T extends HTMLElement>({\n widths = Breakpoints,\n heights = Breakpoints,\n}: ResizeObserverProps = {}) {\n const [exactSize, setSize] = useState<ObservedSize>({\n width: undefined,\n height: undefined,\n });\n const onResize = useMemo(() => throttle(setSize, wait), [wait]);\n const { ref } = useResizeObserverPackage<T>({\n onResize,\n });\n\n const exactWidth = exactSize.width;\n const exactHeight = exactSize.height;\n\n const sizes = {\n width: getSize(widths, exactSize.width),\n height: getSize(heights, exactSize.height),\n exactWidth,\n exactHeight,\n };\n\n return [ref, sizes] as const;\n}\n\n/**\n * To get the proper size we want to make sure that our value is greater\n * then the comparable, but less then the next largest number in our\n * object.\n */\nfunction getSize(\n sizes: object,\n comparable: number | undefined,\n): number | undefined {\n if (!comparable || !sizes) {\n return undefined;\n }\n\n /**\n * Sort the values of our object so that we know they are in proper\n * order to be compared by\n */\n const sortedSizes = Object.values(sizes)\n .sort((a, b) => a - b)\n .reverse();\n\n return (\n sortedSizes.find(value => value <= comparable) ||\n sortedSizes[sortedSizes.length - 1]\n );\n}\n","export type Clearable = \"never\" | \"while-editing\" | \"always\";\n\ninterface UseShowClearParameters {\n clearable: Clearable;\n multiline: boolean;\n focused: boolean;\n hasValue: boolean;\n disabled?: boolean;\n}\n\nexport function useShowClear({\n clearable,\n multiline,\n focused,\n hasValue,\n disabled = false,\n}: UseShowClearParameters): boolean | undefined {\n if (multiline && clearable !== \"never\") {\n throw new Error(\"Multiline inputs can not be clearable\");\n }\n\n // Do not show if there is no value\n if (!hasValue || clearable === \"never\" || disabled) {\n return false;\n }\n\n switch (clearable) {\n case \"while-editing\":\n return focused;\n case \"always\":\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iCAAAA,UAAA;AAAA;AACA,WAAO,eAAeA,UAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,IAAAA,SAAQ,SAAS;AACjB,aAAS,YAAY;AACjB,UAAI,OAAO,WAAW,aAAa;AAC/B,eAAO;AAAA,MACX;AACA,aAAO;AAAA,IACX;AACA,QAAM,OAAO,UAAU;AACvB,IAAAA,SAAQ,SAAS;AAAA;AAAA;;;ACVjB;AAAA,iCAAAC,UAAA;AAAA;AACA,WAAO,eAAeA,UAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,IAAAA,SAAQ,SAAS;AACjB,QAAM,WAAW;AACjB,QAAM,mBAAmB,SAAS,OAAO,gBAAgB,CAAC,GAAG,UAAU,CAAC;AACxE,IAAAA,SAAQ,S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AAMA,QAAM,cAAc,OAAO,OAAO,KAAK,EACpC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,EACpB,QAAQ;AAEX,SACE,YAAY,KAAK,WAAS,SAAS,UAAU,KAC7C,YAAY,YAAY,SAAS,CAAC;AAEtC;;;ACnEO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAgD;AAC9C,MAAI,aAAa,cAAc,SAAS;AACtC,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AAGA,MAAI,CAAC,YAAY,cAAc,WAAW,UAAU;AAClD,WAAO;AAAA,EACT;AAEA,UAAQ,WAAW;AAAA,IACjB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;","names":["exports","exports","exports","exports","exports","process","import_react","import_react","import_react","import_react","_a","import_react","import_react","import_react","import_react","import_react","import_react","calculateStrength","import_react","import_react","import_lodash","useResizeObserverPackage"]}
1
+ {"version":3,"sources":["../../formatters/dist/global.js","../../formatters/dist/config.js","../../formatters/dist/currency.js","../../formatters/dist/CurrencyType.js","../../formatters/dist/index.js","../src/index.ts","../src/useAssert/useAssert.tsx","../src/useBool/useBool.ts","../src/useBreakpoints/useMediaQuery.ts","../src/useBreakpoints/useBreakpoints.ts","../src/useCollectionQuery/useCollectionQuery.ts","../src/useCollectionQuery/uniqueNodes.tsx","../src/useCollectionQuery/uniqueEdges.tsx","../src/useIsMounted/useIsMounted.ts","../src/useSafeLayoutEffect/useSafeLayoutEffect.ts","../src/useFocusTrap/useFocusTrap.ts","../src/useFormState/useFormState.ts","../src/useInView/useInView.ts","../src/useLiveAnnounce/useLiveAnnounce.tsx","../src/useOnKeyDown/useOnKeyDown.ts","../src/usePasswordStrength/usePasswordStrength.ts","../src/useRefocusOnActivator/useRefocusOnActivator.ts","../src/useResizeObserver/useResizeObserver.ts","../src/useShowClear/useShowClear.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.global = void 0;\nfunction getGlobal() {\n if (typeof window !== \"undefined\") {\n return window;\n }\n return global;\n}\nconst glob = getGlobal();\nexports.global = glob;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.config = void 0;\nconst global_1 = require(\"./global\");\nconst configOverrides = (global_1.global.ATLANTIS_ENV || {}).config || {};\nexports.config = Object.freeze(Object.assign({ defaultCurrency: \"USD\", errorNotifier(message, error) {\n console.error(message, error);\n } }, configOverrides));\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatCurrency = void 0;\nconst config_1 = require(\"./config\");\nfunction formatCurrency(amount, currency = config_1.config.defaultCurrency) {\n return amount.toLocaleString(\"en\", {\n style: \"currency\",\n currency: currency,\n });\n}\nexports.formatCurrency = formatCurrency;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./currency\"), exports);\n__exportStar(require(\"./CurrencyType\"), exports);\n__exportStar(require(\"./config\"), exports);\n","/* eslint-disable import/no-internal-modules */\nexport * from \"./useAssert/useAssert\";\nexport * from \"./useBool/useBool\";\nexport * from \"./useBreakpoints/useBreakpoints\";\nexport * from \"./useCollectionQuery/useCollectionQuery\";\nexport * from \"./useFocusTrap/useFocusTrap\";\nexport * from \"./useFormState/useFormState\";\nexport * from \"./useInView/useInView\";\nexport * from \"./useIsMounted/useIsMounted\";\nexport * from \"./useLiveAnnounce/useLiveAnnounce\";\nexport * from \"./useOnKeyDown/useOnKeyDown\";\nexport * from \"./usePasswordStrength/usePasswordStrength\";\nexport * from \"./useRefocusOnActivator/useRefocusOnActivator\";\nexport * from \"./useResizeObserver/useResizeObserver\";\nexport * from \"./useSafeLayoutEffect/useSafeLayoutEffect\";\nexport * from \"./useShowClear/useShowClear\";\n","import process from \"process\";\n\ninterface Options {\n readonly warn: boolean;\n}\n\nexport function useAssert(\n shouldShow: boolean,\n message: string,\n options?: Options,\n) {\n if (process?.env?.NODE_ENV !== \"production\" && shouldShow) {\n if (options?.warn) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n }\n}\n","import { useCallback, useState } from \"react\";\n\ndeclare const brand: unique symbol;\n\ntype Callback = () => void;\n\nexport type SetTrue = Callback & {\n [brand]: \"SetTrue\";\n};\n\nexport type SetFalse = Callback & {\n [brand]: \"SetFalse\";\n};\n\nexport type Toggle = Callback & {\n [brand]: \"Toggle\";\n};\n\nexport function useBool(\n initialState = false,\n): [boolean, SetTrue, SetFalse, Toggle] {\n const [state, setState] = useState(initialState);\n const setTrue = useCallback(() => setState(true), []);\n const setFalse = useCallback(() => setState(false), []);\n const toggle = useCallback(() => setState(current => !current), []);\n\n return [state, setTrue as SetTrue, setFalse as SetFalse, toggle as Toggle];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Sets the JS media query listener. Internal use only.\n */\nexport function useMediaQuery(CSSMediaQuery: string) {\n const [matches, setMatches] = useState(\n window.matchMedia(CSSMediaQuery).matches,\n );\n\n useEffect(() => {\n const media = window.matchMedia(CSSMediaQuery);\n\n if (media.matches !== matches) {\n setMatches(media.matches);\n }\n\n const listener = () => setMatches(media.matches);\n media.addEventListener(\"change\", listener);\n\n return () => media.removeEventListener(\"change\", listener);\n }, [CSSMediaQuery]);\n\n return matches;\n}\n","import { useMediaQuery } from \"./useMediaQuery\";\n\nexport const BREAKPOINT_SIZES = { sm: 490, md: 768, lg: 1080, xl: 1440 };\n\n/**\n * Hook equivalent of CSS media queries with our\n * [supported breakpoints](https://atlantis.getjobber.com/?path=/docs/design-breakpoints--page).\n */\nexport function useBreakpoints() {\n const { sm, md, lg, xl } = BREAKPOINT_SIZES;\n const extraSmallOnly = useMediaQuery(`(max-width: ${sm - 1}px)`);\n const smallAndUp = useMediaQuery(`(min-width: ${sm}px)`);\n const mediumAndUp = useMediaQuery(`(min-width: ${md}px)`);\n const largeAndUp = useMediaQuery(`(min-width: ${lg}px)`);\n const extraLargeAndUp = useMediaQuery(`(min-width: ${xl}px)`);\n\n return {\n smallAndUp,\n mediumAndUp,\n largeAndUp,\n extraLargeAndUp,\n extraSmallOnly,\n smallOnly: smallAndUp && !mediumAndUp,\n mediumOnly: mediumAndUp && !largeAndUp,\n largeOnly: largeAndUp && !extraLargeAndUp,\n };\n}\n","import {\n ApolloError,\n DocumentNode,\n QueryHookOptions,\n SubscribeToMoreOptions,\n useQuery,\n} from \"@apollo/client\";\nimport { cloneDeep } from \"lodash\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { config } from \"@jobber/formatters\";\nimport { Node, uniqueNodes } from \"./uniqueNodes\";\nimport { Edge, createEdge, uniqueEdges } from \"./uniqueEdges\";\nimport { useIsMounted } from \"../useIsMounted\";\n\ninterface UseCollectionQueryArguments<TQuery, TSubscription> {\n /**\n * The graphQL query that fetches the collection\n */\n query: DocumentNode;\n\n /**\n * A list of options for us to pass into the apollo `useQuery` hook\n */\n queryOptions?: QueryHookOptions<TQuery>;\n\n /**\n * A function that returns the location where the {@link Collection} is located.\n *\n * The collection is the part of the result that needs to be paginated.\n */\n getCollectionByPath: GetCollectionByPathFunction<TQuery>;\n\n /**\n * A list of subscription options if you want to create a GraphQL\n * subscription to listen for more content.\n */\n subscription?: ListSubscription<TSubscription>;\n}\n\ninterface ListSubscription<TSubscription> {\n /**\n * The graphQL subscription that listens for more data. This query should\n * return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n document: DocumentNode;\n\n /**\n * A list of variables to pass into the apollo `subscribeToMore` function.\n */\n options?: Pick<SubscribeToMoreOptions<TSubscription>, \"variables\">;\n\n /**\n * A function that returns the location where the `Node` is located on the\n * `TSubscription` object.\n *\n * It should return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n getNodeByPath: GetNodeByPath<TSubscription>;\n}\n\ninterface Collection {\n edges?: Edge[];\n nodes?: Node[];\n pageInfo: {\n endCursor?: string | undefined;\n hasNextPage: boolean;\n [otherProperties: string]: unknown;\n };\n totalCount?: number;\n [otherProperties: string]: unknown;\n}\n\ninterface CollectionQueryResult<TQuery> {\n data: TQuery | undefined;\n error: ApolloError | undefined;\n loadingRefresh: boolean;\n loadingNextPage: boolean;\n loadingInitialContent: boolean;\n refresh(): void;\n nextPage(): void;\n}\n\ntype GetCollectionByPathFunction<TQuery> = (\n data: TQuery | undefined,\n) => Collection | undefined;\n\ntype GetNodeByPath<TSubscription> = (\n data: TSubscription | undefined,\n) => Node | undefined;\n\nexport function useCollectionQuery<TQuery, TSubscription = undefined>({\n query,\n queryOptions,\n getCollectionByPath,\n subscription,\n}: UseCollectionQueryArguments<\n TQuery,\n TSubscription\n>): CollectionQueryResult<TQuery> {\n const { data, loading, refetch, error, fetchMore, subscribeToMore } =\n useQuery<TQuery>(query, queryOptions);\n\n const isMounted = useIsMounted();\n const [loadingRefresh, setLoadingRefresh] = useState<boolean>(false);\n const [loadingNextPage, setLoadingNextPage] = useState<boolean>(false);\n const [hookError, setHookError] = useState<ApolloError | undefined>();\n const loadingInitialContent = loading && !loadingRefresh && !loadingNextPage;\n const isSearching = !!queryOptions?.variables?.searchTerm;\n\n const refresh = useCallback(() => {\n if (loadingInitialContent || loadingRefresh) {\n return;\n }\n\n setLoadingRefresh(true);\n\n fetchMore({\n // a workaround fix for the error described in this post\n // https://github.com/apollographql/apollo-client/issues/7491#issuecomment-767985363\n // These changes can be reverted once we can update to version 3.4\n // (the current release candidate)\n variables: {},\n updateQuery: (prev, { fetchMoreResult }) => fetchMoreResult || prev,\n })\n .catch(err => config.errorNotifier(\"Refetch Error\", err))\n .finally(() => {\n if (isMounted.current) {\n setLoadingRefresh(false);\n }\n });\n }, [\n loadingInitialContent,\n loadingRefresh,\n setLoadingRefresh,\n refetch,\n isMounted,\n ]);\n\n const nextPage = useCallback(() => {\n if (loadingInitialContent || loadingRefresh || loadingNextPage) {\n return;\n }\n\n const pageInfo = getCollectionByPath(data)?.pageInfo;\n\n if (!pageInfo || !pageInfo.hasNextPage) {\n return;\n }\n\n setLoadingNextPage(true);\n setHookError(undefined);\n\n fetchMore({\n variables: {\n cursor: pageInfo.endCursor,\n },\n updateQuery: (prev, { fetchMoreResult }) =>\n fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath),\n })\n .catch(err => {\n config.errorNotifier(\"FetchMore Error\", err);\n setHookError(err);\n })\n .finally(() => {\n if (isMounted.current) {\n setLoadingNextPage(false);\n }\n });\n }, [\n data,\n loadingInitialContent,\n loadingRefresh,\n fetchMore,\n loadingNextPage,\n setLoadingNextPage,\n getCollectionByPath,\n isMounted,\n ]);\n\n useEffect(\n () => {\n if (subscription == undefined) return;\n\n const subscriptionOptions = subscription.options || {};\n\n // Reset this state so we can handle errors from the subscription\n setHookError(undefined);\n\n return subscribeToMore<TSubscription>({\n ...subscriptionOptions,\n document: subscription.document,\n updateQuery: (prev, { subscriptionData }) =>\n subscribeToMoreHandler(\n isSearching,\n prev,\n getCollectionByPath,\n subscriptionData?.data,\n subscription.getNodeByPath,\n ),\n onError: err => {\n config.errorNotifier(\"Subscribe to More Error\", err);\n setHookError(err as ApolloError);\n },\n });\n },\n // Disabling this linter so we can force this only run once. If we didn't\n // do this we would need to ensure subscription, subscribeToMore, and getNodeByPath\n // all use useCallback.\n [queryOptions?.variables?.searchTerm],\n );\n\n const combinedError = error || hookError;\n\n return {\n data,\n error: combinedError,\n refresh,\n loadingRefresh,\n nextPage,\n loadingNextPage,\n loadingInitialContent,\n };\n}\n\n/**\n * The following method uses an `output` variable, and indirectly modifies it through the `outputCollection` variable.\n * This type of indirect modification is prone to bugs, but I couldn't think of a better way to write this code.\n *\n * Here's what I was balancing:\n * 1. We need to copy the structure of prev to ensure that when we're combining two objects, we're not losing properties\n * 2. We need to extract a key from an unknown path that's given to us by getCollectionByPath and then we need to modify\n * that, and ensure that it's properly set on the cloned output object.\n * 3. We want to keep the interface to this hook as simple and easy to use as possible\n *\n * The alternative approaches that were rejected:\n * 1. We replace the getCollectionByPath with a keyPath string. (Eg. \"data.conversation.message\") and then we use lodash\n * `get` and `set` which should remove all the object manipulation. But, this approach loses us the type safety that\n * getCollectionByPath gives us\n * 2. We could add a setCollection function to the list of arguments for this hook. This leaves us with type safety but\n * makes the `useCollectionQuery` interface more complicated by adding arguments\n */\nfunction fetchMoreUpdateQueryHandler<TQuery>(\n prev: TQuery,\n fetchMoreResult: TQuery | undefined,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n): TQuery {\n const nextCollection = getCollectionByPath(fetchMoreResult);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection === undefined || nextCollection === undefined) {\n return output;\n }\n\n if (outputCollection.nodes && nextCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n nextCollection.nodes,\n );\n }\n\n if (outputCollection.edges && nextCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n nextCollection.edges,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(nextCollection.pageInfo),\n ...getTotalCount(nextCollection.totalCount),\n });\n\n return output;\n}\n\nfunction subscribeToMoreHandler<TQuery, TSubscription>(\n isSearching: boolean,\n prev: TQuery,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n subscriptionData: TSubscription | undefined,\n getNodeByPath: GetNodeByPath<TSubscription>,\n): TQuery {\n const node = getNodeByPath(subscriptionData);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection == undefined || node == undefined) return output;\n\n if (isAlreadyUpdated(outputCollection, node) || isSearching) {\n return prev;\n }\n\n if (outputCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n [node],\n false,\n );\n }\n\n if (outputCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n [createEdge(node)],\n false,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(outputCollection.pageInfo),\n ...getTotalCount(outputCollection.totalCount, 1),\n });\n\n return output;\n}\n\ninterface TotalCountReturn {\n totalCount?: number;\n}\n\nfunction getTotalCount(\n totalCount: number | undefined,\n additionalCount = 0,\n): TotalCountReturn {\n return totalCount !== undefined\n ? { totalCount: totalCount + additionalCount }\n : {};\n}\n\nexport function isAlreadyUpdated(outputCollection: Collection, newNode: Node) {\n let edgesAlreadyUpdated = true;\n let nodesAlreadyUpdated = true;\n\n if (outputCollection.edges) {\n edgesAlreadyUpdated = outputCollection.edges.some(edge => {\n return edge.node.id === newNode.id;\n });\n }\n\n if (outputCollection.nodes) {\n nodesAlreadyUpdated = outputCollection.nodes.some(node => {\n return node.id === newNode.id;\n });\n }\n\n return edgesAlreadyUpdated && nodesAlreadyUpdated;\n}\n\nfunction getUpdatedEdges(\n prevEdges: Edge[],\n nextEdges: Edge[],\n appendToEnd = true,\n) {\n const newEdges = appendToEnd\n ? [...prevEdges, ...nextEdges]\n : [...nextEdges, ...prevEdges];\n\n return uniqueEdges(newEdges);\n}\n\nfunction getUpdatedNodes(\n prevNodes: Node[],\n nextNodes: Node[],\n appendToEnd = true,\n) {\n const newNodes = appendToEnd\n ? [...prevNodes, ...nextNodes]\n : [...nextNodes, ...prevNodes];\n\n return uniqueNodes(newNodes);\n}\n","export interface Node {\n id: unknown;\n __typename?: unknown;\n}\n\nexport function uniqueNodes(nodes: Node[]): Node[] {\n const result = new Map<string, Node>();\n nodes.forEach(node => {\n result.set(`${node.__typename}-${node.id}`, node);\n });\n\n return Array.from(result.values());\n}\n","import { Node } from \"./uniqueNodes\";\n\nexport interface Edge {\n __typename?: unknown;\n node: Node;\n cursor: string;\n}\n\nexport function createEdge(node: Node): Edge {\n return {\n node: node,\n cursor: \"\",\n __typename: `${node.__typename}Edge`,\n };\n}\n\nexport function uniqueEdges(edges: Edge[]): Edge[] {\n const result = new Map<string, Edge>();\n edges.forEach(edge => {\n result.set(\n `${edge.__typename}-${edge.node.__typename}-${edge.node.id}`,\n edge,\n );\n });\n\n return Array.from(result.values());\n}\n","import { useRef } from \"react\";\nimport { useSafeLayoutEffect } from \"../useSafeLayoutEffect\";\n\n/**\n * Why does this work?\n *\n * The following is from the react docs:\n * [The return function from `useLayoutEffect`] is the optional cleanup mechanism for effects.\n * Every effect may return a function that cleans up after it.\n *\n * When exactly does React clean up an effect? React performs the cleanup when the component unmounts.\n * The cleanup for useLayoutEffect is called after component unmounts and before before browser painting\n * the screen\n *\n * What does that mean for us? When this hook is initially loaded, we then trigger a `useLayoutEffect` that\n * sets the isMounted to true right after the component is mounted.\n * When the component unmounts, it calls the cleanup function that sets `isMounted` to false.\n * This `useLayoutEffect` hook will only be run once.\n */\nexport function useIsMounted(): { current: boolean } {\n const isMounted = useRef(false);\n\n useSafeLayoutEffect(() => {\n isMounted.current = true;\n\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n return isMounted;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useSafeLayoutEffect = globalThis?.document\n ? useLayoutEffect\n : useEffect;\n","import { useEffect, useRef } from \"react\";\n\n/**\n * Traps the focus within the children of the ref element.\n *\n * @param active - Turns the focus trapping on or off. Also adds aria-hidden on the\n * body but not the dialog.\n *\n * @returns ref\n */\nexport function useFocusTrap<T extends HTMLElement>(active: boolean) {\n // There's an ongoing issue with useRef return type clashing with an element's\n // ref prop type. TLDR: Use null because useRef doesn't expect undefined.\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572\n const ref = useRef<T>(null);\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!(active && ref.current) || event.key !== \"Tab\") {\n return;\n }\n\n const { firstElement, lastElement } = getElements(ref.current);\n\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n lastElement.focus();\n event.preventDefault();\n }\n } else {\n if (document.activeElement === lastElement) {\n firstElement.focus();\n event.preventDefault();\n }\n }\n }\n\n useEffect(() => {\n if (active && ref.current) {\n const { firstElement } = getElements(ref.current);\n firstElement.focus();\n ref.current.addEventListener(\"keydown\", handleKeyDown);\n }\n\n return () => {\n ref.current?.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [active]);\n\n return ref;\n}\n\nfunction getElements<T extends HTMLElement>(ref: T) {\n const focusables = [\n \"button\",\n \"[href]\",\n \"input\",\n \"select\",\n \"textarea\",\n '[tabindex]:not([tabindex=\"-1\"])',\n ];\n const elements = [\n ...ref.querySelectorAll<HTMLElement>(focusables.join(\", \")),\n ];\n\n // If the ref is focusable, ensure it's the first element to be focused.\n if (ref.getAttribute(\"tabindex\") === \"0\") {\n elements.unshift(ref);\n }\n\n const firstElement = elements[0];\n const lastElement = elements[elements.length - 1];\n\n return { firstElement, lastElement };\n}\n","import { useState } from \"react\";\n\nexport function useFormState() {\n const [formState, setFormState] = useState({\n isDirty: false,\n isValid: false,\n });\n\n return [formState, setFormState] as const;\n}\n","import { RefObject, useCallback, useEffect, useRef, useState } from \"react\";\n\nexport function useInView<T extends Element>(): [RefObject<T>, boolean] {\n const ref = useRef<T>(null);\n const [isInView, setIsInView] = useState(false);\n\n const handleIntersection: IntersectionObserverCallback = useCallback(\n entries => setIsInView(entries[0].isIntersecting),\n [setIsInView],\n );\n\n useEffect(() => {\n if (!window.IntersectionObserver) return;\n\n const observer = new IntersectionObserver(handleIntersection);\n ref.current && observer.observe(ref.current);\n\n return () => {\n ref.current && observer.unobserve(ref.current);\n };\n }, [handleIntersection, ref.current]);\n\n return [ref, isInView];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Announce a message on voice over whenever you do an action. This is\n * especially helpful when you have an action that adds or deletes an element\n * from the screen.\n */\nexport function useLiveAnnounce() {\n const [announcedMessage, setAnnouncedMessage] = useState(\"\");\n\n useEffect(() => {\n let target: HTMLElement;\n\n if (announcedMessage) {\n target = createAnnouncedElement();\n setTimeout(() => target.append(announcedMessage), 100);\n }\n\n return () => target?.remove();\n }, [announcedMessage]);\n\n return {\n liveAnnounce: (message: string) => {\n setAnnouncedMessage(message);\n },\n };\n}\n\n// eslint-disable-next-line max-statements\nfunction createAnnouncedElement() {\n const el = document.createElement(\"div\");\n\n el.style.position = \"absolute\";\n el.style.width = \"1px\";\n el.style.height = \"1px\";\n el.style.overflow = \"hidden\";\n el.style.clipPath = \" inset(100%)\";\n el.style.whiteSpace = \" nowrap\";\n el.style.top = \"0\";\n el.setAttribute(\"role\", \"status\");\n el.setAttribute(\"aria-atomic\", \"true\");\n el.setAttribute(\"aria-live\", \"assertive\");\n\n document.body.appendChild(el);\n\n return el;\n}\n","import { useEffect } from \"react\";\nimport { XOR } from \"ts-xor\";\n\ntype SimpleKeyComparator = KeyboardEvent[\"key\"];\n\ninterface VerboseKeyComparator {\n readonly key: SimpleKeyComparator;\n readonly shiftKey?: boolean;\n readonly ctrlKey?: boolean;\n readonly altKey?: boolean;\n readonly metaKey?: boolean;\n readonly [index: string]: boolean | string | undefined;\n}\n\ntype KeyComparator = XOR<VerboseKeyComparator, SimpleKeyComparator>;\n\nexport function useOnKeyDown(\n callback: (event: KeyboardEvent) => void,\n keys: KeyComparator[] | KeyComparator,\n) {\n useEffect(() => {\n window.addEventListener(\"keydown\", handler);\n\n return () => {\n window.removeEventListener(\"keydown\", handler);\n };\n }, [handler]);\n\n function handler(event: KeyboardEvent) {\n const keyboardEvent = event as unknown as VerboseKeyComparator;\n\n if (typeof keys === \"string\" && keyboardEvent.key === keys) {\n callback(event);\n\n return;\n }\n\n if (\n Array.isArray(keys) &&\n keys.some(item => {\n if (typeof item === \"string\") return keyboardEvent.key === item;\n\n return Object.keys(item).every(\n index => keyboardEvent[index] === item[index],\n );\n })\n ) {\n callback(event);\n\n return;\n }\n\n if (\n !Array.isArray(keys) &&\n typeof keys !== \"string\" &&\n Object.keys(keys).every(index => keyboardEvent[index] === keys[index])\n ) {\n callback(event);\n\n return;\n }\n }\n}\n","import { useMemo } from \"react\";\nimport calculateStrength from \"zxcvbn\";\n\nexport function usePasswordStrength(password: string, dictionary?: string[]) {\n const {\n guesses,\n score,\n feedback: { warning, suggestions },\n crack_times_display: { offline_fast_hashing_1e10_per_second: timeToCrack },\n } = useMemo(\n () => calculateStrength(password, dictionary),\n [password, dictionary],\n );\n\n return {\n guesses,\n score,\n warning,\n suggestions,\n timeToCrack,\n };\n}\n","import { useEffect } from \"react\";\n\n/**\n * Brings back the focus to the element that opened an overlaid element once\n * said overlaid element is dismissed.\n *\n * @param active - Determines if it should focus or not\n */\nexport function useRefocusOnActivator(active: boolean) {\n useEffect(() => {\n let activator: Element | null | undefined;\n\n if (active && !activator) {\n activator = document.activeElement;\n }\n\n return () => {\n if (active) {\n if (activator instanceof HTMLElement) {\n activator.focus();\n }\n activator = undefined;\n }\n };\n }, [active]);\n}\n","import { useMemo, useState } from \"react\";\n// Importing the polyfilled version of ResizeObserver\n// eslint-disable-next-line import/no-internal-modules\nimport useResizeObserverPackage from \"use-resize-observer/polyfilled\";\nimport { throttle } from \"lodash\";\n\nexport const Breakpoints = {\n base: 640,\n small: 500,\n smaller: 265,\n large: 750,\n larger: 1024,\n};\n\ninterface ObservedSize {\n width: number | undefined;\n height: number | undefined;\n}\n\ninterface ResizeObserverProps {\n widths?: object;\n heights?: object;\n}\n\nconst wait = 100;\n\nexport function useResizeObserver<T extends HTMLElement>({\n widths = Breakpoints,\n heights = Breakpoints,\n}: ResizeObserverProps = {}) {\n const [exactSize, setSize] = useState<ObservedSize>({\n width: undefined,\n height: undefined,\n });\n const onResize = useMemo(() => throttle(setSize, wait), [wait]);\n const { ref } = useResizeObserverPackage<T>({\n onResize,\n });\n\n const exactWidth = exactSize.width;\n const exactHeight = exactSize.height;\n\n const sizes = {\n width: getSize(widths, exactSize.width),\n height: getSize(heights, exactSize.height),\n exactWidth,\n exactHeight,\n };\n\n return [ref, sizes] as const;\n}\n\n/**\n * To get the proper size we want to make sure that our value is greater\n * then the comparable, but less then the next largest number in our\n * object.\n */\nfunction getSize(\n sizes: object,\n comparable: number | undefined,\n): number | undefined {\n if (!comparable || !sizes) {\n return undefined;\n }\n\n /**\n * Sort the values of our object so that we know they are in proper\n * order to be compared by\n */\n const sortedSizes = Object.values(sizes)\n .sort((a, b) => a - b)\n .reverse();\n\n return (\n sortedSizes.find(value => value <= comparable) ||\n sortedSizes[sortedSizes.length - 1]\n );\n}\n","export type Clearable = \"never\" | \"while-editing\" | \"always\";\n\ninterface UseShowClearParameters {\n clearable: Clearable;\n multiline: boolean;\n focused: boolean;\n hasValue: boolean;\n disabled?: boolean;\n}\n\nexport function useShowClear({\n clearable,\n multiline,\n focused,\n hasValue,\n disabled = false,\n}: UseShowClearParameters): boolean | undefined {\n if (multiline && clearable !== \"never\") {\n throw new Error(\"Multiline inputs can not be clearable\");\n }\n\n // Do not show if there is no value\n if (!hasValue || clearable === \"never\" || disabled) {\n return false;\n }\n\n switch (clearable) {\n case \"while-editing\":\n return focused;\n case \"always\":\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,iCAAAA,UAAA;AAAA;AACA,WAAO,eAAeA,UAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,IAAAA,SAAQ,SAAS;AACjB,aAAS,YAAY;AACjB,UAAI,OAAO,WAAW,aAAa;AAC/B,eAAO;AAAA,MACX;AACA,aAAO;AAAA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CAAC,KAAK,KAAK;AACpB;AAOA,SAAS,QACP,OACA,YACoB;AACpB,MAAI,CAAC,cAAc,CAAC,OAAO;AACzB,WAAO;AAAA,EACT;AAMA,QAAM,cAAc,OAAO,OAAO,KAAK,EACpC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,EACpB,QAAQ;AAEX,SACE,YAAY,KAAK,WAAS,SAAS,UAAU,KAC7C,YAAY,YAAY,SAAS,CAAC;AAEtC;;;ACnEO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAgD;AAC9C,MAAI,aAAa,cAAc,SAAS;AACtC,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AAGA,MAAI,CAAC,YAAY,cAAc,WAAW,UAAU;AAClD,WAAO;AAAA,EACT;AAEA,UAAQ,WAAW;AAAA,IACjB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;","names":["exports","exports","exports","exports","exports","process","import_react","import_react","import_react","import_react","_a","import_react","import_react","import_react","import_react","import_react","import_react","calculateStrength","import_react","import_react","import_lodash","useResizeObserverPackage"]}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export * from "./useAssert";
2
- export * from "./useBool";
3
- export * from "./useBreakpoints";
4
- export * from "./useCollectionQuery";
5
- export * from "./useFocusTrap";
6
- export * from "./useFormState";
7
- export * from "./useInView";
8
- export * from "./useIsMounted";
9
- export * from "./useLiveAnnounce";
10
- export * from "./useOnKeyDown";
11
- export * from "./usePasswordStrength";
12
- export * from "./useRefocusOnActivator";
13
- export * from "./useResizeObserver";
14
- export * from "./useSafeLayoutEffect";
15
- export * from "./useShowClear";
1
+ export * from "./useAssert/useAssert";
2
+ export * from "./useBool/useBool";
3
+ export * from "./useBreakpoints/useBreakpoints";
4
+ export * from "./useCollectionQuery/useCollectionQuery";
5
+ export * from "./useFocusTrap/useFocusTrap";
6
+ export * from "./useFormState/useFormState";
7
+ export * from "./useInView/useInView";
8
+ export * from "./useIsMounted/useIsMounted";
9
+ export * from "./useLiveAnnounce/useLiveAnnounce";
10
+ export * from "./useOnKeyDown/useOnKeyDown";
11
+ export * from "./usePasswordStrength/usePasswordStrength";
12
+ export * from "./useRefocusOnActivator/useRefocusOnActivator";
13
+ export * from "./useResizeObserver/useResizeObserver";
14
+ export * from "./useSafeLayoutEffect/useSafeLayoutEffect";
15
+ export * from "./useShowClear/useShowClear";
package/dist/index.js CHANGED
@@ -1,15 +1,16 @@
1
- export * from "./useAssert";
2
- export * from "./useBool";
3
- export * from "./useBreakpoints";
4
- export * from "./useCollectionQuery";
5
- export * from "./useFocusTrap";
6
- export * from "./useFormState";
7
- export * from "./useInView";
8
- export * from "./useIsMounted";
9
- export * from "./useLiveAnnounce";
10
- export * from "./useOnKeyDown";
11
- export * from "./usePasswordStrength";
12
- export * from "./useRefocusOnActivator";
13
- export * from "./useResizeObserver";
14
- export * from "./useSafeLayoutEffect";
15
- export * from "./useShowClear";
1
+ /* eslint-disable import/no-internal-modules */
2
+ export * from "./useAssert/useAssert";
3
+ export * from "./useBool/useBool";
4
+ export * from "./useBreakpoints/useBreakpoints";
5
+ export * from "./useCollectionQuery/useCollectionQuery";
6
+ export * from "./useFocusTrap/useFocusTrap";
7
+ export * from "./useFormState/useFormState";
8
+ export * from "./useInView/useInView";
9
+ export * from "./useIsMounted/useIsMounted";
10
+ export * from "./useLiveAnnounce/useLiveAnnounce";
11
+ export * from "./useOnKeyDown/useOnKeyDown";
12
+ export * from "./usePasswordStrength/usePasswordStrength";
13
+ export * from "./useRefocusOnActivator/useRefocusOnActivator";
14
+ export * from "./useResizeObserver/useResizeObserver";
15
+ export * from "./useSafeLayoutEffect/useSafeLayoutEffect";
16
+ export * from "./useShowClear/useShowClear";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../formatters/dist/global.js","../../formatters/dist/config.js","../../formatters/dist/currency.js","../../formatters/dist/CurrencyType.js","../../formatters/dist/index.js","../src/useAssert/useAssert.tsx","../src/useBool/useBool.ts","../src/useBreakpoints/useMediaQuery.ts","../src/useBreakpoints/useBreakpoints.ts","../src/useBreakpoints/mockViewportWidth/mockViewportWidth.ts","../src/useCollectionQuery/useCollectionQuery.ts","../src/useCollectionQuery/uniqueNodes.tsx","../src/useCollectionQuery/uniqueEdges.tsx","../src/useIsMounted/useIsMounted.ts","../src/useSafeLayoutEffect/useSafeLayoutEffect.ts","../src/useFocusTrap/useFocusTrap.ts","../src/useFormState/useFormState.ts","../src/useInView/useInView.ts","../src/useLiveAnnounce/useLiveAnnounce.tsx","../src/useOnKeyDown/useOnKeyDown.ts","../src/usePasswordStrength/usePasswordStrength.ts","../src/useRefocusOnActivator/useRefocusOnActivator.ts","../src/useResizeObserver/useResizeObserver.ts","../src/useShowClear/useShowClear.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.global = void 0;\nfunction getGlobal() {\n if (typeof window !== \"undefined\") {\n return window;\n }\n return global;\n}\nconst glob = getGlobal();\nexports.global = glob;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.config = void 0;\nconst global_1 = require(\"./global\");\nconst configOverrides = (global_1.global.ATLANTIS_ENV || {}).config || {};\nexports.config = Object.freeze(Object.assign({ defaultCurrency: \"USD\", errorNotifier(message, error) {\n console.error(message, error);\n } }, configOverrides));\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatCurrency = void 0;\nconst config_1 = require(\"./config\");\nfunction formatCurrency(amount, currency = config_1.config.defaultCurrency) {\n return amount.toLocaleString(\"en\", {\n style: \"currency\",\n currency: currency,\n });\n}\nexports.formatCurrency = formatCurrency;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./currency\"), exports);\n__exportStar(require(\"./CurrencyType\"), exports);\n__exportStar(require(\"./config\"), exports);\n","import process from \"process\";\n\ninterface Options {\n readonly warn: boolean;\n}\n\nexport function useAssert(\n shouldShow: boolean,\n message: string,\n options?: Options,\n) {\n if (process?.env?.NODE_ENV !== \"production\" && shouldShow) {\n if (options?.warn) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n }\n}\n","import { useCallback, useState } from \"react\";\n\ndeclare const brand: unique symbol;\n\ntype Callback = () => void;\n\nexport type SetTrue = Callback & {\n [brand]: \"SetTrue\";\n};\n\nexport type SetFalse = Callback & {\n [brand]: \"SetFalse\";\n};\n\nexport type Toggle = Callback & {\n [brand]: \"Toggle\";\n};\n\nexport function useBool(\n initialState = false,\n): [boolean, SetTrue, SetFalse, Toggle] {\n const [state, setState] = useState(initialState);\n const setTrue = useCallback(() => setState(true), []);\n const setFalse = useCallback(() => setState(false), []);\n const toggle = useCallback(() => setState(current => !current), []);\n\n return [state, setTrue as SetTrue, setFalse as SetFalse, toggle as Toggle];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Sets the JS media query listener. Internal use only.\n */\nexport function useMediaQuery(CSSMediaQuery: string) {\n const [matches, setMatches] = useState(\n window.matchMedia(CSSMediaQuery).matches,\n );\n\n useEffect(() => {\n const media = window.matchMedia(CSSMediaQuery);\n\n if (media.matches !== matches) {\n setMatches(media.matches);\n }\n\n const listener = () => setMatches(media.matches);\n media.addEventListener(\"change\", listener);\n\n return () => media.removeEventListener(\"change\", listener);\n }, [CSSMediaQuery]);\n\n return matches;\n}\n","import { useMediaQuery } from \"./useMediaQuery\";\n\nexport const BREAKPOINT_SIZES = { sm: 490, md: 768, lg: 1080, xl: 1440 };\n\n/**\n * Hook equivalent of CSS media queries with our\n * [supported breakpoints](https://atlantis.getjobber.com/?path=/docs/design-breakpoints--page).\n */\nexport function useBreakpoints() {\n const { sm, md, lg, xl } = BREAKPOINT_SIZES;\n const extraSmallOnly = useMediaQuery(`(max-width: ${sm - 1}px)`);\n const smallAndUp = useMediaQuery(`(min-width: ${sm}px)`);\n const mediumAndUp = useMediaQuery(`(min-width: ${md}px)`);\n const largeAndUp = useMediaQuery(`(min-width: ${lg}px)`);\n const extraLargeAndUp = useMediaQuery(`(min-width: ${xl}px)`);\n\n return {\n smallAndUp,\n mediumAndUp,\n largeAndUp,\n extraLargeAndUp,\n extraSmallOnly,\n smallOnly: smallAndUp && !mediumAndUp,\n mediumOnly: mediumAndUp && !largeAndUp,\n largeOnly: largeAndUp && !extraLargeAndUp,\n };\n}\n","const defaultMatchMedia = window.matchMedia;\nconst defaultResizeTo = window.resizeTo;\nconst defaultInnerWidth = window.innerWidth;\n\nexport function mockViewportWidth() {\n return { cleanup, setViewportWidth };\n}\n\nfunction setViewportWidth(newWidth: number) {\n Object.defineProperty(window, \"matchMedia\", {\n writable: true,\n value: jest.fn().mockImplementation((query: string) => {\n const matches = isQueryMatching(query);\n const instance = {\n matches: matches,\n media: query,\n onchange: null,\n addListener: jest.fn(), // Deprecated but some packages use it\n removeListener: jest.fn(), // Deprecated but some packages use it\n addEventListener: jest.fn(),\n removeEventListener: jest.fn(),\n dispatchEvent: jest.fn(),\n };\n\n window.addEventListener(\"resize\", () => {\n if (matches != instance.matches) {\n instance.matches = matches;\n instance.dispatchEvent(\"change\");\n }\n });\n\n return instance;\n }),\n });\n\n Object.defineProperty(window, \"resizeTo\", {\n value: (width: number) => {\n Object.defineProperty(window, \"innerWidth\", {\n configurable: true,\n writable: true,\n value: width,\n });\n window.dispatchEvent(new Event(\"resize\"));\n },\n });\n\n window.resizeTo(newWidth, window.innerHeight);\n}\n\nfunction cleanup() {\n window.matchMedia = defaultMatchMedia;\n window.resizeTo = defaultResizeTo;\n window.innerWidth = defaultInnerWidth;\n}\n\nexport function isQueryMatching(query: string) {\n const match = query.match(/(min-width|max-width):\\s*(\\d+)/);\n if (!match) return false;\n\n const { innerWidth } = window;\n const [, operator, value] = match;\n const breakpoint = parseInt(value, 10);\n\n switch (operator) {\n case \"max-width\":\n return innerWidth <= breakpoint;\n case \"min-width\":\n return innerWidth >= breakpoint;\n }\n}\n","import {\n ApolloError,\n DocumentNode,\n QueryHookOptions,\n SubscribeToMoreOptions,\n useQuery,\n} from \"@apollo/client\";\nimport { cloneDeep } from \"lodash\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { config } from \"@jobber/formatters\";\nimport { Node, uniqueNodes } from \"./uniqueNodes\";\nimport { Edge, createEdge, uniqueEdges } from \"./uniqueEdges\";\nimport { useIsMounted } from \"../useIsMounted\";\n\ninterface UseCollectionQueryArguments<TQuery, TSubscription> {\n /**\n * The graphQL query that fetches the collection\n */\n query: DocumentNode;\n\n /**\n * A list of options for us to pass into the apollo `useQuery` hook\n */\n queryOptions?: QueryHookOptions<TQuery>;\n\n /**\n * A function that returns the location where the {@link Collection} is located.\n *\n * The collection is the part of the result that needs to be paginated.\n */\n getCollectionByPath: GetCollectionByPathFunction<TQuery>;\n\n /**\n * A list of subscription options if you want to create a GraphQL\n * subscription to listen for more content.\n */\n subscription?: ListSubscription<TSubscription>;\n}\n\ninterface ListSubscription<TSubscription> {\n /**\n * The graphQL subscription that listens for more data. This query should\n * return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n document: DocumentNode;\n\n /**\n * A list of variables to pass into the apollo `subscribeToMore` function.\n */\n options?: Pick<SubscribeToMoreOptions<TSubscription>, \"variables\">;\n\n /**\n * A function that returns the location where the `Node` is located on the\n * `TSubscription` object.\n *\n * It should return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n getNodeByPath: GetNodeByPath<TSubscription>;\n}\n\ninterface Collection {\n edges?: Edge[];\n nodes?: Node[];\n pageInfo: {\n endCursor?: string | undefined;\n hasNextPage: boolean;\n [otherProperties: string]: unknown;\n };\n totalCount?: number;\n [otherProperties: string]: unknown;\n}\n\ninterface CollectionQueryResult<TQuery> {\n data: TQuery | undefined;\n error: ApolloError | undefined;\n loadingRefresh: boolean;\n loadingNextPage: boolean;\n loadingInitialContent: boolean;\n refresh(): void;\n nextPage(): void;\n}\n\ntype GetCollectionByPathFunction<TQuery> = (\n data: TQuery | undefined,\n) => Collection | undefined;\n\ntype GetNodeByPath<TSubscription> = (\n data: TSubscription | undefined,\n) => Node | undefined;\n\nexport function useCollectionQuery<TQuery, TSubscription = undefined>({\n query,\n queryOptions,\n getCollectionByPath,\n subscription,\n}: UseCollectionQueryArguments<\n TQuery,\n TSubscription\n>): CollectionQueryResult<TQuery> {\n const { data, loading, refetch, error, fetchMore, subscribeToMore } =\n useQuery<TQuery>(query, queryOptions);\n\n const isMounted = useIsMounted();\n const [loadingRefresh, setLoadingRefresh] = useState<boolean>(false);\n const [loadingNextPage, setLoadingNextPage] = useState<boolean>(false);\n const [hookError, setHookError] = useState<ApolloError | undefined>();\n const loadingInitialContent = loading && !loadingRefresh && !loadingNextPage;\n const isSearching = !!queryOptions?.variables?.searchTerm;\n\n const refresh = useCallback(() => {\n if (loadingInitialContent || loadingRefresh) {\n return;\n }\n\n setLoadingRefresh(true);\n\n fetchMore({\n // a workaround fix for the error described in this post\n // https://github.com/apollographql/apollo-client/issues/7491#issuecomment-767985363\n // These changes can be reverted once we can update to version 3.4\n // (the current release candidate)\n variables: {},\n updateQuery: (prev, { fetchMoreResult }) => fetchMoreResult || prev,\n })\n .catch(err => config.errorNotifier(\"Refetch Error\", err))\n .finally(() => {\n if (isMounted.current) {\n setLoadingRefresh(false);\n }\n });\n }, [\n loadingInitialContent,\n loadingRefresh,\n setLoadingRefresh,\n refetch,\n isMounted,\n ]);\n\n const nextPage = useCallback(() => {\n if (loadingInitialContent || loadingRefresh || loadingNextPage) {\n return;\n }\n\n const pageInfo = getCollectionByPath(data)?.pageInfo;\n\n if (!pageInfo || !pageInfo.hasNextPage) {\n return;\n }\n\n setLoadingNextPage(true);\n setHookError(undefined);\n\n fetchMore({\n variables: {\n cursor: pageInfo.endCursor,\n },\n updateQuery: (prev, { fetchMoreResult }) =>\n fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath),\n })\n .catch(err => {\n config.errorNotifier(\"FetchMore Error\", err);\n setHookError(err);\n })\n .finally(() => {\n if (isMounted.current) {\n setLoadingNextPage(false);\n }\n });\n }, [\n data,\n loadingInitialContent,\n loadingRefresh,\n fetchMore,\n loadingNextPage,\n setLoadingNextPage,\n getCollectionByPath,\n isMounted,\n ]);\n\n useEffect(\n () => {\n if (subscription == undefined) return;\n\n const subscriptionOptions = subscription.options || {};\n\n // Reset this state so we can handle errors from the subscription\n setHookError(undefined);\n\n return subscribeToMore<TSubscription>({\n ...subscriptionOptions,\n document: subscription.document,\n updateQuery: (prev, { subscriptionData }) =>\n subscribeToMoreHandler(\n isSearching,\n prev,\n getCollectionByPath,\n subscriptionData?.data,\n subscription.getNodeByPath,\n ),\n onError: err => {\n config.errorNotifier(\"Subscribe to More Error\", err);\n setHookError(err as ApolloError);\n },\n });\n },\n // Disabling this linter so we can force this only run once. If we didn't\n // do this we would need to ensure subscription, subscribeToMore, and getNodeByPath\n // all use useCallback.\n [queryOptions?.variables?.searchTerm],\n );\n\n const combinedError = error || hookError;\n\n return {\n data,\n error: combinedError,\n refresh,\n loadingRefresh,\n nextPage,\n loadingNextPage,\n loadingInitialContent,\n };\n}\n\n/**\n * The following method uses an `output` variable, and indirectly modifies it through the `outputCollection` variable.\n * This type of indirect modification is prone to bugs, but I couldn't think of a better way to write this code.\n *\n * Here's what I was balancing:\n * 1. We need to copy the structure of prev to ensure that when we're combining two objects, we're not losing properties\n * 2. We need to extract a key from an unknown path that's given to us by getCollectionByPath and then we need to modify\n * that, and ensure that it's properly set on the cloned output object.\n * 3. We want to keep the interface to this hook as simple and easy to use as possible\n *\n * The alternative approaches that were rejected:\n * 1. We replace the getCollectionByPath with a keyPath string. (Eg. \"data.conversation.message\") and then we use lodash\n * `get` and `set` which should remove all the object manipulation. But, this approach loses us the type safety that\n * getCollectionByPath gives us\n * 2. We could add a setCollection function to the list of arguments for this hook. This leaves us with type safety but\n * makes the `useCollectionQuery` interface more complicated by adding arguments\n */\nfunction fetchMoreUpdateQueryHandler<TQuery>(\n prev: TQuery,\n fetchMoreResult: TQuery | undefined,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n): TQuery {\n const nextCollection = getCollectionByPath(fetchMoreResult);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection === undefined || nextCollection === undefined) {\n return output;\n }\n\n if (outputCollection.nodes && nextCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n nextCollection.nodes,\n );\n }\n\n if (outputCollection.edges && nextCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n nextCollection.edges,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(nextCollection.pageInfo),\n ...getTotalCount(nextCollection.totalCount),\n });\n\n return output;\n}\n\nfunction subscribeToMoreHandler<TQuery, TSubscription>(\n isSearching: boolean,\n prev: TQuery,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n subscriptionData: TSubscription | undefined,\n getNodeByPath: GetNodeByPath<TSubscription>,\n): TQuery {\n const node = getNodeByPath(subscriptionData);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection == undefined || node == undefined) return output;\n\n if (isAlreadyUpdated(outputCollection, node) || isSearching) {\n return prev;\n }\n\n if (outputCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n [node],\n false,\n );\n }\n\n if (outputCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n [createEdge(node)],\n false,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(outputCollection.pageInfo),\n ...getTotalCount(outputCollection.totalCount, 1),\n });\n\n return output;\n}\n\ninterface TotalCountReturn {\n totalCount?: number;\n}\n\nfunction getTotalCount(\n totalCount: number | undefined,\n additionalCount = 0,\n): TotalCountReturn {\n return totalCount !== undefined\n ? { totalCount: totalCount + additionalCount }\n : {};\n}\n\nexport function isAlreadyUpdated(outputCollection: Collection, newNode: Node) {\n let edgesAlreadyUpdated = true;\n let nodesAlreadyUpdated = true;\n\n if (outputCollection.edges) {\n edgesAlreadyUpdated = outputCollection.edges.some(edge => {\n return edge.node.id === newNode.id;\n });\n }\n\n if (outputCollection.nodes) {\n nodesAlreadyUpdated = outputCollection.nodes.some(node => {\n return node.id === newNode.id;\n });\n }\n\n return edgesAlreadyUpdated && nodesAlreadyUpdated;\n}\n\nfunction getUpdatedEdges(\n prevEdges: Edge[],\n nextEdges: Edge[],\n appendToEnd = true,\n) {\n const newEdges = appendToEnd\n ? [...prevEdges, ...nextEdges]\n : [...nextEdges, ...prevEdges];\n\n return uniqueEdges(newEdges);\n}\n\nfunction getUpdatedNodes(\n prevNodes: Node[],\n nextNodes: Node[],\n appendToEnd = true,\n) {\n const newNodes = appendToEnd\n ? [...prevNodes, ...nextNodes]\n : [...nextNodes, ...prevNodes];\n\n return uniqueNodes(newNodes);\n}\n","export interface Node {\n id: unknown;\n __typename?: unknown;\n}\n\nexport function uniqueNodes(nodes: Node[]): Node[] {\n const result = new Map<string, Node>();\n nodes.forEach(node => {\n result.set(`${node.__typename}-${node.id}`, node);\n });\n\n return Array.from(result.values());\n}\n","import { Node } from \"./uniqueNodes\";\n\nexport interface Edge {\n __typename?: unknown;\n node: Node;\n cursor: string;\n}\n\nexport function createEdge(node: Node): Edge {\n return {\n node: node,\n cursor: \"\",\n __typename: `${node.__typename}Edge`,\n };\n}\n\nexport function uniqueEdges(edges: Edge[]): Edge[] {\n const result = new Map<string, Edge>();\n edges.forEach(edge => {\n result.set(\n `${edge.__typename}-${edge.node.__typename}-${edge.node.id}`,\n edge,\n );\n });\n\n return Array.from(result.values());\n}\n","import { useRef } from \"react\";\nimport { useSafeLayoutEffect } from \"../useSafeLayoutEffect\";\n\n/**\n * Why does this work?\n *\n * The following is from the react docs:\n * [The return function from `useLayoutEffect`] is the optional cleanup mechanism for effects.\n * Every effect may return a function that cleans up after it.\n *\n * When exactly does React clean up an effect? React performs the cleanup when the component unmounts.\n * The cleanup for useLayoutEffect is called after component unmounts and before before browser painting\n * the screen\n *\n * What does that mean for us? When this hook is initially loaded, we then trigger a `useLayoutEffect` that\n * sets the isMounted to true right after the component is mounted.\n * When the component unmounts, it calls the cleanup function that sets `isMounted` to false.\n * This `useLayoutEffect` hook will only be run once.\n */\nexport function useIsMounted(): { current: boolean } {\n const isMounted = useRef(false);\n\n useSafeLayoutEffect(() => {\n isMounted.current = true;\n\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n return isMounted;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useSafeLayoutEffect = globalThis?.document\n ? useLayoutEffect\n : useEffect;\n","import { useEffect, useRef } from \"react\";\n\n/**\n * Traps the focus within the children of the ref element.\n *\n * @param active - Turns the focus trapping on or off. Also adds aria-hidden on the\n * body but not the dialog.\n *\n * @returns ref\n */\nexport function useFocusTrap<T extends HTMLElement>(active: boolean) {\n // There's an ongoing issue with useRef return type clashing with an element's\n // ref prop type. TLDR: Use null because useRef doesn't expect undefined.\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572\n const ref = useRef<T>(null);\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!(active && ref.current) || event.key !== \"Tab\") {\n return;\n }\n\n const { firstElement, lastElement } = getElements(ref.current);\n\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n lastElement.focus();\n event.preventDefault();\n }\n } else {\n if (document.activeElement === lastElement) {\n firstElement.focus();\n event.preventDefault();\n }\n }\n }\n\n useEffect(() => {\n if (active && ref.current) {\n const { firstElement } = getElements(ref.current);\n firstElement.focus();\n ref.current.addEventListener(\"keydown\", handleKeyDown);\n }\n\n return () => {\n ref.current?.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [active]);\n\n return ref;\n}\n\nfunction getElements<T extends HTMLElement>(ref: T) {\n const focusables = [\n \"button\",\n \"[href]\",\n \"input\",\n \"select\",\n \"textarea\",\n '[tabindex]:not([tabindex=\"-1\"])',\n ];\n const elements = [\n ...ref.querySelectorAll<HTMLElement>(focusables.join(\", \")),\n ];\n\n // If the ref is focusable, ensure it's the first element to be focused.\n if (ref.getAttribute(\"tabindex\") === \"0\") {\n elements.unshift(ref);\n }\n\n const firstElement = elements[0];\n const lastElement = elements[elements.length - 1];\n\n return { firstElement, lastElement };\n}\n","import { useState } from \"react\";\n\nexport function useFormState() {\n const [formState, setFormState] = useState({\n isDirty: false,\n isValid: false,\n });\n\n return [formState, setFormState] as const;\n}\n","import { RefObject, useCallback, useEffect, useRef, useState } from \"react\";\n\nexport function useInView<T extends Element>(): [RefObject<T>, boolean] {\n const ref = useRef<T>(null);\n const [isInView, setIsInView] = useState(false);\n\n const handleIntersection: IntersectionObserverCallback = useCallback(\n entries => setIsInView(entries[0].isIntersecting),\n [setIsInView],\n );\n\n useEffect(() => {\n if (!window.IntersectionObserver) return;\n\n const observer = new IntersectionObserver(handleIntersection);\n ref.current && observer.observe(ref.current);\n\n return () => {\n ref.current && observer.unobserve(ref.current);\n };\n }, [handleIntersection, ref.current]);\n\n return [ref, isInView];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Announce a message on voice over whenever you do an action. This is\n * especially helpful when you have an action that adds or deletes an element\n * from the screen.\n */\nexport function useLiveAnnounce() {\n const [announcedMessage, setAnnouncedMessage] = useState(\"\");\n\n useEffect(() => {\n let target: HTMLElement;\n\n if (announcedMessage) {\n target = createAnnouncedElement();\n setTimeout(() => target.append(announcedMessage), 100);\n }\n\n return () => target?.remove();\n }, [announcedMessage]);\n\n return {\n liveAnnounce: (message: string) => {\n setAnnouncedMessage(message);\n },\n };\n}\n\n// eslint-disable-next-line max-statements\nfunction createAnnouncedElement() {\n const el = document.createElement(\"div\");\n\n el.style.position = \"absolute\";\n el.style.width = \"1px\";\n el.style.height = \"1px\";\n el.style.overflow = \"hidden\";\n el.style.clipPath = \" inset(100%)\";\n el.style.whiteSpace = \" nowrap\";\n el.style.top = \"0\";\n el.setAttribute(\"role\", \"status\");\n el.setAttribute(\"aria-atomic\", \"true\");\n el.setAttribute(\"aria-live\", \"assertive\");\n\n document.body.appendChild(el);\n\n return el;\n}\n","import { useEffect } from \"react\";\nimport { XOR } from \"ts-xor\";\n\ntype SimpleKeyComparator = KeyboardEvent[\"key\"];\n\ninterface VerboseKeyComparator {\n readonly key: SimpleKeyComparator;\n readonly shiftKey?: boolean;\n readonly ctrlKey?: boolean;\n readonly altKey?: boolean;\n readonly metaKey?: boolean;\n readonly [index: string]: boolean | string | undefined;\n}\n\ntype KeyComparator = XOR<VerboseKeyComparator, SimpleKeyComparator>;\n\nexport function useOnKeyDown(\n callback: (event: KeyboardEvent) => void,\n keys: KeyComparator[] | KeyComparator,\n) {\n useEffect(() => {\n window.addEventListener(\"keydown\", handler);\n\n return () => {\n window.removeEventListener(\"keydown\", handler);\n };\n }, [handler]);\n\n function handler(event: KeyboardEvent) {\n const keyboardEvent = event as unknown as VerboseKeyComparator;\n\n if (typeof keys === \"string\" && keyboardEvent.key === keys) {\n callback(event);\n\n return;\n }\n\n if (\n Array.isArray(keys) &&\n keys.some(item => {\n if (typeof item === \"string\") return keyboardEvent.key === item;\n\n return Object.keys(item).every(\n index => keyboardEvent[index] === item[index],\n );\n })\n ) {\n callback(event);\n\n return;\n }\n\n if (\n !Array.isArray(keys) &&\n typeof keys !== \"string\" &&\n Object.keys(keys).every(index => keyboardEvent[index] === keys[index])\n ) {\n callback(event);\n\n return;\n }\n }\n}\n","import { useMemo } from \"react\";\nimport calculateStrength from \"zxcvbn\";\n\nexport function usePasswordStrength(password: string, dictionary?: string[]) {\n const {\n guesses,\n score,\n feedback: { warning, suggestions },\n crack_times_display: { offline_fast_hashing_1e10_per_second: timeToCrack },\n } = useMemo(\n () => calculateStrength(password, dictionary),\n [password, dictionary],\n );\n\n return {\n guesses,\n score,\n warning,\n suggestions,\n timeToCrack,\n };\n}\n","import { useEffect } from \"react\";\n\n/**\n * Brings back the focus to the element that opened an overlaid element once\n * said overlaid element is dismissed.\n *\n * @param active - Determines if it should focus or not\n */\nexport function useRefocusOnActivator(active: boolean) {\n useEffect(() => {\n let activator: Element | null | undefined;\n\n if (active && !activator) {\n activator = document.activeElement;\n }\n\n return () => {\n if (active) {\n if (activator instanceof HTMLElement) {\n activator.focus();\n }\n activator = undefined;\n }\n };\n }, [active]);\n}\n","import { useMemo, useState } from \"react\";\n// Importing the polyfilled version of ResizeObserver\n// eslint-disable-next-line import/no-internal-modules\nimport useResizeObserverPackage from \"use-resize-observer/polyfilled\";\nimport { throttle } from \"lodash\";\n\nexport const Breakpoints = {\n base: 640,\n small: 500,\n smaller: 265,\n large: 750,\n larger: 1024,\n};\n\ninterface ObservedSize {\n width: number | undefined;\n height: number | undefined;\n}\n\ninterface ResizeObserverProps {\n widths?: object;\n heights?: object;\n}\n\nconst wait = 100;\n\nexport function useResizeObserver<T extends HTMLElement>({\n widths = Breakpoints,\n heights = Breakpoints,\n}: ResizeObserverProps = {}) {\n const [exactSize, setSize] = useState<ObservedSize>({\n width: undefined,\n height: undefined,\n });\n const onResize = useMemo(() => throttle(setSize, wait), [wait]);\n const { ref } = useResizeObserverPackage<T>({\n onResize,\n });\n\n const exactWidth = exactSize.width;\n const exactHeight = exactSize.height;\n\n const sizes = {\n width: getSize(widths, exactSize.width),\n height: getSize(heights, exactSize.height),\n exactWidth,\n exactHeight,\n };\n\n return [ref, sizes] as const;\n}\n\n/**\n * To get the proper size we want to make sure that our value is greater\n * then the comparable, but less then the next largest number in our\n * object.\n */\nfunction getSize(\n sizes: object,\n comparable: number | undefined,\n): number | undefined {\n if (!comparable || !sizes) {\n return undefined;\n }\n\n /**\n * Sort the values of our object so that we know they are in proper\n * order to be compared by\n */\n const sortedSizes = Object.values(sizes)\n .sort((a, b) => a - b)\n .reverse();\n\n return (\n sortedSizes.find(value => value <= comparable) ||\n sortedSizes[sortedSizes.length - 1]\n );\n}\n","export type Clearable = \"never\" | \"while-editing\" | \"always\";\n\ninterface UseShowClearParameters {\n clearable: Clearable;\n multiline: boolean;\n focused: boolean;\n hasValue: boolean;\n disabled?: boolean;\n}\n\nexport function useShowClear({\n clearable,\n multiline,\n focused,\n hasValue,\n disabled = false,\n}: UseShowClearParameters): boolean | undefined {\n if (multiline && clearable !== \"never\") {\n throw new Error(\"Multiline inputs can not be clearable\");\n }\n\n // Do not show if there is no value\n if (!hasValue || clearable === \"never\" || disabled) {\n return false;\n }\n\n switch (clearable) {\n case \"while-editing\":\n return focused;\n case \"always\":\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AACA,WAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,YAAQ,SAAS;AACjB,aAAS,YAAY;AACjB,UAAI,OAAO,WAAW,aAAa;AAC/B,eAAO;AAAA,MACX;AACA,aAAO;AAAA,IACX;AACA,QAAM,OAAO,UAAU;AACvB,YAAQ,SAAS;AAAA;AAAA;;;ACVjB;AAAA;AAAA;AACA,WAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,YAAQ,SAAS;AACjB,QAAM,WAAW;AACjB,QAAM,mBAAmB,SAAS,OAAO,gBAAgB,CAAC,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CAAC,cAAc,CAAC,OAAO;AACzB,WAAO;AAAA,EACT;AAMA,QAAM,cAAc,OAAO,OAAO,KAAK,EACpC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,EACpB,QAAQ;AAEX,SACE,YAAY,KAAK,WAAS,SAAS,UAAU,KAC7C,YAAY,YAAY,SAAS,CAAC;AAEtC;;;ACnEO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAgD;AAC9C,MAAI,aAAa,cAAc,SAAS;AACtC,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AAGA,MAAI,CAAC,YAAY,cAAc,WAAW,UAAU;AAClD,WAAO;AAAA,EACT;AAEA,UAAQ,WAAW;AAAA,IACjB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;","names":["exports","useState","useCallback","useEffect","useState","useEffect","useState","useCallback","_a","useEffect","useEffect","useRef","useState","useCallback","useEffect","useRef","useState","useEffect","useState","useEffect","useEffect","useMemo","useState"]}
1
+ {"version":3,"sources":["../../formatters/dist/global.js","../../formatters/dist/config.js","../../formatters/dist/currency.js","../../formatters/dist/CurrencyType.js","../../formatters/dist/index.js","../src/useAssert/useAssert.tsx","../src/useBool/useBool.ts","../src/useBreakpoints/useMediaQuery.ts","../src/useBreakpoints/useBreakpoints.ts","../src/useCollectionQuery/useCollectionQuery.ts","../src/useCollectionQuery/uniqueNodes.tsx","../src/useCollectionQuery/uniqueEdges.tsx","../src/useIsMounted/useIsMounted.ts","../src/useSafeLayoutEffect/useSafeLayoutEffect.ts","../src/useFocusTrap/useFocusTrap.ts","../src/useFormState/useFormState.ts","../src/useInView/useInView.ts","../src/useLiveAnnounce/useLiveAnnounce.tsx","../src/useOnKeyDown/useOnKeyDown.ts","../src/usePasswordStrength/usePasswordStrength.ts","../src/useRefocusOnActivator/useRefocusOnActivator.ts","../src/useResizeObserver/useResizeObserver.ts","../src/useShowClear/useShowClear.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.global = void 0;\nfunction getGlobal() {\n if (typeof window !== \"undefined\") {\n return window;\n }\n return global;\n}\nconst glob = getGlobal();\nexports.global = glob;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.config = void 0;\nconst global_1 = require(\"./global\");\nconst configOverrides = (global_1.global.ATLANTIS_ENV || {}).config || {};\nexports.config = Object.freeze(Object.assign({ defaultCurrency: \"USD\", errorNotifier(message, error) {\n console.error(message, error);\n } }, configOverrides));\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatCurrency = void 0;\nconst config_1 = require(\"./config\");\nfunction formatCurrency(amount, currency = config_1.config.defaultCurrency) {\n return amount.toLocaleString(\"en\", {\n style: \"currency\",\n currency: currency,\n });\n}\nexports.formatCurrency = formatCurrency;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./currency\"), exports);\n__exportStar(require(\"./CurrencyType\"), exports);\n__exportStar(require(\"./config\"), exports);\n","import process from \"process\";\n\ninterface Options {\n readonly warn: boolean;\n}\n\nexport function useAssert(\n shouldShow: boolean,\n message: string,\n options?: Options,\n) {\n if (process?.env?.NODE_ENV !== \"production\" && shouldShow) {\n if (options?.warn) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n }\n}\n","import { useCallback, useState } from \"react\";\n\ndeclare const brand: unique symbol;\n\ntype Callback = () => void;\n\nexport type SetTrue = Callback & {\n [brand]: \"SetTrue\";\n};\n\nexport type SetFalse = Callback & {\n [brand]: \"SetFalse\";\n};\n\nexport type Toggle = Callback & {\n [brand]: \"Toggle\";\n};\n\nexport function useBool(\n initialState = false,\n): [boolean, SetTrue, SetFalse, Toggle] {\n const [state, setState] = useState(initialState);\n const setTrue = useCallback(() => setState(true), []);\n const setFalse = useCallback(() => setState(false), []);\n const toggle = useCallback(() => setState(current => !current), []);\n\n return [state, setTrue as SetTrue, setFalse as SetFalse, toggle as Toggle];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Sets the JS media query listener. Internal use only.\n */\nexport function useMediaQuery(CSSMediaQuery: string) {\n const [matches, setMatches] = useState(\n window.matchMedia(CSSMediaQuery).matches,\n );\n\n useEffect(() => {\n const media = window.matchMedia(CSSMediaQuery);\n\n if (media.matches !== matches) {\n setMatches(media.matches);\n }\n\n const listener = () => setMatches(media.matches);\n media.addEventListener(\"change\", listener);\n\n return () => media.removeEventListener(\"change\", listener);\n }, [CSSMediaQuery]);\n\n return matches;\n}\n","import { useMediaQuery } from \"./useMediaQuery\";\n\nexport const BREAKPOINT_SIZES = { sm: 490, md: 768, lg: 1080, xl: 1440 };\n\n/**\n * Hook equivalent of CSS media queries with our\n * [supported breakpoints](https://atlantis.getjobber.com/?path=/docs/design-breakpoints--page).\n */\nexport function useBreakpoints() {\n const { sm, md, lg, xl } = BREAKPOINT_SIZES;\n const extraSmallOnly = useMediaQuery(`(max-width: ${sm - 1}px)`);\n const smallAndUp = useMediaQuery(`(min-width: ${sm}px)`);\n const mediumAndUp = useMediaQuery(`(min-width: ${md}px)`);\n const largeAndUp = useMediaQuery(`(min-width: ${lg}px)`);\n const extraLargeAndUp = useMediaQuery(`(min-width: ${xl}px)`);\n\n return {\n smallAndUp,\n mediumAndUp,\n largeAndUp,\n extraLargeAndUp,\n extraSmallOnly,\n smallOnly: smallAndUp && !mediumAndUp,\n mediumOnly: mediumAndUp && !largeAndUp,\n largeOnly: largeAndUp && !extraLargeAndUp,\n };\n}\n","import {\n ApolloError,\n DocumentNode,\n QueryHookOptions,\n SubscribeToMoreOptions,\n useQuery,\n} from \"@apollo/client\";\nimport { cloneDeep } from \"lodash\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { config } from \"@jobber/formatters\";\nimport { Node, uniqueNodes } from \"./uniqueNodes\";\nimport { Edge, createEdge, uniqueEdges } from \"./uniqueEdges\";\nimport { useIsMounted } from \"../useIsMounted\";\n\ninterface UseCollectionQueryArguments<TQuery, TSubscription> {\n /**\n * The graphQL query that fetches the collection\n */\n query: DocumentNode;\n\n /**\n * A list of options for us to pass into the apollo `useQuery` hook\n */\n queryOptions?: QueryHookOptions<TQuery>;\n\n /**\n * A function that returns the location where the {@link Collection} is located.\n *\n * The collection is the part of the result that needs to be paginated.\n */\n getCollectionByPath: GetCollectionByPathFunction<TQuery>;\n\n /**\n * A list of subscription options if you want to create a GraphQL\n * subscription to listen for more content.\n */\n subscription?: ListSubscription<TSubscription>;\n}\n\ninterface ListSubscription<TSubscription> {\n /**\n * The graphQL subscription that listens for more data. This query should\n * return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n document: DocumentNode;\n\n /**\n * A list of variables to pass into the apollo `subscribeToMore` function.\n */\n options?: Pick<SubscribeToMoreOptions<TSubscription>, \"variables\">;\n\n /**\n * A function that returns the location where the `Node` is located on the\n * `TSubscription` object.\n *\n * It should return a single Node that matches the data structure in\n * `getCollectionByPath<TQuery>(...).edges.node` and\n * `getCollectionByPath<TQuery>(...).nodes\n */\n getNodeByPath: GetNodeByPath<TSubscription>;\n}\n\ninterface Collection {\n edges?: Edge[];\n nodes?: Node[];\n pageInfo: {\n endCursor?: string | undefined;\n hasNextPage: boolean;\n [otherProperties: string]: unknown;\n };\n totalCount?: number;\n [otherProperties: string]: unknown;\n}\n\ninterface CollectionQueryResult<TQuery> {\n data: TQuery | undefined;\n error: ApolloError | undefined;\n loadingRefresh: boolean;\n loadingNextPage: boolean;\n loadingInitialContent: boolean;\n refresh(): void;\n nextPage(): void;\n}\n\ntype GetCollectionByPathFunction<TQuery> = (\n data: TQuery | undefined,\n) => Collection | undefined;\n\ntype GetNodeByPath<TSubscription> = (\n data: TSubscription | undefined,\n) => Node | undefined;\n\nexport function useCollectionQuery<TQuery, TSubscription = undefined>({\n query,\n queryOptions,\n getCollectionByPath,\n subscription,\n}: UseCollectionQueryArguments<\n TQuery,\n TSubscription\n>): CollectionQueryResult<TQuery> {\n const { data, loading, refetch, error, fetchMore, subscribeToMore } =\n useQuery<TQuery>(query, queryOptions);\n\n const isMounted = useIsMounted();\n const [loadingRefresh, setLoadingRefresh] = useState<boolean>(false);\n const [loadingNextPage, setLoadingNextPage] = useState<boolean>(false);\n const [hookError, setHookError] = useState<ApolloError | undefined>();\n const loadingInitialContent = loading && !loadingRefresh && !loadingNextPage;\n const isSearching = !!queryOptions?.variables?.searchTerm;\n\n const refresh = useCallback(() => {\n if (loadingInitialContent || loadingRefresh) {\n return;\n }\n\n setLoadingRefresh(true);\n\n fetchMore({\n // a workaround fix for the error described in this post\n // https://github.com/apollographql/apollo-client/issues/7491#issuecomment-767985363\n // These changes can be reverted once we can update to version 3.4\n // (the current release candidate)\n variables: {},\n updateQuery: (prev, { fetchMoreResult }) => fetchMoreResult || prev,\n })\n .catch(err => config.errorNotifier(\"Refetch Error\", err))\n .finally(() => {\n if (isMounted.current) {\n setLoadingRefresh(false);\n }\n });\n }, [\n loadingInitialContent,\n loadingRefresh,\n setLoadingRefresh,\n refetch,\n isMounted,\n ]);\n\n const nextPage = useCallback(() => {\n if (loadingInitialContent || loadingRefresh || loadingNextPage) {\n return;\n }\n\n const pageInfo = getCollectionByPath(data)?.pageInfo;\n\n if (!pageInfo || !pageInfo.hasNextPage) {\n return;\n }\n\n setLoadingNextPage(true);\n setHookError(undefined);\n\n fetchMore({\n variables: {\n cursor: pageInfo.endCursor,\n },\n updateQuery: (prev, { fetchMoreResult }) =>\n fetchMoreUpdateQueryHandler(prev, fetchMoreResult, getCollectionByPath),\n })\n .catch(err => {\n config.errorNotifier(\"FetchMore Error\", err);\n setHookError(err);\n })\n .finally(() => {\n if (isMounted.current) {\n setLoadingNextPage(false);\n }\n });\n }, [\n data,\n loadingInitialContent,\n loadingRefresh,\n fetchMore,\n loadingNextPage,\n setLoadingNextPage,\n getCollectionByPath,\n isMounted,\n ]);\n\n useEffect(\n () => {\n if (subscription == undefined) return;\n\n const subscriptionOptions = subscription.options || {};\n\n // Reset this state so we can handle errors from the subscription\n setHookError(undefined);\n\n return subscribeToMore<TSubscription>({\n ...subscriptionOptions,\n document: subscription.document,\n updateQuery: (prev, { subscriptionData }) =>\n subscribeToMoreHandler(\n isSearching,\n prev,\n getCollectionByPath,\n subscriptionData?.data,\n subscription.getNodeByPath,\n ),\n onError: err => {\n config.errorNotifier(\"Subscribe to More Error\", err);\n setHookError(err as ApolloError);\n },\n });\n },\n // Disabling this linter so we can force this only run once. If we didn't\n // do this we would need to ensure subscription, subscribeToMore, and getNodeByPath\n // all use useCallback.\n [queryOptions?.variables?.searchTerm],\n );\n\n const combinedError = error || hookError;\n\n return {\n data,\n error: combinedError,\n refresh,\n loadingRefresh,\n nextPage,\n loadingNextPage,\n loadingInitialContent,\n };\n}\n\n/**\n * The following method uses an `output` variable, and indirectly modifies it through the `outputCollection` variable.\n * This type of indirect modification is prone to bugs, but I couldn't think of a better way to write this code.\n *\n * Here's what I was balancing:\n * 1. We need to copy the structure of prev to ensure that when we're combining two objects, we're not losing properties\n * 2. We need to extract a key from an unknown path that's given to us by getCollectionByPath and then we need to modify\n * that, and ensure that it's properly set on the cloned output object.\n * 3. We want to keep the interface to this hook as simple and easy to use as possible\n *\n * The alternative approaches that were rejected:\n * 1. We replace the getCollectionByPath with a keyPath string. (Eg. \"data.conversation.message\") and then we use lodash\n * `get` and `set` which should remove all the object manipulation. But, this approach loses us the type safety that\n * getCollectionByPath gives us\n * 2. We could add a setCollection function to the list of arguments for this hook. This leaves us with type safety but\n * makes the `useCollectionQuery` interface more complicated by adding arguments\n */\nfunction fetchMoreUpdateQueryHandler<TQuery>(\n prev: TQuery,\n fetchMoreResult: TQuery | undefined,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n): TQuery {\n const nextCollection = getCollectionByPath(fetchMoreResult);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection === undefined || nextCollection === undefined) {\n return output;\n }\n\n if (outputCollection.nodes && nextCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n nextCollection.nodes,\n );\n }\n\n if (outputCollection.edges && nextCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n nextCollection.edges,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(nextCollection.pageInfo),\n ...getTotalCount(nextCollection.totalCount),\n });\n\n return output;\n}\n\nfunction subscribeToMoreHandler<TQuery, TSubscription>(\n isSearching: boolean,\n prev: TQuery,\n getCollectionByPath: GetCollectionByPathFunction<TQuery>,\n subscriptionData: TSubscription | undefined,\n getNodeByPath: GetNodeByPath<TSubscription>,\n): TQuery {\n const node = getNodeByPath(subscriptionData);\n const output = cloneDeep(prev);\n const outputCollection = getCollectionByPath(output);\n\n if (outputCollection == undefined || node == undefined) return output;\n\n if (isAlreadyUpdated(outputCollection, node) || isSearching) {\n return prev;\n }\n\n if (outputCollection.nodes) {\n outputCollection.nodes = getUpdatedNodes(\n outputCollection.nodes,\n [node],\n false,\n );\n }\n\n if (outputCollection.edges) {\n outputCollection.edges = getUpdatedEdges(\n outputCollection.edges,\n [createEdge(node)],\n false,\n );\n }\n\n Object.assign(outputCollection, {\n pageInfo: cloneDeep(outputCollection.pageInfo),\n ...getTotalCount(outputCollection.totalCount, 1),\n });\n\n return output;\n}\n\ninterface TotalCountReturn {\n totalCount?: number;\n}\n\nfunction getTotalCount(\n totalCount: number | undefined,\n additionalCount = 0,\n): TotalCountReturn {\n return totalCount !== undefined\n ? { totalCount: totalCount + additionalCount }\n : {};\n}\n\nexport function isAlreadyUpdated(outputCollection: Collection, newNode: Node) {\n let edgesAlreadyUpdated = true;\n let nodesAlreadyUpdated = true;\n\n if (outputCollection.edges) {\n edgesAlreadyUpdated = outputCollection.edges.some(edge => {\n return edge.node.id === newNode.id;\n });\n }\n\n if (outputCollection.nodes) {\n nodesAlreadyUpdated = outputCollection.nodes.some(node => {\n return node.id === newNode.id;\n });\n }\n\n return edgesAlreadyUpdated && nodesAlreadyUpdated;\n}\n\nfunction getUpdatedEdges(\n prevEdges: Edge[],\n nextEdges: Edge[],\n appendToEnd = true,\n) {\n const newEdges = appendToEnd\n ? [...prevEdges, ...nextEdges]\n : [...nextEdges, ...prevEdges];\n\n return uniqueEdges(newEdges);\n}\n\nfunction getUpdatedNodes(\n prevNodes: Node[],\n nextNodes: Node[],\n appendToEnd = true,\n) {\n const newNodes = appendToEnd\n ? [...prevNodes, ...nextNodes]\n : [...nextNodes, ...prevNodes];\n\n return uniqueNodes(newNodes);\n}\n","export interface Node {\n id: unknown;\n __typename?: unknown;\n}\n\nexport function uniqueNodes(nodes: Node[]): Node[] {\n const result = new Map<string, Node>();\n nodes.forEach(node => {\n result.set(`${node.__typename}-${node.id}`, node);\n });\n\n return Array.from(result.values());\n}\n","import { Node } from \"./uniqueNodes\";\n\nexport interface Edge {\n __typename?: unknown;\n node: Node;\n cursor: string;\n}\n\nexport function createEdge(node: Node): Edge {\n return {\n node: node,\n cursor: \"\",\n __typename: `${node.__typename}Edge`,\n };\n}\n\nexport function uniqueEdges(edges: Edge[]): Edge[] {\n const result = new Map<string, Edge>();\n edges.forEach(edge => {\n result.set(\n `${edge.__typename}-${edge.node.__typename}-${edge.node.id}`,\n edge,\n );\n });\n\n return Array.from(result.values());\n}\n","import { useRef } from \"react\";\nimport { useSafeLayoutEffect } from \"../useSafeLayoutEffect\";\n\n/**\n * Why does this work?\n *\n * The following is from the react docs:\n * [The return function from `useLayoutEffect`] is the optional cleanup mechanism for effects.\n * Every effect may return a function that cleans up after it.\n *\n * When exactly does React clean up an effect? React performs the cleanup when the component unmounts.\n * The cleanup for useLayoutEffect is called after component unmounts and before before browser painting\n * the screen\n *\n * What does that mean for us? When this hook is initially loaded, we then trigger a `useLayoutEffect` that\n * sets the isMounted to true right after the component is mounted.\n * When the component unmounts, it calls the cleanup function that sets `isMounted` to false.\n * This `useLayoutEffect` hook will only be run once.\n */\nexport function useIsMounted(): { current: boolean } {\n const isMounted = useRef(false);\n\n useSafeLayoutEffect(() => {\n isMounted.current = true;\n\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n return isMounted;\n}\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useSafeLayoutEffect = globalThis?.document\n ? useLayoutEffect\n : useEffect;\n","import { useEffect, useRef } from \"react\";\n\n/**\n * Traps the focus within the children of the ref element.\n *\n * @param active - Turns the focus trapping on or off. Also adds aria-hidden on the\n * body but not the dialog.\n *\n * @returns ref\n */\nexport function useFocusTrap<T extends HTMLElement>(active: boolean) {\n // There's an ongoing issue with useRef return type clashing with an element's\n // ref prop type. TLDR: Use null because useRef doesn't expect undefined.\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572\n const ref = useRef<T>(null);\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!(active && ref.current) || event.key !== \"Tab\") {\n return;\n }\n\n const { firstElement, lastElement } = getElements(ref.current);\n\n if (event.shiftKey) {\n if (document.activeElement === firstElement) {\n lastElement.focus();\n event.preventDefault();\n }\n } else {\n if (document.activeElement === lastElement) {\n firstElement.focus();\n event.preventDefault();\n }\n }\n }\n\n useEffect(() => {\n if (active && ref.current) {\n const { firstElement } = getElements(ref.current);\n firstElement.focus();\n ref.current.addEventListener(\"keydown\", handleKeyDown);\n }\n\n return () => {\n ref.current?.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [active]);\n\n return ref;\n}\n\nfunction getElements<T extends HTMLElement>(ref: T) {\n const focusables = [\n \"button\",\n \"[href]\",\n \"input\",\n \"select\",\n \"textarea\",\n '[tabindex]:not([tabindex=\"-1\"])',\n ];\n const elements = [\n ...ref.querySelectorAll<HTMLElement>(focusables.join(\", \")),\n ];\n\n // If the ref is focusable, ensure it's the first element to be focused.\n if (ref.getAttribute(\"tabindex\") === \"0\") {\n elements.unshift(ref);\n }\n\n const firstElement = elements[0];\n const lastElement = elements[elements.length - 1];\n\n return { firstElement, lastElement };\n}\n","import { useState } from \"react\";\n\nexport function useFormState() {\n const [formState, setFormState] = useState({\n isDirty: false,\n isValid: false,\n });\n\n return [formState, setFormState] as const;\n}\n","import { RefObject, useCallback, useEffect, useRef, useState } from \"react\";\n\nexport function useInView<T extends Element>(): [RefObject<T>, boolean] {\n const ref = useRef<T>(null);\n const [isInView, setIsInView] = useState(false);\n\n const handleIntersection: IntersectionObserverCallback = useCallback(\n entries => setIsInView(entries[0].isIntersecting),\n [setIsInView],\n );\n\n useEffect(() => {\n if (!window.IntersectionObserver) return;\n\n const observer = new IntersectionObserver(handleIntersection);\n ref.current && observer.observe(ref.current);\n\n return () => {\n ref.current && observer.unobserve(ref.current);\n };\n }, [handleIntersection, ref.current]);\n\n return [ref, isInView];\n}\n","import { useEffect, useState } from \"react\";\n\n/**\n * Announce a message on voice over whenever you do an action. This is\n * especially helpful when you have an action that adds or deletes an element\n * from the screen.\n */\nexport function useLiveAnnounce() {\n const [announcedMessage, setAnnouncedMessage] = useState(\"\");\n\n useEffect(() => {\n let target: HTMLElement;\n\n if (announcedMessage) {\n target = createAnnouncedElement();\n setTimeout(() => target.append(announcedMessage), 100);\n }\n\n return () => target?.remove();\n }, [announcedMessage]);\n\n return {\n liveAnnounce: (message: string) => {\n setAnnouncedMessage(message);\n },\n };\n}\n\n// eslint-disable-next-line max-statements\nfunction createAnnouncedElement() {\n const el = document.createElement(\"div\");\n\n el.style.position = \"absolute\";\n el.style.width = \"1px\";\n el.style.height = \"1px\";\n el.style.overflow = \"hidden\";\n el.style.clipPath = \" inset(100%)\";\n el.style.whiteSpace = \" nowrap\";\n el.style.top = \"0\";\n el.setAttribute(\"role\", \"status\");\n el.setAttribute(\"aria-atomic\", \"true\");\n el.setAttribute(\"aria-live\", \"assertive\");\n\n document.body.appendChild(el);\n\n return el;\n}\n","import { useEffect } from \"react\";\nimport { XOR } from \"ts-xor\";\n\ntype SimpleKeyComparator = KeyboardEvent[\"key\"];\n\ninterface VerboseKeyComparator {\n readonly key: SimpleKeyComparator;\n readonly shiftKey?: boolean;\n readonly ctrlKey?: boolean;\n readonly altKey?: boolean;\n readonly metaKey?: boolean;\n readonly [index: string]: boolean | string | undefined;\n}\n\ntype KeyComparator = XOR<VerboseKeyComparator, SimpleKeyComparator>;\n\nexport function useOnKeyDown(\n callback: (event: KeyboardEvent) => void,\n keys: KeyComparator[] | KeyComparator,\n) {\n useEffect(() => {\n window.addEventListener(\"keydown\", handler);\n\n return () => {\n window.removeEventListener(\"keydown\", handler);\n };\n }, [handler]);\n\n function handler(event: KeyboardEvent) {\n const keyboardEvent = event as unknown as VerboseKeyComparator;\n\n if (typeof keys === \"string\" && keyboardEvent.key === keys) {\n callback(event);\n\n return;\n }\n\n if (\n Array.isArray(keys) &&\n keys.some(item => {\n if (typeof item === \"string\") return keyboardEvent.key === item;\n\n return Object.keys(item).every(\n index => keyboardEvent[index] === item[index],\n );\n })\n ) {\n callback(event);\n\n return;\n }\n\n if (\n !Array.isArray(keys) &&\n typeof keys !== \"string\" &&\n Object.keys(keys).every(index => keyboardEvent[index] === keys[index])\n ) {\n callback(event);\n\n return;\n }\n }\n}\n","import { useMemo } from \"react\";\nimport calculateStrength from \"zxcvbn\";\n\nexport function usePasswordStrength(password: string, dictionary?: string[]) {\n const {\n guesses,\n score,\n feedback: { warning, suggestions },\n crack_times_display: { offline_fast_hashing_1e10_per_second: timeToCrack },\n } = useMemo(\n () => calculateStrength(password, dictionary),\n [password, dictionary],\n );\n\n return {\n guesses,\n score,\n warning,\n suggestions,\n timeToCrack,\n };\n}\n","import { useEffect } from \"react\";\n\n/**\n * Brings back the focus to the element that opened an overlaid element once\n * said overlaid element is dismissed.\n *\n * @param active - Determines if it should focus or not\n */\nexport function useRefocusOnActivator(active: boolean) {\n useEffect(() => {\n let activator: Element | null | undefined;\n\n if (active && !activator) {\n activator = document.activeElement;\n }\n\n return () => {\n if (active) {\n if (activator instanceof HTMLElement) {\n activator.focus();\n }\n activator = undefined;\n }\n };\n }, [active]);\n}\n","import { useMemo, useState } from \"react\";\n// Importing the polyfilled version of ResizeObserver\n// eslint-disable-next-line import/no-internal-modules\nimport useResizeObserverPackage from \"use-resize-observer/polyfilled\";\nimport { throttle } from \"lodash\";\n\nexport const Breakpoints = {\n base: 640,\n small: 500,\n smaller: 265,\n large: 750,\n larger: 1024,\n};\n\ninterface ObservedSize {\n width: number | undefined;\n height: number | undefined;\n}\n\ninterface ResizeObserverProps {\n widths?: object;\n heights?: object;\n}\n\nconst wait = 100;\n\nexport function useResizeObserver<T extends HTMLElement>({\n widths = Breakpoints,\n heights = Breakpoints,\n}: ResizeObserverProps = {}) {\n const [exactSize, setSize] = useState<ObservedSize>({\n width: undefined,\n height: undefined,\n });\n const onResize = useMemo(() => throttle(setSize, wait), [wait]);\n const { ref } = useResizeObserverPackage<T>({\n onResize,\n });\n\n const exactWidth = exactSize.width;\n const exactHeight = exactSize.height;\n\n const sizes = {\n width: getSize(widths, exactSize.width),\n height: getSize(heights, exactSize.height),\n exactWidth,\n exactHeight,\n };\n\n return [ref, sizes] as const;\n}\n\n/**\n * To get the proper size we want to make sure that our value is greater\n * then the comparable, but less then the next largest number in our\n * object.\n */\nfunction getSize(\n sizes: object,\n comparable: number | undefined,\n): number | undefined {\n if (!comparable || !sizes) {\n return undefined;\n }\n\n /**\n * Sort the values of our object so that we know they are in proper\n * order to be compared by\n */\n const sortedSizes = Object.values(sizes)\n .sort((a, b) => a - b)\n .reverse();\n\n return (\n sortedSizes.find(value => value <= comparable) ||\n sortedSizes[sortedSizes.length - 1]\n );\n}\n","export type Clearable = \"never\" | \"while-editing\" | \"always\";\n\ninterface UseShowClearParameters {\n clearable: Clearable;\n multiline: boolean;\n focused: boolean;\n hasValue: boolean;\n disabled?: boolean;\n}\n\nexport function useShowClear({\n clearable,\n multiline,\n focused,\n hasValue,\n disabled = false,\n}: UseShowClearParameters): boolean | undefined {\n if (multiline && clearable !== \"never\") {\n throw new Error(\"Multiline inputs can not be clearable\");\n }\n\n // Do not show if there is no value\n if (!hasValue || clearable === \"never\" || disabled) {\n return false;\n }\n\n switch (clearable) {\n case \"while-editing\":\n return focused;\n case \"always\":\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AACA,WAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,YAAQ,SAAS;AACjB,aAAS,YAAY;AACjB,UAAI,OAAO,WAAW,aAAa;AAC/B,eAAO;AAAA,MACX;AACA,aAAO;AAAA,IACX;AACA,QAAM,OAAO,UAAU;AACvB,YAAQ,SAAS;AAAA;AAAA;;;ACVjB;AAAA;AAAA;AACA,WAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CAAC;AAC5D,YAAQ,SAAS;AACjB,QAAM,WAAW;AACjB,QAAM,mBAAmB,SAAS,OAAO,gBAAgB,CAAC,GAAG,UAAU,CAAC;AACxE,YAAQ,SAAS,OAAO,OAAO,OAAO,OAAO,EAAE,iBAAiB,OAAO,cAAc,SAAS,OAAO;AAC7F,cAAQ,MAAM,SAAS,KAAK;AAAA,IAChC,EAAE,GAAG,eAAe,CAAC;AAAA;AAAA;;;ACPzB;AAAA;AAAA;AACA,WAAO,eAAe,SAAS,cAAc,EAAE,OAAO,KAAK,CA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;AAClD,WAAO;AAAA,EACT;AAEA,UAAQ,WAAW;AAAA,IACjB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,EACX;AACF;","names":["exports","useState","useCallback","useEffect","useState","useEffect","useState","useCallback","_a","useEffect","useEffect","useRef","useState","useCallback","useEffect","useRef","useState","useEffect","useState","useEffect","useEffect","useMemo","useState"]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/useFormState/index.ts
21
+ var useFormState_exports = {};
22
+ __export(useFormState_exports, {
23
+ useFormState: () => useFormState
24
+ });
25
+ module.exports = __toCommonJS(useFormState_exports);
26
+
27
+ // src/useFormState/useFormState.ts
28
+ var import_react = require("react");
29
+ function useFormState() {
30
+ const [formState, setFormState] = (0, import_react.useState)({
31
+ isDirty: false,
32
+ isValid: false
33
+ });
34
+ return [formState, setFormState];
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ useFormState
39
+ });
40
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/useFormState/index.ts","../../src/useFormState/useFormState.ts"],"sourcesContent":["export { useFormState } from \"./useFormState\";\n","import { useState } from \"react\";\n\nexport function useFormState() {\n const [formState, setFormState] = useState({\n isDirty: false,\n isValid: false,\n });\n\n return [formState, setFormState] as const;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyB;AAElB,SAAS,eAAe;AAC7B,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS;AAAA,IACzC,SAAS;AAAA,IACT,SAAS;AAAA,EACX,CAAC;AAED,SAAO,CAAC,WAAW,YAAY;AACjC;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/useFormState/useFormState.ts"],"sourcesContent":["import { useState } from \"react\";\n\nexport function useFormState() {\n const [formState, setFormState] = useState({\n isDirty: false,\n isValid: false,\n });\n\n return [formState, setFormState] as const;\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAElB,SAAS,eAAe;AAC7B,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS;AAAA,IACzC,SAAS;AAAA,IACT,SAAS;AAAA,EACX,CAAC;AAED,SAAO,CAAC,WAAW,YAAY;AACjC;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jobber/hooks",
3
3
  "type": "module",
4
- "version": "2.9.2-CJS-to-ESM.25+49dd6c5a",
4
+ "version": "2.9.2-CJS-to-ESM.27+1a2c0338",
5
5
  "license": "MIT",
6
6
  "types": "./dist/index.d.ts",
7
7
  "main": "./dist/index.cjs",
@@ -14,17 +14,17 @@
14
14
  },
15
15
  "./useAssert": {
16
16
  "types": "./dist/useAssert/index.d.ts",
17
- "import": "./dist/useAssert/index.js",
17
+ "import": "./dist/useAssert/useAssert.js",
18
18
  "require": "./dist/useAssert/index.cjs"
19
19
  },
20
20
  "./useBreakpoints": {
21
21
  "types": "./dist/useBreakpoints/index.d.ts",
22
- "import": "./dist/useBreakpoints/index.js",
22
+ "import": "./dist/useBreakpoints/useBreakpoints.js",
23
23
  "require": "./dist/useBreakpoints/index.cjs"
24
24
  },
25
25
  "./useCollectionQuery": {
26
26
  "types": "./dist/useCollectionQuery/index.d.ts",
27
- "import": "./dist/useCollectionQuery/index.js",
27
+ "import": "./dist/useCollectionQuery/useCollectionQuery.js",
28
28
  "require": "./dist/useCollectionQuery/index.cjs"
29
29
  },
30
30
  "./useFocusTrap": {
@@ -125,5 +125,5 @@
125
125
  "@apollo/client": "^3.0.0",
126
126
  "react": "^18"
127
127
  },
128
- "gitHead": "49dd6c5aeb9be3fb05b1fc5777b7222522d66399"
128
+ "gitHead": "1a2c0338cb71db9141f659bbaf719dd81e19f31c"
129
129
  }