@newtonedev/components 0.1.18 → 0.1.20
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/dist/composites/actions/Button/Button.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.styles.d.ts +1 -0
- package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
- package/dist/index.cjs +849 -508
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +807 -469
- package/dist/index.js.map +1 -1
- package/dist/layout/Page/Page.d.ts +30 -0
- package/dist/layout/Page/Page.d.ts.map +1 -0
- package/dist/layout/Page/Page.types.d.ts +60 -0
- package/dist/layout/Page/Page.types.d.ts.map +1 -0
- package/dist/layout/Page/index.d.ts +3 -0
- package/dist/layout/Page/index.d.ts.map +1 -0
- package/dist/layout/Section/Section.d.ts +23 -0
- package/dist/layout/Section/Section.d.ts.map +1 -0
- package/dist/layout/Section/Section.styles.d.ts +20 -0
- package/dist/layout/Section/Section.styles.d.ts.map +1 -0
- package/dist/layout/Section/Section.types.d.ts +74 -0
- package/dist/layout/Section/Section.types.d.ts.map +1 -0
- package/dist/layout/Section/index.d.ts +3 -0
- package/dist/layout/Section/index.d.ts.map +1 -0
- package/dist/layout/Viewport/Viewport.d.ts +22 -0
- package/dist/layout/Viewport/Viewport.d.ts.map +1 -0
- package/dist/layout/Viewport/Viewport.types.d.ts +34 -0
- package/dist/layout/Viewport/Viewport.types.d.ts.map +1 -0
- package/dist/layout/Viewport/index.d.ts +3 -0
- package/dist/layout/Viewport/index.d.ts.map +1 -0
- package/dist/{primitives → layout}/Wrapper/Wrapper.d.ts +1 -16
- package/dist/layout/Wrapper/Wrapper.d.ts.map +1 -0
- package/dist/{primitives → layout}/Wrapper/Wrapper.styles.d.ts +1 -2
- package/dist/layout/Wrapper/Wrapper.styles.d.ts.map +1 -0
- package/dist/{primitives → layout}/Wrapper/Wrapper.types.d.ts +1 -3
- package/dist/layout/Wrapper/Wrapper.types.d.ts.map +1 -0
- package/dist/layout/Wrapper/index.d.ts.map +1 -0
- package/dist/layout/index.d.ts +9 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/primitives/Card/Card.d.ts +15 -0
- package/dist/primitives/Card/Card.d.ts.map +1 -0
- package/dist/primitives/Card/Card.styles.d.ts +40 -0
- package/dist/primitives/Card/Card.styles.d.ts.map +1 -0
- package/dist/primitives/Card/Card.types.d.ts +101 -0
- package/dist/primitives/Card/Card.types.d.ts.map +1 -0
- package/dist/primitives/Card/index.d.ts +3 -0
- package/dist/primitives/Card/index.d.ts.map +1 -0
- package/dist/primitives/Frame/Frame.d.ts +1 -1
- package/dist/primitives/Frame/Frame.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.styles.d.ts +0 -6
- package/dist/primitives/Frame/Frame.styles.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.types.d.ts +1 -15
- package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/composites/actions/Button/Button.styles.ts +58 -19
- package/src/composites/actions/Button/Button.tsx +18 -3
- package/src/composites/display/Chip/Chip.tsx +1 -1
- package/src/composites/form-controls/TextInput/TextInput.styles.ts +4 -4
- package/src/index.ts +18 -5
- package/src/layout/Page/Page.tsx +103 -0
- package/src/layout/Page/Page.types.ts +69 -0
- package/src/layout/Page/index.ts +2 -0
- package/src/layout/Section/Section.styles.ts +90 -0
- package/src/layout/Section/Section.tsx +57 -0
- package/src/layout/Section/Section.types.ts +85 -0
- package/src/layout/Section/index.ts +2 -0
- package/src/layout/Viewport/Viewport.tsx +52 -0
- package/src/layout/Viewport/Viewport.types.ts +40 -0
- package/src/layout/Viewport/index.ts +2 -0
- package/src/{primitives → layout}/Wrapper/Wrapper.styles.ts +2 -20
- package/src/{primitives → layout}/Wrapper/Wrapper.tsx +1 -31
- package/src/{primitives → layout}/Wrapper/Wrapper.types.ts +1 -4
- package/src/layout/index.ts +15 -0
- package/src/primitives/Card/Card.styles.ts +182 -0
- package/src/primitives/Card/Card.tsx +197 -0
- package/src/primitives/Card/Card.types.ts +155 -0
- package/src/primitives/Card/index.ts +2 -0
- package/src/primitives/Frame/Frame.styles.ts +0 -32
- package/src/primitives/Frame/Frame.tsx +5 -52
- package/src/primitives/Frame/Frame.types.ts +1 -22
- package/src/primitives/Text/Text.tsx +1 -1
- package/src/primitives/index.ts +3 -3
- package/dist/primitives/Wrapper/Wrapper.d.ts.map +0 -1
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts.map +0 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +0 -1
- package/dist/primitives/Wrapper/index.d.ts.map +0 -1
- /package/dist/{primitives → layout}/Wrapper/index.d.ts +0 -0
- /package/src/{primitives → layout}/Wrapper/index.ts +0 -0
|
@@ -30,16 +30,11 @@ export interface FrameStyleInput {
|
|
|
30
30
|
readonly left?: OffsetValue;
|
|
31
31
|
readonly zIndex?: number;
|
|
32
32
|
readonly overflow?: OverflowMode;
|
|
33
|
-
readonly opacity?: number;
|
|
34
33
|
readonly radius?: RadiusProp;
|
|
35
|
-
readonly bordered?: boolean;
|
|
36
|
-
readonly disabled?: boolean;
|
|
37
34
|
}
|
|
38
35
|
export interface FrameStyles {
|
|
39
36
|
/** Main container style (ViewStyle) */
|
|
40
37
|
readonly container: ViewStyle;
|
|
41
|
-
/** Style applied when pressed (background shift) */
|
|
42
|
-
readonly pressed: ViewStyle;
|
|
43
38
|
/** Web-only CSS Grid properties (cast to ViewStyle at render) */
|
|
44
39
|
readonly gridWebStyle: React.CSSProperties | null;
|
|
45
40
|
/** Web-only inset box-shadow string for elevation -2 */
|
|
@@ -50,7 +45,6 @@ export interface FrameStyles {
|
|
|
50
45
|
*
|
|
51
46
|
* Takes the Frame's props + design tokens and produces:
|
|
52
47
|
* - container: the main style (background, layout, spacing, border, shadow, etc.)
|
|
53
|
-
* - pressed: style override applied when the user is pressing/clicking
|
|
54
48
|
* - gridWebStyle: CSS Grid properties (only works on web, null otherwise)
|
|
55
49
|
* - insetBoxShadow: inner shadow CSS string for sunken frames (web-only)
|
|
56
50
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Frame.styles.d.ts","sourceRoot":"","sources":["../../../src/primitives/Frame/Frame.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EACV,WAAW,EACX,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;AAcvB,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGxC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IAGrC,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,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AI,CAAC,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAGjC,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAC9B;AAID,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;IAClD,wDAAwD;IACxD,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAID;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,CAqKlE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { View, ViewStyle
|
|
1
|
+
import type { View, ViewStyle } from 'react-native';
|
|
2
2
|
import type { FrameElevation, ThemeName, AppearanceName } from 'newtone-api';
|
|
3
3
|
/** Design system spacing tokens (represent px values at Medium preset) */
|
|
4
4
|
export type SpacingToken = '00' | '02' | '04' | '06' | '08' | '10' | '12' | '16' | '20' | '24' | '32' | '40' | '48';
|
|
@@ -250,12 +250,6 @@ export interface FrameProps {
|
|
|
250
250
|
* - `'box-only'` — element receives events but children cannot
|
|
251
251
|
*/
|
|
252
252
|
readonly pointerEvents?: PointerEventsMode;
|
|
253
|
-
/**
|
|
254
|
-
* Opacity of the element (0 = fully transparent, 1 = fully opaque).
|
|
255
|
-
*
|
|
256
|
-
* When set explicitly, overrides the automatic `0.5` opacity applied by `disabled`.
|
|
257
|
-
*/
|
|
258
|
-
readonly opacity?: number;
|
|
259
253
|
/**
|
|
260
254
|
* Color theme for this Frame's visual rendering (background, border, text).
|
|
261
255
|
*
|
|
@@ -303,14 +297,6 @@ export interface FrameProps {
|
|
|
303
297
|
* ```
|
|
304
298
|
*/
|
|
305
299
|
readonly radius?: RadiusProp;
|
|
306
|
-
/** Show 1px border using theme border color. @default false */
|
|
307
|
-
readonly bordered?: boolean;
|
|
308
|
-
/** Press handler — switches rendering from View to Pressable. */
|
|
309
|
-
readonly onPress?: (event: GestureResponderEvent) => void;
|
|
310
|
-
/** Navigation URL — switches rendering to Pressable with link role. */
|
|
311
|
-
readonly href?: string;
|
|
312
|
-
/** Disable interaction. @default false */
|
|
313
|
-
readonly disabled?: boolean;
|
|
314
300
|
/** Accessible label read by screen readers. Use for icon-only or non-textual frames. */
|
|
315
301
|
readonly accessibilityLabel?: string;
|
|
316
302
|
/** Additional hint read after the label (e.g. "Opens settings page"). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Frame.types.d.ts","sourceRoot":"","sources":["../../../src/primitives/Frame/Frame.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"Frame.types.d.ts","sourceRoot":"","sources":["../../../src/primitives/Frame/Frame.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI7E,0EAA0E;AAC1E,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpH,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,MAAM,CAAC;AAEjD,uBAAuB;AACvB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,Q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ACH,QAAQ,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAI3C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAE3B;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IAErC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAI7B,wFAAwF;IACxF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAErC,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAIpC,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B,uDAAuD;IACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAI/B,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CAC1C"}
|
|
@@ -5,8 +5,8 @@ export type { FrameProps, SpacingToken, SpacingValue, SpacingSides, SpacingAxes,
|
|
|
5
5
|
export type { ResolvedCorners } from './Frame/Frame.utils';
|
|
6
6
|
export { Icon } from './Icon';
|
|
7
7
|
export type { IconProps } from './Icon';
|
|
8
|
-
export {
|
|
9
|
-
export type {
|
|
8
|
+
export { Card } from './Card';
|
|
9
|
+
export type { CardProps } from './Card';
|
|
10
10
|
export { Text } from './Text';
|
|
11
11
|
export type { TextProps, TextSize, TextWeight, TextColor, TextScope, TextRole, TextSpanProps, TextAlign, } from './Text';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":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,MAAM,QAAQ,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,aAAa,EACb,SAAS,GACV,MAAM,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newtonedev/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "React + React Native Web component library for Newtone",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"react-native": ">=0.70.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"newtone-api": "^0.0.
|
|
40
|
+
"newtone-api": "^0.0.5",
|
|
41
41
|
"newtone": "^0.1.0",
|
|
42
42
|
"@newtonedev/fonts": "^0.1.0",
|
|
43
43
|
"react-native-web": "^0.19.10"
|
|
@@ -25,6 +25,7 @@ export interface ButtonConfig {
|
|
|
25
25
|
iconColor: string;
|
|
26
26
|
borderWidth: number;
|
|
27
27
|
borderColor?: string;
|
|
28
|
+
textDecoration?: 'underline' | 'none';
|
|
28
29
|
};
|
|
29
30
|
sizeTokens: {
|
|
30
31
|
height: number;
|
|
@@ -178,20 +179,8 @@ function getVariantColors(
|
|
|
178
179
|
tokens: UseTokensResult,
|
|
179
180
|
theme: ThemeName,
|
|
180
181
|
) {
|
|
181
|
-
const t = tokens.colors[theme];
|
|
182
|
-
|
|
183
182
|
if (disabled) {
|
|
184
|
-
|
|
185
|
-
return {
|
|
186
|
-
...baseColors,
|
|
187
|
-
bg: 'transparent',
|
|
188
|
-
hoveredBg: 'transparent',
|
|
189
|
-
pressedBg: 'transparent',
|
|
190
|
-
textColor: t.main.fontDisabled,
|
|
191
|
-
iconColor: t.main.fontDisabled,
|
|
192
|
-
borderWidth: 1,
|
|
193
|
-
borderColor: t.main.divider,
|
|
194
|
-
};
|
|
183
|
+
return getDisabledVariantColors(variant, tokens, theme);
|
|
195
184
|
}
|
|
196
185
|
|
|
197
186
|
return getVariantColorsForState(variant, tokens, theme);
|
|
@@ -224,17 +213,17 @@ function getVariantColorsForState(
|
|
|
224
213
|
// SECONDARY: Outlined with subtle hover
|
|
225
214
|
if (variant === 'secondary') {
|
|
226
215
|
return {
|
|
227
|
-
bg: t.
|
|
228
|
-
hoveredBg: t.
|
|
229
|
-
pressedBg: t.
|
|
230
|
-
textColor: t.
|
|
231
|
-
iconColor: t.
|
|
216
|
+
bg: t.tinted.actionEnabled,
|
|
217
|
+
hoveredBg: t.tinted.actionHovered,
|
|
218
|
+
pressedBg: t.tinted.actionPressed,
|
|
219
|
+
textColor: t.tinted.fontPrimary,
|
|
220
|
+
iconColor: t.tinted.fontPrimary,
|
|
232
221
|
borderWidth: 0,
|
|
233
222
|
borderColor: 'transparent',
|
|
234
223
|
};
|
|
235
224
|
}
|
|
236
225
|
|
|
237
|
-
// GHOST: No border, transparent background, subtle hover
|
|
226
|
+
// GHOST: No border, transparent background, subtle hover, underlined text
|
|
238
227
|
return {
|
|
239
228
|
bg: 'transparent',
|
|
240
229
|
hoveredBg: t.main.actionEnabled,
|
|
@@ -243,5 +232,55 @@ function getVariantColorsForState(
|
|
|
243
232
|
iconColor: t.main.fontSecondary,
|
|
244
233
|
borderWidth: 0,
|
|
245
234
|
borderColor: 'transparent',
|
|
235
|
+
textDecoration: 'underline' as const,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Get variant-specific disabled colors.
|
|
241
|
+
* Each variant has its own disabled treatment using mapped disabled tokens.
|
|
242
|
+
*/
|
|
243
|
+
function getDisabledVariantColors(
|
|
244
|
+
variant: ButtonVariant,
|
|
245
|
+
tokens: UseTokensResult,
|
|
246
|
+
theme: ThemeName,
|
|
247
|
+
) {
|
|
248
|
+
const t = tokens.colors[theme];
|
|
249
|
+
|
|
250
|
+
// PRIMARY DISABLED: keeps emphasis appearance, muted text
|
|
251
|
+
if (variant === 'primary') {
|
|
252
|
+
return {
|
|
253
|
+
bg: t.main.actionEnabled,
|
|
254
|
+
hoveredBg: t.main.actionEnabled,
|
|
255
|
+
pressedBg: t.main.actionEnabled,
|
|
256
|
+
textColor: t.main.fontDisabled,
|
|
257
|
+
iconColor: t.main.fontDisabled,
|
|
258
|
+
borderWidth: 0,
|
|
259
|
+
borderColor: 'transparent',
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// SECONDARY DISABLED: keeps main appearance bg, muted text
|
|
264
|
+
if (variant === 'secondary') {
|
|
265
|
+
return {
|
|
266
|
+
bg: 'transparent',
|
|
267
|
+
hoveredBg: 'transparent',
|
|
268
|
+
pressedBg: 'transparent',
|
|
269
|
+
textColor: t.main.fontDisabled,
|
|
270
|
+
iconColor: t.main.fontDisabled,
|
|
271
|
+
borderWidth: 1,
|
|
272
|
+
borderColor: t.main.divider,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// GHOST DISABLED: transparent, muted text only, underlined
|
|
277
|
+
return {
|
|
278
|
+
bg: 'transparent',
|
|
279
|
+
hoveredBg: 'transparent',
|
|
280
|
+
pressedBg: 'transparent',
|
|
281
|
+
textColor: t.main.fontDisabled,
|
|
282
|
+
iconColor: t.main.fontDisabled,
|
|
283
|
+
borderWidth: 0,
|
|
284
|
+
borderColor: 'transparent'
|
|
246
285
|
};
|
|
247
286
|
}
|
|
@@ -6,7 +6,7 @@ import { useTokens } from 'newtone-api';
|
|
|
6
6
|
import { useFrameContext } from 'newtone-api';
|
|
7
7
|
import { Icon } from '../../../primitives/Icon/Icon';
|
|
8
8
|
import { Text } from '../../../primitives/Text';
|
|
9
|
-
import { Wrapper } from '../../../
|
|
9
|
+
import { Wrapper } from '../../../layout/Wrapper/Wrapper';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Button — A composite component that inherits its color theme from the
|
|
@@ -57,6 +57,21 @@ export function Button({
|
|
|
57
57
|
// Inherit theme from nearest Frame, default to 'primary'
|
|
58
58
|
const theme = frameCtx?.theme ?? 'primary';
|
|
59
59
|
|
|
60
|
+
// DEBUG: trace Button token resolution
|
|
61
|
+
if (typeof window !== 'undefined') {
|
|
62
|
+
console.log('[Button]', { theme, variant, frameCtxTheme: frameCtx?.theme, hasFrameCtx: !!frameCtx });
|
|
63
|
+
if (tokens.colors[theme]) {
|
|
64
|
+
const t = tokens.colors[theme];
|
|
65
|
+
console.log('[Button tokens]', {
|
|
66
|
+
'emphasis.actionEnabled': t.emphasis.actionEnabled,
|
|
67
|
+
'main.actionEnabled': t.main.actionEnabled,
|
|
68
|
+
'main.background': t.main.background,
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
console.log('[Button] NO tokens for theme:', theme, 'available themes:', Object.keys(tokens.colors));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
60
75
|
const isDisabled = disabled || loading;
|
|
61
76
|
|
|
62
77
|
const { variantColors, sizeTokens } = React.useMemo(
|
|
@@ -92,7 +107,7 @@ export function Button({
|
|
|
92
107
|
borderRadius: sizeTokens.borderRadius,
|
|
93
108
|
borderWidth: variantColors.borderWidth,
|
|
94
109
|
borderColor: variantColors.borderColor || 'transparent',
|
|
95
|
-
opacity:
|
|
110
|
+
opacity: loading ? 0.6 : 1,
|
|
96
111
|
...(fullWidth && { width: '100%' as any, alignSelf: 'stretch' as any }),
|
|
97
112
|
},
|
|
98
113
|
...(Array.isArray(style) ? style : style ? [style] : []),
|
|
@@ -107,7 +122,7 @@ export function Button({
|
|
|
107
122
|
size={sizeTokens.textSize}
|
|
108
123
|
centerVertically
|
|
109
124
|
style={[
|
|
110
|
-
{ color: variantColors.textColor },
|
|
125
|
+
{ color: variantColors.textColor, textDecorationLine: variantColors.textDecoration },
|
|
111
126
|
...(Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []),
|
|
112
127
|
]}
|
|
113
128
|
>
|
|
@@ -5,7 +5,7 @@ import { getChipConfig } from './Chip.styles';
|
|
|
5
5
|
import { useTokens } from 'newtone-api';
|
|
6
6
|
import { Icon } from '../../../primitives/Icon/Icon';
|
|
7
7
|
import { Text } from '../../../primitives/Text';
|
|
8
|
-
import { Wrapper } from '../../../
|
|
8
|
+
import { Wrapper } from '../../../layout/Wrapper/Wrapper';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Chip — A pill-shaped label for tags, filters, badges, and status indicators.
|
|
@@ -16,18 +16,18 @@ export function getTextInputStyles(
|
|
|
16
16
|
fontFamily: tokens.typography.fonts.main.family,
|
|
17
17
|
fontSize: tokens.typography.fontSizes['04'],
|
|
18
18
|
fontWeight: tokens.typography.fonts.main.weights.medium as any,
|
|
19
|
-
color: at.
|
|
19
|
+
color: at.fontSecondary,
|
|
20
20
|
},
|
|
21
21
|
input: {
|
|
22
22
|
fontFamily: tokens.typography.fonts.main.family,
|
|
23
|
-
backgroundColor: at.
|
|
23
|
+
backgroundColor: at.background,
|
|
24
24
|
borderWidth: 1,
|
|
25
|
-
borderColor: at.
|
|
25
|
+
borderColor: at.divider,
|
|
26
26
|
borderRadius: tokens.radius.md,
|
|
27
27
|
paddingVertical: tokens.spacing['08'],
|
|
28
28
|
paddingHorizontal: tokens.spacing['12'],
|
|
29
29
|
fontSize: tokens.typography.fontSizes['05'],
|
|
30
|
-
color: disabled ? at.
|
|
30
|
+
color: disabled ? at.fontDisabled : at.fontPrimary,
|
|
31
31
|
opacity: disabled ? 0.5 : 1,
|
|
32
32
|
},
|
|
33
33
|
});
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,9 @@ export {
|
|
|
29
29
|
useTypographyCalibrations,
|
|
30
30
|
enqueueObservation,
|
|
31
31
|
} from 'newtone-api';
|
|
32
|
+
export type {
|
|
33
|
+
NewtoneProviderProps,
|
|
34
|
+
} from 'newtone-api';
|
|
32
35
|
export type {
|
|
33
36
|
ColorMode,
|
|
34
37
|
ColorGamut,
|
|
@@ -115,9 +118,6 @@ export type { ResolvedCorners } from './primitives/Frame/Frame.utils';
|
|
|
115
118
|
export { Icon } from './primitives/Icon/Icon';
|
|
116
119
|
export type { IconProps } from './primitives/Icon/Icon.types';
|
|
117
120
|
|
|
118
|
-
export { Wrapper } from './primitives/Wrapper/Wrapper';
|
|
119
|
-
export type { WrapperProps } from './primitives/Wrapper/Wrapper.types';
|
|
120
|
-
|
|
121
121
|
export { Text } from './primitives/Text';
|
|
122
122
|
export type {
|
|
123
123
|
TextProps,
|
|
@@ -130,12 +130,25 @@ export type {
|
|
|
130
130
|
TextSpanProps,
|
|
131
131
|
} from './primitives/Text';
|
|
132
132
|
|
|
133
|
+
// Layout Components
|
|
134
|
+
export { Page } from './layout/Page/Page';
|
|
135
|
+
export type { PageProps } from './layout/Page/Page.types';
|
|
136
|
+
|
|
137
|
+
export { Viewport } from './layout/Viewport/Viewport';
|
|
138
|
+
export type { ViewportProps } from './layout/Viewport/Viewport.types';
|
|
139
|
+
|
|
140
|
+
export { Wrapper } from './layout/Wrapper/Wrapper';
|
|
141
|
+
export type { WrapperProps } from './layout/Wrapper/Wrapper.types';
|
|
142
|
+
|
|
143
|
+
export { Section } from './layout/Section/Section';
|
|
144
|
+
export type { SectionProps, SectionSize } from './layout/Section/Section.types';
|
|
145
|
+
|
|
133
146
|
// Composite Components
|
|
134
147
|
export { Button } from './composites/actions/Button/Button';
|
|
135
148
|
export type { ButtonProps, ButtonVariant, ButtonSize, ButtonIconPosition } from './composites/actions/Button/Button.types';
|
|
136
149
|
|
|
137
|
-
export { Card } from './
|
|
138
|
-
export type { CardProps } from './
|
|
150
|
+
export { Card } from './primitives/Card/Card';
|
|
151
|
+
export type { CardProps } from './primitives/Card/Card.types';
|
|
139
152
|
|
|
140
153
|
export { Chip } from './composites/display/Chip/Chip';
|
|
141
154
|
export type { ChipProps, ChipVariant, ChipSemantic, ChipSize } from './composites/display/Chip/Chip.types';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Platform, View, StyleSheet } from 'react-native';
|
|
3
|
+
import type { PageProps } from './Page.types';
|
|
4
|
+
import { useNewtoneTheme, _ThemeContext } from 'newtone-api';
|
|
5
|
+
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
root: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
flexDirection: 'column',
|
|
10
|
+
...(Platform.OS === 'web' ? { minHeight: '100vh' as unknown as number } : {}),
|
|
11
|
+
},
|
|
12
|
+
body: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
flexDirection: 'row',
|
|
15
|
+
},
|
|
16
|
+
content: {
|
|
17
|
+
flex: 1,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Page — Full-viewport layout root with optional navbar and sidebar slots.
|
|
23
|
+
*
|
|
24
|
+
* Page fills the full screen height and arranges layout regions:
|
|
25
|
+
* - Navbar at the top (outside scroll)
|
|
26
|
+
* - Sidebar to the left of the main content
|
|
27
|
+
* - Children fill the remaining space (typically a Viewport)
|
|
28
|
+
*
|
|
29
|
+
* When a `scheme` prop is provided, Page activates that scheme from the
|
|
30
|
+
* parent NewtoneProvider so all descendants receive the scheme's config.
|
|
31
|
+
*
|
|
32
|
+
* Page is invisible — no background, border, or shadow.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <Page navbar={<Nav />}>
|
|
37
|
+
* <Viewport>
|
|
38
|
+
* <Section size="sm" fill>
|
|
39
|
+
* <Frame elevation={1} padding={32}>
|
|
40
|
+
* <Text>Centered content</Text>
|
|
41
|
+
* </Frame>
|
|
42
|
+
* </Section>
|
|
43
|
+
* </Viewport>
|
|
44
|
+
* </Page>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function Page({
|
|
48
|
+
children,
|
|
49
|
+
scheme,
|
|
50
|
+
navbar,
|
|
51
|
+
sidebar,
|
|
52
|
+
testID,
|
|
53
|
+
nativeID,
|
|
54
|
+
ref,
|
|
55
|
+
style,
|
|
56
|
+
}: PageProps) {
|
|
57
|
+
const themeCtx = useNewtoneTheme();
|
|
58
|
+
|
|
59
|
+
// Resolve scheme override: if scheme is specified and exists in the
|
|
60
|
+
// provider's schemes map, override the theme context for descendants.
|
|
61
|
+
const schemeThemeCtx = useMemo(() => {
|
|
62
|
+
if (!scheme || !themeCtx.schemes) return null;
|
|
63
|
+
const schemeConfig = themeCtx.schemes[scheme];
|
|
64
|
+
if (!schemeConfig || schemeConfig === themeCtx.config) return null;
|
|
65
|
+
return {
|
|
66
|
+
...themeCtx,
|
|
67
|
+
config: schemeConfig,
|
|
68
|
+
activeScheme: scheme,
|
|
69
|
+
};
|
|
70
|
+
}, [scheme, themeCtx]);
|
|
71
|
+
|
|
72
|
+
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
73
|
+
|
|
74
|
+
const content = (
|
|
75
|
+
<View
|
|
76
|
+
ref={ref}
|
|
77
|
+
testID={testID}
|
|
78
|
+
nativeID={nativeID}
|
|
79
|
+
accessibilityRole="none"
|
|
80
|
+
style={[styles.root, ...userStyles]}
|
|
81
|
+
>
|
|
82
|
+
{navbar}
|
|
83
|
+
{sidebar ? (
|
|
84
|
+
<View style={styles.body}>
|
|
85
|
+
{sidebar}
|
|
86
|
+
<View style={styles.content}>{children}</View>
|
|
87
|
+
</View>
|
|
88
|
+
) : (
|
|
89
|
+
children
|
|
90
|
+
)}
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
if (schemeThemeCtx) {
|
|
95
|
+
return (
|
|
96
|
+
<_ThemeContext.Provider value={schemeThemeCtx}>
|
|
97
|
+
{content}
|
|
98
|
+
</_ThemeContext.Provider>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return content;
|
|
103
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { View, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Props for Page — the outermost layout container for a screen.
|
|
5
|
+
*
|
|
6
|
+
* Page fills the full viewport height and arranges optional layout slots:
|
|
7
|
+
* navbar (top), sidebar (left), and children (main content area).
|
|
8
|
+
* It can also activate a scheme from the parent NewtoneProvider.
|
|
9
|
+
*
|
|
10
|
+
* Page is invisible — no background, border, or shadow.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Page navbar={<Nav />}>
|
|
15
|
+
* <Viewport>
|
|
16
|
+
* <Section size="md">
|
|
17
|
+
* <Text>Page content</Text>
|
|
18
|
+
* </Section>
|
|
19
|
+
* </Viewport>
|
|
20
|
+
* </Page>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Page scheme="vibrant" sidebar={<Sidebar />}>
|
|
26
|
+
* <Viewport>
|
|
27
|
+
* <Section size="lg">
|
|
28
|
+
* <Text>Dashboard content</Text>
|
|
29
|
+
* </Section>
|
|
30
|
+
* </Viewport>
|
|
31
|
+
* </Page>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export interface PageProps {
|
|
35
|
+
/** Main content area (typically a Viewport). */
|
|
36
|
+
readonly children?: React.ReactNode;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Scheme to activate from the parent NewtoneProvider's `schemes` map.
|
|
40
|
+
* When set, descendants receive the scheme's config via theme context.
|
|
41
|
+
*/
|
|
42
|
+
readonly scheme?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Navbar element rendered at the top, outside the scrollable area.
|
|
46
|
+
* The navbar's height is determined by its own content.
|
|
47
|
+
*/
|
|
48
|
+
readonly navbar?: React.ReactNode;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Sidebar element rendered to the left of the main content area.
|
|
52
|
+
* The sidebar manages its own width and scroll behavior.
|
|
53
|
+
*/
|
|
54
|
+
readonly sidebar?: React.ReactNode;
|
|
55
|
+
|
|
56
|
+
// ── Testing & Platform ──
|
|
57
|
+
|
|
58
|
+
/** Test identifier — maps to `data-testid` on web. */
|
|
59
|
+
readonly testID?: string;
|
|
60
|
+
|
|
61
|
+
/** DOM id — maps to `id` attribute on web. */
|
|
62
|
+
readonly nativeID?: string;
|
|
63
|
+
|
|
64
|
+
/** Ref to the underlying View element. */
|
|
65
|
+
readonly ref?: React.Ref<View>;
|
|
66
|
+
|
|
67
|
+
/** Custom style overrides (applied to the root container). */
|
|
68
|
+
readonly style?: ViewStyle | ViewStyle[];
|
|
69
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import type { ResolvedTokens } from 'newtone-api';
|
|
4
|
+
import type { GapProp, PaddingProp } from '../../primitives/Frame/Frame.types';
|
|
5
|
+
import type { SectionSize } from './Section.types';
|
|
6
|
+
import { resolveGap, resolvePadding } from '../../primitives/Frame/Frame.utils';
|
|
7
|
+
|
|
8
|
+
// ── Size Presets ─────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
interface SizePreset {
|
|
11
|
+
readonly maxWidth: number | undefined;
|
|
12
|
+
readonly paddingHorizontal: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const SIZE_PRESETS: Record<SectionSize, SizePreset> = {
|
|
16
|
+
xs: { maxWidth: 480, paddingHorizontal: 24 },
|
|
17
|
+
sm: { maxWidth: 640, paddingHorizontal: 24 },
|
|
18
|
+
md: { maxWidth: 768, paddingHorizontal: 24 },
|
|
19
|
+
lg: { maxWidth: 1024, paddingHorizontal: 32 },
|
|
20
|
+
xl: { maxWidth: 1280, paddingHorizontal: 40 },
|
|
21
|
+
full: { maxWidth: undefined, paddingHorizontal: 0 },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// ── Input ────────────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export interface SectionStyleInput {
|
|
27
|
+
readonly tokens: ResolvedTokens;
|
|
28
|
+
readonly size?: SectionSize;
|
|
29
|
+
readonly fill?: boolean;
|
|
30
|
+
readonly gap?: GapProp;
|
|
31
|
+
readonly padding?: PaddingProp;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ── Builder ──────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Build layout styles for a Section.
|
|
38
|
+
*
|
|
39
|
+
* Section fills all horizontal space, centers content within a max width,
|
|
40
|
+
* and applies horizontal padding from the size preset. Vertical padding
|
|
41
|
+
* can be specified via the padding prop.
|
|
42
|
+
*/
|
|
43
|
+
export function getSectionStyles(input: SectionStyleInput): ViewStyle {
|
|
44
|
+
const {
|
|
45
|
+
tokens,
|
|
46
|
+
size = 'lg',
|
|
47
|
+
fill,
|
|
48
|
+
gap,
|
|
49
|
+
padding,
|
|
50
|
+
} = input;
|
|
51
|
+
|
|
52
|
+
const preset = SIZE_PRESETS[size];
|
|
53
|
+
const container: Record<string, unknown> = {};
|
|
54
|
+
|
|
55
|
+
// Section always fills horizontal space and stacks children vertically.
|
|
56
|
+
container.width = '100%';
|
|
57
|
+
container.flexDirection = 'column';
|
|
58
|
+
|
|
59
|
+
// Fill available vertical space when requested.
|
|
60
|
+
if (fill) {
|
|
61
|
+
container.flex = 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Center the content area by capping its width and using auto margins.
|
|
65
|
+
if (preset.maxWidth !== undefined) {
|
|
66
|
+
container.maxWidth = preset.maxWidth;
|
|
67
|
+
container.marginLeft = 'auto';
|
|
68
|
+
container.marginRight = 'auto';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Horizontal padding from the size preset (so content doesn't touch edges).
|
|
72
|
+
container.paddingLeft = preset.paddingHorizontal;
|
|
73
|
+
container.paddingRight = preset.paddingHorizontal;
|
|
74
|
+
|
|
75
|
+
// Vertical padding from the user's padding prop.
|
|
76
|
+
if (padding !== undefined) {
|
|
77
|
+
const p = resolvePadding(padding, tokens);
|
|
78
|
+
container.paddingTop = p.top;
|
|
79
|
+
container.paddingBottom = p.bottom;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Gap between children.
|
|
83
|
+
if (gap !== undefined) {
|
|
84
|
+
const g = resolveGap(gap, tokens);
|
|
85
|
+
container.rowGap = g.rowGap;
|
|
86
|
+
container.columnGap = g.columnGap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return StyleSheet.create({ c: container as ViewStyle }).c;
|
|
90
|
+
}
|