@newtonedev/components 0.1.13 → 0.1.14
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/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts +1 -1
- package/dist/composites/actions/Button/Button.d.ts +11 -1
- package/dist/composites/actions/Button/Button.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.types.d.ts +11 -1
- package/dist/composites/actions/Button/Button.types.d.ts.map +1 -1
- package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts +10 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts.map +1 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts +35 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts.map +1 -0
- package/dist/composites/branding/LogoMonogram/index.d.ts +3 -0
- package/dist/composites/branding/LogoMonogram/index.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts +9 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts +26 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/index.d.ts +3 -0
- package/dist/composites/branding/LogoWordmark/index.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.d.ts +25 -0
- package/dist/composites/display/Chip/Chip.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.styles.d.ts +29 -0
- package/dist/composites/display/Chip/Chip.styles.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.types.d.ts +63 -0
- package/dist/composites/display/Chip/Chip.types.d.ts.map +1 -0
- package/dist/composites/display/Chip/index.d.ts +3 -0
- package/dist/composites/display/Chip/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/Select.d.ts.map +1 -1
- package/dist/composites/form-controls/Select/Select.styles.d.ts +2 -2
- package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts +2 -2
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts +2 -2
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -1
- package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -1
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts +2 -2
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -1
- package/dist/composites/layout/Card/Card.d.ts.map +1 -1
- package/dist/composites/layout/Card/Card.styles.d.ts +2 -2
- package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -1
- package/dist/composites/layout/ContentCard/ContentCard.d.ts +33 -0
- package/dist/composites/layout/ContentCard/ContentCard.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts +10 -0
- package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/ContentCard.types.d.ts +52 -0
- package/dist/composites/layout/ContentCard/ContentCard.types.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/index.d.ts +3 -0
- package/dist/composites/layout/ContentCard/index.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.d.ts +25 -0
- package/dist/composites/layout/Divider/Divider.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.styles.d.ts +8 -0
- package/dist/composites/layout/Divider/Divider.styles.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.types.d.ts +25 -0
- package/dist/composites/layout/Divider/Divider.types.d.ts.map +1 -0
- package/dist/composites/layout/Divider/index.d.ts +3 -0
- package/dist/composites/layout/Divider/index.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -1
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts +4 -3
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts +4 -3
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -1
- package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -1
- package/dist/composites/overlays/Popover/Popover.styles.d.ts +2 -2
- package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts +2 -2
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts +2 -2
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts +2 -2
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -1
- package/dist/index.cjs +903 -396
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +830 -344
- package/dist/index.js.map +1 -1
- package/dist/primitives/Frame/Frame.d.ts +1 -35
- package/dist/primitives/Frame/Frame.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.styles.d.ts +13 -4
- package/dist/primitives/Frame/Frame.styles.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.types.d.ts +99 -1
- package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
- package/dist/primitives/Frame/index.d.ts +1 -1
- package/dist/primitives/Frame/index.d.ts.map +1 -1
- package/dist/primitives/Icon/Icon.d.ts.map +1 -1
- package/dist/primitives/Icon/Icon.types.d.ts +2 -2
- package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
- package/dist/primitives/Text/Text.d.ts +5 -3
- package/dist/primitives/Text/Text.d.ts.map +1 -1
- package/dist/primitives/Text/Text.spans.d.ts.map +1 -1
- package/dist/primitives/Text/Text.types.d.ts +3 -6
- package/dist/primitives/Text/Text.types.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.d.ts +1 -1
- package/dist/primitives/Wrapper/Wrapper.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts +9 -1
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts +31 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/composites/actions/Button/Button.styles.ts +71 -55
- package/src/composites/actions/Button/Button.tsx +34 -13
- package/src/composites/actions/Button/Button.types.ts +13 -1
- package/src/composites/branding/LogoMonogram/LogoMonogram.tsx +29 -0
- package/src/composites/branding/LogoMonogram/LogoMonogram.types.ts +35 -0
- package/src/composites/branding/LogoMonogram/index.ts +2 -0
- package/src/composites/branding/LogoWordmark/LogoWordmark.tsx +29 -0
- package/src/composites/branding/LogoWordmark/LogoWordmark.types.ts +25 -0
- package/src/composites/branding/LogoWordmark/index.ts +2 -0
- package/src/composites/display/Chip/Chip.styles.ts +189 -0
- package/src/composites/display/Chip/Chip.tsx +97 -0
- package/src/composites/display/Chip/Chip.types.ts +74 -0
- package/src/composites/display/Chip/index.ts +2 -0
- package/src/composites/form-controls/Select/Select.styles.ts +10 -10
- package/src/composites/form-controls/Select/Select.tsx +9 -6
- package/src/composites/form-controls/Select/SelectOption.tsx +10 -7
- package/src/composites/form-controls/TextInput/TextInput.styles.ts +12 -8
- package/src/composites/form-controls/TextInput/TextInput.tsx +7 -4
- package/src/composites/form-controls/Toggle/Toggle.styles.ts +10 -7
- package/src/composites/form-controls/Toggle/Toggle.tsx +4 -3
- package/src/composites/layout/AppShell/AppShell.styles.ts +8 -3
- package/src/composites/layout/AppShell/AppShell.tsx +6 -2
- package/src/composites/layout/Card/Card.styles.ts +10 -4
- package/src/composites/layout/Card/Card.tsx +4 -3
- package/src/composites/layout/ContentCard/ContentCard.styles.ts +44 -0
- package/src/composites/layout/ContentCard/ContentCard.tsx +71 -0
- package/src/composites/layout/ContentCard/ContentCard.types.ts +60 -0
- package/src/composites/layout/ContentCard/index.ts +2 -0
- package/src/composites/layout/Divider/Divider.styles.ts +30 -0
- package/src/composites/layout/Divider/Divider.tsx +46 -0
- package/src/composites/layout/Divider/Divider.types.ts +28 -0
- package/src/composites/layout/Divider/index.ts +2 -0
- package/src/composites/layout/Navbar/Navbar.styles.ts +7 -5
- package/src/composites/layout/Navbar/Navbar.tsx +4 -3
- package/src/composites/layout/Sidebar/Sidebar.styles.ts +7 -5
- package/src/composites/layout/Sidebar/Sidebar.tsx +4 -3
- package/src/composites/overlays/Popover/Popover.styles.ts +7 -5
- package/src/composites/overlays/Popover/Popover.tsx +4 -3
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +5 -5
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.tsx +4 -3
- package/src/composites/range-inputs/HueSlider/HueSlider.styles.ts +7 -7
- package/src/composites/range-inputs/HueSlider/HueSlider.tsx +1 -1
- package/src/composites/range-inputs/Slider/Slider.styles.ts +9 -9
- package/src/composites/range-inputs/Slider/Slider.tsx +1 -1
- package/src/index.ts +43 -9
- package/src/primitives/Frame/Frame.styles.ts +55 -12
- package/src/primitives/Frame/Frame.tsx +138 -140
- package/src/primitives/Frame/Frame.types.ts +119 -1
- package/src/primitives/Frame/index.ts +4 -0
- package/src/primitives/Icon/Icon.tsx +9 -6
- package/src/primitives/Icon/Icon.types.ts +2 -2
- package/src/primitives/Text/Text.spans.ts +9 -5
- package/src/primitives/Text/Text.tsx +26 -15
- package/src/primitives/Text/Text.types.ts +3 -6
- package/src/primitives/Wrapper/Wrapper.styles.ts +32 -0
- package/src/primitives/Wrapper/Wrapper.tsx +22 -3
- package/src/primitives/Wrapper/Wrapper.types.ts +45 -0
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var newtoneApi = require('newtone-api');
|
|
4
|
-
var
|
|
4
|
+
var React16 = require('react');
|
|
5
5
|
var reactNative = require('react-native');
|
|
6
6
|
var fonts = require('@newtonedev/fonts');
|
|
7
7
|
var newtone = require('newtone');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var React16__default = /*#__PURE__*/_interopDefault(React16);
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
var hadKeyboardEvent = false;
|
|
@@ -39,16 +39,16 @@ function setupModality() {
|
|
|
39
39
|
}, true);
|
|
40
40
|
}
|
|
41
41
|
function useFocusVisible() {
|
|
42
|
-
const [isFocusVisible, setIsFocusVisible] =
|
|
43
|
-
|
|
42
|
+
const [isFocusVisible, setIsFocusVisible] = React16.useState(false);
|
|
43
|
+
React16.useEffect(() => {
|
|
44
44
|
setupModality();
|
|
45
45
|
}, []);
|
|
46
|
-
const onFocus =
|
|
46
|
+
const onFocus = React16.useCallback(() => {
|
|
47
47
|
if (hadKeyboardEvent) {
|
|
48
48
|
setIsFocusVisible(true);
|
|
49
49
|
}
|
|
50
50
|
}, []);
|
|
51
|
-
const onBlur =
|
|
51
|
+
const onBlur = React16.useCallback(() => {
|
|
52
52
|
setIsFocusVisible(false);
|
|
53
53
|
}, []);
|
|
54
54
|
const focusProps = { onFocus, onBlur };
|
|
@@ -160,8 +160,9 @@ function resolveFlexDirection(direction, reverse) {
|
|
|
160
160
|
function getFrameStyles(input) {
|
|
161
161
|
const {
|
|
162
162
|
tokens,
|
|
163
|
-
gamut,
|
|
164
163
|
frameElevation,
|
|
164
|
+
theme = "primary",
|
|
165
|
+
appearance = "main",
|
|
165
166
|
layout = "flex",
|
|
166
167
|
direction = "vertical",
|
|
167
168
|
wrap = false,
|
|
@@ -178,13 +179,22 @@ function getFrameStyles(input) {
|
|
|
178
179
|
maxWidth,
|
|
179
180
|
minHeight,
|
|
180
181
|
maxHeight,
|
|
182
|
+
position,
|
|
183
|
+
top,
|
|
184
|
+
right,
|
|
185
|
+
bottom,
|
|
186
|
+
left,
|
|
187
|
+
zIndex,
|
|
188
|
+
overflow,
|
|
189
|
+
opacity,
|
|
181
190
|
radius,
|
|
182
191
|
bordered = false,
|
|
183
192
|
disabled = false
|
|
184
193
|
} = input;
|
|
185
194
|
const container = {};
|
|
186
|
-
|
|
187
|
-
container.
|
|
195
|
+
const appearanceTokens = tokens.colors[theme][appearance];
|
|
196
|
+
container.backgroundColor = appearanceTokens.background;
|
|
197
|
+
container.color = appearanceTokens.fontPrimary;
|
|
188
198
|
if (layout === "flex") {
|
|
189
199
|
container.display = "flex";
|
|
190
200
|
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
@@ -215,6 +225,12 @@ function getFrameStyles(input) {
|
|
|
215
225
|
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
216
226
|
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
217
227
|
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
228
|
+
if (position) container.position = position;
|
|
229
|
+
if (top !== void 0) container.top = top;
|
|
230
|
+
if (right !== void 0) container.right = right;
|
|
231
|
+
if (bottom !== void 0) container.bottom = bottom;
|
|
232
|
+
if (left !== void 0) container.left = left;
|
|
233
|
+
if (zIndex !== void 0) container.zIndex = zIndex;
|
|
218
234
|
if (radius !== void 0) {
|
|
219
235
|
const corners = resolveRadiusCorners(radius, tokens);
|
|
220
236
|
container.borderTopLeftRadius = corners.topLeft;
|
|
@@ -225,9 +241,10 @@ function getFrameStyles(input) {
|
|
|
225
241
|
container.overflow = "hidden";
|
|
226
242
|
}
|
|
227
243
|
}
|
|
244
|
+
if (overflow) container.overflow = overflow;
|
|
228
245
|
if (bordered) {
|
|
229
246
|
container.borderWidth = 1;
|
|
230
|
-
container.borderColor =
|
|
247
|
+
container.borderColor = appearanceTokens.fontTertiary;
|
|
231
248
|
}
|
|
232
249
|
if (frameElevation === 2) {
|
|
233
250
|
container.shadowColor = "#000";
|
|
@@ -236,11 +253,13 @@ function getFrameStyles(input) {
|
|
|
236
253
|
container.shadowRadius = 6;
|
|
237
254
|
container.elevation = 4;
|
|
238
255
|
}
|
|
239
|
-
if (
|
|
256
|
+
if (opacity !== void 0) {
|
|
257
|
+
container.opacity = opacity;
|
|
258
|
+
} else if (disabled) {
|
|
240
259
|
container.opacity = 0.5;
|
|
241
260
|
}
|
|
242
261
|
const pressed = reactNative.StyleSheet.create({
|
|
243
|
-
s: { backgroundColor:
|
|
262
|
+
s: { backgroundColor: appearanceTokens.fontSecondary }
|
|
244
263
|
}).s;
|
|
245
264
|
let gridWebStyle = null;
|
|
246
265
|
if (layout === "grid") {
|
|
@@ -264,13 +283,18 @@ function getFrameStyles(input) {
|
|
|
264
283
|
|
|
265
284
|
// src/primitives/Frame/Frame.tsx
|
|
266
285
|
function wrapTextChildren(children, textStyle) {
|
|
267
|
-
return
|
|
286
|
+
return React16__default.default.Children.map(children, (child) => {
|
|
268
287
|
if (typeof child === "string" || typeof child === "number") {
|
|
269
|
-
return /* @__PURE__ */
|
|
288
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: textStyle }, child);
|
|
270
289
|
}
|
|
271
290
|
return child;
|
|
272
291
|
});
|
|
273
292
|
}
|
|
293
|
+
var ELEVATION_MAP = {
|
|
294
|
+
0: "sunken",
|
|
295
|
+
1: "grounded",
|
|
296
|
+
2: "elevated"
|
|
297
|
+
};
|
|
274
298
|
function toElevationLevel(frameElevation) {
|
|
275
299
|
if (frameElevation <= -1) return 0;
|
|
276
300
|
if (frameElevation === 0) return 1;
|
|
@@ -280,6 +304,11 @@ function Frame({
|
|
|
280
304
|
children,
|
|
281
305
|
// Elevation
|
|
282
306
|
elevation,
|
|
307
|
+
// Scheme
|
|
308
|
+
scheme,
|
|
309
|
+
// Theme / Appearance
|
|
310
|
+
theme,
|
|
311
|
+
appearance,
|
|
283
312
|
// Layout
|
|
284
313
|
layout,
|
|
285
314
|
direction,
|
|
@@ -300,6 +329,16 @@ function Frame({
|
|
|
300
329
|
maxWidth,
|
|
301
330
|
minHeight,
|
|
302
331
|
maxHeight,
|
|
332
|
+
// Positioning
|
|
333
|
+
position,
|
|
334
|
+
top,
|
|
335
|
+
right,
|
|
336
|
+
bottom,
|
|
337
|
+
left,
|
|
338
|
+
zIndex,
|
|
339
|
+
overflow,
|
|
340
|
+
pointerEvents,
|
|
341
|
+
opacity,
|
|
303
342
|
// Appearance
|
|
304
343
|
radius,
|
|
305
344
|
bordered,
|
|
@@ -317,27 +356,41 @@ function Frame({
|
|
|
317
356
|
// Style override
|
|
318
357
|
style
|
|
319
358
|
}) {
|
|
320
|
-
const
|
|
359
|
+
const themeCtx = newtoneApi.useNewtoneTheme();
|
|
360
|
+
const { mode, gamut } = themeCtx;
|
|
321
361
|
const parentFrameCtx = newtoneApi.useFrameContext();
|
|
362
|
+
const resolvedConfig = React16.useMemo(() => {
|
|
363
|
+
if (scheme && themeCtx.schemes) {
|
|
364
|
+
const schemeConfig = themeCtx.schemes[scheme];
|
|
365
|
+
if (schemeConfig) return schemeConfig;
|
|
366
|
+
}
|
|
367
|
+
return themeCtx.config;
|
|
368
|
+
}, [scheme, themeCtx.schemes, themeCtx.config]);
|
|
369
|
+
const isSchemeOverride = resolvedConfig !== themeCtx.config;
|
|
370
|
+
const resolvedTheme = theme ?? parentFrameCtx?.theme ?? "primary";
|
|
371
|
+
const resolvedAppearance = appearance ?? parentFrameCtx?.appearance ?? "main";
|
|
322
372
|
const resolvedFrameElevation = elevation ?? 0;
|
|
323
373
|
const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
|
|
324
|
-
const tokens =
|
|
374
|
+
const tokens = React16.useMemo(() => {
|
|
325
375
|
return newtoneApi.computeTokens(
|
|
326
|
-
|
|
376
|
+
resolvedConfig.colorSystem,
|
|
327
377
|
mode,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
378
|
+
gamut,
|
|
379
|
+
ELEVATION_MAP[resolvedElevation],
|
|
380
|
+
resolvedConfig.spacing,
|
|
381
|
+
resolvedConfig.radius,
|
|
382
|
+
resolvedConfig.typography,
|
|
383
|
+
resolvedConfig.icons,
|
|
384
|
+
resolvedConfig.themeMappings,
|
|
385
|
+
resolvedConfig.swatchDefaults
|
|
334
386
|
);
|
|
335
|
-
}, [
|
|
336
|
-
const styles =
|
|
387
|
+
}, [resolvedConfig, mode, gamut, resolvedElevation]);
|
|
388
|
+
const styles = React16.useMemo(
|
|
337
389
|
() => getFrameStyles({
|
|
338
390
|
tokens,
|
|
339
|
-
gamut,
|
|
340
391
|
frameElevation: resolvedFrameElevation,
|
|
392
|
+
theme: resolvedTheme,
|
|
393
|
+
appearance: resolvedAppearance,
|
|
341
394
|
layout,
|
|
342
395
|
direction,
|
|
343
396
|
wrap,
|
|
@@ -354,14 +407,23 @@ function Frame({
|
|
|
354
407
|
maxWidth,
|
|
355
408
|
minHeight,
|
|
356
409
|
maxHeight,
|
|
410
|
+
position,
|
|
411
|
+
top,
|
|
412
|
+
right,
|
|
413
|
+
bottom,
|
|
414
|
+
left,
|
|
415
|
+
zIndex,
|
|
416
|
+
overflow,
|
|
417
|
+
opacity,
|
|
357
418
|
radius,
|
|
358
419
|
bordered,
|
|
359
420
|
disabled
|
|
360
421
|
}),
|
|
361
422
|
[
|
|
362
423
|
tokens,
|
|
363
|
-
gamut,
|
|
364
424
|
resolvedFrameElevation,
|
|
425
|
+
resolvedTheme,
|
|
426
|
+
resolvedAppearance,
|
|
365
427
|
layout,
|
|
366
428
|
direction,
|
|
367
429
|
wrap,
|
|
@@ -378,15 +440,38 @@ function Frame({
|
|
|
378
440
|
maxWidth,
|
|
379
441
|
minHeight,
|
|
380
442
|
maxHeight,
|
|
443
|
+
position,
|
|
444
|
+
top,
|
|
445
|
+
right,
|
|
446
|
+
bottom,
|
|
447
|
+
left,
|
|
448
|
+
zIndex,
|
|
449
|
+
overflow,
|
|
450
|
+
opacity,
|
|
381
451
|
radius,
|
|
382
452
|
bordered,
|
|
383
453
|
disabled
|
|
384
454
|
]
|
|
385
455
|
);
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
|
|
456
|
+
const resolvedScheme = scheme ?? parentFrameCtx?.scheme;
|
|
457
|
+
const contextValue = React16.useMemo(
|
|
458
|
+
() => ({
|
|
459
|
+
elevation: resolvedElevation,
|
|
460
|
+
tokens,
|
|
461
|
+
scheme: resolvedScheme,
|
|
462
|
+
theme: resolvedTheme,
|
|
463
|
+
appearance: resolvedAppearance
|
|
464
|
+
}),
|
|
465
|
+
[resolvedElevation, tokens, resolvedScheme, resolvedTheme, resolvedAppearance]
|
|
389
466
|
);
|
|
467
|
+
const schemeThemeCtx = React16.useMemo(() => {
|
|
468
|
+
if (!isSchemeOverride) return null;
|
|
469
|
+
return {
|
|
470
|
+
...themeCtx,
|
|
471
|
+
config: resolvedConfig,
|
|
472
|
+
activeScheme: scheme ?? themeCtx.activeScheme
|
|
473
|
+
};
|
|
474
|
+
}, [isSchemeOverride, themeCtx, resolvedConfig, scheme]);
|
|
390
475
|
const webOverrides = [];
|
|
391
476
|
if (styles.gridWebStyle) {
|
|
392
477
|
webOverrides.push(styles.gridWebStyle);
|
|
@@ -400,68 +485,65 @@ function Frame({
|
|
|
400
485
|
const focusRingStyle = isFocusVisible && !disabled ? {
|
|
401
486
|
outlineWidth: 2,
|
|
402
487
|
outlineStyle: "solid",
|
|
403
|
-
outlineColor: tokens.
|
|
488
|
+
outlineColor: tokens.colors[resolvedTheme].emphasis.background,
|
|
404
489
|
outlineOffset: 2
|
|
405
490
|
} : void 0;
|
|
406
491
|
const webFocusProps = isInteractive ? focusProps : {};
|
|
407
|
-
const textStyle =
|
|
492
|
+
const textStyle = React16.useMemo(
|
|
408
493
|
() => ({
|
|
409
|
-
color: tokens.
|
|
494
|
+
color: tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary,
|
|
410
495
|
fontSize: tokens.typography.fontSizes["05"],
|
|
411
496
|
fontFamily: tokens.typography.fonts.main.family,
|
|
412
497
|
lineHeight: tokens.typography.lineHeights["06"]
|
|
413
498
|
}),
|
|
414
|
-
[tokens]
|
|
499
|
+
[tokens, resolvedTheme, resolvedAppearance]
|
|
415
500
|
);
|
|
416
|
-
const wrappedChildren =
|
|
501
|
+
const wrappedChildren = React16.useMemo(
|
|
417
502
|
() => wrapTextChildren(children, textStyle),
|
|
418
503
|
[children, textStyle]
|
|
419
504
|
);
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
wrappedChildren
|
|
459
|
-
)
|
|
460
|
-
));
|
|
505
|
+
const content = isInteractive ? /* @__PURE__ */ React16__default.default.createElement(
|
|
506
|
+
reactNative.Pressable,
|
|
507
|
+
{
|
|
508
|
+
ref,
|
|
509
|
+
testID,
|
|
510
|
+
nativeID,
|
|
511
|
+
pointerEvents,
|
|
512
|
+
accessibilityLabel,
|
|
513
|
+
accessibilityHint,
|
|
514
|
+
accessibilityState: disabled ? { disabled: true } : void 0,
|
|
515
|
+
onPress,
|
|
516
|
+
disabled,
|
|
517
|
+
...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
|
|
518
|
+
...webFocusProps,
|
|
519
|
+
style: ({ pressed }) => [
|
|
520
|
+
styles.container,
|
|
521
|
+
pressed && !disabled && styles.pressed,
|
|
522
|
+
focusRingStyle,
|
|
523
|
+
...webOverrides,
|
|
524
|
+
...userStyles
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
wrappedChildren
|
|
528
|
+
) : /* @__PURE__ */ React16__default.default.createElement(
|
|
529
|
+
reactNative.View,
|
|
530
|
+
{
|
|
531
|
+
ref,
|
|
532
|
+
testID,
|
|
533
|
+
nativeID,
|
|
534
|
+
pointerEvents,
|
|
535
|
+
accessibilityLabel,
|
|
536
|
+
accessibilityHint,
|
|
537
|
+
style: [styles.container, ...webOverrides, ...userStyles]
|
|
538
|
+
},
|
|
539
|
+
wrappedChildren
|
|
540
|
+
);
|
|
541
|
+
const wrappedContent = schemeThemeCtx ? /* @__PURE__ */ React16__default.default.createElement(newtoneApi._ThemeContext.Provider, { value: schemeThemeCtx }, content) : content;
|
|
542
|
+
return /* @__PURE__ */ React16__default.default.createElement(newtoneApi.FrameContext.Provider, { value: contextValue }, wrappedContent);
|
|
461
543
|
}
|
|
462
544
|
function Icon({
|
|
463
|
-
name,
|
|
464
|
-
size,
|
|
545
|
+
name = "add",
|
|
546
|
+
size = 24,
|
|
465
547
|
opticalSize,
|
|
466
548
|
fill = 0,
|
|
467
549
|
color,
|
|
@@ -474,7 +556,10 @@ function Icon({
|
|
|
474
556
|
ref
|
|
475
557
|
}) {
|
|
476
558
|
const tokens = newtoneApi.useTokens();
|
|
477
|
-
const
|
|
559
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
560
|
+
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
561
|
+
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
562
|
+
const iconStyle = React16.useMemo(() => {
|
|
478
563
|
const fontSize = size ?? tokens.typography.fontSizes["05"];
|
|
479
564
|
const getOpticalSize = (size2) => {
|
|
480
565
|
if (size2 <= 22) return 20;
|
|
@@ -483,7 +568,7 @@ function Icon({
|
|
|
483
568
|
return 48;
|
|
484
569
|
};
|
|
485
570
|
const opsz = opticalSize ?? getOpticalSize(fontSize);
|
|
486
|
-
const iconColor = color ?? tokens.
|
|
571
|
+
const iconColor = color ?? tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary;
|
|
487
572
|
const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
|
|
488
573
|
const fillValue = typeof fill === "boolean" ? fill ? 1 : 0 : fill;
|
|
489
574
|
const fontVariationSettings = `'FILL' ${fillValue}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
|
|
@@ -503,8 +588,8 @@ function Icon({
|
|
|
503
588
|
// web-only: controls the variable font axes listed above
|
|
504
589
|
...style
|
|
505
590
|
};
|
|
506
|
-
}, [tokens, size, opticalSize, fill, color, style]);
|
|
507
|
-
return /* @__PURE__ */
|
|
591
|
+
}, [tokens, size, opticalSize, fill, color, style, resolvedTheme, resolvedAppearance]);
|
|
592
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
508
593
|
reactNative.Text,
|
|
509
594
|
{
|
|
510
595
|
ref,
|
|
@@ -532,7 +617,15 @@ function getWrapperStyles(input) {
|
|
|
532
617
|
minWidth,
|
|
533
618
|
maxWidth,
|
|
534
619
|
minHeight,
|
|
535
|
-
maxHeight
|
|
620
|
+
maxHeight,
|
|
621
|
+
position,
|
|
622
|
+
top,
|
|
623
|
+
right,
|
|
624
|
+
bottom,
|
|
625
|
+
left,
|
|
626
|
+
zIndex,
|
|
627
|
+
overflow,
|
|
628
|
+
opacity
|
|
536
629
|
} = input;
|
|
537
630
|
const container = {};
|
|
538
631
|
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
@@ -556,6 +649,14 @@ function getWrapperStyles(input) {
|
|
|
556
649
|
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
557
650
|
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
558
651
|
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
652
|
+
if (position) container.position = position;
|
|
653
|
+
if (top !== void 0) container.top = top;
|
|
654
|
+
if (right !== void 0) container.right = right;
|
|
655
|
+
if (bottom !== void 0) container.bottom = bottom;
|
|
656
|
+
if (left !== void 0) container.left = left;
|
|
657
|
+
if (zIndex !== void 0) container.zIndex = zIndex;
|
|
658
|
+
if (overflow) container.overflow = overflow;
|
|
659
|
+
if (opacity !== void 0) container.opacity = opacity;
|
|
559
660
|
return reactNative.StyleSheet.create({ c: container }).c;
|
|
560
661
|
}
|
|
561
662
|
function Wrapper({
|
|
@@ -573,14 +674,24 @@ function Wrapper({
|
|
|
573
674
|
maxWidth,
|
|
574
675
|
minHeight,
|
|
575
676
|
maxHeight,
|
|
677
|
+
// Positioning
|
|
678
|
+
position,
|
|
679
|
+
top,
|
|
680
|
+
right,
|
|
681
|
+
bottom,
|
|
682
|
+
left,
|
|
683
|
+
zIndex,
|
|
684
|
+
overflow,
|
|
685
|
+
pointerEvents,
|
|
686
|
+
opacity,
|
|
576
687
|
style,
|
|
577
688
|
// Testing & platform
|
|
578
689
|
testID,
|
|
579
690
|
nativeID,
|
|
580
691
|
ref
|
|
581
692
|
}) {
|
|
582
|
-
const tokens = newtoneApi.useTokens(
|
|
583
|
-
const containerStyle =
|
|
693
|
+
const tokens = newtoneApi.useTokens();
|
|
694
|
+
const containerStyle = React16.useMemo(
|
|
584
695
|
() => getWrapperStyles({
|
|
585
696
|
tokens,
|
|
586
697
|
direction,
|
|
@@ -595,7 +706,15 @@ function Wrapper({
|
|
|
595
706
|
minWidth,
|
|
596
707
|
maxWidth,
|
|
597
708
|
minHeight,
|
|
598
|
-
maxHeight
|
|
709
|
+
maxHeight,
|
|
710
|
+
position,
|
|
711
|
+
top,
|
|
712
|
+
right,
|
|
713
|
+
bottom,
|
|
714
|
+
left,
|
|
715
|
+
zIndex,
|
|
716
|
+
overflow,
|
|
717
|
+
opacity
|
|
599
718
|
}),
|
|
600
719
|
[
|
|
601
720
|
tokens,
|
|
@@ -611,42 +730,45 @@ function Wrapper({
|
|
|
611
730
|
minWidth,
|
|
612
731
|
maxWidth,
|
|
613
732
|
minHeight,
|
|
614
|
-
maxHeight
|
|
733
|
+
maxHeight,
|
|
734
|
+
position,
|
|
735
|
+
top,
|
|
736
|
+
right,
|
|
737
|
+
bottom,
|
|
738
|
+
left,
|
|
739
|
+
zIndex,
|
|
740
|
+
overflow,
|
|
741
|
+
opacity
|
|
615
742
|
]
|
|
616
743
|
);
|
|
617
744
|
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
618
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
619
746
|
reactNative.View,
|
|
620
747
|
{
|
|
621
748
|
ref,
|
|
622
749
|
testID,
|
|
623
750
|
nativeID,
|
|
751
|
+
pointerEvents,
|
|
624
752
|
accessibilityRole: "none",
|
|
625
753
|
style: [containerStyle, ...userStyles]
|
|
626
754
|
},
|
|
627
755
|
children
|
|
628
756
|
);
|
|
629
757
|
}
|
|
630
|
-
var TextScopeContext =
|
|
631
|
-
|
|
632
|
-
|
|
758
|
+
var TextScopeContext = React16.createContext(null);
|
|
759
|
+
var LARGE_TEXT_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
760
|
+
function resolveTextColor(color, tokens, theme = "primary", appearance = "main", role = "body") {
|
|
633
761
|
switch (color) {
|
|
634
762
|
case "primary":
|
|
635
|
-
return tokens.
|
|
763
|
+
return tokens.colors[theme][appearance].fontPrimary;
|
|
636
764
|
case "secondary":
|
|
637
|
-
return tokens.
|
|
765
|
+
return tokens.colors[theme][appearance].fontSecondary;
|
|
638
766
|
case "tertiary":
|
|
639
|
-
return tokens.
|
|
767
|
+
return tokens.colors[theme][appearance].fontTertiary;
|
|
640
768
|
case "disabled":
|
|
641
|
-
return tokens.
|
|
769
|
+
return tokens.colors[theme][appearance].fontDisabled;
|
|
642
770
|
case "accent":
|
|
643
|
-
return tokens.
|
|
644
|
-
case "success":
|
|
645
|
-
return tokens.success.fill[gamut];
|
|
646
|
-
case "warning":
|
|
647
|
-
return tokens.warning.fill[gamut];
|
|
648
|
-
case "error":
|
|
649
|
-
return tokens.error.fill[gamut];
|
|
771
|
+
return tokens.colors[theme][appearance][LARGE_TEXT_ROLES.has(role) ? "accentLarge" : "accentSmall"];
|
|
650
772
|
}
|
|
651
773
|
}
|
|
652
774
|
var ADAPTIVE_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
@@ -676,7 +798,7 @@ function TextBase({
|
|
|
676
798
|
weight: weightOverride,
|
|
677
799
|
align,
|
|
678
800
|
numberOfLines,
|
|
679
|
-
elevation
|
|
801
|
+
elevation,
|
|
680
802
|
style,
|
|
681
803
|
accessibilityRole: accessibilityRoleOverride,
|
|
682
804
|
testID,
|
|
@@ -688,6 +810,9 @@ function TextBase({
|
|
|
688
810
|
}) {
|
|
689
811
|
const tokens = newtoneApi.useTokens(elevation);
|
|
690
812
|
const { config, reportingEndpoint } = newtoneApi.useNewtoneTheme();
|
|
813
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
814
|
+
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
815
|
+
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
691
816
|
const size = sizeOverride ?? "md";
|
|
692
817
|
const fontSlot = tokens.typography.fonts[scope];
|
|
693
818
|
const resolvedFontWeight = weightOverride ? fonts.SEMANTIC_WEIGHT_MAP[weightOverride] : config.typography.roleWeights?.[role] ?? fonts.ROLE_DEFAULT_WEIGHTS[role];
|
|
@@ -704,9 +829,9 @@ function TextBase({
|
|
|
704
829
|
calibrations[fontSlot.family]
|
|
705
830
|
);
|
|
706
831
|
const isAdaptive = ADAPTIVE_ROLES.has(role);
|
|
707
|
-
const [containerWidth, setContainerWidth] =
|
|
708
|
-
const characterCount =
|
|
709
|
-
const resolvedStep =
|
|
832
|
+
const [containerWidth, setContainerWidth] = React16.useState(null);
|
|
833
|
+
const characterCount = React16.useMemo(() => extractCharacterCount(children), [children]);
|
|
834
|
+
const resolvedStep = React16.useMemo(
|
|
710
835
|
() => fonts.resolveResponsiveSize(
|
|
711
836
|
{
|
|
712
837
|
role,
|
|
@@ -723,7 +848,7 @@ function TextBase({
|
|
|
723
848
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
724
849
|
[role, size, responsive, isAdaptive, fontSlot.family, step.fontSize, config.typography.roles, containerWidth, characterCount, localRatio]
|
|
725
850
|
);
|
|
726
|
-
|
|
851
|
+
React16.useEffect(() => {
|
|
727
852
|
if (!reportingEndpoint || !responsive || !isAdaptive || containerWidth == null) return;
|
|
728
853
|
const lineWidths = fonts.estimateLineWidths(characterCount, containerWidth, resolvedStep.fontSize, localRatio);
|
|
729
854
|
const lastLine = lineWidths[lineWidths.length - 1];
|
|
@@ -739,7 +864,7 @@ function TextBase({
|
|
|
739
864
|
lastLineRatio: containerWidth > 0 ? lastLine / containerWidth : 1
|
|
740
865
|
});
|
|
741
866
|
}, [reportingEndpoint, resolvedStep.fontSize, containerWidth]);
|
|
742
|
-
const resolvedStyle =
|
|
867
|
+
const resolvedStyle = React16.useMemo(() => {
|
|
743
868
|
const activeStep = responsive && isAdaptive ? resolvedStep : step;
|
|
744
869
|
const currentMetrics = config.typography.fontMetrics?.[fontSlot.family];
|
|
745
870
|
const correctedLineHeight = currentMetrics ? Math.round(activeStep.lineHeight * currentMetrics.naturalLineHeightRatio / fonts.REFERENCE_LINE_HEIGHT_RATIO / 4) * 4 : activeStep.lineHeight;
|
|
@@ -750,18 +875,18 @@ function TextBase({
|
|
|
750
875
|
fontFamily: fontSlot.family,
|
|
751
876
|
fontSize: activeStep.fontSize,
|
|
752
877
|
fontWeight: String(resolvedFontWeight),
|
|
753
|
-
color: resolveTextColor(color, tokens),
|
|
878
|
+
color: resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance, role),
|
|
754
879
|
lineHeight: correctedLineHeight,
|
|
755
880
|
textAlign: align,
|
|
756
881
|
...vcOffset !== 0 ? { transform: [{ translateY: vcOffset }] } : {},
|
|
757
882
|
...featureSettings ? { fontFeatureSettings: featureSettings } : {}
|
|
758
883
|
};
|
|
759
|
-
}, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features]);
|
|
884
|
+
}, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features, resolvedTheme, resolvedAppearance]);
|
|
760
885
|
const inferredA11yRole = role === "headline" || role === "title" || role === "heading" ? "header" : void 0;
|
|
761
886
|
const effectiveA11yRole = accessibilityRoleOverride ?? inferredA11yRole;
|
|
762
887
|
const ariaLevel = effectiveA11yRole === "header" ? ROLE_HEADING_LEVEL[role] : void 0;
|
|
763
|
-
const scopeCtx =
|
|
764
|
-
const textNode = /* @__PURE__ */
|
|
888
|
+
const scopeCtx = React16.useMemo(() => ({ weights: fonts.SEMANTIC_WEIGHT_MAP }), []);
|
|
889
|
+
const textNode = /* @__PURE__ */ React16__default.default.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React16__default.default.createElement(
|
|
765
890
|
reactNative.Text,
|
|
766
891
|
{
|
|
767
892
|
ref,
|
|
@@ -775,7 +900,7 @@ function TextBase({
|
|
|
775
900
|
children
|
|
776
901
|
));
|
|
777
902
|
if (responsive && isAdaptive) {
|
|
778
|
-
return /* @__PURE__ */
|
|
903
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
779
904
|
reactNative.View,
|
|
780
905
|
{
|
|
781
906
|
onLayout: (e) => {
|
|
@@ -790,37 +915,40 @@ function TextBase({
|
|
|
790
915
|
return textNode;
|
|
791
916
|
}
|
|
792
917
|
function TextSpan({ children, color, weight, italic, underline, highlight, style }) {
|
|
793
|
-
const tokens = newtoneApi.useTokens(
|
|
794
|
-
const scopeCtx =
|
|
795
|
-
const
|
|
918
|
+
const tokens = newtoneApi.useTokens();
|
|
919
|
+
const scopeCtx = React16.useContext(TextScopeContext);
|
|
920
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
921
|
+
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
922
|
+
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
923
|
+
const spanStyle = React16.useMemo(() => {
|
|
796
924
|
const s = {};
|
|
797
|
-
if (color) s.color = resolveTextColor(color, tokens);
|
|
925
|
+
if (color) s.color = resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance);
|
|
798
926
|
if (weight && scopeCtx) s.fontWeight = String(scopeCtx.weights[weight]);
|
|
799
927
|
if (italic) s.fontStyle = "italic";
|
|
800
928
|
if (underline) s.textDecorationLine = "underline";
|
|
801
|
-
if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens);
|
|
929
|
+
if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens, resolvedTheme, resolvedAppearance);
|
|
802
930
|
return s;
|
|
803
|
-
}, [tokens, scopeCtx, color, weight, italic, underline, highlight]);
|
|
804
|
-
return
|
|
931
|
+
}, [tokens, scopeCtx, color, weight, italic, underline, highlight, resolvedTheme, resolvedAppearance]);
|
|
932
|
+
return React16__default.default.createElement(
|
|
805
933
|
reactNative.Text,
|
|
806
934
|
{ style: style ? [spanStyle, ...Array.isArray(style) ? style : [style]] : spanStyle },
|
|
807
935
|
children
|
|
808
936
|
);
|
|
809
937
|
}
|
|
810
938
|
function TextBold(props) {
|
|
811
|
-
return
|
|
939
|
+
return React16__default.default.createElement(TextSpan, { ...props, weight: "bold" });
|
|
812
940
|
}
|
|
813
941
|
function TextMedium(props) {
|
|
814
|
-
return
|
|
942
|
+
return React16__default.default.createElement(TextSpan, { ...props, weight: "medium" });
|
|
815
943
|
}
|
|
816
944
|
function TextItalic(props) {
|
|
817
|
-
return
|
|
945
|
+
return React16__default.default.createElement(TextSpan, { ...props, italic: true });
|
|
818
946
|
}
|
|
819
947
|
function TextUnderline(props) {
|
|
820
|
-
return
|
|
948
|
+
return React16__default.default.createElement(TextSpan, { ...props, underline: true });
|
|
821
949
|
}
|
|
822
950
|
function TextHighlight(props) {
|
|
823
|
-
return
|
|
951
|
+
return React16__default.default.createElement(TextSpan, props);
|
|
824
952
|
}
|
|
825
953
|
|
|
826
954
|
// src/primitives/Text/index.ts
|
|
@@ -882,19 +1010,9 @@ function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
|
|
|
882
1010
|
paddingBottom: base
|
|
883
1011
|
};
|
|
884
1012
|
}
|
|
885
|
-
function
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
return tokens.accent;
|
|
889
|
-
case "success":
|
|
890
|
-
return tokens.success;
|
|
891
|
-
case "error":
|
|
892
|
-
return tokens.error;
|
|
893
|
-
case "warning":
|
|
894
|
-
return tokens.warning;
|
|
895
|
-
default:
|
|
896
|
-
return void 0;
|
|
897
|
-
}
|
|
1013
|
+
function semanticToTheme(semantic) {
|
|
1014
|
+
if (semantic === "accent") return "primary";
|
|
1015
|
+
return semantic;
|
|
898
1016
|
}
|
|
899
1017
|
function getButtonConfig(variant, semantic, size, disabled, tokens) {
|
|
900
1018
|
const sizeConfig = getSizeConfig(size, tokens);
|
|
@@ -942,40 +1060,38 @@ function getSizeConfig(size, tokens) {
|
|
|
942
1060
|
function getVariantColors(variant, semantic, disabled, tokens) {
|
|
943
1061
|
if (disabled) {
|
|
944
1062
|
const baseColors = getVariantColorsForState(variant, semantic, tokens);
|
|
945
|
-
const
|
|
946
|
-
const disabledBg = tokens.backgroundSunken[gamut];
|
|
1063
|
+
const disabledBg = tokens.colors.primary.main.fontSecondary;
|
|
947
1064
|
return {
|
|
948
1065
|
...baseColors,
|
|
949
1066
|
bg: disabledBg,
|
|
950
1067
|
hoveredBg: disabledBg,
|
|
951
1068
|
pressedBg: disabledBg,
|
|
952
|
-
textColor: tokens.
|
|
953
|
-
iconColor: tokens.
|
|
1069
|
+
textColor: tokens.colors.primary.main.fontTertiary,
|
|
1070
|
+
iconColor: tokens.colors.primary.main.fontTertiary
|
|
954
1071
|
};
|
|
955
1072
|
}
|
|
956
1073
|
return getVariantColorsForState(variant, semantic, tokens);
|
|
957
1074
|
}
|
|
958
1075
|
function getVariantColorsForState(variant, semantic, tokens) {
|
|
959
|
-
const { gamut } = tokens;
|
|
960
|
-
const paletteTokens = getPaletteTokens(semantic, tokens);
|
|
961
1076
|
if (variant === "primary") {
|
|
962
1077
|
if (semantic === "neutral") {
|
|
963
1078
|
return {
|
|
964
|
-
bg: tokens.
|
|
965
|
-
hoveredBg: tokens.
|
|
966
|
-
pressedBg: tokens.
|
|
967
|
-
textColor: tokens.
|
|
968
|
-
iconColor: tokens.
|
|
1079
|
+
bg: tokens.colors.primary.main.fontPrimary,
|
|
1080
|
+
hoveredBg: tokens.colors.primary.main.fontSecondary,
|
|
1081
|
+
pressedBg: tokens.colors.primary.main.fontPrimary,
|
|
1082
|
+
textColor: tokens.colors.primary.main.divider,
|
|
1083
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
969
1084
|
borderWidth: 1,
|
|
970
1085
|
borderColor: "transparent"
|
|
971
1086
|
};
|
|
972
1087
|
}
|
|
1088
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
973
1089
|
return {
|
|
974
|
-
bg:
|
|
975
|
-
hoveredBg:
|
|
976
|
-
pressedBg:
|
|
977
|
-
textColor:
|
|
978
|
-
iconColor:
|
|
1090
|
+
bg: t.emphasis.background,
|
|
1091
|
+
hoveredBg: t.emphasis.fontPrimary,
|
|
1092
|
+
pressedBg: t.emphasis.fontSecondary,
|
|
1093
|
+
textColor: t.main.background,
|
|
1094
|
+
iconColor: t.main.background,
|
|
979
1095
|
borderWidth: 1,
|
|
980
1096
|
borderColor: "transparent"
|
|
981
1097
|
};
|
|
@@ -984,20 +1100,21 @@ function getVariantColorsForState(variant, semantic, tokens) {
|
|
|
984
1100
|
if (semantic === "neutral") {
|
|
985
1101
|
return {
|
|
986
1102
|
bg: "transparent",
|
|
987
|
-
hoveredBg: tokens.
|
|
988
|
-
pressedBg: tokens.
|
|
989
|
-
textColor: tokens.
|
|
990
|
-
iconColor: tokens.
|
|
1103
|
+
hoveredBg: tokens.colors.primary.main.fontPrimary,
|
|
1104
|
+
pressedBg: tokens.colors.primary.main.fontSecondary,
|
|
1105
|
+
textColor: tokens.colors.primary.main.divider,
|
|
1106
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
991
1107
|
borderWidth: 1,
|
|
992
|
-
borderColor: tokens.
|
|
1108
|
+
borderColor: tokens.colors.primary.main.fontSecondary
|
|
993
1109
|
};
|
|
994
1110
|
}
|
|
1111
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
995
1112
|
return {
|
|
996
|
-
bg:
|
|
997
|
-
hoveredBg:
|
|
998
|
-
pressedBg:
|
|
999
|
-
textColor:
|
|
1000
|
-
iconColor:
|
|
1113
|
+
bg: t.tinted.background,
|
|
1114
|
+
hoveredBg: t.tinted.fontPrimary,
|
|
1115
|
+
pressedBg: t.tinted.fontSecondary,
|
|
1116
|
+
textColor: t.emphasis.divider,
|
|
1117
|
+
iconColor: t.emphasis.divider,
|
|
1001
1118
|
borderWidth: 1,
|
|
1002
1119
|
borderColor: "transparent"
|
|
1003
1120
|
};
|
|
@@ -1006,30 +1123,54 @@ function getVariantColorsForState(variant, semantic, tokens) {
|
|
|
1006
1123
|
if (semantic === "neutral") {
|
|
1007
1124
|
return {
|
|
1008
1125
|
bg: "transparent",
|
|
1009
|
-
hoveredBg: tokens.
|
|
1010
|
-
pressedBg: tokens.
|
|
1011
|
-
textColor: tokens.
|
|
1012
|
-
iconColor: tokens.
|
|
1126
|
+
hoveredBg: tokens.colors.primary.main.fontPrimary,
|
|
1127
|
+
pressedBg: tokens.colors.primary.main.fontSecondary,
|
|
1128
|
+
textColor: tokens.colors.primary.main.divider,
|
|
1129
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
1013
1130
|
borderWidth: 1,
|
|
1014
1131
|
borderColor: "transparent"
|
|
1015
1132
|
};
|
|
1016
1133
|
}
|
|
1134
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
1017
1135
|
return {
|
|
1018
1136
|
bg: "transparent",
|
|
1019
|
-
hoveredBg:
|
|
1020
|
-
pressedBg:
|
|
1021
|
-
textColor:
|
|
1022
|
-
iconColor:
|
|
1137
|
+
hoveredBg: t.tinted.background,
|
|
1138
|
+
pressedBg: t.tinted.fontPrimary,
|
|
1139
|
+
textColor: t.emphasis.divider,
|
|
1140
|
+
iconColor: t.emphasis.divider,
|
|
1023
1141
|
borderWidth: 1,
|
|
1024
1142
|
borderColor: "transparent"
|
|
1025
1143
|
};
|
|
1026
1144
|
}
|
|
1145
|
+
if (variant === "link") {
|
|
1146
|
+
if (semantic === "neutral") {
|
|
1147
|
+
return {
|
|
1148
|
+
bg: "transparent",
|
|
1149
|
+
hoveredBg: "transparent",
|
|
1150
|
+
pressedBg: "transparent",
|
|
1151
|
+
textColor: tokens.colors.primary.main.fontSecondary,
|
|
1152
|
+
iconColor: tokens.colors.primary.main.fontSecondary,
|
|
1153
|
+
borderWidth: 0,
|
|
1154
|
+
borderColor: "transparent"
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
1158
|
+
return {
|
|
1159
|
+
bg: "transparent",
|
|
1160
|
+
hoveredBg: "transparent",
|
|
1161
|
+
pressedBg: "transparent",
|
|
1162
|
+
textColor: t.emphasis.divider,
|
|
1163
|
+
iconColor: t.emphasis.divider,
|
|
1164
|
+
borderWidth: 0,
|
|
1165
|
+
borderColor: "transparent"
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1027
1168
|
return {
|
|
1028
1169
|
bg: "transparent",
|
|
1029
1170
|
hoveredBg: "transparent",
|
|
1030
1171
|
pressedBg: "transparent",
|
|
1031
|
-
textColor: tokens.
|
|
1032
|
-
iconColor: tokens.
|
|
1172
|
+
textColor: tokens.colors.primary.main.divider,
|
|
1173
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
1033
1174
|
borderWidth: 0
|
|
1034
1175
|
};
|
|
1035
1176
|
}
|
|
@@ -1041,22 +1182,25 @@ function Button({
|
|
|
1041
1182
|
semantic = "neutral",
|
|
1042
1183
|
size = "md",
|
|
1043
1184
|
disabled = false,
|
|
1185
|
+
loading = false,
|
|
1186
|
+
fullWidth = false,
|
|
1044
1187
|
style,
|
|
1045
1188
|
textStyle,
|
|
1046
1189
|
...pressableProps
|
|
1047
1190
|
}) {
|
|
1048
1191
|
const tokens = newtoneApi.useTokens();
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
|
|
1192
|
+
const isDisabled = disabled || loading;
|
|
1193
|
+
const { variantColors, sizeTokens } = React16__default.default.useMemo(
|
|
1194
|
+
() => getButtonConfig(variant, semantic, size, isDisabled, tokens),
|
|
1195
|
+
[variant, semantic, size, isDisabled, tokens]
|
|
1052
1196
|
);
|
|
1053
|
-
const padding =
|
|
1054
|
-
() => computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
1055
|
-
[size, icon, children, iconPosition]
|
|
1197
|
+
const padding = React16__default.default.useMemo(
|
|
1198
|
+
() => variant === "link" ? { paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0 } : computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
1199
|
+
[size, icon, children, iconPosition, variant]
|
|
1056
1200
|
);
|
|
1057
|
-
return /* @__PURE__ */
|
|
1201
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.Pressable, { disabled: isDisabled, ...pressableProps }, ({ pressed, hovered }) => (
|
|
1058
1202
|
// Wrapper handles layout: direction, gap, alignment (padding via style)
|
|
1059
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ React16__default.default.createElement(
|
|
1060
1204
|
Wrapper,
|
|
1061
1205
|
{
|
|
1062
1206
|
direction: "horizontal",
|
|
@@ -1067,41 +1211,45 @@ function Button({
|
|
|
1067
1211
|
{
|
|
1068
1212
|
...padding,
|
|
1069
1213
|
// Asymmetric horizontal padding for text optical balance
|
|
1070
|
-
backgroundColor: pressed && !
|
|
1071
|
-
borderRadius: sizeTokens.borderRadius,
|
|
1214
|
+
backgroundColor: pressed && !isDisabled ? variantColors.pressedBg : hovered && !isDisabled ? variantColors.hoveredBg : variantColors.bg,
|
|
1215
|
+
borderRadius: variant === "link" ? 0 : sizeTokens.borderRadius,
|
|
1072
1216
|
borderWidth: variantColors.borderWidth,
|
|
1073
|
-
// Always 1 for consistent sizing
|
|
1074
1217
|
borderColor: variantColors.borderColor || "transparent",
|
|
1075
|
-
opacity:
|
|
1218
|
+
opacity: isDisabled ? loading ? 0.6 : 0.4 : variant === "link" && pressed ? 0.7 : 1,
|
|
1219
|
+
...fullWidth && { width: "100%", alignSelf: "stretch" }
|
|
1076
1220
|
},
|
|
1077
1221
|
...Array.isArray(style) ? style : style ? [style] : []
|
|
1078
1222
|
]
|
|
1079
1223
|
},
|
|
1080
|
-
icon && iconPosition === "left" && /* @__PURE__ */
|
|
1224
|
+
icon && iconPosition === "left" && /* @__PURE__ */ React16__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
|
|
1081
1225
|
children && // Text primitive with semantic props + color style override
|
|
1082
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ React16__default.default.createElement(
|
|
1083
1227
|
Text3,
|
|
1084
1228
|
{
|
|
1085
1229
|
role: "label",
|
|
1086
1230
|
size: sizeTokens.textSize,
|
|
1087
1231
|
centerVertically: true,
|
|
1088
1232
|
style: [
|
|
1089
|
-
{
|
|
1233
|
+
{
|
|
1234
|
+
color: variantColors.textColor,
|
|
1235
|
+
...variant === "link" && hovered && { textDecorationLine: "underline" }
|
|
1236
|
+
},
|
|
1090
1237
|
...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
|
|
1091
1238
|
]
|
|
1092
1239
|
},
|
|
1093
1240
|
children
|
|
1094
1241
|
),
|
|
1095
|
-
icon && iconPosition === "right" && /* @__PURE__ */
|
|
1242
|
+
icon && iconPosition === "right" && /* @__PURE__ */ React16__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
|
|
1096
1243
|
)
|
|
1097
1244
|
));
|
|
1098
1245
|
}
|
|
1099
|
-
function getCardStyles(tokens,
|
|
1246
|
+
function getCardStyles(tokens, disabled, theme = "primary", appearance = "main") {
|
|
1247
|
+
const at = tokens.colors[theme][appearance];
|
|
1100
1248
|
return reactNative.StyleSheet.create({
|
|
1101
1249
|
container: {
|
|
1102
|
-
backgroundColor:
|
|
1250
|
+
backgroundColor: at.background,
|
|
1103
1251
|
borderWidth: 1,
|
|
1104
|
-
borderColor:
|
|
1252
|
+
borderColor: at.fontSecondary,
|
|
1105
1253
|
borderRadius: tokens.radius.lg,
|
|
1106
1254
|
padding: tokens.spacing["16"],
|
|
1107
1255
|
opacity: disabled ? 0.5 : 1
|
|
@@ -1117,13 +1265,286 @@ function Card({
|
|
|
1117
1265
|
disabled = false
|
|
1118
1266
|
}) {
|
|
1119
1267
|
const tokens = newtoneApi.useTokens(elevation);
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1268
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
1269
|
+
const styles = React16__default.default.useMemo(
|
|
1270
|
+
() => getCardStyles(tokens, disabled, frameCtx?.theme, frameCtx?.appearance),
|
|
1271
|
+
[tokens, disabled, frameCtx?.theme, frameCtx?.appearance]
|
|
1123
1272
|
);
|
|
1124
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// src/composites/display/Chip/Chip.styles.ts
|
|
1277
|
+
function semanticToTheme2(semantic) {
|
|
1278
|
+
if (semantic === "accent") return "primary";
|
|
1279
|
+
return semantic;
|
|
1280
|
+
}
|
|
1281
|
+
function getSizeConfig2(size) {
|
|
1282
|
+
if (size === "sm") {
|
|
1283
|
+
return { paddingX: 10, paddingY: 3, gap: 4, textRole: "caption", iconSize: 16 };
|
|
1284
|
+
}
|
|
1285
|
+
return { paddingX: 16, paddingY: 8, gap: 6, textRole: "label", iconSize: 20 };
|
|
1125
1286
|
}
|
|
1126
|
-
function
|
|
1287
|
+
function getVariantColors2(variant, semantic, selected, disabled, tokens) {
|
|
1288
|
+
if (selected) {
|
|
1289
|
+
if (semantic === "neutral") {
|
|
1290
|
+
return {
|
|
1291
|
+
bg: tokens.colors.primary.strong.background,
|
|
1292
|
+
hoveredBg: tokens.colors.primary.strong.fontPrimary,
|
|
1293
|
+
pressedBg: tokens.colors.primary.strong.background,
|
|
1294
|
+
textColor: tokens.colors.primary.strong.fontPrimary,
|
|
1295
|
+
iconColor: tokens.colors.primary.strong.fontPrimary,
|
|
1296
|
+
borderWidth: 1,
|
|
1297
|
+
borderColor: "transparent"
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
const t2 = tokens.colors[semanticToTheme2(semantic)];
|
|
1301
|
+
return {
|
|
1302
|
+
bg: t2.emphasis.background,
|
|
1303
|
+
hoveredBg: t2.emphasis.fontPrimary,
|
|
1304
|
+
pressedBg: t2.emphasis.background,
|
|
1305
|
+
textColor: t2.main.background,
|
|
1306
|
+
iconColor: t2.main.background,
|
|
1307
|
+
borderWidth: 1,
|
|
1308
|
+
borderColor: "transparent"
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
if (disabled) {
|
|
1312
|
+
return {
|
|
1313
|
+
bg: "transparent",
|
|
1314
|
+
hoveredBg: "transparent",
|
|
1315
|
+
pressedBg: "transparent",
|
|
1316
|
+
textColor: tokens.colors.primary.main.fontTertiary,
|
|
1317
|
+
iconColor: tokens.colors.primary.main.fontTertiary,
|
|
1318
|
+
borderWidth: 1,
|
|
1319
|
+
borderColor: tokens.colors.primary.main.divider
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
if (variant === "filled") {
|
|
1323
|
+
if (semantic === "neutral") {
|
|
1324
|
+
return {
|
|
1325
|
+
bg: tokens.colors.primary.main.fontPrimary,
|
|
1326
|
+
hoveredBg: tokens.colors.primary.main.fontSecondary,
|
|
1327
|
+
pressedBg: tokens.colors.primary.main.fontPrimary,
|
|
1328
|
+
textColor: tokens.colors.primary.main.divider,
|
|
1329
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
1330
|
+
borderWidth: 1,
|
|
1331
|
+
borderColor: "transparent"
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
const t2 = tokens.colors[semanticToTheme2(semantic)];
|
|
1335
|
+
return {
|
|
1336
|
+
bg: t2.emphasis.background,
|
|
1337
|
+
hoveredBg: t2.emphasis.fontPrimary,
|
|
1338
|
+
pressedBg: t2.emphasis.fontSecondary,
|
|
1339
|
+
textColor: t2.main.background,
|
|
1340
|
+
iconColor: t2.main.background,
|
|
1341
|
+
borderWidth: 1,
|
|
1342
|
+
borderColor: "transparent"
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
if (variant === "tinted") {
|
|
1346
|
+
if (semantic === "neutral") {
|
|
1347
|
+
return {
|
|
1348
|
+
bg: tokens.colors.primary.tinted.background,
|
|
1349
|
+
hoveredBg: tokens.colors.primary.tinted.fontPrimary,
|
|
1350
|
+
pressedBg: tokens.colors.primary.tinted.fontSecondary,
|
|
1351
|
+
textColor: tokens.colors.primary.main.fontPrimary,
|
|
1352
|
+
iconColor: tokens.colors.primary.main.fontPrimary,
|
|
1353
|
+
borderWidth: 1,
|
|
1354
|
+
borderColor: "transparent"
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
const t2 = tokens.colors[semanticToTheme2(semantic)];
|
|
1358
|
+
return {
|
|
1359
|
+
bg: t2.tinted.background,
|
|
1360
|
+
hoveredBg: t2.tinted.fontPrimary,
|
|
1361
|
+
pressedBg: t2.tinted.fontSecondary,
|
|
1362
|
+
textColor: t2.emphasis.divider,
|
|
1363
|
+
iconColor: t2.emphasis.divider,
|
|
1364
|
+
borderWidth: 1,
|
|
1365
|
+
borderColor: "transparent"
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
if (semantic === "neutral") {
|
|
1369
|
+
return {
|
|
1370
|
+
bg: "transparent",
|
|
1371
|
+
hoveredBg: tokens.colors.primary.tinted.background,
|
|
1372
|
+
pressedBg: tokens.colors.primary.tinted.fontPrimary,
|
|
1373
|
+
textColor: tokens.colors.primary.main.fontPrimary,
|
|
1374
|
+
iconColor: tokens.colors.primary.main.fontPrimary,
|
|
1375
|
+
borderWidth: 1,
|
|
1376
|
+
borderColor: tokens.colors.primary.main.divider
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
const t = tokens.colors[semanticToTheme2(semantic)];
|
|
1380
|
+
return {
|
|
1381
|
+
bg: "transparent",
|
|
1382
|
+
hoveredBg: t.tinted.background,
|
|
1383
|
+
pressedBg: t.tinted.fontPrimary,
|
|
1384
|
+
textColor: t.emphasis.divider,
|
|
1385
|
+
iconColor: t.emphasis.divider,
|
|
1386
|
+
borderWidth: 1,
|
|
1387
|
+
borderColor: t.tinted.fontSecondary
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
function getChipConfig(variant, semantic, size, selected, disabled, tokens) {
|
|
1391
|
+
return {
|
|
1392
|
+
colors: getVariantColors2(variant, semantic, selected, disabled, tokens),
|
|
1393
|
+
sizeTokens: getSizeConfig2(size)
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
function Chip({
|
|
1397
|
+
children,
|
|
1398
|
+
variant = "tinted",
|
|
1399
|
+
size = "md",
|
|
1400
|
+
semantic = "neutral",
|
|
1401
|
+
selected = false,
|
|
1402
|
+
onPress,
|
|
1403
|
+
disabled = false,
|
|
1404
|
+
icon,
|
|
1405
|
+
style
|
|
1406
|
+
}) {
|
|
1407
|
+
const tokens = newtoneApi.useTokens();
|
|
1408
|
+
const { colors, sizeTokens } = React16__default.default.useMemo(
|
|
1409
|
+
() => getChipConfig(variant, semantic, size, selected, disabled, tokens),
|
|
1410
|
+
[variant, semantic, size, selected, disabled, tokens]
|
|
1411
|
+
);
|
|
1412
|
+
const content = (state) => /* @__PURE__ */ React16__default.default.createElement(
|
|
1413
|
+
Wrapper,
|
|
1414
|
+
{
|
|
1415
|
+
direction: "horizontal",
|
|
1416
|
+
align: "center",
|
|
1417
|
+
gap: sizeTokens.gap,
|
|
1418
|
+
style: [
|
|
1419
|
+
{
|
|
1420
|
+
paddingLeft: sizeTokens.paddingX,
|
|
1421
|
+
paddingRight: sizeTokens.paddingX,
|
|
1422
|
+
paddingTop: sizeTokens.paddingY,
|
|
1423
|
+
paddingBottom: sizeTokens.paddingY,
|
|
1424
|
+
backgroundColor: state?.pressed && !disabled ? colors.pressedBg : state?.hovered && !disabled ? colors.hoveredBg : colors.bg,
|
|
1425
|
+
borderRadius: 99,
|
|
1426
|
+
borderWidth: colors.borderWidth,
|
|
1427
|
+
borderColor: colors.borderColor || "transparent",
|
|
1428
|
+
opacity: disabled ? 0.4 : 1
|
|
1429
|
+
},
|
|
1430
|
+
...Array.isArray(style) ? style : style ? [style] : []
|
|
1431
|
+
]
|
|
1432
|
+
},
|
|
1433
|
+
icon && /* @__PURE__ */ React16__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: colors.iconColor }),
|
|
1434
|
+
/* @__PURE__ */ React16__default.default.createElement(
|
|
1435
|
+
Text3,
|
|
1436
|
+
{
|
|
1437
|
+
role: sizeTokens.textRole,
|
|
1438
|
+
weight: selected ? "bold" : "medium",
|
|
1439
|
+
style: { color: colors.textColor }
|
|
1440
|
+
},
|
|
1441
|
+
children
|
|
1442
|
+
)
|
|
1443
|
+
);
|
|
1444
|
+
if (onPress) {
|
|
1445
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.Pressable, { onPress, disabled }, ({ pressed, hovered }) => content({ pressed, hovered }));
|
|
1446
|
+
}
|
|
1447
|
+
return content();
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
// src/composites/layout/Divider/Divider.styles.ts
|
|
1451
|
+
function getDividerStyles(orientation, spacing, tokens) {
|
|
1452
|
+
const color = tokens.colors.primary.main.divider;
|
|
1453
|
+
if (orientation === "vertical") {
|
|
1454
|
+
return {
|
|
1455
|
+
width: 1,
|
|
1456
|
+
height: "100%",
|
|
1457
|
+
backgroundColor: color,
|
|
1458
|
+
...spacing != null && { marginLeft: spacing, marginRight: spacing }
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
return {
|
|
1462
|
+
height: 1,
|
|
1463
|
+
width: "100%",
|
|
1464
|
+
backgroundColor: color,
|
|
1465
|
+
...spacing != null && { marginTop: spacing, marginBottom: spacing }
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
function Divider({
|
|
1469
|
+
orientation = "horizontal",
|
|
1470
|
+
spacing,
|
|
1471
|
+
style
|
|
1472
|
+
}) {
|
|
1473
|
+
const tokens = newtoneApi.useTokens();
|
|
1474
|
+
const dividerStyle = React16__default.default.useMemo(
|
|
1475
|
+
() => getDividerStyles(orientation, spacing, tokens),
|
|
1476
|
+
[orientation, spacing, tokens]
|
|
1477
|
+
);
|
|
1478
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
1479
|
+
reactNative.View,
|
|
1480
|
+
{
|
|
1481
|
+
style: [dividerStyle, ...Array.isArray(style) ? style : style ? [style] : []],
|
|
1482
|
+
accessibilityRole: "none"
|
|
1483
|
+
}
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
// src/composites/layout/ContentCard/ContentCard.styles.ts
|
|
1488
|
+
function getContentCardStyles(variant, isInteractive, tokens) {
|
|
1489
|
+
const dividerColor = tokens.colors.primary.main.divider;
|
|
1490
|
+
const interactiveStyles = isInteractive ? { cursor: "pointer", textDecorationLine: "none" } : {};
|
|
1491
|
+
if (variant === "elevated") {
|
|
1492
|
+
return {
|
|
1493
|
+
borderRadius: 12,
|
|
1494
|
+
...interactiveStyles
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
if (variant === "bordered") {
|
|
1498
|
+
return {
|
|
1499
|
+
borderWidth: 1,
|
|
1500
|
+
borderColor: dividerColor,
|
|
1501
|
+
borderStyle: "solid",
|
|
1502
|
+
borderRadius: 12,
|
|
1503
|
+
...interactiveStyles
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
return {
|
|
1507
|
+
borderBottomWidth: 1,
|
|
1508
|
+
borderBottomColor: dividerColor,
|
|
1509
|
+
...interactiveStyles
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
function ContentCard({
|
|
1513
|
+
children,
|
|
1514
|
+
variant = "bordered",
|
|
1515
|
+
href,
|
|
1516
|
+
onPress,
|
|
1517
|
+
padding = 20,
|
|
1518
|
+
gap = 8,
|
|
1519
|
+
disabled = false,
|
|
1520
|
+
style
|
|
1521
|
+
}) {
|
|
1522
|
+
const tokens = newtoneApi.useTokens();
|
|
1523
|
+
const isInteractive = !!(href || onPress);
|
|
1524
|
+
const variantStyles = React16__default.default.useMemo(
|
|
1525
|
+
() => getContentCardStyles(variant, isInteractive, tokens),
|
|
1526
|
+
[variant, isInteractive, tokens]
|
|
1527
|
+
);
|
|
1528
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
1529
|
+
Frame,
|
|
1530
|
+
{
|
|
1531
|
+
elevation: variant === "elevated" ? 2 : void 0,
|
|
1532
|
+
appearance: variant === "elevated" ? "tinted" : void 0,
|
|
1533
|
+
href,
|
|
1534
|
+
onPress,
|
|
1535
|
+
disabled,
|
|
1536
|
+
padding,
|
|
1537
|
+
gap,
|
|
1538
|
+
style: [
|
|
1539
|
+
variantStyles,
|
|
1540
|
+
...Array.isArray(style) ? style : style ? [style] : []
|
|
1541
|
+
]
|
|
1542
|
+
},
|
|
1543
|
+
children
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
function getTextInputStyles(tokens, disabled, theme = "primary", appearance = "main") {
|
|
1547
|
+
const at = tokens.colors[theme][appearance];
|
|
1127
1548
|
return reactNative.StyleSheet.create({
|
|
1128
1549
|
container: {
|
|
1129
1550
|
gap: tokens.spacing["04"]
|
|
@@ -1132,18 +1553,18 @@ function getTextInputStyles(tokens, gamut, disabled) {
|
|
|
1132
1553
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1133
1554
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1134
1555
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1135
|
-
color:
|
|
1556
|
+
color: at.fontTertiary
|
|
1136
1557
|
},
|
|
1137
1558
|
input: {
|
|
1138
1559
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1139
|
-
backgroundColor:
|
|
1560
|
+
backgroundColor: at.fontSecondary,
|
|
1140
1561
|
borderWidth: 1,
|
|
1141
|
-
borderColor:
|
|
1562
|
+
borderColor: at.fontSecondary,
|
|
1142
1563
|
borderRadius: tokens.radius.md,
|
|
1143
1564
|
paddingVertical: tokens.spacing["08"],
|
|
1144
1565
|
paddingHorizontal: tokens.spacing["12"],
|
|
1145
1566
|
fontSize: tokens.typography.fontSizes["05"],
|
|
1146
|
-
color: disabled ?
|
|
1567
|
+
color: disabled ? at.fontTertiary : at.divider,
|
|
1147
1568
|
opacity: disabled ? 0.5 : 1
|
|
1148
1569
|
}
|
|
1149
1570
|
});
|
|
@@ -1157,21 +1578,25 @@ function TextInput({
|
|
|
1157
1578
|
...textInputProps
|
|
1158
1579
|
}) {
|
|
1159
1580
|
const tokens = newtoneApi.useTokens(1);
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
|
|
1581
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
1582
|
+
const theme = frameCtx?.theme ?? "primary";
|
|
1583
|
+
const appearance = frameCtx?.appearance ?? "main";
|
|
1584
|
+
const styles = React16__default.default.useMemo(
|
|
1585
|
+
() => getTextInputStyles(tokens, disabled, theme, appearance),
|
|
1586
|
+
[tokens, disabled, theme, appearance]
|
|
1163
1587
|
);
|
|
1164
|
-
return /* @__PURE__ */
|
|
1588
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React16__default.default.createElement(
|
|
1165
1589
|
reactNative.TextInput,
|
|
1166
1590
|
{
|
|
1167
1591
|
style: styles.input,
|
|
1168
1592
|
editable: !disabled,
|
|
1169
|
-
placeholderTextColor: tokens.
|
|
1593
|
+
placeholderTextColor: tokens.colors[theme][appearance].fontTertiary,
|
|
1170
1594
|
...textInputProps
|
|
1171
1595
|
}
|
|
1172
1596
|
));
|
|
1173
1597
|
}
|
|
1174
|
-
function getPopoverStyles(tokens,
|
|
1598
|
+
function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, theme = "primary", appearance = "main") {
|
|
1599
|
+
const at = tokens.colors[theme][appearance];
|
|
1175
1600
|
const widthStyle = width === "trigger" ? { left: 0, right: 0 } : typeof width === "number" ? { width, left: 0 } : { left: 0 };
|
|
1176
1601
|
return reactNative.StyleSheet.create({
|
|
1177
1602
|
container: {
|
|
@@ -1182,9 +1607,9 @@ function getPopoverStyles(tokens, gamut, triggerHeight, offset, maxHeight, width
|
|
|
1182
1607
|
position: "absolute",
|
|
1183
1608
|
top: triggerHeight + offset,
|
|
1184
1609
|
...widthStyle,
|
|
1185
|
-
backgroundColor:
|
|
1610
|
+
backgroundColor: at.fontPrimary,
|
|
1186
1611
|
borderWidth: 1,
|
|
1187
|
-
borderColor:
|
|
1612
|
+
borderColor: at.fontSecondary,
|
|
1188
1613
|
borderRadius: tokens.radius.md,
|
|
1189
1614
|
maxHeight,
|
|
1190
1615
|
zIndex: 1e3,
|
|
@@ -1213,15 +1638,16 @@ function Popover({
|
|
|
1213
1638
|
contentStyle
|
|
1214
1639
|
}) {
|
|
1215
1640
|
const tokens = newtoneApi.useTokens(1);
|
|
1216
|
-
const
|
|
1217
|
-
const
|
|
1218
|
-
const
|
|
1641
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
1642
|
+
const containerRef = React16.useRef(null);
|
|
1643
|
+
const [triggerHeight, setTriggerHeight] = React16.useState(0);
|
|
1644
|
+
const onTriggerLayout = React16.useCallback(
|
|
1219
1645
|
(e) => {
|
|
1220
1646
|
setTriggerHeight(e.nativeEvent.layout.height);
|
|
1221
1647
|
},
|
|
1222
1648
|
[]
|
|
1223
1649
|
);
|
|
1224
|
-
|
|
1650
|
+
React16.useEffect(() => {
|
|
1225
1651
|
if (!isOpen) return;
|
|
1226
1652
|
openPopovers.forEach((closeFn) => closeFn());
|
|
1227
1653
|
openPopovers.clear();
|
|
@@ -1230,7 +1656,7 @@ function Popover({
|
|
|
1230
1656
|
openPopovers.delete(onClose);
|
|
1231
1657
|
};
|
|
1232
1658
|
}, [isOpen, onClose]);
|
|
1233
|
-
|
|
1659
|
+
React16.useEffect(() => {
|
|
1234
1660
|
if (!isOpen) return;
|
|
1235
1661
|
if (typeof document === "undefined") return;
|
|
1236
1662
|
const handleMouseDown = (e) => {
|
|
@@ -1242,7 +1668,7 @@ function Popover({
|
|
|
1242
1668
|
document.addEventListener("mousedown", handleMouseDown, true);
|
|
1243
1669
|
return () => document.removeEventListener("mousedown", handleMouseDown, true);
|
|
1244
1670
|
}, [isOpen, onClose]);
|
|
1245
|
-
const handleKeyDown =
|
|
1671
|
+
const handleKeyDown = React16.useCallback(
|
|
1246
1672
|
(e) => {
|
|
1247
1673
|
if (closeOnEscape && e.key === "Escape") {
|
|
1248
1674
|
e.stopPropagation();
|
|
@@ -1251,41 +1677,41 @@ function Popover({
|
|
|
1251
1677
|
},
|
|
1252
1678
|
[closeOnEscape, onClose]
|
|
1253
1679
|
);
|
|
1254
|
-
const styles =
|
|
1255
|
-
() => getPopoverStyles(tokens,
|
|
1256
|
-
[tokens, triggerHeight, offset, maxHeight, width, isOpen]
|
|
1680
|
+
const styles = React16.useMemo(
|
|
1681
|
+
() => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance),
|
|
1682
|
+
[tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance]
|
|
1257
1683
|
);
|
|
1258
|
-
const containerStyles =
|
|
1684
|
+
const containerStyles = React16.useMemo(
|
|
1259
1685
|
() => [styles.container, ...Array.isArray(style) ? style : style ? [style] : []],
|
|
1260
1686
|
[styles.container, style]
|
|
1261
1687
|
);
|
|
1262
|
-
const mergedContentStyles =
|
|
1688
|
+
const mergedContentStyles = React16.useMemo(
|
|
1263
1689
|
() => [styles.content, ...Array.isArray(contentStyle) ? contentStyle : contentStyle ? [contentStyle] : []],
|
|
1264
1690
|
[styles.content, contentStyle]
|
|
1265
1691
|
);
|
|
1266
1692
|
const webProps = { onKeyDown: handleKeyDown };
|
|
1267
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
1268
1694
|
reactNative.View,
|
|
1269
1695
|
{
|
|
1270
1696
|
ref: containerRef,
|
|
1271
1697
|
style: containerStyles,
|
|
1272
1698
|
...webProps
|
|
1273
1699
|
},
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
isOpen && /* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { onLayout: onTriggerLayout }, trigger),
|
|
1701
|
+
isOpen && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: mergedContentStyles }, children)
|
|
1276
1702
|
);
|
|
1277
1703
|
}
|
|
1278
1704
|
function usePopover(options) {
|
|
1279
|
-
const [isOpen, setIsOpen] =
|
|
1280
|
-
const open =
|
|
1705
|
+
const [isOpen, setIsOpen] = React16.useState(options?.initialOpen ?? false);
|
|
1706
|
+
const open = React16.useCallback(() => {
|
|
1281
1707
|
setIsOpen(true);
|
|
1282
1708
|
options?.onOpenChange?.(true);
|
|
1283
1709
|
}, [options]);
|
|
1284
|
-
const close =
|
|
1710
|
+
const close = React16.useCallback(() => {
|
|
1285
1711
|
setIsOpen(false);
|
|
1286
1712
|
options?.onOpenChange?.(false);
|
|
1287
1713
|
}, [options]);
|
|
1288
|
-
const toggle =
|
|
1714
|
+
const toggle = React16.useCallback(() => {
|
|
1289
1715
|
setIsOpen((prev) => {
|
|
1290
1716
|
const next = !prev;
|
|
1291
1717
|
options?.onOpenChange?.(next);
|
|
@@ -1299,7 +1725,8 @@ function usePopover(options) {
|
|
|
1299
1725
|
function isOptionGroup(item) {
|
|
1300
1726
|
return "options" in item;
|
|
1301
1727
|
}
|
|
1302
|
-
function getSelectStyles(tokens,
|
|
1728
|
+
function getSelectStyles(tokens, disabled, size, isOpen, theme = "primary", appearance = "main") {
|
|
1729
|
+
const at = tokens.colors[theme][appearance];
|
|
1303
1730
|
const isSm = size === "sm";
|
|
1304
1731
|
const fontSize = isSm ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1305
1732
|
const iconSize = fontSize + 2;
|
|
@@ -1315,14 +1742,14 @@ function getSelectStyles(tokens, gamut, disabled, size, isOpen) {
|
|
|
1315
1742
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1316
1743
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1317
1744
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1318
|
-
color:
|
|
1745
|
+
color: at.fontTertiary
|
|
1319
1746
|
},
|
|
1320
1747
|
trigger: {
|
|
1321
1748
|
flexDirection: "row",
|
|
1322
1749
|
alignItems: "center",
|
|
1323
|
-
backgroundColor:
|
|
1750
|
+
backgroundColor: at.fontSecondary,
|
|
1324
1751
|
borderWidth: 1,
|
|
1325
|
-
borderColor:
|
|
1752
|
+
borderColor: at.fontSecondary,
|
|
1326
1753
|
borderRadius: tokens.radius.md,
|
|
1327
1754
|
paddingVertical,
|
|
1328
1755
|
paddingLeft: paddingHorizontal,
|
|
@@ -1333,7 +1760,7 @@ function getSelectStyles(tokens, gamut, disabled, size, isOpen) {
|
|
|
1333
1760
|
flex: 1,
|
|
1334
1761
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1335
1762
|
fontSize,
|
|
1336
|
-
color: disabled ?
|
|
1763
|
+
color: disabled ? at.fontTertiary : at.divider
|
|
1337
1764
|
},
|
|
1338
1765
|
iconWrapper: {
|
|
1339
1766
|
position: "absolute",
|
|
@@ -1346,7 +1773,7 @@ function getSelectStyles(tokens, gamut, disabled, size, isOpen) {
|
|
|
1346
1773
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1347
1774
|
fontSize: tokens.typography.fontSizes["01"],
|
|
1348
1775
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1349
|
-
color:
|
|
1776
|
+
color: at.fontTertiary,
|
|
1350
1777
|
textTransform: "uppercase",
|
|
1351
1778
|
letterSpacing: 0.5,
|
|
1352
1779
|
paddingVertical: tokens.spacing["04"],
|
|
@@ -1372,10 +1799,10 @@ function useSelect({
|
|
|
1372
1799
|
onClose,
|
|
1373
1800
|
onOpen
|
|
1374
1801
|
}) {
|
|
1375
|
-
const [focusedIndex, setFocusedIndex] =
|
|
1376
|
-
const typeAheadRef =
|
|
1377
|
-
const typeAheadTimerRef =
|
|
1378
|
-
|
|
1802
|
+
const [focusedIndex, setFocusedIndex] = React16.useState(-1);
|
|
1803
|
+
const typeAheadRef = React16.useRef("");
|
|
1804
|
+
const typeAheadTimerRef = React16.useRef();
|
|
1805
|
+
React16.useEffect(() => {
|
|
1379
1806
|
if (isOpen) {
|
|
1380
1807
|
const selectedIdx = flatOptions.findIndex((o) => o.value === value);
|
|
1381
1808
|
if (selectedIdx >= 0 && !flatOptions[selectedIdx].disabled) {
|
|
@@ -1388,7 +1815,7 @@ function useSelect({
|
|
|
1388
1815
|
setFocusedIndex(-1);
|
|
1389
1816
|
}
|
|
1390
1817
|
}, [isOpen, flatOptions, value]);
|
|
1391
|
-
const handleKeyDown =
|
|
1818
|
+
const handleKeyDown = React16.useCallback(
|
|
1392
1819
|
(e) => {
|
|
1393
1820
|
const key = e.key;
|
|
1394
1821
|
if (!isOpen) {
|
|
@@ -1465,11 +1892,14 @@ function SelectOptionRow({
|
|
|
1465
1892
|
size
|
|
1466
1893
|
}) {
|
|
1467
1894
|
const tokens = newtoneApi.useTokens(1);
|
|
1895
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
1896
|
+
const at = tokens.colors[frameCtx?.theme ?? "primary"][frameCtx?.appearance ?? "main"];
|
|
1897
|
+
const emphasisAt = tokens.colors[frameCtx?.theme ?? "primary"].emphasis;
|
|
1468
1898
|
const paddingVertical = size === "sm" ? tokens.spacing["04"] : tokens.spacing["08"];
|
|
1469
1899
|
const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
|
|
1470
1900
|
const fontSize = size === "sm" ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1471
1901
|
if (renderOption) {
|
|
1472
|
-
return /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
1473
1903
|
reactNative.Pressable,
|
|
1474
1904
|
{
|
|
1475
1905
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1480,7 +1910,7 @@ function SelectOptionRow({
|
|
|
1480
1910
|
renderOption(option, { isSelected, isFocused })
|
|
1481
1911
|
);
|
|
1482
1912
|
}
|
|
1483
|
-
return /* @__PURE__ */
|
|
1913
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
1484
1914
|
reactNative.Pressable,
|
|
1485
1915
|
{
|
|
1486
1916
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1496,10 +1926,10 @@ function SelectOptionRow({
|
|
|
1496
1926
|
paddingHorizontal
|
|
1497
1927
|
},
|
|
1498
1928
|
isSelected && {
|
|
1499
|
-
backgroundColor:
|
|
1929
|
+
backgroundColor: at.fontSecondary
|
|
1500
1930
|
},
|
|
1501
1931
|
isFocused && !isSelected && {
|
|
1502
|
-
backgroundColor: `${
|
|
1932
|
+
backgroundColor: `${at.fontSecondary}20`
|
|
1503
1933
|
},
|
|
1504
1934
|
option.disabled && {
|
|
1505
1935
|
opacity: 0.5
|
|
@@ -1509,7 +1939,7 @@ function SelectOptionRow({
|
|
|
1509
1939
|
}
|
|
1510
1940
|
]
|
|
1511
1941
|
},
|
|
1512
|
-
/* @__PURE__ */
|
|
1942
|
+
/* @__PURE__ */ React16__default.default.createElement(
|
|
1513
1943
|
reactNative.Text,
|
|
1514
1944
|
{
|
|
1515
1945
|
style: [
|
|
@@ -1517,26 +1947,26 @@ function SelectOptionRow({
|
|
|
1517
1947
|
flex: 1,
|
|
1518
1948
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1519
1949
|
fontSize,
|
|
1520
|
-
color:
|
|
1950
|
+
color: at.divider
|
|
1521
1951
|
},
|
|
1522
1952
|
isSelected && {
|
|
1523
1953
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1524
|
-
color:
|
|
1954
|
+
color: emphasisAt.divider
|
|
1525
1955
|
},
|
|
1526
1956
|
option.disabled && {
|
|
1527
|
-
color:
|
|
1957
|
+
color: at.fontTertiary
|
|
1528
1958
|
}
|
|
1529
1959
|
],
|
|
1530
1960
|
numberOfLines: 1
|
|
1531
1961
|
},
|
|
1532
1962
|
option.label
|
|
1533
1963
|
),
|
|
1534
|
-
isSelected && /* @__PURE__ */
|
|
1964
|
+
isSelected && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React16__default.default.createElement(
|
|
1535
1965
|
Icon,
|
|
1536
1966
|
{
|
|
1537
1967
|
name: "check",
|
|
1538
1968
|
size: fontSize,
|
|
1539
|
-
color:
|
|
1969
|
+
color: emphasisAt.divider
|
|
1540
1970
|
}
|
|
1541
1971
|
))
|
|
1542
1972
|
);
|
|
@@ -1567,8 +1997,9 @@ function Select({
|
|
|
1567
1997
|
style
|
|
1568
1998
|
}) {
|
|
1569
1999
|
const tokens = newtoneApi.useTokens(1);
|
|
2000
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
1570
2001
|
const { isOpen, open, close, toggle } = usePopover();
|
|
1571
|
-
const flatOptions =
|
|
2002
|
+
const flatOptions = React16.useMemo(() => flattenOptions(options), [options]);
|
|
1572
2003
|
const { focusedIndex, handleKeyDown } = useSelect({
|
|
1573
2004
|
flatOptions,
|
|
1574
2005
|
value,
|
|
@@ -1580,15 +2011,18 @@ function Select({
|
|
|
1580
2011
|
onClose: close,
|
|
1581
2012
|
onOpen: open
|
|
1582
2013
|
});
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
|
|
2014
|
+
const inheritedTheme = frameCtx?.theme;
|
|
2015
|
+
const inheritedAppearance = frameCtx?.appearance;
|
|
2016
|
+
const styles = React16.useMemo(
|
|
2017
|
+
() => getSelectStyles(tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance),
|
|
2018
|
+
[tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance]
|
|
1586
2019
|
);
|
|
1587
2020
|
const selectedOption = flatOptions.find((o) => o.value === value);
|
|
1588
2021
|
const displayLabel = selectedOption?.label ?? placeholder ?? value;
|
|
1589
|
-
const
|
|
2022
|
+
const at = tokens.colors[inheritedTheme ?? "primary"][inheritedAppearance ?? "main"];
|
|
2023
|
+
const iconColor = disabled ? at.fontTertiary : at.divider;
|
|
1590
2024
|
const triggerWebProps = { onKeyDown: handleKeyDown };
|
|
1591
|
-
const trigger = /* @__PURE__ */
|
|
2025
|
+
const trigger = /* @__PURE__ */ React16__default.default.createElement(
|
|
1592
2026
|
reactNative.Pressable,
|
|
1593
2027
|
{
|
|
1594
2028
|
onPress: disabled ? void 0 : toggle,
|
|
@@ -1598,8 +2032,8 @@ function Select({
|
|
|
1598
2032
|
...triggerWebProps,
|
|
1599
2033
|
style: styles.trigger
|
|
1600
2034
|
},
|
|
1601
|
-
renderValue ? renderValue(selectedOption) : /* @__PURE__ */
|
|
1602
|
-
/* @__PURE__ */
|
|
2035
|
+
renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
|
|
2036
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React16__default.default.createElement(
|
|
1603
2037
|
Icon,
|
|
1604
2038
|
{
|
|
1605
2039
|
name: isOpen ? "expand_less" : "expand_more",
|
|
@@ -1608,14 +2042,14 @@ function Select({
|
|
|
1608
2042
|
}
|
|
1609
2043
|
))
|
|
1610
2044
|
);
|
|
1611
|
-
return /* @__PURE__ */
|
|
2045
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React16__default.default.createElement(
|
|
1612
2046
|
Popover,
|
|
1613
2047
|
{
|
|
1614
2048
|
isOpen: isOpen && !disabled,
|
|
1615
2049
|
onClose: close,
|
|
1616
2050
|
trigger
|
|
1617
2051
|
},
|
|
1618
|
-
/* @__PURE__ */
|
|
2052
|
+
/* @__PURE__ */ React16__default.default.createElement(
|
|
1619
2053
|
reactNative.ScrollView,
|
|
1620
2054
|
{
|
|
1621
2055
|
bounces: false,
|
|
@@ -1624,7 +2058,7 @@ function Select({
|
|
|
1624
2058
|
},
|
|
1625
2059
|
options.map((item) => {
|
|
1626
2060
|
if (isOptionGroup(item)) {
|
|
1627
|
-
return /* @__PURE__ */
|
|
2061
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { key: item.label }, /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React16__default.default.createElement(
|
|
1628
2062
|
SelectOptionRow,
|
|
1629
2063
|
{
|
|
1630
2064
|
key: opt.value,
|
|
@@ -1640,7 +2074,7 @@ function Select({
|
|
|
1640
2074
|
}
|
|
1641
2075
|
)));
|
|
1642
2076
|
}
|
|
1643
|
-
return /* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
1644
2078
|
SelectOptionRow,
|
|
1645
2079
|
{
|
|
1646
2080
|
key: item.value,
|
|
@@ -1663,7 +2097,9 @@ var TRACK_WIDTH = 40;
|
|
|
1663
2097
|
var TRACK_HEIGHT = 22;
|
|
1664
2098
|
var THUMB_SIZE = 18;
|
|
1665
2099
|
var THUMB_OFFSET = 2;
|
|
1666
|
-
function getToggleStyles(tokens,
|
|
2100
|
+
function getToggleStyles(tokens, value, disabled, theme = "primary", appearance = "main") {
|
|
2101
|
+
const at = tokens.colors[theme][appearance];
|
|
2102
|
+
const emphasisAt = tokens.colors[theme].emphasis;
|
|
1667
2103
|
return reactNative.StyleSheet.create({
|
|
1668
2104
|
container: {
|
|
1669
2105
|
flexDirection: "row",
|
|
@@ -1675,13 +2111,13 @@ function getToggleStyles(tokens, gamut, value, disabled) {
|
|
|
1675
2111
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1676
2112
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1677
2113
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1678
|
-
color:
|
|
2114
|
+
color: at.fontTertiary
|
|
1679
2115
|
},
|
|
1680
2116
|
track: {
|
|
1681
2117
|
width: TRACK_WIDTH,
|
|
1682
2118
|
height: TRACK_HEIGHT,
|
|
1683
2119
|
borderRadius: TRACK_HEIGHT / 2,
|
|
1684
|
-
backgroundColor: value ?
|
|
2120
|
+
backgroundColor: value ? emphasisAt.divider : at.fontSecondary,
|
|
1685
2121
|
justifyContent: "center",
|
|
1686
2122
|
paddingHorizontal: THUMB_OFFSET
|
|
1687
2123
|
},
|
|
@@ -1689,7 +2125,7 @@ function getToggleStyles(tokens, gamut, value, disabled) {
|
|
|
1689
2125
|
width: THUMB_SIZE,
|
|
1690
2126
|
height: THUMB_SIZE,
|
|
1691
2127
|
borderRadius: THUMB_SIZE / 2,
|
|
1692
|
-
backgroundColor:
|
|
2128
|
+
backgroundColor: at.background,
|
|
1693
2129
|
alignSelf: value ? "flex-end" : "flex-start"
|
|
1694
2130
|
}
|
|
1695
2131
|
});
|
|
@@ -1704,16 +2140,17 @@ function Toggle({
|
|
|
1704
2140
|
style
|
|
1705
2141
|
}) {
|
|
1706
2142
|
const tokens = newtoneApi.useTokens(1);
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1709
|
-
|
|
2143
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
2144
|
+
const styles = React16__default.default.useMemo(
|
|
2145
|
+
() => getToggleStyles(tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance),
|
|
2146
|
+
[tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance]
|
|
1710
2147
|
);
|
|
1711
|
-
const handlePress =
|
|
2148
|
+
const handlePress = React16__default.default.useCallback(() => {
|
|
1712
2149
|
if (!disabled) {
|
|
1713
2150
|
onValueChange(!value);
|
|
1714
2151
|
}
|
|
1715
2152
|
}, [disabled, value, onValueChange]);
|
|
1716
|
-
return /* @__PURE__ */
|
|
2153
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React16__default.default.createElement(
|
|
1717
2154
|
reactNative.Pressable,
|
|
1718
2155
|
{
|
|
1719
2156
|
onPress: handlePress,
|
|
@@ -1721,12 +2158,12 @@ function Toggle({
|
|
|
1721
2158
|
accessibilityRole: "switch",
|
|
1722
2159
|
accessibilityState: { checked: value, disabled }
|
|
1723
2160
|
},
|
|
1724
|
-
/* @__PURE__ */
|
|
2161
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.track }, /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.thumb }))
|
|
1725
2162
|
));
|
|
1726
2163
|
}
|
|
1727
2164
|
var TRACK_HEIGHT2 = 6;
|
|
1728
2165
|
var THUMB_SIZE2 = 16;
|
|
1729
|
-
function getSliderStyles(tokens,
|
|
2166
|
+
function getSliderStyles(tokens, disabled) {
|
|
1730
2167
|
return reactNative.StyleSheet.create({
|
|
1731
2168
|
container: {
|
|
1732
2169
|
gap: tokens.spacing["04"],
|
|
@@ -1741,23 +2178,23 @@ function getSliderStyles(tokens, gamut, disabled) {
|
|
|
1741
2178
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1742
2179
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1743
2180
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1744
|
-
color: tokens.
|
|
2181
|
+
color: tokens.colors.primary.main.fontTertiary
|
|
1745
2182
|
},
|
|
1746
2183
|
value: {
|
|
1747
2184
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1748
2185
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1749
2186
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1750
|
-
color: tokens.
|
|
2187
|
+
color: tokens.colors.primary.main.divider
|
|
1751
2188
|
},
|
|
1752
2189
|
valueInput: {
|
|
1753
2190
|
width: 48,
|
|
1754
2191
|
paddingVertical: 0,
|
|
1755
2192
|
paddingHorizontal: 4,
|
|
1756
2193
|
borderWidth: 1,
|
|
1757
|
-
borderColor: tokens.
|
|
2194
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
1758
2195
|
borderRadius: 4,
|
|
1759
2196
|
backgroundColor: "transparent",
|
|
1760
|
-
color: tokens.
|
|
2197
|
+
color: tokens.colors.primary.main.divider,
|
|
1761
2198
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1762
2199
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1763
2200
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
@@ -1774,21 +2211,21 @@ function getSliderStyles(tokens, gamut, disabled) {
|
|
|
1774
2211
|
right: 0,
|
|
1775
2212
|
height: TRACK_HEIGHT2,
|
|
1776
2213
|
borderRadius: TRACK_HEIGHT2 / 2,
|
|
1777
|
-
backgroundColor: tokens.
|
|
2214
|
+
backgroundColor: tokens.colors.primary.main.fontSecondary
|
|
1778
2215
|
},
|
|
1779
2216
|
trackFill: {
|
|
1780
2217
|
position: "absolute",
|
|
1781
2218
|
left: 0,
|
|
1782
2219
|
height: TRACK_HEIGHT2,
|
|
1783
2220
|
borderRadius: TRACK_HEIGHT2 / 2,
|
|
1784
|
-
backgroundColor: tokens.
|
|
2221
|
+
backgroundColor: tokens.colors.primary.emphasis.divider
|
|
1785
2222
|
},
|
|
1786
2223
|
thumb: {
|
|
1787
2224
|
position: "absolute",
|
|
1788
2225
|
width: THUMB_SIZE2,
|
|
1789
2226
|
height: THUMB_SIZE2,
|
|
1790
2227
|
borderRadius: THUMB_SIZE2 / 2,
|
|
1791
|
-
backgroundColor: tokens.
|
|
2228
|
+
backgroundColor: tokens.colors.primary.emphasis.divider
|
|
1792
2229
|
}
|
|
1793
2230
|
});
|
|
1794
2231
|
}
|
|
@@ -1807,42 +2244,42 @@ function Slider({
|
|
|
1807
2244
|
style
|
|
1808
2245
|
}) {
|
|
1809
2246
|
const tokens = newtoneApi.useTokens(1);
|
|
1810
|
-
const styles =
|
|
1811
|
-
() => getSliderStyles(tokens,
|
|
2247
|
+
const styles = React16__default.default.useMemo(
|
|
2248
|
+
() => getSliderStyles(tokens, disabled),
|
|
1812
2249
|
[tokens, disabled]
|
|
1813
2250
|
);
|
|
1814
|
-
const trackRef =
|
|
1815
|
-
const trackWidth =
|
|
1816
|
-
const trackPageX =
|
|
1817
|
-
const [layoutWidth, setLayoutWidth] =
|
|
1818
|
-
const onValueChangeRef =
|
|
1819
|
-
const minRef =
|
|
1820
|
-
const maxRef =
|
|
1821
|
-
const stepRef =
|
|
1822
|
-
const disabledRef =
|
|
1823
|
-
|
|
2251
|
+
const trackRef = React16__default.default.useRef(null);
|
|
2252
|
+
const trackWidth = React16__default.default.useRef(0);
|
|
2253
|
+
const trackPageX = React16__default.default.useRef(0);
|
|
2254
|
+
const [layoutWidth, setLayoutWidth] = React16__default.default.useState(0);
|
|
2255
|
+
const onValueChangeRef = React16__default.default.useRef(onValueChange);
|
|
2256
|
+
const minRef = React16__default.default.useRef(min);
|
|
2257
|
+
const maxRef = React16__default.default.useRef(max);
|
|
2258
|
+
const stepRef = React16__default.default.useRef(step);
|
|
2259
|
+
const disabledRef = React16__default.default.useRef(disabled);
|
|
2260
|
+
React16__default.default.useEffect(() => {
|
|
1824
2261
|
onValueChangeRef.current = onValueChange;
|
|
1825
2262
|
}, [onValueChange]);
|
|
1826
|
-
|
|
2263
|
+
React16__default.default.useEffect(() => {
|
|
1827
2264
|
minRef.current = min;
|
|
1828
2265
|
}, [min]);
|
|
1829
|
-
|
|
2266
|
+
React16__default.default.useEffect(() => {
|
|
1830
2267
|
maxRef.current = max;
|
|
1831
2268
|
}, [max]);
|
|
1832
|
-
|
|
2269
|
+
React16__default.default.useEffect(() => {
|
|
1833
2270
|
stepRef.current = step;
|
|
1834
2271
|
}, [step]);
|
|
1835
|
-
|
|
2272
|
+
React16__default.default.useEffect(() => {
|
|
1836
2273
|
disabledRef.current = disabled;
|
|
1837
2274
|
}, [disabled]);
|
|
1838
|
-
const computeValue =
|
|
2275
|
+
const computeValue = React16__default.default.useCallback((pageX) => {
|
|
1839
2276
|
const localX = pageX - trackPageX.current;
|
|
1840
2277
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
1841
2278
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
1842
2279
|
const stepped = Math.round(raw / stepRef.current) * stepRef.current;
|
|
1843
2280
|
return Math.min(maxRef.current, Math.max(minRef.current, stepped));
|
|
1844
2281
|
}, []);
|
|
1845
|
-
const panResponder =
|
|
2282
|
+
const panResponder = React16__default.default.useRef(
|
|
1846
2283
|
reactNative.PanResponder.create({
|
|
1847
2284
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
1848
2285
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -1870,7 +2307,7 @@ function Slider({
|
|
|
1870
2307
|
fillLeft = 0;
|
|
1871
2308
|
fillWidth = thumbLeft + THUMB_SIZE2 / 2;
|
|
1872
2309
|
}
|
|
1873
|
-
const handleValueTextSubmit =
|
|
2310
|
+
const handleValueTextSubmit = React16__default.default.useCallback(
|
|
1874
2311
|
(text) => {
|
|
1875
2312
|
const raw = Number(text);
|
|
1876
2313
|
if (!Number.isNaN(raw)) {
|
|
@@ -1879,12 +2316,12 @@ function Slider({
|
|
|
1879
2316
|
},
|
|
1880
2317
|
[onValueChange, min, max]
|
|
1881
2318
|
);
|
|
1882
|
-
const [editText, setEditText] =
|
|
1883
|
-
|
|
2319
|
+
const [editText, setEditText] = React16__default.default.useState(String(value));
|
|
2320
|
+
React16__default.default.useEffect(() => {
|
|
1884
2321
|
setEditText(String(value));
|
|
1885
2322
|
}, [value]);
|
|
1886
2323
|
const showLabel = label || showValue || editableValue;
|
|
1887
|
-
return /* @__PURE__ */
|
|
2324
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16__default.default.createElement(
|
|
1888
2325
|
reactNative.TextInput,
|
|
1889
2326
|
{
|
|
1890
2327
|
style: styles.valueInput,
|
|
@@ -1896,7 +2333,7 @@ function Slider({
|
|
|
1896
2333
|
selectTextOnFocus: true,
|
|
1897
2334
|
editable: !disabled
|
|
1898
2335
|
}
|
|
1899
|
-
) : showValue && /* @__PURE__ */
|
|
2336
|
+
) : showValue && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.value }, value)), /* @__PURE__ */ React16__default.default.createElement(
|
|
1900
2337
|
reactNative.View,
|
|
1901
2338
|
{
|
|
1902
2339
|
ref: trackRef,
|
|
@@ -1911,9 +2348,9 @@ function Slider({
|
|
|
1911
2348
|
},
|
|
1912
2349
|
...panResponder.panHandlers
|
|
1913
2350
|
},
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
2351
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.trackRail }),
|
|
2352
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.trackFill, { left: fillLeft, width: fillWidth }] }),
|
|
2353
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
1917
2354
|
));
|
|
1918
2355
|
}
|
|
1919
2356
|
var TRACK_HEIGHT3 = 22;
|
|
@@ -1931,7 +2368,7 @@ function buildHueSegments(min, max) {
|
|
|
1931
2368
|
return hueToHex(hue);
|
|
1932
2369
|
});
|
|
1933
2370
|
}
|
|
1934
|
-
function getHueSliderStyles(tokens,
|
|
2371
|
+
function getHueSliderStyles(tokens, disabled) {
|
|
1935
2372
|
return reactNative.StyleSheet.create({
|
|
1936
2373
|
container: {
|
|
1937
2374
|
gap: tokens.spacing["04"],
|
|
@@ -1946,23 +2383,23 @@ function getHueSliderStyles(tokens, gamut, disabled) {
|
|
|
1946
2383
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1947
2384
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1948
2385
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1949
|
-
color: tokens.
|
|
2386
|
+
color: tokens.colors.primary.main.fontTertiary
|
|
1950
2387
|
},
|
|
1951
2388
|
value: {
|
|
1952
2389
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1953
2390
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1954
2391
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1955
|
-
color: tokens.
|
|
2392
|
+
color: tokens.colors.primary.main.divider
|
|
1956
2393
|
},
|
|
1957
2394
|
valueInput: {
|
|
1958
2395
|
width: 48,
|
|
1959
2396
|
paddingVertical: 0,
|
|
1960
2397
|
paddingHorizontal: 4,
|
|
1961
2398
|
borderWidth: 1,
|
|
1962
|
-
borderColor: tokens.
|
|
2399
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
1963
2400
|
borderRadius: 4,
|
|
1964
2401
|
backgroundColor: "transparent",
|
|
1965
|
-
color: tokens.
|
|
2402
|
+
color: tokens.colors.primary.main.divider,
|
|
1966
2403
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1967
2404
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1968
2405
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
@@ -1992,7 +2429,7 @@ function getHueSliderStyles(tokens, gamut, disabled) {
|
|
|
1992
2429
|
borderRadius: THUMB_SIZE3 / 2,
|
|
1993
2430
|
backgroundColor: "#ffffff",
|
|
1994
2431
|
borderWidth: 2,
|
|
1995
|
-
borderColor: tokens.
|
|
2432
|
+
borderColor: tokens.colors.primary.main.fontSecondary
|
|
1996
2433
|
}
|
|
1997
2434
|
});
|
|
1998
2435
|
}
|
|
@@ -2010,42 +2447,42 @@ function HueSlider({
|
|
|
2010
2447
|
style
|
|
2011
2448
|
}) {
|
|
2012
2449
|
const tokens = newtoneApi.useTokens(1);
|
|
2013
|
-
const styles =
|
|
2014
|
-
() => getHueSliderStyles(tokens,
|
|
2450
|
+
const styles = React16__default.default.useMemo(
|
|
2451
|
+
() => getHueSliderStyles(tokens, disabled),
|
|
2015
2452
|
[tokens, disabled]
|
|
2016
2453
|
);
|
|
2017
|
-
const segments =
|
|
2454
|
+
const segments = React16__default.default.useMemo(
|
|
2018
2455
|
() => buildHueSegments(min, max),
|
|
2019
2456
|
[min, max]
|
|
2020
2457
|
);
|
|
2021
|
-
const trackRef =
|
|
2022
|
-
const trackWidth =
|
|
2023
|
-
const trackPageX =
|
|
2024
|
-
const [layoutWidth, setLayoutWidth] =
|
|
2025
|
-
const onValueChangeRef =
|
|
2026
|
-
const minRef =
|
|
2027
|
-
const maxRef =
|
|
2028
|
-
const disabledRef =
|
|
2029
|
-
|
|
2458
|
+
const trackRef = React16__default.default.useRef(null);
|
|
2459
|
+
const trackWidth = React16__default.default.useRef(0);
|
|
2460
|
+
const trackPageX = React16__default.default.useRef(0);
|
|
2461
|
+
const [layoutWidth, setLayoutWidth] = React16__default.default.useState(0);
|
|
2462
|
+
const onValueChangeRef = React16__default.default.useRef(onValueChange);
|
|
2463
|
+
const minRef = React16__default.default.useRef(min);
|
|
2464
|
+
const maxRef = React16__default.default.useRef(max);
|
|
2465
|
+
const disabledRef = React16__default.default.useRef(disabled);
|
|
2466
|
+
React16__default.default.useEffect(() => {
|
|
2030
2467
|
onValueChangeRef.current = onValueChange;
|
|
2031
2468
|
}, [onValueChange]);
|
|
2032
|
-
|
|
2469
|
+
React16__default.default.useEffect(() => {
|
|
2033
2470
|
minRef.current = min;
|
|
2034
2471
|
}, [min]);
|
|
2035
|
-
|
|
2472
|
+
React16__default.default.useEffect(() => {
|
|
2036
2473
|
maxRef.current = max;
|
|
2037
2474
|
}, [max]);
|
|
2038
|
-
|
|
2475
|
+
React16__default.default.useEffect(() => {
|
|
2039
2476
|
disabledRef.current = disabled;
|
|
2040
2477
|
}, [disabled]);
|
|
2041
|
-
const computeHue =
|
|
2478
|
+
const computeHue = React16__default.default.useCallback((pageX) => {
|
|
2042
2479
|
const localX = pageX - trackPageX.current;
|
|
2043
2480
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2044
2481
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2045
2482
|
const stepped = Math.round(raw);
|
|
2046
2483
|
return (stepped % 360 + 360) % 360;
|
|
2047
2484
|
}, []);
|
|
2048
|
-
const panResponder =
|
|
2485
|
+
const panResponder = React16__default.default.useRef(
|
|
2049
2486
|
reactNative.PanResponder.create({
|
|
2050
2487
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2051
2488
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2061,7 +2498,7 @@ function HueSlider({
|
|
|
2061
2498
|
const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
|
|
2062
2499
|
const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE3);
|
|
2063
2500
|
const thumbLeft = ratio * usableWidth;
|
|
2064
|
-
const handleValueTextSubmit =
|
|
2501
|
+
const handleValueTextSubmit = React16__default.default.useCallback(
|
|
2065
2502
|
(text) => {
|
|
2066
2503
|
const raw = Number(text);
|
|
2067
2504
|
if (!Number.isNaN(raw)) {
|
|
@@ -2070,12 +2507,12 @@ function HueSlider({
|
|
|
2070
2507
|
},
|
|
2071
2508
|
[onValueChange]
|
|
2072
2509
|
);
|
|
2073
|
-
const [editText, setEditText] =
|
|
2074
|
-
|
|
2510
|
+
const [editText, setEditText] = React16__default.default.useState(String(value));
|
|
2511
|
+
React16__default.default.useEffect(() => {
|
|
2075
2512
|
setEditText(String(value));
|
|
2076
2513
|
}, [value]);
|
|
2077
2514
|
const showLabel = label || showValue || editableValue;
|
|
2078
|
-
return /* @__PURE__ */
|
|
2515
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16__default.default.createElement(
|
|
2079
2516
|
reactNative.TextInput,
|
|
2080
2517
|
{
|
|
2081
2518
|
style: styles.valueInput,
|
|
@@ -2087,7 +2524,7 @@ function HueSlider({
|
|
|
2087
2524
|
selectTextOnFocus: true,
|
|
2088
2525
|
editable: !disabled
|
|
2089
2526
|
}
|
|
2090
|
-
) : showValue && /* @__PURE__ */
|
|
2527
|
+
) : showValue && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React16__default.default.createElement(
|
|
2091
2528
|
reactNative.View,
|
|
2092
2529
|
{
|
|
2093
2530
|
ref: trackRef,
|
|
@@ -2102,8 +2539,8 @@ function HueSlider({
|
|
|
2102
2539
|
},
|
|
2103
2540
|
...panResponder.panHandlers
|
|
2104
2541
|
},
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
/* @__PURE__ */
|
|
2542
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
|
|
2543
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2107
2544
|
));
|
|
2108
2545
|
}
|
|
2109
2546
|
|
|
@@ -2164,7 +2601,7 @@ function oklchToP3Css(color) {
|
|
|
2164
2601
|
}
|
|
2165
2602
|
var TRACK_HEIGHT4 = 22;
|
|
2166
2603
|
var THUMB_SIZE4 = 18;
|
|
2167
|
-
function getColorScaleSliderStyles(tokens,
|
|
2604
|
+
function getColorScaleSliderStyles(tokens, disabled) {
|
|
2168
2605
|
return reactNative.StyleSheet.create({
|
|
2169
2606
|
container: {
|
|
2170
2607
|
gap: tokens.spacing["04"],
|
|
@@ -2179,7 +2616,7 @@ function getColorScaleSliderStyles(tokens, gamut, disabled) {
|
|
|
2179
2616
|
fontFamily: tokens.typography.fonts.main.family,
|
|
2180
2617
|
fontSize: tokens.typography.fontSizes["04"],
|
|
2181
2618
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2182
|
-
color: tokens.
|
|
2619
|
+
color: tokens.colors.primary.main.fontTertiary
|
|
2183
2620
|
},
|
|
2184
2621
|
trackContainer: {
|
|
2185
2622
|
height: TRACK_HEIGHT4 + THUMB_SIZE4,
|
|
@@ -2205,13 +2642,13 @@ function getColorScaleSliderStyles(tokens, gamut, disabled) {
|
|
|
2205
2642
|
borderRadius: THUMB_SIZE4 / 2,
|
|
2206
2643
|
backgroundColor: "#ffffff",
|
|
2207
2644
|
borderWidth: 2,
|
|
2208
|
-
borderColor: tokens.
|
|
2645
|
+
borderColor: tokens.colors.primary.main.fontSecondary
|
|
2209
2646
|
},
|
|
2210
2647
|
warning: {
|
|
2211
2648
|
fontFamily: tokens.typography.fonts.main.family,
|
|
2212
2649
|
fontSize: tokens.typography.fontSizes["01"],
|
|
2213
2650
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2214
|
-
color: tokens.error.
|
|
2651
|
+
color: tokens.colors.error.emphasis.divider
|
|
2215
2652
|
}
|
|
2216
2653
|
});
|
|
2217
2654
|
}
|
|
@@ -2231,37 +2668,38 @@ function ColorScaleSlider({
|
|
|
2231
2668
|
style
|
|
2232
2669
|
}) {
|
|
2233
2670
|
const tokens = newtoneApi.useTokens(1);
|
|
2234
|
-
const
|
|
2235
|
-
|
|
2671
|
+
const { gamut } = newtoneApi.useNewtoneTheme();
|
|
2672
|
+
const styles = React16__default.default.useMemo(
|
|
2673
|
+
() => getColorScaleSliderStyles(tokens, disabled),
|
|
2236
2674
|
[tokens, disabled]
|
|
2237
2675
|
);
|
|
2238
|
-
const trackRef =
|
|
2239
|
-
const trackWidth =
|
|
2240
|
-
const trackPageX =
|
|
2241
|
-
const isDragging =
|
|
2242
|
-
const thumbAnim =
|
|
2243
|
-
const [layoutWidth, setLayoutWidth] =
|
|
2244
|
-
const onValueChangeRef =
|
|
2245
|
-
const disabledRef =
|
|
2246
|
-
const colorsLengthRef =
|
|
2247
|
-
const trimEndsRef =
|
|
2248
|
-
const snapRef =
|
|
2249
|
-
|
|
2676
|
+
const trackRef = React16__default.default.useRef(null);
|
|
2677
|
+
const trackWidth = React16__default.default.useRef(0);
|
|
2678
|
+
const trackPageX = React16__default.default.useRef(0);
|
|
2679
|
+
const isDragging = React16__default.default.useRef(false);
|
|
2680
|
+
const thumbAnim = React16__default.default.useRef(new reactNative.Animated.Value(0)).current;
|
|
2681
|
+
const [layoutWidth, setLayoutWidth] = React16__default.default.useState(0);
|
|
2682
|
+
const onValueChangeRef = React16__default.default.useRef(onValueChange);
|
|
2683
|
+
const disabledRef = React16__default.default.useRef(disabled);
|
|
2684
|
+
const colorsLengthRef = React16__default.default.useRef(colors.length);
|
|
2685
|
+
const trimEndsRef = React16__default.default.useRef(trimEnds);
|
|
2686
|
+
const snapRef = React16__default.default.useRef(snap);
|
|
2687
|
+
React16__default.default.useEffect(() => {
|
|
2250
2688
|
onValueChangeRef.current = onValueChange;
|
|
2251
2689
|
}, [onValueChange]);
|
|
2252
|
-
|
|
2690
|
+
React16__default.default.useEffect(() => {
|
|
2253
2691
|
disabledRef.current = disabled;
|
|
2254
2692
|
}, [disabled]);
|
|
2255
|
-
|
|
2693
|
+
React16__default.default.useEffect(() => {
|
|
2256
2694
|
colorsLengthRef.current = colors.length;
|
|
2257
2695
|
}, [colors.length]);
|
|
2258
|
-
|
|
2696
|
+
React16__default.default.useEffect(() => {
|
|
2259
2697
|
trimEndsRef.current = trimEnds;
|
|
2260
2698
|
}, [trimEnds]);
|
|
2261
|
-
|
|
2699
|
+
React16__default.default.useEffect(() => {
|
|
2262
2700
|
snapRef.current = snap;
|
|
2263
2701
|
}, [snap]);
|
|
2264
|
-
const computeNv =
|
|
2702
|
+
const computeNv = React16__default.default.useCallback((pageX) => {
|
|
2265
2703
|
const localX = pageX - trackPageX.current;
|
|
2266
2704
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2267
2705
|
const totalSteps2 = colorsLengthRef.current - 1;
|
|
@@ -2276,7 +2714,7 @@ function ColorScaleSlider({
|
|
|
2276
2714
|
}
|
|
2277
2715
|
return nv;
|
|
2278
2716
|
}, []);
|
|
2279
|
-
const panResponder =
|
|
2717
|
+
const panResponder = React16__default.default.useRef(
|
|
2280
2718
|
reactNative.PanResponder.create({
|
|
2281
2719
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2282
2720
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2304,7 +2742,7 @@ function ColorScaleSlider({
|
|
|
2304
2742
|
const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
|
|
2305
2743
|
const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE4);
|
|
2306
2744
|
const thumbLeft = ratio * usableWidth;
|
|
2307
|
-
|
|
2745
|
+
React16__default.default.useEffect(() => {
|
|
2308
2746
|
if (isDragging.current || !animateValue) {
|
|
2309
2747
|
thumbAnim.setValue(thumbLeft);
|
|
2310
2748
|
} else {
|
|
@@ -2315,7 +2753,7 @@ function ColorScaleSlider({
|
|
|
2315
2753
|
}).start();
|
|
2316
2754
|
}
|
|
2317
2755
|
}, [thumbLeft, animateValue, thumbAnim]);
|
|
2318
|
-
return /* @__PURE__ */
|
|
2756
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.labelRow }, /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.label }, label)), /* @__PURE__ */ React16__default.default.createElement(
|
|
2319
2757
|
reactNative.View,
|
|
2320
2758
|
{
|
|
2321
2759
|
ref: trackRef,
|
|
@@ -2330,17 +2768,18 @@ function ColorScaleSlider({
|
|
|
2330
2768
|
},
|
|
2331
2769
|
...panResponder.panHandlers
|
|
2332
2770
|
},
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
), warning && /* @__PURE__ */
|
|
2771
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: gamut === "p3" ? oklchToP3Css(color.oklch) : newtone.srgbToHex(color.srgb) }] }))),
|
|
2772
|
+
/* @__PURE__ */ React16__default.default.createElement(reactNative.Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
|
|
2773
|
+
), warning && /* @__PURE__ */ React16__default.default.createElement(reactNative.Text, { style: styles.warning }, warning));
|
|
2336
2774
|
}
|
|
2337
|
-
function getAppShellStyles(tokens,
|
|
2775
|
+
function getAppShellStyles(tokens, theme = "primary", appearance = "main") {
|
|
2776
|
+
const at = tokens.colors[theme][appearance];
|
|
2338
2777
|
return reactNative.StyleSheet.create({
|
|
2339
2778
|
container: {
|
|
2340
2779
|
flex: 1,
|
|
2341
2780
|
flexDirection: "row",
|
|
2342
2781
|
overflow: "hidden",
|
|
2343
|
-
backgroundColor:
|
|
2782
|
+
backgroundColor: at.background
|
|
2344
2783
|
},
|
|
2345
2784
|
main: {
|
|
2346
2785
|
flex: 1,
|
|
@@ -2354,17 +2793,22 @@ function getAppShellStyles(tokens, gamut) {
|
|
|
2354
2793
|
// src/composites/layout/AppShell/AppShell.tsx
|
|
2355
2794
|
function AppShell({ sidebar, children }) {
|
|
2356
2795
|
const tokens = newtoneApi.useTokens();
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2796
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
2797
|
+
const styles = React16__default.default.useMemo(
|
|
2798
|
+
() => getAppShellStyles(tokens, frameCtx?.theme, frameCtx?.appearance),
|
|
2799
|
+
[tokens, frameCtx?.theme, frameCtx?.appearance]
|
|
2800
|
+
);
|
|
2801
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.container }, sidebar, /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.main }, children));
|
|
2359
2802
|
}
|
|
2360
|
-
function getSidebarStyles({ tokens,
|
|
2361
|
-
const
|
|
2803
|
+
function getSidebarStyles({ tokens, width, bordered, theme = "primary", appearance = "main" }) {
|
|
2804
|
+
const at = tokens.colors[theme][appearance];
|
|
2805
|
+
const borderColor = at.fontSecondary;
|
|
2362
2806
|
return reactNative.StyleSheet.create({
|
|
2363
2807
|
container: {
|
|
2364
2808
|
width,
|
|
2365
2809
|
flexShrink: 0,
|
|
2366
2810
|
flexDirection: "column",
|
|
2367
|
-
backgroundColor:
|
|
2811
|
+
backgroundColor: at.background,
|
|
2368
2812
|
borderRightWidth: bordered ? 1 : 0,
|
|
2369
2813
|
borderRightColor: borderColor
|
|
2370
2814
|
},
|
|
@@ -2393,14 +2837,16 @@ function Sidebar({
|
|
|
2393
2837
|
bordered = true
|
|
2394
2838
|
}) {
|
|
2395
2839
|
const tokens = newtoneApi.useTokens();
|
|
2396
|
-
const
|
|
2397
|
-
|
|
2398
|
-
|
|
2840
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
2841
|
+
const styles = React16__default.default.useMemo(
|
|
2842
|
+
() => getSidebarStyles({ tokens, width, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
|
|
2843
|
+
[tokens, width, bordered, frameCtx?.theme, frameCtx?.appearance]
|
|
2399
2844
|
);
|
|
2400
|
-
return /* @__PURE__ */
|
|
2845
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.container }, header && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.header }, header), /* @__PURE__ */ React16__default.default.createElement(reactNative.ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.footer }, footer));
|
|
2401
2846
|
}
|
|
2402
|
-
function getNavbarStyles({ tokens,
|
|
2403
|
-
const
|
|
2847
|
+
function getNavbarStyles({ tokens, height, bordered, theme = "primary", appearance = "main" }) {
|
|
2848
|
+
const at = tokens.colors[theme][appearance];
|
|
2849
|
+
const borderColor = at.fontSecondary;
|
|
2404
2850
|
return reactNative.StyleSheet.create({
|
|
2405
2851
|
container: {
|
|
2406
2852
|
flexDirection: "row",
|
|
@@ -2408,7 +2854,7 @@ function getNavbarStyles({ tokens, gamut, height, bordered }) {
|
|
|
2408
2854
|
height,
|
|
2409
2855
|
flexShrink: 0,
|
|
2410
2856
|
paddingHorizontal: 24,
|
|
2411
|
-
backgroundColor:
|
|
2857
|
+
backgroundColor: at.background,
|
|
2412
2858
|
borderBottomWidth: bordered ? 1 : 0,
|
|
2413
2859
|
borderBottomColor: borderColor
|
|
2414
2860
|
},
|
|
@@ -2435,11 +2881,51 @@ function Navbar({
|
|
|
2435
2881
|
bordered = true
|
|
2436
2882
|
}) {
|
|
2437
2883
|
const tokens = newtoneApi.useTokens();
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
|
|
2884
|
+
const frameCtx = newtoneApi.useFrameContext();
|
|
2885
|
+
const styles = React16__default.default.useMemo(
|
|
2886
|
+
() => getNavbarStyles({ tokens, height, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
|
|
2887
|
+
[tokens, height, bordered, frameCtx?.theme, frameCtx?.appearance]
|
|
2888
|
+
);
|
|
2889
|
+
return /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.container }, children ? children : /* @__PURE__ */ React16__default.default.createElement(React16__default.default.Fragment, null, /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.left }, left), /* @__PURE__ */ React16__default.default.createElement(reactNative.View, { style: styles.right }, right)));
|
|
2890
|
+
}
|
|
2891
|
+
function LogoMonogram({ colorValue = 0, size = 32 }) {
|
|
2892
|
+
const fg = `rgb(${colorValue}, ${colorValue}, ${colorValue})`;
|
|
2893
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
2894
|
+
"svg",
|
|
2895
|
+
{
|
|
2896
|
+
width: size,
|
|
2897
|
+
height: size,
|
|
2898
|
+
viewBox: "0 0 168 168",
|
|
2899
|
+
fill: "none",
|
|
2900
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2901
|
+
},
|
|
2902
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M39.3574 70H12L20 84H36L30.2681 94.0309C28.8627 96.4903 28.8627 99.5096 30.2681 101.969L36 112L49.7319 87.9691C51.1373 85.5097 51.1373 82.4903 49.7319 80.0309L46.3034 74.0309C44.879 71.5383 42.2283 70 39.3574 70Z", fill: fg }),
|
|
2903
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M84 112H36L41.6966 121.969C43.121 124.462 45.7717 126 48.6426 126H79.3574C82.2283 126 84.879 124.462 86.3034 121.969L93.7319 108.969C95.1373 106.51 95.1373 103.49 93.7319 101.031L84 84L76 98L84 112Z", fill: fg }),
|
|
2904
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M76 70L84 84H64.6426C61.7717 84 59.121 82.4617 57.6966 79.9691L50.268 66.9691C48.8626 64.5097 48.8626 61.4903 50.268 59.0309L65.6966 32.0309C67.121 29.5383 69.7717 28 72.6426 28H84L60 70H76Z", fill: fg }),
|
|
2905
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M95.3574 28H84L132 112L137.732 101.969C139.137 99.5097 139.137 96.4903 137.732 94.0309L102.303 32.0309C100.879 29.5383 98.2283 28 95.3574 28Z", fill: fg }),
|
|
2906
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M104.643 112H132L126.303 121.969C124.879 124.462 122.228 126 119.357 126H108L116 140L108 154L94.268 129.969C92.8626 127.51 92.8626 124.49 94.268 122.031L97.6966 116.031C99.121 113.538 101.772 112 104.643 112Z", fill: fg })
|
|
2907
|
+
);
|
|
2908
|
+
}
|
|
2909
|
+
function LogoWordmark({ fill = "black" }) {
|
|
2910
|
+
return /* @__PURE__ */ React16__default.default.createElement(
|
|
2911
|
+
"svg",
|
|
2912
|
+
{
|
|
2913
|
+
height: 32,
|
|
2914
|
+
viewBox: "0 0 504 168",
|
|
2915
|
+
fill: "none",
|
|
2916
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2917
|
+
},
|
|
2918
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M8 126H22V42H14.4C12.1598 42 11.0397 42 10.184 42.436C9.43139 42.8195 8.81947 43.4314 8.43597 44.184C8 45.0397 8 46.1598 8 48.4V126Z", fill }),
|
|
2919
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M76 108.5V42H90V119.6C90 121.84 90 122.96 89.564 123.816C89.1805 124.569 88.5686 125.181 87.816 125.564C86.9603 126 85.8402 126 83.6 126H77.4281C74.7227 126 73.37 126 72.1603 125.605C71.0899 125.256 70.1054 124.684 69.271 123.928C68.328 123.074 67.6569 121.9 66.3146 119.551L22 42H30.5719C33.2773 42 34.63 42 35.8397 42.3949C36.9101 42.7442 37.8946 43.3156 38.729 44.0716C39.672 44.926 40.3431 46.1005 41.6854 48.4494L76 108.5Z", fill }),
|
|
2920
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M152.208 68.2077C153.395 69.3951 153.989 69.9888 154.439 70.6738C154.838 71.2814 155.152 71.9406 155.374 72.6332C155.623 73.4139 155.711 74.2489 155.886 75.9189L156.884 85.3951C157.27 89.0678 157.464 90.9042 156.867 92.3245C156.343 93.5721 155.412 94.6057 154.226 95.2577C152.876 96 151.03 96 147.337 96H112V114H154V126H115.302C113.345 126 112.367 126 111.446 125.779C110.63 125.583 109.849 125.26 109.134 124.821C108.326 124.326 107.635 123.635 106.251 122.251L101.749 117.749C100.365 116.365 99.6736 115.674 99.1789 114.866C98.7402 114.151 98.417 113.37 98.221 112.554C98 111.633 98 110.655 98 108.698V75.3019C98 73.3452 98 72.3668 98.221 71.4461C98.417 70.6299 98.7402 69.8495 99.1789 69.1337C99.6736 68.3264 100.365 67.6346 101.749 66.251L106.251 61.749C107.635 60.3654 108.326 59.6736 109.134 59.1789C109.849 58.7402 110.63 58.417 111.446 58.221C112.367 58 113.345 58 115.302 58H136.698C138.655 58 139.633 58 140.554 58.221C141.37 58.417 142.151 58.7402 142.866 59.1789C143.674 59.6736 144.365 60.3654 145.749 61.749L152.208 68.2077ZM112 70V87.5332L144.492 86.4502L141.895 70H112Z", fill }),
|
|
2921
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M492.208 68.2077C493.395 69.3951 493.989 69.9888 494.439 70.6738C494.838 71.2814 495.152 71.9406 495.374 72.6332C495.623 73.4139 495.711 74.2489 495.886 75.9189L496.884 85.3951C497.27 89.0678 497.464 90.9042 496.867 92.3245C496.343 93.5721 495.412 94.6057 494.226 95.2577C492.876 96 491.03 96 487.337 96H452V114H494V126H455.302C453.345 126 452.367 126 451.446 125.779C450.63 125.583 449.849 125.26 449.134 124.821C448.326 124.326 447.635 123.635 446.251 122.251L441.749 117.749C440.365 116.365 439.674 115.674 439.179 114.866C438.74 114.151 438.417 113.37 438.221 112.554C438 111.633 438 110.655 438 108.698V75.3019C438 73.3452 438 72.3668 438.221 71.4461C438.417 70.6299 438.74 69.8495 439.179 69.1337C439.674 68.3264 440.365 67.6346 441.749 66.251L446.251 61.749C447.635 60.3654 448.326 59.6736 449.134 59.1789C449.849 58.7402 450.63 58.417 451.446 58.221C452.367 58 453.345 58 455.302 58H476.698C478.655 58 479.633 58 480.554 58.221C481.37 58.417 482.151 58.7402 482.866 59.1789C483.674 59.6736 484.365 60.3654 485.749 61.749L492.208 68.2077ZM452 70V87.5332L484.492 86.4502L481.895 70H452Z", fill }),
|
|
2922
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M168.794 117.797L160 58H174L184 126H178.291C175.35 126 173.88 126 172.695 125.46C171.651 124.984 170.765 124.219 170.142 123.255C169.435 122.161 169.222 120.706 168.794 117.797Z", fill }),
|
|
2923
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M192.794 66.2033L184 126H187.674C190.626 126 192.102 126 193.29 125.457C194.337 124.979 195.224 124.209 195.846 123.241C196.551 122.141 196.76 120.68 197.177 117.758L204 70L210.823 117.758C211.24 120.68 211.449 122.141 212.154 123.241C212.776 124.209 213.663 124.979 214.71 125.457C215.898 126 217.374 126 220.326 126H224L215.206 66.2033C214.778 63.2936 214.565 61.8387 213.858 60.7448C213.235 59.7808 212.349 59.0155 211.305 58.5398C210.12 58 208.65 58 205.709 58H202.291C199.35 58 197.88 58 196.695 58.5398C195.651 59.0155 194.765 59.7808 194.142 60.7448C193.435 61.8387 193.222 63.2936 192.794 66.2033Z", fill }),
|
|
2924
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M224 126H229.709C232.65 126 234.12 126 235.305 125.46C236.349 124.984 237.235 124.219 237.858 123.255C238.565 122.161 238.778 120.706 239.206 117.797L246.235 70H298V58H251.302C249.345 58 248.367 58 247.446 58.221C246.63 58.417 245.849 58.7402 245.134 59.1789C244.326 59.6736 243.635 60.3654 242.251 61.749L234.927 69.0727C233.815 70.1845 233.26 70.7405 232.829 71.3785C232.447 71.9446 232.139 72.5573 231.913 73.2016C231.658 73.9277 231.543 74.7056 231.315 76.2613L224 126Z", fill }),
|
|
2925
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M264.251 122.251L259.749 117.749C258.365 116.365 257.674 115.674 257.179 114.866C256.74 114.151 256.417 113.37 256.221 112.554C256 111.633 256 110.655 256 108.698V69.2L260 42H270V114H298V126H273.302C271.345 126 270.367 126 269.446 125.779C268.63 125.583 267.849 125.26 267.134 124.821C266.326 124.326 265.635 123.635 264.251 122.251Z", fill }),
|
|
2926
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M358.251 66.251C359.635 67.6346 360.326 68.3264 360.821 69.1337C361.26 69.8495 361.583 70.6299 361.779 71.4461C362 72.3668 362 73.3452 362 75.3019V108.698C362 110.655 362 111.633 361.779 112.554C361.583 113.37 361.26 114.151 360.821 114.866C360.326 115.674 359.635 116.365 358.251 117.749L353.749 122.251C352.365 123.635 351.674 124.326 350.866 124.821C350.151 125.26 349.37 125.583 348.554 125.779C347.633 126 346.655 126 344.698 126H319.302C317.345 126 316.367 126 315.446 125.779C314.63 125.583 313.849 125.26 313.134 124.821C312.326 124.326 311.635 123.635 310.251 122.251L305.749 117.749C304.365 116.365 303.674 115.674 303.179 114.866C302.74 114.151 302.417 113.37 302.221 112.554C302 111.633 302 110.655 302 108.698V75.3019C302 73.3452 302 72.3668 302.221 71.4461C302.417 70.6299 302.74 69.8495 303.179 69.1337C303.674 68.3264 304.365 67.6346 305.749 66.251L310.224 61.7757C311.606 60.3937 312.297 59.7027 313.104 59.2083C313.818 58.77 314.598 58.4468 315.413 58.2506C316.333 58.0292 317.31 58.0284 319.264 58.0267L344.692 58.0046C346.651 58.0029 347.63 58.0021 348.552 58.2228C349.369 58.4185 350.151 58.7417 350.867 59.1807C351.676 59.6757 352.368 60.3684 353.754 61.7536L358.251 66.251ZM316 70V114H348V70H316Z", fill }),
|
|
2927
|
+
/* @__PURE__ */ React16__default.default.createElement("path", { d: "M370 64.4V126H384V70H416V126H430V75.3019C430 73.3452 430 72.3668 429.779 71.4461C429.583 70.6299 429.26 69.8495 428.821 69.1337C428.326 68.3264 427.635 67.6346 426.251 66.251L421.749 61.749C420.365 60.3654 419.674 59.6736 418.866 59.1789C418.151 58.7402 417.37 58.417 416.554 58.221C415.633 58 414.655 58 412.698 58H376.4C374.16 58 373.04 58 372.184 58.436C371.431 58.8195 370.819 59.4314 370.436 60.184C370 61.0397 370 62.1598 370 64.4Z", fill })
|
|
2441
2928
|
);
|
|
2442
|
-
return /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.container }, children ? children : /* @__PURE__ */ React13__default.default.createElement(React13__default.default.Fragment, null, /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.left }, left), /* @__PURE__ */ React13__default.default.createElement(reactNative.View, { style: styles.right }, right)));
|
|
2443
2929
|
}
|
|
2444
2930
|
|
|
2445
2931
|
// src/registry/registry.ts
|
|
@@ -3387,10 +3873,6 @@ var ICON_CATALOG = [
|
|
|
3387
3873
|
}
|
|
3388
3874
|
];
|
|
3389
3875
|
|
|
3390
|
-
Object.defineProperty(exports, "ACCENT_DEFAULTS", {
|
|
3391
|
-
enumerable: true,
|
|
3392
|
-
get: function () { return newtoneApi.ACCENT_DEFAULTS; }
|
|
3393
|
-
});
|
|
3394
3876
|
Object.defineProperty(exports, "DEFAULT_FONT_SIZES", {
|
|
3395
3877
|
enumerable: true,
|
|
3396
3878
|
get: function () { return newtoneApi.DEFAULT_FONT_SIZES; }
|
|
@@ -3407,6 +3889,10 @@ Object.defineProperty(exports, "DEFAULT_THEME_CONFIG", {
|
|
|
3407
3889
|
enumerable: true,
|
|
3408
3890
|
get: function () { return newtoneApi.DEFAULT_THEME_CONFIG; }
|
|
3409
3891
|
});
|
|
3892
|
+
Object.defineProperty(exports, "DEFAULT_THEME_MAPPINGS", {
|
|
3893
|
+
enumerable: true,
|
|
3894
|
+
get: function () { return newtoneApi.DEFAULT_THEME_MAPPINGS; }
|
|
3895
|
+
});
|
|
3410
3896
|
Object.defineProperty(exports, "ERROR_DEFAULTS", {
|
|
3411
3897
|
enumerable: true,
|
|
3412
3898
|
get: function () { return newtoneApi.ERROR_DEFAULTS; }
|
|
@@ -3415,18 +3901,26 @@ Object.defineProperty(exports, "FrameContext", {
|
|
|
3415
3901
|
enumerable: true,
|
|
3416
3902
|
get: function () { return newtoneApi.FrameContext; }
|
|
3417
3903
|
});
|
|
3418
|
-
Object.defineProperty(exports, "NEUTRAL_DEFAULTS", {
|
|
3419
|
-
enumerable: true,
|
|
3420
|
-
get: function () { return newtoneApi.NEUTRAL_DEFAULTS; }
|
|
3421
|
-
});
|
|
3422
3904
|
Object.defineProperty(exports, "NewtoneProvider", {
|
|
3423
3905
|
enumerable: true,
|
|
3424
3906
|
get: function () { return newtoneApi.NewtoneProvider; }
|
|
3425
3907
|
});
|
|
3908
|
+
Object.defineProperty(exports, "PRIMARY_DEFAULTS", {
|
|
3909
|
+
enumerable: true,
|
|
3910
|
+
get: function () { return newtoneApi.PRIMARY_DEFAULTS; }
|
|
3911
|
+
});
|
|
3912
|
+
Object.defineProperty(exports, "SECONDARY_DEFAULTS", {
|
|
3913
|
+
enumerable: true,
|
|
3914
|
+
get: function () { return newtoneApi.SECONDARY_DEFAULTS; }
|
|
3915
|
+
});
|
|
3426
3916
|
Object.defineProperty(exports, "SUCCESS_DEFAULTS", {
|
|
3427
3917
|
enumerable: true,
|
|
3428
3918
|
get: function () { return newtoneApi.SUCCESS_DEFAULTS; }
|
|
3429
3919
|
});
|
|
3920
|
+
Object.defineProperty(exports, "TERTIARY_DEFAULTS", {
|
|
3921
|
+
enumerable: true,
|
|
3922
|
+
get: function () { return newtoneApi.TERTIARY_DEFAULTS; }
|
|
3923
|
+
});
|
|
3430
3924
|
Object.defineProperty(exports, "WARNING_DEFAULTS", {
|
|
3431
3925
|
enumerable: true,
|
|
3432
3926
|
get: function () { return newtoneApi.WARNING_DEFAULTS; }
|
|
@@ -3435,6 +3929,14 @@ Object.defineProperty(exports, "buildGoogleFontsUrl", {
|
|
|
3435
3929
|
enumerable: true,
|
|
3436
3930
|
get: function () { return newtoneApi.buildGoogleFontsUrl; }
|
|
3437
3931
|
});
|
|
3932
|
+
Object.defineProperty(exports, "computeColors", {
|
|
3933
|
+
enumerable: true,
|
|
3934
|
+
get: function () { return newtoneApi.computeColors; }
|
|
3935
|
+
});
|
|
3936
|
+
Object.defineProperty(exports, "computeSwatches", {
|
|
3937
|
+
enumerable: true,
|
|
3938
|
+
get: function () { return newtoneApi.computeSwatches; }
|
|
3939
|
+
});
|
|
3438
3940
|
Object.defineProperty(exports, "computeTokens", {
|
|
3439
3941
|
enumerable: true,
|
|
3440
3942
|
get: function () { return newtoneApi.computeTokens; }
|
|
@@ -3443,17 +3945,13 @@ Object.defineProperty(exports, "enqueueObservation", {
|
|
|
3443
3945
|
enumerable: true,
|
|
3444
3946
|
get: function () { return newtoneApi.enqueueObservation; }
|
|
3445
3947
|
});
|
|
3446
|
-
Object.defineProperty(exports, "isV2TokenOverrides", {
|
|
3447
|
-
enumerable: true,
|
|
3448
|
-
get: function () { return newtoneApi.isV2TokenOverrides; }
|
|
3449
|
-
});
|
|
3450
3948
|
Object.defineProperty(exports, "measureAvgCharWidth", {
|
|
3451
3949
|
enumerable: true,
|
|
3452
3950
|
get: function () { return newtoneApi.measureAvgCharWidth; }
|
|
3453
3951
|
});
|
|
3454
|
-
Object.defineProperty(exports, "
|
|
3952
|
+
Object.defineProperty(exports, "resolveTheme", {
|
|
3455
3953
|
enumerable: true,
|
|
3456
|
-
get: function () { return newtoneApi.
|
|
3954
|
+
get: function () { return newtoneApi.resolveTheme; }
|
|
3457
3955
|
});
|
|
3458
3956
|
Object.defineProperty(exports, "useBreakpoint", {
|
|
3459
3957
|
enumerable: true,
|
|
@@ -3471,6 +3969,10 @@ Object.defineProperty(exports, "useNewtoneTheme", {
|
|
|
3471
3969
|
enumerable: true,
|
|
3472
3970
|
get: function () { return newtoneApi.useNewtoneTheme; }
|
|
3473
3971
|
});
|
|
3972
|
+
Object.defineProperty(exports, "useScheme", {
|
|
3973
|
+
enumerable: true,
|
|
3974
|
+
get: function () { return newtoneApi.useScheme; }
|
|
3975
|
+
});
|
|
3474
3976
|
Object.defineProperty(exports, "useTokens", {
|
|
3475
3977
|
enumerable: true,
|
|
3476
3978
|
get: function () { return newtoneApi.useTokens; }
|
|
@@ -3484,11 +3986,16 @@ exports.Button = Button;
|
|
|
3484
3986
|
exports.CATEGORIES = CATEGORIES;
|
|
3485
3987
|
exports.COMPONENTS = COMPONENTS;
|
|
3486
3988
|
exports.Card = Card;
|
|
3989
|
+
exports.Chip = Chip;
|
|
3487
3990
|
exports.ColorScaleSlider = ColorScaleSlider;
|
|
3991
|
+
exports.ContentCard = ContentCard;
|
|
3992
|
+
exports.Divider = Divider;
|
|
3488
3993
|
exports.Frame = Frame;
|
|
3489
3994
|
exports.HueSlider = HueSlider;
|
|
3490
3995
|
exports.ICON_CATALOG = ICON_CATALOG;
|
|
3491
3996
|
exports.Icon = Icon;
|
|
3997
|
+
exports.LogoMonogram = LogoMonogram;
|
|
3998
|
+
exports.LogoWordmark = LogoWordmark;
|
|
3492
3999
|
exports.Navbar = Navbar;
|
|
3493
4000
|
exports.Popover = Popover;
|
|
3494
4001
|
exports.Select = Select;
|