@razorpay/blade 10.15.2 → 10.16.0
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/build/components/index.d.ts +432 -1
- package/build/components/index.development.web.js +2673 -1969
- package/build/components/index.development.web.js.map +1 -1
- package/build/components/index.native.d.ts +111 -1
- package/build/components/index.native.js +372 -353
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.production.web.js +2652 -1968
- package/build/components/index.production.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +2 -2
- package/build/css/bankingThemeDarkMobile.css +2 -2
- package/build/css/bankingThemeLightDesktop.css +2 -2
- package/build/css/bankingThemeLightMobile.css +2 -2
- package/build/css/paymentThemeDarkDesktop.css +2 -2
- package/build/css/paymentThemeDarkMobile.css +2 -2
- package/build/css/paymentThemeLightDesktop.css +2 -2
- package/build/css/paymentThemeLightMobile.css +2 -2
- package/build/tokens/index.development.web.js +4 -4
- package/build/tokens/index.development.web.js.map +1 -1
- package/build/tokens/index.native.js +1 -1
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.production.web.js +4 -4
- package/build/tokens/index.production.web.js.map +1 -1
- package/build/utils/index.d.ts +1 -1
- package/build/utils/index.development.web.js.map +1 -1
- package/build/utils/index.native.d.ts +1 -1
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.production.web.js.map +1 -1
- package/package.json +15 -5
package/build/utils/index.d.ts
CHANGED
|
@@ -758,4 +758,4 @@ declare type ThemeContext = UseColorScheme & {
|
|
|
758
758
|
declare const ThemeContext: React.Context<ThemeContext>;
|
|
759
759
|
declare const useTheme: () => ThemeContext;
|
|
760
760
|
|
|
761
|
-
export { MakeSize, Platform, PlatformTypes, ThemeContext, UseColorScheme, castNativeType, castWebType, getColorScheme, getMediaQuery, getOS, getPlatformType, isAndroid, isReactNative, makeBorderSize, makeMotionTime, makeSize, makeSpace, makeTypographySize, toTitleCase, useBreakpoint, useColorScheme, useInterval, usePrevious, useTheme };
|
|
761
|
+
export { DeviceType, MakeSize, Platform, PlatformTypes, ThemeContext, UseColorScheme, castNativeType, castWebType, getColorScheme, getMediaQuery, getOS, getPlatformType, isAndroid, isReactNative, makeBorderSize, makeMotionTime, makeSize, makeSpace, makeTypographySize, toTitleCase, useBreakpoint, useColorScheme, useInterval, usePrevious, useTheme };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.development.web.js","sources":["../../src/utils/getColorScheme/getColorScheme.web.ts","../../src/utils/getMediaQuery/getMediaQuery.ts","../../src/utils/getPlatformType/getPlatformType.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/tokens/theme/theme.ts","../../src/utils/logger/logger.ts","../../src/utils/useColorScheme/useColorScheme.ts","../../src/utils/useIsomorphicLayoutEffect.ts","../../src/utils/useInterval.ts","../../src/utils/platform/isReactNative.ts","../../src/utils/platform/getOS.web.ts","../../src/utils/platform/castUtils.ts","../../src/utils/makeBorderSize/makeBorderSize.ts","../../src/utils/makeMotionTime/makeMotionTime.web.ts","../../src/utils/makeSpace/makeSpace.ts","../../src/utils/makeTypographySize/makeTypographySize.web.ts","../../src/utils/makeSize/makeSize.ts","../../src/utils/toTitleCase/toTitleCase.ts","../../src/utils/usePrevious/usePrevious.ts","../../src/components/BladeProvider/useTheme.ts"],"sourcesContent":["import type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\n\nexport const getColorScheme = (colorScheme: ColorSchemeNamesInput = 'light'): ColorSchemeNames => {\n // @TODO: create a useMediaQuery hook with an event listener which will subscribe to changes and move all this logic there\n const colorSchemeMediaQueryMap = {\n light: '(prefers-color-scheme: light)',\n dark: '(prefers-color-scheme: dark)',\n system: 'default',\n };\n const supportsMatchMedia =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n\n if (colorScheme === 'light' || colorScheme === 'dark') {\n return colorScheme;\n }\n\n if (\n colorScheme === 'system' &&\n supportsMatchMedia &&\n window.matchMedia(colorSchemeMediaQueryMap.dark).matches\n ) {\n return 'dark';\n }\n\n return 'light';\n};\n","export const getMediaQuery = ({ min, max }: { min: number; max?: number }): string => {\n return `screen and (min-width: ${min}px)${max ? ` and (max-width: ${max}px)` : ''}`;\n};\n","export type PlatformTypes = 'browser' | 'node' | 'react-native' | 'unknown';\n\nexport const getPlatformType = (): PlatformTypes => {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n if (typeof document !== 'undefined') {\n return 'browser';\n }\n\n if (typeof process !== 'undefined') {\n return 'node';\n }\n\n return 'unknown';\n};\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\n\nconst deviceType = {\n desktop: 'desktop',\n mobile: 'mobile',\n} as const;\n\ntype DeviceType = keyof typeof deviceType;\ntype Breakpoint = keyof Breakpoints | undefined;\n\ntype BreakpointAndDevice = {\n matchedBreakpoint: Breakpoint;\n matchedDeviceType: DeviceType;\n};\n\nexport const useBreakpoint = ({\n breakpoints,\n}: {\n breakpoints: Breakpoints;\n}): BreakpointAndDevice => {\n const supportsMatchMedia =\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof window?.matchMedia === 'function';\n\n const breakpointsTokenAndQueryCollection = useMemo(\n () =>\n (supportsMatchMedia\n ? Object.entries(breakpoints).map(([token, screenSize], index, breakpointsArray) => {\n const min = screenSize;\n const maxValue = breakpointsArray[index + 1]?.[1];\n const mediaQuery = getMediaQuery({ min, max: maxValue ? maxValue - 1 : undefined });\n return { token, screenSize, mediaQuery };\n })\n : []) as {\n token: keyof Breakpoints;\n screenSize: number;\n mediaQuery: string;\n }[],\n [breakpoints, supportsMatchMedia],\n );\n\n const getMatchedDeviceType = useCallback((matchedBreakpoint: Breakpoint): DeviceType => {\n let matchedDeviceType: DeviceType = deviceType.mobile;\n const platform = getPlatformType();\n if (platform === 'react-native') {\n matchedDeviceType = deviceType.mobile;\n } else if (platform === 'browser') {\n if (matchedBreakpoint && ['base', 'xs', 's'].includes(matchedBreakpoint)) {\n // tablet is also categorised as mobile\n matchedDeviceType = deviceType.mobile;\n } else {\n matchedDeviceType = deviceType.desktop;\n }\n } else if (platform === 'node') {\n //@TODO: Check for useragent for node\n matchedDeviceType = deviceType.desktop;\n }\n return matchedDeviceType;\n }, []);\n\n const getMatchedBreakpoint = useCallback(\n (event?: MediaQueryListEvent): Breakpoint => {\n const matchedBreakpoint =\n breakpointsTokenAndQueryCollection.find(({ mediaQuery = '' }) => {\n // this will run whenever mediaQuery change event is triggered\n if (event?.media === mediaQuery) {\n return true;\n }\n // this will run when the state is initialised for the first time and hence the event object will be empty so we'll fallback to browser's window object\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return {\n matchedBreakpoint,\n matchedDeviceType,\n };\n });\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return undefined;\n }\n\n const handleMediaQueryChange = (event: MediaQueryListEvent): void => {\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint(event);\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n\n return { matchedBreakpoint, matchedDeviceType };\n });\n };\n\n const mediaQueryInstances = breakpointsTokenAndQueryCollection.map(({ mediaQuery = '' }) => {\n const mediaQueryInstance = window.matchMedia(mediaQuery);\n /**\n * the mediaquery event listener is available on mediaQuery instances and not `window`\n * we iterate over all the breakpoints we have, register each instance and store them as `mediaQueryInstances` so we can later unregister all of them.\n */\n if (mediaQueryInstance.addEventListener) {\n mediaQueryInstance.addEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using addListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener\n mediaQueryInstance.addListener(handleMediaQueryChange);\n }\n return mediaQueryInstance;\n });\n\n return (): void => {\n mediaQueryInstances.forEach((mediaQueryInstance) => {\n if (mediaQueryInstance.removeEventListener) {\n mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using removeListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/removeListener\n mediaQueryInstance.removeListener(handleMediaQueryChange);\n }\n });\n };\n }, [\n breakpointsTokenAndQueryCollection,\n getMatchedBreakpoint,\n getMatchedDeviceType,\n supportsMatchMedia,\n ]);\n\n // @TODO: handle SSR scenarios\n return breakpointAndDevice;\n};\n","import type { StringWithAutocomplete } from '~utils/types';\nimport type {\n Border,\n Breakpoints,\n Motion,\n Spacing,\n TypographyWithPlatforms,\n ElevationWithColorModes,\n} from '~tokens/global';\n\nexport type ColorSchemeNames = 'dark' | 'light';\nexport type ColorSchemeNamesInput = ColorSchemeNames | 'system';\n\nexport type ColorSchemeModes = 'onDark' | 'onLight';\n\nexport type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';\n\nexport type ColorContrastTypes = 'low' | 'high';\n\nexport type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';\n\nexport type ColorContrast = {\n [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;\n};\n\n// @TODO: this shall rather be Surface = 'level1' | 'level2' | 'level3' to keep in sync with color tokens\nexport type SurfaceLevels = 1 | 2 | 3;\n\nexport type ActionStates = {\n default: string;\n hover: string;\n focus: string;\n active: string;\n disabled: string;\n};\n\nexport type LinkActionStates = ActionStates & {\n visited: string;\n};\n\nexport type ActionStatesWithContrast = {\n default: ColorContrast;\n hover: ColorContrast;\n focus: ColorContrast;\n active: ColorContrast;\n disabled: ColorContrast;\n};\n\nexport type ActionStatesWithLowContrast = {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n};\n\nexport type LinkActionStatesWithContrast = ActionStatesWithContrast & {\n visited: ColorContrast;\n};\n\nexport type ActionVariants = {\n primary: ActionStates;\n secondary: ActionStates;\n tertiary: ActionStates;\n link: LinkActionStates;\n};\n\nexport type ActionVariantsWithContrast = {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithContrast;\n tertiary: ActionStatesWithContrast;\n link: ActionStatesWithContrast;\n};\n\nexport type SecondaryFeedbackActionStatesWithContrast = {\n secondary: {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n };\n};\n\n// export type ActionProperties = {\n// background: ActionVariants;\n// border: ActionVariants;\n// text: ActionVariants;\n// icon: ActionVariants;\n// };\n\nexport type FeedbackActions = {\n action: {\n background: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n border: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n text: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n icon: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n };\n};\n\nexport type WhiteColors = {\n background: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n border: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n text: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n icon: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n};\n\nexport type Colors = {\n brand: {\n primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;\n secondary: Record<500, string>;\n gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;\n };\n feedback: {\n background: Record<Feedback, ColorContrast>;\n border: Record<Feedback, ColorContrast>;\n text: Record<Feedback, ColorContrast>;\n icon: Record<Feedback, ColorContrast>;\n positive: FeedbackActions;\n negative: FeedbackActions;\n information: FeedbackActions;\n notice: FeedbackActions;\n neutral: FeedbackActions;\n };\n surface: {\n background: Record<'level1' | 'level2' | 'level3', ColorContrast>;\n border: Record<'normal' | 'subtle', ColorContrast>;\n text: Record<TextTypes, ColorContrast>;\n action: {\n icon: ActionStatesWithContrast;\n };\n overlay: Record<'background', Record<400 | 800, string>>;\n popup: Record<'background', string>;\n };\n overlay: Record<'background', string>;\n action: {\n background: Omit<ActionVariants, 'link'>;\n border: Omit<ActionVariants, 'link'>;\n text: ActionVariants;\n icon: ActionVariants;\n };\n badge: {\n background: {\n blue: ColorContrast;\n };\n border: {\n blue: ColorContrast;\n };\n text: {\n blue: ColorContrast;\n };\n icon: {\n blue: ColorContrast;\n };\n };\n static: {\n white: string;\n };\n white: {\n action: WhiteColors;\n };\n};\n\nexport type ColorsWithModes = Record<ColorSchemeModes, Colors>;\n\nexport type ThemeTokens = {\n name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object\n border: Border;\n breakpoints: Breakpoints;\n colors: ColorsWithModes;\n motion: Motion;\n elevation: ElevationWithColorModes;\n spacing: Spacing;\n typography: TypographyWithPlatforms;\n};\n\nexport type SpacingValues = `${Spacing[keyof Spacing]}px`;\nexport type BorderWidthValues = `${Border['width'][keyof Border['width']]}px`;\nexport type BorderRadiusValues =\n | `${Border['radius'][Exclude<keyof Border['radius'], 'round'>]}px`\n | `${Border['radius'][Extract<keyof Border['radius'], 'round'>]}`;\n\nexport const colorSchemeNamesInput: ColorSchemeNamesInput[] = ['light', 'dark', 'system'];\n","type LogType = 'error' | 'warn' | 'log';\n\ntype LoggerOptions = {\n message: string;\n moduleName?: string;\n type: LogType;\n};\n\ntype ThrowBladeErrorOptions = {\n message: string;\n moduleName?: string;\n};\n\nconst PREFIX = '[Blade]:';\n\nconst throwBladeError = ({ message, moduleName }: ThrowBladeErrorOptions): void | never => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n throw new Error(`${prefix} ${message}`);\n }\n};\n\nconst getCommonLogger = (\n type: LogType,\n): typeof console.log | typeof console.error | typeof console.warn => {\n switch (type) {\n case 'error':\n return console.error;\n case 'warn':\n return console.warn;\n case 'log':\n default:\n return console.log;\n }\n};\n\nconst logger = ({ message, moduleName, type }: LoggerOptions): void => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n getCommonLogger(type)(`${prefix} ${message}`);\n }\n};\n\nexport { throwBladeError, logger };\n","import { useState, useCallback } from 'react';\nimport { getColorScheme } from '../getColorScheme';\nimport { colorSchemeNamesInput } from '~tokens/theme/theme';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\nimport { throwBladeError } from '~utils/logger';\n\nexport type UseColorScheme = {\n colorScheme: ColorSchemeNames;\n setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;\n};\n\nexport const useColorScheme = (\n initialColorScheme: ColorSchemeNamesInput = 'light',\n): UseColorScheme => {\n // if colorScheme defined use that else fallback to 'light'\n const [colorSchemeState, setColorSchemeState] = useState<ColorSchemeNames>(() =>\n getColorScheme(initialColorScheme),\n );\n\n const setColorScheme = useCallback(function setThemeMode(colorScheme: ColorSchemeNamesInput) {\n if (__DEV__) {\n if (!colorSchemeNamesInput.includes(colorScheme)) {\n throwBladeError({\n message: `Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,\n moduleName: 'useColorScheme',\n });\n }\n }\n setColorSchemeState(getColorScheme(colorScheme));\n }, []);\n\n return {\n colorScheme: colorSchemeState,\n setColorScheme,\n };\n};\n","import * as React from 'react';\nimport { getPlatformType } from './getPlatformType';\n\nconst isBrowser = getPlatformType() == 'browser';\n\n/**\n * useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser\n * (for SSR reasons)\n *\n * React currently throws a warning when using useLayoutEffect on the server.\n * To get around it, we can conditionally useEffect on the server (no-op) and\n * useLayoutEffect in the browser.\n *\n * @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n */\nexport const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;\n","/* eslint-disable consistent-return */\nimport React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\nfunction useInterval(\n callback: () => void,\n { delay, enable }: { delay: number; enable?: boolean },\n): void {\n const intervalRef = React.useRef<number | null>(null);\n const savedCallback = React.useRef(callback);\n\n // keep the callback updated\n useIsomorphicLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n const tick = (): void => savedCallback.current();\n\n if (enable) {\n intervalRef.current = window.setInterval(tick, delay);\n return () => window.clearInterval(intervalRef.current!);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }, [delay, enable]);\n}\n\nexport { useInterval };\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport { getPlatformType } from '../getPlatformType';\n\nconst isReactNative = (): boolean => {\n return getPlatformType() === 'react-native';\n};\n\nexport { isReactNative };\n","import type { Platform } from 'react-native';\n\nexport const getOS = (): typeof Platform.OS => {\n return 'web';\n};\n\nexport const isAndroid = (): boolean => false;\n","import type { Platform } from '.';\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to web type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedWebType = castWebType('' as Example);\n * // ^ string\n * ```\n */\nconst castWebType = <T>(value: T): Platform.CastWeb<T> => {\n return value as Platform.CastWeb<typeof value>;\n};\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to native type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedNativeType = castNativeType('' as Example);\n * // ^ number\n * ```\n */\nconst castNativeType = <T>(value: T): Platform.CastNative<T> => {\n return value as Platform.CastNative<typeof value>;\n};\n\nexport { castWebType, castNativeType };\n","export function makeBorderSize<T extends number>(size: T): `${T}px`;\nexport function makeBorderSize<T extends string>(size: T): T;\nexport function makeBorderSize<T extends number | string>(size: T): `${T}px` | T {\n if (typeof size === 'number') {\n return `${size}px`;\n }\n return size;\n}\n","import type { MakeMotionTime } from './types';\nimport type { Platform } from '~utils';\n\nexport const makeMotionTime = <T extends number>(time: T): Platform.CastWeb<MakeMotionTime<T>> => {\n return `${time}ms`;\n};\n","export const makeSpace = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export const makeTypographySize = (size: number): `${number}rem` => {\n const remValue = size / 16;\n return `${remValue}rem`;\n};\n","export type MakeSize<T extends number> = `${T}px`;\n\nexport const makeSize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","/**\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport const toTitleCase = (inputString: string): string =>\n inputString\n .toLowerCase()\n .split(' ')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n","import type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\n/**\n * a type-safe version of the `usePrevious` hook described here:\n * @see {@link https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state}\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'] {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import { useContext, createContext } from 'react';\nimport type { Theme } from './';\nimport type { UseColorScheme } from '~utils/useColorScheme';\nimport type { TypographyPlatforms } from '~tokens/global';\nimport { throwBladeError } from '~utils/logger';\n\nexport type ThemeContext = UseColorScheme & {\n theme: Theme;\n platform: TypographyPlatforms;\n};\n\nexport const ThemeContext = createContext<ThemeContext>({\n // @ts-expect-error set null\n theme: null,\n colorScheme: 'light',\n platform: 'onDesktop',\n setColorScheme: () => null,\n});\n\nconst useTheme = (): ThemeContext => {\n const themeContext = useContext<ThemeContext>(ThemeContext);\n if (__DEV__) {\n if (!themeContext.theme) {\n throwBladeError({\n message: 'BladeProvider is missing theme',\n moduleName: 'BladeProvider',\n });\n }\n if (themeContext === undefined) {\n throwBladeError({\n message: 'useTheme must be used within BladeProvider',\n moduleName: 'BladeProvider',\n });\n }\n }\n return themeContext;\n};\n\nexport default useTheme;\n"],"names":["getColorScheme","colorScheme","arguments","length","undefined","colorSchemeMediaQueryMap","light","dark","system","supportsMatchMedia","window","matchMedia","matches","getMediaQuery","_ref","min","max","concat","getPlatformType","navigator","product","document","process","deviceType","desktop","mobile","useBreakpoint","_window","breakpoints","breakpointsTokenAndQueryCollection","useMemo","Object","entries","map","_ref2","index","breakpointsArray","_breakpointsArray","_ref3","_slicedToArray","token","screenSize","maxValue","mediaQuery","getMatchedDeviceType","useCallback","matchedBreakpoint","matchedDeviceType","platform","includes","getMatchedBreakpoint","event","_breakpointsTokenAndQ","_breakpointsTokenAndQ2","find","_ref4","_ref4$mediaQuery","media","_useState","useState","_useState2","breakpointAndDevice","setBreakpointAndDevice","useEffect","handleMediaQueryChange","mediaQueryInstances","_ref5","_ref5$mediaQuery","mediaQueryInstance","addEventListener","addListener","forEach","removeEventListener","removeListener","colorSchemeNamesInput","PREFIX","throwBladeError","message","moduleName","prefix","Error","useColorScheme","initialColorScheme","colorSchemeState","setColorSchemeState","setColorScheme","setThemeMode","toString","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useInterval","callback","delay","enable","intervalRef","useRef","savedCallback","current","tick","setInterval","clearInterval","isReactNative","getOS","isAndroid","castWebType","value","castNativeType","makeBorderSize","size","makeMotionTime","time","makeSpace","makeTypographySize","remValue","makeSize","toTitleCase","inputString","toLowerCase","split","word","charAt","toUpperCase","slice","join","usePrevious","ref","ThemeContext","createContext","theme","useTheme","themeContext","useContext"],"mappings":";;;;IAEaA,cAAc,GAAG,SAAjBA,cAAcA,GAAuE;AAAA,EAAA,IAAnEC,WAAkC,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,OAAO,CAAA;AACzE;AACA,EAAA,IAAMG,wBAAwB,GAAG;AAC/BC,IAAAA,KAAK,EAAE,+BAA+B;AACtCC,IAAAA,IAAI,EAAE,8BAA8B;AACpCC,IAAAA,MAAM,EAAE,SAAA;GACT,CAAA;AACD,EAAA,IAAMC,kBAAkB,GACtB,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,UAAU,KAAK,UAAU,CAAA;AAE1E,EAAA,IAAIV,WAAW,KAAK,OAAO,IAAIA,WAAW,KAAK,MAAM,EAAE;AACrD,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAA;AAEA,EAAA,IACEA,WAAW,KAAK,QAAQ,IACxBQ,kBAAkB,IAClBC,MAAM,CAACC,UAAU,CAACN,wBAAwB,CAACE,IAAI,CAAC,CAACK,OAAO,EACxD;AACA,IAAA,OAAO,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,OAAO,OAAO,CAAA;AAChB;;ICzBaC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAA4D;AAAA,EAAA,IAAtDC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG,CAAA;AACtC,EAAA,OAAA,yBAAA,CAAAC,MAAA,CAAiCF,GAAG,EAAA,KAAA,CAAA,CAAAE,MAAA,CAAMD,GAAG,GAAA,mBAAA,CAAAC,MAAA,CAAuBD,GAAG,EAAA,KAAA,CAAA,GAAQ,E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AC;AACdC,QAAAA,OAAO,EAAE,gCAAgC;AACzCC,QAAAA,UAAU,EAAE,eAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;IACA,IAAIsD,YAAY,KAAKhI,SAAS,EAAE;AAC9BwE,MAAAA,eAAe,CAAC;AACdC,QAAAA,OAAO,EAAE,4CAA4C;AACrDC,QAAAA,UAAU,EAAE,eAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;AACF,GAAA;AACA,EAAA,OAAOsD,YAAY,CAAA;AACrB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.development.web.js","sources":["../../src/utils/getColorScheme/getColorScheme.web.ts","../../src/utils/getMediaQuery/getMediaQuery.ts","../../src/utils/getPlatformType/getPlatformType.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/tokens/theme/theme.ts","../../src/utils/logger/logger.ts","../../src/utils/useColorScheme/useColorScheme.ts","../../src/utils/useIsomorphicLayoutEffect.ts","../../src/utils/useInterval.ts","../../src/utils/platform/isReactNative.ts","../../src/utils/platform/getOS.web.ts","../../src/utils/platform/castUtils.ts","../../src/utils/makeBorderSize/makeBorderSize.ts","../../src/utils/makeMotionTime/makeMotionTime.web.ts","../../src/utils/makeSpace/makeSpace.ts","../../src/utils/makeTypographySize/makeTypographySize.web.ts","../../src/utils/makeSize/makeSize.ts","../../src/utils/toTitleCase/toTitleCase.ts","../../src/utils/usePrevious/usePrevious.ts","../../src/components/BladeProvider/useTheme.ts"],"sourcesContent":["import type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\n\nexport const getColorScheme = (colorScheme: ColorSchemeNamesInput = 'light'): ColorSchemeNames => {\n // @TODO: create a useMediaQuery hook with an event listener which will subscribe to changes and move all this logic there\n const colorSchemeMediaQueryMap = {\n light: '(prefers-color-scheme: light)',\n dark: '(prefers-color-scheme: dark)',\n system: 'default',\n };\n const supportsMatchMedia =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n\n if (colorScheme === 'light' || colorScheme === 'dark') {\n return colorScheme;\n }\n\n if (\n colorScheme === 'system' &&\n supportsMatchMedia &&\n window.matchMedia(colorSchemeMediaQueryMap.dark).matches\n ) {\n return 'dark';\n }\n\n return 'light';\n};\n","export const getMediaQuery = ({ min, max }: { min: number; max?: number }): string => {\n return `screen and (min-width: ${min}px)${max ? ` and (max-width: ${max}px)` : ''}`;\n};\n","export type PlatformTypes = 'browser' | 'node' | 'react-native' | 'unknown';\n\nexport const getPlatformType = (): PlatformTypes => {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n if (typeof document !== 'undefined') {\n return 'browser';\n }\n\n if (typeof process !== 'undefined') {\n return 'node';\n }\n\n return 'unknown';\n};\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\n\nconst deviceType = {\n desktop: 'desktop',\n mobile: 'mobile',\n} as const;\n\ntype DeviceType = keyof typeof deviceType;\ntype Breakpoint = keyof Breakpoints | undefined;\n\ntype BreakpointAndDevice = {\n matchedBreakpoint: Breakpoint;\n matchedDeviceType: DeviceType;\n};\n\nexport const useBreakpoint = ({\n breakpoints,\n}: {\n breakpoints: Breakpoints;\n}): BreakpointAndDevice => {\n const supportsMatchMedia =\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof window?.matchMedia === 'function';\n\n const breakpointsTokenAndQueryCollection = useMemo(\n () =>\n (supportsMatchMedia\n ? Object.entries(breakpoints).map(([token, screenSize], index, breakpointsArray) => {\n const min = screenSize;\n const maxValue = breakpointsArray[index + 1]?.[1];\n const mediaQuery = getMediaQuery({ min, max: maxValue ? maxValue - 1 : undefined });\n return { token, screenSize, mediaQuery };\n })\n : []) as {\n token: keyof Breakpoints;\n screenSize: number;\n mediaQuery: string;\n }[],\n [breakpoints, supportsMatchMedia],\n );\n\n const getMatchedDeviceType = useCallback((matchedBreakpoint: Breakpoint): DeviceType => {\n let matchedDeviceType: DeviceType = deviceType.mobile;\n const platform = getPlatformType();\n if (platform === 'react-native') {\n matchedDeviceType = deviceType.mobile;\n } else if (platform === 'browser') {\n if (matchedBreakpoint && ['base', 'xs', 's'].includes(matchedBreakpoint)) {\n // tablet is also categorised as mobile\n matchedDeviceType = deviceType.mobile;\n } else {\n matchedDeviceType = deviceType.desktop;\n }\n } else if (platform === 'node') {\n //@TODO: Check for useragent for node\n matchedDeviceType = deviceType.desktop;\n }\n return matchedDeviceType;\n }, []);\n\n const getMatchedBreakpoint = useCallback(\n (event?: MediaQueryListEvent): Breakpoint => {\n const matchedBreakpoint =\n breakpointsTokenAndQueryCollection.find(({ mediaQuery = '' }) => {\n // this will run whenever mediaQuery change event is triggered\n if (event?.media === mediaQuery) {\n return true;\n }\n // this will run when the state is initialised for the first time and hence the event object will be empty so we'll fallback to browser's window object\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return {\n matchedBreakpoint,\n matchedDeviceType,\n };\n });\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return undefined;\n }\n\n const handleMediaQueryChange = (event: MediaQueryListEvent): void => {\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint(event);\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n\n return { matchedBreakpoint, matchedDeviceType };\n });\n };\n\n const mediaQueryInstances = breakpointsTokenAndQueryCollection.map(({ mediaQuery = '' }) => {\n const mediaQueryInstance = window.matchMedia(mediaQuery);\n /**\n * the mediaquery event listener is available on mediaQuery instances and not `window`\n * we iterate over all the breakpoints we have, register each instance and store them as `mediaQueryInstances` so we can later unregister all of them.\n */\n if (mediaQueryInstance.addEventListener) {\n mediaQueryInstance.addEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using addListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener\n mediaQueryInstance.addListener(handleMediaQueryChange);\n }\n return mediaQueryInstance;\n });\n\n return (): void => {\n mediaQueryInstances.forEach((mediaQueryInstance) => {\n if (mediaQueryInstance.removeEventListener) {\n mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using removeListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/removeListener\n mediaQueryInstance.removeListener(handleMediaQueryChange);\n }\n });\n };\n }, [\n breakpointsTokenAndQueryCollection,\n getMatchedBreakpoint,\n getMatchedDeviceType,\n supportsMatchMedia,\n ]);\n\n // @TODO: handle SSR scenarios\n return breakpointAndDevice;\n};\n\nexport type { DeviceType };\n","import type { StringWithAutocomplete } from '~utils/types';\nimport type {\n Border,\n Breakpoints,\n Motion,\n Spacing,\n TypographyWithPlatforms,\n ElevationWithColorModes,\n} from '~tokens/global';\n\nexport type ColorSchemeNames = 'dark' | 'light';\nexport type ColorSchemeNamesInput = ColorSchemeNames | 'system';\n\nexport type ColorSchemeModes = 'onDark' | 'onLight';\n\nexport type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';\n\nexport type ColorContrastTypes = 'low' | 'high';\n\nexport type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';\n\nexport type ColorContrast = {\n [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;\n};\n\n// @TODO: this shall rather be Surface = 'level1' | 'level2' | 'level3' to keep in sync with color tokens\nexport type SurfaceLevels = 1 | 2 | 3;\n\nexport type ActionStates = {\n default: string;\n hover: string;\n focus: string;\n active: string;\n disabled: string;\n};\n\nexport type LinkActionStates = ActionStates & {\n visited: string;\n};\n\nexport type ActionStatesWithContrast = {\n default: ColorContrast;\n hover: ColorContrast;\n focus: ColorContrast;\n active: ColorContrast;\n disabled: ColorContrast;\n};\n\nexport type ActionStatesWithLowContrast = {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n};\n\nexport type LinkActionStatesWithContrast = ActionStatesWithContrast & {\n visited: ColorContrast;\n};\n\nexport type ActionVariants = {\n primary: ActionStates;\n secondary: ActionStates;\n tertiary: ActionStates;\n link: LinkActionStates;\n};\n\nexport type ActionVariantsWithContrast = {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithContrast;\n tertiary: ActionStatesWithContrast;\n link: ActionStatesWithContrast;\n};\n\nexport type SecondaryFeedbackActionStatesWithContrast = {\n secondary: {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n };\n};\n\n// export type ActionProperties = {\n// background: ActionVariants;\n// border: ActionVariants;\n// text: ActionVariants;\n// icon: ActionVariants;\n// };\n\nexport type FeedbackActions = {\n action: {\n background: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n border: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n text: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n icon: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n };\n};\n\nexport type WhiteColors = {\n background: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n border: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n text: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n icon: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n};\n\nexport type Colors = {\n brand: {\n primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;\n secondary: Record<500, string>;\n gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;\n };\n feedback: {\n background: Record<Feedback, ColorContrast>;\n border: Record<Feedback, ColorContrast>;\n text: Record<Feedback, ColorContrast>;\n icon: Record<Feedback, ColorContrast>;\n positive: FeedbackActions;\n negative: FeedbackActions;\n information: FeedbackActions;\n notice: FeedbackActions;\n neutral: FeedbackActions;\n };\n surface: {\n background: Record<'level1' | 'level2' | 'level3', ColorContrast>;\n border: Record<'normal' | 'subtle', ColorContrast>;\n text: Record<TextTypes, ColorContrast>;\n action: {\n icon: ActionStatesWithContrast;\n };\n overlay: Record<'background', Record<400 | 800, string>>;\n popup: Record<'background', string>;\n };\n overlay: Record<'background', string>;\n action: {\n background: Omit<ActionVariants, 'link'>;\n border: Omit<ActionVariants, 'link'>;\n text: ActionVariants;\n icon: ActionVariants;\n };\n badge: {\n background: {\n blue: ColorContrast;\n };\n border: {\n blue: ColorContrast;\n };\n text: {\n blue: ColorContrast;\n };\n icon: {\n blue: ColorContrast;\n };\n };\n static: {\n white: string;\n };\n white: {\n action: WhiteColors;\n };\n};\n\nexport type ColorsWithModes = Record<ColorSchemeModes, Colors>;\n\nexport type ThemeTokens = {\n name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object\n border: Border;\n breakpoints: Breakpoints;\n colors: ColorsWithModes;\n motion: Motion;\n elevation: ElevationWithColorModes;\n spacing: Spacing;\n typography: TypographyWithPlatforms;\n};\n\nexport type SpacingValues = `${Spacing[keyof Spacing]}px`;\nexport type BorderWidthValues = `${Border['width'][keyof Border['width']]}px`;\nexport type BorderRadiusValues =\n | `${Border['radius'][Exclude<keyof Border['radius'], 'round'>]}px`\n | `${Border['radius'][Extract<keyof Border['radius'], 'round'>]}`;\n\nexport const colorSchemeNamesInput: ColorSchemeNamesInput[] = ['light', 'dark', 'system'];\n","type LogType = 'error' | 'warn' | 'log';\n\ntype LoggerOptions = {\n message: string;\n moduleName?: string;\n type: LogType;\n};\n\ntype ThrowBladeErrorOptions = {\n message: string;\n moduleName?: string;\n};\n\nconst PREFIX = '[Blade]:';\n\nconst throwBladeError = ({ message, moduleName }: ThrowBladeErrorOptions): void | never => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n throw new Error(`${prefix} ${message}`);\n }\n};\n\nconst getCommonLogger = (\n type: LogType,\n): typeof console.log | typeof console.error | typeof console.warn => {\n switch (type) {\n case 'error':\n return console.error;\n case 'warn':\n return console.warn;\n case 'log':\n default:\n return console.log;\n }\n};\n\nconst logger = ({ message, moduleName, type }: LoggerOptions): void => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n getCommonLogger(type)(`${prefix} ${message}`);\n }\n};\n\nexport { throwBladeError, logger };\n","import { useState, useCallback } from 'react';\nimport { getColorScheme } from '../getColorScheme';\nimport { colorSchemeNamesInput } from '~tokens/theme/theme';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\nimport { throwBladeError } from '~utils/logger';\n\nexport type UseColorScheme = {\n colorScheme: ColorSchemeNames;\n setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;\n};\n\nexport const useColorScheme = (\n initialColorScheme: ColorSchemeNamesInput = 'light',\n): UseColorScheme => {\n // if colorScheme defined use that else fallback to 'light'\n const [colorSchemeState, setColorSchemeState] = useState<ColorSchemeNames>(() =>\n getColorScheme(initialColorScheme),\n );\n\n const setColorScheme = useCallback(function setThemeMode(colorScheme: ColorSchemeNamesInput) {\n if (__DEV__) {\n if (!colorSchemeNamesInput.includes(colorScheme)) {\n throwBladeError({\n message: `Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,\n moduleName: 'useColorScheme',\n });\n }\n }\n setColorSchemeState(getColorScheme(colorScheme));\n }, []);\n\n return {\n colorScheme: colorSchemeState,\n setColorScheme,\n };\n};\n","import * as React from 'react';\nimport { getPlatformType } from './getPlatformType';\n\nconst isBrowser = getPlatformType() == 'browser';\n\n/**\n * useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser\n * (for SSR reasons)\n *\n * React currently throws a warning when using useLayoutEffect on the server.\n * To get around it, we can conditionally useEffect on the server (no-op) and\n * useLayoutEffect in the browser.\n *\n * @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n */\nexport const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;\n","/* eslint-disable consistent-return */\nimport React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\nfunction useInterval(\n callback: () => void,\n { delay, enable }: { delay: number; enable?: boolean },\n): void {\n const intervalRef = React.useRef<number | null>(null);\n const savedCallback = React.useRef(callback);\n\n // keep the callback updated\n useIsomorphicLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n const tick = (): void => savedCallback.current();\n\n if (enable) {\n intervalRef.current = window.setInterval(tick, delay);\n return () => window.clearInterval(intervalRef.current!);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }, [delay, enable]);\n}\n\nexport { useInterval };\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport { getPlatformType } from '../getPlatformType';\n\nconst isReactNative = (): boolean => {\n return getPlatformType() === 'react-native';\n};\n\nexport { isReactNative };\n","import type { Platform } from 'react-native';\n\nexport const getOS = (): typeof Platform.OS => {\n return 'web';\n};\n\nexport const isAndroid = (): boolean => false;\n","import type { Platform } from '.';\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to web type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedWebType = castWebType('' as Example);\n * // ^ string\n * ```\n */\nconst castWebType = <T>(value: T): Platform.CastWeb<T> => {\n return value as Platform.CastWeb<typeof value>;\n};\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to native type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedNativeType = castNativeType('' as Example);\n * // ^ number\n * ```\n */\nconst castNativeType = <T>(value: T): Platform.CastNative<T> => {\n return value as Platform.CastNative<typeof value>;\n};\n\nexport { castWebType, castNativeType };\n","export function makeBorderSize<T extends number>(size: T): `${T}px`;\nexport function makeBorderSize<T extends string>(size: T): T;\nexport function makeBorderSize<T extends number | string>(size: T): `${T}px` | T {\n if (typeof size === 'number') {\n return `${size}px`;\n }\n return size;\n}\n","import type { MakeMotionTime } from './types';\nimport type { Platform } from '~utils';\n\nexport const makeMotionTime = <T extends number>(time: T): Platform.CastWeb<MakeMotionTime<T>> => {\n return `${time}ms`;\n};\n","export const makeSpace = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export const makeTypographySize = (size: number): `${number}rem` => {\n const remValue = size / 16;\n return `${remValue}rem`;\n};\n","export type MakeSize<T extends number> = `${T}px`;\n\nexport const makeSize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","/**\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport const toTitleCase = (inputString: string): string =>\n inputString\n .toLowerCase()\n .split(' ')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n","import type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\n/**\n * a type-safe version of the `usePrevious` hook described here:\n * @see {@link https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state}\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'] {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import { useContext, createContext } from 'react';\nimport type { Theme } from './';\nimport type { UseColorScheme } from '~utils/useColorScheme';\nimport type { TypographyPlatforms } from '~tokens/global';\nimport { throwBladeError } from '~utils/logger';\n\nexport type ThemeContext = UseColorScheme & {\n theme: Theme;\n platform: TypographyPlatforms;\n};\n\nexport const ThemeContext = createContext<ThemeContext>({\n // @ts-expect-error set null\n theme: null,\n colorScheme: 'light',\n platform: 'onDesktop',\n setColorScheme: () => null,\n});\n\nconst useTheme = (): ThemeContext => {\n const themeContext = useContext<ThemeContext>(ThemeContext);\n if (__DEV__) {\n if (!themeContext.theme) {\n throwBladeError({\n message: 'BladeProvider is missing theme',\n moduleName: 'BladeProvider',\n });\n }\n if (themeContext === undefined) {\n throwBladeError({\n message: 'useTheme must be used within BladeProvider',\n moduleName: 'BladeProvider',\n });\n }\n }\n return themeContext;\n};\n\nexport default useTheme;\n"],"names":["getColorScheme","colorScheme","arguments","length","undefined","colorSchemeMediaQueryMap","light","dark","system","supportsMatchMedia","window","matchMedia","matches","getMediaQuery","_ref","min","max","concat","getPlatformType","navigator","product","document","process","deviceType","desktop","mobile","useBreakpoint","_window","breakpoints","breakpointsTokenAndQueryCollection","useMemo","Object","entries","map","_ref2","index","breakpointsArray","_breakpointsArray","_ref3","_slicedToArray","token","screenSize","maxValue","mediaQuery","getMatchedDeviceType","useCallback","matchedBreakpoint","matchedDeviceType","platform","includes","getMatchedBreakpoint","event","_breakpointsTokenAndQ","_breakpointsTokenAndQ2","find","_ref4","_ref4$mediaQuery","media","_useState","useState","_useState2","breakpointAndDevice","setBreakpointAndDevice","useEffect","handleMediaQueryChange","mediaQueryInstances","_ref5","_ref5$mediaQuery","mediaQueryInstance","addEventListener","addListener","forEach","removeEventListener","removeListener","colorSchemeNamesInput","PREFIX","throwBladeError","message","moduleName","prefix","Error","useColorScheme","initialColorScheme","colorSchemeState","setColorSchemeState","setColorScheme","setThemeMode","toString","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useInterval","callback","delay","enable","intervalRef","useRef","savedCallback","current","tick","setInterval","clearInterval","isReactNative","getOS","isAndroid","castWebType","value","castNativeType","makeBorderSize","size","makeMotionTime","time","makeSpace","makeTypographySize","remValue","makeSize","toTitleCase","inputString","toLowerCase","split","word","charAt","toUpperCase","slice","join","usePrevious","ref","ThemeContext","createContext","theme","useTheme","themeContext","useContext"],"mappings":";;;;IAEaA,cAAc,GAAG,SAAjBA,cAAcA,GAAuE;AAAA,EAAA,IAAnEC,WAAkC,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,OAAO,CAAA;AACzE;AACA,EAAA,IAAMG,wBAAwB,GAAG;AAC/BC,IAAAA,KAAK,EAAE,+BAA+B;AACtCC,IAAAA,IAAI,EAAE,8BAA8B;AACpCC,IAAAA,MAAM,EAAE,SAAA;GACT,CAAA;AACD,EAAA,IAAMC,kBAAkB,GACtB,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,UAAU,KAAK,UAAU,CAAA;AAE1E,EAAA,IAAIV,WAAW,KAAK,OAAO,IAAIA,WAAW,KAAK,MAAM,EAAE;AACrD,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAA;AAEA,EAAA,IACEA,WAAW,KAAK,QAAQ,IACxBQ,kBAAkB,IAClBC,MAAM,CAACC,UAAU,CAACN,wBAAwB,CAACE,IAAI,CAAC,CAACK,OAAO,EACxD;AACA,IAAA,OAAO,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,OAAO,OAAO,CAAA;AAChB;;ICzBaC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAA4D;AAAA,EAAA,IAAtDC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG,CAAA;AACtC,EAAA,OAAA,yBAAA,CAAAC,MAAA,CAAiCF,GAAG,EA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CAAeL,YAAY,CAAC,CAAA;AAC3D,EAAa;AACX,IAAA,IAAI,CAACI,YAAY,CAACF,KAAK,EAAE;AACvBtD,MAAAA,eAAe,CAAC;AACdC,QAAAA,OAAO,EAAE,gCAAgC;AACzCC,QAAAA,UAAU,EAAE,eAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;IACA,IAAIsD,YAAY,KAAKhI,SAAS,EAAE;AAC9BwE,MAAAA,eAAe,CAAC;AACdC,QAAAA,OAAO,EAAE,4CAA4C;AACrDC,QAAAA,UAAU,EAAE,eAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;AACF,GAAA;AACA,EAAA,OAAOsD,YAAY,CAAA;AACrB;;;;"}
|
|
@@ -756,4 +756,4 @@ declare type ThemeContext = UseColorScheme & {
|
|
|
756
756
|
declare const ThemeContext: React.Context<ThemeContext>;
|
|
757
757
|
declare const useTheme: () => ThemeContext;
|
|
758
758
|
|
|
759
|
-
export { MakeSize, Platform, PlatformTypes, ThemeContext, UseColorScheme, castNativeType, castWebType, getColorScheme, getMediaQuery, getOS, getPlatformType, isAndroid, isReactNative, makeBorderSize, makeMotionTime, makeSize, makeSpace, makeTypographySize, toTitleCase, useBreakpoint, useColorScheme, useInterval, usePrevious, useTheme };
|
|
759
|
+
export { DeviceType, MakeSize, Platform, PlatformTypes, ThemeContext, UseColorScheme, castNativeType, castWebType, getColorScheme, getMediaQuery, getOS, getPlatformType, isAndroid, isReactNative, makeBorderSize, makeMotionTime, makeSize, makeSpace, makeTypographySize, toTitleCase, useBreakpoint, useColorScheme, useInterval, usePrevious, useTheme };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sources":["../../src/utils/getColorScheme/getColorScheme.native.ts","../../src/utils/getMediaQuery/getMediaQuery.ts","../../src/utils/getPlatformType/getPlatformType.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/tokens/theme/theme.ts","../../src/utils/logger/logger.ts","../../src/utils/useColorScheme/useColorScheme.ts","../../src/utils/useIsomorphicLayoutEffect.ts","../../src/utils/useInterval.ts","../../src/utils/platform/isReactNative.ts","../../src/utils/platform/getOS.native.ts","../../src/utils/platform/castUtils.ts","../../src/utils/makeBorderSize/makeBorderSize.ts","../../src/utils/makeMotionTime/makeMotionTime.native.ts","../../src/utils/makeSpace/makeSpace.ts","../../src/utils/makeTypographySize/makeTypographySize.native.ts","../../src/utils/makeSize/makeSize.ts","../../src/utils/toTitleCase/toTitleCase.ts","../../src/utils/usePrevious/usePrevious.ts","../../src/components/BladeProvider/useTheme.ts"],"sourcesContent":["import { Appearance } from 'react-native';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\n\nexport const getColorScheme = (colorScheme: ColorSchemeNamesInput = 'light'): ColorSchemeNames => {\n // @TODO: convert this to hook as Appearance API also adds an eventListener which subscribes to the colorscheme changes on the device\n if (colorScheme === 'light' || colorScheme === 'dark') {\n return colorScheme;\n }\n\n if (colorScheme === 'system') {\n return Appearance.getColorScheme() ?? 'light';\n }\n\n return 'light';\n};\n","export const getMediaQuery = ({ min, max }: { min: number; max?: number }): string => {\n return `screen and (min-width: ${min}px)${max ? ` and (max-width: ${max}px)` : ''}`;\n};\n","export type PlatformTypes = 'browser' | 'node' | 'react-native' | 'unknown';\n\nexport const getPlatformType = (): PlatformTypes => {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n if (typeof document !== 'undefined') {\n return 'browser';\n }\n\n if (typeof process !== 'undefined') {\n return 'node';\n }\n\n return 'unknown';\n};\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\n\nconst deviceType = {\n desktop: 'desktop',\n mobile: 'mobile',\n} as const;\n\ntype DeviceType = keyof typeof deviceType;\ntype Breakpoint = keyof Breakpoints | undefined;\n\ntype BreakpointAndDevice = {\n matchedBreakpoint: Breakpoint;\n matchedDeviceType: DeviceType;\n};\n\nexport const useBreakpoint = ({\n breakpoints,\n}: {\n breakpoints: Breakpoints;\n}): BreakpointAndDevice => {\n const supportsMatchMedia =\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof window?.matchMedia === 'function';\n\n const breakpointsTokenAndQueryCollection = useMemo(\n () =>\n (supportsMatchMedia\n ? Object.entries(breakpoints).map(([token, screenSize], index, breakpointsArray) => {\n const min = screenSize;\n const maxValue = breakpointsArray[index + 1]?.[1];\n const mediaQuery = getMediaQuery({ min, max: maxValue ? maxValue - 1 : undefined });\n return { token, screenSize, mediaQuery };\n })\n : []) as {\n token: keyof Breakpoints;\n screenSize: number;\n mediaQuery: string;\n }[],\n [breakpoints, supportsMatchMedia],\n );\n\n const getMatchedDeviceType = useCallback((matchedBreakpoint: Breakpoint): DeviceType => {\n let matchedDeviceType: DeviceType = deviceType.mobile;\n const platform = getPlatformType();\n if (platform === 'react-native') {\n matchedDeviceType = deviceType.mobile;\n } else if (platform === 'browser') {\n if (matchedBreakpoint && ['base', 'xs', 's'].includes(matchedBreakpoint)) {\n // tablet is also categorised as mobile\n matchedDeviceType = deviceType.mobile;\n } else {\n matchedDeviceType = deviceType.desktop;\n }\n } else if (platform === 'node') {\n //@TODO: Check for useragent for node\n matchedDeviceType = deviceType.desktop;\n }\n return matchedDeviceType;\n }, []);\n\n const getMatchedBreakpoint = useCallback(\n (event?: MediaQueryListEvent): Breakpoint => {\n const matchedBreakpoint =\n breakpointsTokenAndQueryCollection.find(({ mediaQuery = '' }) => {\n // this will run whenever mediaQuery change event is triggered\n if (event?.media === mediaQuery) {\n return true;\n }\n // this will run when the state is initialised for the first time and hence the event object will be empty so we'll fallback to browser's window object\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return {\n matchedBreakpoint,\n matchedDeviceType,\n };\n });\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return undefined;\n }\n\n const handleMediaQueryChange = (event: MediaQueryListEvent): void => {\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint(event);\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n\n return { matchedBreakpoint, matchedDeviceType };\n });\n };\n\n const mediaQueryInstances = breakpointsTokenAndQueryCollection.map(({ mediaQuery = '' }) => {\n const mediaQueryInstance = window.matchMedia(mediaQuery);\n /**\n * the mediaquery event listener is available on mediaQuery instances and not `window`\n * we iterate over all the breakpoints we have, register each instance and store them as `mediaQueryInstances` so we can later unregister all of them.\n */\n if (mediaQueryInstance.addEventListener) {\n mediaQueryInstance.addEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using addListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener\n mediaQueryInstance.addListener(handleMediaQueryChange);\n }\n return mediaQueryInstance;\n });\n\n return (): void => {\n mediaQueryInstances.forEach((mediaQueryInstance) => {\n if (mediaQueryInstance.removeEventListener) {\n mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using removeListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/removeListener\n mediaQueryInstance.removeListener(handleMediaQueryChange);\n }\n });\n };\n }, [\n breakpointsTokenAndQueryCollection,\n getMatchedBreakpoint,\n getMatchedDeviceType,\n supportsMatchMedia,\n ]);\n\n // @TODO: handle SSR scenarios\n return breakpointAndDevice;\n};\n","import type { StringWithAutocomplete } from '~utils/types';\nimport type {\n Border,\n Breakpoints,\n Motion,\n Spacing,\n TypographyWithPlatforms,\n ElevationWithColorModes,\n} from '~tokens/global';\n\nexport type ColorSchemeNames = 'dark' | 'light';\nexport type ColorSchemeNamesInput = ColorSchemeNames | 'system';\n\nexport type ColorSchemeModes = 'onDark' | 'onLight';\n\nexport type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';\n\nexport type ColorContrastTypes = 'low' | 'high';\n\nexport type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';\n\nexport type ColorContrast = {\n [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;\n};\n\n// @TODO: this shall rather be Surface = 'level1' | 'level2' | 'level3' to keep in sync with color tokens\nexport type SurfaceLevels = 1 | 2 | 3;\n\nexport type ActionStates = {\n default: string;\n hover: string;\n focus: string;\n active: string;\n disabled: string;\n};\n\nexport type LinkActionStates = ActionStates & {\n visited: string;\n};\n\nexport type ActionStatesWithContrast = {\n default: ColorContrast;\n hover: ColorContrast;\n focus: ColorContrast;\n active: ColorContrast;\n disabled: ColorContrast;\n};\n\nexport type ActionStatesWithLowContrast = {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n};\n\nexport type LinkActionStatesWithContrast = ActionStatesWithContrast & {\n visited: ColorContrast;\n};\n\nexport type ActionVariants = {\n primary: ActionStates;\n secondary: ActionStates;\n tertiary: ActionStates;\n link: LinkActionStates;\n};\n\nexport type ActionVariantsWithContrast = {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithContrast;\n tertiary: ActionStatesWithContrast;\n link: ActionStatesWithContrast;\n};\n\nexport type SecondaryFeedbackActionStatesWithContrast = {\n secondary: {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n };\n};\n\n// export type ActionProperties = {\n// background: ActionVariants;\n// border: ActionVariants;\n// text: ActionVariants;\n// icon: ActionVariants;\n// };\n\nexport type FeedbackActions = {\n action: {\n background: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n border: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n text: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n icon: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n };\n};\n\nexport type WhiteColors = {\n background: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n border: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n text: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n icon: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n};\n\nexport type Colors = {\n brand: {\n primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;\n secondary: Record<500, string>;\n gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;\n };\n feedback: {\n background: Record<Feedback, ColorContrast>;\n border: Record<Feedback, ColorContrast>;\n text: Record<Feedback, ColorContrast>;\n icon: Record<Feedback, ColorContrast>;\n positive: FeedbackActions;\n negative: FeedbackActions;\n information: FeedbackActions;\n notice: FeedbackActions;\n neutral: FeedbackActions;\n };\n surface: {\n background: Record<'level1' | 'level2' | 'level3', ColorContrast>;\n border: Record<'normal' | 'subtle', ColorContrast>;\n text: Record<TextTypes, ColorContrast>;\n action: {\n icon: ActionStatesWithContrast;\n };\n overlay: Record<'background', Record<400 | 800, string>>;\n popup: Record<'background', string>;\n };\n overlay: Record<'background', string>;\n action: {\n background: Omit<ActionVariants, 'link'>;\n border: Omit<ActionVariants, 'link'>;\n text: ActionVariants;\n icon: ActionVariants;\n };\n badge: {\n background: {\n blue: ColorContrast;\n };\n border: {\n blue: ColorContrast;\n };\n text: {\n blue: ColorContrast;\n };\n icon: {\n blue: ColorContrast;\n };\n };\n static: {\n white: string;\n };\n white: {\n action: WhiteColors;\n };\n};\n\nexport type ColorsWithModes = Record<ColorSchemeModes, Colors>;\n\nexport type ThemeTokens = {\n name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object\n border: Border;\n breakpoints: Breakpoints;\n colors: ColorsWithModes;\n motion: Motion;\n elevation: ElevationWithColorModes;\n spacing: Spacing;\n typography: TypographyWithPlatforms;\n};\n\nexport type SpacingValues = `${Spacing[keyof Spacing]}px`;\nexport type BorderWidthValues = `${Border['width'][keyof Border['width']]}px`;\nexport type BorderRadiusValues =\n | `${Border['radius'][Exclude<keyof Border['radius'], 'round'>]}px`\n | `${Border['radius'][Extract<keyof Border['radius'], 'round'>]}`;\n\nexport const colorSchemeNamesInput: ColorSchemeNamesInput[] = ['light', 'dark', 'system'];\n","type LogType = 'error' | 'warn' | 'log';\n\ntype LoggerOptions = {\n message: string;\n moduleName?: string;\n type: LogType;\n};\n\ntype ThrowBladeErrorOptions = {\n message: string;\n moduleName?: string;\n};\n\nconst PREFIX = '[Blade]:';\n\nconst throwBladeError = ({ message, moduleName }: ThrowBladeErrorOptions): void | never => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n throw new Error(`${prefix} ${message}`);\n }\n};\n\nconst getCommonLogger = (\n type: LogType,\n): typeof console.log | typeof console.error | typeof console.warn => {\n switch (type) {\n case 'error':\n return console.error;\n case 'warn':\n return console.warn;\n case 'log':\n default:\n return console.log;\n }\n};\n\nconst logger = ({ message, moduleName, type }: LoggerOptions): void => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n getCommonLogger(type)(`${prefix} ${message}`);\n }\n};\n\nexport { throwBladeError, logger };\n","import { useState, useCallback } from 'react';\nimport { getColorScheme } from '../getColorScheme';\nimport { colorSchemeNamesInput } from '~tokens/theme/theme';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\nimport { throwBladeError } from '~utils/logger';\n\nexport type UseColorScheme = {\n colorScheme: ColorSchemeNames;\n setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;\n};\n\nexport const useColorScheme = (\n initialColorScheme: ColorSchemeNamesInput = 'light',\n): UseColorScheme => {\n // if colorScheme defined use that else fallback to 'light'\n const [colorSchemeState, setColorSchemeState] = useState<ColorSchemeNames>(() =>\n getColorScheme(initialColorScheme),\n );\n\n const setColorScheme = useCallback(function setThemeMode(colorScheme: ColorSchemeNamesInput) {\n if (__DEV__) {\n if (!colorSchemeNamesInput.includes(colorScheme)) {\n throwBladeError({\n message: `Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,\n moduleName: 'useColorScheme',\n });\n }\n }\n setColorSchemeState(getColorScheme(colorScheme));\n }, []);\n\n return {\n colorScheme: colorSchemeState,\n setColorScheme,\n };\n};\n","import * as React from 'react';\nimport { getPlatformType } from './getPlatformType';\n\nconst isBrowser = getPlatformType() == 'browser';\n\n/**\n * useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser\n * (for SSR reasons)\n *\n * React currently throws a warning when using useLayoutEffect on the server.\n * To get around it, we can conditionally useEffect on the server (no-op) and\n * useLayoutEffect in the browser.\n *\n * @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n */\nexport const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;\n","/* eslint-disable consistent-return */\nimport React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\nfunction useInterval(\n callback: () => void,\n { delay, enable }: { delay: number; enable?: boolean },\n): void {\n const intervalRef = React.useRef<number | null>(null);\n const savedCallback = React.useRef(callback);\n\n // keep the callback updated\n useIsomorphicLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n const tick = (): void => savedCallback.current();\n\n if (enable) {\n intervalRef.current = window.setInterval(tick, delay);\n return () => window.clearInterval(intervalRef.current!);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }, [delay, enable]);\n}\n\nexport { useInterval };\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport { getPlatformType } from '../getPlatformType';\n\nconst isReactNative = (): boolean => {\n return getPlatformType() === 'react-native';\n};\n\nexport { isReactNative };\n","import { Platform } from 'react-native';\n\nexport const getOS = (): typeof Platform.OS => {\n return Platform.OS;\n};\n\nexport const isAndroid = (): boolean => getOS() === 'android';\n","import type { Platform } from '.';\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to web type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedWebType = castWebType('' as Example);\n * // ^ string\n * ```\n */\nconst castWebType = <T>(value: T): Platform.CastWeb<T> => {\n return value as Platform.CastWeb<typeof value>;\n};\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to native type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedNativeType = castNativeType('' as Example);\n * // ^ number\n * ```\n */\nconst castNativeType = <T>(value: T): Platform.CastNative<T> => {\n return value as Platform.CastNative<typeof value>;\n};\n\nexport { castWebType, castNativeType };\n","export function makeBorderSize<T extends number>(size: T): `${T}px`;\nexport function makeBorderSize<T extends string>(size: T): T;\nexport function makeBorderSize<T extends number | string>(size: T): `${T}px` | T {\n if (typeof size === 'number') {\n return `${size}px`;\n }\n return size;\n}\n","import type { MakeMotionTime } from './types';\nimport type { Platform } from '~utils';\n\nexport const makeMotionTime = <T extends number>(\n time: T,\n): Platform.CastNative<MakeMotionTime<T>> => {\n return time;\n};\n","export const makeSpace = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export const makeTypographySize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export type MakeSize<T extends number> = `${T}px`;\n\nexport const makeSize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","/**\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport const toTitleCase = (inputString: string): string =>\n inputString\n .toLowerCase()\n .split(' ')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n","import type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\n/**\n * a type-safe version of the `usePrevious` hook described here:\n * @see {@link https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state}\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'] {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import { useContext, createContext } from 'react';\nimport type { Theme } from './';\nimport type { UseColorScheme } from '~utils/useColorScheme';\nimport type { TypographyPlatforms } from '~tokens/global';\nimport { throwBladeError } from '~utils/logger';\n\nexport type ThemeContext = UseColorScheme & {\n theme: Theme;\n platform: TypographyPlatforms;\n};\n\nexport const ThemeContext = createContext<ThemeContext>({\n // @ts-expect-error set null\n theme: null,\n colorScheme: 'light',\n platform: 'onDesktop',\n setColorScheme: () => null,\n});\n\nconst useTheme = (): ThemeContext => {\n const themeContext = useContext<ThemeContext>(ThemeContext);\n if (__DEV__) {\n if (!themeContext.theme) {\n throwBladeError({\n message: 'BladeProvider is missing theme',\n moduleName: 'BladeProvider',\n });\n }\n if (themeContext === undefined) {\n throwBladeError({\n message: 'useTheme must be used within BladeProvider',\n moduleName: 'BladeProvider',\n });\n }\n }\n return themeContext;\n};\n\nexport default useTheme;\n"],"names":["getColorScheme","colorScheme","arguments","length","undefined","_Appearance$getColorS","Appearance","getMediaQuery","_ref","min","max","getPlatformType","navigator","product","document","process","deviceType","desktop","mobile","useBreakpoint","_window","breakpoints","supportsMatchMedia","window","matchMedia","breakpointsTokenAndQueryCollection","useMemo","Object","entries","map","_ref2","index","breakpointsArray","_breakpointsArray","_ref3","_slicedToArray","token","screenSize","maxValue","mediaQuery","getMatchedDeviceType","useCallback","matchedBreakpoint","matchedDeviceType","platform","includes","getMatchedBreakpoint","event","_breakpointsTokenAndQ","_breakpointsTokenAndQ2","find","_ref4","_ref4$mediaQuery","media","matches","_useState","useState","_useState2","breakpointAndDevice","setBreakpointAndDevice","useEffect","handleMediaQueryChange","mediaQueryInstances","_ref5","_ref5$mediaQuery","mediaQueryInstance","addEventListener","addListener","forEach","removeEventListener","removeListener","colorSchemeNamesInput","PREFIX","throwBladeError","message","moduleName","__DEV__","prefix","Error","useColorScheme","initialColorScheme","colorSchemeState","setColorSchemeState","setColorScheme","setThemeMode","toString","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useInterval","callback","delay","enable","intervalRef","useRef","savedCallback","current","tick","setInterval","clearInterval","isReactNative","getOS","Platform","OS","isAndroid","castWebType","value","castNativeType","makeBorderSize","size","makeMotionTime","time","makeSpace","makeTypographySize","makeSize","toTitleCase","inputString","toLowerCase","split","word","charAt","toUpperCase","slice","join","usePrevious","ref","ThemeContext","createContext","theme","useTheme","themeContext","useContext"],"mappings":";;;;;AAGa,IAAAA,cAAc,CAAG,SAAjBA,cAAcA,EAAuE,CAAnE,IAAAC,WAAkC,CAAAC,SAAA,CAAAC,MAAA,CAAA,CAAA,EAAAD,SAAA,CAAAE,CAAAA,CAAAA,GAAAA,SAAA,CAAAF,SAAA,IAAG,OAAO,CAEzE,GAAID,WAAW,GAAK,OAAO,EAAIA,WAAW,GAAK,MAAM,CAAE,CACrD,OAAOA,WAAW,CACpB,CAEA,GAAIA,WAAW,GAAK,QAAQ,CAAE,KAAAI,qBAAA,CAC5B,OAAAA,CAAAA,qBAAA,CAAOC,UAAU,CAACN,cAAc,EAAE,GAAA,IAAA,CAAAK,qBAAA,CAAI,OAAO,CAC/C,CAEA,OAAO,OAAO,CAChB;;ACda,IAAAE,aAAa,CAAG,SAAhBA,aAAa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C,IAAI,CAAC,GAAG,CAAC,CAAA;;SCAEC,WAAWA,CAAIlB,KAAQ,CAA8C,CACnF,IAAMmB,GAAG,CAAG/B,MAAM,EAAK,CAEvBnC,SAAS,CAAC,UAAM,CACdkE,GAAG,CAAC7B,OAAO,CAAGU,KAAK,CACrB,CAAC,CAAE,CAACA,KAAK,CAAC,CAAC,CAEX,OAAOmB,GAAG,CAAC7B,OAAO,CACpB;;ACLa,IAAA8B,YAAY,CAAGC,aAAa,CAAe,CAEtDC,KAAK,CAAE,IAAI,CACXhI,WAAW,CAAE,OAAO,CACpB2C,QAAQ,CAAE,WAAW,CACrBuC,cAAc,CAAE,SAAAA,cAAA,EAAA,CAAA,WAAU,CAC5B,CAAA,CAAC,EAEK,IAAA+C,QAAQ,CAAG,SAAXA,QAAQA,EAAuB,CACnC,IAAMC,YAAY,CAAGC,UAAU,CAAeL,YAAY,CAAC,CAC3D,GAAInD,OAAO,CAAE,CACX,GAAI,CAACuD,YAAY,CAACF,KAAK,CAAE,CACvBxD,eAAe,CAAC,CACdC,OAAO,CAAE,gCAAgC,CACzCC,UAAU,CAAE,eACd,CAAC,CAAC,CACJ,CACA,GAAIwD,YAAY,GAAK/H,SAAS,CAAE,CAC9BqE,eAAe,CAAC,CACdC,OAAO,CAAE,4CAA4C,CACrDC,UAAU,CAAE,eACd,CAAC,CAAC,CACJ,CACF,CACA,OAAOwD,YAAY,CACrB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.native.js","sources":["../../src/utils/getColorScheme/getColorScheme.native.ts","../../src/utils/getMediaQuery/getMediaQuery.ts","../../src/utils/getPlatformType/getPlatformType.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/tokens/theme/theme.ts","../../src/utils/logger/logger.ts","../../src/utils/useColorScheme/useColorScheme.ts","../../src/utils/useIsomorphicLayoutEffect.ts","../../src/utils/useInterval.ts","../../src/utils/platform/isReactNative.ts","../../src/utils/platform/getOS.native.ts","../../src/utils/platform/castUtils.ts","../../src/utils/makeBorderSize/makeBorderSize.ts","../../src/utils/makeMotionTime/makeMotionTime.native.ts","../../src/utils/makeSpace/makeSpace.ts","../../src/utils/makeTypographySize/makeTypographySize.native.ts","../../src/utils/makeSize/makeSize.ts","../../src/utils/toTitleCase/toTitleCase.ts","../../src/utils/usePrevious/usePrevious.ts","../../src/components/BladeProvider/useTheme.ts"],"sourcesContent":["import { Appearance } from 'react-native';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\n\nexport const getColorScheme = (colorScheme: ColorSchemeNamesInput = 'light'): ColorSchemeNames => {\n // @TODO: convert this to hook as Appearance API also adds an eventListener which subscribes to the colorscheme changes on the device\n if (colorScheme === 'light' || colorScheme === 'dark') {\n return colorScheme;\n }\n\n if (colorScheme === 'system') {\n return Appearance.getColorScheme() ?? 'light';\n }\n\n return 'light';\n};\n","export const getMediaQuery = ({ min, max }: { min: number; max?: number }): string => {\n return `screen and (min-width: ${min}px)${max ? ` and (max-width: ${max}px)` : ''}`;\n};\n","export type PlatformTypes = 'browser' | 'node' | 'react-native' | 'unknown';\n\nexport const getPlatformType = (): PlatformTypes => {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n if (typeof document !== 'undefined') {\n return 'browser';\n }\n\n if (typeof process !== 'undefined') {\n return 'node';\n }\n\n return 'unknown';\n};\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\n\nconst deviceType = {\n desktop: 'desktop',\n mobile: 'mobile',\n} as const;\n\ntype DeviceType = keyof typeof deviceType;\ntype Breakpoint = keyof Breakpoints | undefined;\n\ntype BreakpointAndDevice = {\n matchedBreakpoint: Breakpoint;\n matchedDeviceType: DeviceType;\n};\n\nexport const useBreakpoint = ({\n breakpoints,\n}: {\n breakpoints: Breakpoints;\n}): BreakpointAndDevice => {\n const supportsMatchMedia =\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof window?.matchMedia === 'function';\n\n const breakpointsTokenAndQueryCollection = useMemo(\n () =>\n (supportsMatchMedia\n ? Object.entries(breakpoints).map(([token, screenSize], index, breakpointsArray) => {\n const min = screenSize;\n const maxValue = breakpointsArray[index + 1]?.[1];\n const mediaQuery = getMediaQuery({ min, max: maxValue ? maxValue - 1 : undefined });\n return { token, screenSize, mediaQuery };\n })\n : []) as {\n token: keyof Breakpoints;\n screenSize: number;\n mediaQuery: string;\n }[],\n [breakpoints, supportsMatchMedia],\n );\n\n const getMatchedDeviceType = useCallback((matchedBreakpoint: Breakpoint): DeviceType => {\n let matchedDeviceType: DeviceType = deviceType.mobile;\n const platform = getPlatformType();\n if (platform === 'react-native') {\n matchedDeviceType = deviceType.mobile;\n } else if (platform === 'browser') {\n if (matchedBreakpoint && ['base', 'xs', 's'].includes(matchedBreakpoint)) {\n // tablet is also categorised as mobile\n matchedDeviceType = deviceType.mobile;\n } else {\n matchedDeviceType = deviceType.desktop;\n }\n } else if (platform === 'node') {\n //@TODO: Check for useragent for node\n matchedDeviceType = deviceType.desktop;\n }\n return matchedDeviceType;\n }, []);\n\n const getMatchedBreakpoint = useCallback(\n (event?: MediaQueryListEvent): Breakpoint => {\n const matchedBreakpoint =\n breakpointsTokenAndQueryCollection.find(({ mediaQuery = '' }) => {\n // this will run whenever mediaQuery change event is triggered\n if (event?.media === mediaQuery) {\n return true;\n }\n // this will run when the state is initialised for the first time and hence the event object will be empty so we'll fallback to browser's window object\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return {\n matchedBreakpoint,\n matchedDeviceType,\n };\n });\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return undefined;\n }\n\n const handleMediaQueryChange = (event: MediaQueryListEvent): void => {\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint(event);\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n\n return { matchedBreakpoint, matchedDeviceType };\n });\n };\n\n const mediaQueryInstances = breakpointsTokenAndQueryCollection.map(({ mediaQuery = '' }) => {\n const mediaQueryInstance = window.matchMedia(mediaQuery);\n /**\n * the mediaquery event listener is available on mediaQuery instances and not `window`\n * we iterate over all the breakpoints we have, register each instance and store them as `mediaQueryInstances` so we can later unregister all of them.\n */\n if (mediaQueryInstance.addEventListener) {\n mediaQueryInstance.addEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using addListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener\n mediaQueryInstance.addListener(handleMediaQueryChange);\n }\n return mediaQueryInstance;\n });\n\n return (): void => {\n mediaQueryInstances.forEach((mediaQueryInstance) => {\n if (mediaQueryInstance.removeEventListener) {\n mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using removeListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/removeListener\n mediaQueryInstance.removeListener(handleMediaQueryChange);\n }\n });\n };\n }, [\n breakpointsTokenAndQueryCollection,\n getMatchedBreakpoint,\n getMatchedDeviceType,\n supportsMatchMedia,\n ]);\n\n // @TODO: handle SSR scenarios\n return breakpointAndDevice;\n};\n\nexport type { DeviceType };\n","import type { StringWithAutocomplete } from '~utils/types';\nimport type {\n Border,\n Breakpoints,\n Motion,\n Spacing,\n TypographyWithPlatforms,\n ElevationWithColorModes,\n} from '~tokens/global';\n\nexport type ColorSchemeNames = 'dark' | 'light';\nexport type ColorSchemeNamesInput = ColorSchemeNames | 'system';\n\nexport type ColorSchemeModes = 'onDark' | 'onLight';\n\nexport type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';\n\nexport type ColorContrastTypes = 'low' | 'high';\n\nexport type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';\n\nexport type ColorContrast = {\n [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;\n};\n\n// @TODO: this shall rather be Surface = 'level1' | 'level2' | 'level3' to keep in sync with color tokens\nexport type SurfaceLevels = 1 | 2 | 3;\n\nexport type ActionStates = {\n default: string;\n hover: string;\n focus: string;\n active: string;\n disabled: string;\n};\n\nexport type LinkActionStates = ActionStates & {\n visited: string;\n};\n\nexport type ActionStatesWithContrast = {\n default: ColorContrast;\n hover: ColorContrast;\n focus: ColorContrast;\n active: ColorContrast;\n disabled: ColorContrast;\n};\n\nexport type ActionStatesWithLowContrast = {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n};\n\nexport type LinkActionStatesWithContrast = ActionStatesWithContrast & {\n visited: ColorContrast;\n};\n\nexport type ActionVariants = {\n primary: ActionStates;\n secondary: ActionStates;\n tertiary: ActionStates;\n link: LinkActionStates;\n};\n\nexport type ActionVariantsWithContrast = {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithContrast;\n tertiary: ActionStatesWithContrast;\n link: ActionStatesWithContrast;\n};\n\nexport type SecondaryFeedbackActionStatesWithContrast = {\n secondary: {\n default: Pick<ColorContrast, 'lowContrast'>;\n hover: Pick<ColorContrast, 'lowContrast'>;\n focus: Pick<ColorContrast, 'lowContrast'>;\n active: Pick<ColorContrast, 'lowContrast'>;\n disabled: Pick<ColorContrast, 'lowContrast'>;\n };\n};\n\n// export type ActionProperties = {\n// background: ActionVariants;\n// border: ActionVariants;\n// text: ActionVariants;\n// icon: ActionVariants;\n// };\n\nexport type FeedbackActions = {\n action: {\n background: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n border: {\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n text: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n icon: {\n link: ActionStatesWithContrast;\n primary: ActionStatesWithContrast;\n secondary: ActionStatesWithLowContrast;\n };\n };\n};\n\nexport type WhiteColors = {\n background: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n border: Pick<ActionVariants, 'primary' | 'secondary' | 'tertiary'>;\n text: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n icon: Pick<ActionVariants, 'link' | 'primary' | 'secondary' | 'tertiary'>;\n};\n\nexport type Colors = {\n brand: {\n primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;\n secondary: Record<500, string>;\n gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;\n };\n feedback: {\n background: Record<Feedback, ColorContrast>;\n border: Record<Feedback, ColorContrast>;\n text: Record<Feedback, ColorContrast>;\n icon: Record<Feedback, ColorContrast>;\n positive: FeedbackActions;\n negative: FeedbackActions;\n information: FeedbackActions;\n notice: FeedbackActions;\n neutral: FeedbackActions;\n };\n surface: {\n background: Record<'level1' | 'level2' | 'level3', ColorContrast>;\n border: Record<'normal' | 'subtle', ColorContrast>;\n text: Record<TextTypes, ColorContrast>;\n action: {\n icon: ActionStatesWithContrast;\n };\n overlay: Record<'background', Record<400 | 800, string>>;\n popup: Record<'background', string>;\n };\n overlay: Record<'background', string>;\n action: {\n background: Omit<ActionVariants, 'link'>;\n border: Omit<ActionVariants, 'link'>;\n text: ActionVariants;\n icon: ActionVariants;\n };\n badge: {\n background: {\n blue: ColorContrast;\n };\n border: {\n blue: ColorContrast;\n };\n text: {\n blue: ColorContrast;\n };\n icon: {\n blue: ColorContrast;\n };\n };\n static: {\n white: string;\n };\n white: {\n action: WhiteColors;\n };\n};\n\nexport type ColorsWithModes = Record<ColorSchemeModes, Colors>;\n\nexport type ThemeTokens = {\n name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object\n border: Border;\n breakpoints: Breakpoints;\n colors: ColorsWithModes;\n motion: Motion;\n elevation: ElevationWithColorModes;\n spacing: Spacing;\n typography: TypographyWithPlatforms;\n};\n\nexport type SpacingValues = `${Spacing[keyof Spacing]}px`;\nexport type BorderWidthValues = `${Border['width'][keyof Border['width']]}px`;\nexport type BorderRadiusValues =\n | `${Border['radius'][Exclude<keyof Border['radius'], 'round'>]}px`\n | `${Border['radius'][Extract<keyof Border['radius'], 'round'>]}`;\n\nexport const colorSchemeNamesInput: ColorSchemeNamesInput[] = ['light', 'dark', 'system'];\n","type LogType = 'error' | 'warn' | 'log';\n\ntype LoggerOptions = {\n message: string;\n moduleName?: string;\n type: LogType;\n};\n\ntype ThrowBladeErrorOptions = {\n message: string;\n moduleName?: string;\n};\n\nconst PREFIX = '[Blade]:';\n\nconst throwBladeError = ({ message, moduleName }: ThrowBladeErrorOptions): void | never => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n throw new Error(`${prefix} ${message}`);\n }\n};\n\nconst getCommonLogger = (\n type: LogType,\n): typeof console.log | typeof console.error | typeof console.warn => {\n switch (type) {\n case 'error':\n return console.error;\n case 'warn':\n return console.warn;\n case 'log':\n default:\n return console.log;\n }\n};\n\nconst logger = ({ message, moduleName, type }: LoggerOptions): void => {\n if (__DEV__) {\n const prefix = moduleName ? `[Blade: ${moduleName}]:` : PREFIX;\n getCommonLogger(type)(`${prefix} ${message}`);\n }\n};\n\nexport { throwBladeError, logger };\n","import { useState, useCallback } from 'react';\nimport { getColorScheme } from '../getColorScheme';\nimport { colorSchemeNamesInput } from '~tokens/theme/theme';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\nimport { throwBladeError } from '~utils/logger';\n\nexport type UseColorScheme = {\n colorScheme: ColorSchemeNames;\n setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;\n};\n\nexport const useColorScheme = (\n initialColorScheme: ColorSchemeNamesInput = 'light',\n): UseColorScheme => {\n // if colorScheme defined use that else fallback to 'light'\n const [colorSchemeState, setColorSchemeState] = useState<ColorSchemeNames>(() =>\n getColorScheme(initialColorScheme),\n );\n\n const setColorScheme = useCallback(function setThemeMode(colorScheme: ColorSchemeNamesInput) {\n if (__DEV__) {\n if (!colorSchemeNamesInput.includes(colorScheme)) {\n throwBladeError({\n message: `Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,\n moduleName: 'useColorScheme',\n });\n }\n }\n setColorSchemeState(getColorScheme(colorScheme));\n }, []);\n\n return {\n colorScheme: colorSchemeState,\n setColorScheme,\n };\n};\n","import * as React from 'react';\nimport { getPlatformType } from './getPlatformType';\n\nconst isBrowser = getPlatformType() == 'browser';\n\n/**\n * useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser\n * (for SSR reasons)\n *\n * React currently throws a warning when using useLayoutEffect on the server.\n * To get around it, we can conditionally useEffect on the server (no-op) and\n * useLayoutEffect in the browser.\n *\n * @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n */\nexport const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;\n","/* eslint-disable consistent-return */\nimport React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\nfunction useInterval(\n callback: () => void,\n { delay, enable }: { delay: number; enable?: boolean },\n): void {\n const intervalRef = React.useRef<number | null>(null);\n const savedCallback = React.useRef(callback);\n\n // keep the callback updated\n useIsomorphicLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n const tick = (): void => savedCallback.current();\n\n if (enable) {\n intervalRef.current = window.setInterval(tick, delay);\n return () => window.clearInterval(intervalRef.current!);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }, [delay, enable]);\n}\n\nexport { useInterval };\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport { getPlatformType } from '../getPlatformType';\n\nconst isReactNative = (): boolean => {\n return getPlatformType() === 'react-native';\n};\n\nexport { isReactNative };\n","import { Platform } from 'react-native';\n\nexport const getOS = (): typeof Platform.OS => {\n return Platform.OS;\n};\n\nexport const isAndroid = (): boolean => getOS() === 'android';\n","import type { Platform } from '.';\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to web type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedWebType = castWebType('' as Example);\n * // ^ string\n * ```\n */\nconst castWebType = <T>(value: T): Platform.CastWeb<T> => {\n return value as Platform.CastWeb<typeof value>;\n};\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to native type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedNativeType = castNativeType('' as Example);\n * // ^ number\n * ```\n */\nconst castNativeType = <T>(value: T): Platform.CastNative<T> => {\n return value as Platform.CastNative<typeof value>;\n};\n\nexport { castWebType, castNativeType };\n","export function makeBorderSize<T extends number>(size: T): `${T}px`;\nexport function makeBorderSize<T extends string>(size: T): T;\nexport function makeBorderSize<T extends number | string>(size: T): `${T}px` | T {\n if (typeof size === 'number') {\n return `${size}px`;\n }\n return size;\n}\n","import type { MakeMotionTime } from './types';\nimport type { Platform } from '~utils';\n\nexport const makeMotionTime = <T extends number>(\n time: T,\n): Platform.CastNative<MakeMotionTime<T>> => {\n return time;\n};\n","export const makeSpace = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export const makeTypographySize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export type MakeSize<T extends number> = `${T}px`;\n\nexport const makeSize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","/**\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport const toTitleCase = (inputString: string): string =>\n inputString\n .toLowerCase()\n .split(' ')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n","import type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\n/**\n * a type-safe version of the `usePrevious` hook described here:\n * @see {@link https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state}\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'] {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import { useContext, createContext } from 'react';\nimport type { Theme } from './';\nimport type { UseColorScheme } from '~utils/useColorScheme';\nimport type { TypographyPlatforms } from '~tokens/global';\nimport { throwBladeError } from '~utils/logger';\n\nexport type ThemeContext = UseColorScheme & {\n theme: Theme;\n platform: TypographyPlatforms;\n};\n\nexport const ThemeContext = createContext<ThemeContext>({\n // @ts-expect-error set null\n theme: null,\n colorScheme: 'light',\n platform: 'onDesktop',\n setColorScheme: () => null,\n});\n\nconst useTheme = (): ThemeContext => {\n const themeContext = useContext<ThemeContext>(ThemeContext);\n if (__DEV__) {\n if (!themeContext.theme) {\n throwBladeError({\n message: 'BladeProvider is missing theme',\n moduleName: 'BladeProvider',\n });\n }\n if (themeContext === undefined) {\n throwBladeError({\n message: 'useTheme must be used within BladeProvider',\n moduleName: 'BladeProvider',\n });\n }\n }\n return themeContext;\n};\n\nexport default useTheme;\n"],"names":["getColorScheme","colorScheme","arguments","length","undefined","_Appearance$getColorS","Appearance","getMediaQuery","_ref","min","max","getPlatformType","navigator","product","document","process","deviceType","desktop","mobile","useBreakpoint","_window","breakpoints","supportsMatchMedia","window","matchMedia","breakpointsTokenAndQueryCollection","useMemo","Object","entries","map","_ref2","index","breakpointsArray","_breakpointsArray","_ref3","_slicedToArray","token","screenSize","maxValue","mediaQuery","getMatchedDeviceType","useCallback","matchedBreakpoint","matchedDeviceType","platform","includes","getMatchedBreakpoint","event","_breakpointsTokenAndQ","_breakpointsTokenAndQ2","find","_ref4","_ref4$mediaQuery","media","matches","_useState","useState","_useState2","breakpointAndDevice","setBreakpointAndDevice","useEffect","handleMediaQueryChange","mediaQueryInstances","_ref5","_ref5$mediaQuery","mediaQueryInstance","addEventListener","addListener","forEach","removeEventListener","removeListener","colorSchemeNamesInput","PREFIX","throwBladeError","message","moduleName","__DEV__","prefix","Error","useColorScheme","initialColorScheme","colorSchemeState","setColorSchemeState","setColorScheme","setThemeMode","toString","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useInterval","callback","delay","enable","intervalRef","useRef","savedCallback","current","tick","setInterval","clearInterval","isReactNative","getOS","Platform","OS","isAndroid","castWebType","value","castNativeType","makeBorderSize","size","makeMotionTime","time","makeSpace","makeTypographySize","makeSize","toTitleCase","inputString","toLowerCase","split","word","charAt","toUpperCase","slice","join","usePrevious","ref","ThemeContext","createContext","theme","useTheme","themeContext","useContext"],"mappings":";;;;;AAGa,IAAAA,cAAc,CAAG,SAAjBA,cAAcA,EAAuE,CAAnE,IAAAC,WAAkC,CAAAC,SAAA,CAAAC,MAAA,CAAA,CAAA,EAAAD,SAAA,CAAAE,CAAAA,CAAAA,GAAAA,SAAA,CAAAF,SAAA,IAAG,OAAO,CAEzE,GAAID,WAAW,GAAK,OAAO,EAAIA,WAAW,GAAK,MAAM,CAAE,CACrD,OAAOA,WAAW,CACpB,CAEA,GAAIA,WAAW,GAAK,QAAQ,CAAE,KAAAI,qBAAA,CAC5B,OAAAA,CAAAA,qBAAA,CAAOC,UAAU,CAACN,cAAc,EAAE,GAAA,IAAA,CAAAK,qBAAA,CAAI,OAAO,CAC/C,CAEA,OAAO,OAAO,CAChB;;ACda,IAAAE,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAA4D,KAAtDC,GAAG,CAAAD,IAAA,CAAHC,GAAG,CAAEC,GAAG,CAAAF,IAAA,CAAHE,GAAG,CACtC,OA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CAEvBnC,SAAS,CAAC,UAAM,CACdkE,GAAG,CAAC7B,OAAO,CAAGU,KAAK,CACrB,CAAC,CAAE,CAACA,KAAK,CAAC,CAAC,CAEX,OAAOmB,GAAG,CAAC7B,OAAO,CACpB;;ACLa,IAAA8B,YAAY,CAAGC,aAAa,CAAe,CAEtDC,KAAK,CAAE,IAAI,CACXhI,WAAW,CAAE,OAAO,CACpB2C,QAAQ,CAAE,WAAW,CACrBuC,cAAc,CAAE,SAAAA,cAAA,EAAA,CAAA,WAAU,CAC5B,CAAA,CAAC,EAEK,IAAA+C,QAAQ,CAAG,SAAXA,QAAQA,EAAuB,CACnC,IAAMC,YAAY,CAAGC,UAAU,CAAeL,YAAY,CAAC,CAC3D,GAAInD,OAAO,CAAE,CACX,GAAI,CAACuD,YAAY,CAACF,KAAK,CAAE,CACvBxD,eAAe,CAAC,CACdC,OAAO,CAAE,gCAAgC,CACzCC,UAAU,CAAE,eACd,CAAC,CAAC,CACJ,CACA,GAAIwD,YAAY,GAAK/H,SAAS,CAAE,CAC9BqE,eAAe,CAAC,CACdC,OAAO,CAAE,4CAA4C,CACrDC,UAAU,CAAE,eACd,CAAC,CAAC,CACJ,CACF,CACA,OAAOwD,YAAY,CACrB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.production.web.js","sources":["../../src/utils/getColorScheme/getColorScheme.web.ts","../../src/utils/getMediaQuery/getMediaQuery.ts","../../src/utils/getPlatformType/getPlatformType.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/utils/useColorScheme/useColorScheme.ts","../../src/utils/useIsomorphicLayoutEffect.ts","../../src/utils/useInterval.ts","../../src/utils/platform/isReactNative.ts","../../src/utils/platform/getOS.web.ts","../../src/utils/platform/castUtils.ts","../../src/utils/makeBorderSize/makeBorderSize.ts","../../src/utils/makeMotionTime/makeMotionTime.web.ts","../../src/utils/makeSpace/makeSpace.ts","../../src/utils/makeTypographySize/makeTypographySize.web.ts","../../src/utils/makeSize/makeSize.ts","../../src/utils/toTitleCase/toTitleCase.ts","../../src/utils/usePrevious/usePrevious.ts","../../src/components/BladeProvider/useTheme.ts"],"sourcesContent":["import type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\n\nexport const getColorScheme = (colorScheme: ColorSchemeNamesInput = 'light'): ColorSchemeNames => {\n // @TODO: create a useMediaQuery hook with an event listener which will subscribe to changes and move all this logic there\n const colorSchemeMediaQueryMap = {\n light: '(prefers-color-scheme: light)',\n dark: '(prefers-color-scheme: dark)',\n system: 'default',\n };\n const supportsMatchMedia =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n\n if (colorScheme === 'light' || colorScheme === 'dark') {\n return colorScheme;\n }\n\n if (\n colorScheme === 'system' &&\n supportsMatchMedia &&\n window.matchMedia(colorSchemeMediaQueryMap.dark).matches\n ) {\n return 'dark';\n }\n\n return 'light';\n};\n","export const getMediaQuery = ({ min, max }: { min: number; max?: number }): string => {\n return `screen and (min-width: ${min}px)${max ? ` and (max-width: ${max}px)` : ''}`;\n};\n","export type PlatformTypes = 'browser' | 'node' | 'react-native' | 'unknown';\n\nexport const getPlatformType = (): PlatformTypes => {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n if (typeof document !== 'undefined') {\n return 'browser';\n }\n\n if (typeof process !== 'undefined') {\n return 'node';\n }\n\n return 'unknown';\n};\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\n\nconst deviceType = {\n desktop: 'desktop',\n mobile: 'mobile',\n} as const;\n\ntype DeviceType = keyof typeof deviceType;\ntype Breakpoint = keyof Breakpoints | undefined;\n\ntype BreakpointAndDevice = {\n matchedBreakpoint: Breakpoint;\n matchedDeviceType: DeviceType;\n};\n\nexport const useBreakpoint = ({\n breakpoints,\n}: {\n breakpoints: Breakpoints;\n}): BreakpointAndDevice => {\n const supportsMatchMedia =\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof window?.matchMedia === 'function';\n\n const breakpointsTokenAndQueryCollection = useMemo(\n () =>\n (supportsMatchMedia\n ? Object.entries(breakpoints).map(([token, screenSize], index, breakpointsArray) => {\n const min = screenSize;\n const maxValue = breakpointsArray[index + 1]?.[1];\n const mediaQuery = getMediaQuery({ min, max: maxValue ? maxValue - 1 : undefined });\n return { token, screenSize, mediaQuery };\n })\n : []) as {\n token: keyof Breakpoints;\n screenSize: number;\n mediaQuery: string;\n }[],\n [breakpoints, supportsMatchMedia],\n );\n\n const getMatchedDeviceType = useCallback((matchedBreakpoint: Breakpoint): DeviceType => {\n let matchedDeviceType: DeviceType = deviceType.mobile;\n const platform = getPlatformType();\n if (platform === 'react-native') {\n matchedDeviceType = deviceType.mobile;\n } else if (platform === 'browser') {\n if (matchedBreakpoint && ['base', 'xs', 's'].includes(matchedBreakpoint)) {\n // tablet is also categorised as mobile\n matchedDeviceType = deviceType.mobile;\n } else {\n matchedDeviceType = deviceType.desktop;\n }\n } else if (platform === 'node') {\n //@TODO: Check for useragent for node\n matchedDeviceType = deviceType.desktop;\n }\n return matchedDeviceType;\n }, []);\n\n const getMatchedBreakpoint = useCallback(\n (event?: MediaQueryListEvent): Breakpoint => {\n const matchedBreakpoint =\n breakpointsTokenAndQueryCollection.find(({ mediaQuery = '' }) => {\n // this will run whenever mediaQuery change event is triggered\n if (event?.media === mediaQuery) {\n return true;\n }\n // this will run when the state is initialised for the first time and hence the event object will be empty so we'll fallback to browser's window object\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return {\n matchedBreakpoint,\n matchedDeviceType,\n };\n });\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return undefined;\n }\n\n const handleMediaQueryChange = (event: MediaQueryListEvent): void => {\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint(event);\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n\n return { matchedBreakpoint, matchedDeviceType };\n });\n };\n\n const mediaQueryInstances = breakpointsTokenAndQueryCollection.map(({ mediaQuery = '' }) => {\n const mediaQueryInstance = window.matchMedia(mediaQuery);\n /**\n * the mediaquery event listener is available on mediaQuery instances and not `window`\n * we iterate over all the breakpoints we have, register each instance and store them as `mediaQueryInstances` so we can later unregister all of them.\n */\n if (mediaQueryInstance.addEventListener) {\n mediaQueryInstance.addEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using addListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener\n mediaQueryInstance.addListener(handleMediaQueryChange);\n }\n return mediaQueryInstance;\n });\n\n return (): void => {\n mediaQueryInstances.forEach((mediaQueryInstance) => {\n if (mediaQueryInstance.removeEventListener) {\n mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using removeListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/removeListener\n mediaQueryInstance.removeListener(handleMediaQueryChange);\n }\n });\n };\n }, [\n breakpointsTokenAndQueryCollection,\n getMatchedBreakpoint,\n getMatchedDeviceType,\n supportsMatchMedia,\n ]);\n\n // @TODO: handle SSR scenarios\n return breakpointAndDevice;\n};\n","import { useState, useCallback } from 'react';\nimport { getColorScheme } from '../getColorScheme';\nimport { colorSchemeNamesInput } from '~tokens/theme/theme';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\nimport { throwBladeError } from '~utils/logger';\n\nexport type UseColorScheme = {\n colorScheme: ColorSchemeNames;\n setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;\n};\n\nexport const useColorScheme = (\n initialColorScheme: ColorSchemeNamesInput = 'light',\n): UseColorScheme => {\n // if colorScheme defined use that else fallback to 'light'\n const [colorSchemeState, setColorSchemeState] = useState<ColorSchemeNames>(() =>\n getColorScheme(initialColorScheme),\n );\n\n const setColorScheme = useCallback(function setThemeMode(colorScheme: ColorSchemeNamesInput) {\n if (__DEV__) {\n if (!colorSchemeNamesInput.includes(colorScheme)) {\n throwBladeError({\n message: `Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,\n moduleName: 'useColorScheme',\n });\n }\n }\n setColorSchemeState(getColorScheme(colorScheme));\n }, []);\n\n return {\n colorScheme: colorSchemeState,\n setColorScheme,\n };\n};\n","import * as React from 'react';\nimport { getPlatformType } from './getPlatformType';\n\nconst isBrowser = getPlatformType() == 'browser';\n\n/**\n * useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser\n * (for SSR reasons)\n *\n * React currently throws a warning when using useLayoutEffect on the server.\n * To get around it, we can conditionally useEffect on the server (no-op) and\n * useLayoutEffect in the browser.\n *\n * @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n */\nexport const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;\n","/* eslint-disable consistent-return */\nimport React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\nfunction useInterval(\n callback: () => void,\n { delay, enable }: { delay: number; enable?: boolean },\n): void {\n const intervalRef = React.useRef<number | null>(null);\n const savedCallback = React.useRef(callback);\n\n // keep the callback updated\n useIsomorphicLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n const tick = (): void => savedCallback.current();\n\n if (enable) {\n intervalRef.current = window.setInterval(tick, delay);\n return () => window.clearInterval(intervalRef.current!);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }, [delay, enable]);\n}\n\nexport { useInterval };\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport { getPlatformType } from '../getPlatformType';\n\nconst isReactNative = (): boolean => {\n return getPlatformType() === 'react-native';\n};\n\nexport { isReactNative };\n","import type { Platform } from 'react-native';\n\nexport const getOS = (): typeof Platform.OS => {\n return 'web';\n};\n\nexport const isAndroid = (): boolean => false;\n","import type { Platform } from '.';\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to web type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedWebType = castWebType('' as Example);\n * // ^ string\n * ```\n */\nconst castWebType = <T>(value: T): Platform.CastWeb<T> => {\n return value as Platform.CastWeb<typeof value>;\n};\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to native type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedNativeType = castNativeType('' as Example);\n * // ^ number\n * ```\n */\nconst castNativeType = <T>(value: T): Platform.CastNative<T> => {\n return value as Platform.CastNative<typeof value>;\n};\n\nexport { castWebType, castNativeType };\n","export function makeBorderSize<T extends number>(size: T): `${T}px`;\nexport function makeBorderSize<T extends string>(size: T): T;\nexport function makeBorderSize<T extends number | string>(size: T): `${T}px` | T {\n if (typeof size === 'number') {\n return `${size}px`;\n }\n return size;\n}\n","import type { MakeMotionTime } from './types';\nimport type { Platform } from '~utils';\n\nexport const makeMotionTime = <T extends number>(time: T): Platform.CastWeb<MakeMotionTime<T>> => {\n return `${time}ms`;\n};\n","export const makeSpace = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export const makeTypographySize = (size: number): `${number}rem` => {\n const remValue = size / 16;\n return `${remValue}rem`;\n};\n","export type MakeSize<T extends number> = `${T}px`;\n\nexport const makeSize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","/**\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport const toTitleCase = (inputString: string): string =>\n inputString\n .toLowerCase()\n .split(' ')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n","import type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\n/**\n * a type-safe version of the `usePrevious` hook described here:\n * @see {@link https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state}\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'] {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import { useContext, createContext } from 'react';\nimport type { Theme } from './';\nimport type { UseColorScheme } from '~utils/useColorScheme';\nimport type { TypographyPlatforms } from '~tokens/global';\nimport { throwBladeError } from '~utils/logger';\n\nexport type ThemeContext = UseColorScheme & {\n theme: Theme;\n platform: TypographyPlatforms;\n};\n\nexport const ThemeContext = createContext<ThemeContext>({\n // @ts-expect-error set null\n theme: null,\n colorScheme: 'light',\n platform: 'onDesktop',\n setColorScheme: () => null,\n});\n\nconst useTheme = (): ThemeContext => {\n const themeContext = useContext<ThemeContext>(ThemeContext);\n if (__DEV__) {\n if (!themeContext.theme) {\n throwBladeError({\n message: 'BladeProvider is missing theme',\n moduleName: 'BladeProvider',\n });\n }\n if (themeContext === undefined) {\n throwBladeError({\n message: 'useTheme must be used within BladeProvider',\n moduleName: 'BladeProvider',\n });\n }\n }\n return themeContext;\n};\n\nexport default useTheme;\n"],"names":["getColorScheme","colorScheme","arguments","length","undefined","colorSchemeMediaQueryMap","light","dark","system","supportsMatchMedia","window","matchMedia","matches","getMediaQuery","_ref","min","max","concat","getPlatformType","navigator","product","document","process","deviceType","desktop","mobile","useBreakpoint","_window","breakpoints","breakpointsTokenAndQueryCollection","useMemo","Object","entries","map","_ref2","index","breakpointsArray","_breakpointsArray","_ref3","_slicedToArray","token","screenSize","maxValue","mediaQuery","getMatchedDeviceType","useCallback","matchedBreakpoint","matchedDeviceType","platform","includes","getMatchedBreakpoint","event","_breakpointsTokenAndQ","_breakpointsTokenAndQ2","find","_ref4","_ref4$mediaQuery","media","_useState","useState","_useState2","breakpointAndDevice","setBreakpointAndDevice","useEffect","handleMediaQueryChange","mediaQueryInstances","_ref5","_ref5$mediaQuery","mediaQueryInstance","addEventListener","addListener","forEach","removeEventListener","removeListener","useColorScheme","initialColorScheme","colorSchemeState","setColorSchemeState","setColorScheme","setThemeMode","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useInterval","callback","delay","enable","intervalRef","useRef","savedCallback","current","tick","setInterval","clearInterval","isReactNative","getOS","isAndroid","castWebType","value","castNativeType","makeBorderSize","size","makeMotionTime","time","makeSpace","makeTypographySize","remValue","makeSize","toTitleCase","inputString","toLowerCase","split","word","charAt","toUpperCase","slice","join","usePrevious","ref","ThemeContext","createContext","theme","useTheme","themeContext","useContext"],"mappings":";;;;IAEaA,cAAc,GAAG,SAAjBA,cAAcA,GAAuE;AAAA,EAAA,IAAnEC,WAAkC,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,OAAO,CAAA;AACzE;AACA,EAAA,IAAMG,wBAAwB,GAAG;AAC/BC,IAAAA,KAAK,EAAE,+BAA+B;AACtCC,IAAAA,IAAI,EAAE,8BAA8B;AACpCC,IAAAA,MAAM,EAAE,SAAA;GACT,CAAA;AACD,EAAA,IAAMC,kBAAkB,GACtB,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,UAAU,KAAK,UAAU,CAAA;AAE1E,EAAA,IAAIV,WAAW,KAAK,OAAO,IAAIA,WAAW,KAAK,MAAM,EAAE;AACrD,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAA;AAEA,EAAA,IACEA,WAAW,KAAK,QAAQ,IACxBQ,kBAAkB,IAClBC,MAAM,CAACC,UAAU,CAACN,wBAAwB,CAACE,IAAI,CAAC,CAACK,OAAO,EACxD;AACA,I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AInB,KAAQ,EAA8C;AACnF,EAAA,IAAMoB,GAAG,GAAG9B,MAAM,EAAK,CAAA;AAEvB1B,EAAAA,SAAS,CAAC,YAAM;IACdwD,GAAG,CAAC5B,OAAO,GAAGQ,KAAK,CAAA;AACrB,GAAC,EAAE,CAACA,KAAK,CAAC,CAAC,CAAA;EAEX,OAAOoB,GAAG,CAAC5B,OAAO,CAAA;AACpB;;ACLa6B,IAAAA,YAAY,gBAAGC,aAAa,CAAe;AACtD;AACAC,EAAAA,KAAK,EAAE,IAAI;AACXzH,EAAAA,WAAW,EAAE,OAAO;AACpB+C,EAAAA,QAAQ,EAAE,WAAW;EACrB8B,cAAc,EAAE,SAAAA,cAAA,GAAA;AAAA,IAAA,OAAM,IAAI,CAAA;AAAA,GAAA;AAC5B,CAAC,EAAC;AAEF,IAAM6C,QAAQ,GAAG,SAAXA,QAAQA,GAAuB;AACnC,EAAA,IAAMC,YAAY,GAAGC,UAAU,CAAeL,YAAY,CAAC,CAAA;AAe3D,EAAA,OAAOI,YAAY,CAAA;AACrB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.production.web.js","sources":["../../src/utils/getColorScheme/getColorScheme.web.ts","../../src/utils/getMediaQuery/getMediaQuery.ts","../../src/utils/getPlatformType/getPlatformType.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/utils/useColorScheme/useColorScheme.ts","../../src/utils/useIsomorphicLayoutEffect.ts","../../src/utils/useInterval.ts","../../src/utils/platform/isReactNative.ts","../../src/utils/platform/getOS.web.ts","../../src/utils/platform/castUtils.ts","../../src/utils/makeBorderSize/makeBorderSize.ts","../../src/utils/makeMotionTime/makeMotionTime.web.ts","../../src/utils/makeSpace/makeSpace.ts","../../src/utils/makeTypographySize/makeTypographySize.web.ts","../../src/utils/makeSize/makeSize.ts","../../src/utils/toTitleCase/toTitleCase.ts","../../src/utils/usePrevious/usePrevious.ts","../../src/components/BladeProvider/useTheme.ts"],"sourcesContent":["import type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\n\nexport const getColorScheme = (colorScheme: ColorSchemeNamesInput = 'light'): ColorSchemeNames => {\n // @TODO: create a useMediaQuery hook with an event listener which will subscribe to changes and move all this logic there\n const colorSchemeMediaQueryMap = {\n light: '(prefers-color-scheme: light)',\n dark: '(prefers-color-scheme: dark)',\n system: 'default',\n };\n const supportsMatchMedia =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n\n if (colorScheme === 'light' || colorScheme === 'dark') {\n return colorScheme;\n }\n\n if (\n colorScheme === 'system' &&\n supportsMatchMedia &&\n window.matchMedia(colorSchemeMediaQueryMap.dark).matches\n ) {\n return 'dark';\n }\n\n return 'light';\n};\n","export const getMediaQuery = ({ min, max }: { min: number; max?: number }): string => {\n return `screen and (min-width: ${min}px)${max ? ` and (max-width: ${max}px)` : ''}`;\n};\n","export type PlatformTypes = 'browser' | 'node' | 'react-native' | 'unknown';\n\nexport const getPlatformType = (): PlatformTypes => {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n if (typeof document !== 'undefined') {\n return 'browser';\n }\n\n if (typeof process !== 'undefined') {\n return 'node';\n }\n\n return 'unknown';\n};\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\n\nconst deviceType = {\n desktop: 'desktop',\n mobile: 'mobile',\n} as const;\n\ntype DeviceType = keyof typeof deviceType;\ntype Breakpoint = keyof Breakpoints | undefined;\n\ntype BreakpointAndDevice = {\n matchedBreakpoint: Breakpoint;\n matchedDeviceType: DeviceType;\n};\n\nexport const useBreakpoint = ({\n breakpoints,\n}: {\n breakpoints: Breakpoints;\n}): BreakpointAndDevice => {\n const supportsMatchMedia =\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof window?.matchMedia === 'function';\n\n const breakpointsTokenAndQueryCollection = useMemo(\n () =>\n (supportsMatchMedia\n ? Object.entries(breakpoints).map(([token, screenSize], index, breakpointsArray) => {\n const min = screenSize;\n const maxValue = breakpointsArray[index + 1]?.[1];\n const mediaQuery = getMediaQuery({ min, max: maxValue ? maxValue - 1 : undefined });\n return { token, screenSize, mediaQuery };\n })\n : []) as {\n token: keyof Breakpoints;\n screenSize: number;\n mediaQuery: string;\n }[],\n [breakpoints, supportsMatchMedia],\n );\n\n const getMatchedDeviceType = useCallback((matchedBreakpoint: Breakpoint): DeviceType => {\n let matchedDeviceType: DeviceType = deviceType.mobile;\n const platform = getPlatformType();\n if (platform === 'react-native') {\n matchedDeviceType = deviceType.mobile;\n } else if (platform === 'browser') {\n if (matchedBreakpoint && ['base', 'xs', 's'].includes(matchedBreakpoint)) {\n // tablet is also categorised as mobile\n matchedDeviceType = deviceType.mobile;\n } else {\n matchedDeviceType = deviceType.desktop;\n }\n } else if (platform === 'node') {\n //@TODO: Check for useragent for node\n matchedDeviceType = deviceType.desktop;\n }\n return matchedDeviceType;\n }, []);\n\n const getMatchedBreakpoint = useCallback(\n (event?: MediaQueryListEvent): Breakpoint => {\n const matchedBreakpoint =\n breakpointsTokenAndQueryCollection.find(({ mediaQuery = '' }) => {\n // this will run whenever mediaQuery change event is triggered\n if (event?.media === mediaQuery) {\n return true;\n }\n // this will run when the state is initialised for the first time and hence the event object will be empty so we'll fallback to browser's window object\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return {\n matchedBreakpoint,\n matchedDeviceType,\n };\n });\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return undefined;\n }\n\n const handleMediaQueryChange = (event: MediaQueryListEvent): void => {\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint(event);\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n\n return { matchedBreakpoint, matchedDeviceType };\n });\n };\n\n const mediaQueryInstances = breakpointsTokenAndQueryCollection.map(({ mediaQuery = '' }) => {\n const mediaQueryInstance = window.matchMedia(mediaQuery);\n /**\n * the mediaquery event listener is available on mediaQuery instances and not `window`\n * we iterate over all the breakpoints we have, register each instance and store them as `mediaQueryInstances` so we can later unregister all of them.\n */\n if (mediaQueryInstance.addEventListener) {\n mediaQueryInstance.addEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using addListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener\n mediaQueryInstance.addListener(handleMediaQueryChange);\n }\n return mediaQueryInstance;\n });\n\n return (): void => {\n mediaQueryInstances.forEach((mediaQueryInstance) => {\n if (mediaQueryInstance.removeEventListener) {\n mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using removeListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/removeListener\n mediaQueryInstance.removeListener(handleMediaQueryChange);\n }\n });\n };\n }, [\n breakpointsTokenAndQueryCollection,\n getMatchedBreakpoint,\n getMatchedDeviceType,\n supportsMatchMedia,\n ]);\n\n // @TODO: handle SSR scenarios\n return breakpointAndDevice;\n};\n\nexport type { DeviceType };\n","import { useState, useCallback } from 'react';\nimport { getColorScheme } from '../getColorScheme';\nimport { colorSchemeNamesInput } from '~tokens/theme/theme';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\nimport { throwBladeError } from '~utils/logger';\n\nexport type UseColorScheme = {\n colorScheme: ColorSchemeNames;\n setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;\n};\n\nexport const useColorScheme = (\n initialColorScheme: ColorSchemeNamesInput = 'light',\n): UseColorScheme => {\n // if colorScheme defined use that else fallback to 'light'\n const [colorSchemeState, setColorSchemeState] = useState<ColorSchemeNames>(() =>\n getColorScheme(initialColorScheme),\n );\n\n const setColorScheme = useCallback(function setThemeMode(colorScheme: ColorSchemeNamesInput) {\n if (__DEV__) {\n if (!colorSchemeNamesInput.includes(colorScheme)) {\n throwBladeError({\n message: `Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,\n moduleName: 'useColorScheme',\n });\n }\n }\n setColorSchemeState(getColorScheme(colorScheme));\n }, []);\n\n return {\n colorScheme: colorSchemeState,\n setColorScheme,\n };\n};\n","import * as React from 'react';\nimport { getPlatformType } from './getPlatformType';\n\nconst isBrowser = getPlatformType() == 'browser';\n\n/**\n * useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser\n * (for SSR reasons)\n *\n * React currently throws a warning when using useLayoutEffect on the server.\n * To get around it, we can conditionally useEffect on the server (no-op) and\n * useLayoutEffect in the browser.\n *\n * @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n */\nexport const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;\n","/* eslint-disable consistent-return */\nimport React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\nfunction useInterval(\n callback: () => void,\n { delay, enable }: { delay: number; enable?: boolean },\n): void {\n const intervalRef = React.useRef<number | null>(null);\n const savedCallback = React.useRef(callback);\n\n // keep the callback updated\n useIsomorphicLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n React.useEffect(() => {\n const tick = (): void => savedCallback.current();\n\n if (enable) {\n intervalRef.current = window.setInterval(tick, delay);\n return () => window.clearInterval(intervalRef.current!);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }, [delay, enable]);\n}\n\nexport { useInterval };\n","/* eslint-disable @typescript-eslint/no-namespace */\nimport { getPlatformType } from '../getPlatformType';\n\nconst isReactNative = (): boolean => {\n return getPlatformType() === 'react-native';\n};\n\nexport { isReactNative };\n","import type { Platform } from 'react-native';\n\nexport const getOS = (): typeof Platform.OS => {\n return 'web';\n};\n\nexport const isAndroid = (): boolean => false;\n","import type { Platform } from '.';\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to web type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedWebType = castWebType('' as Example);\n * // ^ string\n * ```\n */\nconst castWebType = <T>(value: T): Platform.CastWeb<T> => {\n return value as Platform.CastWeb<typeof value>;\n};\n\n/**\n * @description\n *\n * Casts a Platform.Select<> type to native type\n *\n * @example\n *\n * ```ts\n * type Example = Platform.Select<{ web: string; native: number }>;\n *\n * const extractedNativeType = castNativeType('' as Example);\n * // ^ number\n * ```\n */\nconst castNativeType = <T>(value: T): Platform.CastNative<T> => {\n return value as Platform.CastNative<typeof value>;\n};\n\nexport { castWebType, castNativeType };\n","export function makeBorderSize<T extends number>(size: T): `${T}px`;\nexport function makeBorderSize<T extends string>(size: T): T;\nexport function makeBorderSize<T extends number | string>(size: T): `${T}px` | T {\n if (typeof size === 'number') {\n return `${size}px`;\n }\n return size;\n}\n","import type { MakeMotionTime } from './types';\nimport type { Platform } from '~utils';\n\nexport const makeMotionTime = <T extends number>(time: T): Platform.CastWeb<MakeMotionTime<T>> => {\n return `${time}ms`;\n};\n","export const makeSpace = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","export const makeTypographySize = (size: number): `${number}rem` => {\n const remValue = size / 16;\n return `${remValue}rem`;\n};\n","export type MakeSize<T extends number> = `${T}px`;\n\nexport const makeSize = <T extends number>(size: T): `${T}px` => {\n return `${size}px`;\n};\n","/**\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport const toTitleCase = (inputString: string): string =>\n inputString\n .toLowerCase()\n .split(' ')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n","import type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\n/**\n * a type-safe version of the `usePrevious` hook described here:\n * @see {@link https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state}\n * @deprecated This utility will be deprecated in subsequent version.\n */\nexport function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'] {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import { useContext, createContext } from 'react';\nimport type { Theme } from './';\nimport type { UseColorScheme } from '~utils/useColorScheme';\nimport type { TypographyPlatforms } from '~tokens/global';\nimport { throwBladeError } from '~utils/logger';\n\nexport type ThemeContext = UseColorScheme & {\n theme: Theme;\n platform: TypographyPlatforms;\n};\n\nexport const ThemeContext = createContext<ThemeContext>({\n // @ts-expect-error set null\n theme: null,\n colorScheme: 'light',\n platform: 'onDesktop',\n setColorScheme: () => null,\n});\n\nconst useTheme = (): ThemeContext => {\n const themeContext = useContext<ThemeContext>(ThemeContext);\n if (__DEV__) {\n if (!themeContext.theme) {\n throwBladeError({\n message: 'BladeProvider is missing theme',\n moduleName: 'BladeProvider',\n });\n }\n if (themeContext === undefined) {\n throwBladeError({\n message: 'useTheme must be used within BladeProvider',\n moduleName: 'BladeProvider',\n });\n }\n }\n return themeContext;\n};\n\nexport default useTheme;\n"],"names":["getColorScheme","colorScheme","arguments","length","undefined","colorSchemeMediaQueryMap","light","dark","system","supportsMatchMedia","window","matchMedia","matches","getMediaQuery","_ref","min","max","concat","getPlatformType","navigator","product","document","process","deviceType","desktop","mobile","useBreakpoint","_window","breakpoints","breakpointsTokenAndQueryCollection","useMemo","Object","entries","map","_ref2","index","breakpointsArray","_breakpointsArray","_ref3","_slicedToArray","token","screenSize","maxValue","mediaQuery","getMatchedDeviceType","useCallback","matchedBreakpoint","matchedDeviceType","platform","includes","getMatchedBreakpoint","event","_breakpointsTokenAndQ","_breakpointsTokenAndQ2","find","_ref4","_ref4$mediaQuery","media","_useState","useState","_useState2","breakpointAndDevice","setBreakpointAndDevice","useEffect","handleMediaQueryChange","mediaQueryInstances","_ref5","_ref5$mediaQuery","mediaQueryInstance","addEventListener","addListener","forEach","removeEventListener","removeListener","useColorScheme","initialColorScheme","colorSchemeState","setColorSchemeState","setColorScheme","setThemeMode","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useInterval","callback","delay","enable","intervalRef","useRef","savedCallback","current","tick","setInterval","clearInterval","isReactNative","getOS","isAndroid","castWebType","value","castNativeType","makeBorderSize","size","makeMotionTime","time","makeSpace","makeTypographySize","remValue","makeSize","toTitleCase","inputString","toLowerCase","split","word","charAt","toUpperCase","slice","join","usePrevious","ref","ThemeContext","createContext","theme","useTheme","themeContext","useContext"],"mappings":";;;;IAEaA,cAAc,GAAG,SAAjBA,cAAcA,GAAuE;AAAA,EAAA,IAAnEC,WAAkC,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,OAAO,CAAA;AACzE;AACA,EAAA,IAAMG,wBAAwB,GAAG;AAC/BC,IAAAA,KAAK,EAAE,+BAA+B;AACtCC,IAAAA,IAAI,EAAE,8BAA8B;AACpCC,IAAAA,MAAM,EAAE,SAAA;GACT,CAAA;AACD,EAAA,IAAMC,kBAAkB,GACtB,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,UAAU,KAAK,UAAU,CAAA;AAE1E,EAAA,IAAIV,WAAW,KAAK,OAAO,IAAIA,WAAW,KAAK,MAAM,EAAE;AACrD,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAA;AAEA,EAAA,IACEA,WAAW,KAAK,QAAQ,IACxBQ,kBAAkB,IAClBC,MAAM,CAACC,UAAU,CAACN,wBAAwB,CAACE,IAAI,CAAC,CAACK,OAAO,EACxD;AACA,IAAA,OAAO,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,OAAO,OAAO,CAAA;AAChB;;ICzBaC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,I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AAG,CAAC5B,OAAO,GAAGQ,KAAK,CAAA;AACrB,GAAC,EAAE,CAACA,KAAK,CAAC,CAAC,CAAA;EAEX,OAAOoB,GAAG,CAAC5B,OAAO,CAAA;AACpB;;ACLa6B,IAAAA,YAAY,gBAAGC,aAAa,CAAe;AACtD;AACAC,EAAAA,KAAK,EAAE,IAAI;AACXzH,EAAAA,WAAW,EAAE,OAAO;AACpB+C,EAAAA,QAAQ,EAAE,WAAW;EACrB8B,cAAc,EAAE,SAAAA,cAAA,GAAA;AAAA,IAAA,OAAM,IAAI,CAAA;AAAA,GAAA;AAC5B,CAAC,EAAC;AAEF,IAAM6C,QAAQ,GAAG,SAAXA,QAAQA,GAAuB;AACnC,EAAA,IAAMC,YAAY,GAAGC,UAAU,CAAeL,YAAY,CAAC,CAAA;AAe3D,EAAA,OAAOI,YAAY,CAAA;AACrB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorpay/blade",
|
|
3
3
|
"description": "The Design System that powers Razorpay",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.16.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18.12.1"
|
|
@@ -119,10 +119,12 @@
|
|
|
119
119
|
"@use-gesture/react": "10.2.24",
|
|
120
120
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
121
121
|
"use-presence": "1.1.0",
|
|
122
|
-
"@floating-ui/react": "0.
|
|
123
|
-
"@floating-ui/react-native": "0.10.
|
|
122
|
+
"@floating-ui/react": "0.25.4",
|
|
123
|
+
"@floating-ui/react-native": "0.10.1",
|
|
124
124
|
"patch-package": "7.0.0",
|
|
125
|
-
"tinycolor2": "1.6.0"
|
|
125
|
+
"tinycolor2": "1.6.0",
|
|
126
|
+
"react-native-tab-view": "3.5.2",
|
|
127
|
+
"react-native-pager-view": "6.2.1"
|
|
126
128
|
},
|
|
127
129
|
"devDependencies": {
|
|
128
130
|
"chromatic": "6.22.0",
|
|
@@ -160,6 +162,8 @@
|
|
|
160
162
|
"@storybook/preset-create-react-app": "3.2.0",
|
|
161
163
|
"@storybook/react": "6.5.16",
|
|
162
164
|
"@storybook/react-native": "6.5.5",
|
|
165
|
+
"storybook-react-router": "1.0.8",
|
|
166
|
+
"react-router-dom": "5.3.4",
|
|
163
167
|
"@testing-library/jest-dom": "5.16.4",
|
|
164
168
|
"@testing-library/jest-native": "5.4.2",
|
|
165
169
|
"@testing-library/react": "13.4.0",
|
|
@@ -179,6 +183,8 @@
|
|
|
179
183
|
"@types/styled-components": "5.1.25",
|
|
180
184
|
"@types/styled-components-react-native": "5.1.3",
|
|
181
185
|
"@types/tinycolor2": "1.4.3",
|
|
186
|
+
"@types/react-router-dom": "5.3.3",
|
|
187
|
+
"@types/storybook-react-router": "1.0.5",
|
|
182
188
|
"any-leaf": "1.2.2",
|
|
183
189
|
"args-parser": "1.3.0",
|
|
184
190
|
"babel-jest": "29.6.1",
|
|
@@ -213,6 +219,8 @@
|
|
|
213
219
|
"react-native-gesture-handler": "2.9.0",
|
|
214
220
|
"react-native-reanimated": "3.4.1",
|
|
215
221
|
"react-native-svg": "12.3.0",
|
|
222
|
+
"react-native-tab-view": "3.5.2",
|
|
223
|
+
"react-native-pager-view": "6.2.1",
|
|
216
224
|
"react-scripts": "4.0.3",
|
|
217
225
|
"react-test-renderer": "18.2.0",
|
|
218
226
|
"rollup": "3.28.1",
|
|
@@ -231,12 +239,14 @@
|
|
|
231
239
|
"peerDependencies": {
|
|
232
240
|
"@gorhom/bottom-sheet": "^4",
|
|
233
241
|
"@gorhom/portal": "1.0.14",
|
|
234
|
-
"@floating-ui/react": "0.
|
|
242
|
+
"@floating-ui/react": "0.25.4",
|
|
235
243
|
"@floating-ui/react-native": "0.10.0",
|
|
236
244
|
"react": ">=18",
|
|
237
245
|
"react-dom": ">=18",
|
|
238
246
|
"react-native": "^0.72",
|
|
239
247
|
"react-native-reanimated": "^3.4.1",
|
|
248
|
+
"react-native-tab-view": "3.5.2",
|
|
249
|
+
"react-native-pager-view": "6.2.1",
|
|
240
250
|
"react-native-svg": "^12.3.0",
|
|
241
251
|
"styled-components": "^5",
|
|
242
252
|
"react-native-gesture-handler": "^2.9.0"
|