@newtonedev/components 0.1.7 → 0.1.8
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/form-controls/Select/Select.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -1
- package/dist/fonts/GoogleFontLoader.d.ts +5 -4
- package/dist/fonts/GoogleFontLoader.d.ts.map +1 -1
- package/dist/fonts/SelfHostedFontLoader.d.ts +14 -0
- package/dist/fonts/SelfHostedFontLoader.d.ts.map +1 -0
- package/dist/fonts/buildGoogleFontsUrl.d.ts +1 -16
- package/dist/fonts/buildGoogleFontsUrl.d.ts.map +1 -1
- package/dist/fonts/measureFont.d.ts +18 -0
- package/dist/fonts/measureFont.d.ts.map +1 -0
- package/dist/fonts/reportQueue.d.ts +7 -0
- package/dist/fonts/reportQueue.d.ts.map +1 -0
- package/dist/fonts/useLocalCalibration.d.ts +19 -0
- package/dist/fonts/useLocalCalibration.d.ts.map +1 -0
- package/dist/fonts/useTypographyCalibrations.d.ts +11 -0
- package/dist/fonts/useTypographyCalibrations.d.ts.map +1 -0
- package/dist/index.cjs +628 -422
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +567 -376
- package/dist/index.js.map +1 -1
- package/dist/primitives/Icon/Icon.types.d.ts +1 -1
- package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
- package/dist/primitives/Text/Text.d.ts +33 -8
- package/dist/primitives/Text/Text.d.ts.map +1 -1
- package/dist/primitives/Text/Text.spans.d.ts +22 -0
- package/dist/primitives/Text/Text.spans.d.ts.map +1 -0
- package/dist/primitives/Text/Text.types.d.ts +75 -27
- package/dist/primitives/Text/Text.types.d.ts.map +1 -1
- package/dist/primitives/Text/index.d.ts +23 -2
- package/dist/primitives/Text/index.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/registry/codegen.d.ts.map +1 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/types.d.ts +2 -0
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/theme/NewtoneProvider.d.ts +9 -1
- package/dist/theme/NewtoneProvider.d.ts.map +1 -1
- package/dist/theme/defaults.d.ts +1 -0
- package/dist/theme/defaults.d.ts.map +1 -1
- package/dist/theme/types.d.ts +48 -32
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/useBreakpoint.d.ts +9 -0
- package/dist/theme/useBreakpoint.d.ts.map +1 -0
- package/dist/tokens/computeTokens.d.ts +9 -22
- package/dist/tokens/computeTokens.d.ts.map +1 -1
- package/dist/tokens/types.d.ts +40 -22
- package/dist/tokens/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/composites/actions/Button/Button.styles.ts +3 -3
- package/src/composites/actions/Button/Button.tsx +3 -2
- package/src/composites/form-controls/Select/Select.styles.ts +8 -8
- package/src/composites/form-controls/Select/Select.tsx +1 -1
- package/src/composites/form-controls/Select/SelectOption.tsx +3 -3
- package/src/composites/form-controls/TextInput/TextInput.styles.ts +5 -5
- package/src/composites/form-controls/Toggle/Toggle.styles.ts +3 -3
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +6 -6
- package/src/composites/range-inputs/HueSlider/HueSlider.styles.ts +9 -9
- package/src/composites/range-inputs/Slider/Slider.styles.ts +9 -9
- package/src/fonts/GoogleFontLoader.tsx +25 -10
- package/src/fonts/SelfHostedFontLoader.tsx +44 -0
- package/src/fonts/buildGoogleFontsUrl.ts +2 -31
- package/src/fonts/measureFont.ts +42 -0
- package/src/fonts/reportQueue.ts +54 -0
- package/src/fonts/useLocalCalibration.ts +97 -0
- package/src/fonts/useTypographyCalibrations.ts +15 -0
- package/src/index.ts +16 -7
- package/src/primitives/Frame/Frame.tsx +3 -3
- package/src/primitives/Icon/Icon.tsx +1 -1
- package/src/primitives/Icon/Icon.types.ts +1 -1
- package/src/primitives/Text/Text.spans.ts +57 -0
- package/src/primitives/Text/Text.tsx +205 -53
- package/src/primitives/Text/Text.types.ts +80 -27
- package/src/primitives/Text/index.ts +27 -3
- package/src/primitives/index.ts +3 -2
- package/src/registry/codegen.ts +1 -0
- package/src/registry/registry.ts +55 -53
- package/src/registry/types.ts +2 -0
- package/src/theme/NewtoneProvider.tsx +18 -2
- package/src/theme/defaults.ts +8 -28
- package/src/theme/types.ts +63 -33
- package/src/theme/useBreakpoint.ts +14 -0
- package/src/tokens/computeTokens.ts +23 -19
- package/src/tokens/types.ts +10 -24
- package/dist/fonts/googleFonts.d.ts +0 -20
- package/dist/fonts/googleFonts.d.ts.map +0 -1
- package/src/fonts/googleFonts.ts +0 -87
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DEFAULT_NEUTRAL_SATURATION, DEFAULT_NEUTRAL_HUE, DEFAULT_ACCENT_SATURATION, DEFAULT_ACCENT_HUE, DEFAULT_SUCCESS_SATURATION, DEFAULT_SUCCESS_HUE, DEFAULT_WARNING_SATURATION, DEFAULT_WARNING_HUE, DEFAULT_ERROR_SATURATION, DEFAULT_ERROR_HUE
|
|
3
|
-
import {
|
|
1
|
+
import React14, { createContext, useState, useMemo, useEffect, useContext, useCallback, useRef } from 'react';
|
|
2
|
+
import { srgbToHex, getColor, DEFAULT_NEUTRAL_SATURATION, DEFAULT_NEUTRAL_HUE, DEFAULT_ACCENT_SATURATION, DEFAULT_ACCENT_HUE, DEFAULT_SUCCESS_SATURATION, DEFAULT_SUCCESS_HUE, DEFAULT_WARNING_SATURATION, DEFAULT_WARNING_HUE, DEFAULT_ERROR_SATURATION, DEFAULT_ERROR_HUE } from 'newtone';
|
|
3
|
+
import { ROLE_DEFAULT_WEIGHTS, BREAKPOINT_ROLE_SCALE, scaleRoleStep, SEMANTIC_WEIGHT_MAP, resolveResponsiveSize, estimateLineWidths, REFERENCE_LINE_HEIGHT_RATIO, buildFontFeatureSettings, getBreakpointForWidth, fontConfigToFamily, DEFAULT_ROLE_SCALES, DEFAULT_LINE_HEIGHTS, DEFAULT_FONT_SIZES, DEFAULT_FONT_SLOTS, buildGoogleFontsUrl } from '@newtonedev/fonts';
|
|
4
|
+
export { DEFAULT_FONT_SIZES, DEFAULT_LINE_HEIGHTS, DEFAULT_ROLE_SCALES, buildGoogleFontsUrl } from '@newtonedev/fonts';
|
|
5
|
+
import { Text, View, useWindowDimensions, Pressable, TextInput as TextInput$1, ScrollView, PanResponder, Animated, StyleSheet } from 'react-native';
|
|
4
6
|
|
|
5
7
|
// src/theme/NewtoneProvider.tsx
|
|
6
8
|
var DEFAULT_THEME_CONFIG = {
|
|
@@ -54,40 +56,10 @@ var DEFAULT_THEME_CONFIG = {
|
|
|
54
56
|
pill: 999
|
|
55
57
|
},
|
|
56
58
|
typography: {
|
|
57
|
-
fonts:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
fallback: "SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
62
|
-
},
|
|
63
|
-
display: {
|
|
64
|
-
type: "system",
|
|
65
|
-
family: "system-ui",
|
|
66
|
-
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
67
|
-
},
|
|
68
|
-
default: {
|
|
69
|
-
type: "system",
|
|
70
|
-
family: "system-ui",
|
|
71
|
-
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
scale: {
|
|
75
|
-
xs: 10,
|
|
76
|
-
// 16 / 1.25^2
|
|
77
|
-
sm: 13,
|
|
78
|
-
// 16 / 1.25
|
|
79
|
-
base: 16,
|
|
80
|
-
md: 20,
|
|
81
|
-
// 16 * 1.25
|
|
82
|
-
lg: 25,
|
|
83
|
-
// 16 * 1.25^2
|
|
84
|
-
xl: 31,
|
|
85
|
-
// 16 * 1.25^3
|
|
86
|
-
xxl: 39
|
|
87
|
-
// 16 * 1.25^4
|
|
88
|
-
},
|
|
89
|
-
lineHeight: { tight: 1.25, normal: 1.5, relaxed: 1.75 },
|
|
90
|
-
fontWeight: { regular: 400, medium: 500, semibold: 600, bold: 700 }
|
|
59
|
+
fonts: DEFAULT_FONT_SLOTS,
|
|
60
|
+
fontSizes: DEFAULT_FONT_SIZES,
|
|
61
|
+
lineHeights: DEFAULT_LINE_HEIGHTS,
|
|
62
|
+
roles: DEFAULT_ROLE_SCALES
|
|
91
63
|
},
|
|
92
64
|
icons: {
|
|
93
65
|
variant: "rounded",
|
|
@@ -99,20 +71,6 @@ var DEFAULT_THEME_CONFIG = {
|
|
|
99
71
|
}
|
|
100
72
|
};
|
|
101
73
|
|
|
102
|
-
// src/fonts/buildGoogleFontsUrl.ts
|
|
103
|
-
function buildGoogleFontsUrl(fonts) {
|
|
104
|
-
const googleFonts = [fonts.mono, fonts.display, fonts.default].filter(
|
|
105
|
-
(f) => f.type === "google"
|
|
106
|
-
);
|
|
107
|
-
if (googleFonts.length === 0) return null;
|
|
108
|
-
const unique = [...new Map(googleFonts.map((f) => [f.family, f])).values()];
|
|
109
|
-
const families = unique.map((f) => {
|
|
110
|
-
const encoded = f.family.replace(/ /g, "+");
|
|
111
|
-
return `family=${encoded}:wght@400;500;600;700`;
|
|
112
|
-
});
|
|
113
|
-
return `https://fonts.googleapis.com/css2?${families.join("&")}&display=swap`;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
74
|
// src/fonts/GoogleFontLoader.tsx
|
|
117
75
|
function GoogleFontLoader({ fonts }) {
|
|
118
76
|
const linkRef = useRef(null);
|
|
@@ -138,15 +96,52 @@ function GoogleFontLoader({ fonts }) {
|
|
|
138
96
|
}
|
|
139
97
|
};
|
|
140
98
|
}, [
|
|
141
|
-
fonts.
|
|
142
|
-
fonts.
|
|
143
|
-
fonts.
|
|
144
|
-
fonts.
|
|
145
|
-
fonts.
|
|
146
|
-
fonts.
|
|
99
|
+
fonts.main.config.family,
|
|
100
|
+
fonts.main.config.type,
|
|
101
|
+
fonts.main.weights.regular,
|
|
102
|
+
fonts.main.weights.medium,
|
|
103
|
+
fonts.main.weights.bold,
|
|
104
|
+
fonts.display.config.family,
|
|
105
|
+
fonts.display.config.type,
|
|
106
|
+
fonts.display.weights.regular,
|
|
107
|
+
fonts.display.weights.medium,
|
|
108
|
+
fonts.display.weights.bold,
|
|
109
|
+
fonts.mono.config.family,
|
|
110
|
+
fonts.mono.config.type,
|
|
111
|
+
fonts.mono.weights.regular,
|
|
112
|
+
fonts.mono.weights.medium,
|
|
113
|
+
fonts.mono.weights.bold,
|
|
114
|
+
fonts.currency.config.family,
|
|
115
|
+
fonts.currency.config.type,
|
|
116
|
+
fonts.currency.weights.regular,
|
|
117
|
+
fonts.currency.weights.medium,
|
|
118
|
+
fonts.currency.weights.bold
|
|
147
119
|
]);
|
|
148
120
|
return null;
|
|
149
121
|
}
|
|
122
|
+
function SelfHostedFontLoader({ fontFaceCss }) {
|
|
123
|
+
const styleRef = useRef(null);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (typeof document === "undefined") return;
|
|
126
|
+
if (styleRef.current) {
|
|
127
|
+
styleRef.current.remove();
|
|
128
|
+
styleRef.current = null;
|
|
129
|
+
}
|
|
130
|
+
if (!fontFaceCss) return;
|
|
131
|
+
const style = document.createElement("style");
|
|
132
|
+
style.setAttribute("data-newtone-fonts", "self-hosted");
|
|
133
|
+
style.textContent = fontFaceCss;
|
|
134
|
+
document.head.appendChild(style);
|
|
135
|
+
styleRef.current = style;
|
|
136
|
+
return () => {
|
|
137
|
+
if (styleRef.current) {
|
|
138
|
+
styleRef.current.remove();
|
|
139
|
+
styleRef.current = null;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}, [fontFaceCss]);
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
150
145
|
function IconFontLoader({ icons }) {
|
|
151
146
|
const linkRef = useRef(null);
|
|
152
147
|
useEffect(() => {
|
|
@@ -180,18 +175,21 @@ var ThemeContext = createContext(null);
|
|
|
180
175
|
function NewtoneProvider({
|
|
181
176
|
config = DEFAULT_THEME_CONFIG,
|
|
182
177
|
initialMode = "light",
|
|
183
|
-
children
|
|
178
|
+
children,
|
|
179
|
+
reportingEndpoint,
|
|
180
|
+
fontFaceCss
|
|
184
181
|
}) {
|
|
185
182
|
const [mode, setMode] = useState(initialMode);
|
|
186
183
|
const value = useMemo(
|
|
187
184
|
() => ({
|
|
188
185
|
config,
|
|
189
186
|
mode,
|
|
190
|
-
setMode
|
|
187
|
+
setMode,
|
|
188
|
+
reportingEndpoint
|
|
191
189
|
}),
|
|
192
|
-
[config, mode]
|
|
190
|
+
[config, mode, reportingEndpoint]
|
|
193
191
|
);
|
|
194
|
-
return /* @__PURE__ */
|
|
192
|
+
return /* @__PURE__ */ React14.createElement(ThemeContext.Provider, { value }, fontFaceCss ? /* @__PURE__ */ React14.createElement(SelfHostedFontLoader, { fontFaceCss }) : /* @__PURE__ */ React14.createElement(GoogleFontLoader, { fonts: config.typography.fonts }), /* @__PURE__ */ React14.createElement(IconFontLoader, { icons: config.icons }), children);
|
|
195
193
|
}
|
|
196
194
|
function useNewtoneTheme() {
|
|
197
195
|
const context = useContext(ThemeContext);
|
|
@@ -274,10 +272,6 @@ var ERROR_DEFAULTS = {
|
|
|
274
272
|
border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
|
|
275
273
|
}
|
|
276
274
|
};
|
|
277
|
-
function fontConfigToFamily(font) {
|
|
278
|
-
const family = font.family.includes(" ") ? `"${font.family}"` : font.family;
|
|
279
|
-
return `${family}, ${font.fallback}`;
|
|
280
|
-
}
|
|
281
275
|
var clamp = (n) => Math.max(0, Math.min(1, n));
|
|
282
276
|
function computePaletteTokens(palette, defaults, mode, elevation, dynamicRange, elevationDelta, effectiveTextMode, autoAccentNv, neutralTextPrimary, neutralBgElevated) {
|
|
283
277
|
const modeDefaults = defaults[mode];
|
|
@@ -532,13 +526,25 @@ function computeTokens(config, mode, elevation, spacing, radius, typography, ico
|
|
|
532
526
|
radius,
|
|
533
527
|
typography: {
|
|
534
528
|
fonts: {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
529
|
+
main: {
|
|
530
|
+
family: fontConfigToFamily(typography.fonts.main.config),
|
|
531
|
+
weights: typography.fonts.main.weights
|
|
532
|
+
},
|
|
533
|
+
display: {
|
|
534
|
+
family: fontConfigToFamily(typography.fonts.display.config),
|
|
535
|
+
weights: typography.fonts.display.weights
|
|
536
|
+
},
|
|
537
|
+
mono: {
|
|
538
|
+
family: fontConfigToFamily(typography.fonts.mono.config),
|
|
539
|
+
weights: typography.fonts.mono.weights
|
|
540
|
+
},
|
|
541
|
+
currency: {
|
|
542
|
+
family: fontConfigToFamily(typography.fonts.currency.config),
|
|
543
|
+
weights: typography.fonts.currency.weights
|
|
544
|
+
}
|
|
538
545
|
},
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
weight: typography.fontWeight
|
|
546
|
+
fontSizes: typography.fontSizes,
|
|
547
|
+
lineHeights: typography.lineHeights
|
|
542
548
|
},
|
|
543
549
|
icons: {
|
|
544
550
|
variant: icons.variant,
|
|
@@ -653,7 +659,7 @@ function getSizeConfig(size, tokens) {
|
|
|
653
659
|
padding: 8,
|
|
654
660
|
gap: tokens.spacing["08"],
|
|
655
661
|
borderRadius: 8,
|
|
656
|
-
textSize: "
|
|
662
|
+
textSize: "md",
|
|
657
663
|
// 16px
|
|
658
664
|
iconSize: 24
|
|
659
665
|
},
|
|
@@ -661,7 +667,7 @@ function getSizeConfig(size, tokens) {
|
|
|
661
667
|
padding: 12,
|
|
662
668
|
gap: tokens.spacing["08"],
|
|
663
669
|
borderRadius: 12,
|
|
664
|
-
textSize: "
|
|
670
|
+
textSize: "md",
|
|
665
671
|
// 16px
|
|
666
672
|
iconSize: 24
|
|
667
673
|
},
|
|
@@ -669,7 +675,7 @@ function getSizeConfig(size, tokens) {
|
|
|
669
675
|
padding: 16,
|
|
670
676
|
gap: tokens.spacing["08"],
|
|
671
677
|
borderRadius: 16,
|
|
672
|
-
textSize: "
|
|
678
|
+
textSize: "md",
|
|
673
679
|
// 16px
|
|
674
680
|
iconSize: 24
|
|
675
681
|
}
|
|
@@ -784,7 +790,7 @@ function Icon({
|
|
|
784
790
|
}) {
|
|
785
791
|
const tokens = useTokens();
|
|
786
792
|
const iconStyle = useMemo(() => {
|
|
787
|
-
const fontSize = size ?? tokens.typography.
|
|
793
|
+
const fontSize = size ?? tokens.typography.fontSizes["05"];
|
|
788
794
|
const getOpticalSize = (size2) => {
|
|
789
795
|
if (size2 <= 22) return 20;
|
|
790
796
|
if (size2 <= 32) return 24;
|
|
@@ -813,7 +819,7 @@ function Icon({
|
|
|
813
819
|
...style
|
|
814
820
|
};
|
|
815
821
|
}, [tokens, size, opticalSize, fill, color, style]);
|
|
816
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ React14.createElement(
|
|
817
823
|
Text,
|
|
818
824
|
{
|
|
819
825
|
ref,
|
|
@@ -826,6 +832,118 @@ function Icon({
|
|
|
826
832
|
name
|
|
827
833
|
);
|
|
828
834
|
}
|
|
835
|
+
|
|
836
|
+
// src/fonts/measureFont.ts
|
|
837
|
+
var REF_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ";
|
|
838
|
+
async function measureAvgCharWidth(fontFamily, fontWeight, fallback, fontSize = 16) {
|
|
839
|
+
if (typeof document === "undefined") return 0.55;
|
|
840
|
+
try {
|
|
841
|
+
await document.fonts.load(`${fontWeight} ${fontSize}px "${fontFamily}"`);
|
|
842
|
+
const canvas = document.createElement("canvas");
|
|
843
|
+
const ctx = canvas.getContext("2d");
|
|
844
|
+
if (!ctx) return 0.55;
|
|
845
|
+
ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", ${fallback}`;
|
|
846
|
+
const ratio = ctx.measureText(REF_STRING).width / REF_STRING.length / fontSize;
|
|
847
|
+
return Math.round(ratio * 1e3) / 1e3;
|
|
848
|
+
} catch {
|
|
849
|
+
return 0.55;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// src/fonts/useLocalCalibration.ts
|
|
854
|
+
var STORAGE_KEY = "newtone:font-metrics:v1";
|
|
855
|
+
var TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
856
|
+
function readCache() {
|
|
857
|
+
if (typeof localStorage === "undefined") return {};
|
|
858
|
+
try {
|
|
859
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
860
|
+
return raw ? JSON.parse(raw) : {};
|
|
861
|
+
} catch {
|
|
862
|
+
return {};
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
function writeCache(cache) {
|
|
866
|
+
if (typeof localStorage === "undefined") return;
|
|
867
|
+
try {
|
|
868
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(cache));
|
|
869
|
+
} catch {
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function cacheKey(fontFamily, fontWeight) {
|
|
873
|
+
return `${fontFamily}:${fontWeight}`;
|
|
874
|
+
}
|
|
875
|
+
function useLocalCalibration(fontFamily, fontWeight, fallback, baseCalibration) {
|
|
876
|
+
const key = cacheKey(fontFamily, fontWeight);
|
|
877
|
+
const [ratio, setRatio] = useState(() => {
|
|
878
|
+
const cache = readCache();
|
|
879
|
+
const entry = cache[key];
|
|
880
|
+
if (entry && Date.now() - entry.measuredAt < TTL_MS) {
|
|
881
|
+
return entry.ratio;
|
|
882
|
+
}
|
|
883
|
+
return baseCalibration ?? 0.55;
|
|
884
|
+
});
|
|
885
|
+
useEffect(() => {
|
|
886
|
+
const cache = readCache();
|
|
887
|
+
const entry = cache[key];
|
|
888
|
+
if (entry && Date.now() - entry.measuredAt < TTL_MS) {
|
|
889
|
+
if (entry.ratio !== ratio) setRatio(entry.ratio);
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
let cancelled = false;
|
|
893
|
+
measureAvgCharWidth(fontFamily, fontWeight, fallback).then((measured) => {
|
|
894
|
+
if (cancelled) return;
|
|
895
|
+
const updated = { ...readCache(), [key]: { ratio: measured, measuredAt: Date.now() } };
|
|
896
|
+
writeCache(updated);
|
|
897
|
+
setRatio(measured);
|
|
898
|
+
});
|
|
899
|
+
return () => {
|
|
900
|
+
cancelled = true;
|
|
901
|
+
};
|
|
902
|
+
}, [key, fontFamily, fontWeight, fallback]);
|
|
903
|
+
return ratio;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// src/fonts/useTypographyCalibrations.ts
|
|
907
|
+
function useTypographyCalibrations() {
|
|
908
|
+
const { config } = useNewtoneTheme();
|
|
909
|
+
return config.typography.calibrations ?? {};
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// src/fonts/reportQueue.ts
|
|
913
|
+
var queue = [];
|
|
914
|
+
var flushTimer;
|
|
915
|
+
function flush() {
|
|
916
|
+
if (queue.length === 0) return;
|
|
917
|
+
const byEndpoint = /* @__PURE__ */ new Map();
|
|
918
|
+
for (const item of queue) {
|
|
919
|
+
const group = byEndpoint.get(item.endpoint) ?? [];
|
|
920
|
+
group.push(item.payload);
|
|
921
|
+
byEndpoint.set(item.endpoint, group);
|
|
922
|
+
}
|
|
923
|
+
queue.length = 0;
|
|
924
|
+
for (const [endpoint, observations] of byEndpoint) {
|
|
925
|
+
fetch(endpoint, {
|
|
926
|
+
method: "POST",
|
|
927
|
+
headers: { "Content-Type": "application/json" },
|
|
928
|
+
body: JSON.stringify({ observations }),
|
|
929
|
+
// keepalive: true allows the request to outlive the page
|
|
930
|
+
keepalive: true
|
|
931
|
+
}).catch(() => {
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
function enqueueObservation(endpoint, payload) {
|
|
936
|
+
queue.push({ endpoint, payload });
|
|
937
|
+
if (flushTimer !== void 0) clearTimeout(flushTimer);
|
|
938
|
+
flushTimer = setTimeout(flush, 2e3);
|
|
939
|
+
}
|
|
940
|
+
function useBreakpoint() {
|
|
941
|
+
const { width } = useWindowDimensions();
|
|
942
|
+
return getBreakpointForWidth(width);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// src/primitives/Text/Text.tsx
|
|
946
|
+
var TextScopeContext = createContext(null);
|
|
829
947
|
function resolveTextColor(color, tokens) {
|
|
830
948
|
switch (color) {
|
|
831
949
|
case "primary":
|
|
@@ -846,53 +964,188 @@ function resolveTextColor(color, tokens) {
|
|
|
846
964
|
return srgbToHex(tokens.error.fill.srgb);
|
|
847
965
|
}
|
|
848
966
|
}
|
|
849
|
-
|
|
967
|
+
var ADAPTIVE_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
968
|
+
var ROLE_HEADING_LEVEL = {
|
|
969
|
+
headline: 1,
|
|
970
|
+
title: 2,
|
|
971
|
+
heading: 3
|
|
972
|
+
};
|
|
973
|
+
function extractCharacterCount(node) {
|
|
974
|
+
if (typeof node === "string") return node.length;
|
|
975
|
+
if (typeof node === "number") return String(node).length;
|
|
976
|
+
if (!node) return 0;
|
|
977
|
+
if (Array.isArray(node)) {
|
|
978
|
+
return node.reduce((sum, child) => sum + extractCharacterCount(child), 0);
|
|
979
|
+
}
|
|
980
|
+
if (typeof node === "object" && "props" in node) {
|
|
981
|
+
return extractCharacterCount(node.props?.children);
|
|
982
|
+
}
|
|
983
|
+
return 0;
|
|
984
|
+
}
|
|
985
|
+
function TextBase({
|
|
850
986
|
children,
|
|
851
|
-
|
|
852
|
-
|
|
987
|
+
scope = "main",
|
|
988
|
+
role = "body",
|
|
853
989
|
color = "primary",
|
|
854
|
-
|
|
855
|
-
lineHeight = "normal",
|
|
990
|
+
size: sizeOverride,
|
|
856
991
|
align,
|
|
857
992
|
numberOfLines,
|
|
858
993
|
elevation = 1,
|
|
859
994
|
style,
|
|
860
|
-
|
|
861
|
-
accessibilityRole,
|
|
862
|
-
// Testing & platform
|
|
995
|
+
accessibilityRole: accessibilityRoleOverride,
|
|
863
996
|
testID,
|
|
864
997
|
nativeID,
|
|
865
|
-
ref
|
|
998
|
+
ref,
|
|
999
|
+
responsive = false,
|
|
1000
|
+
centerVertically = false,
|
|
1001
|
+
features
|
|
866
1002
|
}) {
|
|
867
1003
|
const tokens = useTokens(elevation);
|
|
1004
|
+
const { config, reportingEndpoint } = useNewtoneTheme();
|
|
1005
|
+
const size = sizeOverride ?? "md";
|
|
1006
|
+
const fontSlot = tokens.typography.fonts[scope];
|
|
1007
|
+
const resolvedFontWeight = config.typography.roleWeights?.[role] ?? ROLE_DEFAULT_WEIGHTS[role];
|
|
1008
|
+
const breakpoint = useBreakpoint();
|
|
1009
|
+
const baseStep = config.typography.roles[role][size];
|
|
1010
|
+
const bpScale = BREAKPOINT_ROLE_SCALE[breakpoint][role];
|
|
1011
|
+
const step = bpScale === 1 ? baseStep : scaleRoleStep(baseStep, bpScale);
|
|
1012
|
+
const calibrations = useTypographyCalibrations();
|
|
1013
|
+
const fontSlotFull = config.typography.fonts[scope];
|
|
1014
|
+
const localRatio = useLocalCalibration(
|
|
1015
|
+
fontSlot.family,
|
|
1016
|
+
SEMANTIC_WEIGHT_MAP.regular,
|
|
1017
|
+
fontSlotFull.config.fallback,
|
|
1018
|
+
calibrations[fontSlot.family]
|
|
1019
|
+
);
|
|
1020
|
+
const isAdaptive = ADAPTIVE_ROLES.has(role);
|
|
1021
|
+
const [containerWidth, setContainerWidth] = useState(null);
|
|
1022
|
+
const characterCount = useMemo(() => extractCharacterCount(children), [children]);
|
|
1023
|
+
const resolvedStep = useMemo(
|
|
1024
|
+
() => resolveResponsiveSize(
|
|
1025
|
+
{
|
|
1026
|
+
role,
|
|
1027
|
+
size,
|
|
1028
|
+
responsive: responsive && isAdaptive,
|
|
1029
|
+
fontFamily: fontSlot.family,
|
|
1030
|
+
maxFontSize: step.fontSize,
|
|
1031
|
+
minFontSize: Math.max(8, Math.round(step.fontSize * 0.7))
|
|
1032
|
+
},
|
|
1033
|
+
config.typography.roles,
|
|
1034
|
+
containerWidth != null ? { containerWidth, characterCount } : void 0,
|
|
1035
|
+
{ [fontSlot.family]: localRatio }
|
|
1036
|
+
),
|
|
1037
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1038
|
+
[role, size, responsive, isAdaptive, fontSlot.family, step.fontSize, config.typography.roles, containerWidth, characterCount, localRatio]
|
|
1039
|
+
);
|
|
1040
|
+
useEffect(() => {
|
|
1041
|
+
if (!reportingEndpoint || !responsive || !isAdaptive || containerWidth == null) return;
|
|
1042
|
+
const lineWidths = estimateLineWidths(characterCount, containerWidth, resolvedStep.fontSize, localRatio);
|
|
1043
|
+
const lastLine = lineWidths[lineWidths.length - 1];
|
|
1044
|
+
enqueueObservation(reportingEndpoint, {
|
|
1045
|
+
fontFamily: fontSlot.family,
|
|
1046
|
+
fontWeight: resolvedFontWeight,
|
|
1047
|
+
role,
|
|
1048
|
+
size,
|
|
1049
|
+
fontSize: resolvedStep.fontSize,
|
|
1050
|
+
containerWidth,
|
|
1051
|
+
characterCount,
|
|
1052
|
+
lineCount: lineWidths.length,
|
|
1053
|
+
lastLineRatio: containerWidth > 0 ? lastLine / containerWidth : 1
|
|
1054
|
+
});
|
|
1055
|
+
}, [reportingEndpoint, resolvedStep.fontSize, containerWidth]);
|
|
868
1056
|
const resolvedStyle = useMemo(() => {
|
|
869
|
-
const
|
|
1057
|
+
const activeStep = responsive && isAdaptive ? resolvedStep : step;
|
|
1058
|
+
const currentMetrics = config.typography.fontMetrics?.[fontSlot.family];
|
|
1059
|
+
const correctedLineHeight = currentMetrics ? Math.round(activeStep.lineHeight * currentMetrics.naturalLineHeightRatio / REFERENCE_LINE_HEIGHT_RATIO / 4) * 4 : activeStep.lineHeight;
|
|
1060
|
+
const vcOffset = centerVertically && currentMetrics ? Math.round(currentMetrics.verticalCenterOffset * activeStep.fontSize * 2) / 2 : 0;
|
|
1061
|
+
const activeFeatures = features ? currentMetrics?.features ? features.filter((tag) => currentMetrics.features.includes(tag)) : [...features] : [];
|
|
1062
|
+
const featureSettings = activeFeatures.length > 0 ? buildFontFeatureSettings(activeFeatures) : void 0;
|
|
870
1063
|
return {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
// Font weight is stored as a number (e.g. 400, 600) but React Native expects a string.
|
|
875
|
-
fontWeight: String(tokens.typography.weight[weight]),
|
|
876
|
-
// Convert the theme color from internal sRGB format to a hex string (e.g. '#1a1a1a').
|
|
1064
|
+
fontFamily: fontSlot.family,
|
|
1065
|
+
fontSize: activeStep.fontSize,
|
|
1066
|
+
fontWeight: String(resolvedFontWeight),
|
|
877
1067
|
color: resolveTextColor(color, tokens),
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1068
|
+
lineHeight: correctedLineHeight,
|
|
1069
|
+
textAlign: align,
|
|
1070
|
+
...vcOffset !== 0 ? { transform: [{ translateY: vcOffset }] } : {},
|
|
1071
|
+
...featureSettings ? { fontFeatureSettings: featureSettings } : {}
|
|
881
1072
|
};
|
|
882
|
-
}, [tokens,
|
|
883
|
-
|
|
1073
|
+
}, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features]);
|
|
1074
|
+
const inferredA11yRole = role === "headline" || role === "title" || role === "heading" ? "header" : void 0;
|
|
1075
|
+
const effectiveA11yRole = accessibilityRoleOverride ?? inferredA11yRole;
|
|
1076
|
+
const ariaLevel = effectiveA11yRole === "header" ? ROLE_HEADING_LEVEL[role] : void 0;
|
|
1077
|
+
const scopeCtx = useMemo(() => ({ weights: SEMANTIC_WEIGHT_MAP }), []);
|
|
1078
|
+
const textNode = /* @__PURE__ */ React14.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React14.createElement(
|
|
884
1079
|
Text,
|
|
885
1080
|
{
|
|
886
1081
|
ref,
|
|
887
1082
|
testID,
|
|
888
1083
|
nativeID,
|
|
889
|
-
accessibilityRole,
|
|
1084
|
+
accessibilityRole: effectiveA11yRole,
|
|
1085
|
+
"aria-level": ariaLevel,
|
|
890
1086
|
style: style ? [resolvedStyle, ...Array.isArray(style) ? style : [style]] : resolvedStyle,
|
|
891
1087
|
numberOfLines
|
|
892
1088
|
},
|
|
893
1089
|
children
|
|
1090
|
+
));
|
|
1091
|
+
if (responsive && isAdaptive) {
|
|
1092
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1093
|
+
View,
|
|
1094
|
+
{
|
|
1095
|
+
onLayout: (e) => {
|
|
1096
|
+
const w = e.nativeEvent.layout.width;
|
|
1097
|
+
if (w > 0) setContainerWidth(w);
|
|
1098
|
+
},
|
|
1099
|
+
style: { width: "100%" }
|
|
1100
|
+
},
|
|
1101
|
+
textNode
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
return textNode;
|
|
1105
|
+
}
|
|
1106
|
+
function TextSpan({ children, color, weight, italic, underline, highlight, style }) {
|
|
1107
|
+
const tokens = useTokens(1);
|
|
1108
|
+
const scopeCtx = useContext(TextScopeContext);
|
|
1109
|
+
const spanStyle = useMemo(() => {
|
|
1110
|
+
const s = {};
|
|
1111
|
+
if (color) s.color = resolveTextColor(color, tokens);
|
|
1112
|
+
if (weight && scopeCtx) s.fontWeight = String(scopeCtx.weights[weight]);
|
|
1113
|
+
if (italic) s.fontStyle = "italic";
|
|
1114
|
+
if (underline) s.textDecorationLine = "underline";
|
|
1115
|
+
if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens);
|
|
1116
|
+
return s;
|
|
1117
|
+
}, [tokens, scopeCtx, color, weight, italic, underline, highlight]);
|
|
1118
|
+
return React14.createElement(
|
|
1119
|
+
Text,
|
|
1120
|
+
{ style: style ? [spanStyle, ...Array.isArray(style) ? style : [style]] : spanStyle },
|
|
1121
|
+
children
|
|
894
1122
|
);
|
|
895
1123
|
}
|
|
1124
|
+
function TextBold(props) {
|
|
1125
|
+
return React14.createElement(TextSpan, { ...props, weight: "bold" });
|
|
1126
|
+
}
|
|
1127
|
+
function TextMedium(props) {
|
|
1128
|
+
return React14.createElement(TextSpan, { ...props, weight: "medium" });
|
|
1129
|
+
}
|
|
1130
|
+
function TextItalic(props) {
|
|
1131
|
+
return React14.createElement(TextSpan, { ...props, italic: true });
|
|
1132
|
+
}
|
|
1133
|
+
function TextUnderline(props) {
|
|
1134
|
+
return React14.createElement(TextSpan, { ...props, underline: true });
|
|
1135
|
+
}
|
|
1136
|
+
function TextHighlight(props) {
|
|
1137
|
+
return React14.createElement(TextSpan, props);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
// src/primitives/Text/index.ts
|
|
1141
|
+
var Text2 = Object.assign(TextBase, {
|
|
1142
|
+
Span: TextSpan,
|
|
1143
|
+
Bold: TextBold,
|
|
1144
|
+
Medium: TextMedium,
|
|
1145
|
+
Italic: TextItalic,
|
|
1146
|
+
Underline: TextUnderline,
|
|
1147
|
+
Highlight: TextHighlight
|
|
1148
|
+
});
|
|
896
1149
|
|
|
897
1150
|
// src/primitives/Frame/Frame.utils.ts
|
|
898
1151
|
function resolveSpacing(value, tokens) {
|
|
@@ -1096,7 +1349,7 @@ function Wrapper({
|
|
|
1096
1349
|
]
|
|
1097
1350
|
);
|
|
1098
1351
|
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
1099
|
-
return /* @__PURE__ */
|
|
1352
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1100
1353
|
View,
|
|
1101
1354
|
{
|
|
1102
1355
|
ref,
|
|
@@ -1123,17 +1376,17 @@ function Button({
|
|
|
1123
1376
|
...pressableProps
|
|
1124
1377
|
}) {
|
|
1125
1378
|
const tokens = useTokens();
|
|
1126
|
-
const { variantColors, sizeTokens } =
|
|
1379
|
+
const { variantColors, sizeTokens } = React14.useMemo(
|
|
1127
1380
|
() => getButtonConfig(variant, semantic, size, disabled, tokens),
|
|
1128
1381
|
[variant, semantic, size, disabled, tokens]
|
|
1129
1382
|
);
|
|
1130
|
-
const padding =
|
|
1383
|
+
const padding = React14.useMemo(
|
|
1131
1384
|
() => computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
1132
1385
|
[size, icon, children, iconPosition]
|
|
1133
1386
|
);
|
|
1134
|
-
return /* @__PURE__ */
|
|
1387
|
+
return /* @__PURE__ */ React14.createElement(Pressable, { disabled, ...pressableProps }, ({ pressed, hovered }) => (
|
|
1135
1388
|
// Wrapper handles layout: direction, gap, alignment (padding via style)
|
|
1136
|
-
/* @__PURE__ */
|
|
1389
|
+
/* @__PURE__ */ React14.createElement(
|
|
1137
1390
|
Wrapper,
|
|
1138
1391
|
{
|
|
1139
1392
|
direction: "horizontal",
|
|
@@ -1154,13 +1407,14 @@ function Button({
|
|
|
1154
1407
|
...Array.isArray(style) ? style : style ? [style] : []
|
|
1155
1408
|
]
|
|
1156
1409
|
},
|
|
1157
|
-
icon && iconPosition === "left" && /* @__PURE__ */
|
|
1410
|
+
icon && iconPosition === "left" && /* @__PURE__ */ React14.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
|
|
1158
1411
|
children && // Text primitive with semantic props + color style override
|
|
1159
|
-
/* @__PURE__ */
|
|
1412
|
+
/* @__PURE__ */ React14.createElement(
|
|
1160
1413
|
Text2,
|
|
1161
1414
|
{
|
|
1415
|
+
role: "label",
|
|
1162
1416
|
size: sizeTokens.textSize,
|
|
1163
|
-
|
|
1417
|
+
centerVertically: true,
|
|
1164
1418
|
style: [
|
|
1165
1419
|
{ color: variantColors.textColor },
|
|
1166
1420
|
...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
|
|
@@ -1168,7 +1422,7 @@ function Button({
|
|
|
1168
1422
|
},
|
|
1169
1423
|
children
|
|
1170
1424
|
),
|
|
1171
|
-
icon && iconPosition === "right" && /* @__PURE__ */
|
|
1425
|
+
icon && iconPosition === "right" && /* @__PURE__ */ React14.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
|
|
1172
1426
|
)
|
|
1173
1427
|
));
|
|
1174
1428
|
}
|
|
@@ -1193,11 +1447,11 @@ function Card({
|
|
|
1193
1447
|
disabled = false
|
|
1194
1448
|
}) {
|
|
1195
1449
|
const tokens = useTokens(elevation);
|
|
1196
|
-
const styles =
|
|
1450
|
+
const styles = React14.useMemo(
|
|
1197
1451
|
() => getCardStyles(tokens, disabled),
|
|
1198
1452
|
[tokens, disabled]
|
|
1199
1453
|
);
|
|
1200
|
-
return /* @__PURE__ */
|
|
1454
|
+
return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
|
|
1201
1455
|
}
|
|
1202
1456
|
var hadKeyboardEvent = false;
|
|
1203
1457
|
var isListenerSetup = false;
|
|
@@ -1348,9 +1602,9 @@ function getFrameStyles(input) {
|
|
|
1348
1602
|
|
|
1349
1603
|
// src/primitives/Frame/Frame.tsx
|
|
1350
1604
|
function wrapTextChildren(children, textStyle) {
|
|
1351
|
-
return
|
|
1605
|
+
return React14.Children.map(children, (child) => {
|
|
1352
1606
|
if (typeof child === "string" || typeof child === "number") {
|
|
1353
|
-
return /* @__PURE__ */
|
|
1607
|
+
return /* @__PURE__ */ React14.createElement(Text, { style: textStyle }, child);
|
|
1354
1608
|
}
|
|
1355
1609
|
return child;
|
|
1356
1610
|
});
|
|
@@ -1489,9 +1743,9 @@ function Frame({
|
|
|
1489
1743
|
const textStyle = useMemo(
|
|
1490
1744
|
() => ({
|
|
1491
1745
|
color: srgbToHex(tokens.textPrimary.srgb),
|
|
1492
|
-
fontSize: tokens.typography.
|
|
1493
|
-
fontFamily: tokens.typography.fonts.
|
|
1494
|
-
lineHeight: tokens.typography.
|
|
1746
|
+
fontSize: tokens.typography.fontSizes["05"],
|
|
1747
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1748
|
+
lineHeight: tokens.typography.lineHeights["06"]
|
|
1495
1749
|
}),
|
|
1496
1750
|
[tokens]
|
|
1497
1751
|
);
|
|
@@ -1499,10 +1753,10 @@ function Frame({
|
|
|
1499
1753
|
() => wrapTextChildren(children, textStyle),
|
|
1500
1754
|
[children, textStyle]
|
|
1501
1755
|
);
|
|
1502
|
-
return /* @__PURE__ */
|
|
1756
|
+
return /* @__PURE__ */ React14.createElement(FrameContext.Provider, { value: contextValue }, isInteractive ? (
|
|
1503
1757
|
// Pressable handles taps. When href is set, react-native-web renders
|
|
1504
1758
|
// it as an <a> tag so it works like a regular link on the web.
|
|
1505
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ React14.createElement(
|
|
1506
1760
|
Pressable,
|
|
1507
1761
|
{
|
|
1508
1762
|
ref,
|
|
@@ -1527,7 +1781,7 @@ function Frame({
|
|
|
1527
1781
|
)
|
|
1528
1782
|
) : (
|
|
1529
1783
|
// Non-interactive Frame: just a plain View with no tap handling.
|
|
1530
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ React14.createElement(
|
|
1531
1785
|
View,
|
|
1532
1786
|
{
|
|
1533
1787
|
ref,
|
|
@@ -1547,20 +1801,20 @@ function getTextInputStyles(tokens, disabled) {
|
|
|
1547
1801
|
gap: tokens.spacing["04"]
|
|
1548
1802
|
},
|
|
1549
1803
|
label: {
|
|
1550
|
-
fontFamily: tokens.typography.fonts.
|
|
1551
|
-
fontSize: tokens.typography.
|
|
1552
|
-
fontWeight: tokens.typography.
|
|
1804
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1805
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
1806
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1553
1807
|
color: srgbToHex(tokens.textSecondary.srgb)
|
|
1554
1808
|
},
|
|
1555
1809
|
input: {
|
|
1556
|
-
fontFamily: tokens.typography.fonts.
|
|
1810
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1557
1811
|
backgroundColor: srgbToHex(tokens.backgroundSunken.srgb),
|
|
1558
1812
|
borderWidth: 1,
|
|
1559
1813
|
borderColor: srgbToHex(tokens.border.srgb),
|
|
1560
1814
|
borderRadius: tokens.radius.md,
|
|
1561
1815
|
paddingVertical: tokens.spacing["08"],
|
|
1562
1816
|
paddingHorizontal: tokens.spacing["12"],
|
|
1563
|
-
fontSize: tokens.typography.
|
|
1817
|
+
fontSize: tokens.typography.fontSizes["05"],
|
|
1564
1818
|
color: disabled ? srgbToHex(tokens.textSecondary.srgb) : srgbToHex(tokens.textPrimary.srgb),
|
|
1565
1819
|
opacity: disabled ? 0.5 : 1
|
|
1566
1820
|
}
|
|
@@ -1573,11 +1827,11 @@ function TextInput({
|
|
|
1573
1827
|
...textInputProps
|
|
1574
1828
|
}) {
|
|
1575
1829
|
const tokens = useTokens(1);
|
|
1576
|
-
const styles =
|
|
1830
|
+
const styles = React14.useMemo(
|
|
1577
1831
|
() => getTextInputStyles(tokens, disabled),
|
|
1578
1832
|
[tokens, disabled]
|
|
1579
1833
|
);
|
|
1580
|
-
return /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React14.createElement(
|
|
1581
1835
|
TextInput$1,
|
|
1582
1836
|
{
|
|
1583
1837
|
style: styles.input,
|
|
@@ -1680,15 +1934,15 @@ function Popover({
|
|
|
1680
1934
|
[styles.content, contentStyle]
|
|
1681
1935
|
);
|
|
1682
1936
|
const webProps = { onKeyDown: handleKeyDown };
|
|
1683
|
-
return /* @__PURE__ */
|
|
1937
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1684
1938
|
View,
|
|
1685
1939
|
{
|
|
1686
1940
|
ref: containerRef,
|
|
1687
1941
|
style: containerStyles,
|
|
1688
1942
|
...webProps
|
|
1689
1943
|
},
|
|
1690
|
-
/* @__PURE__ */
|
|
1691
|
-
isOpen && /* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ React14.createElement(View, { onLayout: onTriggerLayout }, trigger),
|
|
1945
|
+
isOpen && /* @__PURE__ */ React14.createElement(View, { style: mergedContentStyles }, children)
|
|
1692
1946
|
);
|
|
1693
1947
|
}
|
|
1694
1948
|
function usePopover(options) {
|
|
@@ -1717,7 +1971,7 @@ function isOptionGroup(item) {
|
|
|
1717
1971
|
}
|
|
1718
1972
|
function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
1719
1973
|
const isSm = size === "sm";
|
|
1720
|
-
const fontSize = isSm ? tokens.typography.
|
|
1974
|
+
const fontSize = isSm ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1721
1975
|
const iconSize = fontSize + 2;
|
|
1722
1976
|
const iconSpace = iconSize + tokens.spacing["08"];
|
|
1723
1977
|
const paddingVertical = isSm ? tokens.spacing["04"] : tokens.spacing["08"];
|
|
@@ -1728,9 +1982,9 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
|
1728
1982
|
zIndex: isOpen ? 999 : 0
|
|
1729
1983
|
},
|
|
1730
1984
|
label: {
|
|
1731
|
-
fontFamily: tokens.typography.fonts.
|
|
1732
|
-
fontSize: tokens.typography.
|
|
1733
|
-
fontWeight: tokens.typography.
|
|
1985
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1986
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
1987
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1734
1988
|
color: srgbToHex(tokens.textSecondary.srgb)
|
|
1735
1989
|
},
|
|
1736
1990
|
trigger: {
|
|
@@ -1747,7 +2001,7 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
|
1747
2001
|
},
|
|
1748
2002
|
triggerText: {
|
|
1749
2003
|
flex: 1,
|
|
1750
|
-
fontFamily: tokens.typography.fonts.
|
|
2004
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1751
2005
|
fontSize,
|
|
1752
2006
|
color: disabled ? srgbToHex(tokens.textSecondary.srgb) : srgbToHex(tokens.textPrimary.srgb)
|
|
1753
2007
|
},
|
|
@@ -1759,9 +2013,9 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
|
1759
2013
|
justifyContent: "center"
|
|
1760
2014
|
},
|
|
1761
2015
|
groupLabel: {
|
|
1762
|
-
fontFamily: tokens.typography.fonts.
|
|
1763
|
-
fontSize: tokens.typography.
|
|
1764
|
-
fontWeight: tokens.typography.
|
|
2016
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2017
|
+
fontSize: tokens.typography.fontSizes["01"],
|
|
2018
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1765
2019
|
color: srgbToHex(tokens.textSecondary.srgb),
|
|
1766
2020
|
textTransform: "uppercase",
|
|
1767
2021
|
letterSpacing: 0.5,
|
|
@@ -1883,9 +2137,9 @@ function SelectOptionRow({
|
|
|
1883
2137
|
const tokens = useTokens(1);
|
|
1884
2138
|
const paddingVertical = size === "sm" ? tokens.spacing["04"] : tokens.spacing["08"];
|
|
1885
2139
|
const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
|
|
1886
|
-
const fontSize = size === "sm" ? tokens.typography.
|
|
2140
|
+
const fontSize = size === "sm" ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1887
2141
|
if (renderOption) {
|
|
1888
|
-
return /* @__PURE__ */
|
|
2142
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1889
2143
|
Pressable,
|
|
1890
2144
|
{
|
|
1891
2145
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1896,7 +2150,7 @@ function SelectOptionRow({
|
|
|
1896
2150
|
renderOption(option, { isSelected, isFocused })
|
|
1897
2151
|
);
|
|
1898
2152
|
}
|
|
1899
|
-
return /* @__PURE__ */
|
|
2153
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1900
2154
|
Pressable,
|
|
1901
2155
|
{
|
|
1902
2156
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1925,18 +2179,18 @@ function SelectOptionRow({
|
|
|
1925
2179
|
}
|
|
1926
2180
|
]
|
|
1927
2181
|
},
|
|
1928
|
-
/* @__PURE__ */
|
|
2182
|
+
/* @__PURE__ */ React14.createElement(
|
|
1929
2183
|
Text,
|
|
1930
2184
|
{
|
|
1931
2185
|
style: [
|
|
1932
2186
|
{
|
|
1933
2187
|
flex: 1,
|
|
1934
|
-
fontFamily: tokens.typography.fonts.
|
|
2188
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1935
2189
|
fontSize,
|
|
1936
2190
|
color: srgbToHex(tokens.textPrimary.srgb)
|
|
1937
2191
|
},
|
|
1938
2192
|
isSelected && {
|
|
1939
|
-
fontWeight: tokens.typography.
|
|
2193
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1940
2194
|
color: srgbToHex(tokens.accent.fill.srgb)
|
|
1941
2195
|
},
|
|
1942
2196
|
option.disabled && {
|
|
@@ -1947,7 +2201,7 @@ function SelectOptionRow({
|
|
|
1947
2201
|
},
|
|
1948
2202
|
option.label
|
|
1949
2203
|
),
|
|
1950
|
-
isSelected && /* @__PURE__ */
|
|
2204
|
+
isSelected && /* @__PURE__ */ React14.createElement(View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React14.createElement(
|
|
1951
2205
|
Icon,
|
|
1952
2206
|
{
|
|
1953
2207
|
name: "check",
|
|
@@ -2002,7 +2256,7 @@ function Select({
|
|
|
2002
2256
|
const displayLabel = selectedOption?.label ?? placeholder ?? value;
|
|
2003
2257
|
const iconColor = disabled ? srgbToHex(tokens.textSecondary.srgb) : srgbToHex(tokens.textPrimary.srgb);
|
|
2004
2258
|
const triggerWebProps = { onKeyDown: handleKeyDown };
|
|
2005
|
-
const trigger = /* @__PURE__ */
|
|
2259
|
+
const trigger = /* @__PURE__ */ React14.createElement(
|
|
2006
2260
|
Pressable,
|
|
2007
2261
|
{
|
|
2008
2262
|
onPress: disabled ? void 0 : toggle,
|
|
@@ -2012,24 +2266,24 @@ function Select({
|
|
|
2012
2266
|
...triggerWebProps,
|
|
2013
2267
|
style: styles.trigger
|
|
2014
2268
|
},
|
|
2015
|
-
renderValue ? renderValue(selectedOption) : /* @__PURE__ */
|
|
2016
|
-
/* @__PURE__ */
|
|
2269
|
+
renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React14.createElement(Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
|
|
2270
|
+
/* @__PURE__ */ React14.createElement(View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React14.createElement(
|
|
2017
2271
|
Icon,
|
|
2018
2272
|
{
|
|
2019
2273
|
name: isOpen ? "expand_less" : "expand_more",
|
|
2020
|
-
size: size === "sm" ? tokens.typography.
|
|
2274
|
+
size: size === "sm" ? tokens.typography.fontSizes["04"] + 2 : tokens.typography.fontSizes["05"] + 2,
|
|
2021
2275
|
color: iconColor
|
|
2022
2276
|
}
|
|
2023
2277
|
))
|
|
2024
2278
|
);
|
|
2025
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React14.createElement(
|
|
2026
2280
|
Popover,
|
|
2027
2281
|
{
|
|
2028
2282
|
isOpen: isOpen && !disabled,
|
|
2029
2283
|
onClose: close,
|
|
2030
2284
|
trigger
|
|
2031
2285
|
},
|
|
2032
|
-
/* @__PURE__ */
|
|
2286
|
+
/* @__PURE__ */ React14.createElement(
|
|
2033
2287
|
ScrollView,
|
|
2034
2288
|
{
|
|
2035
2289
|
bounces: false,
|
|
@@ -2038,7 +2292,7 @@ function Select({
|
|
|
2038
2292
|
},
|
|
2039
2293
|
options.map((item) => {
|
|
2040
2294
|
if (isOptionGroup(item)) {
|
|
2041
|
-
return /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ React14.createElement(View, { key: item.label }, /* @__PURE__ */ React14.createElement(Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React14.createElement(
|
|
2042
2296
|
SelectOptionRow,
|
|
2043
2297
|
{
|
|
2044
2298
|
key: opt.value,
|
|
@@ -2054,7 +2308,7 @@ function Select({
|
|
|
2054
2308
|
}
|
|
2055
2309
|
)));
|
|
2056
2310
|
}
|
|
2057
|
-
return /* @__PURE__ */
|
|
2311
|
+
return /* @__PURE__ */ React14.createElement(
|
|
2058
2312
|
SelectOptionRow,
|
|
2059
2313
|
{
|
|
2060
2314
|
key: item.value,
|
|
@@ -2086,9 +2340,9 @@ function getToggleStyles(tokens, value, disabled) {
|
|
|
2086
2340
|
opacity: disabled ? 0.5 : 1
|
|
2087
2341
|
},
|
|
2088
2342
|
label: {
|
|
2089
|
-
fontFamily: tokens.typography.fonts.
|
|
2090
|
-
fontSize: tokens.typography.
|
|
2091
|
-
fontWeight: tokens.typography.
|
|
2343
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2344
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2345
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2092
2346
|
color: srgbToHex(tokens.textSecondary.srgb)
|
|
2093
2347
|
},
|
|
2094
2348
|
track: {
|
|
@@ -2118,16 +2372,16 @@ function Toggle({
|
|
|
2118
2372
|
style
|
|
2119
2373
|
}) {
|
|
2120
2374
|
const tokens = useTokens(1);
|
|
2121
|
-
const styles =
|
|
2375
|
+
const styles = React14.useMemo(
|
|
2122
2376
|
() => getToggleStyles(tokens, value, disabled),
|
|
2123
2377
|
[tokens, value, disabled]
|
|
2124
2378
|
);
|
|
2125
|
-
const handlePress =
|
|
2379
|
+
const handlePress = React14.useCallback(() => {
|
|
2126
2380
|
if (!disabled) {
|
|
2127
2381
|
onValueChange(!value);
|
|
2128
2382
|
}
|
|
2129
2383
|
}, [disabled, value, onValueChange]);
|
|
2130
|
-
return /* @__PURE__ */
|
|
2384
|
+
return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React14.createElement(
|
|
2131
2385
|
Pressable,
|
|
2132
2386
|
{
|
|
2133
2387
|
onPress: handlePress,
|
|
@@ -2135,7 +2389,7 @@ function Toggle({
|
|
|
2135
2389
|
accessibilityRole: "switch",
|
|
2136
2390
|
accessibilityState: { checked: value, disabled }
|
|
2137
2391
|
},
|
|
2138
|
-
/* @__PURE__ */
|
|
2392
|
+
/* @__PURE__ */ React14.createElement(View, { style: styles.track }, /* @__PURE__ */ React14.createElement(View, { style: styles.thumb }))
|
|
2139
2393
|
));
|
|
2140
2394
|
}
|
|
2141
2395
|
var TRACK_HEIGHT2 = 6;
|
|
@@ -2152,15 +2406,15 @@ function getSliderStyles(tokens, disabled) {
|
|
|
2152
2406
|
alignItems: "center"
|
|
2153
2407
|
},
|
|
2154
2408
|
label: {
|
|
2155
|
-
fontFamily: tokens.typography.fonts.
|
|
2156
|
-
fontSize: tokens.typography.
|
|
2157
|
-
fontWeight: tokens.typography.
|
|
2409
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2410
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2411
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2158
2412
|
color: srgbToHex(tokens.textSecondary.srgb)
|
|
2159
2413
|
},
|
|
2160
2414
|
value: {
|
|
2161
|
-
fontFamily: tokens.typography.fonts.
|
|
2162
|
-
fontSize: tokens.typography.
|
|
2163
|
-
fontWeight: tokens.typography.
|
|
2415
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2416
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2417
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2164
2418
|
color: srgbToHex(tokens.textPrimary.srgb)
|
|
2165
2419
|
},
|
|
2166
2420
|
valueInput: {
|
|
@@ -2172,9 +2426,9 @@ function getSliderStyles(tokens, disabled) {
|
|
|
2172
2426
|
borderRadius: 4,
|
|
2173
2427
|
backgroundColor: "transparent",
|
|
2174
2428
|
color: srgbToHex(tokens.textPrimary.srgb),
|
|
2175
|
-
fontFamily: tokens.typography.fonts.
|
|
2176
|
-
fontSize: tokens.typography.
|
|
2177
|
-
fontWeight: tokens.typography.
|
|
2429
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2430
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2431
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2178
2432
|
textAlign: "right"
|
|
2179
2433
|
},
|
|
2180
2434
|
trackContainer: {
|
|
@@ -2221,41 +2475,41 @@ function Slider({
|
|
|
2221
2475
|
style
|
|
2222
2476
|
}) {
|
|
2223
2477
|
const tokens = useTokens(1);
|
|
2224
|
-
const styles =
|
|
2478
|
+
const styles = React14.useMemo(
|
|
2225
2479
|
() => getSliderStyles(tokens, disabled),
|
|
2226
2480
|
[tokens, disabled]
|
|
2227
2481
|
);
|
|
2228
|
-
const trackRef =
|
|
2229
|
-
const trackWidth =
|
|
2230
|
-
const trackPageX =
|
|
2231
|
-
const onValueChangeRef =
|
|
2232
|
-
const minRef =
|
|
2233
|
-
const maxRef =
|
|
2234
|
-
const stepRef =
|
|
2235
|
-
const disabledRef =
|
|
2236
|
-
|
|
2482
|
+
const trackRef = React14.useRef(null);
|
|
2483
|
+
const trackWidth = React14.useRef(0);
|
|
2484
|
+
const trackPageX = React14.useRef(0);
|
|
2485
|
+
const onValueChangeRef = React14.useRef(onValueChange);
|
|
2486
|
+
const minRef = React14.useRef(min);
|
|
2487
|
+
const maxRef = React14.useRef(max);
|
|
2488
|
+
const stepRef = React14.useRef(step);
|
|
2489
|
+
const disabledRef = React14.useRef(disabled);
|
|
2490
|
+
React14.useEffect(() => {
|
|
2237
2491
|
onValueChangeRef.current = onValueChange;
|
|
2238
2492
|
}, [onValueChange]);
|
|
2239
|
-
|
|
2493
|
+
React14.useEffect(() => {
|
|
2240
2494
|
minRef.current = min;
|
|
2241
2495
|
}, [min]);
|
|
2242
|
-
|
|
2496
|
+
React14.useEffect(() => {
|
|
2243
2497
|
maxRef.current = max;
|
|
2244
2498
|
}, [max]);
|
|
2245
|
-
|
|
2499
|
+
React14.useEffect(() => {
|
|
2246
2500
|
stepRef.current = step;
|
|
2247
2501
|
}, [step]);
|
|
2248
|
-
|
|
2502
|
+
React14.useEffect(() => {
|
|
2249
2503
|
disabledRef.current = disabled;
|
|
2250
2504
|
}, [disabled]);
|
|
2251
|
-
const computeValue =
|
|
2505
|
+
const computeValue = React14.useCallback((pageX) => {
|
|
2252
2506
|
const localX = pageX - trackPageX.current;
|
|
2253
2507
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2254
2508
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2255
2509
|
const stepped = Math.round(raw / stepRef.current) * stepRef.current;
|
|
2256
2510
|
return Math.min(maxRef.current, Math.max(minRef.current, stepped));
|
|
2257
2511
|
}, []);
|
|
2258
|
-
const panResponder =
|
|
2512
|
+
const panResponder = React14.useRef(
|
|
2259
2513
|
PanResponder.create({
|
|
2260
2514
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2261
2515
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2271,7 +2525,7 @@ function Slider({
|
|
|
2271
2525
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE2);
|
|
2272
2526
|
const thumbLeft = ratio * usableWidth;
|
|
2273
2527
|
const fillWidth = thumbLeft + THUMB_SIZE2 / 2;
|
|
2274
|
-
const handleValueTextSubmit =
|
|
2528
|
+
const handleValueTextSubmit = React14.useCallback(
|
|
2275
2529
|
(text) => {
|
|
2276
2530
|
const raw = Number(text);
|
|
2277
2531
|
if (!Number.isNaN(raw)) {
|
|
@@ -2280,12 +2534,12 @@ function Slider({
|
|
|
2280
2534
|
},
|
|
2281
2535
|
[onValueChange, min, max]
|
|
2282
2536
|
);
|
|
2283
|
-
const [editText, setEditText] =
|
|
2284
|
-
|
|
2537
|
+
const [editText, setEditText] = React14.useState(String(value));
|
|
2538
|
+
React14.useEffect(() => {
|
|
2285
2539
|
setEditText(String(value));
|
|
2286
2540
|
}, [value]);
|
|
2287
2541
|
const showLabel = label || showValue || editableValue;
|
|
2288
|
-
return /* @__PURE__ */
|
|
2542
|
+
return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14.createElement(
|
|
2289
2543
|
TextInput$1,
|
|
2290
2544
|
{
|
|
2291
2545
|
style: styles.valueInput,
|
|
@@ -2297,7 +2551,7 @@ function Slider({
|
|
|
2297
2551
|
selectTextOnFocus: true,
|
|
2298
2552
|
editable: !disabled
|
|
2299
2553
|
}
|
|
2300
|
-
) : showValue && /* @__PURE__ */
|
|
2554
|
+
) : showValue && /* @__PURE__ */ React14.createElement(Text, { style: styles.value }, value)), /* @__PURE__ */ React14.createElement(
|
|
2301
2555
|
View,
|
|
2302
2556
|
{
|
|
2303
2557
|
ref: trackRef,
|
|
@@ -2310,9 +2564,9 @@ function Slider({
|
|
|
2310
2564
|
},
|
|
2311
2565
|
...panResponder.panHandlers
|
|
2312
2566
|
},
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2567
|
+
/* @__PURE__ */ React14.createElement(View, { style: styles.trackRail }),
|
|
2568
|
+
/* @__PURE__ */ React14.createElement(View, { style: [styles.trackFill, { width: fillWidth }] }),
|
|
2569
|
+
/* @__PURE__ */ React14.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2316
2570
|
));
|
|
2317
2571
|
}
|
|
2318
2572
|
var TRACK_HEIGHT3 = 22;
|
|
@@ -2368,15 +2622,15 @@ function getHueSliderStyles(tokens, disabled) {
|
|
|
2368
2622
|
alignItems: "center"
|
|
2369
2623
|
},
|
|
2370
2624
|
label: {
|
|
2371
|
-
fontFamily: tokens.typography.fonts.
|
|
2372
|
-
fontSize: tokens.typography.
|
|
2373
|
-
fontWeight: tokens.typography.
|
|
2625
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2626
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2627
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2374
2628
|
color: srgbToHex(tokens.textSecondary.srgb)
|
|
2375
2629
|
},
|
|
2376
2630
|
value: {
|
|
2377
|
-
fontFamily: tokens.typography.fonts.
|
|
2378
|
-
fontSize: tokens.typography.
|
|
2379
|
-
fontWeight: tokens.typography.
|
|
2631
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2632
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2633
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2380
2634
|
color: srgbToHex(tokens.textPrimary.srgb)
|
|
2381
2635
|
},
|
|
2382
2636
|
valueInput: {
|
|
@@ -2388,9 +2642,9 @@ function getHueSliderStyles(tokens, disabled) {
|
|
|
2388
2642
|
borderRadius: 4,
|
|
2389
2643
|
backgroundColor: "transparent",
|
|
2390
2644
|
color: srgbToHex(tokens.textPrimary.srgb),
|
|
2391
|
-
fontFamily: tokens.typography.fonts.
|
|
2392
|
-
fontSize: tokens.typography.
|
|
2393
|
-
fontWeight: tokens.typography.
|
|
2645
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2646
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2647
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2394
2648
|
textAlign: "right"
|
|
2395
2649
|
},
|
|
2396
2650
|
trackContainer: {
|
|
@@ -2435,41 +2689,41 @@ function HueSlider({
|
|
|
2435
2689
|
style
|
|
2436
2690
|
}) {
|
|
2437
2691
|
const tokens = useTokens(1);
|
|
2438
|
-
const styles =
|
|
2692
|
+
const styles = React14.useMemo(
|
|
2439
2693
|
() => getHueSliderStyles(tokens, disabled),
|
|
2440
2694
|
[tokens, disabled]
|
|
2441
2695
|
);
|
|
2442
|
-
const segments =
|
|
2696
|
+
const segments = React14.useMemo(
|
|
2443
2697
|
() => buildHueSegments(min, max),
|
|
2444
2698
|
[min, max]
|
|
2445
2699
|
);
|
|
2446
|
-
const trackRef =
|
|
2447
|
-
const trackWidth =
|
|
2448
|
-
const trackPageX =
|
|
2449
|
-
const onValueChangeRef =
|
|
2450
|
-
const minRef =
|
|
2451
|
-
const maxRef =
|
|
2452
|
-
const disabledRef =
|
|
2453
|
-
|
|
2700
|
+
const trackRef = React14.useRef(null);
|
|
2701
|
+
const trackWidth = React14.useRef(0);
|
|
2702
|
+
const trackPageX = React14.useRef(0);
|
|
2703
|
+
const onValueChangeRef = React14.useRef(onValueChange);
|
|
2704
|
+
const minRef = React14.useRef(min);
|
|
2705
|
+
const maxRef = React14.useRef(max);
|
|
2706
|
+
const disabledRef = React14.useRef(disabled);
|
|
2707
|
+
React14.useEffect(() => {
|
|
2454
2708
|
onValueChangeRef.current = onValueChange;
|
|
2455
2709
|
}, [onValueChange]);
|
|
2456
|
-
|
|
2710
|
+
React14.useEffect(() => {
|
|
2457
2711
|
minRef.current = min;
|
|
2458
2712
|
}, [min]);
|
|
2459
|
-
|
|
2713
|
+
React14.useEffect(() => {
|
|
2460
2714
|
maxRef.current = max;
|
|
2461
2715
|
}, [max]);
|
|
2462
|
-
|
|
2716
|
+
React14.useEffect(() => {
|
|
2463
2717
|
disabledRef.current = disabled;
|
|
2464
2718
|
}, [disabled]);
|
|
2465
|
-
const computeHue =
|
|
2719
|
+
const computeHue = React14.useCallback((pageX) => {
|
|
2466
2720
|
const localX = pageX - trackPageX.current;
|
|
2467
2721
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2468
2722
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2469
2723
|
const stepped = Math.round(raw);
|
|
2470
2724
|
return (stepped % 360 + 360) % 360;
|
|
2471
2725
|
}, []);
|
|
2472
|
-
const panResponder =
|
|
2726
|
+
const panResponder = React14.useRef(
|
|
2473
2727
|
PanResponder.create({
|
|
2474
2728
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2475
2729
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2485,7 +2739,7 @@ function HueSlider({
|
|
|
2485
2739
|
const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
|
|
2486
2740
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE3);
|
|
2487
2741
|
const thumbLeft = ratio * usableWidth;
|
|
2488
|
-
const handleValueTextSubmit =
|
|
2742
|
+
const handleValueTextSubmit = React14.useCallback(
|
|
2489
2743
|
(text) => {
|
|
2490
2744
|
const raw = Number(text);
|
|
2491
2745
|
if (!Number.isNaN(raw)) {
|
|
@@ -2494,12 +2748,12 @@ function HueSlider({
|
|
|
2494
2748
|
},
|
|
2495
2749
|
[onValueChange]
|
|
2496
2750
|
);
|
|
2497
|
-
const [editText, setEditText] =
|
|
2498
|
-
|
|
2751
|
+
const [editText, setEditText] = React14.useState(String(value));
|
|
2752
|
+
React14.useEffect(() => {
|
|
2499
2753
|
setEditText(String(value));
|
|
2500
2754
|
}, [value]);
|
|
2501
2755
|
const showLabel = label || showValue || editableValue;
|
|
2502
|
-
return /* @__PURE__ */
|
|
2756
|
+
return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14.createElement(
|
|
2503
2757
|
TextInput$1,
|
|
2504
2758
|
{
|
|
2505
2759
|
style: styles.valueInput,
|
|
@@ -2511,7 +2765,7 @@ function HueSlider({
|
|
|
2511
2765
|
selectTextOnFocus: true,
|
|
2512
2766
|
editable: !disabled
|
|
2513
2767
|
}
|
|
2514
|
-
) : showValue && /* @__PURE__ */
|
|
2768
|
+
) : showValue && /* @__PURE__ */ React14.createElement(Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React14.createElement(
|
|
2515
2769
|
View,
|
|
2516
2770
|
{
|
|
2517
2771
|
ref: trackRef,
|
|
@@ -2524,8 +2778,8 @@ function HueSlider({
|
|
|
2524
2778
|
},
|
|
2525
2779
|
...panResponder.panHandlers
|
|
2526
2780
|
},
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
/* @__PURE__ */
|
|
2781
|
+
/* @__PURE__ */ React14.createElement(View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React14.createElement(View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
|
|
2782
|
+
/* @__PURE__ */ React14.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2529
2783
|
));
|
|
2530
2784
|
}
|
|
2531
2785
|
var TRACK_HEIGHT4 = 22;
|
|
@@ -2542,9 +2796,9 @@ function getColorScaleSliderStyles(tokens, disabled) {
|
|
|
2542
2796
|
alignItems: "center"
|
|
2543
2797
|
},
|
|
2544
2798
|
label: {
|
|
2545
|
-
fontFamily: tokens.typography.fonts.
|
|
2546
|
-
fontSize: tokens.typography.
|
|
2547
|
-
fontWeight: tokens.typography.
|
|
2799
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2800
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2801
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2548
2802
|
color: srgbToHex(tokens.textSecondary.srgb)
|
|
2549
2803
|
},
|
|
2550
2804
|
trackContainer: {
|
|
@@ -2574,9 +2828,9 @@ function getColorScaleSliderStyles(tokens, disabled) {
|
|
|
2574
2828
|
borderColor: srgbToHex(tokens.border.srgb)
|
|
2575
2829
|
},
|
|
2576
2830
|
warning: {
|
|
2577
|
-
fontFamily: tokens.typography.fonts.
|
|
2578
|
-
fontSize: tokens.typography.
|
|
2579
|
-
fontWeight: tokens.typography.
|
|
2831
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2832
|
+
fontSize: tokens.typography.fontSizes["01"],
|
|
2833
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2580
2834
|
color: srgbToHex(tokens.error.fill.srgb)
|
|
2581
2835
|
}
|
|
2582
2836
|
});
|
|
@@ -2596,36 +2850,36 @@ function ColorScaleSlider({
|
|
|
2596
2850
|
style
|
|
2597
2851
|
}) {
|
|
2598
2852
|
const tokens = useTokens(1);
|
|
2599
|
-
const styles =
|
|
2853
|
+
const styles = React14.useMemo(
|
|
2600
2854
|
() => getColorScaleSliderStyles(tokens, disabled),
|
|
2601
2855
|
[tokens, disabled]
|
|
2602
2856
|
);
|
|
2603
|
-
const trackRef =
|
|
2604
|
-
const trackWidth =
|
|
2605
|
-
const trackPageX =
|
|
2606
|
-
const isDragging =
|
|
2607
|
-
const thumbAnim =
|
|
2608
|
-
const onValueChangeRef =
|
|
2609
|
-
const disabledRef =
|
|
2610
|
-
const colorsLengthRef =
|
|
2611
|
-
const trimEndsRef =
|
|
2612
|
-
const snapRef =
|
|
2613
|
-
|
|
2857
|
+
const trackRef = React14.useRef(null);
|
|
2858
|
+
const trackWidth = React14.useRef(0);
|
|
2859
|
+
const trackPageX = React14.useRef(0);
|
|
2860
|
+
const isDragging = React14.useRef(false);
|
|
2861
|
+
const thumbAnim = React14.useRef(new Animated.Value(0)).current;
|
|
2862
|
+
const onValueChangeRef = React14.useRef(onValueChange);
|
|
2863
|
+
const disabledRef = React14.useRef(disabled);
|
|
2864
|
+
const colorsLengthRef = React14.useRef(colors.length);
|
|
2865
|
+
const trimEndsRef = React14.useRef(trimEnds);
|
|
2866
|
+
const snapRef = React14.useRef(snap);
|
|
2867
|
+
React14.useEffect(() => {
|
|
2614
2868
|
onValueChangeRef.current = onValueChange;
|
|
2615
2869
|
}, [onValueChange]);
|
|
2616
|
-
|
|
2870
|
+
React14.useEffect(() => {
|
|
2617
2871
|
disabledRef.current = disabled;
|
|
2618
2872
|
}, [disabled]);
|
|
2619
|
-
|
|
2873
|
+
React14.useEffect(() => {
|
|
2620
2874
|
colorsLengthRef.current = colors.length;
|
|
2621
2875
|
}, [colors.length]);
|
|
2622
|
-
|
|
2876
|
+
React14.useEffect(() => {
|
|
2623
2877
|
trimEndsRef.current = trimEnds;
|
|
2624
2878
|
}, [trimEnds]);
|
|
2625
|
-
|
|
2879
|
+
React14.useEffect(() => {
|
|
2626
2880
|
snapRef.current = snap;
|
|
2627
2881
|
}, [snap]);
|
|
2628
|
-
const computeNv =
|
|
2882
|
+
const computeNv = React14.useCallback((pageX) => {
|
|
2629
2883
|
const localX = pageX - trackPageX.current;
|
|
2630
2884
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2631
2885
|
const totalSteps2 = colorsLengthRef.current - 1;
|
|
@@ -2640,7 +2894,7 @@ function ColorScaleSlider({
|
|
|
2640
2894
|
}
|
|
2641
2895
|
return nv;
|
|
2642
2896
|
}, []);
|
|
2643
|
-
const panResponder =
|
|
2897
|
+
const panResponder = React14.useRef(
|
|
2644
2898
|
PanResponder.create({
|
|
2645
2899
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2646
2900
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2668,7 +2922,7 @@ function ColorScaleSlider({
|
|
|
2668
2922
|
const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
|
|
2669
2923
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE4);
|
|
2670
2924
|
const thumbLeft = ratio * usableWidth;
|
|
2671
|
-
|
|
2925
|
+
React14.useEffect(() => {
|
|
2672
2926
|
if (isDragging.current || !animateValue) {
|
|
2673
2927
|
thumbAnim.setValue(thumbLeft);
|
|
2674
2928
|
} else {
|
|
@@ -2679,7 +2933,7 @@ function ColorScaleSlider({
|
|
|
2679
2933
|
}).start();
|
|
2680
2934
|
}
|
|
2681
2935
|
}, [thumbLeft, animateValue, thumbAnim]);
|
|
2682
|
-
return /* @__PURE__ */
|
|
2936
|
+
return /* @__PURE__ */ React14.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14.createElement(View, { style: styles.labelRow }, /* @__PURE__ */ React14.createElement(Text, { style: styles.label }, label)), /* @__PURE__ */ React14.createElement(
|
|
2683
2937
|
View,
|
|
2684
2938
|
{
|
|
2685
2939
|
ref: trackRef,
|
|
@@ -2694,9 +2948,9 @@ function ColorScaleSlider({
|
|
|
2694
2948
|
},
|
|
2695
2949
|
...panResponder.panHandlers
|
|
2696
2950
|
},
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
2699
|
-
), warning && /* @__PURE__ */
|
|
2951
|
+
/* @__PURE__ */ React14.createElement(View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React14.createElement(View, { key: i, style: [styles.segment, { backgroundColor: srgbToHex(color.srgb) }] }))),
|
|
2952
|
+
/* @__PURE__ */ React14.createElement(Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
|
|
2953
|
+
), warning && /* @__PURE__ */ React14.createElement(Text, { style: styles.warning }, warning));
|
|
2700
2954
|
}
|
|
2701
2955
|
function getAppShellStyles(tokens) {
|
|
2702
2956
|
return StyleSheet.create({
|
|
@@ -2718,8 +2972,8 @@ function getAppShellStyles(tokens) {
|
|
|
2718
2972
|
// src/composites/layout/AppShell/AppShell.tsx
|
|
2719
2973
|
function AppShell({ sidebar, children }) {
|
|
2720
2974
|
const tokens = useTokens();
|
|
2721
|
-
const styles =
|
|
2722
|
-
return /* @__PURE__ */
|
|
2975
|
+
const styles = React14.useMemo(() => getAppShellStyles(tokens), [tokens]);
|
|
2976
|
+
return /* @__PURE__ */ React14.createElement(View, { style: styles.container }, sidebar, /* @__PURE__ */ React14.createElement(View, { style: styles.main }, children));
|
|
2723
2977
|
}
|
|
2724
2978
|
function getSidebarStyles({ tokens, width, bordered }) {
|
|
2725
2979
|
const borderColor = srgbToHex(tokens.border.srgb);
|
|
@@ -2757,11 +3011,11 @@ function Sidebar({
|
|
|
2757
3011
|
bordered = true
|
|
2758
3012
|
}) {
|
|
2759
3013
|
const tokens = useTokens();
|
|
2760
|
-
const styles =
|
|
3014
|
+
const styles = React14.useMemo(
|
|
2761
3015
|
() => getSidebarStyles({ tokens, width, bordered }),
|
|
2762
3016
|
[tokens, width, bordered]
|
|
2763
3017
|
);
|
|
2764
|
-
return /* @__PURE__ */
|
|
3018
|
+
return /* @__PURE__ */ React14.createElement(View, { style: styles.container }, header && /* @__PURE__ */ React14.createElement(View, { style: styles.header }, header), /* @__PURE__ */ React14.createElement(ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React14.createElement(View, { style: styles.footer }, footer));
|
|
2765
3019
|
}
|
|
2766
3020
|
function getNavbarStyles({ tokens, height, bordered }) {
|
|
2767
3021
|
const borderColor = srgbToHex(tokens.border.srgb);
|
|
@@ -2799,28 +3053,27 @@ function Navbar({
|
|
|
2799
3053
|
bordered = true
|
|
2800
3054
|
}) {
|
|
2801
3055
|
const tokens = useTokens();
|
|
2802
|
-
const styles =
|
|
3056
|
+
const styles = React14.useMemo(
|
|
2803
3057
|
() => getNavbarStyles({ tokens, height, bordered }),
|
|
2804
3058
|
[tokens, height, bordered]
|
|
2805
3059
|
);
|
|
2806
|
-
return /* @__PURE__ */
|
|
3060
|
+
return /* @__PURE__ */ React14.createElement(View, { style: styles.container }, children ? children : /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(View, { style: styles.left }, left), /* @__PURE__ */ React14.createElement(View, { style: styles.right }, right)));
|
|
2807
3061
|
}
|
|
2808
3062
|
|
|
2809
3063
|
// src/registry/registry.ts
|
|
2810
3064
|
var CATEGORIES = [
|
|
2811
|
-
{ id: "
|
|
2812
|
-
{ id: "
|
|
2813
|
-
{ id: "
|
|
2814
|
-
{ id: "
|
|
2815
|
-
{ id: "
|
|
2816
|
-
{ id: "overlays", name: "Overlays", description: "Floating and portal-based UI elements" }
|
|
3065
|
+
{ id: "colors", name: "Colors", description: "Color palettes and token visualization", icon: "palette" },
|
|
3066
|
+
{ id: "typography", name: "Typography", description: "Text roles, scopes, and weight control", icon: "text_fields" },
|
|
3067
|
+
{ id: "symbols", name: "Symbols", description: "Material Symbols icon browser", icon: "grid_view" },
|
|
3068
|
+
{ id: "layout", name: "Layout", description: "Structural containers \u2014 Frame and Wrapper", icon: "grid_on" },
|
|
3069
|
+
{ id: "components", name: "Components", description: "Interactive UI components", icon: "widgets" }
|
|
2817
3070
|
];
|
|
2818
3071
|
var COMPONENTS = [
|
|
2819
3072
|
{
|
|
2820
3073
|
id: "button",
|
|
2821
3074
|
name: "Button",
|
|
2822
3075
|
importName: "Button",
|
|
2823
|
-
categoryId: "
|
|
3076
|
+
categoryId: "components",
|
|
2824
3077
|
description: "Interactive button with multiple variants, sizes, and optional icon",
|
|
2825
3078
|
hasChildren: true,
|
|
2826
3079
|
variants: [
|
|
@@ -2902,7 +3155,7 @@ var COMPONENTS = [
|
|
|
2902
3155
|
id: "text-input",
|
|
2903
3156
|
name: "TextInput",
|
|
2904
3157
|
importName: "TextInput",
|
|
2905
|
-
categoryId: "
|
|
3158
|
+
categoryId: "components",
|
|
2906
3159
|
description: "Text input field with label support",
|
|
2907
3160
|
hasChildren: false,
|
|
2908
3161
|
variants: [
|
|
@@ -2929,7 +3182,7 @@ var COMPONENTS = [
|
|
|
2929
3182
|
id: "select",
|
|
2930
3183
|
name: "Select",
|
|
2931
3184
|
importName: "Select",
|
|
2932
|
-
categoryId: "
|
|
3185
|
+
categoryId: "components",
|
|
2933
3186
|
description: "Dropdown selector with options",
|
|
2934
3187
|
hasChildren: false,
|
|
2935
3188
|
variants: [
|
|
@@ -2976,7 +3229,7 @@ var COMPONENTS = [
|
|
|
2976
3229
|
id: "toggle",
|
|
2977
3230
|
name: "Toggle",
|
|
2978
3231
|
importName: "Toggle",
|
|
2979
|
-
categoryId: "
|
|
3232
|
+
categoryId: "components",
|
|
2980
3233
|
description: "Binary switch component",
|
|
2981
3234
|
hasChildren: false,
|
|
2982
3235
|
variants: [
|
|
@@ -3003,7 +3256,7 @@ var COMPONENTS = [
|
|
|
3003
3256
|
id: "slider",
|
|
3004
3257
|
name: "Slider",
|
|
3005
3258
|
importName: "Slider",
|
|
3006
|
-
categoryId: "
|
|
3259
|
+
categoryId: "components",
|
|
3007
3260
|
description: "Numeric range slider",
|
|
3008
3261
|
hasChildren: false,
|
|
3009
3262
|
variants: [
|
|
@@ -3047,7 +3300,7 @@ var COMPONENTS = [
|
|
|
3047
3300
|
id: "hue-slider",
|
|
3048
3301
|
name: "HueSlider",
|
|
3049
3302
|
importName: "HueSlider",
|
|
3050
|
-
categoryId: "
|
|
3303
|
+
categoryId: "components",
|
|
3051
3304
|
description: "Specialized slider for hue selection (0-360\xB0)",
|
|
3052
3305
|
hasChildren: false,
|
|
3053
3306
|
variants: [
|
|
@@ -3183,7 +3436,7 @@ var COMPONENTS = [
|
|
|
3183
3436
|
id: "card",
|
|
3184
3437
|
name: "Card",
|
|
3185
3438
|
importName: "Card",
|
|
3186
|
-
categoryId: "
|
|
3439
|
+
categoryId: "components",
|
|
3187
3440
|
description: "Surface container with elevation levels",
|
|
3188
3441
|
hasChildren: true,
|
|
3189
3442
|
variants: [
|
|
@@ -3216,45 +3469,59 @@ var COMPONENTS = [
|
|
|
3216
3469
|
id: "text",
|
|
3217
3470
|
name: "Text",
|
|
3218
3471
|
importName: "Text",
|
|
3219
|
-
categoryId: "
|
|
3220
|
-
description: "Typography primitive with semantic
|
|
3472
|
+
categoryId: "typography",
|
|
3473
|
+
description: "Typography primitive with semantic scope (font family) and role (purpose)",
|
|
3221
3474
|
hasChildren: true,
|
|
3475
|
+
previewLayout: "list",
|
|
3222
3476
|
variants: [
|
|
3223
|
-
{ id: "
|
|
3224
|
-
{ id: "
|
|
3225
|
-
{ id: "
|
|
3226
|
-
{ id: "
|
|
3227
|
-
{ id: "
|
|
3228
|
-
{ id: "
|
|
3229
|
-
{ id: "
|
|
3477
|
+
{ id: "body", label: "Body", props: { role: "body" } },
|
|
3478
|
+
{ id: "headline", label: "Headline", props: { role: "headline", scope: "display" } },
|
|
3479
|
+
{ id: "title", label: "Title", props: { role: "title", scope: "display" } },
|
|
3480
|
+
{ id: "heading", label: "Heading", props: { role: "heading" } },
|
|
3481
|
+
{ id: "subheading", label: "Subheading", props: { role: "subheading" } },
|
|
3482
|
+
{ id: "label", label: "Label", props: { role: "label" } },
|
|
3483
|
+
{ id: "caption", label: "Caption", props: { role: "caption", color: "secondary" } },
|
|
3484
|
+
{ id: "mono", label: "Monospace", props: { scope: "mono", role: "body" } },
|
|
3485
|
+
{ id: "currency", label: "Currency", props: { scope: "currency", role: "body" } }
|
|
3230
3486
|
],
|
|
3231
3487
|
editableProps: [
|
|
3232
3488
|
{
|
|
3233
|
-
name: "
|
|
3234
|
-
label: "
|
|
3489
|
+
name: "scope",
|
|
3490
|
+
label: "Scope",
|
|
3235
3491
|
control: "select",
|
|
3236
3492
|
options: [
|
|
3237
|
-
{ label: "
|
|
3238
|
-
{ label: "
|
|
3239
|
-
{ label: "
|
|
3240
|
-
{ label: "
|
|
3241
|
-
{ label: "Large", value: "lg" },
|
|
3242
|
-
{ label: "Extra Large", value: "xl" },
|
|
3243
|
-
{ label: "XXL", value: "xxl" }
|
|
3493
|
+
{ label: "Main", value: "main" },
|
|
3494
|
+
{ label: "Display", value: "display" },
|
|
3495
|
+
{ label: "Mono", value: "mono" },
|
|
3496
|
+
{ label: "Currency", value: "currency" }
|
|
3244
3497
|
],
|
|
3245
|
-
defaultValue: "
|
|
3498
|
+
defaultValue: "main"
|
|
3246
3499
|
},
|
|
3247
3500
|
{
|
|
3248
|
-
name: "
|
|
3249
|
-
label: "
|
|
3501
|
+
name: "role",
|
|
3502
|
+
label: "Role",
|
|
3250
3503
|
control: "select",
|
|
3251
3504
|
options: [
|
|
3252
|
-
{ label: "
|
|
3253
|
-
{ label: "
|
|
3254
|
-
{ label: "
|
|
3255
|
-
{ label: "
|
|
3505
|
+
{ label: "Headline", value: "headline" },
|
|
3506
|
+
{ label: "Title", value: "title" },
|
|
3507
|
+
{ label: "Heading", value: "heading" },
|
|
3508
|
+
{ label: "Subheading", value: "subheading" },
|
|
3509
|
+
{ label: "Body", value: "body" },
|
|
3510
|
+
{ label: "Label", value: "label" },
|
|
3511
|
+
{ label: "Caption", value: "caption" }
|
|
3256
3512
|
],
|
|
3257
|
-
defaultValue: "
|
|
3513
|
+
defaultValue: "body"
|
|
3514
|
+
},
|
|
3515
|
+
{
|
|
3516
|
+
name: "size",
|
|
3517
|
+
label: "Size",
|
|
3518
|
+
control: "select",
|
|
3519
|
+
options: [
|
|
3520
|
+
{ label: "Small", value: "sm" },
|
|
3521
|
+
{ label: "Medium", value: "md" },
|
|
3522
|
+
{ label: "Large", value: "lg" }
|
|
3523
|
+
],
|
|
3524
|
+
defaultValue: "md"
|
|
3258
3525
|
},
|
|
3259
3526
|
{
|
|
3260
3527
|
name: "color",
|
|
@@ -3271,17 +3538,6 @@ var COMPONENTS = [
|
|
|
3271
3538
|
{ label: "Error", value: "error" }
|
|
3272
3539
|
],
|
|
3273
3540
|
defaultValue: "primary"
|
|
3274
|
-
},
|
|
3275
|
-
{
|
|
3276
|
-
name: "font",
|
|
3277
|
-
label: "Font",
|
|
3278
|
-
control: "select",
|
|
3279
|
-
options: [
|
|
3280
|
-
{ label: "Default", value: "default" },
|
|
3281
|
-
{ label: "Display", value: "display" },
|
|
3282
|
-
{ label: "Mono", value: "mono" }
|
|
3283
|
-
],
|
|
3284
|
-
defaultValue: "default"
|
|
3285
3541
|
}
|
|
3286
3542
|
]
|
|
3287
3543
|
},
|
|
@@ -3289,7 +3545,7 @@ var COMPONENTS = [
|
|
|
3289
3545
|
id: "icon",
|
|
3290
3546
|
name: "Icon",
|
|
3291
3547
|
importName: "Icon",
|
|
3292
|
-
categoryId: "
|
|
3548
|
+
categoryId: "symbols",
|
|
3293
3549
|
description: "Material Symbols icon with size and fill",
|
|
3294
3550
|
hasChildren: false,
|
|
3295
3551
|
variants: [
|
|
@@ -3326,7 +3582,7 @@ var COMPONENTS = [
|
|
|
3326
3582
|
id: "wrapper",
|
|
3327
3583
|
name: "Wrapper",
|
|
3328
3584
|
importName: "Wrapper",
|
|
3329
|
-
categoryId: "
|
|
3585
|
+
categoryId: "layout",
|
|
3330
3586
|
description: "Lightweight layout container with direction, spacing, and alignment (no theming)",
|
|
3331
3587
|
hasChildren: true,
|
|
3332
3588
|
variants: [
|
|
@@ -3400,7 +3656,7 @@ var COMPONENTS = [
|
|
|
3400
3656
|
id: "color-scale-slider",
|
|
3401
3657
|
name: "ColorScaleSlider",
|
|
3402
3658
|
importName: "ColorScaleSlider",
|
|
3403
|
-
categoryId: "
|
|
3659
|
+
categoryId: "components",
|
|
3404
3660
|
description: "Interactive palette preview slider with color segments",
|
|
3405
3661
|
hasChildren: false,
|
|
3406
3662
|
variants: [
|
|
@@ -3443,6 +3699,7 @@ var HANDLER_PROPS = {
|
|
|
3443
3699
|
};
|
|
3444
3700
|
var CHILDREN_CONTENT = {
|
|
3445
3701
|
button: "Button",
|
|
3702
|
+
text: "The quick brown fox",
|
|
3446
3703
|
card: "{/* content */}",
|
|
3447
3704
|
frame: "{/* content */}"
|
|
3448
3705
|
};
|
|
@@ -3748,72 +4005,6 @@ var ICON_CATALOG = [
|
|
|
3748
4005
|
}
|
|
3749
4006
|
];
|
|
3750
4007
|
|
|
3751
|
-
|
|
3752
|
-
var GOOGLE_FONTS = [
|
|
3753
|
-
// Sans-serif
|
|
3754
|
-
{ family: "Inter", category: "sans-serif", fallback: "sans-serif" },
|
|
3755
|
-
{ family: "Roboto", category: "sans-serif", fallback: "sans-serif" },
|
|
3756
|
-
{ family: "Open Sans", category: "sans-serif", fallback: "sans-serif" },
|
|
3757
|
-
{ family: "Lato", category: "sans-serif", fallback: "sans-serif" },
|
|
3758
|
-
{ family: "Montserrat", category: "sans-serif", fallback: "sans-serif" },
|
|
3759
|
-
{ family: "Poppins", category: "sans-serif", fallback: "sans-serif" },
|
|
3760
|
-
{ family: "Nunito", category: "sans-serif", fallback: "sans-serif" },
|
|
3761
|
-
{ family: "Source Sans 3", category: "sans-serif", fallback: "sans-serif" },
|
|
3762
|
-
{ family: "Work Sans", category: "sans-serif", fallback: "sans-serif" },
|
|
3763
|
-
{ family: "Raleway", category: "sans-serif", fallback: "sans-serif" },
|
|
3764
|
-
{ family: "DM Sans", category: "sans-serif", fallback: "sans-serif" },
|
|
3765
|
-
{ family: "Plus Jakarta Sans", category: "sans-serif", fallback: "sans-serif" },
|
|
3766
|
-
{ family: "Outfit", category: "sans-serif", fallback: "sans-serif" },
|
|
3767
|
-
{ family: "Space Grotesk", category: "sans-serif", fallback: "sans-serif" },
|
|
3768
|
-
{ family: "Manrope", category: "sans-serif", fallback: "sans-serif" },
|
|
3769
|
-
// Serif
|
|
3770
|
-
{ family: "Playfair Display", category: "serif", fallback: "serif" },
|
|
3771
|
-
{ family: "Merriweather", category: "serif", fallback: "serif" },
|
|
3772
|
-
{ family: "Lora", category: "serif", fallback: "serif" },
|
|
3773
|
-
{ family: "Libre Baskerville", category: "serif", fallback: "serif" },
|
|
3774
|
-
{ family: "Source Serif 4", category: "serif", fallback: "serif" },
|
|
3775
|
-
{ family: "Bitter", category: "serif", fallback: "serif" },
|
|
3776
|
-
{ family: "Cormorant Garamond", category: "serif", fallback: "serif" },
|
|
3777
|
-
{ family: "EB Garamond", category: "serif", fallback: "serif" },
|
|
3778
|
-
{ family: "Crimson Text", category: "serif", fallback: "serif" },
|
|
3779
|
-
{ family: "Noto Serif", category: "serif", fallback: "serif" },
|
|
3780
|
-
// Monospace
|
|
3781
|
-
{ family: "Fira Code", category: "monospace", fallback: "monospace" },
|
|
3782
|
-
{ family: "JetBrains Mono", category: "monospace", fallback: "monospace" },
|
|
3783
|
-
{ family: "Source Code Pro", category: "monospace", fallback: "monospace" },
|
|
3784
|
-
{ family: "IBM Plex Mono", category: "monospace", fallback: "monospace" },
|
|
3785
|
-
{ family: "Roboto Mono", category: "monospace", fallback: "monospace" },
|
|
3786
|
-
{ family: "Space Mono", category: "monospace", fallback: "monospace" },
|
|
3787
|
-
{ family: "Ubuntu Mono", category: "monospace", fallback: "monospace" },
|
|
3788
|
-
{ family: "Inconsolata", category: "monospace", fallback: "monospace" },
|
|
3789
|
-
// Display
|
|
3790
|
-
{ family: "Abril Fatface", category: "display", fallback: "serif" },
|
|
3791
|
-
{ family: "Bebas Neue", category: "display", fallback: "sans-serif" },
|
|
3792
|
-
{ family: "Oswald", category: "display", fallback: "sans-serif" },
|
|
3793
|
-
{ family: "Righteous", category: "display", fallback: "sans-serif" },
|
|
3794
|
-
{ family: "Lobster", category: "display", fallback: "cursive" },
|
|
3795
|
-
{ family: "Pacifico", category: "display", fallback: "cursive" },
|
|
3796
|
-
{ family: "Comfortaa", category: "display", fallback: "sans-serif" },
|
|
3797
|
-
{ family: "Fredoka", category: "display", fallback: "sans-serif" }
|
|
3798
|
-
];
|
|
3799
|
-
var SYSTEM_FONTS = [
|
|
3800
|
-
{
|
|
3801
|
-
family: "system-ui",
|
|
3802
|
-
category: "sans-serif",
|
|
3803
|
-
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
3804
|
-
},
|
|
3805
|
-
{
|
|
3806
|
-
family: "ui-monospace",
|
|
3807
|
-
category: "monospace",
|
|
3808
|
-
fallback: "SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
3809
|
-
},
|
|
3810
|
-
{
|
|
3811
|
-
family: "ui-serif",
|
|
3812
|
-
category: "serif",
|
|
3813
|
-
fallback: 'Georgia, "Times New Roman", serif'
|
|
3814
|
-
}
|
|
3815
|
-
];
|
|
3816
|
-
|
|
3817
|
-
export { ACCENT_DEFAULTS, AppShell, Button, CATEGORIES, COMPONENTS, Card, ColorScaleSlider, DEFAULT_THEME_CONFIG, ERROR_DEFAULTS, Frame, GOOGLE_FONTS, HueSlider, ICON_CATALOG, Icon, NEUTRAL_DEFAULTS, Navbar, NewtoneProvider, Popover, SUCCESS_DEFAULTS, SYSTEM_FONTS, Select, Sidebar, Slider, Text2 as Text, TextInput, Toggle, WARNING_DEFAULTS, Wrapper, buildGoogleFontsUrl, computeTokens, generateComponentCode, getCategory, getComponent, getComponentsByCategory, isOptionGroup, useFocusVisible, useFrameContext, useNewtoneTheme, usePopover, useTokens };
|
|
4008
|
+
export { ACCENT_DEFAULTS, AppShell, Button, CATEGORIES, COMPONENTS, Card, ColorScaleSlider, DEFAULT_THEME_CONFIG, ERROR_DEFAULTS, Frame, HueSlider, ICON_CATALOG, Icon, NEUTRAL_DEFAULTS, Navbar, NewtoneProvider, Popover, SUCCESS_DEFAULTS, Select, Sidebar, Slider, Text2 as Text, TextInput, Toggle, WARNING_DEFAULTS, Wrapper, computeTokens, generateComponentCode, getCategory, getComponent, getComponentsByCategory, isOptionGroup, measureAvgCharWidth, useFocusVisible, useFrameContext, useLocalCalibration, useNewtoneTheme, usePopover, useTokens, useTypographyCalibrations };
|
|
3818
4009
|
//# sourceMappingURL=index.js.map
|
|
3819
4010
|
//# sourceMappingURL=index.js.map
|