@newtonedev/components 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composites/actions/Button/Button.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.styles.d.ts +1 -0
- package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
- package/dist/index.cjs +849 -508
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +807 -469
- package/dist/index.js.map +1 -1
- package/dist/layout/Page/Page.d.ts +30 -0
- package/dist/layout/Page/Page.d.ts.map +1 -0
- package/dist/layout/Page/Page.types.d.ts +60 -0
- package/dist/layout/Page/Page.types.d.ts.map +1 -0
- package/dist/layout/Page/index.d.ts +3 -0
- package/dist/layout/Page/index.d.ts.map +1 -0
- package/dist/layout/Section/Section.d.ts +23 -0
- package/dist/layout/Section/Section.d.ts.map +1 -0
- package/dist/layout/Section/Section.styles.d.ts +20 -0
- package/dist/layout/Section/Section.styles.d.ts.map +1 -0
- package/dist/layout/Section/Section.types.d.ts +74 -0
- package/dist/layout/Section/Section.types.d.ts.map +1 -0
- package/dist/layout/Section/index.d.ts +3 -0
- package/dist/layout/Section/index.d.ts.map +1 -0
- package/dist/layout/Viewport/Viewport.d.ts +22 -0
- package/dist/layout/Viewport/Viewport.d.ts.map +1 -0
- package/dist/layout/Viewport/Viewport.types.d.ts +34 -0
- package/dist/layout/Viewport/Viewport.types.d.ts.map +1 -0
- package/dist/layout/Viewport/index.d.ts +3 -0
- package/dist/layout/Viewport/index.d.ts.map +1 -0
- package/dist/{primitives → layout}/Wrapper/Wrapper.d.ts +1 -16
- package/dist/layout/Wrapper/Wrapper.d.ts.map +1 -0
- package/dist/{primitives → layout}/Wrapper/Wrapper.styles.d.ts +1 -2
- package/dist/layout/Wrapper/Wrapper.styles.d.ts.map +1 -0
- package/dist/{primitives → layout}/Wrapper/Wrapper.types.d.ts +1 -3
- package/dist/layout/Wrapper/Wrapper.types.d.ts.map +1 -0
- package/dist/layout/Wrapper/index.d.ts.map +1 -0
- package/dist/layout/index.d.ts +9 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/primitives/Card/Card.d.ts +15 -0
- package/dist/primitives/Card/Card.d.ts.map +1 -0
- package/dist/primitives/Card/Card.styles.d.ts +40 -0
- package/dist/primitives/Card/Card.styles.d.ts.map +1 -0
- package/dist/primitives/Card/Card.types.d.ts +101 -0
- package/dist/primitives/Card/Card.types.d.ts.map +1 -0
- package/dist/primitives/Card/index.d.ts +3 -0
- package/dist/primitives/Card/index.d.ts.map +1 -0
- package/dist/primitives/Frame/Frame.d.ts +1 -1
- package/dist/primitives/Frame/Frame.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.styles.d.ts +0 -6
- package/dist/primitives/Frame/Frame.styles.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.types.d.ts +1 -15
- package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/composites/actions/Button/Button.styles.ts +58 -19
- package/src/composites/actions/Button/Button.tsx +18 -3
- package/src/composites/display/Chip/Chip.tsx +1 -1
- package/src/composites/form-controls/TextInput/TextInput.styles.ts +4 -4
- package/src/index.ts +18 -5
- package/src/layout/Page/Page.tsx +103 -0
- package/src/layout/Page/Page.types.ts +69 -0
- package/src/layout/Page/index.ts +2 -0
- package/src/layout/Section/Section.styles.ts +90 -0
- package/src/layout/Section/Section.tsx +57 -0
- package/src/layout/Section/Section.types.ts +85 -0
- package/src/layout/Section/index.ts +2 -0
- package/src/layout/Viewport/Viewport.tsx +52 -0
- package/src/layout/Viewport/Viewport.types.ts +40 -0
- package/src/layout/Viewport/index.ts +2 -0
- package/src/{primitives → layout}/Wrapper/Wrapper.styles.ts +2 -20
- package/src/{primitives → layout}/Wrapper/Wrapper.tsx +1 -31
- package/src/{primitives → layout}/Wrapper/Wrapper.types.ts +1 -4
- package/src/layout/index.ts +15 -0
- package/src/primitives/Card/Card.styles.ts +182 -0
- package/src/primitives/Card/Card.tsx +197 -0
- package/src/primitives/Card/Card.types.ts +155 -0
- package/src/primitives/Card/index.ts +2 -0
- package/src/primitives/Frame/Frame.styles.ts +0 -32
- package/src/primitives/Frame/Frame.tsx +5 -52
- package/src/primitives/Frame/Frame.types.ts +1 -22
- package/src/primitives/Text/Text.tsx +1 -1
- package/src/primitives/index.ts +3 -3
- package/dist/primitives/Wrapper/Wrapper.d.ts.map +0 -1
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts.map +0 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +0 -1
- package/dist/primitives/Wrapper/index.d.ts.map +0 -1
- /package/dist/{primitives → layout}/Wrapper/index.d.ts +0 -0
- /package/src/{primitives → layout}/Wrapper/index.ts +0 -0
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 React19 = 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 React19__default = /*#__PURE__*/_interopDefault(React19);
|
|
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] = React19.useState(false);
|
|
43
|
+
React19.useEffect(() => {
|
|
44
44
|
setupModality();
|
|
45
45
|
}, []);
|
|
46
|
-
const onFocus =
|
|
46
|
+
const onFocus = React19.useCallback(() => {
|
|
47
47
|
if (hadKeyboardEvent) {
|
|
48
48
|
setIsFocusVisible(true);
|
|
49
49
|
}
|
|
50
50
|
}, []);
|
|
51
|
-
const onBlur =
|
|
51
|
+
const onBlur = React19.useCallback(() => {
|
|
52
52
|
setIsFocusVisible(false);
|
|
53
53
|
}, []);
|
|
54
54
|
const focusProps = { onFocus, onBlur };
|
|
@@ -186,10 +186,7 @@ function getFrameStyles(input) {
|
|
|
186
186
|
left,
|
|
187
187
|
zIndex,
|
|
188
188
|
overflow,
|
|
189
|
-
|
|
190
|
-
radius,
|
|
191
|
-
bordered = false,
|
|
192
|
-
disabled = false
|
|
189
|
+
radius
|
|
193
190
|
} = input;
|
|
194
191
|
const container = {};
|
|
195
192
|
const appearanceTokens = tokens.colors[theme][appearance];
|
|
@@ -242,10 +239,6 @@ function getFrameStyles(input) {
|
|
|
242
239
|
}
|
|
243
240
|
}
|
|
244
241
|
if (overflow) container.overflow = overflow;
|
|
245
|
-
if (bordered) {
|
|
246
|
-
container.borderWidth = 1;
|
|
247
|
-
container.borderColor = appearanceTokens.fontTertiary;
|
|
248
|
-
}
|
|
249
242
|
if (frameElevation === 2) {
|
|
250
243
|
container.shadowColor = "#000";
|
|
251
244
|
container.shadowOffset = { width: 0, height: 2 };
|
|
@@ -253,14 +246,6 @@ function getFrameStyles(input) {
|
|
|
253
246
|
container.shadowRadius = 6;
|
|
254
247
|
container.elevation = 4;
|
|
255
248
|
}
|
|
256
|
-
if (opacity !== void 0) {
|
|
257
|
-
container.opacity = opacity;
|
|
258
|
-
} else if (disabled) {
|
|
259
|
-
container.opacity = 0.5;
|
|
260
|
-
}
|
|
261
|
-
const pressed = reactNative.StyleSheet.create({
|
|
262
|
-
s: { backgroundColor: appearanceTokens.fontSecondary }
|
|
263
|
-
}).s;
|
|
264
249
|
let gridWebStyle = null;
|
|
265
250
|
if (layout === "grid") {
|
|
266
251
|
gridWebStyle = {
|
|
@@ -275,7 +260,6 @@ function getFrameStyles(input) {
|
|
|
275
260
|
// Validate and optimize the container styles through StyleSheet.create(),
|
|
276
261
|
// then extract the single style object with `.c`.
|
|
277
262
|
container: reactNative.StyleSheet.create({ c: container }).c,
|
|
278
|
-
pressed,
|
|
279
263
|
gridWebStyle,
|
|
280
264
|
insetBoxShadow
|
|
281
265
|
};
|
|
@@ -283,9 +267,9 @@ function getFrameStyles(input) {
|
|
|
283
267
|
|
|
284
268
|
// src/primitives/Frame/Frame.tsx
|
|
285
269
|
function wrapTextChildren(children, textStyle) {
|
|
286
|
-
return
|
|
270
|
+
return React19__default.default.Children.map(children, (child) => {
|
|
287
271
|
if (typeof child === "string" || typeof child === "number") {
|
|
288
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: textStyle }, child);
|
|
289
273
|
}
|
|
290
274
|
return child;
|
|
291
275
|
});
|
|
@@ -338,14 +322,8 @@ function Frame({
|
|
|
338
322
|
zIndex,
|
|
339
323
|
overflow,
|
|
340
324
|
pointerEvents,
|
|
341
|
-
opacity,
|
|
342
325
|
// Appearance
|
|
343
326
|
radius,
|
|
344
|
-
bordered,
|
|
345
|
-
// Interactivity
|
|
346
|
-
onPress,
|
|
347
|
-
href,
|
|
348
|
-
disabled = false,
|
|
349
327
|
// Accessibility
|
|
350
328
|
accessibilityLabel,
|
|
351
329
|
accessibilityHint,
|
|
@@ -359,7 +337,7 @@ function Frame({
|
|
|
359
337
|
const themeCtx = newtoneApi.useNewtoneTheme();
|
|
360
338
|
const { mode, gamut } = themeCtx;
|
|
361
339
|
const parentFrameCtx = newtoneApi.useFrameContext();
|
|
362
|
-
const resolvedConfig =
|
|
340
|
+
const resolvedConfig = React19.useMemo(() => {
|
|
363
341
|
if (scheme && themeCtx.schemes) {
|
|
364
342
|
const schemeConfig = themeCtx.schemes[scheme];
|
|
365
343
|
if (schemeConfig) return schemeConfig;
|
|
@@ -371,7 +349,7 @@ function Frame({
|
|
|
371
349
|
const resolvedAppearance = appearance ?? parentFrameCtx?.appearance ?? "main";
|
|
372
350
|
const resolvedFrameElevation = elevation ?? 0;
|
|
373
351
|
const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
|
|
374
|
-
const tokens =
|
|
352
|
+
const tokens = React19.useMemo(() => {
|
|
375
353
|
return newtoneApi.computeTokens(
|
|
376
354
|
resolvedConfig.colorSystem,
|
|
377
355
|
mode,
|
|
@@ -386,7 +364,7 @@ function Frame({
|
|
|
386
364
|
resolvedConfig.relativeSwatchDefaults
|
|
387
365
|
);
|
|
388
366
|
}, [resolvedConfig, mode, gamut, resolvedElevation]);
|
|
389
|
-
const
|
|
367
|
+
const styles3 = React19.useMemo(
|
|
390
368
|
() => getFrameStyles({
|
|
391
369
|
tokens,
|
|
392
370
|
frameElevation: resolvedFrameElevation,
|
|
@@ -415,10 +393,7 @@ function Frame({
|
|
|
415
393
|
left,
|
|
416
394
|
zIndex,
|
|
417
395
|
overflow,
|
|
418
|
-
|
|
419
|
-
radius,
|
|
420
|
-
bordered,
|
|
421
|
-
disabled
|
|
396
|
+
radius
|
|
422
397
|
}),
|
|
423
398
|
[
|
|
424
399
|
tokens,
|
|
@@ -448,14 +423,11 @@ function Frame({
|
|
|
448
423
|
left,
|
|
449
424
|
zIndex,
|
|
450
425
|
overflow,
|
|
451
|
-
|
|
452
|
-
radius,
|
|
453
|
-
bordered,
|
|
454
|
-
disabled
|
|
426
|
+
radius
|
|
455
427
|
]
|
|
456
428
|
);
|
|
457
429
|
const resolvedScheme = scheme ?? parentFrameCtx?.scheme;
|
|
458
|
-
const contextValue =
|
|
430
|
+
const contextValue = React19.useMemo(
|
|
459
431
|
() => ({
|
|
460
432
|
elevation: resolvedElevation,
|
|
461
433
|
tokens,
|
|
@@ -465,7 +437,7 @@ function Frame({
|
|
|
465
437
|
}),
|
|
466
438
|
[resolvedElevation, tokens, resolvedScheme, resolvedTheme, resolvedAppearance]
|
|
467
439
|
);
|
|
468
|
-
const schemeThemeCtx =
|
|
440
|
+
const schemeThemeCtx = React19.useMemo(() => {
|
|
469
441
|
if (!isSchemeOverride) return null;
|
|
470
442
|
return {
|
|
471
443
|
...themeCtx,
|
|
@@ -474,23 +446,14 @@ function Frame({
|
|
|
474
446
|
};
|
|
475
447
|
}, [isSchemeOverride, themeCtx, resolvedConfig, scheme]);
|
|
476
448
|
const webOverrides = [];
|
|
477
|
-
if (
|
|
478
|
-
webOverrides.push(
|
|
449
|
+
if (styles3.gridWebStyle) {
|
|
450
|
+
webOverrides.push(styles3.gridWebStyle);
|
|
479
451
|
}
|
|
480
|
-
if (
|
|
481
|
-
webOverrides.push({ boxShadow:
|
|
452
|
+
if (styles3.insetBoxShadow) {
|
|
453
|
+
webOverrides.push({ boxShadow: styles3.insetBoxShadow });
|
|
482
454
|
}
|
|
483
455
|
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
484
|
-
const
|
|
485
|
-
const { isFocusVisible, focusProps } = useFocusVisible();
|
|
486
|
-
const focusRingStyle = isFocusVisible && !disabled ? {
|
|
487
|
-
outlineWidth: 2,
|
|
488
|
-
outlineStyle: "solid",
|
|
489
|
-
outlineColor: tokens.colors[resolvedTheme].emphasis.background,
|
|
490
|
-
outlineOffset: 2
|
|
491
|
-
} : void 0;
|
|
492
|
-
const webFocusProps = isInteractive ? focusProps : {};
|
|
493
|
-
const textStyle = React16.useMemo(
|
|
456
|
+
const textStyle = React19.useMemo(
|
|
494
457
|
() => ({
|
|
495
458
|
color: tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary,
|
|
496
459
|
fontSize: tokens.typography.fontSizes["05"],
|
|
@@ -499,34 +462,11 @@ function Frame({
|
|
|
499
462
|
}),
|
|
500
463
|
[tokens, resolvedTheme, resolvedAppearance]
|
|
501
464
|
);
|
|
502
|
-
const wrappedChildren =
|
|
465
|
+
const wrappedChildren = React19.useMemo(
|
|
503
466
|
() => wrapTextChildren(children, textStyle),
|
|
504
467
|
[children, textStyle]
|
|
505
468
|
);
|
|
506
|
-
const content =
|
|
507
|
-
reactNative.Pressable,
|
|
508
|
-
{
|
|
509
|
-
ref,
|
|
510
|
-
testID,
|
|
511
|
-
nativeID,
|
|
512
|
-
pointerEvents,
|
|
513
|
-
accessibilityLabel,
|
|
514
|
-
accessibilityHint,
|
|
515
|
-
accessibilityState: disabled ? { disabled: true } : void 0,
|
|
516
|
-
onPress,
|
|
517
|
-
disabled,
|
|
518
|
-
...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
|
|
519
|
-
...webFocusProps,
|
|
520
|
-
style: ({ pressed }) => [
|
|
521
|
-
styles.container,
|
|
522
|
-
pressed && !disabled && styles.pressed,
|
|
523
|
-
focusRingStyle,
|
|
524
|
-
...webOverrides,
|
|
525
|
-
...userStyles
|
|
526
|
-
]
|
|
527
|
-
},
|
|
528
|
-
wrappedChildren
|
|
529
|
-
) : /* @__PURE__ */ React16__default.default.createElement(
|
|
469
|
+
const content = /* @__PURE__ */ React19__default.default.createElement(
|
|
530
470
|
reactNative.View,
|
|
531
471
|
{
|
|
532
472
|
ref,
|
|
@@ -535,12 +475,12 @@ function Frame({
|
|
|
535
475
|
pointerEvents,
|
|
536
476
|
accessibilityLabel,
|
|
537
477
|
accessibilityHint,
|
|
538
|
-
style: [
|
|
478
|
+
style: [styles3.container, ...webOverrides, ...userStyles]
|
|
539
479
|
},
|
|
540
480
|
wrappedChildren
|
|
541
481
|
);
|
|
542
|
-
const wrappedContent = schemeThemeCtx ? /* @__PURE__ */
|
|
543
|
-
return /* @__PURE__ */
|
|
482
|
+
const wrappedContent = schemeThemeCtx ? /* @__PURE__ */ React19__default.default.createElement(newtoneApi._ThemeContext.Provider, { value: schemeThemeCtx }, content) : content;
|
|
483
|
+
return /* @__PURE__ */ React19__default.default.createElement(newtoneApi.FrameContext.Provider, { value: contextValue }, wrappedContent);
|
|
544
484
|
}
|
|
545
485
|
function Icon({
|
|
546
486
|
name = "add",
|
|
@@ -560,7 +500,7 @@ function Icon({
|
|
|
560
500
|
const frameCtx = newtoneApi.useFrameContext();
|
|
561
501
|
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
562
502
|
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
563
|
-
const iconStyle =
|
|
503
|
+
const iconStyle = React19.useMemo(() => {
|
|
564
504
|
const fontSize = size ?? tokens.typography.fontSizes["05"];
|
|
565
505
|
const getOpticalSize = (size2) => {
|
|
566
506
|
if (size2 <= 22) return 20;
|
|
@@ -590,7 +530,7 @@ function Icon({
|
|
|
590
530
|
...style
|
|
591
531
|
};
|
|
592
532
|
}, [tokens, size, opticalSize, fill, color, style, resolvedTheme, resolvedAppearance]);
|
|
593
|
-
return /* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
594
534
|
reactNative.Text,
|
|
595
535
|
{
|
|
596
536
|
ref,
|
|
@@ -603,160 +543,7 @@ function Icon({
|
|
|
603
543
|
name
|
|
604
544
|
);
|
|
605
545
|
}
|
|
606
|
-
|
|
607
|
-
const {
|
|
608
|
-
tokens,
|
|
609
|
-
direction = "vertical",
|
|
610
|
-
wrap = false,
|
|
611
|
-
reverse = false,
|
|
612
|
-
align,
|
|
613
|
-
justify,
|
|
614
|
-
padding,
|
|
615
|
-
gap,
|
|
616
|
-
width,
|
|
617
|
-
height,
|
|
618
|
-
minWidth,
|
|
619
|
-
maxWidth,
|
|
620
|
-
minHeight,
|
|
621
|
-
maxHeight,
|
|
622
|
-
position,
|
|
623
|
-
top,
|
|
624
|
-
right,
|
|
625
|
-
bottom,
|
|
626
|
-
left,
|
|
627
|
-
zIndex,
|
|
628
|
-
overflow,
|
|
629
|
-
opacity
|
|
630
|
-
} = input;
|
|
631
|
-
const container = {};
|
|
632
|
-
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
633
|
-
if (wrap) container.flexWrap = "wrap";
|
|
634
|
-
if (align) container.alignItems = resolveAlignment(align);
|
|
635
|
-
if (justify) container.justifyContent = resolveJustification(justify);
|
|
636
|
-
if (padding !== void 0) {
|
|
637
|
-
const p = resolvePadding(padding, tokens);
|
|
638
|
-
container.paddingTop = p.top;
|
|
639
|
-
container.paddingRight = p.right;
|
|
640
|
-
container.paddingBottom = p.bottom;
|
|
641
|
-
container.paddingLeft = p.left;
|
|
642
|
-
}
|
|
643
|
-
if (gap !== void 0) {
|
|
644
|
-
const g = resolveGap(gap, tokens);
|
|
645
|
-
container.rowGap = g.rowGap;
|
|
646
|
-
container.columnGap = g.columnGap;
|
|
647
|
-
}
|
|
648
|
-
Object.assign(container, resolveSizing(width, height));
|
|
649
|
-
if (minWidth !== void 0) container.minWidth = minWidth;
|
|
650
|
-
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
651
|
-
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
652
|
-
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
653
|
-
if (position) container.position = position;
|
|
654
|
-
if (top !== void 0) container.top = top;
|
|
655
|
-
if (right !== void 0) container.right = right;
|
|
656
|
-
if (bottom !== void 0) container.bottom = bottom;
|
|
657
|
-
if (left !== void 0) container.left = left;
|
|
658
|
-
if (zIndex !== void 0) container.zIndex = zIndex;
|
|
659
|
-
if (overflow) container.overflow = overflow;
|
|
660
|
-
if (opacity !== void 0) container.opacity = opacity;
|
|
661
|
-
return reactNative.StyleSheet.create({ c: container }).c;
|
|
662
|
-
}
|
|
663
|
-
function Wrapper({
|
|
664
|
-
children,
|
|
665
|
-
direction,
|
|
666
|
-
wrap,
|
|
667
|
-
reverse,
|
|
668
|
-
align,
|
|
669
|
-
justify,
|
|
670
|
-
padding,
|
|
671
|
-
gap,
|
|
672
|
-
width,
|
|
673
|
-
height,
|
|
674
|
-
minWidth,
|
|
675
|
-
maxWidth,
|
|
676
|
-
minHeight,
|
|
677
|
-
maxHeight,
|
|
678
|
-
// Positioning
|
|
679
|
-
position,
|
|
680
|
-
top,
|
|
681
|
-
right,
|
|
682
|
-
bottom,
|
|
683
|
-
left,
|
|
684
|
-
zIndex,
|
|
685
|
-
overflow,
|
|
686
|
-
pointerEvents,
|
|
687
|
-
opacity,
|
|
688
|
-
style,
|
|
689
|
-
// Testing & platform
|
|
690
|
-
testID,
|
|
691
|
-
nativeID,
|
|
692
|
-
ref
|
|
693
|
-
}) {
|
|
694
|
-
const tokens = newtoneApi.useTokens();
|
|
695
|
-
const containerStyle = React16.useMemo(
|
|
696
|
-
() => getWrapperStyles({
|
|
697
|
-
tokens,
|
|
698
|
-
direction,
|
|
699
|
-
wrap,
|
|
700
|
-
reverse,
|
|
701
|
-
align,
|
|
702
|
-
justify,
|
|
703
|
-
padding,
|
|
704
|
-
gap,
|
|
705
|
-
width,
|
|
706
|
-
height,
|
|
707
|
-
minWidth,
|
|
708
|
-
maxWidth,
|
|
709
|
-
minHeight,
|
|
710
|
-
maxHeight,
|
|
711
|
-
position,
|
|
712
|
-
top,
|
|
713
|
-
right,
|
|
714
|
-
bottom,
|
|
715
|
-
left,
|
|
716
|
-
zIndex,
|
|
717
|
-
overflow,
|
|
718
|
-
opacity
|
|
719
|
-
}),
|
|
720
|
-
[
|
|
721
|
-
tokens,
|
|
722
|
-
direction,
|
|
723
|
-
wrap,
|
|
724
|
-
reverse,
|
|
725
|
-
align,
|
|
726
|
-
justify,
|
|
727
|
-
padding,
|
|
728
|
-
gap,
|
|
729
|
-
width,
|
|
730
|
-
height,
|
|
731
|
-
minWidth,
|
|
732
|
-
maxWidth,
|
|
733
|
-
minHeight,
|
|
734
|
-
maxHeight,
|
|
735
|
-
position,
|
|
736
|
-
top,
|
|
737
|
-
right,
|
|
738
|
-
bottom,
|
|
739
|
-
left,
|
|
740
|
-
zIndex,
|
|
741
|
-
overflow,
|
|
742
|
-
opacity
|
|
743
|
-
]
|
|
744
|
-
);
|
|
745
|
-
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
746
|
-
return /* @__PURE__ */ React16__default.default.createElement(
|
|
747
|
-
reactNative.View,
|
|
748
|
-
{
|
|
749
|
-
ref,
|
|
750
|
-
testID,
|
|
751
|
-
nativeID,
|
|
752
|
-
pointerEvents,
|
|
753
|
-
accessibilityRole: "none",
|
|
754
|
-
style: [containerStyle, ...userStyles]
|
|
755
|
-
},
|
|
756
|
-
children
|
|
757
|
-
);
|
|
758
|
-
}
|
|
759
|
-
var TextScopeContext = React16.createContext(null);
|
|
546
|
+
var TextScopeContext = React19.createContext(null);
|
|
760
547
|
var LARGE_TEXT_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
761
548
|
function resolveTextColor(color, tokens, theme = "primary", appearance = "main", role = "body") {
|
|
762
549
|
switch (color) {
|
|
@@ -766,10 +553,10 @@ function resolveTextColor(color, tokens, theme = "primary", appearance = "main",
|
|
|
766
553
|
return tokens.colors[theme][appearance].fontSecondary;
|
|
767
554
|
case "tertiary":
|
|
768
555
|
return tokens.colors[theme][appearance].fontTertiary;
|
|
769
|
-
case "disabled":
|
|
770
|
-
return tokens.colors[theme][appearance].fontDisabled;
|
|
771
556
|
case "accent":
|
|
772
557
|
return tokens.colors[theme][appearance][LARGE_TEXT_ROLES.has(role) ? "accentLarge" : "accentSmall"];
|
|
558
|
+
case "disabled":
|
|
559
|
+
return tokens.colors[theme][appearance].fontDisabled;
|
|
773
560
|
}
|
|
774
561
|
}
|
|
775
562
|
var ADAPTIVE_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
@@ -830,9 +617,9 @@ function TextBase({
|
|
|
830
617
|
calibrations[fontSlot.family]
|
|
831
618
|
);
|
|
832
619
|
const isAdaptive = ADAPTIVE_ROLES.has(role);
|
|
833
|
-
const [containerWidth, setContainerWidth] =
|
|
834
|
-
const characterCount =
|
|
835
|
-
const resolvedStep =
|
|
620
|
+
const [containerWidth, setContainerWidth] = React19.useState(null);
|
|
621
|
+
const characterCount = React19.useMemo(() => extractCharacterCount(children), [children]);
|
|
622
|
+
const resolvedStep = React19.useMemo(
|
|
836
623
|
() => fonts.resolveResponsiveSize(
|
|
837
624
|
{
|
|
838
625
|
role,
|
|
@@ -849,7 +636,7 @@ function TextBase({
|
|
|
849
636
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
850
637
|
[role, size, responsive, isAdaptive, fontSlot.family, step.fontSize, config.typography.roles, containerWidth, characterCount, localRatio]
|
|
851
638
|
);
|
|
852
|
-
|
|
639
|
+
React19.useEffect(() => {
|
|
853
640
|
if (!reportingEndpoint || !responsive || !isAdaptive || containerWidth == null) return;
|
|
854
641
|
const lineWidths = fonts.estimateLineWidths(characterCount, containerWidth, resolvedStep.fontSize, localRatio);
|
|
855
642
|
const lastLine = lineWidths[lineWidths.length - 1];
|
|
@@ -865,7 +652,7 @@ function TextBase({
|
|
|
865
652
|
lastLineRatio: containerWidth > 0 ? lastLine / containerWidth : 1
|
|
866
653
|
});
|
|
867
654
|
}, [reportingEndpoint, resolvedStep.fontSize, containerWidth]);
|
|
868
|
-
const resolvedStyle =
|
|
655
|
+
const resolvedStyle = React19.useMemo(() => {
|
|
869
656
|
const activeStep = responsive && isAdaptive ? resolvedStep : step;
|
|
870
657
|
const currentMetrics = config.typography.fontMetrics?.[fontSlot.family];
|
|
871
658
|
const correctedLineHeight = currentMetrics ? Math.round(activeStep.lineHeight * currentMetrics.naturalLineHeightRatio / fonts.REFERENCE_LINE_HEIGHT_RATIO / 4) * 4 : activeStep.lineHeight;
|
|
@@ -886,8 +673,8 @@ function TextBase({
|
|
|
886
673
|
const inferredA11yRole = role === "headline" || role === "title" || role === "heading" ? "header" : void 0;
|
|
887
674
|
const effectiveA11yRole = accessibilityRoleOverride ?? inferredA11yRole;
|
|
888
675
|
const ariaLevel = effectiveA11yRole === "header" ? ROLE_HEADING_LEVEL[role] : void 0;
|
|
889
|
-
const scopeCtx =
|
|
890
|
-
const textNode = /* @__PURE__ */
|
|
676
|
+
const scopeCtx = React19.useMemo(() => ({ weights: fonts.SEMANTIC_WEIGHT_MAP }), []);
|
|
677
|
+
const textNode = /* @__PURE__ */ React19__default.default.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React19__default.default.createElement(
|
|
891
678
|
reactNative.Text,
|
|
892
679
|
{
|
|
893
680
|
ref,
|
|
@@ -901,7 +688,7 @@ function TextBase({
|
|
|
901
688
|
children
|
|
902
689
|
));
|
|
903
690
|
if (responsive && isAdaptive) {
|
|
904
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
905
692
|
reactNative.View,
|
|
906
693
|
{
|
|
907
694
|
onLayout: (e) => {
|
|
@@ -917,11 +704,11 @@ function TextBase({
|
|
|
917
704
|
}
|
|
918
705
|
function TextSpan({ children, color, weight, italic, underline, highlight, style }) {
|
|
919
706
|
const tokens = newtoneApi.useTokens();
|
|
920
|
-
const scopeCtx =
|
|
707
|
+
const scopeCtx = React19.useContext(TextScopeContext);
|
|
921
708
|
const frameCtx = newtoneApi.useFrameContext();
|
|
922
709
|
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
923
710
|
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
924
|
-
const spanStyle =
|
|
711
|
+
const spanStyle = React19.useMemo(() => {
|
|
925
712
|
const s = {};
|
|
926
713
|
if (color) s.color = resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance);
|
|
927
714
|
if (weight && scopeCtx) s.fontWeight = String(scopeCtx.weights[weight]);
|
|
@@ -930,26 +717,26 @@ function TextSpan({ children, color, weight, italic, underline, highlight, style
|
|
|
930
717
|
if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens, resolvedTheme, resolvedAppearance);
|
|
931
718
|
return s;
|
|
932
719
|
}, [tokens, scopeCtx, color, weight, italic, underline, highlight, resolvedTheme, resolvedAppearance]);
|
|
933
|
-
return
|
|
720
|
+
return React19__default.default.createElement(
|
|
934
721
|
reactNative.Text,
|
|
935
722
|
{ style: style ? [spanStyle, ...Array.isArray(style) ? style : [style]] : spanStyle },
|
|
936
723
|
children
|
|
937
724
|
);
|
|
938
725
|
}
|
|
939
726
|
function TextBold(props) {
|
|
940
|
-
return
|
|
727
|
+
return React19__default.default.createElement(TextSpan, { ...props, weight: "bold" });
|
|
941
728
|
}
|
|
942
729
|
function TextMedium(props) {
|
|
943
|
-
return
|
|
730
|
+
return React19__default.default.createElement(TextSpan, { ...props, weight: "medium" });
|
|
944
731
|
}
|
|
945
732
|
function TextItalic(props) {
|
|
946
|
-
return
|
|
733
|
+
return React19__default.default.createElement(TextSpan, { ...props, italic: true });
|
|
947
734
|
}
|
|
948
735
|
function TextUnderline(props) {
|
|
949
|
-
return
|
|
736
|
+
return React19__default.default.createElement(TextSpan, { ...props, underline: true });
|
|
950
737
|
}
|
|
951
738
|
function TextHighlight(props) {
|
|
952
|
-
return
|
|
739
|
+
return React19__default.default.createElement(TextSpan, props);
|
|
953
740
|
}
|
|
954
741
|
|
|
955
742
|
// src/primitives/Text/index.ts
|
|
@@ -961,51 +748,349 @@ var Text3 = Object.assign(TextBase, {
|
|
|
961
748
|
Underline: TextUnderline,
|
|
962
749
|
Highlight: TextHighlight
|
|
963
750
|
});
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
lg: 20,
|
|
977
|
-
xl: 24
|
|
978
|
-
};
|
|
979
|
-
const base = basePadding[size];
|
|
980
|
-
const textExtra = 8;
|
|
981
|
-
if (!hasText && hasIcon) {
|
|
982
|
-
return { paddingLeft: base, paddingRight: base };
|
|
983
|
-
}
|
|
984
|
-
if (hasText && !hasIcon) {
|
|
985
|
-
return { paddingLeft: base + textExtra, paddingRight: base + textExtra };
|
|
751
|
+
var styles = reactNative.StyleSheet.create({
|
|
752
|
+
root: {
|
|
753
|
+
flex: 1,
|
|
754
|
+
flexDirection: "column",
|
|
755
|
+
...reactNative.Platform.OS === "web" ? { minHeight: "100vh" } : {}
|
|
756
|
+
},
|
|
757
|
+
body: {
|
|
758
|
+
flex: 1,
|
|
759
|
+
flexDirection: "row"
|
|
760
|
+
},
|
|
761
|
+
content: {
|
|
762
|
+
flex: 1
|
|
986
763
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
764
|
+
});
|
|
765
|
+
function Page({
|
|
766
|
+
children,
|
|
767
|
+
scheme,
|
|
768
|
+
navbar,
|
|
769
|
+
sidebar,
|
|
770
|
+
testID,
|
|
771
|
+
nativeID,
|
|
772
|
+
ref,
|
|
773
|
+
style
|
|
774
|
+
}) {
|
|
775
|
+
const themeCtx = newtoneApi.useNewtoneTheme();
|
|
776
|
+
const schemeThemeCtx = React19.useMemo(() => {
|
|
777
|
+
if (!scheme || !themeCtx.schemes) return null;
|
|
778
|
+
const schemeConfig = themeCtx.schemes[scheme];
|
|
779
|
+
if (!schemeConfig || schemeConfig === themeCtx.config) return null;
|
|
780
|
+
return {
|
|
781
|
+
...themeCtx,
|
|
782
|
+
config: schemeConfig,
|
|
783
|
+
activeScheme: scheme
|
|
784
|
+
};
|
|
785
|
+
}, [scheme, themeCtx]);
|
|
786
|
+
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
787
|
+
const content = /* @__PURE__ */ React19__default.default.createElement(
|
|
788
|
+
reactNative.View,
|
|
789
|
+
{
|
|
790
|
+
ref,
|
|
791
|
+
testID,
|
|
792
|
+
nativeID,
|
|
793
|
+
accessibilityRole: "none",
|
|
794
|
+
style: [styles.root, ...userStyles]
|
|
795
|
+
},
|
|
796
|
+
navbar,
|
|
797
|
+
sidebar ? /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles.body }, sidebar, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles.content }, children)) : children
|
|
798
|
+
);
|
|
799
|
+
if (schemeThemeCtx) {
|
|
800
|
+
return /* @__PURE__ */ React19__default.default.createElement(newtoneApi._ThemeContext.Provider, { value: schemeThemeCtx }, content);
|
|
993
801
|
}
|
|
994
|
-
return
|
|
802
|
+
return content;
|
|
995
803
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
804
|
+
var styles2 = reactNative.StyleSheet.create({
|
|
805
|
+
root: {
|
|
806
|
+
flex: 1
|
|
807
|
+
},
|
|
808
|
+
content: {
|
|
809
|
+
flexGrow: 1
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
function Viewport({
|
|
813
|
+
children,
|
|
814
|
+
testID,
|
|
815
|
+
nativeID,
|
|
816
|
+
ref,
|
|
817
|
+
style
|
|
818
|
+
}) {
|
|
819
|
+
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
820
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
821
|
+
reactNative.ScrollView,
|
|
822
|
+
{
|
|
823
|
+
ref,
|
|
824
|
+
testID,
|
|
825
|
+
nativeID,
|
|
826
|
+
style: styles2.root,
|
|
827
|
+
contentContainerStyle: [styles2.content, ...userStyles]
|
|
828
|
+
},
|
|
829
|
+
children
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
function getWrapperStyles(input) {
|
|
833
|
+
const {
|
|
834
|
+
tokens,
|
|
835
|
+
direction = "vertical",
|
|
836
|
+
wrap = false,
|
|
837
|
+
reverse = false,
|
|
838
|
+
align,
|
|
839
|
+
justify,
|
|
840
|
+
padding,
|
|
841
|
+
gap,
|
|
842
|
+
width,
|
|
843
|
+
height,
|
|
844
|
+
minWidth,
|
|
845
|
+
maxWidth,
|
|
846
|
+
minHeight,
|
|
847
|
+
maxHeight,
|
|
848
|
+
position,
|
|
849
|
+
top,
|
|
850
|
+
right,
|
|
851
|
+
bottom,
|
|
852
|
+
left,
|
|
853
|
+
zIndex,
|
|
854
|
+
overflow
|
|
855
|
+
} = input;
|
|
856
|
+
const container = {};
|
|
857
|
+
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
858
|
+
if (wrap) container.flexWrap = "wrap";
|
|
859
|
+
if (align) container.alignItems = resolveAlignment(align);
|
|
860
|
+
if (justify) container.justifyContent = resolveJustification(justify);
|
|
861
|
+
if (padding !== void 0) {
|
|
862
|
+
const p = resolvePadding(padding, tokens);
|
|
863
|
+
container.paddingTop = p.top;
|
|
864
|
+
container.paddingRight = p.right;
|
|
865
|
+
container.paddingBottom = p.bottom;
|
|
866
|
+
container.paddingLeft = p.left;
|
|
867
|
+
}
|
|
868
|
+
if (gap !== void 0) {
|
|
869
|
+
const g = resolveGap(gap, tokens);
|
|
870
|
+
container.rowGap = g.rowGap;
|
|
871
|
+
container.columnGap = g.columnGap;
|
|
872
|
+
}
|
|
873
|
+
Object.assign(container, resolveSizing(width, height));
|
|
874
|
+
if (minWidth !== void 0) container.minWidth = minWidth;
|
|
875
|
+
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
876
|
+
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
877
|
+
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
878
|
+
if (position) container.position = position;
|
|
879
|
+
if (top !== void 0) container.top = top;
|
|
880
|
+
if (right !== void 0) container.right = right;
|
|
881
|
+
if (bottom !== void 0) container.bottom = bottom;
|
|
882
|
+
if (left !== void 0) container.left = left;
|
|
883
|
+
if (zIndex !== void 0) container.zIndex = zIndex;
|
|
884
|
+
if (overflow) container.overflow = overflow;
|
|
885
|
+
return reactNative.StyleSheet.create({ c: container }).c;
|
|
886
|
+
}
|
|
887
|
+
function Wrapper({
|
|
888
|
+
children,
|
|
889
|
+
direction,
|
|
890
|
+
wrap,
|
|
891
|
+
reverse,
|
|
892
|
+
align,
|
|
893
|
+
justify,
|
|
894
|
+
padding,
|
|
895
|
+
gap,
|
|
896
|
+
width,
|
|
897
|
+
height,
|
|
898
|
+
minWidth,
|
|
899
|
+
maxWidth,
|
|
900
|
+
minHeight,
|
|
901
|
+
maxHeight,
|
|
902
|
+
position,
|
|
903
|
+
top,
|
|
904
|
+
right,
|
|
905
|
+
bottom,
|
|
906
|
+
left,
|
|
907
|
+
zIndex,
|
|
908
|
+
overflow,
|
|
909
|
+
pointerEvents,
|
|
910
|
+
style,
|
|
911
|
+
testID,
|
|
912
|
+
nativeID,
|
|
913
|
+
ref
|
|
914
|
+
}) {
|
|
915
|
+
const tokens = newtoneApi.useTokens();
|
|
916
|
+
const containerStyle = React19.useMemo(
|
|
917
|
+
() => getWrapperStyles({
|
|
918
|
+
tokens,
|
|
919
|
+
direction,
|
|
920
|
+
wrap,
|
|
921
|
+
reverse,
|
|
922
|
+
align,
|
|
923
|
+
justify,
|
|
924
|
+
padding,
|
|
925
|
+
gap,
|
|
926
|
+
width,
|
|
927
|
+
height,
|
|
928
|
+
minWidth,
|
|
929
|
+
maxWidth,
|
|
930
|
+
minHeight,
|
|
931
|
+
maxHeight,
|
|
932
|
+
position,
|
|
933
|
+
top,
|
|
934
|
+
right,
|
|
935
|
+
bottom,
|
|
936
|
+
left,
|
|
937
|
+
zIndex,
|
|
938
|
+
overflow
|
|
939
|
+
}),
|
|
940
|
+
[
|
|
941
|
+
tokens,
|
|
942
|
+
direction,
|
|
943
|
+
wrap,
|
|
944
|
+
reverse,
|
|
945
|
+
align,
|
|
946
|
+
justify,
|
|
947
|
+
padding,
|
|
948
|
+
gap,
|
|
949
|
+
width,
|
|
950
|
+
height,
|
|
951
|
+
minWidth,
|
|
952
|
+
maxWidth,
|
|
953
|
+
minHeight,
|
|
954
|
+
maxHeight,
|
|
955
|
+
position,
|
|
956
|
+
top,
|
|
957
|
+
right,
|
|
958
|
+
bottom,
|
|
959
|
+
left,
|
|
960
|
+
zIndex,
|
|
961
|
+
overflow
|
|
962
|
+
]
|
|
963
|
+
);
|
|
964
|
+
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
965
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
966
|
+
reactNative.View,
|
|
967
|
+
{
|
|
968
|
+
ref,
|
|
969
|
+
testID,
|
|
970
|
+
nativeID,
|
|
971
|
+
pointerEvents,
|
|
972
|
+
accessibilityRole: "none",
|
|
973
|
+
style: [containerStyle, ...userStyles]
|
|
974
|
+
},
|
|
975
|
+
children
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
var SIZE_PRESETS = {
|
|
979
|
+
xs: { maxWidth: 480, paddingHorizontal: 24 },
|
|
980
|
+
sm: { maxWidth: 640, paddingHorizontal: 24 },
|
|
981
|
+
md: { maxWidth: 768, paddingHorizontal: 24 },
|
|
982
|
+
lg: { maxWidth: 1024, paddingHorizontal: 32 },
|
|
983
|
+
xl: { maxWidth: 1280, paddingHorizontal: 40 },
|
|
984
|
+
full: { maxWidth: void 0, paddingHorizontal: 0 }
|
|
985
|
+
};
|
|
986
|
+
function getSectionStyles(input) {
|
|
987
|
+
const {
|
|
988
|
+
tokens,
|
|
989
|
+
size = "lg",
|
|
990
|
+
fill,
|
|
991
|
+
gap,
|
|
992
|
+
padding
|
|
993
|
+
} = input;
|
|
994
|
+
const preset = SIZE_PRESETS[size];
|
|
995
|
+
const container = {};
|
|
996
|
+
container.width = "100%";
|
|
997
|
+
container.flexDirection = "column";
|
|
998
|
+
if (fill) {
|
|
999
|
+
container.flex = 1;
|
|
1000
|
+
}
|
|
1001
|
+
if (preset.maxWidth !== void 0) {
|
|
1002
|
+
container.maxWidth = preset.maxWidth;
|
|
1003
|
+
container.marginLeft = "auto";
|
|
1004
|
+
container.marginRight = "auto";
|
|
1005
|
+
}
|
|
1006
|
+
container.paddingLeft = preset.paddingHorizontal;
|
|
1007
|
+
container.paddingRight = preset.paddingHorizontal;
|
|
1008
|
+
if (padding !== void 0) {
|
|
1009
|
+
const p = resolvePadding(padding, tokens);
|
|
1010
|
+
container.paddingTop = p.top;
|
|
1011
|
+
container.paddingBottom = p.bottom;
|
|
1012
|
+
}
|
|
1013
|
+
if (gap !== void 0) {
|
|
1014
|
+
const g = resolveGap(gap, tokens);
|
|
1015
|
+
container.rowGap = g.rowGap;
|
|
1016
|
+
container.columnGap = g.columnGap;
|
|
1017
|
+
}
|
|
1018
|
+
return reactNative.StyleSheet.create({ c: container }).c;
|
|
1019
|
+
}
|
|
1020
|
+
function Section({
|
|
1021
|
+
children,
|
|
1022
|
+
size,
|
|
1023
|
+
fill,
|
|
1024
|
+
gap,
|
|
1025
|
+
padding,
|
|
1026
|
+
testID,
|
|
1027
|
+
nativeID,
|
|
1028
|
+
ref,
|
|
1029
|
+
style
|
|
1030
|
+
}) {
|
|
1031
|
+
const tokens = newtoneApi.useTokens();
|
|
1032
|
+
const containerStyle = React19.useMemo(
|
|
1033
|
+
() => getSectionStyles({ tokens, size, fill, gap, padding }),
|
|
1034
|
+
[tokens, size, fill, gap, padding]
|
|
1035
|
+
);
|
|
1036
|
+
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
1037
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
1038
|
+
reactNative.View,
|
|
1039
|
+
{
|
|
1040
|
+
ref,
|
|
1041
|
+
testID,
|
|
1042
|
+
nativeID,
|
|
1043
|
+
accessibilityRole: "none",
|
|
1044
|
+
style: [containerStyle, ...userStyles]
|
|
1045
|
+
},
|
|
1046
|
+
children
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// src/composites/actions/Button/Button.styles.ts
|
|
1051
|
+
var BUTTON_HEIGHTS = {
|
|
1052
|
+
sm: 40,
|
|
1053
|
+
md: 48,
|
|
1054
|
+
lg: 56,
|
|
1055
|
+
xl: 64
|
|
1056
|
+
};
|
|
1057
|
+
function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
|
|
1058
|
+
const basePadding = {
|
|
1059
|
+
sm: 12,
|
|
1060
|
+
md: 16,
|
|
1061
|
+
lg: 20,
|
|
1062
|
+
xl: 24
|
|
1063
|
+
};
|
|
1064
|
+
const base = basePadding[size];
|
|
1065
|
+
const textExtra = 8;
|
|
1066
|
+
if (!hasText && hasIcon) {
|
|
1067
|
+
return { paddingLeft: base, paddingRight: base };
|
|
1068
|
+
}
|
|
1069
|
+
if (hasText && !hasIcon) {
|
|
1070
|
+
return { paddingLeft: base + textExtra, paddingRight: base + textExtra };
|
|
1071
|
+
}
|
|
1072
|
+
if (hasText && hasIcon) {
|
|
1073
|
+
if (iconPosition === "left") {
|
|
1074
|
+
return { paddingLeft: base, paddingRight: base + textExtra };
|
|
1075
|
+
} else {
|
|
1076
|
+
return { paddingLeft: base + textExtra, paddingRight: base };
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
return { paddingLeft: base, paddingRight: base };
|
|
1080
|
+
}
|
|
1081
|
+
function getButtonConfig(variant, size, disabled, tokens, theme) {
|
|
1082
|
+
const sizeConfig = getSizeConfig(size, tokens);
|
|
1083
|
+
const variantColors = getVariantColors(variant, disabled, tokens, theme);
|
|
1084
|
+
return {
|
|
1085
|
+
variantColors,
|
|
1086
|
+
sizeTokens: {
|
|
1087
|
+
height: sizeConfig.height,
|
|
1088
|
+
padding: sizeConfig.padding,
|
|
1089
|
+
gap: sizeConfig.gap,
|
|
1090
|
+
borderRadius: sizeConfig.borderRadius,
|
|
1091
|
+
textSize: sizeConfig.textSize,
|
|
1092
|
+
iconSize: sizeConfig.iconSize
|
|
1093
|
+
}
|
|
1009
1094
|
};
|
|
1010
1095
|
}
|
|
1011
1096
|
function getSizeConfig(size, tokens) {
|
|
@@ -1046,19 +1131,8 @@ function getSizeConfig(size, tokens) {
|
|
|
1046
1131
|
return configs[size];
|
|
1047
1132
|
}
|
|
1048
1133
|
function getVariantColors(variant, disabled, tokens, theme) {
|
|
1049
|
-
const t = tokens.colors[theme];
|
|
1050
1134
|
if (disabled) {
|
|
1051
|
-
|
|
1052
|
-
return {
|
|
1053
|
-
...baseColors,
|
|
1054
|
-
bg: "transparent",
|
|
1055
|
-
hoveredBg: "transparent",
|
|
1056
|
-
pressedBg: "transparent",
|
|
1057
|
-
textColor: t.main.fontDisabled,
|
|
1058
|
-
iconColor: t.main.fontDisabled,
|
|
1059
|
-
borderWidth: 1,
|
|
1060
|
-
borderColor: t.main.divider
|
|
1061
|
-
};
|
|
1135
|
+
return getDisabledVariantColors(variant, tokens, theme);
|
|
1062
1136
|
}
|
|
1063
1137
|
return getVariantColorsForState(variant, tokens, theme);
|
|
1064
1138
|
}
|
|
@@ -1077,11 +1151,11 @@ function getVariantColorsForState(variant, tokens, theme) {
|
|
|
1077
1151
|
}
|
|
1078
1152
|
if (variant === "secondary") {
|
|
1079
1153
|
return {
|
|
1080
|
-
bg: t.
|
|
1081
|
-
hoveredBg: t.
|
|
1082
|
-
pressedBg: t.
|
|
1083
|
-
textColor: t.
|
|
1084
|
-
iconColor: t.
|
|
1154
|
+
bg: t.tinted.actionEnabled,
|
|
1155
|
+
hoveredBg: t.tinted.actionHovered,
|
|
1156
|
+
pressedBg: t.tinted.actionPressed,
|
|
1157
|
+
textColor: t.tinted.fontPrimary,
|
|
1158
|
+
iconColor: t.tinted.fontPrimary,
|
|
1085
1159
|
borderWidth: 0,
|
|
1086
1160
|
borderColor: "transparent"
|
|
1087
1161
|
};
|
|
@@ -1093,6 +1167,41 @@ function getVariantColorsForState(variant, tokens, theme) {
|
|
|
1093
1167
|
textColor: t.main.fontSecondary,
|
|
1094
1168
|
iconColor: t.main.fontSecondary,
|
|
1095
1169
|
borderWidth: 0,
|
|
1170
|
+
borderColor: "transparent",
|
|
1171
|
+
textDecoration: "underline"
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
function getDisabledVariantColors(variant, tokens, theme) {
|
|
1175
|
+
const t = tokens.colors[theme];
|
|
1176
|
+
if (variant === "primary") {
|
|
1177
|
+
return {
|
|
1178
|
+
bg: t.main.actionEnabled,
|
|
1179
|
+
hoveredBg: t.main.actionEnabled,
|
|
1180
|
+
pressedBg: t.main.actionEnabled,
|
|
1181
|
+
textColor: t.main.fontDisabled,
|
|
1182
|
+
iconColor: t.main.fontDisabled,
|
|
1183
|
+
borderWidth: 0,
|
|
1184
|
+
borderColor: "transparent"
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
if (variant === "secondary") {
|
|
1188
|
+
return {
|
|
1189
|
+
bg: "transparent",
|
|
1190
|
+
hoveredBg: "transparent",
|
|
1191
|
+
pressedBg: "transparent",
|
|
1192
|
+
textColor: t.main.fontDisabled,
|
|
1193
|
+
iconColor: t.main.fontDisabled,
|
|
1194
|
+
borderWidth: 1,
|
|
1195
|
+
borderColor: t.main.divider
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
return {
|
|
1199
|
+
bg: "transparent",
|
|
1200
|
+
hoveredBg: "transparent",
|
|
1201
|
+
pressedBg: "transparent",
|
|
1202
|
+
textColor: t.main.fontDisabled,
|
|
1203
|
+
iconColor: t.main.fontDisabled,
|
|
1204
|
+
borderWidth: 0,
|
|
1096
1205
|
borderColor: "transparent"
|
|
1097
1206
|
};
|
|
1098
1207
|
}
|
|
@@ -1112,16 +1221,29 @@ function Button({
|
|
|
1112
1221
|
const tokens = newtoneApi.useTokens();
|
|
1113
1222
|
const frameCtx = newtoneApi.useFrameContext();
|
|
1114
1223
|
const theme = frameCtx?.theme ?? "primary";
|
|
1224
|
+
if (typeof window !== "undefined") {
|
|
1225
|
+
console.log("[Button]", { theme, variant, frameCtxTheme: frameCtx?.theme, hasFrameCtx: !!frameCtx });
|
|
1226
|
+
if (tokens.colors[theme]) {
|
|
1227
|
+
const t = tokens.colors[theme];
|
|
1228
|
+
console.log("[Button tokens]", {
|
|
1229
|
+
"emphasis.actionEnabled": t.emphasis.actionEnabled,
|
|
1230
|
+
"main.actionEnabled": t.main.actionEnabled,
|
|
1231
|
+
"main.background": t.main.background
|
|
1232
|
+
});
|
|
1233
|
+
} else {
|
|
1234
|
+
console.log("[Button] NO tokens for theme:", theme, "available themes:", Object.keys(tokens.colors));
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1115
1237
|
const isDisabled = disabled || loading;
|
|
1116
|
-
const { variantColors, sizeTokens } =
|
|
1238
|
+
const { variantColors, sizeTokens } = React19__default.default.useMemo(
|
|
1117
1239
|
() => getButtonConfig(variant, size, isDisabled, tokens, theme),
|
|
1118
1240
|
[variant, size, isDisabled, tokens, theme]
|
|
1119
1241
|
);
|
|
1120
|
-
const padding =
|
|
1242
|
+
const padding = React19__default.default.useMemo(
|
|
1121
1243
|
() => computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
1122
1244
|
[size, icon, children, iconPosition]
|
|
1123
1245
|
);
|
|
1124
|
-
return /* @__PURE__ */
|
|
1246
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.Pressable, { disabled: isDisabled, ...pressableProps }, ({ pressed, hovered }) => /* @__PURE__ */ React19__default.default.createElement(
|
|
1125
1247
|
Wrapper,
|
|
1126
1248
|
{
|
|
1127
1249
|
direction: "horizontal",
|
|
@@ -1137,57 +1259,270 @@ function Button({
|
|
|
1137
1259
|
borderRadius: sizeTokens.borderRadius,
|
|
1138
1260
|
borderWidth: variantColors.borderWidth,
|
|
1139
1261
|
borderColor: variantColors.borderColor || "transparent",
|
|
1140
|
-
opacity:
|
|
1262
|
+
opacity: loading ? 0.6 : 1,
|
|
1141
1263
|
...fullWidth && { width: "100%", alignSelf: "stretch" }
|
|
1142
1264
|
},
|
|
1143
1265
|
...Array.isArray(style) ? style : style ? [style] : []
|
|
1144
1266
|
]
|
|
1145
1267
|
},
|
|
1146
|
-
icon && iconPosition === "left" && /* @__PURE__ */
|
|
1147
|
-
children && /* @__PURE__ */
|
|
1268
|
+
icon && iconPosition === "left" && /* @__PURE__ */ React19__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
|
|
1269
|
+
children && /* @__PURE__ */ React19__default.default.createElement(
|
|
1148
1270
|
Text3,
|
|
1149
1271
|
{
|
|
1150
1272
|
role: "label",
|
|
1151
1273
|
size: sizeTokens.textSize,
|
|
1152
1274
|
centerVertically: true,
|
|
1153
1275
|
style: [
|
|
1154
|
-
{ color: variantColors.textColor },
|
|
1276
|
+
{ color: variantColors.textColor, textDecorationLine: variantColors.textDecoration },
|
|
1155
1277
|
...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
|
|
1156
1278
|
]
|
|
1157
1279
|
},
|
|
1158
1280
|
children
|
|
1159
1281
|
),
|
|
1160
|
-
icon && iconPosition === "right" && /* @__PURE__ */
|
|
1282
|
+
icon && iconPosition === "right" && /* @__PURE__ */ React19__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
|
|
1161
1283
|
));
|
|
1162
1284
|
}
|
|
1163
|
-
function getCardStyles(
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1285
|
+
function getCardStyles(input) {
|
|
1286
|
+
const {
|
|
1287
|
+
tokens,
|
|
1288
|
+
theme,
|
|
1289
|
+
appearance = "main",
|
|
1290
|
+
direction = "vertical",
|
|
1291
|
+
wrap = false,
|
|
1292
|
+
reverse = false,
|
|
1293
|
+
align,
|
|
1294
|
+
justify,
|
|
1295
|
+
padding,
|
|
1296
|
+
gap,
|
|
1297
|
+
width,
|
|
1298
|
+
height,
|
|
1299
|
+
minWidth,
|
|
1300
|
+
maxWidth,
|
|
1301
|
+
minHeight,
|
|
1302
|
+
maxHeight,
|
|
1303
|
+
radius,
|
|
1304
|
+
disabled = false
|
|
1305
|
+
} = input;
|
|
1306
|
+
const container = {};
|
|
1307
|
+
const appearanceTokens = tokens.colors[theme][appearance];
|
|
1308
|
+
container.backgroundColor = appearanceTokens.background;
|
|
1309
|
+
container.color = appearanceTokens.fontPrimary;
|
|
1310
|
+
container.display = "flex";
|
|
1311
|
+
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
1312
|
+
if (wrap) container.flexWrap = "wrap";
|
|
1313
|
+
if (align) container.alignItems = resolveAlignment(align);
|
|
1314
|
+
if (justify) container.justifyContent = resolveJustification(justify);
|
|
1315
|
+
if (padding !== void 0) {
|
|
1316
|
+
const p = resolvePadding(padding, tokens);
|
|
1317
|
+
container.paddingTop = p.top;
|
|
1318
|
+
container.paddingRight = p.right;
|
|
1319
|
+
container.paddingBottom = p.bottom;
|
|
1320
|
+
container.paddingLeft = p.left;
|
|
1321
|
+
}
|
|
1322
|
+
if (gap !== void 0) {
|
|
1323
|
+
const g = resolveGap(gap, tokens);
|
|
1324
|
+
container.rowGap = g.rowGap;
|
|
1325
|
+
container.columnGap = g.columnGap;
|
|
1326
|
+
}
|
|
1327
|
+
Object.assign(container, resolveSizing(width, height));
|
|
1328
|
+
if (minWidth !== void 0) container.minWidth = minWidth;
|
|
1329
|
+
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
1330
|
+
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
1331
|
+
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
1332
|
+
if (radius !== void 0) {
|
|
1333
|
+
const corners = resolveRadiusCorners(radius, tokens);
|
|
1334
|
+
container.borderTopLeftRadius = corners.topLeft;
|
|
1335
|
+
container.borderTopRightRadius = corners.topRight;
|
|
1336
|
+
container.borderBottomLeftRadius = corners.bottomLeft;
|
|
1337
|
+
container.borderBottomRightRadius = corners.bottomRight;
|
|
1338
|
+
if (hasPositiveRadius(corners)) {
|
|
1339
|
+
container.overflow = "hidden";
|
|
1173
1340
|
}
|
|
1174
|
-
}
|
|
1341
|
+
}
|
|
1342
|
+
container.borderWidth = 1;
|
|
1343
|
+
container.borderColor = appearanceTokens.divider;
|
|
1344
|
+
container.shadowColor = "#000";
|
|
1345
|
+
container.shadowOffset = { width: 0, height: 2 };
|
|
1346
|
+
container.shadowOpacity = 0.12;
|
|
1347
|
+
container.shadowRadius = 6;
|
|
1348
|
+
container.elevation = 4;
|
|
1349
|
+
if (disabled) {
|
|
1350
|
+
container.opacity = 0.5;
|
|
1351
|
+
}
|
|
1352
|
+
const pressed = reactNative.StyleSheet.create({
|
|
1353
|
+
s: { backgroundColor: appearanceTokens.fontSecondary }
|
|
1354
|
+
}).s;
|
|
1355
|
+
return {
|
|
1356
|
+
container: reactNative.StyleSheet.create({ c: container }).c,
|
|
1357
|
+
pressed
|
|
1358
|
+
};
|
|
1175
1359
|
}
|
|
1176
1360
|
|
|
1177
|
-
// src/
|
|
1361
|
+
// src/primitives/Card/Card.tsx
|
|
1362
|
+
function wrapTextChildren2(children, textStyle) {
|
|
1363
|
+
return React19__default.default.Children.map(children, (child) => {
|
|
1364
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
1365
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: textStyle }, child);
|
|
1366
|
+
}
|
|
1367
|
+
return child;
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
var CARD_ELEVATION = 2;
|
|
1371
|
+
var CARD_ELEVATION_NAME = "elevated";
|
|
1178
1372
|
function Card({
|
|
1179
1373
|
children,
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1374
|
+
// Appearance
|
|
1375
|
+
appearance,
|
|
1376
|
+
radius,
|
|
1377
|
+
// Layout
|
|
1378
|
+
direction,
|
|
1379
|
+
wrap,
|
|
1380
|
+
reverse,
|
|
1381
|
+
// Alignment
|
|
1382
|
+
align,
|
|
1383
|
+
justify,
|
|
1384
|
+
// Spacing
|
|
1385
|
+
padding,
|
|
1386
|
+
gap,
|
|
1387
|
+
// Sizing
|
|
1388
|
+
width,
|
|
1389
|
+
height,
|
|
1390
|
+
minWidth,
|
|
1391
|
+
maxWidth,
|
|
1392
|
+
minHeight,
|
|
1393
|
+
maxHeight,
|
|
1394
|
+
// Positioning
|
|
1395
|
+
pointerEvents,
|
|
1396
|
+
// Interactivity
|
|
1397
|
+
onPress,
|
|
1398
|
+
href,
|
|
1399
|
+
disabled = false,
|
|
1400
|
+
// Accessibility
|
|
1401
|
+
accessibilityLabel,
|
|
1402
|
+
accessibilityHint,
|
|
1403
|
+
// Testing & platform
|
|
1404
|
+
testID,
|
|
1405
|
+
nativeID,
|
|
1406
|
+
ref,
|
|
1407
|
+
// Style override
|
|
1408
|
+
style
|
|
1183
1409
|
}) {
|
|
1184
|
-
const
|
|
1185
|
-
const
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1188
|
-
|
|
1410
|
+
const themeCtx = newtoneApi.useNewtoneTheme();
|
|
1411
|
+
const { mode, gamut } = themeCtx;
|
|
1412
|
+
const parentFrameCtx = newtoneApi.useFrameContext();
|
|
1413
|
+
const resolvedTheme = parentFrameCtx?.theme ?? "primary";
|
|
1414
|
+
const resolvedAppearance = appearance ?? parentFrameCtx?.appearance ?? "main";
|
|
1415
|
+
const tokens = React19.useMemo(() => {
|
|
1416
|
+
return newtoneApi.computeTokens(
|
|
1417
|
+
themeCtx.config.colorSystem,
|
|
1418
|
+
mode,
|
|
1419
|
+
gamut,
|
|
1420
|
+
CARD_ELEVATION_NAME,
|
|
1421
|
+
themeCtx.config.spacing,
|
|
1422
|
+
themeCtx.config.radius,
|
|
1423
|
+
themeCtx.config.typography,
|
|
1424
|
+
themeCtx.config.icons,
|
|
1425
|
+
themeCtx.config.themeMappings,
|
|
1426
|
+
themeCtx.config.swatchDefaults,
|
|
1427
|
+
themeCtx.config.relativeSwatchDefaults
|
|
1428
|
+
);
|
|
1429
|
+
}, [themeCtx.config, mode, gamut]);
|
|
1430
|
+
const styles3 = React19.useMemo(
|
|
1431
|
+
() => getCardStyles({
|
|
1432
|
+
tokens,
|
|
1433
|
+
theme: resolvedTheme,
|
|
1434
|
+
appearance: resolvedAppearance,
|
|
1435
|
+
direction,
|
|
1436
|
+
wrap,
|
|
1437
|
+
reverse,
|
|
1438
|
+
align,
|
|
1439
|
+
justify,
|
|
1440
|
+
padding,
|
|
1441
|
+
gap,
|
|
1442
|
+
width,
|
|
1443
|
+
height,
|
|
1444
|
+
minWidth,
|
|
1445
|
+
maxWidth,
|
|
1446
|
+
minHeight,
|
|
1447
|
+
maxHeight,
|
|
1448
|
+
radius,
|
|
1449
|
+
disabled
|
|
1450
|
+
}),
|
|
1451
|
+
[
|
|
1452
|
+
tokens,
|
|
1453
|
+
resolvedTheme,
|
|
1454
|
+
resolvedAppearance,
|
|
1455
|
+
direction,
|
|
1456
|
+
wrap,
|
|
1457
|
+
reverse,
|
|
1458
|
+
align,
|
|
1459
|
+
justify,
|
|
1460
|
+
padding,
|
|
1461
|
+
gap,
|
|
1462
|
+
width,
|
|
1463
|
+
height,
|
|
1464
|
+
minWidth,
|
|
1465
|
+
maxWidth,
|
|
1466
|
+
minHeight,
|
|
1467
|
+
maxHeight,
|
|
1468
|
+
radius,
|
|
1469
|
+
disabled
|
|
1470
|
+
]
|
|
1189
1471
|
);
|
|
1190
|
-
|
|
1472
|
+
const contextValue = React19.useMemo(
|
|
1473
|
+
() => ({
|
|
1474
|
+
elevation: CARD_ELEVATION,
|
|
1475
|
+
tokens,
|
|
1476
|
+
scheme: parentFrameCtx?.scheme,
|
|
1477
|
+
theme: resolvedTheme,
|
|
1478
|
+
appearance: resolvedAppearance
|
|
1479
|
+
}),
|
|
1480
|
+
[tokens, parentFrameCtx?.scheme, resolvedTheme, resolvedAppearance]
|
|
1481
|
+
);
|
|
1482
|
+
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
1483
|
+
const { isFocusVisible, focusProps } = useFocusVisible();
|
|
1484
|
+
const focusRingStyle = isFocusVisible && !disabled ? {
|
|
1485
|
+
outlineWidth: 2,
|
|
1486
|
+
outlineStyle: "solid",
|
|
1487
|
+
outlineColor: tokens.colors[resolvedTheme].emphasis.background,
|
|
1488
|
+
outlineOffset: 2
|
|
1489
|
+
} : void 0;
|
|
1490
|
+
const textStyle = React19.useMemo(
|
|
1491
|
+
() => ({
|
|
1492
|
+
color: tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary,
|
|
1493
|
+
fontSize: tokens.typography.fontSizes["05"],
|
|
1494
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1495
|
+
lineHeight: tokens.typography.lineHeights["06"]
|
|
1496
|
+
}),
|
|
1497
|
+
[tokens, resolvedTheme, resolvedAppearance]
|
|
1498
|
+
);
|
|
1499
|
+
const wrappedChildren = React19.useMemo(
|
|
1500
|
+
() => wrapTextChildren2(children, textStyle),
|
|
1501
|
+
[children, textStyle]
|
|
1502
|
+
);
|
|
1503
|
+
return /* @__PURE__ */ React19__default.default.createElement(newtoneApi.FrameContext.Provider, { value: contextValue }, /* @__PURE__ */ React19__default.default.createElement(
|
|
1504
|
+
reactNative.Pressable,
|
|
1505
|
+
{
|
|
1506
|
+
ref,
|
|
1507
|
+
testID,
|
|
1508
|
+
nativeID,
|
|
1509
|
+
pointerEvents,
|
|
1510
|
+
accessibilityLabel,
|
|
1511
|
+
accessibilityHint,
|
|
1512
|
+
accessibilityState: disabled ? { disabled: true } : void 0,
|
|
1513
|
+
onPress,
|
|
1514
|
+
disabled,
|
|
1515
|
+
...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
|
|
1516
|
+
...focusProps,
|
|
1517
|
+
style: ({ pressed }) => [
|
|
1518
|
+
styles3.container,
|
|
1519
|
+
pressed && !disabled && styles3.pressed,
|
|
1520
|
+
focusRingStyle,
|
|
1521
|
+
...userStyles
|
|
1522
|
+
]
|
|
1523
|
+
},
|
|
1524
|
+
wrappedChildren
|
|
1525
|
+
));
|
|
1191
1526
|
}
|
|
1192
1527
|
|
|
1193
1528
|
// src/composites/display/Chip/Chip.styles.ts
|
|
@@ -1322,11 +1657,11 @@ function Chip({
|
|
|
1322
1657
|
style
|
|
1323
1658
|
}) {
|
|
1324
1659
|
const tokens = newtoneApi.useTokens();
|
|
1325
|
-
const { colors, sizeTokens } =
|
|
1660
|
+
const { colors, sizeTokens } = React19__default.default.useMemo(
|
|
1326
1661
|
() => getChipConfig(variant, semantic, size, selected, disabled, tokens),
|
|
1327
1662
|
[variant, semantic, size, selected, disabled, tokens]
|
|
1328
1663
|
);
|
|
1329
|
-
const content = (state) => /* @__PURE__ */
|
|
1664
|
+
const content = (state) => /* @__PURE__ */ React19__default.default.createElement(
|
|
1330
1665
|
Wrapper,
|
|
1331
1666
|
{
|
|
1332
1667
|
direction: "horizontal",
|
|
@@ -1347,8 +1682,8 @@ function Chip({
|
|
|
1347
1682
|
...Array.isArray(style) ? style : style ? [style] : []
|
|
1348
1683
|
]
|
|
1349
1684
|
},
|
|
1350
|
-
icon && /* @__PURE__ */
|
|
1351
|
-
/* @__PURE__ */
|
|
1685
|
+
icon && /* @__PURE__ */ React19__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: colors.iconColor }),
|
|
1686
|
+
/* @__PURE__ */ React19__default.default.createElement(
|
|
1352
1687
|
Text3,
|
|
1353
1688
|
{
|
|
1354
1689
|
role: sizeTokens.textRole,
|
|
@@ -1359,7 +1694,7 @@ function Chip({
|
|
|
1359
1694
|
)
|
|
1360
1695
|
);
|
|
1361
1696
|
if (onPress) {
|
|
1362
|
-
return /* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.Pressable, { onPress, disabled }, ({ pressed, hovered }) => content({ pressed, hovered }));
|
|
1363
1698
|
}
|
|
1364
1699
|
return content();
|
|
1365
1700
|
}
|
|
@@ -1388,11 +1723,11 @@ function Divider({
|
|
|
1388
1723
|
style
|
|
1389
1724
|
}) {
|
|
1390
1725
|
const tokens = newtoneApi.useTokens();
|
|
1391
|
-
const dividerStyle =
|
|
1726
|
+
const dividerStyle = React19__default.default.useMemo(
|
|
1392
1727
|
() => getDividerStyles(orientation, spacing, tokens),
|
|
1393
1728
|
[orientation, spacing, tokens]
|
|
1394
1729
|
);
|
|
1395
|
-
return /* @__PURE__ */
|
|
1730
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
1396
1731
|
reactNative.View,
|
|
1397
1732
|
{
|
|
1398
1733
|
style: [dividerStyle, ...Array.isArray(style) ? style : style ? [style] : []],
|
|
@@ -1438,11 +1773,11 @@ function ContentCard({
|
|
|
1438
1773
|
}) {
|
|
1439
1774
|
const tokens = newtoneApi.useTokens();
|
|
1440
1775
|
const isInteractive = !!(href || onPress);
|
|
1441
|
-
const variantStyles =
|
|
1776
|
+
const variantStyles = React19__default.default.useMemo(
|
|
1442
1777
|
() => getContentCardStyles(variant, isInteractive, tokens),
|
|
1443
1778
|
[variant, isInteractive, tokens]
|
|
1444
1779
|
);
|
|
1445
|
-
return /* @__PURE__ */
|
|
1780
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
1446
1781
|
Frame,
|
|
1447
1782
|
{
|
|
1448
1783
|
elevation: variant === "elevated" ? 2 : void 0,
|
|
@@ -1470,18 +1805,18 @@ function getTextInputStyles(tokens, disabled, theme = "primary", appearance = "m
|
|
|
1470
1805
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1471
1806
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1472
1807
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1473
|
-
color: at.
|
|
1808
|
+
color: at.fontSecondary
|
|
1474
1809
|
},
|
|
1475
1810
|
input: {
|
|
1476
1811
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1477
|
-
backgroundColor: at.
|
|
1812
|
+
backgroundColor: at.background,
|
|
1478
1813
|
borderWidth: 1,
|
|
1479
|
-
borderColor: at.
|
|
1814
|
+
borderColor: at.divider,
|
|
1480
1815
|
borderRadius: tokens.radius.md,
|
|
1481
1816
|
paddingVertical: tokens.spacing["08"],
|
|
1482
1817
|
paddingHorizontal: tokens.spacing["12"],
|
|
1483
1818
|
fontSize: tokens.typography.fontSizes["05"],
|
|
1484
|
-
color: disabled ? at.
|
|
1819
|
+
color: disabled ? at.fontDisabled : at.fontPrimary,
|
|
1485
1820
|
opacity: disabled ? 0.5 : 1
|
|
1486
1821
|
}
|
|
1487
1822
|
});
|
|
@@ -1498,14 +1833,14 @@ function TextInput({
|
|
|
1498
1833
|
const frameCtx = newtoneApi.useFrameContext();
|
|
1499
1834
|
const theme = frameCtx?.theme ?? "primary";
|
|
1500
1835
|
const appearance = frameCtx?.appearance ?? "main";
|
|
1501
|
-
const
|
|
1836
|
+
const styles3 = React19__default.default.useMemo(
|
|
1502
1837
|
() => getTextInputStyles(tokens, disabled, theme, appearance),
|
|
1503
1838
|
[tokens, disabled, theme, appearance]
|
|
1504
1839
|
);
|
|
1505
|
-
return /* @__PURE__ */
|
|
1840
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.label }, label), /* @__PURE__ */ React19__default.default.createElement(
|
|
1506
1841
|
reactNative.TextInput,
|
|
1507
1842
|
{
|
|
1508
|
-
style:
|
|
1843
|
+
style: styles3.input,
|
|
1509
1844
|
editable: !disabled,
|
|
1510
1845
|
placeholderTextColor: tokens.colors[theme][appearance].fontTertiary,
|
|
1511
1846
|
...textInputProps
|
|
@@ -1556,15 +1891,15 @@ function Popover({
|
|
|
1556
1891
|
}) {
|
|
1557
1892
|
const tokens = newtoneApi.useTokens(1);
|
|
1558
1893
|
const frameCtx = newtoneApi.useFrameContext();
|
|
1559
|
-
const containerRef =
|
|
1560
|
-
const [triggerHeight, setTriggerHeight] =
|
|
1561
|
-
const onTriggerLayout =
|
|
1894
|
+
const containerRef = React19.useRef(null);
|
|
1895
|
+
const [triggerHeight, setTriggerHeight] = React19.useState(0);
|
|
1896
|
+
const onTriggerLayout = React19.useCallback(
|
|
1562
1897
|
(e) => {
|
|
1563
1898
|
setTriggerHeight(e.nativeEvent.layout.height);
|
|
1564
1899
|
},
|
|
1565
1900
|
[]
|
|
1566
1901
|
);
|
|
1567
|
-
|
|
1902
|
+
React19.useEffect(() => {
|
|
1568
1903
|
if (!isOpen) return;
|
|
1569
1904
|
openPopovers.forEach((closeFn) => closeFn());
|
|
1570
1905
|
openPopovers.clear();
|
|
@@ -1573,7 +1908,7 @@ function Popover({
|
|
|
1573
1908
|
openPopovers.delete(onClose);
|
|
1574
1909
|
};
|
|
1575
1910
|
}, [isOpen, onClose]);
|
|
1576
|
-
|
|
1911
|
+
React19.useEffect(() => {
|
|
1577
1912
|
if (!isOpen) return;
|
|
1578
1913
|
if (typeof document === "undefined") return;
|
|
1579
1914
|
const handleMouseDown = (e) => {
|
|
@@ -1585,7 +1920,7 @@ function Popover({
|
|
|
1585
1920
|
document.addEventListener("mousedown", handleMouseDown, true);
|
|
1586
1921
|
return () => document.removeEventListener("mousedown", handleMouseDown, true);
|
|
1587
1922
|
}, [isOpen, onClose]);
|
|
1588
|
-
const handleKeyDown =
|
|
1923
|
+
const handleKeyDown = React19.useCallback(
|
|
1589
1924
|
(e) => {
|
|
1590
1925
|
if (closeOnEscape && e.key === "Escape") {
|
|
1591
1926
|
e.stopPropagation();
|
|
@@ -1594,41 +1929,41 @@ function Popover({
|
|
|
1594
1929
|
},
|
|
1595
1930
|
[closeOnEscape, onClose]
|
|
1596
1931
|
);
|
|
1597
|
-
const
|
|
1932
|
+
const styles3 = React19.useMemo(
|
|
1598
1933
|
() => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance),
|
|
1599
1934
|
[tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance]
|
|
1600
1935
|
);
|
|
1601
|
-
const containerStyles =
|
|
1602
|
-
() => [
|
|
1603
|
-
[
|
|
1936
|
+
const containerStyles = React19.useMemo(
|
|
1937
|
+
() => [styles3.container, ...Array.isArray(style) ? style : style ? [style] : []],
|
|
1938
|
+
[styles3.container, style]
|
|
1604
1939
|
);
|
|
1605
|
-
const mergedContentStyles =
|
|
1606
|
-
() => [
|
|
1607
|
-
[
|
|
1940
|
+
const mergedContentStyles = React19.useMemo(
|
|
1941
|
+
() => [styles3.content, ...Array.isArray(contentStyle) ? contentStyle : contentStyle ? [contentStyle] : []],
|
|
1942
|
+
[styles3.content, contentStyle]
|
|
1608
1943
|
);
|
|
1609
1944
|
const webProps = { onKeyDown: handleKeyDown };
|
|
1610
|
-
return /* @__PURE__ */
|
|
1945
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
1611
1946
|
reactNative.View,
|
|
1612
1947
|
{
|
|
1613
1948
|
ref: containerRef,
|
|
1614
1949
|
style: containerStyles,
|
|
1615
1950
|
...webProps
|
|
1616
1951
|
},
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
isOpen && /* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { onLayout: onTriggerLayout }, trigger),
|
|
1953
|
+
isOpen && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: mergedContentStyles }, children)
|
|
1619
1954
|
);
|
|
1620
1955
|
}
|
|
1621
1956
|
function usePopover(options) {
|
|
1622
|
-
const [isOpen, setIsOpen] =
|
|
1623
|
-
const open =
|
|
1957
|
+
const [isOpen, setIsOpen] = React19.useState(options?.initialOpen ?? false);
|
|
1958
|
+
const open = React19.useCallback(() => {
|
|
1624
1959
|
setIsOpen(true);
|
|
1625
1960
|
options?.onOpenChange?.(true);
|
|
1626
1961
|
}, [options]);
|
|
1627
|
-
const close =
|
|
1962
|
+
const close = React19.useCallback(() => {
|
|
1628
1963
|
setIsOpen(false);
|
|
1629
1964
|
options?.onOpenChange?.(false);
|
|
1630
1965
|
}, [options]);
|
|
1631
|
-
const toggle =
|
|
1966
|
+
const toggle = React19.useCallback(() => {
|
|
1632
1967
|
setIsOpen((prev) => {
|
|
1633
1968
|
const next = !prev;
|
|
1634
1969
|
options?.onOpenChange?.(next);
|
|
@@ -1716,10 +2051,10 @@ function useSelect({
|
|
|
1716
2051
|
onClose,
|
|
1717
2052
|
onOpen
|
|
1718
2053
|
}) {
|
|
1719
|
-
const [focusedIndex, setFocusedIndex] =
|
|
1720
|
-
const typeAheadRef =
|
|
1721
|
-
const typeAheadTimerRef =
|
|
1722
|
-
|
|
2054
|
+
const [focusedIndex, setFocusedIndex] = React19.useState(-1);
|
|
2055
|
+
const typeAheadRef = React19.useRef("");
|
|
2056
|
+
const typeAheadTimerRef = React19.useRef();
|
|
2057
|
+
React19.useEffect(() => {
|
|
1723
2058
|
if (isOpen) {
|
|
1724
2059
|
const selectedIdx = flatOptions.findIndex((o) => o.value === value);
|
|
1725
2060
|
if (selectedIdx >= 0 && !flatOptions[selectedIdx].disabled) {
|
|
@@ -1732,7 +2067,7 @@ function useSelect({
|
|
|
1732
2067
|
setFocusedIndex(-1);
|
|
1733
2068
|
}
|
|
1734
2069
|
}, [isOpen, flatOptions, value]);
|
|
1735
|
-
const handleKeyDown =
|
|
2070
|
+
const handleKeyDown = React19.useCallback(
|
|
1736
2071
|
(e) => {
|
|
1737
2072
|
const key = e.key;
|
|
1738
2073
|
if (!isOpen) {
|
|
@@ -1816,7 +2151,7 @@ function SelectOptionRow({
|
|
|
1816
2151
|
const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
|
|
1817
2152
|
const fontSize = size === "sm" ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1818
2153
|
if (renderOption) {
|
|
1819
|
-
return /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
1820
2155
|
reactNative.Pressable,
|
|
1821
2156
|
{
|
|
1822
2157
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1827,7 +2162,7 @@ function SelectOptionRow({
|
|
|
1827
2162
|
renderOption(option, { isSelected, isFocused })
|
|
1828
2163
|
);
|
|
1829
2164
|
}
|
|
1830
|
-
return /* @__PURE__ */
|
|
2165
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
1831
2166
|
reactNative.Pressable,
|
|
1832
2167
|
{
|
|
1833
2168
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1856,7 +2191,7 @@ function SelectOptionRow({
|
|
|
1856
2191
|
}
|
|
1857
2192
|
]
|
|
1858
2193
|
},
|
|
1859
|
-
/* @__PURE__ */
|
|
2194
|
+
/* @__PURE__ */ React19__default.default.createElement(
|
|
1860
2195
|
reactNative.Text,
|
|
1861
2196
|
{
|
|
1862
2197
|
style: [
|
|
@@ -1878,7 +2213,7 @@ function SelectOptionRow({
|
|
|
1878
2213
|
},
|
|
1879
2214
|
option.label
|
|
1880
2215
|
),
|
|
1881
|
-
isSelected && /* @__PURE__ */
|
|
2216
|
+
isSelected && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React19__default.default.createElement(
|
|
1882
2217
|
Icon,
|
|
1883
2218
|
{
|
|
1884
2219
|
name: "check",
|
|
@@ -1916,7 +2251,7 @@ function Select({
|
|
|
1916
2251
|
const tokens = newtoneApi.useTokens(1);
|
|
1917
2252
|
const frameCtx = newtoneApi.useFrameContext();
|
|
1918
2253
|
const { isOpen, open, close, toggle } = usePopover();
|
|
1919
|
-
const flatOptions =
|
|
2254
|
+
const flatOptions = React19.useMemo(() => flattenOptions(options), [options]);
|
|
1920
2255
|
const { focusedIndex, handleKeyDown } = useSelect({
|
|
1921
2256
|
flatOptions,
|
|
1922
2257
|
value,
|
|
@@ -1930,7 +2265,7 @@ function Select({
|
|
|
1930
2265
|
});
|
|
1931
2266
|
const inheritedTheme = frameCtx?.theme;
|
|
1932
2267
|
const inheritedAppearance = frameCtx?.appearance;
|
|
1933
|
-
const
|
|
2268
|
+
const styles3 = React19.useMemo(
|
|
1934
2269
|
() => getSelectStyles(tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance),
|
|
1935
2270
|
[tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance]
|
|
1936
2271
|
);
|
|
@@ -1939,7 +2274,7 @@ function Select({
|
|
|
1939
2274
|
const at = tokens.colors[inheritedTheme ?? "primary"][inheritedAppearance ?? "main"];
|
|
1940
2275
|
const iconColor = disabled ? at.fontTertiary : at.divider;
|
|
1941
2276
|
const triggerWebProps = { onKeyDown: handleKeyDown };
|
|
1942
|
-
const trigger = /* @__PURE__ */
|
|
2277
|
+
const trigger = /* @__PURE__ */ React19__default.default.createElement(
|
|
1943
2278
|
reactNative.Pressable,
|
|
1944
2279
|
{
|
|
1945
2280
|
onPress: disabled ? void 0 : toggle,
|
|
@@ -1947,10 +2282,10 @@ function Select({
|
|
|
1947
2282
|
role: "combobox",
|
|
1948
2283
|
accessibilityState: { expanded: isOpen },
|
|
1949
2284
|
...triggerWebProps,
|
|
1950
|
-
style:
|
|
2285
|
+
style: styles3.trigger
|
|
1951
2286
|
},
|
|
1952
|
-
renderValue ? renderValue(selectedOption) : /* @__PURE__ */
|
|
1953
|
-
/* @__PURE__ */
|
|
2287
|
+
renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.triggerText, numberOfLines: 1 }, displayLabel),
|
|
2288
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React19__default.default.createElement(
|
|
1954
2289
|
Icon,
|
|
1955
2290
|
{
|
|
1956
2291
|
name: isOpen ? "expand_less" : "expand_more",
|
|
@@ -1959,14 +2294,14 @@ function Select({
|
|
|
1959
2294
|
}
|
|
1960
2295
|
))
|
|
1961
2296
|
);
|
|
1962
|
-
return /* @__PURE__ */
|
|
2297
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.label }, label), /* @__PURE__ */ React19__default.default.createElement(
|
|
1963
2298
|
Popover,
|
|
1964
2299
|
{
|
|
1965
2300
|
isOpen: isOpen && !disabled,
|
|
1966
2301
|
onClose: close,
|
|
1967
2302
|
trigger
|
|
1968
2303
|
},
|
|
1969
|
-
/* @__PURE__ */
|
|
2304
|
+
/* @__PURE__ */ React19__default.default.createElement(
|
|
1970
2305
|
reactNative.ScrollView,
|
|
1971
2306
|
{
|
|
1972
2307
|
bounces: false,
|
|
@@ -1975,7 +2310,7 @@ function Select({
|
|
|
1975
2310
|
},
|
|
1976
2311
|
options.map((item) => {
|
|
1977
2312
|
if (isOptionGroup(item)) {
|
|
1978
|
-
return /* @__PURE__ */
|
|
2313
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { key: item.label }, /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React19__default.default.createElement(
|
|
1979
2314
|
SelectOptionRow,
|
|
1980
2315
|
{
|
|
1981
2316
|
key: opt.value,
|
|
@@ -1991,7 +2326,7 @@ function Select({
|
|
|
1991
2326
|
}
|
|
1992
2327
|
)));
|
|
1993
2328
|
}
|
|
1994
|
-
return /* @__PURE__ */
|
|
2329
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
1995
2330
|
SelectOptionRow,
|
|
1996
2331
|
{
|
|
1997
2332
|
key: item.value,
|
|
@@ -2058,16 +2393,16 @@ function Toggle({
|
|
|
2058
2393
|
}) {
|
|
2059
2394
|
const tokens = newtoneApi.useTokens(1);
|
|
2060
2395
|
const frameCtx = newtoneApi.useFrameContext();
|
|
2061
|
-
const
|
|
2396
|
+
const styles3 = React19__default.default.useMemo(
|
|
2062
2397
|
() => getToggleStyles(tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance),
|
|
2063
2398
|
[tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance]
|
|
2064
2399
|
);
|
|
2065
|
-
const handlePress =
|
|
2400
|
+
const handlePress = React19__default.default.useCallback(() => {
|
|
2066
2401
|
if (!disabled) {
|
|
2067
2402
|
onValueChange(!value);
|
|
2068
2403
|
}
|
|
2069
2404
|
}, [disabled, value, onValueChange]);
|
|
2070
|
-
return /* @__PURE__ */
|
|
2405
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.label }, label), /* @__PURE__ */ React19__default.default.createElement(
|
|
2071
2406
|
reactNative.Pressable,
|
|
2072
2407
|
{
|
|
2073
2408
|
onPress: handlePress,
|
|
@@ -2075,7 +2410,7 @@ function Toggle({
|
|
|
2075
2410
|
accessibilityRole: "switch",
|
|
2076
2411
|
accessibilityState: { checked: value, disabled }
|
|
2077
2412
|
},
|
|
2078
|
-
/* @__PURE__ */
|
|
2413
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.track }, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.thumb }))
|
|
2079
2414
|
));
|
|
2080
2415
|
}
|
|
2081
2416
|
var TRACK_HEIGHT2 = 6;
|
|
@@ -2161,42 +2496,42 @@ function Slider({
|
|
|
2161
2496
|
style
|
|
2162
2497
|
}) {
|
|
2163
2498
|
const tokens = newtoneApi.useTokens(1);
|
|
2164
|
-
const
|
|
2499
|
+
const styles3 = React19__default.default.useMemo(
|
|
2165
2500
|
() => getSliderStyles(tokens, disabled),
|
|
2166
2501
|
[tokens, disabled]
|
|
2167
2502
|
);
|
|
2168
|
-
const trackRef =
|
|
2169
|
-
const trackWidth =
|
|
2170
|
-
const trackPageX =
|
|
2171
|
-
const [layoutWidth, setLayoutWidth] =
|
|
2172
|
-
const onValueChangeRef =
|
|
2173
|
-
const minRef =
|
|
2174
|
-
const maxRef =
|
|
2175
|
-
const stepRef =
|
|
2176
|
-
const disabledRef =
|
|
2177
|
-
|
|
2503
|
+
const trackRef = React19__default.default.useRef(null);
|
|
2504
|
+
const trackWidth = React19__default.default.useRef(0);
|
|
2505
|
+
const trackPageX = React19__default.default.useRef(0);
|
|
2506
|
+
const [layoutWidth, setLayoutWidth] = React19__default.default.useState(0);
|
|
2507
|
+
const onValueChangeRef = React19__default.default.useRef(onValueChange);
|
|
2508
|
+
const minRef = React19__default.default.useRef(min);
|
|
2509
|
+
const maxRef = React19__default.default.useRef(max);
|
|
2510
|
+
const stepRef = React19__default.default.useRef(step);
|
|
2511
|
+
const disabledRef = React19__default.default.useRef(disabled);
|
|
2512
|
+
React19__default.default.useEffect(() => {
|
|
2178
2513
|
onValueChangeRef.current = onValueChange;
|
|
2179
2514
|
}, [onValueChange]);
|
|
2180
|
-
|
|
2515
|
+
React19__default.default.useEffect(() => {
|
|
2181
2516
|
minRef.current = min;
|
|
2182
2517
|
}, [min]);
|
|
2183
|
-
|
|
2518
|
+
React19__default.default.useEffect(() => {
|
|
2184
2519
|
maxRef.current = max;
|
|
2185
2520
|
}, [max]);
|
|
2186
|
-
|
|
2521
|
+
React19__default.default.useEffect(() => {
|
|
2187
2522
|
stepRef.current = step;
|
|
2188
2523
|
}, [step]);
|
|
2189
|
-
|
|
2524
|
+
React19__default.default.useEffect(() => {
|
|
2190
2525
|
disabledRef.current = disabled;
|
|
2191
2526
|
}, [disabled]);
|
|
2192
|
-
const computeValue =
|
|
2527
|
+
const computeValue = React19__default.default.useCallback((pageX) => {
|
|
2193
2528
|
const localX = pageX - trackPageX.current;
|
|
2194
2529
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2195
2530
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2196
2531
|
const stepped = Math.round(raw / stepRef.current) * stepRef.current;
|
|
2197
2532
|
return Math.min(maxRef.current, Math.max(minRef.current, stepped));
|
|
2198
2533
|
}, []);
|
|
2199
|
-
const panResponder =
|
|
2534
|
+
const panResponder = React19__default.default.useRef(
|
|
2200
2535
|
reactNative.PanResponder.create({
|
|
2201
2536
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2202
2537
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2224,7 +2559,7 @@ function Slider({
|
|
|
2224
2559
|
fillLeft = 0;
|
|
2225
2560
|
fillWidth = thumbLeft + THUMB_SIZE2 / 2;
|
|
2226
2561
|
}
|
|
2227
|
-
const handleValueTextSubmit =
|
|
2562
|
+
const handleValueTextSubmit = React19__default.default.useCallback(
|
|
2228
2563
|
(text) => {
|
|
2229
2564
|
const raw = Number(text);
|
|
2230
2565
|
if (!Number.isNaN(raw)) {
|
|
@@ -2233,15 +2568,15 @@ function Slider({
|
|
|
2233
2568
|
},
|
|
2234
2569
|
[onValueChange, min, max]
|
|
2235
2570
|
);
|
|
2236
|
-
const [editText, setEditText] =
|
|
2237
|
-
|
|
2571
|
+
const [editText, setEditText] = React19__default.default.useState(String(value));
|
|
2572
|
+
React19__default.default.useEffect(() => {
|
|
2238
2573
|
setEditText(String(value));
|
|
2239
2574
|
}, [value]);
|
|
2240
2575
|
const showLabel = label || showValue || editableValue;
|
|
2241
|
-
return /* @__PURE__ */
|
|
2576
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.labelRow }, label && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.label }, label), editableValue ? /* @__PURE__ */ React19__default.default.createElement(
|
|
2242
2577
|
reactNative.TextInput,
|
|
2243
2578
|
{
|
|
2244
|
-
style:
|
|
2579
|
+
style: styles3.valueInput,
|
|
2245
2580
|
value: editText,
|
|
2246
2581
|
keyboardType: "numeric",
|
|
2247
2582
|
onChangeText: setEditText,
|
|
@@ -2250,11 +2585,11 @@ function Slider({
|
|
|
2250
2585
|
selectTextOnFocus: true,
|
|
2251
2586
|
editable: !disabled
|
|
2252
2587
|
}
|
|
2253
|
-
) : showValue && /* @__PURE__ */
|
|
2588
|
+
) : showValue && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.value }, value)), /* @__PURE__ */ React19__default.default.createElement(
|
|
2254
2589
|
reactNative.View,
|
|
2255
2590
|
{
|
|
2256
2591
|
ref: trackRef,
|
|
2257
|
-
style:
|
|
2592
|
+
style: styles3.trackContainer,
|
|
2258
2593
|
onLayout: (e) => {
|
|
2259
2594
|
const w = e.nativeEvent.layout.width;
|
|
2260
2595
|
trackWidth.current = w;
|
|
@@ -2265,9 +2600,9 @@ function Slider({
|
|
|
2265
2600
|
},
|
|
2266
2601
|
...panResponder.panHandlers
|
|
2267
2602
|
},
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2603
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.trackRail }),
|
|
2604
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.trackFill, { left: fillLeft, width: fillWidth }] }),
|
|
2605
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.thumb, { left: thumbLeft }] })
|
|
2271
2606
|
));
|
|
2272
2607
|
}
|
|
2273
2608
|
var TRACK_HEIGHT3 = 22;
|
|
@@ -2364,42 +2699,42 @@ function HueSlider({
|
|
|
2364
2699
|
style
|
|
2365
2700
|
}) {
|
|
2366
2701
|
const tokens = newtoneApi.useTokens(1);
|
|
2367
|
-
const
|
|
2702
|
+
const styles3 = React19__default.default.useMemo(
|
|
2368
2703
|
() => getHueSliderStyles(tokens, disabled),
|
|
2369
2704
|
[tokens, disabled]
|
|
2370
2705
|
);
|
|
2371
|
-
const segments =
|
|
2706
|
+
const segments = React19__default.default.useMemo(
|
|
2372
2707
|
() => buildHueSegments(min, max),
|
|
2373
2708
|
[min, max]
|
|
2374
2709
|
);
|
|
2375
|
-
const trackRef =
|
|
2376
|
-
const trackWidth =
|
|
2377
|
-
const trackPageX =
|
|
2378
|
-
const [layoutWidth, setLayoutWidth] =
|
|
2379
|
-
const onValueChangeRef =
|
|
2380
|
-
const minRef =
|
|
2381
|
-
const maxRef =
|
|
2382
|
-
const disabledRef =
|
|
2383
|
-
|
|
2710
|
+
const trackRef = React19__default.default.useRef(null);
|
|
2711
|
+
const trackWidth = React19__default.default.useRef(0);
|
|
2712
|
+
const trackPageX = React19__default.default.useRef(0);
|
|
2713
|
+
const [layoutWidth, setLayoutWidth] = React19__default.default.useState(0);
|
|
2714
|
+
const onValueChangeRef = React19__default.default.useRef(onValueChange);
|
|
2715
|
+
const minRef = React19__default.default.useRef(min);
|
|
2716
|
+
const maxRef = React19__default.default.useRef(max);
|
|
2717
|
+
const disabledRef = React19__default.default.useRef(disabled);
|
|
2718
|
+
React19__default.default.useEffect(() => {
|
|
2384
2719
|
onValueChangeRef.current = onValueChange;
|
|
2385
2720
|
}, [onValueChange]);
|
|
2386
|
-
|
|
2721
|
+
React19__default.default.useEffect(() => {
|
|
2387
2722
|
minRef.current = min;
|
|
2388
2723
|
}, [min]);
|
|
2389
|
-
|
|
2724
|
+
React19__default.default.useEffect(() => {
|
|
2390
2725
|
maxRef.current = max;
|
|
2391
2726
|
}, [max]);
|
|
2392
|
-
|
|
2727
|
+
React19__default.default.useEffect(() => {
|
|
2393
2728
|
disabledRef.current = disabled;
|
|
2394
2729
|
}, [disabled]);
|
|
2395
|
-
const computeHue =
|
|
2730
|
+
const computeHue = React19__default.default.useCallback((pageX) => {
|
|
2396
2731
|
const localX = pageX - trackPageX.current;
|
|
2397
2732
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2398
2733
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2399
2734
|
const stepped = Math.round(raw);
|
|
2400
2735
|
return (stepped % 360 + 360) % 360;
|
|
2401
2736
|
}, []);
|
|
2402
|
-
const panResponder =
|
|
2737
|
+
const panResponder = React19__default.default.useRef(
|
|
2403
2738
|
reactNative.PanResponder.create({
|
|
2404
2739
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2405
2740
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2415,7 +2750,7 @@ function HueSlider({
|
|
|
2415
2750
|
const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
|
|
2416
2751
|
const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE3);
|
|
2417
2752
|
const thumbLeft = ratio * usableWidth;
|
|
2418
|
-
const handleValueTextSubmit =
|
|
2753
|
+
const handleValueTextSubmit = React19__default.default.useCallback(
|
|
2419
2754
|
(text) => {
|
|
2420
2755
|
const raw = Number(text);
|
|
2421
2756
|
if (!Number.isNaN(raw)) {
|
|
@@ -2424,15 +2759,15 @@ function HueSlider({
|
|
|
2424
2759
|
},
|
|
2425
2760
|
[onValueChange]
|
|
2426
2761
|
);
|
|
2427
|
-
const [editText, setEditText] =
|
|
2428
|
-
|
|
2762
|
+
const [editText, setEditText] = React19__default.default.useState(String(value));
|
|
2763
|
+
React19__default.default.useEffect(() => {
|
|
2429
2764
|
setEditText(String(value));
|
|
2430
2765
|
}, [value]);
|
|
2431
2766
|
const showLabel = label || showValue || editableValue;
|
|
2432
|
-
return /* @__PURE__ */
|
|
2767
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.labelRow }, label && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.label }, label), editableValue ? /* @__PURE__ */ React19__default.default.createElement(
|
|
2433
2768
|
reactNative.TextInput,
|
|
2434
2769
|
{
|
|
2435
|
-
style:
|
|
2770
|
+
style: styles3.valueInput,
|
|
2436
2771
|
value: editText,
|
|
2437
2772
|
keyboardType: "numeric",
|
|
2438
2773
|
onChangeText: setEditText,
|
|
@@ -2441,11 +2776,11 @@ function HueSlider({
|
|
|
2441
2776
|
selectTextOnFocus: true,
|
|
2442
2777
|
editable: !disabled
|
|
2443
2778
|
}
|
|
2444
|
-
) : showValue && /* @__PURE__ */
|
|
2779
|
+
) : showValue && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.value }, value, "\xB0")), /* @__PURE__ */ React19__default.default.createElement(
|
|
2445
2780
|
reactNative.View,
|
|
2446
2781
|
{
|
|
2447
2782
|
ref: trackRef,
|
|
2448
|
-
style:
|
|
2783
|
+
style: styles3.trackContainer,
|
|
2449
2784
|
onLayout: (e) => {
|
|
2450
2785
|
const w = e.nativeEvent.layout.width;
|
|
2451
2786
|
trackWidth.current = w;
|
|
@@ -2456,8 +2791,8 @@ function HueSlider({
|
|
|
2456
2791
|
},
|
|
2457
2792
|
...panResponder.panHandlers
|
|
2458
2793
|
},
|
|
2459
|
-
/* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */
|
|
2794
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { key: i, style: [styles3.segment, { backgroundColor: color }] }))),
|
|
2795
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.thumb, { left: thumbLeft }] })
|
|
2461
2796
|
));
|
|
2462
2797
|
}
|
|
2463
2798
|
|
|
@@ -2513,7 +2848,10 @@ function oklchToP3(color) {
|
|
|
2513
2848
|
return linearSrgbToSrgb(oklabToLinearP3(oklchToOklab(color)));
|
|
2514
2849
|
}
|
|
2515
2850
|
function oklchToP3Css(color) {
|
|
2516
|
-
const
|
|
2851
|
+
const p3 = oklchToP3(color);
|
|
2852
|
+
const r = Math.max(0, Math.min(1, p3.r)).toFixed(4);
|
|
2853
|
+
const g = Math.max(0, Math.min(1, p3.g)).toFixed(4);
|
|
2854
|
+
const b = Math.max(0, Math.min(1, p3.b)).toFixed(4);
|
|
2517
2855
|
return `color(display-p3 ${r} ${g} ${b})`;
|
|
2518
2856
|
}
|
|
2519
2857
|
var TRACK_HEIGHT4 = 22;
|
|
@@ -2586,37 +2924,37 @@ function ColorScaleSlider({
|
|
|
2586
2924
|
}) {
|
|
2587
2925
|
const tokens = newtoneApi.useTokens(1);
|
|
2588
2926
|
const { gamut } = newtoneApi.useNewtoneTheme();
|
|
2589
|
-
const
|
|
2927
|
+
const styles3 = React19__default.default.useMemo(
|
|
2590
2928
|
() => getColorScaleSliderStyles(tokens, disabled),
|
|
2591
2929
|
[tokens, disabled]
|
|
2592
2930
|
);
|
|
2593
|
-
const trackRef =
|
|
2594
|
-
const trackWidth =
|
|
2595
|
-
const trackPageX =
|
|
2596
|
-
const isDragging =
|
|
2597
|
-
const thumbAnim =
|
|
2598
|
-
const [layoutWidth, setLayoutWidth] =
|
|
2599
|
-
const onValueChangeRef =
|
|
2600
|
-
const disabledRef =
|
|
2601
|
-
const colorsLengthRef =
|
|
2602
|
-
const trimEndsRef =
|
|
2603
|
-
const snapRef =
|
|
2604
|
-
|
|
2931
|
+
const trackRef = React19__default.default.useRef(null);
|
|
2932
|
+
const trackWidth = React19__default.default.useRef(0);
|
|
2933
|
+
const trackPageX = React19__default.default.useRef(0);
|
|
2934
|
+
const isDragging = React19__default.default.useRef(false);
|
|
2935
|
+
const thumbAnim = React19__default.default.useRef(new reactNative.Animated.Value(0)).current;
|
|
2936
|
+
const [layoutWidth, setLayoutWidth] = React19__default.default.useState(0);
|
|
2937
|
+
const onValueChangeRef = React19__default.default.useRef(onValueChange);
|
|
2938
|
+
const disabledRef = React19__default.default.useRef(disabled);
|
|
2939
|
+
const colorsLengthRef = React19__default.default.useRef(colors.length);
|
|
2940
|
+
const trimEndsRef = React19__default.default.useRef(trimEnds);
|
|
2941
|
+
const snapRef = React19__default.default.useRef(snap);
|
|
2942
|
+
React19__default.default.useEffect(() => {
|
|
2605
2943
|
onValueChangeRef.current = onValueChange;
|
|
2606
2944
|
}, [onValueChange]);
|
|
2607
|
-
|
|
2945
|
+
React19__default.default.useEffect(() => {
|
|
2608
2946
|
disabledRef.current = disabled;
|
|
2609
2947
|
}, [disabled]);
|
|
2610
|
-
|
|
2948
|
+
React19__default.default.useEffect(() => {
|
|
2611
2949
|
colorsLengthRef.current = colors.length;
|
|
2612
2950
|
}, [colors.length]);
|
|
2613
|
-
|
|
2951
|
+
React19__default.default.useEffect(() => {
|
|
2614
2952
|
trimEndsRef.current = trimEnds;
|
|
2615
2953
|
}, [trimEnds]);
|
|
2616
|
-
|
|
2954
|
+
React19__default.default.useEffect(() => {
|
|
2617
2955
|
snapRef.current = snap;
|
|
2618
2956
|
}, [snap]);
|
|
2619
|
-
const computeNv =
|
|
2957
|
+
const computeNv = React19__default.default.useCallback((pageX) => {
|
|
2620
2958
|
const localX = pageX - trackPageX.current;
|
|
2621
2959
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2622
2960
|
const totalSteps2 = colorsLengthRef.current - 1;
|
|
@@ -2631,7 +2969,7 @@ function ColorScaleSlider({
|
|
|
2631
2969
|
}
|
|
2632
2970
|
return nv;
|
|
2633
2971
|
}, []);
|
|
2634
|
-
const panResponder =
|
|
2972
|
+
const panResponder = React19__default.default.useRef(
|
|
2635
2973
|
reactNative.PanResponder.create({
|
|
2636
2974
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2637
2975
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2659,7 +2997,7 @@ function ColorScaleSlider({
|
|
|
2659
2997
|
const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
|
|
2660
2998
|
const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE4);
|
|
2661
2999
|
const thumbLeft = ratio * usableWidth;
|
|
2662
|
-
|
|
3000
|
+
React19__default.default.useEffect(() => {
|
|
2663
3001
|
if (isDragging.current || !animateValue) {
|
|
2664
3002
|
thumbAnim.setValue(thumbLeft);
|
|
2665
3003
|
} else {
|
|
@@ -2670,11 +3008,11 @@ function ColorScaleSlider({
|
|
|
2670
3008
|
}).start();
|
|
2671
3009
|
}
|
|
2672
3010
|
}, [thumbLeft, animateValue, thumbAnim]);
|
|
2673
|
-
return /* @__PURE__ */
|
|
3011
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: [styles3.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.labelRow }, /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.label }, label)), /* @__PURE__ */ React19__default.default.createElement(
|
|
2674
3012
|
reactNative.View,
|
|
2675
3013
|
{
|
|
2676
3014
|
ref: trackRef,
|
|
2677
|
-
style:
|
|
3015
|
+
style: styles3.trackContainer,
|
|
2678
3016
|
onLayout: (e) => {
|
|
2679
3017
|
const w = e.nativeEvent.layout.width;
|
|
2680
3018
|
trackWidth.current = w;
|
|
@@ -2685,9 +3023,9 @@ function ColorScaleSlider({
|
|
|
2685
3023
|
},
|
|
2686
3024
|
...panResponder.panHandlers
|
|
2687
3025
|
},
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2690
|
-
), warning && /* @__PURE__ */
|
|
3026
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { key: i, style: [styles3.segment, { backgroundColor: gamut === "p3" ? oklchToP3Css(color.oklch) : newtone.srgbToHex(color.srgb) }] }))),
|
|
3027
|
+
/* @__PURE__ */ React19__default.default.createElement(reactNative.Animated.View, { style: [styles3.thumb, { left: thumbAnim }] })
|
|
3028
|
+
), warning && /* @__PURE__ */ React19__default.default.createElement(reactNative.Text, { style: styles3.warning }, warning));
|
|
2691
3029
|
}
|
|
2692
3030
|
function getAppShellStyles(tokens, theme = "primary", appearance = "main") {
|
|
2693
3031
|
const at = tokens.colors[theme][appearance];
|
|
@@ -2711,11 +3049,11 @@ function getAppShellStyles(tokens, theme = "primary", appearance = "main") {
|
|
|
2711
3049
|
function AppShell({ sidebar, children }) {
|
|
2712
3050
|
const tokens = newtoneApi.useTokens();
|
|
2713
3051
|
const frameCtx = newtoneApi.useFrameContext();
|
|
2714
|
-
const
|
|
3052
|
+
const styles3 = React19__default.default.useMemo(
|
|
2715
3053
|
() => getAppShellStyles(tokens, frameCtx?.theme, frameCtx?.appearance),
|
|
2716
3054
|
[tokens, frameCtx?.theme, frameCtx?.appearance]
|
|
2717
3055
|
);
|
|
2718
|
-
return /* @__PURE__ */
|
|
3056
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.container }, sidebar, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.main }, children));
|
|
2719
3057
|
}
|
|
2720
3058
|
function getSidebarStyles({ tokens, width, bordered, theme = "primary", appearance = "main" }) {
|
|
2721
3059
|
const at = tokens.colors[theme][appearance];
|
|
@@ -2755,11 +3093,11 @@ function Sidebar({
|
|
|
2755
3093
|
}) {
|
|
2756
3094
|
const tokens = newtoneApi.useTokens();
|
|
2757
3095
|
const frameCtx = newtoneApi.useFrameContext();
|
|
2758
|
-
const
|
|
3096
|
+
const styles3 = React19__default.default.useMemo(
|
|
2759
3097
|
() => getSidebarStyles({ tokens, width, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
|
|
2760
3098
|
[tokens, width, bordered, frameCtx?.theme, frameCtx?.appearance]
|
|
2761
3099
|
);
|
|
2762
|
-
return /* @__PURE__ */
|
|
3100
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.container }, header && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.header }, header), /* @__PURE__ */ React19__default.default.createElement(reactNative.ScrollView, { style: styles3.body }, children), footer && /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.footer }, footer));
|
|
2763
3101
|
}
|
|
2764
3102
|
function getNavbarStyles({ tokens, height, bordered, theme = "primary", appearance = "main" }) {
|
|
2765
3103
|
const at = tokens.colors[theme][appearance];
|
|
@@ -2799,15 +3137,15 @@ function Navbar({
|
|
|
2799
3137
|
}) {
|
|
2800
3138
|
const tokens = newtoneApi.useTokens();
|
|
2801
3139
|
const frameCtx = newtoneApi.useFrameContext();
|
|
2802
|
-
const
|
|
3140
|
+
const styles3 = React19__default.default.useMemo(
|
|
2803
3141
|
() => getNavbarStyles({ tokens, height, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
|
|
2804
3142
|
[tokens, height, bordered, frameCtx?.theme, frameCtx?.appearance]
|
|
2805
3143
|
);
|
|
2806
|
-
return /* @__PURE__ */
|
|
3144
|
+
return /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.container }, children ? children : /* @__PURE__ */ React19__default.default.createElement(React19__default.default.Fragment, null, /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.left }, left), /* @__PURE__ */ React19__default.default.createElement(reactNative.View, { style: styles3.right }, right)));
|
|
2807
3145
|
}
|
|
2808
3146
|
function LogoMonogram({ colorValue = 0, size = 32 }) {
|
|
2809
3147
|
const fg = `rgb(${colorValue}, ${colorValue}, ${colorValue})`;
|
|
2810
|
-
return /* @__PURE__ */
|
|
3148
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
2811
3149
|
"svg",
|
|
2812
3150
|
{
|
|
2813
3151
|
width: size,
|
|
@@ -2816,15 +3154,15 @@ function LogoMonogram({ colorValue = 0, size = 32 }) {
|
|
|
2816
3154
|
fill: "none",
|
|
2817
3155
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2818
3156
|
},
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
3157
|
+
/* @__PURE__ */ React19__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 }),
|
|
3158
|
+
/* @__PURE__ */ React19__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 }),
|
|
3159
|
+
/* @__PURE__ */ React19__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 }),
|
|
3160
|
+
/* @__PURE__ */ React19__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 }),
|
|
3161
|
+
/* @__PURE__ */ React19__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 })
|
|
2824
3162
|
);
|
|
2825
3163
|
}
|
|
2826
3164
|
function LogoWordmark({ fill = "black" }) {
|
|
2827
|
-
return /* @__PURE__ */
|
|
3165
|
+
return /* @__PURE__ */ React19__default.default.createElement(
|
|
2828
3166
|
"svg",
|
|
2829
3167
|
{
|
|
2830
3168
|
height: 32,
|
|
@@ -2832,16 +3170,16 @@ function LogoWordmark({ fill = "black" }) {
|
|
|
2832
3170
|
fill: "none",
|
|
2833
3171
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2834
3172
|
},
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
/* @__PURE__ */
|
|
2838
|
-
/* @__PURE__ */
|
|
2839
|
-
/* @__PURE__ */
|
|
2840
|
-
/* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
/* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
3173
|
+
/* @__PURE__ */ React19__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 }),
|
|
3174
|
+
/* @__PURE__ */ React19__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 }),
|
|
3175
|
+
/* @__PURE__ */ React19__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 }),
|
|
3176
|
+
/* @__PURE__ */ React19__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 }),
|
|
3177
|
+
/* @__PURE__ */ React19__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 }),
|
|
3178
|
+
/* @__PURE__ */ React19__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 }),
|
|
3179
|
+
/* @__PURE__ */ React19__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 }),
|
|
3180
|
+
/* @__PURE__ */ React19__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 }),
|
|
3181
|
+
/* @__PURE__ */ React19__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 }),
|
|
3182
|
+
/* @__PURE__ */ React19__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 })
|
|
2845
3183
|
);
|
|
2846
3184
|
}
|
|
2847
3185
|
|
|
@@ -3902,13 +4240,16 @@ exports.Icon = Icon;
|
|
|
3902
4240
|
exports.LogoMonogram = LogoMonogram;
|
|
3903
4241
|
exports.LogoWordmark = LogoWordmark;
|
|
3904
4242
|
exports.Navbar = Navbar;
|
|
4243
|
+
exports.Page = Page;
|
|
3905
4244
|
exports.Popover = Popover;
|
|
4245
|
+
exports.Section = Section;
|
|
3906
4246
|
exports.Select = Select;
|
|
3907
4247
|
exports.Sidebar = Sidebar;
|
|
3908
4248
|
exports.Slider = Slider;
|
|
3909
4249
|
exports.Text = Text3;
|
|
3910
4250
|
exports.TextInput = TextInput;
|
|
3911
4251
|
exports.Toggle = Toggle;
|
|
4252
|
+
exports.Viewport = Viewport;
|
|
3912
4253
|
exports.Wrapper = Wrapper;
|
|
3913
4254
|
exports.generateComponentCode = generateComponentCode;
|
|
3914
4255
|
exports.getCategory = getCategory;
|