@newtonedev/components 0.1.13 → 0.1.15

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.
Files changed (173) hide show
  1. package/dist/composites/actions/Button/Button.d.ts +17 -20
  2. package/dist/composites/actions/Button/Button.d.ts.map +1 -1
  3. package/dist/composites/actions/Button/Button.styles.d.ts +12 -24
  4. package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
  5. package/dist/composites/actions/Button/Button.types.d.ts +14 -13
  6. package/dist/composites/actions/Button/Button.types.d.ts.map +1 -1
  7. package/dist/composites/actions/Button/index.d.ts +1 -1
  8. package/dist/composites/actions/Button/index.d.ts.map +1 -1
  9. package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts +10 -0
  10. package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts.map +1 -0
  11. package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts +35 -0
  12. package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts.map +1 -0
  13. package/dist/composites/branding/LogoMonogram/index.d.ts +3 -0
  14. package/dist/composites/branding/LogoMonogram/index.d.ts.map +1 -0
  15. package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts +9 -0
  16. package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts.map +1 -0
  17. package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts +26 -0
  18. package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts.map +1 -0
  19. package/dist/composites/branding/LogoWordmark/index.d.ts +3 -0
  20. package/dist/composites/branding/LogoWordmark/index.d.ts.map +1 -0
  21. package/dist/composites/display/Chip/Chip.d.ts +25 -0
  22. package/dist/composites/display/Chip/Chip.d.ts.map +1 -0
  23. package/dist/composites/display/Chip/Chip.styles.d.ts +29 -0
  24. package/dist/composites/display/Chip/Chip.styles.d.ts.map +1 -0
  25. package/dist/composites/display/Chip/Chip.types.d.ts +63 -0
  26. package/dist/composites/display/Chip/Chip.types.d.ts.map +1 -0
  27. package/dist/composites/display/Chip/index.d.ts +3 -0
  28. package/dist/composites/display/Chip/index.d.ts.map +1 -0
  29. package/dist/composites/form-controls/Select/Select.d.ts.map +1 -1
  30. package/dist/composites/form-controls/Select/Select.styles.d.ts +2 -2
  31. package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -1
  32. package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -1
  33. package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -1
  34. package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts +2 -2
  35. package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -1
  36. package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -1
  37. package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts +2 -2
  38. package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -1
  39. package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -1
  40. package/dist/composites/layout/AppShell/AppShell.styles.d.ts +2 -2
  41. package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -1
  42. package/dist/composites/layout/Card/Card.d.ts.map +1 -1
  43. package/dist/composites/layout/Card/Card.styles.d.ts +2 -2
  44. package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -1
  45. package/dist/composites/layout/ContentCard/ContentCard.d.ts +33 -0
  46. package/dist/composites/layout/ContentCard/ContentCard.d.ts.map +1 -0
  47. package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts +10 -0
  48. package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts.map +1 -0
  49. package/dist/composites/layout/ContentCard/ContentCard.types.d.ts +52 -0
  50. package/dist/composites/layout/ContentCard/ContentCard.types.d.ts.map +1 -0
  51. package/dist/composites/layout/ContentCard/index.d.ts +3 -0
  52. package/dist/composites/layout/ContentCard/index.d.ts.map +1 -0
  53. package/dist/composites/layout/Divider/Divider.d.ts +25 -0
  54. package/dist/composites/layout/Divider/Divider.d.ts.map +1 -0
  55. package/dist/composites/layout/Divider/Divider.styles.d.ts +8 -0
  56. package/dist/composites/layout/Divider/Divider.styles.d.ts.map +1 -0
  57. package/dist/composites/layout/Divider/Divider.types.d.ts +25 -0
  58. package/dist/composites/layout/Divider/Divider.types.d.ts.map +1 -0
  59. package/dist/composites/layout/Divider/index.d.ts +3 -0
  60. package/dist/composites/layout/Divider/index.d.ts.map +1 -0
  61. package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -1
  62. package/dist/composites/layout/Navbar/Navbar.styles.d.ts +4 -3
  63. package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -1
  64. package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -1
  65. package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts +4 -3
  66. package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -1
  67. package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -1
  68. package/dist/composites/overlays/Popover/Popover.styles.d.ts +2 -2
  69. package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -1
  70. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -1
  71. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts +2 -2
  72. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -1
  73. package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts +2 -2
  74. package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -1
  75. package/dist/composites/range-inputs/Slider/Slider.styles.d.ts +2 -2
  76. package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -1
  77. package/dist/index.cjs +935 -523
  78. package/dist/index.cjs.map +1 -1
  79. package/dist/index.d.ts +13 -3
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +860 -473
  82. package/dist/index.js.map +1 -1
  83. package/dist/primitives/Frame/Frame.d.ts +1 -35
  84. package/dist/primitives/Frame/Frame.d.ts.map +1 -1
  85. package/dist/primitives/Frame/Frame.styles.d.ts +13 -4
  86. package/dist/primitives/Frame/Frame.styles.d.ts.map +1 -1
  87. package/dist/primitives/Frame/Frame.types.d.ts +99 -1
  88. package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
  89. package/dist/primitives/Frame/index.d.ts +1 -1
  90. package/dist/primitives/Frame/index.d.ts.map +1 -1
  91. package/dist/primitives/Icon/Icon.d.ts.map +1 -1
  92. package/dist/primitives/Icon/Icon.types.d.ts +2 -2
  93. package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
  94. package/dist/primitives/Text/Text.d.ts +5 -3
  95. package/dist/primitives/Text/Text.d.ts.map +1 -1
  96. package/dist/primitives/Text/Text.spans.d.ts.map +1 -1
  97. package/dist/primitives/Text/Text.types.d.ts +3 -6
  98. package/dist/primitives/Text/Text.types.d.ts.map +1 -1
  99. package/dist/primitives/Wrapper/Wrapper.d.ts +1 -1
  100. package/dist/primitives/Wrapper/Wrapper.d.ts.map +1 -1
  101. package/dist/primitives/Wrapper/Wrapper.styles.d.ts +9 -1
  102. package/dist/primitives/Wrapper/Wrapper.styles.d.ts.map +1 -1
  103. package/dist/primitives/Wrapper/Wrapper.types.d.ts +31 -1
  104. package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +1 -1
  105. package/dist/registry/registry.d.ts.map +1 -1
  106. package/package.json +1 -1
  107. package/src/composites/actions/Button/Button.styles.ts +90 -182
  108. package/src/composites/actions/Button/Button.tsx +37 -33
  109. package/src/composites/actions/Button/Button.types.ts +16 -15
  110. package/src/composites/actions/Button/index.ts +1 -1
  111. package/src/composites/branding/LogoMonogram/LogoMonogram.tsx +29 -0
  112. package/src/composites/branding/LogoMonogram/LogoMonogram.types.ts +35 -0
  113. package/src/composites/branding/LogoMonogram/index.ts +2 -0
  114. package/src/composites/branding/LogoWordmark/LogoWordmark.tsx +29 -0
  115. package/src/composites/branding/LogoWordmark/LogoWordmark.types.ts +25 -0
  116. package/src/composites/branding/LogoWordmark/index.ts +2 -0
  117. package/src/composites/display/Chip/Chip.styles.ts +189 -0
  118. package/src/composites/display/Chip/Chip.tsx +97 -0
  119. package/src/composites/display/Chip/Chip.types.ts +74 -0
  120. package/src/composites/display/Chip/index.ts +2 -0
  121. package/src/composites/form-controls/Select/Select.styles.ts +10 -10
  122. package/src/composites/form-controls/Select/Select.tsx +9 -6
  123. package/src/composites/form-controls/Select/SelectOption.tsx +10 -7
  124. package/src/composites/form-controls/TextInput/TextInput.styles.ts +12 -8
  125. package/src/composites/form-controls/TextInput/TextInput.tsx +7 -4
  126. package/src/composites/form-controls/Toggle/Toggle.styles.ts +10 -7
  127. package/src/composites/form-controls/Toggle/Toggle.tsx +4 -3
  128. package/src/composites/layout/AppShell/AppShell.styles.ts +8 -3
  129. package/src/composites/layout/AppShell/AppShell.tsx +6 -2
  130. package/src/composites/layout/Card/Card.styles.ts +10 -4
  131. package/src/composites/layout/Card/Card.tsx +4 -3
  132. package/src/composites/layout/ContentCard/ContentCard.styles.ts +44 -0
  133. package/src/composites/layout/ContentCard/ContentCard.tsx +71 -0
  134. package/src/composites/layout/ContentCard/ContentCard.types.ts +60 -0
  135. package/src/composites/layout/ContentCard/index.ts +2 -0
  136. package/src/composites/layout/Divider/Divider.styles.ts +30 -0
  137. package/src/composites/layout/Divider/Divider.tsx +46 -0
  138. package/src/composites/layout/Divider/Divider.types.ts +28 -0
  139. package/src/composites/layout/Divider/index.ts +2 -0
  140. package/src/composites/layout/Navbar/Navbar.styles.ts +7 -5
  141. package/src/composites/layout/Navbar/Navbar.tsx +4 -3
  142. package/src/composites/layout/Sidebar/Sidebar.styles.ts +7 -5
  143. package/src/composites/layout/Sidebar/Sidebar.tsx +4 -3
  144. package/src/composites/overlays/Popover/Popover.styles.ts +7 -5
  145. package/src/composites/overlays/Popover/Popover.tsx +4 -3
  146. package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +5 -5
  147. package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.tsx +4 -3
  148. package/src/composites/range-inputs/HueSlider/HueSlider.styles.ts +7 -7
  149. package/src/composites/range-inputs/HueSlider/HueSlider.tsx +1 -1
  150. package/src/composites/range-inputs/Slider/Slider.styles.ts +9 -9
  151. package/src/composites/range-inputs/Slider/Slider.tsx +1 -1
  152. package/src/index.ts +49 -10
  153. package/src/primitives/Frame/Frame.styles.ts +55 -12
  154. package/src/primitives/Frame/Frame.tsx +139 -140
  155. package/src/primitives/Frame/Frame.types.ts +119 -1
  156. package/src/primitives/Frame/index.ts +4 -0
  157. package/src/primitives/Icon/Icon.tsx +9 -6
  158. package/src/primitives/Icon/Icon.types.ts +2 -2
  159. package/src/primitives/Text/Text.spans.ts +9 -5
  160. package/src/primitives/Text/Text.tsx +26 -15
  161. package/src/primitives/Text/Text.types.ts +3 -6
  162. package/src/primitives/Wrapper/Wrapper.styles.ts +32 -0
  163. package/src/primitives/Wrapper/Wrapper.tsx +22 -3
  164. package/src/primitives/Wrapper/Wrapper.types.ts +45 -0
  165. package/src/registry/registry.ts +5 -21
  166. package/dist/_COMPONENT_TEMPLATE/ComponentName.d.ts +0 -70
  167. package/dist/_COMPONENT_TEMPLATE/ComponentName.d.ts.map +0 -1
  168. package/dist/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts +0 -23
  169. package/dist/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts.map +0 -1
  170. package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts +0 -45
  171. package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts.map +0 -1
  172. package/dist/_COMPONENT_TEMPLATE/index.d.ts +0 -3
  173. package/dist/_COMPONENT_TEMPLATE/index.d.ts.map +0 -1
@@ -4,8 +4,10 @@ import type { LayoutChangeEvent, TextStyle } from 'react-native';
4
4
  import { resolveResponsiveSize, estimateLineWidths, BREAKPOINT_ROLE_SCALE, scaleRoleStep, REFERENCE_LINE_HEIGHT_RATIO, buildFontFeatureSettings, SEMANTIC_WEIGHT_MAP, ROLE_DEFAULT_WEIGHTS } from '@newtonedev/fonts';
5
5
  import { useTokens } from 'newtone-api';
6
6
  import { useNewtoneTheme } from 'newtone-api';
7
+ import { useFrameContext } from 'newtone-api';
7
8
  import type { UseTokensResult } from 'newtone-api';
8
- import type { TextProps, TextColor } from './Text.types';
9
+ import type { ThemeName, AppearanceName } from 'newtone-api';
10
+ import type { TextProps, TextColor, TextRole } from './Text.types';
9
11
  import { useLocalCalibration } from 'newtone-api';
10
12
  import { useTypographyCalibrations } from 'newtone-api';
11
13
  import { enqueueObservation } from 'newtone-api';
@@ -21,21 +23,27 @@ export const TextScopeContext = createContext<{
21
23
  readonly weights: { readonly regular: number; readonly medium: number; readonly bold: number };
22
24
  } | null>(null);
23
25
 
26
+ /** Roles considered "large text" — accent uses accentLarge (lighter). */
27
+ const LARGE_TEXT_ROLES = new Set<TextRole>(['headline', 'title', 'heading', 'subheading']);
28
+
24
29
  /**
25
30
  * Resolve a semantic text color to a hex string from the current tokens.
26
- * Neutral text colors are top-level; palette colors use nested PaletteTokens.fill.
31
+ * Neutral colors use the inherited theme/appearance from the nearest Frame.
32
+ * Accent uses accentLarge (large text) or accentSmall (small text) from the inherited theme/appearance.
27
33
  */
28
- export function resolveTextColor(color: TextColor, tokens: UseTokensResult): string {
29
- const { gamut } = tokens;
34
+ export function resolveTextColor(
35
+ color: TextColor,
36
+ tokens: UseTokensResult,
37
+ theme: ThemeName = 'primary',
38
+ appearance: AppearanceName = 'main',
39
+ role: TextRole = 'body',
40
+ ): string {
30
41
  switch (color) {
31
- case 'primary': return tokens.textPrimary[gamut];
32
- case 'secondary': return tokens.textSecondary[gamut];
33
- case 'tertiary': return tokens.textTertiary[gamut];
34
- case 'disabled': return tokens.textDisabled[gamut];
35
- case 'accent': return tokens.accent.fill[gamut];
36
- case 'success': return tokens.success.fill[gamut];
37
- case 'warning': return tokens.warning.fill[gamut];
38
- case 'error': return tokens.error.fill[gamut];
42
+ case 'primary': return tokens.colors[theme][appearance].fontPrimary;
43
+ case 'secondary': return tokens.colors[theme][appearance].fontSecondary;
44
+ case 'tertiary': return tokens.colors[theme][appearance].fontTertiary;
45
+ case 'disabled': return tokens.colors[theme][appearance].fontDisabled;
46
+ case 'accent': return tokens.colors[theme][appearance][LARGE_TEXT_ROLES.has(role) ? 'accentLarge' : 'accentSmall'];
39
47
  }
40
48
  }
41
49
 
@@ -90,7 +98,7 @@ function TextBase({
90
98
  weight: weightOverride,
91
99
  align,
92
100
  numberOfLines,
93
- elevation = 1,
101
+ elevation,
94
102
  style,
95
103
  accessibilityRole: accessibilityRoleOverride,
96
104
  testID,
@@ -102,6 +110,9 @@ function TextBase({
102
110
  }: TextProps) {
103
111
  const tokens = useTokens(elevation);
104
112
  const { config, reportingEndpoint } = useNewtoneTheme();
113
+ const frameCtx = useFrameContext();
114
+ const resolvedTheme: ThemeName = frameCtx?.theme ?? 'primary';
115
+ const resolvedAppearance: AppearanceName = frameCtx?.appearance ?? 'main';
105
116
 
106
117
  const size = sizeOverride ?? 'md';
107
118
  const fontSlot = tokens.typography.fonts[scope];
@@ -195,13 +206,13 @@ function TextBase({
195
206
  fontFamily: fontSlot.family,
196
207
  fontSize: activeStep.fontSize,
197
208
  fontWeight: String(resolvedFontWeight) as TextStyle['fontWeight'],
198
- color: resolveTextColor(color, tokens),
209
+ color: resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance, role),
199
210
  lineHeight: correctedLineHeight,
200
211
  textAlign: align,
201
212
  ...(vcOffset !== 0 ? { transform: [{ translateY: vcOffset }] } : {}),
202
213
  ...(featureSettings ? { fontFeatureSettings: featureSettings } as any : {}),
203
214
  };
204
- }, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features]);
215
+ }, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features, resolvedTheme, resolvedAppearance]);
205
216
 
206
217
  // Auto-derive accessibility role and heading level for heading-like typography roles.
207
218
  // react-native-web uses aria-level to render the correct <h1>/<h2>/<h3> element.
@@ -8,7 +8,7 @@ export type TextSize = 'sm' | 'md' | 'lg';
8
8
  export type TextWeight = 'regular' | 'medium' | 'bold';
9
9
 
10
10
  /** Semantic text color tokens — resolved from the current theme's token palette. */
11
- export type TextColor = 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'success' | 'warning' | 'error';
11
+ export type TextColor = 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent';
12
12
 
13
13
  /** Font scope — selects which font family slot to use. @default 'main' */
14
14
  export type TextScope = 'main' | 'display' | 'mono' | 'currency';
@@ -66,10 +66,7 @@ export interface TextProps {
66
66
  * - `'secondary'` — Subdued/muted text (captions, labels)
67
67
  * - `'tertiary'` — Hints, placeholders
68
68
  * - `'disabled'` — Disabled text elements
69
- * - `'accent'` — Accent palette color for links/actions
70
- * - `'success'` — Success palette color for positive indicators
71
- * - `'warning'` — Warning palette color for caution indicators
72
- * - `'error'` — Error palette color for destructive/error indicators
69
+ * - `'accent'` — Accent color from the inherited theme/appearance (accentLarge for large text, accentSmall for small text)
73
70
  *
74
71
  * @default 'primary'
75
72
  */
@@ -89,7 +86,7 @@ export interface TextProps {
89
86
  /** Maximum number of lines before truncation with ellipsis. When omitted, text wraps freely. */
90
87
  readonly numberOfLines?: number;
91
88
 
92
- /** Elevation level for token computation. @default 1 */
89
+ /** Elevation level for token computation. When omitted, inherits from nearest parent Frame. */
93
90
  readonly elevation?: ElevationLevel;
94
91
 
95
92
  /** Style overrides (applied last). Supports a single style or an array of styles. */
@@ -8,6 +8,9 @@ import type {
8
8
  PaddingProp,
9
9
  GapProp,
10
10
  SizingMode,
11
+ PositionType,
12
+ OffsetValue,
13
+ OverflowMode,
11
14
  } from '../Frame/Frame.types';
12
15
  import {
13
16
  resolvePadding,
@@ -33,6 +36,16 @@ export interface WrapperStyleInput {
33
36
  readonly maxWidth?: number;
34
37
  readonly minHeight?: number;
35
38
  readonly maxHeight?: number;
39
+
40
+ // Positioning
41
+ readonly position?: PositionType;
42
+ readonly top?: OffsetValue;
43
+ readonly right?: OffsetValue;
44
+ readonly bottom?: OffsetValue;
45
+ readonly left?: OffsetValue;
46
+ readonly zIndex?: number;
47
+ readonly overflow?: OverflowMode;
48
+ readonly opacity?: number;
36
49
  }
37
50
 
38
51
  /**
@@ -58,6 +71,14 @@ export function getWrapperStyles(input: WrapperStyleInput): ViewStyle {
58
71
  maxWidth,
59
72
  minHeight,
60
73
  maxHeight,
74
+ position,
75
+ top,
76
+ right,
77
+ bottom,
78
+ left,
79
+ zIndex,
80
+ overflow,
81
+ opacity,
61
82
  } = input;
62
83
 
63
84
  // We build styles as a plain object first, then validate it through
@@ -107,6 +128,17 @@ export function getWrapperStyles(input: WrapperStyleInput): ViewStyle {
107
128
  if (minHeight !== undefined) container.minHeight = minHeight;
108
129
  if (maxHeight !== undefined) container.maxHeight = maxHeight;
109
130
 
131
+ // ── Positioning ──
132
+ // Set CSS position mode and offsets for absolute/fixed/sticky positioning.
133
+ if (position) container.position = position;
134
+ if (top !== undefined) container.top = top;
135
+ if (right !== undefined) container.right = right;
136
+ if (bottom !== undefined) container.bottom = bottom;
137
+ if (left !== undefined) container.left = left;
138
+ if (zIndex !== undefined) container.zIndex = zIndex;
139
+ if (overflow) container.overflow = overflow;
140
+ if (opacity !== undefined) container.opacity = opacity;
141
+
110
142
  // Pass through StyleSheet.create() to validate and optimize the styles,
111
143
  // then extract the single style object with `.c`.
112
144
  return StyleSheet.create({ c: container as ViewStyle }).c;
@@ -44,6 +44,16 @@ export function Wrapper({
44
44
  maxWidth,
45
45
  minHeight,
46
46
  maxHeight,
47
+ // Positioning
48
+ position,
49
+ top,
50
+ right,
51
+ bottom,
52
+ left,
53
+ zIndex,
54
+ overflow,
55
+ pointerEvents,
56
+ opacity,
47
57
  style,
48
58
  // Testing & platform
49
59
  testID,
@@ -51,9 +61,8 @@ export function Wrapper({
51
61
  ref,
52
62
  }: WrapperProps) {
53
63
  // Get the theme's design tokens so we can convert spacing names (like 'md')
54
- // into pixel values. The "1" is the default elevation level Wrapper doesn't
55
- // have its own elevation, but tokens need one for the spacing lookups.
56
- const tokens = useTokens(1);
64
+ // into pixel values. Wrapper inherits elevation from FrameContext automatically.
65
+ const tokens = useTokens();
57
66
 
58
67
  // Calculate the layout styles (direction, spacing, alignment, sizing).
59
68
  // Wrapped in useMemo so it only recalculates when one of the props changes,
@@ -74,11 +83,20 @@ export function Wrapper({
74
83
  maxWidth,
75
84
  minHeight,
76
85
  maxHeight,
86
+ position,
87
+ top,
88
+ right,
89
+ bottom,
90
+ left,
91
+ zIndex,
92
+ overflow,
93
+ opacity,
77
94
  }),
78
95
  [
79
96
  tokens, direction, wrap, reverse,
80
97
  align, justify, padding, gap,
81
98
  width, height, minWidth, maxWidth, minHeight, maxHeight,
99
+ position, top, right, bottom, left, zIndex, overflow, opacity,
82
100
  ],
83
101
  );
84
102
 
@@ -93,6 +111,7 @@ export function Wrapper({
93
111
  ref={ref}
94
112
  testID={testID}
95
113
  nativeID={nativeID}
114
+ pointerEvents={pointerEvents}
96
115
  // Wrapper is a layout-only container with no semantic meaning.
97
116
  // "none" tells screen readers to skip this element and read its children directly.
98
117
  accessibilityRole="none"
@@ -6,6 +6,10 @@ import type {
6
6
  PaddingProp,
7
7
  GapProp,
8
8
  SizingMode,
9
+ PositionType,
10
+ OffsetValue,
11
+ OverflowMode,
12
+ PointerEventsMode,
9
13
  } from '../Frame/Frame.types';
10
14
 
11
15
  /**
@@ -131,6 +135,47 @@ export interface WrapperProps {
131
135
  /** Maximum height in pixels. */
132
136
  readonly maxHeight?: number;
133
137
 
138
+ // ── Positioning ──
139
+
140
+ /**
141
+ * CSS position mode.
142
+ *
143
+ * `'fixed'` and `'sticky'` are web-only (supported via react-native-web).
144
+ * React Native natively supports `'absolute'` and `'relative'`.
145
+ */
146
+ readonly position?: PositionType;
147
+
148
+ /** Offset from the top edge. Accepts pixels (number) or percentage string. */
149
+ readonly top?: OffsetValue;
150
+
151
+ /** Offset from the right edge. Accepts pixels (number) or percentage string. */
152
+ readonly right?: OffsetValue;
153
+
154
+ /** Offset from the bottom edge. Accepts pixels (number) or percentage string. */
155
+ readonly bottom?: OffsetValue;
156
+
157
+ /** Offset from the left edge. Accepts pixels (number) or percentage string. */
158
+ readonly left?: OffsetValue;
159
+
160
+ /** Stacking order. Higher values render above lower values. */
161
+ readonly zIndex?: number;
162
+
163
+ /** Content overflow behavior. */
164
+ readonly overflow?: OverflowMode;
165
+
166
+ /**
167
+ * Controls whether the element can be the target of touch/pointer events.
168
+ *
169
+ * - `'auto'` — default, element and children receive events
170
+ * - `'none'` — element and children are invisible to events (pass through)
171
+ * - `'box-none'` — element ignores events but children can receive them
172
+ * - `'box-only'` — element receives events but children cannot
173
+ */
174
+ readonly pointerEvents?: PointerEventsMode;
175
+
176
+ /** Opacity of the element (0 = fully transparent, 1 = fully opaque). */
177
+ readonly opacity?: number;
178
+
134
179
  // ── Testing & Platform ──
135
180
 
136
181
  /** Test identifier — maps to `data-testid` on web. Used by testing libraries. */
@@ -19,17 +19,13 @@ export const COMPONENTS: readonly ComponentMeta[] = [
19
19
  variants: [
20
20
  { id: 'primary-md', label: 'Primary', props: { variant: 'primary', size: 'md' } },
21
21
  { id: 'secondary-md', label: 'Secondary', props: { variant: 'secondary', size: 'md' } },
22
- { id: 'tertiary-md', label: 'Tertiary', props: { variant: 'tertiary', size: 'md' } },
22
+ { id: 'ghost-md', label: 'Ghost', props: { variant: 'ghost', size: 'md' } },
23
23
  { id: 'primary-sm', label: 'Primary Small', props: { variant: 'primary', size: 'sm' } },
24
24
  { id: 'primary-lg', label: 'Primary Large', props: { variant: 'primary', size: 'lg' } },
25
- { id: 'accent-primary', label: 'Accent Primary', props: { variant: 'primary', size: 'md', semantic: 'accent' } },
26
- { id: 'accent-secondary', label: 'Accent Secondary', props: { variant: 'secondary', size: 'md', semantic: 'accent' } },
27
- { id: 'success-primary', label: 'Success Primary', props: { variant: 'primary', size: 'md', semantic: 'success' } },
28
- { id: 'error-primary', label: 'Error Primary', props: { variant: 'primary', size: 'md', semantic: 'error' } },
29
- { id: 'warning-primary', label: 'Warning Primary', props: { variant: 'primary', size: 'md', semantic: 'warning' } },
25
+ { id: 'primary-xl', label: 'Primary XL', props: { variant: 'primary', size: 'xl' } },
30
26
  { id: 'icon-left', label: 'Icon Left', props: { variant: 'primary', size: 'md', icon: 'add' } },
31
27
  { id: 'icon-right', label: 'Icon Right', props: { variant: 'primary', size: 'md', icon: 'arrow_forward', iconPosition: 'right' } },
32
- { id: 'icon-only', label: 'Icon Only', props: { variant: 'tertiary', size: 'md', icon: 'settings' } },
28
+ { id: 'icon-only', label: 'Icon Only', props: { variant: 'ghost', size: 'md', icon: 'settings' } },
33
29
  ],
34
30
  editableProps: [
35
31
  {
@@ -39,23 +35,10 @@ export const COMPONENTS: readonly ComponentMeta[] = [
39
35
  options: [
40
36
  { label: 'Primary', value: 'primary' },
41
37
  { label: 'Secondary', value: 'secondary' },
42
- { label: 'Tertiary', value: 'tertiary' },
38
+ { label: 'Ghost', value: 'ghost' },
43
39
  ],
44
40
  defaultValue: 'primary',
45
41
  },
46
- {
47
- name: 'semantic',
48
- label: 'Semantic',
49
- control: 'select',
50
- options: [
51
- { label: 'Neutral', value: 'neutral' },
52
- { label: 'Accent', value: 'accent' },
53
- { label: 'Success', value: 'success' },
54
- { label: 'Warning', value: 'warning' },
55
- { label: 'Error', value: 'error' },
56
- ],
57
- defaultValue: 'neutral',
58
- },
59
42
  {
60
43
  name: 'size',
61
44
  label: 'Size',
@@ -64,6 +47,7 @@ export const COMPONENTS: readonly ComponentMeta[] = [
64
47
  { label: 'Small', value: 'sm' },
65
48
  { label: 'Medium', value: 'md' },
66
49
  { label: 'Large', value: 'lg' },
50
+ { label: 'Extra Large', value: 'xl' },
67
51
  ],
68
52
  defaultValue: 'md',
69
53
  },
@@ -1,70 +0,0 @@
1
- /**
2
- * Component Template — Copy this directory when creating a new component.
3
- *
4
- * CROSS-PLATFORM RULES (enforced for all @newtonedev/components):
5
- *
6
- * 1. PRIMITIVES — Import ONLY from 'react-native':
7
- * View, Text, Pressable, ScrollView, TextInput, PanResponder, Animated, StyleSheet
8
- * NEVER use HTML elements (div, span, input, select, button, etc.)
9
- *
10
- * 2. STYLES — Always use StyleSheet.create() via a dedicated .styles.ts file.
11
- * Never use plain JS objects or React.CSSProperties.
12
- *
13
- * 3. COLORS — Use useTokens() for all colors. Never hardcode hex values.
14
- * Token palette: background, backgroundElevated, backgroundSunken,
15
- * textPrimary, textSecondary, interactive, interactiveHover, interactiveActive, border
16
- *
17
- * 4. ACCESSIBILITY — Use accessibilityRole and accessibilityState (not aria-* attributes).
18
- * react-native-web maps these to ARIA on the DOM automatically.
19
- * Reference: Toggle.tsx (accessibilityRole="switch", accessibilityState={{ checked }})
20
- *
21
- * 5. SHADOWS — Use RN shadow properties:
22
- * shadowColor, shadowOffset, shadowOpacity, shadowRadius, elevation
23
- * NEVER use boxShadow as a CSS string. react-native-web maps RN shadows automatically.
24
- * Reference: Frame.styles.ts, Popover.styles.ts
25
- *
26
- * 6. WEB-ONLY DOM — Guard with: if (typeof document === 'undefined') return;
27
- * This covers both native (no document) and SSR (no document during render).
28
- * Reference: GoogleFontLoader.tsx, Popover.tsx
29
- *
30
- * 7. WEB-ONLY EVENTS — Spread via typed-any pattern with comment:
31
- * const webProps = { onKeyDown: handler } as any; // web-only
32
- * <Pressable {...webProps} />
33
- * These are silently ignored on native. Reference: Select.tsx, Popover.tsx
34
- *
35
- * 8. WEB-ONLY CSS — Properties like userSelect, fontVariationSettings, cursor
36
- * are silently ignored on native. Mark with inline // web-only comment.
37
- * Cast via `as TextStyle` or `as any` to satisfy TypeScript.
38
- *
39
- * 9. TYPES — All props must be readonly. Define in ComponentName.types.ts.
40
- *
41
- * 10. MEMOIZATION — Wrap style computation in useMemo keyed on tokens + props.
42
- *
43
- * 11. JSDOC — Every interface and prop must have JSDoc with @example blocks.
44
- * Complex props (unions, objects) must explain all accepted forms inline.
45
- * Developers must be able to use components via autocomplete alone,
46
- * without consulting external documentation. See ComponentName.types.ts.
47
- *
48
- * 12. INLINE COMMENTS — Every logical block in .tsx and .styles.ts files must
49
- * have a plain-language comment explaining what it does and why. Write for
50
- * someone who has never seen React or React Native before. No jargon,
51
- * no assumed knowledge. A reader should be able to understand the entire
52
- * file top-to-bottom without external documentation.
53
- * Reference: Frame.tsx, Text.tsx, Frame.styles.ts, Frame.utils.ts
54
- *
55
- * 13. STANDARD PROPS — Every component must accept testID, nativeID, and ref.
56
- * testID maps to data-testid on web (used by testing libraries).
57
- * nativeID maps to id on web (used for DOM anchors).
58
- * ref is a regular React 19 prop (no forwardRef needed).
59
- * Reference: Frame.tsx, Text.tsx, Icon.tsx, Wrapper.tsx
60
- *
61
- * 14. ACCESSIBILITY — Interactive components must accept accessibilityLabel
62
- * and accessibilityHint. Use accessibilityState={{ disabled }} on Pressable.
63
- * Decorative elements use importantForAccessibility="no-hide-descendants".
64
- * Layout-only containers use accessibilityRole="none".
65
- * Reference: Frame.tsx (interactive), Icon.tsx (decorative), Wrapper.tsx (layout)
66
- */
67
- import React from 'react';
68
- import type { ComponentNameProps } from './ComponentName.types';
69
- export declare function ComponentName({ style, testID, nativeID, ref, }: ComponentNameProps): React.JSX.Element;
70
- //# sourceMappingURL=ComponentName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentName.d.ts","sourceRoot":"","sources":["../../src/_COMPONENT_TEMPLATE/ComponentName.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EAEL,MAAM,EACN,QAAQ,EACR,GAAG,GACJ,EAAE,kBAAkB,qBA0BpB"}
@@ -1,23 +0,0 @@
1
- import type { ResolvedTokens, ColorGamut } from 'newtone-api';
2
- /**
3
- * Pure style computation function.
4
- *
5
- * Rules:
6
- * - Always use StyleSheet.create() — never plain JS objects
7
- * - Colors from tokens only — never hardcoded hex (except shadows: '#000')
8
- * - Use `[gamut]` indexing on TokenColor values (never `.srgb` or `.p3` directly)
9
- * - Shadows via RN properties (shadowColor, shadowOffset, shadowOpacity, shadowRadius, elevation)
10
- * NEVER use boxShadow as a CSS string
11
- * - For web-only CSS (boxShadow, gridTemplateColumns, etc.):
12
- * return as a separate property and apply via web overrides pattern (see Frame.styles.ts)
13
- * - Every section must have a plain-language inline comment explaining what
14
- * the style achieves visually, not just the CSS property name
15
- */
16
- export declare function getComponentNameStyles(tokens: ResolvedTokens, gamut: ColorGamut): {
17
- container: {
18
- backgroundColor: string;
19
- borderRadius: number;
20
- padding: number;
21
- };
22
- };
23
- //# sourceMappingURL=ComponentName.styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentName.styles.d.ts","sourceRoot":"","sources":["../../src/_COMPONENT_TEMPLATE/ComponentName.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU;;;;;;EAW/E"}
@@ -1,45 +0,0 @@
1
- import type { View, ViewStyle } from 'react-native';
2
- import type { ElevationLevel } from 'newtone-api';
3
- /**
4
- * Props for ComponentName — [one-line description of what this component does].
5
- *
6
- * [Brief explanation of when to use this component and what it provides.]
7
- *
8
- * @example
9
- * ```tsx
10
- * // Basic usage
11
- * <ComponentName>Content</ComponentName>
12
- * ```
13
- *
14
- * @example
15
- * ```tsx
16
- * // With common prop combinations
17
- * <ComponentName disabled elevation={2}>
18
- * Advanced usage
19
- * </ComponentName>
20
- * ```
21
- */
22
- export interface ComponentNameProps {
23
- /**
24
- * [Describe what children this component expects.]
25
- *
26
- * @example
27
- * ```tsx
28
- * <ComponentName>Text or elements</ComponentName>
29
- * ```
30
- */
31
- readonly children?: React.ReactNode;
32
- /** Additional styles applied to the container. */
33
- readonly style?: ViewStyle;
34
- /** Elevation level for token computation. @default 1 */
35
- readonly elevation?: ElevationLevel;
36
- /** Whether the component is disabled. @default false */
37
- readonly disabled?: boolean;
38
- /** Test identifier — maps to `data-testid` on web. Used by testing libraries. */
39
- readonly testID?: string;
40
- /** DOM id — maps to `id` attribute on web. Used for anchors and scroll targets. */
41
- readonly nativeID?: string;
42
- /** Ref to the underlying View element. */
43
- readonly ref?: React.Ref<View>;
44
- }
45
- //# sourceMappingURL=ComponentName.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentName.types.d.ts","sourceRoot":"","sources":["../../src/_COMPONENT_TEMPLATE/ComponentName.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEpC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAE3B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC;IAEpC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAI5B,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B,0CAA0C;IAC1C,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;CAChC"}
@@ -1,3 +0,0 @@
1
- export { ComponentName } from './ComponentName';
2
- export type { ComponentNameProps } from './ComponentName.types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_COMPONENT_TEMPLATE/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}