@multiplatform.one/theme 7.81.2 → 7.82.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/theme",
3
- "version": "7.81.2",
3
+ "version": "7.82.0",
4
4
  "description": "Tamagui theme system for multiplatform.one",
5
5
  "keywords": [
6
6
  "multiplatform",
@@ -72,8 +72,8 @@
72
72
  "access": "public"
73
73
  },
74
74
  "dependencies": {
75
- "@multiplatform.one/platform": "^7.81.2",
76
- "@multiplatform.one/store": "^7.81.2",
75
+ "@multiplatform.one/platform": "^7.82.0",
76
+ "@multiplatform.one/store": "^7.82.0",
77
77
  "@tamagui/animations-react-native": "2.7.6",
78
78
  "@tamagui/colors": "2.7.6",
79
79
  "@tamagui/config": "2.7.6",
@@ -89,8 +89,8 @@
89
89
  },
90
90
  "devDependencies": {
91
91
  "@expo/prebuild-config": "55.0.18",
92
- "@multiplatform.one/config": "7.81.2",
93
- "@multiplatform.one/test-utils": "7.81.2",
92
+ "@multiplatform.one/config": "7.82.0",
93
+ "@multiplatform.one/test-utils": "7.82.0",
94
94
  "@tamagui/animations-css": "2.7.6",
95
95
  "@tamagui/animations-reanimated": "2.7.6",
96
96
  "@tamagui/font-inter": "2.7.6",
@@ -154,6 +154,40 @@ describe("Surface nesting (LC-78)", () => {
154
154
  });
155
155
  });
156
156
 
157
+ describe("Surface field (LC-176, FZ-8711)", () => {
158
+ function read(tree: (probe: ReactNode) => ReactNode): SurfaceIntent {
159
+ let intent: SurfaceIntent | undefined;
160
+ render(tree(createElement(Probe, { onRead: (value) => (intent = value) })) as never);
161
+ if (!intent) throw new Error("Surface probe did not render");
162
+ return intent;
163
+ }
164
+
165
+ it("a field's frame marks its subtree, inside a bar too, and nests unchanged", () => {
166
+ expect(read((probe) => probe).field).toBe(false);
167
+ const inBar = read((probe) =>
168
+ createElement(Surface, { bar: true }, createElement(Surface, { field: true }, probe)),
169
+ );
170
+ expect(inBar).toMatchObject({ bar: true, field: true });
171
+ expect(
172
+ read((probe) =>
173
+ createElement(Surface, { field: true }, createElement(Surface, { size: "$3" }, probe)),
174
+ ).field,
175
+ ).toBe(true);
176
+ });
177
+
178
+ it("a painted surface (an overlay, a card) resets it, so a menu from a slotted glyph is content", () => {
179
+ expect(
180
+ read((probe) =>
181
+ createElement(
182
+ Surface,
183
+ { field: true },
184
+ createElement(Surface, { painted: false, elevated: true }, probe),
185
+ ),
186
+ ).field,
187
+ ).toBe(false);
188
+ });
189
+ });
190
+
157
191
  describe("useResolvedKnobs inside Surface", () => {
158
192
  const inSurface =
159
193
  (size: SizeTokens) =>
@@ -17,12 +17,18 @@ export type SurfaceSize = SizeTokens | "unset";
17
17
  * `elevated`: the subtree sits on the elevated ground (`elevatedSurface`
18
18
  * unpainted), which in dark is the control wash's own step, so controls on it
19
19
  * step their fill one up (LC-153, FZ-7944). Any explicit `painted` resets it.
20
+ *
21
+ * `field`: the subtree is inside a text field's frame, so an icon button there
22
+ * is part of the field: a bare tinted glyph, never glass or a plate, even when
23
+ * the field sits in a bar (LC-176, FZ-8711). Any explicit `painted` resets it,
24
+ * so a menu opened from that glyph is content again.
20
25
  */
21
26
  export type SurfaceIntent = {
22
27
  size: SurfaceSize;
23
28
  painted: boolean;
24
29
  bar: boolean;
25
30
  elevated: boolean;
31
+ field: boolean;
26
32
  };
27
33
 
28
34
  export const SurfaceContext = createStyledContext<SurfaceIntent>({
@@ -30,6 +36,7 @@ export const SurfaceContext = createStyledContext<SurfaceIntent>({
30
36
  painted: false,
31
37
  bar: false,
32
38
  elevated: false,
39
+ field: false,
33
40
  });
34
41
 
35
42
  /** True inside a bar (LC-153): neutral buttons there are plain, not tinted. */
@@ -37,6 +44,11 @@ export function useBarSurface(): boolean {
37
44
  return SurfaceContext.useStyledContext().bar ?? false;
38
45
  }
39
46
 
47
+ /** True inside a text field's frame (LC-176): an icon button there is the field's bare glyph. */
48
+ export function useFieldSurface(): boolean {
49
+ return SurfaceContext.useStyledContext().field ?? false;
50
+ }
51
+
40
52
  /** True on an elevated ground (an overlay frame, an unnested Panel): controls step their wash up in dark. */
41
53
  export function useElevatedSurface(): boolean {
42
54
  return SurfaceContext.useStyledContext().elevated ?? false;
@@ -121,7 +133,8 @@ export function clampSurfaceSize(requested: SurfaceSize, parent: SurfaceSize): S
121
133
  * inherits it. `bar` marks a bar subtree (LC-153); omitted, it inherits unless
122
134
  * `painted` is given, which resets it. `elevated` marks a frame that paints
123
135
  * the elevated ground; omitted it inherits unless `painted` is given, which
124
- * resets it. Either way a painted value opens a new surface with its own
136
+ * resets it. `field` marks a text field's frame the same way. Either way a
137
+ * painted value opens a new surface with its own
125
138
  * inset, so the page gutter does not reach inside it (LC-146).
126
139
  *
127
140
  * @example A table cell's editors at the row's control height
@@ -132,12 +145,14 @@ export function Surface({
132
145
  painted,
133
146
  bar,
134
147
  elevated,
148
+ field,
135
149
  children,
136
150
  }: {
137
151
  size?: SizeTokens;
138
152
  painted?: boolean;
139
153
  bar?: boolean;
140
154
  elevated?: boolean;
155
+ field?: boolean;
141
156
  children?: ReactNode;
142
157
  }) {
143
158
  const parent = SurfaceContext.useStyledContext();
@@ -145,12 +160,14 @@ export function Surface({
145
160
  const nextPainted = painted ?? parent.painted ?? false;
146
161
  const nextBar = bar ?? (painted === undefined ? (parent.bar ?? false) : false);
147
162
  const nextElevated = elevated ?? (painted === undefined ? (parent.elevated ?? false) : false);
163
+ const nextField = field ?? (painted === undefined ? (parent.field ?? false) : false);
148
164
  return (
149
165
  <SurfaceContext.Provider
150
166
  size={nextSize}
151
167
  painted={nextPainted}
152
168
  bar={nextBar}
153
169
  elevated={nextElevated}
170
+ field={nextField}
154
171
  >
155
172
  {painted === undefined ? children : <PageGutter inset={null}>{children}</PageGutter>}
156
173
  </SurfaceContext.Provider>
@@ -14,16 +14,24 @@ export type SurfaceSize = SizeTokens | "unset";
14
14
  * `elevated`: the subtree sits on the elevated ground (`elevatedSurface`
15
15
  * unpainted), which in dark is the control wash's own step, so controls on it
16
16
  * step their fill one up (LC-153, FZ-7944). Any explicit `painted` resets it.
17
+ *
18
+ * `field`: the subtree is inside a text field's frame, so an icon button there
19
+ * is part of the field: a bare tinted glyph, never glass or a plate, even when
20
+ * the field sits in a bar (LC-176, FZ-8711). Any explicit `painted` resets it,
21
+ * so a menu opened from that glyph is content again.
17
22
  */
18
23
  export type SurfaceIntent = {
19
24
  size: SurfaceSize;
20
25
  painted: boolean;
21
26
  bar: boolean;
22
27
  elevated: boolean;
28
+ field: boolean;
23
29
  };
24
30
  export declare const SurfaceContext: import("@tamagui/web").StyledContext<SurfaceIntent>;
25
31
  /** True inside a bar (LC-153): neutral buttons there are plain, not tinted. */
26
32
  export declare function useBarSurface(): boolean;
33
+ /** True inside a text field's frame (LC-176): an icon button there is the field's bare glyph. */
34
+ export declare function useFieldSurface(): boolean;
27
35
  /** True on an elevated ground (an overlay frame, an unnested Panel): controls step their wash up in dark. */
28
36
  export declare function useElevatedSurface(): boolean;
29
37
  /**
@@ -72,17 +80,19 @@ export declare function clampSurfaceSize(requested: SurfaceSize, parent: Surface
72
80
  * inherits it. `bar` marks a bar subtree (LC-153); omitted, it inherits unless
73
81
  * `painted` is given, which resets it. `elevated` marks a frame that paints
74
82
  * the elevated ground; omitted it inherits unless `painted` is given, which
75
- * resets it. Either way a painted value opens a new surface with its own
83
+ * resets it. `field` marks a text field's frame the same way. Either way a
84
+ * painted value opens a new surface with its own
76
85
  * inset, so the page gutter does not reach inside it (LC-146).
77
86
  *
78
87
  * @example A table cell's editors at the row's control height
79
88
  * <Surface size="$3">{cell}</Surface>
80
89
  */
81
- export declare function Surface({ size, painted, bar, elevated, children, }: {
90
+ export declare function Surface({ size, painted, bar, elevated, field, children, }: {
82
91
  size?: SizeTokens;
83
92
  painted?: boolean;
84
93
  bar?: boolean;
85
94
  elevated?: boolean;
95
+ field?: boolean;
86
96
  children?: ReactNode;
87
97
  }): import("react/jsx-runtime").JSX.Element;
88
98
  //# sourceMappingURL=Surface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../src/theme/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAI/D,oEAAoE;AACpE,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAC/C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc,qDAKzB,CAAC;AAEH,+EAA+E;AAC/E,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAKD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAErE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAI1F;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAG3F;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,CAKpE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,C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