@razorpay/blade 10.18.1 → 10.19.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 +315 -1
- package/build/components/index.development.web.js +9251 -3311
- package/build/components/index.development.web.js.map +1 -1
- package/build/components/index.native.d.ts +316 -1
- package/build/components/index.native.js +18 -6
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.production.web.js +9236 -3306
- package/build/components/index.production.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +1 -1
- package/build/css/bankingThemeDarkMobile.css +1 -1
- package/build/css/bankingThemeLightDesktop.css +1 -1
- package/build/css/bankingThemeLightMobile.css +1 -1
- package/build/css/paymentThemeDarkDesktop.css +1 -1
- package/build/css/paymentThemeDarkMobile.css +1 -1
- package/build/css/paymentThemeLightDesktop.css +1 -1
- package/build/css/paymentThemeLightMobile.css +1 -1
- package/build/utils/index.development.web.js +30 -24
- package/build/utils/index.development.web.js.map +1 -1
- package/build/utils/index.native.js +4 -4
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.production.web.js +30 -24
- package/build/utils/index.production.web.js.map +1 -1
- package/package.json +10 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useMemo, useCallback, useState,
|
|
3
|
+
import React__default, { useMemo, useCallback, useState, useRef, useEffect, createContext, useContext } from 'react';
|
|
4
4
|
|
|
5
5
|
var getColorScheme = function getColorScheme() {
|
|
6
6
|
var colorScheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
|
|
@@ -39,6 +39,20 @@ var getPlatformType = function getPlatformType() {
|
|
|
39
39
|
return 'unknown';
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
var isBrowser = getPlatformType() == 'browser';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser
|
|
46
|
+
* (for SSR reasons)
|
|
47
|
+
*
|
|
48
|
+
* React currently throws a warning when using useLayoutEffect on the server.
|
|
49
|
+
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
50
|
+
* useLayoutEffect in the browser.
|
|
51
|
+
*
|
|
52
|
+
* @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
53
|
+
*/
|
|
54
|
+
var useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
55
|
+
|
|
42
56
|
var deviceType = {
|
|
43
57
|
desktop: 'desktop',
|
|
44
58
|
mobile: 'mobile'
|
|
@@ -93,7 +107,8 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
93
107
|
if ((event === null || event === void 0 ? void 0 : event.media) === mediaQuery) {
|
|
94
108
|
return true;
|
|
95
109
|
}
|
|
96
|
-
|
|
110
|
+
|
|
111
|
+
// this will run when the state is initialised for the first time and hence the event object will be empty because the event listener wouldn't have triggered
|
|
97
112
|
if (window.matchMedia(mediaQuery).matches) {
|
|
98
113
|
return true;
|
|
99
114
|
}
|
|
@@ -101,18 +116,25 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
101
116
|
})) === null || _breakpointsTokenAndQ2 === void 0 ? void 0 : _breakpointsTokenAndQ2.token) !== null && _breakpointsTokenAndQ !== void 0 ? _breakpointsTokenAndQ : undefined;
|
|
102
117
|
return matchedBreakpoint;
|
|
103
118
|
}, [breakpointsTokenAndQueryCollection]);
|
|
104
|
-
var _useState = useState(
|
|
119
|
+
var _useState = useState({
|
|
120
|
+
matchedBreakpoint: undefined,
|
|
121
|
+
matchedDeviceType: deviceType.desktop
|
|
122
|
+
}),
|
|
123
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
124
|
+
breakpointAndDevice = _useState2[0],
|
|
125
|
+
setBreakpointAndDevice = _useState2[1];
|
|
126
|
+
useIsomorphicLayoutEffect(function () {
|
|
127
|
+
// set the breakpoint and devicetype for the first time because eventlisteners will only trigger after the screen is actually changed
|
|
128
|
+
setBreakpointAndDevice(function () {
|
|
105
129
|
var matchedBreakpoint = getMatchedBreakpoint();
|
|
106
130
|
var matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);
|
|
107
131
|
return {
|
|
108
132
|
matchedBreakpoint: matchedBreakpoint,
|
|
109
133
|
matchedDeviceType: matchedDeviceType
|
|
110
134
|
};
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
setBreakpointAndDevice = _useState2[1];
|
|
115
|
-
useEffect(function () {
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// for react-native and SSR we don't need to register event listeners
|
|
116
138
|
if (!supportsMatchMedia) {
|
|
117
139
|
return undefined;
|
|
118
140
|
}
|
|
@@ -153,8 +175,6 @@ var useBreakpoint = function useBreakpoint(_ref) {
|
|
|
153
175
|
});
|
|
154
176
|
};
|
|
155
177
|
}, [breakpointsTokenAndQueryCollection, getMatchedBreakpoint, getMatchedDeviceType, supportsMatchMedia]);
|
|
156
|
-
|
|
157
|
-
// @TODO: handle SSR scenarios
|
|
158
178
|
return breakpointAndDevice;
|
|
159
179
|
};
|
|
160
180
|
|
|
@@ -204,20 +224,6 @@ var useColorScheme = function useColorScheme() {
|
|
|
204
224
|
};
|
|
205
225
|
};
|
|
206
226
|
|
|
207
|
-
var isBrowser = getPlatformType() == 'browser';
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* useIsomorphicLayoutEffect enables us to safely call `useLayoutEffect` on the browser
|
|
211
|
-
* (for SSR reasons)
|
|
212
|
-
*
|
|
213
|
-
* React currently throws a warning when using useLayoutEffect on the server.
|
|
214
|
-
* To get around it, we can conditionally useEffect on the server (no-op) and
|
|
215
|
-
* useLayoutEffect in the browser.
|
|
216
|
-
*
|
|
217
|
-
* @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
218
|
-
*/
|
|
219
|
-
var useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
220
|
-
|
|
221
227
|
/* eslint-disable consistent-return */
|
|
222
228
|
function useInterval(callback, _ref) {
|
|
223
229
|
var delay = _ref.delay,
|
|
@@ -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\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 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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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/useIsomorphicLayoutEffect.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/tokens/theme/theme.ts","../../src/utils/logger/logger.ts","../../src/utils/useColorScheme/useColorScheme.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","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 @typescript-eslint/restrict-plus-operands */\nimport { useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\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\n // this will run when the state is initialised for the first time and hence the event object will be empty because the event listener wouldn't have triggered\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState<BreakpointAndDevice>({\n matchedBreakpoint: undefined,\n matchedDeviceType: deviceType.desktop,\n });\n\n useIsomorphicLayoutEffect(() => {\n // set the breakpoint and devicetype for the first time because eventlisteners will only trigger after the screen is actually changed\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return { matchedBreakpoint, matchedDeviceType };\n });\n\n // for react-native and SSR we don't need to register event listeners\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 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 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 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","/* 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","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useEffect","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","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","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,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WAAW,EAAE,OAAO;AACpBoD,EAAAA,QAAQ,EAAE,WAAW;EACrBoC,cAAc,EAAE,SAAAA,cAAA,GAAA;AAAA,IAAA,OAAM,IAAI,CAAA;AAAA,GAAA;AAC5B,CAAC,EAAC;AAEF,IAAM0C,QAAQ,GAAG,SAAXA,QAAQA,GAAuB;AACnC,EAAA,IAAMC,YAAY,GAAGC,UAAU,CAAeL,YAAY,CAAC,CAAA;AAC3D,EAAa;AACX,IAAA,IAAI,CAACI,YAAY,CAACF,KAAK,EAAE;AACvBlD,MAAAA,eAAe,CAAC;AACdC,QAAAA,OAAO,EAAE,gCAAgC;AACzCC,QAAAA,UAAU,EAAE,eAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;IACA,IAAIkD,YAAY,KAAKhI,SAAS,EAAE;AAC9B4E,MAAAA,eAAe,CAAC;AACdC,QAAAA,OAAO,EAAE,4CAA4C;AACrDC,QAAAA,UAAU,EAAE,eAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;AACF,GAAA;AACA,EAAA,OAAOkD,YAAY,CAAA;AACrB;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Appearance, Platform } from 'react-native';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { useMemo, useCallback, useState,
|
|
4
|
+
import React__default, { useMemo, useCallback, useState, useRef, useEffect, createContext, useContext } from 'react';
|
|
5
5
|
|
|
6
6
|
var getColorScheme=function getColorScheme(){var colorScheme=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'light';if(colorScheme==='light'||colorScheme==='dark'){return colorScheme;}if(colorScheme==='system'){var _Appearance$getColorS;return (_Appearance$getColorS=Appearance.getColorScheme())!=null?_Appearance$getColorS:'light';}return 'light';};
|
|
7
7
|
|
|
@@ -9,7 +9,9 @@ var getMediaQuery=function getMediaQuery(_ref){var min=_ref.min,max=_ref.max;ret
|
|
|
9
9
|
|
|
10
10
|
var getPlatformType=function getPlatformType(){if(typeof navigator!=='undefined'&&navigator.product==='ReactNative'){return 'react-native';}if(typeof document!=='undefined'){return 'browser';}if(typeof process!=='undefined'){return 'node';}return 'unknown';};
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var isBrowser=getPlatformType()=='browser';var useIsomorphicLayoutEffect=isBrowser?React.useLayoutEffect:React.useEffect;
|
|
13
|
+
|
|
14
|
+
var deviceType={desktop:'desktop',mobile:'mobile'};var useBreakpoint=function useBreakpoint(_ref){var _window;var breakpoints=_ref.breakpoints;var supportsMatchMedia=typeof document!=='undefined'&&typeof window!=='undefined'&&typeof((_window=window)==null?void 0:_window.matchMedia)==='function';var breakpointsTokenAndQueryCollection=useMemo(function(){return supportsMatchMedia?Object.entries(breakpoints).map(function(_ref2,index,breakpointsArray){var _breakpointsArray;var _ref3=_slicedToArray(_ref2,2),token=_ref3[0],screenSize=_ref3[1];var min=screenSize;var maxValue=(_breakpointsArray=breakpointsArray[index+1])==null?void 0:_breakpointsArray[1];var mediaQuery=getMediaQuery({min:min,max:maxValue?maxValue-1:undefined});return {token:token,screenSize:screenSize,mediaQuery:mediaQuery};}):[];},[breakpoints,supportsMatchMedia]);var getMatchedDeviceType=useCallback(function(matchedBreakpoint){var matchedDeviceType=deviceType.mobile;var platform=getPlatformType();if(platform==='react-native'){matchedDeviceType=deviceType.mobile;}else if(platform==='browser'){if(matchedBreakpoint&&['base','xs','s'].includes(matchedBreakpoint)){matchedDeviceType=deviceType.mobile;}else {matchedDeviceType=deviceType.desktop;}}else if(platform==='node'){matchedDeviceType=deviceType.desktop;}return matchedDeviceType;},[]);var getMatchedBreakpoint=useCallback(function(event){var _breakpointsTokenAndQ,_breakpointsTokenAndQ2;var matchedBreakpoint=(_breakpointsTokenAndQ=(_breakpointsTokenAndQ2=breakpointsTokenAndQueryCollection.find(function(_ref4){var _ref4$mediaQuery=_ref4.mediaQuery,mediaQuery=_ref4$mediaQuery===void 0?'':_ref4$mediaQuery;if((event==null?void 0:event.media)===mediaQuery){return true;}if(window.matchMedia(mediaQuery).matches){return true;}return false;}))==null?void 0:_breakpointsTokenAndQ2.token)!=null?_breakpointsTokenAndQ:undefined;return matchedBreakpoint;},[breakpointsTokenAndQueryCollection]);var _useState=useState({matchedBreakpoint:undefined,matchedDeviceType:deviceType.desktop}),_useState2=_slicedToArray(_useState,2),breakpointAndDevice=_useState2[0],setBreakpointAndDevice=_useState2[1];useIsomorphicLayoutEffect(function(){setBreakpointAndDevice(function(){var matchedBreakpoint=getMatchedBreakpoint();var matchedDeviceType=getMatchedDeviceType(matchedBreakpoint);return {matchedBreakpoint:matchedBreakpoint,matchedDeviceType:matchedDeviceType};});if(!supportsMatchMedia){return undefined;}var handleMediaQueryChange=function handleMediaQueryChange(event){setBreakpointAndDevice(function(){var matchedBreakpoint=getMatchedBreakpoint(event);var matchedDeviceType=getMatchedDeviceType(matchedBreakpoint);return {matchedBreakpoint:matchedBreakpoint,matchedDeviceType:matchedDeviceType};});};var mediaQueryInstances=breakpointsTokenAndQueryCollection.map(function(_ref5){var _ref5$mediaQuery=_ref5.mediaQuery,mediaQuery=_ref5$mediaQuery===void 0?'':_ref5$mediaQuery;var mediaQueryInstance=window.matchMedia(mediaQuery);if(mediaQueryInstance.addEventListener){mediaQueryInstance.addEventListener('change',handleMediaQueryChange);}else {mediaQueryInstance.addListener(handleMediaQueryChange);}return mediaQueryInstance;});return function(){mediaQueryInstances.forEach(function(mediaQueryInstance){if(mediaQueryInstance.removeEventListener){mediaQueryInstance.removeEventListener('change',handleMediaQueryChange);}else {mediaQueryInstance.removeListener(handleMediaQueryChange);}});};},[breakpointsTokenAndQueryCollection,getMatchedBreakpoint,getMatchedDeviceType,supportsMatchMedia]);return breakpointAndDevice;};
|
|
13
15
|
|
|
14
16
|
var colorSchemeNamesInput=['light','dark','system'];
|
|
15
17
|
|
|
@@ -17,8 +19,6 @@ var PREFIX='[Blade]:';var throwBladeError=function throwBladeError(_ref){var mes
|
|
|
17
19
|
|
|
18
20
|
var useColorScheme=function useColorScheme(){var initialColorScheme=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'light';var _useState=useState(function(){return getColorScheme(initialColorScheme);}),_useState2=_slicedToArray(_useState,2),colorSchemeState=_useState2[0],setColorSchemeState=_useState2[1];var setColorScheme=useCallback(function setThemeMode(colorScheme){if(__DEV__){if(!colorSchemeNamesInput.includes(colorScheme)){throwBladeError({message:`Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,moduleName:'useColorScheme'});}}setColorSchemeState(getColorScheme(colorScheme));},[]);return {colorScheme:colorSchemeState,setColorScheme:setColorScheme};};
|
|
19
21
|
|
|
20
|
-
var isBrowser=getPlatformType()=='browser';var useIsomorphicLayoutEffect=isBrowser?React.useLayoutEffect:React.useEffect;
|
|
21
|
-
|
|
22
22
|
function useInterval(callback,_ref){var delay=_ref.delay,enable=_ref.enable;var intervalRef=React__default.useRef(null);var savedCallback=React__default.useRef(callback);useIsomorphicLayoutEffect(function(){savedCallback.current=callback;},[callback]);React__default.useEffect(function(){var tick=function tick(){return savedCallback.current();};if(enable){intervalRef.current=window.setInterval(tick,delay);return function(){return window.clearInterval(intervalRef.current);};}return function(){};},[delay,enable]);}
|
|
23
23
|
|
|
24
24
|
var isReactNative=function isReactNative(){return getPlatformType()==='react-native';};
|
|
@@ -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\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 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,OAAQ,0BAAyBD,GAAI,CAAA,GAAA,EAAKC,GAAG,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7B,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/useIsomorphicLayoutEffect.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/tokens/theme/theme.ts","../../src/utils/logger/logger.ts","../../src/utils/useColorScheme/useColorScheme.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","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 @typescript-eslint/restrict-plus-operands */\nimport { useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\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\n // this will run when the state is initialised for the first time and hence the event object will be empty because the event listener wouldn't have triggered\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState<BreakpointAndDevice>({\n matchedBreakpoint: undefined,\n matchedDeviceType: deviceType.desktop,\n });\n\n useIsomorphicLayoutEffect(() => {\n // set the breakpoint and devicetype for the first time because eventlisteners will only trigger after the screen is actually changed\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return { matchedBreakpoint, matchedDeviceType };\n });\n\n // for react-native and SSR we don't need to register event listeners\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 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 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 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","/* 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","isBrowser","useIsomorphicLayoutEffect","React","useLayoutEffect","useEffect","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","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","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,CAC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