@razorpay/blade 9.4.1 → 9.5.1
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 +19 -14
- package/build/components/{index.web.js → index.development.web.js} +215 -127
- package/build/components/index.development.web.js.map +1 -0
- package/build/components/index.native.d.ts +17 -12
- package/build/components/index.native.js +36 -36
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.production.web.js +29819 -0
- package/build/components/index.production.web.js.map +1 -0
- 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/tokens/{index.web.js → index.development.web.js} +21 -14
- package/build/tokens/index.development.web.js.map +1 -0
- package/build/tokens/index.native.js +2 -2
- package/build/tokens/index.native.js.map +1 -1
- package/build/tokens/index.production.web.js +8407 -0
- package/build/tokens/index.production.web.js.map +1 -0
- package/build/utils/index.d.ts +9 -5
- package/build/utils/{index.web.js → index.development.web.js} +12 -8
- package/build/utils/index.development.web.js.map +1 -0
- package/build/utils/index.native.d.ts +9 -5
- package/build/utils/index.native.js +2 -2
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.production.web.js +322 -0
- package/build/utils/index.production.web.js.map +1 -0
- package/package.json +19 -11
- package/build/components/index.web.js.map +0 -1
- package/build/tokens/index.web.js.map +0 -1
- package/build/utils/index.web.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.production.web.js","sources":["../../src/utils/getColorScheme/getColorScheme.web.ts","../../src/utils/getMediaQuery/getMediaQuery.ts","../../src/utils/getPlatformType/getPlatformType.ts","../../src/utils/useBreakpoint/useBreakpoint.ts","../../src/utils/useColorScheme/useColorScheme.ts","../../src/utils/platform/isReactNative.ts","../../src/utils/platform/getOS.web.ts","../../src/utils/platform/platform.ts","../../src/utils/platform/castUtils.ts","../../src/utils/makeBorderSize/makeBorderSize.ts","../../src/utils/makeMotionTime/makeMotionTime.web.ts","../../src/utils/makeSpace/makeSpace.ts","../../src/utils/makeTypographySize/makeTypographySize.web.ts","../../src/utils/makeSize/makeSize.ts","../../src/utils/toTitleCase/toTitleCase.ts","../../src/utils/usePrevious/usePrevious.ts","../../src/components/BladeProvider/useTheme.ts"],"sourcesContent":["import type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\n\nexport const getColorScheme = (colorScheme: ColorSchemeNamesInput = 'light'): ColorSchemeNames => {\n // @TODO: create a useMediaQuery hook with an event listener which will subscribe to changes and move all this logic there\n const colorSchemeMediaQueryMap = {\n light: '(prefers-color-scheme: light)',\n dark: '(prefers-color-scheme: dark)',\n system: 'default',\n };\n const supportsMatchMedia =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n\n if (colorScheme === 'light' || colorScheme === 'dark') {\n return colorScheme;\n }\n\n if (\n colorScheme === 'system' &&\n supportsMatchMedia &&\n window.matchMedia(colorSchemeMediaQueryMap.dark).matches\n ) {\n return 'dark';\n }\n\n return 'light';\n};\n","export const getMediaQuery = ({ min, max }: { min: number; max?: number }): string => {\n return `screen and (min-width: ${min}px)${max ? ` and (max-width: ${max}px)` : ''}`;\n};\n","export type PlatformTypes = 'browser' | 'node' | 'react-native' | 'unknown';\n\nexport const getPlatformType = (): PlatformTypes => {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return 'react-native';\n }\n\n if (typeof document !== 'undefined') {\n return 'browser';\n }\n\n if (typeof process !== 'undefined') {\n return 'node';\n }\n\n return 'unknown';\n};\n","/* eslint-disable @typescript-eslint/restrict-plus-operands */\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport { getPlatformType } from '../getPlatformType';\nimport { getMediaQuery } from '../getMediaQuery';\nimport type { Breakpoints } from '~tokens/global';\n\nconst deviceType = {\n desktop: 'desktop',\n mobile: 'mobile',\n} as const;\n\ntype DeviceType = keyof typeof deviceType;\ntype Breakpoint = keyof Breakpoints | undefined;\n\ntype BreakpointAndDevice = {\n matchedBreakpoint: Breakpoint;\n matchedDeviceType: DeviceType;\n};\n\nexport const useBreakpoint = ({\n breakpoints,\n}: {\n breakpoints: Breakpoints;\n}): BreakpointAndDevice => {\n const supportsMatchMedia =\n typeof document !== 'undefined' &&\n typeof window !== 'undefined' &&\n typeof window?.matchMedia === 'function';\n\n const breakpointsTokenAndQueryCollection = useMemo(\n () =>\n (supportsMatchMedia\n ? Object.entries(breakpoints).map(([token, screenSize], index, breakpointsArray) => {\n const min = screenSize;\n const maxValue = breakpointsArray[index + 1]?.[1];\n const mediaQuery = getMediaQuery({ min, max: maxValue ? maxValue - 1 : undefined });\n return { token, screenSize, mediaQuery };\n })\n : []) as {\n token: keyof Breakpoints;\n screenSize: number;\n mediaQuery: string;\n }[],\n [breakpoints, supportsMatchMedia],\n );\n\n const getMatchedDeviceType = useCallback((matchedBreakpoint: Breakpoint): DeviceType => {\n let matchedDeviceType: DeviceType = deviceType.mobile;\n const platform = getPlatformType();\n if (platform === 'react-native') {\n matchedDeviceType = deviceType.mobile;\n } else if (platform === 'browser') {\n if (matchedBreakpoint && ['base', 'xs', 's'].includes(matchedBreakpoint)) {\n // tablet is also categorised as mobile\n matchedDeviceType = deviceType.mobile;\n } else {\n matchedDeviceType = deviceType.desktop;\n }\n } else if (platform === 'node') {\n //@TODO: Check for useragent for node\n matchedDeviceType = deviceType.desktop;\n }\n return matchedDeviceType;\n }, []);\n\n const getMatchedBreakpoint = useCallback(\n (event?: MediaQueryListEvent): Breakpoint => {\n const matchedBreakpoint =\n breakpointsTokenAndQueryCollection.find(({ mediaQuery = '' }) => {\n // this will run whenever mediaQuery change event is triggered\n if (event?.media === mediaQuery) {\n return true;\n }\n // this will run when the state is initialised for the first time and hence the event object will be empty so we'll fallback to browser's window object\n if (window.matchMedia(mediaQuery).matches) {\n return true;\n }\n return false;\n })?.token ?? undefined;\n\n return matchedBreakpoint;\n },\n [breakpointsTokenAndQueryCollection],\n );\n\n const [breakpointAndDevice, setBreakpointAndDevice] = useState(() => {\n const matchedBreakpoint = getMatchedBreakpoint();\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n return {\n matchedBreakpoint,\n matchedDeviceType,\n };\n });\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return undefined;\n }\n\n const handleMediaQueryChange = (event: MediaQueryListEvent): void => {\n setBreakpointAndDevice(() => {\n const matchedBreakpoint = getMatchedBreakpoint(event);\n const matchedDeviceType = getMatchedDeviceType(matchedBreakpoint);\n\n return { matchedBreakpoint, matchedDeviceType };\n });\n };\n\n const mediaQueryInstances = breakpointsTokenAndQueryCollection.map(({ mediaQuery = '' }) => {\n const mediaQueryInstance = window.matchMedia(mediaQuery);\n /**\n * the mediaquery event listener is available on mediaQuery instances and not `window`\n * we iterate over all the breakpoints we have, register each instance and store them as `mediaQueryInstances` so we can later unregister all of them.\n */\n if (mediaQueryInstance.addEventListener) {\n mediaQueryInstance.addEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using addListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener\n mediaQueryInstance.addListener(handleMediaQueryChange);\n }\n return mediaQueryInstance;\n });\n\n return (): void => {\n mediaQueryInstances.forEach((mediaQueryInstance) => {\n if (mediaQueryInstance.removeEventListener) {\n mediaQueryInstance.removeEventListener('change', handleMediaQueryChange);\n } else {\n // In older browsers MediaQueryList do not yet inherit from EventTarget, So using removeListener as fallback - https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/removeListener\n mediaQueryInstance.removeListener(handleMediaQueryChange);\n }\n });\n };\n }, [\n breakpointsTokenAndQueryCollection,\n getMatchedBreakpoint,\n getMatchedDeviceType,\n supportsMatchMedia,\n ]);\n\n // @TODO: handle SSR scenarios\n return breakpointAndDevice;\n};\n","import { useState, useCallback } from 'react';\nimport { getColorScheme } from '../getColorScheme';\nimport { colorSchemeNamesInput } from '~tokens/theme/theme';\nimport type { ColorSchemeNames, ColorSchemeNamesInput } from '~tokens/theme';\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 throw new Error(\n `[useColorScheme]: Expected color scheme to be one of [${colorSchemeNamesInput.toString()}] but received ${colorScheme}`,\n );\n }\n }\n setColorSchemeState(getColorScheme(colorScheme));\n }, []);\n\n return {\n colorScheme: colorSchemeState,\n setColorScheme,\n };\n};\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","/* eslint-disable @typescript-eslint/no-namespace */\nimport type { Brand, NativeOrWebBrand } from './types';\n\nnamespace Platform {\n export type Name = 'web';\n /**\n * Right now, the module resolution is set to resolve `.web` files,\n *\n * Thus Platform.Select<> type will return the `web` type\n */\n export type Select<Options extends { web: unknown; native: unknown }> = Brand<\n Options[Name],\n 'platform-web'\n >;\n\n export type CastNative<T extends NativeOrWebBrand | undefined> = Extract<\n T,\n { __brand__?: 'platform-native' | 'platform-all' }\n >;\n\n export type CastWeb<T extends NativeOrWebBrand | undefined> = Extract<\n T,\n { __brand__?: 'platform-web' | 'platform-all' }\n >;\n}\n\nexport { Platform };\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 { UseColorScheme } from '../../utils/useColorScheme';\nimport type { Theme } from './';\nimport type { TypographyPlatforms } from '~tokens/global';\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 throw new Error(`[@razorpay/blade:BladeProvider]: BladeProvider is missing theme`);\n }\n if (themeContext === undefined) {\n throw new Error(\n `[@razorpay/blade:BladeProvider]: useTheme must be used within BladeProvider`,\n );\n }\n }\n return themeContext;\n};\n\nexport default useTheme;\n"],"names":["getColorScheme","colorScheme","colorSchemeMediaQueryMap","light","dark","system","supportsMatchMedia","window","matchMedia","matches","getMediaQuery","min","max","getPlatformType","navigator","product","document","process","deviceType","desktop","mobile","useBreakpoint","breakpoints","breakpointsTokenAndQueryCollection","useMemo","Object","entries","map","index","breakpointsArray","token","screenSize","maxValue","mediaQuery","undefined","getMatchedDeviceType","useCallback","matchedBreakpoint","matchedDeviceType","platform","includes","getMatchedBreakpoint","event","find","media","useState","breakpointAndDevice","setBreakpointAndDevice","useEffect","handleMediaQueryChange","mediaQueryInstances","mediaQueryInstance","addEventListener","addListener","forEach","removeEventListener","removeListener","useColorScheme","initialColorScheme","colorSchemeState","setColorSchemeState","setColorScheme","setThemeMode","isReactNative","getOS","isAndroid","Platform","castWebType","value","castNativeType","makeBorderSize","size","makeMotionTime","time","makeSpace","makeTypographySize","remValue","makeSize","toTitleCase","inputString","toLowerCase","split","word","charAt","toUpperCase","slice","join","usePrevious","ref","useRef","current","ThemeContext","createContext","theme","useTheme","themeContext","useContext"],"mappings":";;;IAEaA,cAAc,GAAG,SAAjBA,cAAiB,GAAoE;AAAA,MAAnEC,WAAmE,uEAA9B,OAA8B;AAChG;AACA,MAAMC,wBAAwB,GAAG;AAC/BC,IAAAA,KAAK,EAAE,+BADwB;AAE/BC,IAAAA,IAAI,EAAE,8BAFyB;AAG/BC,IAAAA,MAAM,EAAE;AAHuB,GAAjC;AAKA,MAAMC,kBAAkB,GACtB,OAAOC,MAAP,KAAkB,WAAlB,IAAiC,OAAOA,MAAM,CAACC,UAAd,KAA6B,UADhE;;AAGA,MAAIP,WAAW,KAAK,OAAhB,IAA2BA,WAAW,KAAK,MAA/C,EAAuD;AACrD,WAAOA,WAAP;AACD;;AAED,MACEA,WAAW,KAAK,QAAhB,IACAK,kBADA,IAEAC,MAAM,CAACC,UAAP,CAAkBN,wBAAwB,CAACE,IAA3C,EAAiDK,OAHnD,EAIE;AACA,WAAO,MAAP;AACD;;AAED,SAAO,OAAP;AACD;;ICzBYC,aAAa,GAAG,SAAhBA,aAAgB,OAAyD;AAAA,MAAtDC,GAAsD,QAAtDA,GAAsD;AAAA,MAAjDC,GAAiD,QAAjDA,GAAiD;AACpF,0CAAiCD,GAAjC,gBAA0CC,GAAG,8BAAuBA,GAAvB,WAAkC,EAA/E;AACD;;ICAYC,eAAe,GAAG,SAAlBA,eAAkB,GAAqB;AAClD,MAAI,OAAOC,SAAP,KAAqB,WAArB,IAAoCA,SAAS,CAACC,OAAV,KAAsB,aAA9D,EAA6E;AAC3E,WAAO,cAAP;AACD;;AAED,MAAI,OAAOC,QAAP,KAAoB,WAAxB,EAAqC;AACnC,WAAO,SAAP;AACD;;AAED,MAAI,OAAOC,OAAP,KAAmB,WAAvB,EAAoC;AAClC,WAAO,MAAP;AACD;;AAED,SAAO,SAAP;AACD;;ACVD,IAAMC,UAAU,GAAG;A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,QAAQ,EAAE,WAJ4C;AAKtDsB,EAAAA,cAAc,EAAE;AAAA,WAAM,IAAN;AAAA;AALsC,CAAf;;IAQnCiC,QAAQ,GAAG,SAAXA,QAAW,GAAoB;AACnC,MAAMC,YAAY,GAAGC,UAAU,CAAeL,YAAf,CAA/B;;AAWA,SAAOI,YAAP;AACD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorpay/blade",
|
|
3
3
|
"description": "The Design System that powers Razorpay",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.5.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18.12.1"
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"default": {
|
|
41
41
|
"types": "./build/components/index.d.ts",
|
|
42
|
-
"
|
|
42
|
+
"development": "./build/components/index.development.web.js",
|
|
43
|
+
"production": "./build/components/index.production.web.js",
|
|
44
|
+
"default": "./build/components/index.development.web.js"
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
"./tokens": {
|
|
@@ -49,7 +51,9 @@
|
|
|
49
51
|
},
|
|
50
52
|
"default": {
|
|
51
53
|
"types": "./build/tokens/index.d.ts",
|
|
52
|
-
"
|
|
54
|
+
"development": "./build/tokens/index.development.web.js",
|
|
55
|
+
"production": "./build/tokens/index.production.web.js",
|
|
56
|
+
"default": "./build/tokens/index.development.web.js"
|
|
53
57
|
}
|
|
54
58
|
},
|
|
55
59
|
"./utils": {
|
|
@@ -59,7 +63,9 @@
|
|
|
59
63
|
},
|
|
60
64
|
"default": {
|
|
61
65
|
"types": "./build/utils/index.d.ts",
|
|
62
|
-
"
|
|
66
|
+
"development": "./build/utils/index.development.web.js",
|
|
67
|
+
"production": "./build/utils/index.production.web.js",
|
|
68
|
+
"default": "./build/utils/index.development.web.js"
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
},
|
|
@@ -80,8 +86,9 @@
|
|
|
80
86
|
"types:copy-declarations:native": "copyfiles -u 1 \"src/**/*.d.ts\" build/types/native",
|
|
81
87
|
"build:generate-root-imports": "rollup -c && node ./scripts/generateRootImports.js",
|
|
82
88
|
"build:clean-declarations": "rm -rf build/types",
|
|
83
|
-
"build:react": "FRAMEWORK=REACT rollup -c
|
|
84
|
-
"build:react-
|
|
89
|
+
"build:react-dev": "FRAMEWORK=REACT NODE_ENV=development rollup -c",
|
|
90
|
+
"build:react-prod": "FRAMEWORK=REACT NODE_ENV=production rollup -c",
|
|
91
|
+
"build:react-native": "FRAMEWORK=REACT_NATIVE rollup -c",
|
|
85
92
|
"build:generate-css-variables": "GENERATE_CSS_VARIABLES=true FRAMEWORK=REACT rollup -c && node ./scripts/generateCssThemeVariables.js",
|
|
86
93
|
"build:clean-theme-bundle": "rm -rf build/js-bundle-for-css",
|
|
87
94
|
"react-native:get-stories": "sb-rn-get-stories --config-path=./.storybook/react-native && yarn prettier --write ./.storybook/react-native/storybook.requires.js",
|
|
@@ -133,6 +140,7 @@
|
|
|
133
140
|
"@rollup/plugin-babel": "5.3.1",
|
|
134
141
|
"@rollup/plugin-commonjs": "21.1.0",
|
|
135
142
|
"@rollup/plugin-node-resolve": "13.1.1",
|
|
143
|
+
"@rollup/plugin-replace": "5.0.2",
|
|
136
144
|
"@size-limit/preset-big-lib": "8.2.4",
|
|
137
145
|
"@storybook/addon-a11y": "6.3.0",
|
|
138
146
|
"@storybook/addon-actions": "6.3.0",
|
|
@@ -247,7 +255,7 @@
|
|
|
247
255
|
"files": [
|
|
248
256
|
{
|
|
249
257
|
"friendlyName": "Web Components",
|
|
250
|
-
"path": "./build/components/index.web.js"
|
|
258
|
+
"path": "./build/components/index.production.web.js"
|
|
251
259
|
},
|
|
252
260
|
{
|
|
253
261
|
"friendlyName": "React Native Components",
|
|
@@ -255,7 +263,7 @@
|
|
|
255
263
|
},
|
|
256
264
|
{
|
|
257
265
|
"friendlyName": "Web Tokens",
|
|
258
|
-
"path": "./build/tokens/index.web.js"
|
|
266
|
+
"path": "./build/tokens/index.production.web.js"
|
|
259
267
|
},
|
|
260
268
|
{
|
|
261
269
|
"friendlyName": "React Native Tokens",
|
|
@@ -267,7 +275,7 @@
|
|
|
267
275
|
},
|
|
268
276
|
{
|
|
269
277
|
"friendlyName": "Web Utils",
|
|
270
|
-
"path": "./build/utils/index.web.js"
|
|
278
|
+
"path": "./build/utils/index.production.web.js"
|
|
271
279
|
},
|
|
272
280
|
{
|
|
273
281
|
"friendlyName": "React Native Utils",
|
|
@@ -281,14 +289,14 @@
|
|
|
281
289
|
"size-limit": [
|
|
282
290
|
{
|
|
283
291
|
"name": "Import Button only",
|
|
284
|
-
"path": "./build/components/index.web.js",
|
|
292
|
+
"path": "./build/components/index.production.web.js",
|
|
285
293
|
"import": "{ Button }",
|
|
286
294
|
"limit": "20 kb",
|
|
287
295
|
"running": false
|
|
288
296
|
},
|
|
289
297
|
{
|
|
290
298
|
"name": "Import Text only",
|
|
291
|
-
"path": "./build/components/index.web.js",
|
|
299
|
+
"path": "./build/components/index.production.web.js",
|
|
292
300
|
"import": "{ Text }",
|
|
293
301
|
"limit": "15 kb",
|
|
294
302
|
"running": false
|