react-native-terra-ui 0.3.0 → 0.4.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/CHANGELOG.md +13 -0
- package/lib/module/components/screen/ScreenFlashList.js +32 -26
- package/lib/module/components/screen/ScreenFlashList.js.map +1 -1
- package/lib/module/components/screen/ScreenFlatList.js +37 -31
- package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +24 -18
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/context/ThemeProvider.js +15 -0
- package/lib/module/context/ThemeProvider.js.map +1 -1
- package/lib/module/context/index.js +1 -1
- package/lib/module/context/index.js.map +1 -1
- package/lib/module/theme/breakpoints.js +29 -0
- package/lib/module/theme/breakpoints.js.map +1 -0
- package/lib/module/theme/index.js +4 -0
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/registry.js +3 -1
- package/lib/module/theme/registry.js.map +1 -1
- package/lib/module/theme/screen-margin.js +17 -0
- package/lib/module/theme/screen-margin.js.map +1 -0
- package/lib/module/theme/tokens/primitives.js +12 -2
- package/lib/module/theme/tokens/primitives.js.map +1 -1
- package/lib/typescript/src/components/screen/ScreenFlashList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/context/ThemeProvider.d.ts +8 -0
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/index.d.ts +1 -1
- package/lib/typescript/src/context/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/breakpoints.d.ts +32 -0
- package/lib/typescript/src/theme/breakpoints.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +4 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/registry.d.ts.map +1 -1
- package/lib/typescript/src/theme/screen-margin.d.ts +15 -0
- package/lib/typescript/src/theme/screen-margin.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens/primitives.d.ts +10 -2
- package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +9 -3
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/components/screen/ScreenFlashList.tsx +37 -30
- package/src/components/screen/ScreenFlatList.tsx +41 -34
- package/src/components/screen/ScreenScrollView.tsx +24 -18
- package/src/context/ThemeProvider.tsx +15 -0
- package/src/context/index.ts +1 -1
- package/src/theme/breakpoints.ts +41 -0
- package/src/theme/index.ts +5 -0
- package/src/theme/registry.ts +2 -1
- package/src/theme/screen-margin.ts +26 -0
- package/src/theme/tokens/primitives.ts +12 -2
- package/src/theme/types.ts +12 -2
- package/skills/terra-ui/SKILL.md +0 -193
- package/skills/terra-ui/references/recipes.md +0 -198
- package/skills/terra-ui/references/troubleshooting.md +0 -112
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenScrollView.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/ScreenScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAEtB,OAAiB,EACf,KAAK,sBAAsB,EAG5B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ScreenScrollView.d.ts","sourceRoot":"","sources":["../../../../../src/components/screen/ScreenScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAEtB,OAAiB,EACf,KAAK,sBAAsB,EAG5B,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,YAAS,CAAC;AAGpE,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EACzC,qBAAqB;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,aAAa,EAAE,qBAAqB,EACpC,QAAQ,EAAE,YAAY,EACtB,UAAkB,EAClB,OAAe,EACf,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,GAAG,IAAI,EACR,EAAE,qBAAqB,+BAoEvB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type ResolvedScreenMargin } from '../theme/screen-margin.js';
|
|
2
3
|
import type { Scheme, TerraTheme } from '../theme/types.js';
|
|
3
4
|
/**
|
|
4
5
|
* Root provider for Terra UI. Wrap your app once near the root.
|
|
@@ -26,4 +27,11 @@ export interface UseThemeResult {
|
|
|
26
27
|
* Must be used under {@link TerraUIProvider}.
|
|
27
28
|
*/
|
|
28
29
|
export declare function useTheme(): UseThemeResult;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves `theme.layout.screen.margin` for the current runtime breakpoint.
|
|
32
|
+
* For use outside a `StyleSheet.create` factory (e.g. plain-JS layout maths);
|
|
33
|
+
* inside one, call `resolveScreenMargin(theme, rt.breakpoint)` directly so
|
|
34
|
+
* the value stays reactive without a React re-render.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useScreenMargin(): ResolvedScreenMargin;
|
|
29
37
|
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/context/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAgB,CAAC;AAczD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,iBAAiB,gCAoB9D,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,KAAK,EAAE,UAAU,CAAC;IAClB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,kCAAkC;IAClC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,qCAAqC;IACrC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CAezC"}
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/context/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,2BAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAgB,CAAC;AAczD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,iBAAiB,gCAoB9D,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,KAAK,EAAE,UAAU,CAAC;IAClB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,kCAAkC;IAClC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,qCAAqC;IACrC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CAezC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAGtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/context/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,oBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/context/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,oBAAiB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { UnistylesBreakpoints } from 'react-native-unistyles';
|
|
2
|
+
/**
|
|
3
|
+
* Viewport-width breakpoints (dp), registered with Unistyles via
|
|
4
|
+
* `StyleSheet.configure({ breakpoints })` in {@link ./registry.ts}. `xs` must
|
|
5
|
+
* stay `0` — Unistyles falls back to it below `sm`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const breakpoints: {
|
|
8
|
+
readonly xs: 0;
|
|
9
|
+
readonly sm: 576;
|
|
10
|
+
readonly md: 768;
|
|
11
|
+
readonly lg: 992;
|
|
12
|
+
readonly xl: 1200;
|
|
13
|
+
};
|
|
14
|
+
export type AppBreakpoints = typeof breakpoints;
|
|
15
|
+
export type BreakpointName = keyof AppBreakpoints;
|
|
16
|
+
declare module 'react-native-unistyles' {
|
|
17
|
+
interface UnistylesBreakpoints extends AppBreakpoints {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolves a per-breakpoint record (e.g. `theme.layout.screen.margin.x`) to
|
|
22
|
+
* the value for the current runtime breakpoint (`rt.breakpoint`). A
|
|
23
|
+
* `StyleSheet.create` factory re-runs on breakpoint change, so calling this
|
|
24
|
+
* inside one keeps the resolved value reactive.
|
|
25
|
+
*
|
|
26
|
+
* `rt.breakpoint`'s type also includes Unistyles' built-in `landscape` /
|
|
27
|
+
* `portrait` orientation keys, which this record has no entry for — those
|
|
28
|
+
* (and `undefined`, below the smallest configured breakpoint) fall back to
|
|
29
|
+
* `xs`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveBreakpointValue<T>(values: Record<BreakpointName, T>, breakpoint: keyof UnistylesBreakpoints | undefined): T;
|
|
32
|
+
//# sourceMappingURL=breakpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/theme/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,WAAW,CAAC;AAChD,MAAM,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC;AAElD,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,oBAAqB,SAAQ,cAAc;KAAG;CAChE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,MAAM,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,EACjC,UAAU,EAAE,MAAM,oBAAoB,GAAG,SAAS,GACjD,CAAC,CAIH"}
|
|
@@ -4,8 +4,12 @@ export type { DeepPartial } from '../utils/deep-merge';
|
|
|
4
4
|
export { deepMerge } from '../utils/deep-merge';
|
|
5
5
|
export { resolveThemeColor } from '../utils/resolve-theme-color';
|
|
6
6
|
export { FONT_WEIGHT_VALUE, SYSTEM_FONT } from '../utils/typography';
|
|
7
|
+
export type { AppBreakpoints, BreakpointName } from './breakpoints.js';
|
|
8
|
+
export { breakpoints, resolveBreakpointValue } from './breakpoints.js';
|
|
7
9
|
export { configureTerraUI, getAccentNames, getDefaultRadius, getIcon, getImageComponent, getIsConfigured, getRequiredIcon, getSurfaceElevation, resolveTheme, } from './registry.js';
|
|
8
10
|
export { applyAccent, applyScheme, getCurrentAccent } from './runtime.js';
|
|
11
|
+
export type { ResolvedScreenMargin } from './screen-margin.js';
|
|
12
|
+
export { resolveScreenMargin } from './screen-margin.js';
|
|
9
13
|
export { defaultDarkTheme, defaultLightTheme } from './theme.js';
|
|
10
14
|
export type { Accent, AccentOverride, AccentShorthand, ActionColorToken, BackgroundColorToken, BorderColorToken, ButtonDefaults, ColorToken, ComponentDefaults, ContentColorToken, DefaultRadiusToken, ElevationKey, ElevationScale, ElevationStyle, FontWeightToken, LayoutTokens, OpacityTokens, RadiusComponent, RadiusKey, Scheme, SpacingKey, StatusColorToken, SurfaceColorToken, SurfaceDefaults, TerraConfig, TerraIconComponent, TerraIconName, TerraIconProps, TerraImageComponent, TerraImageContentFit, TerraImageProps, TerraSemanticIconName, TerraTheme, TerraThemeOverride, TextColorToken, TextVariant, ThemeColor, ThemeRadiusOverride, TypeStyle, Typography, } from './types.js';
|
|
11
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM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AE,MAAM,YAAS,CAAC;AAE9D,YAAY,EACV,MAAM,EACN,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACZ,aAAa,EACb,eAAe,EACf,SAAS,EACT,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,UAAU,GACX,MAAM,YAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/theme/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/theme/registry.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,EAEX,MAAM,YAAS,CAAC;AASjB,KAAK,cAAc,GAAG,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;AAWlE,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,eAAe;QAC9B,KAAK,EAAE,UAAU,CAAC;QAClB,IAAI,EAAE,UAAU,CAAC;KAClB;CACF;AAED,UAAU,QAAQ;IAChB,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,cAAc,CAAC;IAC9B,gBAAgB,EAAE,YAAY,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC1C,cAAc,EAAE,mBAAmB,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;CACrB;AAcD,gBAAgB;AAChB,eAAO,MAAM,WAAW,QAAO,QAAoB,CAAC;AAEpD,eAAO,MAAM,eAAe,QAAO,OAA8B,CAAC;AAElE,eAAO,MAAM,cAAc,QAAO,MAAM,EAAmC,CAAC;AAE5E,eAAO,MAAM,iBAAiB,QAAO,mBACZ,CAAC;AAE1B,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,kBAAkB,GAAG,SACS,CAAC;AAEtE,eAAO,MAAM,eAAe,GAC1B,MAAM,qBAAqB,KAC1B,kBAAgE,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,WAAW,eAAe,KACzB,kBAAuD,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAO,YACZ,CAAC;AAE5B,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAI5E;AA2CD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,WAAgB,GAAG,IAAI,CAY/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAOvC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UnistylesBreakpoints } from 'react-native-unistyles';
|
|
2
|
+
import type { TerraTheme } from './types.js';
|
|
3
|
+
export interface ResolvedScreenMargin {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolves both axes of `theme.layout.screen.margin` for the current runtime
|
|
9
|
+
* breakpoint in one call — nearly every consumer needs both axes, so this
|
|
10
|
+
* saves calling `resolveBreakpointValue` twice. Call inside a
|
|
11
|
+
* `StyleSheet.create` factory (passing `rt.breakpoint`) so the result stays
|
|
12
|
+
* reactive to breakpoint changes; outside one, use {@link useScreenMargin}.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveScreenMargin(theme: TerraTheme, breakpoint: keyof UnistylesBreakpoints | undefined): ResolvedScreenMargin;
|
|
15
|
+
//# sourceMappingURL=screen-margin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-margin.d.ts","sourceRoot":"","sources":["../../../../src/theme/screen-margin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACnC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,oBAAoB,GAAG,SAAS,GACjD,oBAAoB,CAKtB"}
|
|
@@ -416,8 +416,16 @@ export declare const primitives: {
|
|
|
416
416
|
'typography.variants.caption.maxFontSizeMultiplier': number;
|
|
417
417
|
'opacity.disabled': number;
|
|
418
418
|
'opacity.pressed': number;
|
|
419
|
-
'layout.screen.margin.x': number;
|
|
420
|
-
'layout.screen.margin.
|
|
419
|
+
'layout.screen.margin.x.xs': number;
|
|
420
|
+
'layout.screen.margin.x.sm': number;
|
|
421
|
+
'layout.screen.margin.x.md': number;
|
|
422
|
+
'layout.screen.margin.x.lg': number;
|
|
423
|
+
'layout.screen.margin.x.xl': number;
|
|
424
|
+
'layout.screen.margin.y.xs': number;
|
|
425
|
+
'layout.screen.margin.y.sm': number;
|
|
426
|
+
'layout.screen.margin.y.md': number;
|
|
427
|
+
'layout.screen.margin.y.lg': number;
|
|
428
|
+
'layout.screen.margin.y.xl': number;
|
|
421
429
|
'layout.header.height': number;
|
|
422
430
|
};
|
|
423
431
|
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../../../src/theme/tokens/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../../../src/theme/tokens/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqctB,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { ComponentType } from 'react';
|
|
8
8
|
import type { ImageStyle, StyleProp } from 'react-native';
|
|
9
9
|
import type { DeepPartial } from '../utils/deep-merge';
|
|
10
|
+
import type { BreakpointName } from './breakpoints.js';
|
|
10
11
|
/** Spacing scale keys (dp, 4dp base unit). Read as `gap={3}` → string '3'. */
|
|
11
12
|
export type SpacingKey = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '12' | '14' | '16' | '20' | '24' | '32';
|
|
12
13
|
/** Border-radius scale keys. */
|
|
@@ -145,10 +146,15 @@ export interface OpacityTokens {
|
|
|
145
146
|
/** Screen-level layout tokens. */
|
|
146
147
|
export interface LayoutTokens {
|
|
147
148
|
screen: {
|
|
148
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* Margin between content and the screen edge (applied as container
|
|
151
|
+
* padding). Both axes scale with the viewport breakpoint — resolve with
|
|
152
|
+
* `resolveBreakpointValue(theme.layout.screen.margin.x, rt.breakpoint)`
|
|
153
|
+
* (same for `y`).
|
|
154
|
+
*/
|
|
149
155
|
margin: {
|
|
150
|
-
x: number
|
|
151
|
-
y: number
|
|
156
|
+
x: Record<BreakpointName, number>;
|
|
157
|
+
y: Record<BreakpointName, number>;
|
|
152
158
|
};
|
|
153
159
|
};
|
|
154
160
|
header: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/theme/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/theme/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAe,CAAC;AAIpD,8EAA8E;AA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;IAC3E,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,sDAAsD;IACtD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-terra-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Themeable React Native UI components built on react-native-unistyles",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"src",
|
|
23
23
|
"lib",
|
|
24
|
-
"skills",
|
|
25
24
|
"CHANGELOG.md",
|
|
26
25
|
"!**/__tests__",
|
|
27
26
|
"!**/__fixtures__",
|
|
@@ -12,6 +12,7 @@ import Animated, {
|
|
|
12
12
|
|
|
13
13
|
import { StyleSheet } from 'react-native-unistyles';
|
|
14
14
|
|
|
15
|
+
import { resolveScreenMargin } from '#theme/screen-margin';
|
|
15
16
|
import { PortalHost } from '../portal';
|
|
16
17
|
import { BottomSafeArea } from './parts/BottomSafeArea';
|
|
17
18
|
import { renderScreenPlaceholder } from './parts/ScreenPlaceholder';
|
|
@@ -164,33 +165,39 @@ export function ScreenFlashList<T>({
|
|
|
164
165
|
);
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
const styles = StyleSheet.create((theme, runtime) =>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
168
|
+
const styles = StyleSheet.create((theme, runtime) => {
|
|
169
|
+
const { x: marginX, y: marginY } = resolveScreenMargin(
|
|
170
|
+
theme,
|
|
171
|
+
runtime.breakpoint
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
content: (
|
|
176
|
+
margins: ScreenMargins,
|
|
177
|
+
hasHeader: boolean,
|
|
178
|
+
bottomInset: number | undefined
|
|
179
|
+
) => {
|
|
180
|
+
return {
|
|
181
|
+
flexGrow: 1,
|
|
182
|
+
// The header is absolutely positioned, so the list reserves its full
|
|
183
|
+
// height — bar plus top safe area. This assumes the scroll view does not
|
|
184
|
+
// also get UIKit's automatic inset adjustment: on a native tab screen
|
|
185
|
+
// that means `disableAutomaticContentInsets` on the tab, or the two
|
|
186
|
+
// insets are counted twice.
|
|
187
|
+
paddingTop:
|
|
188
|
+
(hasHeader ? theme.layout.header.height + runtime.insets.top : 0) +
|
|
189
|
+
(hasYMargin(margins) ? marginY : 0),
|
|
190
|
+
paddingHorizontal: hasXMargin(margins) ? marginX : 0,
|
|
191
|
+
// The safe area is `BottomSafeArea`'s job; counting it here as well
|
|
192
|
+
// would leave a gap the height of the gesture bar.
|
|
193
|
+
paddingBottom: bottomInset ?? (hasYMargin(margins) ? marginY : 0),
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
safeArea: {
|
|
197
|
+
height: runtime.insets.top,
|
|
198
|
+
},
|
|
199
|
+
headerWrapper: (margins: ScreenMargins) => ({
|
|
200
|
+
marginHorizontal: hasXMargin(margins) ? -marginX : 0,
|
|
201
|
+
}),
|
|
202
|
+
};
|
|
203
|
+
});
|
|
@@ -12,6 +12,7 @@ import Animated, {
|
|
|
12
12
|
} from 'react-native-reanimated';
|
|
13
13
|
import { StyleSheet } from 'react-native-unistyles';
|
|
14
14
|
|
|
15
|
+
import { resolveScreenMargin } from '#theme/screen-margin';
|
|
15
16
|
import { PortalHost } from '../portal';
|
|
16
17
|
import { BottomSafeArea } from './parts/BottomSafeArea';
|
|
17
18
|
import { renderScreenPlaceholder } from './parts/ScreenPlaceholder';
|
|
@@ -146,37 +147,43 @@ export function ScreenFlatList<T>({
|
|
|
146
147
|
);
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
const styles = StyleSheet.create((theme, runtime) =>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
150
|
+
const styles = StyleSheet.create((theme, runtime) => {
|
|
151
|
+
const { x: marginX, y: marginY } = resolveScreenMargin(
|
|
152
|
+
theme,
|
|
153
|
+
runtime.breakpoint
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
scrollContent: {
|
|
158
|
+
flexGrow: 1,
|
|
159
|
+
},
|
|
160
|
+
content: (
|
|
161
|
+
margins: ScreenMargins,
|
|
162
|
+
hasHeader: boolean,
|
|
163
|
+
bottomInset: number | undefined
|
|
164
|
+
) => ({
|
|
165
|
+
flexGrow: 1,
|
|
166
|
+
// The header is absolutely positioned, so the list reserves its full
|
|
167
|
+
// height — bar plus top safe area. This assumes the scroll view does not
|
|
168
|
+
// also get UIKit's automatic inset adjustment: on a native tab screen
|
|
169
|
+
// that means `disableAutomaticContentInsets` on the tab, or the two
|
|
170
|
+
// insets are counted twice.
|
|
171
|
+
paddingTop:
|
|
172
|
+
(hasHeader ? theme.layout.header.height + runtime.insets.top : 0) +
|
|
173
|
+
(hasYMargin(margins) ? marginY : 0),
|
|
174
|
+
paddingHorizontal: hasXMargin(margins) ? marginX : 0,
|
|
175
|
+
// The safe area is `BottomSafeArea`'s job; counting it here as well
|
|
176
|
+
// would leave a gap the height of the gesture bar.
|
|
177
|
+
paddingBottom: bottomInset ?? (hasYMargin(margins) ? marginY : 0),
|
|
178
|
+
}),
|
|
179
|
+
safeArea: {
|
|
180
|
+
height: runtime.insets.top,
|
|
181
|
+
},
|
|
182
|
+
headerWrapper: (margins: ScreenMargins) => ({
|
|
183
|
+
marginHorizontal: hasXMargin(margins) ? -marginX : 0,
|
|
184
|
+
}),
|
|
185
|
+
header: {
|
|
186
|
+
height: theme.layout.header.height,
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
});
|
|
@@ -13,6 +13,8 @@ import Animated, {
|
|
|
13
13
|
} from 'react-native-reanimated';
|
|
14
14
|
import { StyleSheet } from 'react-native-unistyles';
|
|
15
15
|
import { scheduleOnRN } from 'react-native-worklets';
|
|
16
|
+
|
|
17
|
+
import { resolveScreenMargin } from '#theme/screen-margin';
|
|
16
18
|
import { PortalHost } from '../portal';
|
|
17
19
|
import { BottomSafeArea } from './parts/BottomSafeArea';
|
|
18
20
|
import { renderScreenPlaceholder } from './parts/ScreenPlaceholder';
|
|
@@ -170,22 +172,26 @@ export function ScreenScrollView({
|
|
|
170
172
|
);
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
const styles = StyleSheet.create((theme, rt) =>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
175
|
+
const styles = StyleSheet.create((theme, rt) => {
|
|
176
|
+
const { x: marginX, y: marginY } = resolveScreenMargin(theme, rt.breakpoint);
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
scrollContent: (hasHeader: boolean, margins: ScreenMargins) => ({
|
|
180
|
+
flexGrow: 1,
|
|
181
|
+
// The header inset and the safe area are structural — they apply
|
|
182
|
+
// whether or not margins are on; the y margin stacks on top of them.
|
|
183
|
+
paddingTop:
|
|
184
|
+
(hasHeader ? theme.layout.header.height + rt.insets.top : 0) +
|
|
185
|
+
(hasYMargin(margins) ? marginY : 0),
|
|
186
|
+
// The safe area is `BottomSafeArea`'s job; counting it here as well
|
|
187
|
+
// would leave a gap the height of the gesture bar.
|
|
188
|
+
paddingBottom: hasYMargin(margins) ? marginY : 0,
|
|
189
|
+
}),
|
|
185
190
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
191
|
+
content: (horizontal: boolean, margins: ScreenMargins) => ({
|
|
192
|
+
flexGrow: 1,
|
|
193
|
+
paddingHorizontal: hasXMargin(margins) ? marginX : 0,
|
|
194
|
+
flexDirection: horizontal ? 'row' : 'column',
|
|
195
|
+
}),
|
|
196
|
+
};
|
|
197
|
+
});
|
|
@@ -10,6 +10,10 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
|
10
10
|
import { useUnistyles } from 'react-native-unistyles';
|
|
11
11
|
import { bootstrapTerraUI } from '../theme/registry';
|
|
12
12
|
import { applyAccent, applyScheme, getCurrentAccent } from '../theme/runtime';
|
|
13
|
+
import {
|
|
14
|
+
type ResolvedScreenMargin,
|
|
15
|
+
resolveScreenMargin,
|
|
16
|
+
} from '../theme/screen-margin';
|
|
13
17
|
import type { Scheme, TerraTheme } from '../theme/types';
|
|
14
18
|
|
|
15
19
|
// Ensure the default theme is registered on first import. An app that calls
|
|
@@ -88,6 +92,17 @@ export function useTheme(): UseThemeResult {
|
|
|
88
92
|
};
|
|
89
93
|
}
|
|
90
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Resolves `theme.layout.screen.margin` for the current runtime breakpoint.
|
|
97
|
+
* For use outside a `StyleSheet.create` factory (e.g. plain-JS layout maths);
|
|
98
|
+
* inside one, call `resolveScreenMargin(theme, rt.breakpoint)` directly so
|
|
99
|
+
* the value stays reactive without a React re-render.
|
|
100
|
+
*/
|
|
101
|
+
export function useScreenMargin(): ResolvedScreenMargin {
|
|
102
|
+
const { theme, rt } = useUnistyles();
|
|
103
|
+
return resolveScreenMargin(theme, rt.breakpoint);
|
|
104
|
+
}
|
|
105
|
+
|
|
91
106
|
const noopSetAccent = (_name: string): void => {
|
|
92
107
|
if (__DEV__) {
|
|
93
108
|
console.warn(
|
package/src/context/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { UseThemeResult } from './ThemeProvider';
|
|
2
|
-
export { TerraUIProvider, useTheme } from './ThemeProvider';
|
|
2
|
+
export { TerraUIProvider, useScreenMargin, useTheme } from './ThemeProvider';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { UnistylesBreakpoints } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Viewport-width breakpoints (dp), registered with Unistyles via
|
|
5
|
+
* `StyleSheet.configure({ breakpoints })` in {@link ./registry.ts}. `xs` must
|
|
6
|
+
* stay `0` — Unistyles falls back to it below `sm`.
|
|
7
|
+
*/
|
|
8
|
+
export const breakpoints = {
|
|
9
|
+
xs: 0,
|
|
10
|
+
sm: 576,
|
|
11
|
+
md: 768,
|
|
12
|
+
lg: 992,
|
|
13
|
+
xl: 1200,
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type AppBreakpoints = typeof breakpoints;
|
|
17
|
+
export type BreakpointName = keyof AppBreakpoints;
|
|
18
|
+
|
|
19
|
+
declare module 'react-native-unistyles' {
|
|
20
|
+
export interface UnistylesBreakpoints extends AppBreakpoints {}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a per-breakpoint record (e.g. `theme.layout.screen.margin.x`) to
|
|
25
|
+
* the value for the current runtime breakpoint (`rt.breakpoint`). A
|
|
26
|
+
* `StyleSheet.create` factory re-runs on breakpoint change, so calling this
|
|
27
|
+
* inside one keeps the resolved value reactive.
|
|
28
|
+
*
|
|
29
|
+
* `rt.breakpoint`'s type also includes Unistyles' built-in `landscape` /
|
|
30
|
+
* `portrait` orientation keys, which this record has no entry for — those
|
|
31
|
+
* (and `undefined`, below the smallest configured breakpoint) fall back to
|
|
32
|
+
* `xs`.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveBreakpointValue<T>(
|
|
35
|
+
values: Record<BreakpointName, T>,
|
|
36
|
+
breakpoint: keyof UnistylesBreakpoints | undefined
|
|
37
|
+
): T {
|
|
38
|
+
return breakpoint !== undefined && breakpoint in values
|
|
39
|
+
? values[breakpoint as BreakpointName]
|
|
40
|
+
: values.xs;
|
|
41
|
+
}
|
package/src/theme/index.ts
CHANGED
|
@@ -12,6 +12,9 @@ export type { DeepPartial } from '#utils/deep-merge';
|
|
|
12
12
|
export { deepMerge } from '#utils/deep-merge';
|
|
13
13
|
export { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
14
14
|
export { FONT_WEIGHT_VALUE, SYSTEM_FONT } from '#utils/typography';
|
|
15
|
+
// ─── Breakpoints ─────────────────────────────────────────────────────────────
|
|
16
|
+
export type { AppBreakpoints, BreakpointName } from './breakpoints';
|
|
17
|
+
export { breakpoints, resolveBreakpointValue } from './breakpoints';
|
|
15
18
|
// ─── Config + runtime ───────────────────────────────────────────────────────
|
|
16
19
|
export {
|
|
17
20
|
configureTerraUI,
|
|
@@ -25,6 +28,8 @@ export {
|
|
|
25
28
|
resolveTheme,
|
|
26
29
|
} from './registry';
|
|
27
30
|
export { applyAccent, applyScheme, getCurrentAccent } from './runtime';
|
|
31
|
+
export type { ResolvedScreenMargin } from './screen-margin';
|
|
32
|
+
export { resolveScreenMargin } from './screen-margin';
|
|
28
33
|
// ─── Default themes ───────────────────────────────────────────────────────────
|
|
29
34
|
export { defaultDarkTheme, defaultLightTheme } from './theme';
|
|
30
35
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
package/src/theme/registry.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { StyleSheet, UnistylesRuntime } from 'react-native-unistyles';
|
|
|
3
3
|
import { normalizeAccent } from '#utils/accent-utils';
|
|
4
4
|
import { deepMerge } from '#utils/deep-merge';
|
|
5
5
|
|
|
6
|
+
import { breakpoints } from './breakpoints';
|
|
6
7
|
import { defaultIcons } from './defaults/icons';
|
|
7
8
|
import { defaultImage } from './defaults/image';
|
|
8
9
|
import {
|
|
@@ -254,6 +255,6 @@ function applyConfig(config: TerraConfig): void {
|
|
|
254
255
|
return;
|
|
255
256
|
}
|
|
256
257
|
|
|
257
|
-
StyleSheet.configure({ themes, settings });
|
|
258
|
+
StyleSheet.configure({ themes, settings, breakpoints });
|
|
258
259
|
unistylesConfigured = true;
|
|
259
260
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { UnistylesBreakpoints } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
import { resolveBreakpointValue } from './breakpoints';
|
|
4
|
+
import type { TerraTheme } from './types';
|
|
5
|
+
|
|
6
|
+
export interface ResolvedScreenMargin {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Resolves both axes of `theme.layout.screen.margin` for the current runtime
|
|
13
|
+
* breakpoint in one call — nearly every consumer needs both axes, so this
|
|
14
|
+
* saves calling `resolveBreakpointValue` twice. Call inside a
|
|
15
|
+
* `StyleSheet.create` factory (passing `rt.breakpoint`) so the result stays
|
|
16
|
+
* reactive to breakpoint changes; outside one, use {@link useScreenMargin}.
|
|
17
|
+
*/
|
|
18
|
+
export function resolveScreenMargin(
|
|
19
|
+
theme: TerraTheme,
|
|
20
|
+
breakpoint: keyof UnistylesBreakpoints | undefined
|
|
21
|
+
): ResolvedScreenMargin {
|
|
22
|
+
return {
|
|
23
|
+
x: resolveBreakpointValue(theme.layout.screen.margin.x, breakpoint),
|
|
24
|
+
y: resolveBreakpointValue(theme.layout.screen.margin.y, breakpoint),
|
|
25
|
+
};
|
|
26
|
+
}
|