@newtonedev/components 0.1.6 → 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 +863 -437
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +801 -391
- package/dist/index.js.map +1 -1
- package/dist/primitives/Icon/Icon.d.ts +1 -1
- package/dist/primitives/Icon/Icon.d.ts.map +1 -1
- package/dist/primitives/Icon/Icon.types.d.ts +8 -13
- 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/icons.d.ts +7 -0
- package/dist/registry/icons.d.ts.map +1 -0
- package/dist/registry/index.d.ts +2 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/types.d.ts +3 -1
- 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 +18 -7
- package/src/primitives/Frame/Frame.tsx +3 -3
- package/src/primitives/Icon/Icon.tsx +5 -7
- package/src/primitives/Icon/Icon.types.ts +8 -15
- 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/icons.ts +111 -0
- package/src/registry/index.ts +3 -0
- package/src/registry/registry.ts +67 -70
- package/src/registry/types.ts +3 -1
- 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.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React14 = require('react');
|
|
4
4
|
var newtone = require('newtone');
|
|
5
|
+
var fonts = require('@newtonedev/fonts');
|
|
5
6
|
var reactNative = require('react-native');
|
|
6
7
|
|
|
7
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
9
|
|
|
9
|
-
var
|
|
10
|
+
var React14__default = /*#__PURE__*/_interopDefault(React14);
|
|
10
11
|
|
|
11
12
|
// src/theme/NewtoneProvider.tsx
|
|
12
13
|
var DEFAULT_THEME_CONFIG = {
|
|
@@ -60,40 +61,10 @@ var DEFAULT_THEME_CONFIG = {
|
|
|
60
61
|
pill: 999
|
|
61
62
|
},
|
|
62
63
|
typography: {
|
|
63
|
-
fonts:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
fallback: "SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
68
|
-
},
|
|
69
|
-
display: {
|
|
70
|
-
type: "system",
|
|
71
|
-
family: "system-ui",
|
|
72
|
-
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
73
|
-
},
|
|
74
|
-
default: {
|
|
75
|
-
type: "system",
|
|
76
|
-
family: "system-ui",
|
|
77
|
-
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
scale: {
|
|
81
|
-
xs: 10,
|
|
82
|
-
// 16 / 1.25^2
|
|
83
|
-
sm: 13,
|
|
84
|
-
// 16 / 1.25
|
|
85
|
-
base: 16,
|
|
86
|
-
md: 20,
|
|
87
|
-
// 16 * 1.25
|
|
88
|
-
lg: 25,
|
|
89
|
-
// 16 * 1.25^2
|
|
90
|
-
xl: 31,
|
|
91
|
-
// 16 * 1.25^3
|
|
92
|
-
xxl: 39
|
|
93
|
-
// 16 * 1.25^4
|
|
94
|
-
},
|
|
95
|
-
lineHeight: { tight: 1.25, normal: 1.5, relaxed: 1.75 },
|
|
96
|
-
fontWeight: { regular: 400, medium: 500, semibold: 600, bold: 700 }
|
|
64
|
+
fonts: fonts.DEFAULT_FONT_SLOTS,
|
|
65
|
+
fontSizes: fonts.DEFAULT_FONT_SIZES,
|
|
66
|
+
lineHeights: fonts.DEFAULT_LINE_HEIGHTS,
|
|
67
|
+
roles: fonts.DEFAULT_ROLE_SCALES
|
|
97
68
|
},
|
|
98
69
|
icons: {
|
|
99
70
|
variant: "rounded",
|
|
@@ -105,26 +76,12 @@ var DEFAULT_THEME_CONFIG = {
|
|
|
105
76
|
}
|
|
106
77
|
};
|
|
107
78
|
|
|
108
|
-
// src/fonts/buildGoogleFontsUrl.ts
|
|
109
|
-
function buildGoogleFontsUrl(fonts) {
|
|
110
|
-
const googleFonts = [fonts.mono, fonts.display, fonts.default].filter(
|
|
111
|
-
(f) => f.type === "google"
|
|
112
|
-
);
|
|
113
|
-
if (googleFonts.length === 0) return null;
|
|
114
|
-
const unique = [...new Map(googleFonts.map((f) => [f.family, f])).values()];
|
|
115
|
-
const families = unique.map((f) => {
|
|
116
|
-
const encoded = f.family.replace(/ /g, "+");
|
|
117
|
-
return `family=${encoded}:wght@400;500;600;700`;
|
|
118
|
-
});
|
|
119
|
-
return `https://fonts.googleapis.com/css2?${families.join("&")}&display=swap`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
79
|
// src/fonts/GoogleFontLoader.tsx
|
|
123
|
-
function GoogleFontLoader({ fonts }) {
|
|
124
|
-
const linkRef =
|
|
125
|
-
|
|
80
|
+
function GoogleFontLoader({ fonts: fonts$1 }) {
|
|
81
|
+
const linkRef = React14.useRef(null);
|
|
82
|
+
React14.useEffect(() => {
|
|
126
83
|
if (typeof document === "undefined") return;
|
|
127
|
-
const url = buildGoogleFontsUrl(fonts);
|
|
84
|
+
const url = fonts.buildGoogleFontsUrl(fonts$1);
|
|
128
85
|
if (linkRef.current) {
|
|
129
86
|
linkRef.current.remove();
|
|
130
87
|
linkRef.current = null;
|
|
@@ -144,18 +101,55 @@ function GoogleFontLoader({ fonts }) {
|
|
|
144
101
|
}
|
|
145
102
|
};
|
|
146
103
|
}, [
|
|
147
|
-
fonts.
|
|
148
|
-
fonts.
|
|
149
|
-
fonts.
|
|
150
|
-
fonts.
|
|
151
|
-
fonts.
|
|
152
|
-
fonts.
|
|
104
|
+
fonts$1.main.config.family,
|
|
105
|
+
fonts$1.main.config.type,
|
|
106
|
+
fonts$1.main.weights.regular,
|
|
107
|
+
fonts$1.main.weights.medium,
|
|
108
|
+
fonts$1.main.weights.bold,
|
|
109
|
+
fonts$1.display.config.family,
|
|
110
|
+
fonts$1.display.config.type,
|
|
111
|
+
fonts$1.display.weights.regular,
|
|
112
|
+
fonts$1.display.weights.medium,
|
|
113
|
+
fonts$1.display.weights.bold,
|
|
114
|
+
fonts$1.mono.config.family,
|
|
115
|
+
fonts$1.mono.config.type,
|
|
116
|
+
fonts$1.mono.weights.regular,
|
|
117
|
+
fonts$1.mono.weights.medium,
|
|
118
|
+
fonts$1.mono.weights.bold,
|
|
119
|
+
fonts$1.currency.config.family,
|
|
120
|
+
fonts$1.currency.config.type,
|
|
121
|
+
fonts$1.currency.weights.regular,
|
|
122
|
+
fonts$1.currency.weights.medium,
|
|
123
|
+
fonts$1.currency.weights.bold
|
|
153
124
|
]);
|
|
154
125
|
return null;
|
|
155
126
|
}
|
|
127
|
+
function SelfHostedFontLoader({ fontFaceCss }) {
|
|
128
|
+
const styleRef = React14.useRef(null);
|
|
129
|
+
React14.useEffect(() => {
|
|
130
|
+
if (typeof document === "undefined") return;
|
|
131
|
+
if (styleRef.current) {
|
|
132
|
+
styleRef.current.remove();
|
|
133
|
+
styleRef.current = null;
|
|
134
|
+
}
|
|
135
|
+
if (!fontFaceCss) return;
|
|
136
|
+
const style = document.createElement("style");
|
|
137
|
+
style.setAttribute("data-newtone-fonts", "self-hosted");
|
|
138
|
+
style.textContent = fontFaceCss;
|
|
139
|
+
document.head.appendChild(style);
|
|
140
|
+
styleRef.current = style;
|
|
141
|
+
return () => {
|
|
142
|
+
if (styleRef.current) {
|
|
143
|
+
styleRef.current.remove();
|
|
144
|
+
styleRef.current = null;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}, [fontFaceCss]);
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
156
150
|
function IconFontLoader({ icons }) {
|
|
157
|
-
const linkRef =
|
|
158
|
-
|
|
151
|
+
const linkRef = React14.useRef(null);
|
|
152
|
+
React14.useEffect(() => {
|
|
159
153
|
if (typeof document === "undefined") return;
|
|
160
154
|
const variantName = icons.variant.charAt(0).toUpperCase() + icons.variant.slice(1);
|
|
161
155
|
const family = `Material+Symbols+${variantName}`;
|
|
@@ -182,33 +176,36 @@ function IconFontLoader({ icons }) {
|
|
|
182
176
|
}
|
|
183
177
|
|
|
184
178
|
// src/theme/NewtoneProvider.tsx
|
|
185
|
-
var ThemeContext =
|
|
179
|
+
var ThemeContext = React14.createContext(null);
|
|
186
180
|
function NewtoneProvider({
|
|
187
181
|
config = DEFAULT_THEME_CONFIG,
|
|
188
182
|
initialMode = "light",
|
|
189
|
-
children
|
|
183
|
+
children,
|
|
184
|
+
reportingEndpoint,
|
|
185
|
+
fontFaceCss
|
|
190
186
|
}) {
|
|
191
|
-
const [mode, setMode] =
|
|
192
|
-
const value =
|
|
187
|
+
const [mode, setMode] = React14.useState(initialMode);
|
|
188
|
+
const value = React14.useMemo(
|
|
193
189
|
() => ({
|
|
194
190
|
config,
|
|
195
191
|
mode,
|
|
196
|
-
setMode
|
|
192
|
+
setMode,
|
|
193
|
+
reportingEndpoint
|
|
197
194
|
}),
|
|
198
|
-
[config, mode]
|
|
195
|
+
[config, mode, reportingEndpoint]
|
|
199
196
|
);
|
|
200
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ React14__default.default.createElement(ThemeContext.Provider, { value }, fontFaceCss ? /* @__PURE__ */ React14__default.default.createElement(SelfHostedFontLoader, { fontFaceCss }) : /* @__PURE__ */ React14__default.default.createElement(GoogleFontLoader, { fonts: config.typography.fonts }), /* @__PURE__ */ React14__default.default.createElement(IconFontLoader, { icons: config.icons }), children);
|
|
201
198
|
}
|
|
202
199
|
function useNewtoneTheme() {
|
|
203
|
-
const context =
|
|
200
|
+
const context = React14.useContext(ThemeContext);
|
|
204
201
|
if (!context) {
|
|
205
202
|
throw new Error("useNewtoneTheme must be used within NewtoneProvider");
|
|
206
203
|
}
|
|
207
204
|
return context;
|
|
208
205
|
}
|
|
209
|
-
var FrameContext =
|
|
206
|
+
var FrameContext = React14.createContext(null);
|
|
210
207
|
function useFrameContext() {
|
|
211
|
-
return
|
|
208
|
+
return React14.useContext(FrameContext);
|
|
212
209
|
}
|
|
213
210
|
var NEUTRAL_DEFAULTS = {
|
|
214
211
|
light: {
|
|
@@ -280,10 +277,6 @@ var ERROR_DEFAULTS = {
|
|
|
280
277
|
border: { enabled: 0.08, focused: 0.16, filled: 0.24 }
|
|
281
278
|
}
|
|
282
279
|
};
|
|
283
|
-
function fontConfigToFamily(font) {
|
|
284
|
-
const family = font.family.includes(" ") ? `"${font.family}"` : font.family;
|
|
285
|
-
return `${family}, ${font.fallback}`;
|
|
286
|
-
}
|
|
287
280
|
var clamp = (n) => Math.max(0, Math.min(1, n));
|
|
288
281
|
function computePaletteTokens(palette, defaults, mode, elevation, dynamicRange, elevationDelta, effectiveTextMode, autoAccentNv, neutralTextPrimary, neutralBgElevated) {
|
|
289
282
|
const modeDefaults = defaults[mode];
|
|
@@ -538,13 +531,25 @@ function computeTokens(config, mode, elevation, spacing, radius, typography, ico
|
|
|
538
531
|
radius,
|
|
539
532
|
typography: {
|
|
540
533
|
fonts: {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
534
|
+
main: {
|
|
535
|
+
family: fonts.fontConfigToFamily(typography.fonts.main.config),
|
|
536
|
+
weights: typography.fonts.main.weights
|
|
537
|
+
},
|
|
538
|
+
display: {
|
|
539
|
+
family: fonts.fontConfigToFamily(typography.fonts.display.config),
|
|
540
|
+
weights: typography.fonts.display.weights
|
|
541
|
+
},
|
|
542
|
+
mono: {
|
|
543
|
+
family: fonts.fontConfigToFamily(typography.fonts.mono.config),
|
|
544
|
+
weights: typography.fonts.mono.weights
|
|
545
|
+
},
|
|
546
|
+
currency: {
|
|
547
|
+
family: fonts.fontConfigToFamily(typography.fonts.currency.config),
|
|
548
|
+
weights: typography.fonts.currency.weights
|
|
549
|
+
}
|
|
544
550
|
},
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
weight: typography.fontWeight
|
|
551
|
+
fontSizes: typography.fontSizes,
|
|
552
|
+
lineHeights: typography.lineHeights
|
|
548
553
|
},
|
|
549
554
|
icons: {
|
|
550
555
|
variant: icons.variant,
|
|
@@ -560,7 +565,7 @@ function useTokens(elevation) {
|
|
|
560
565
|
const frameCtx = useFrameContext();
|
|
561
566
|
const resolvedElevation = elevation ?? frameCtx?.elevation ?? 1;
|
|
562
567
|
const canReuse = frameCtx !== null && elevation === void 0 && frameCtx.elevation === resolvedElevation;
|
|
563
|
-
return
|
|
568
|
+
return React14.useMemo(() => {
|
|
564
569
|
if (canReuse) {
|
|
565
570
|
return { ...frameCtx.tokens, elevation: resolvedElevation };
|
|
566
571
|
}
|
|
@@ -659,7 +664,7 @@ function getSizeConfig(size, tokens) {
|
|
|
659
664
|
padding: 8,
|
|
660
665
|
gap: tokens.spacing["08"],
|
|
661
666
|
borderRadius: 8,
|
|
662
|
-
textSize: "
|
|
667
|
+
textSize: "md",
|
|
663
668
|
// 16px
|
|
664
669
|
iconSize: 24
|
|
665
670
|
},
|
|
@@ -667,7 +672,7 @@ function getSizeConfig(size, tokens) {
|
|
|
667
672
|
padding: 12,
|
|
668
673
|
gap: tokens.spacing["08"],
|
|
669
674
|
borderRadius: 12,
|
|
670
|
-
textSize: "
|
|
675
|
+
textSize: "md",
|
|
671
676
|
// 16px
|
|
672
677
|
iconSize: 24
|
|
673
678
|
},
|
|
@@ -675,7 +680,7 @@ function getSizeConfig(size, tokens) {
|
|
|
675
680
|
padding: 16,
|
|
676
681
|
gap: tokens.spacing["08"],
|
|
677
682
|
borderRadius: 16,
|
|
678
|
-
textSize: "
|
|
683
|
+
textSize: "md",
|
|
679
684
|
// 16px
|
|
680
685
|
iconSize: 24
|
|
681
686
|
}
|
|
@@ -780,9 +785,7 @@ function Icon({
|
|
|
780
785
|
opticalSize,
|
|
781
786
|
fill = 0,
|
|
782
787
|
color,
|
|
783
|
-
elevation = 1,
|
|
784
788
|
style,
|
|
785
|
-
onPress,
|
|
786
789
|
// Accessibility
|
|
787
790
|
accessibilityLabel,
|
|
788
791
|
// Testing & platform
|
|
@@ -790,9 +793,9 @@ function Icon({
|
|
|
790
793
|
nativeID,
|
|
791
794
|
ref
|
|
792
795
|
}) {
|
|
793
|
-
const tokens = useTokens(
|
|
794
|
-
const iconStyle =
|
|
795
|
-
const fontSize = size ?? tokens.typography.
|
|
796
|
+
const tokens = useTokens();
|
|
797
|
+
const iconStyle = React14.useMemo(() => {
|
|
798
|
+
const fontSize = size ?? tokens.typography.fontSizes["05"];
|
|
796
799
|
const getOpticalSize = (size2) => {
|
|
797
800
|
if (size2 <= 22) return 20;
|
|
798
801
|
if (size2 <= 32) return 24;
|
|
@@ -802,7 +805,8 @@ function Icon({
|
|
|
802
805
|
const opsz = opticalSize ?? getOpticalSize(fontSize);
|
|
803
806
|
const iconColor = color ?? newtone.srgbToHex(tokens.textPrimary.srgb);
|
|
804
807
|
const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
|
|
805
|
-
const
|
|
808
|
+
const fillValue = typeof fill === "boolean" ? fill ? 1 : 0 : fill;
|
|
809
|
+
const fontVariationSettings = `'FILL' ${fillValue}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
|
|
806
810
|
return {
|
|
807
811
|
fontFamily,
|
|
808
812
|
fontSize,
|
|
@@ -820,7 +824,7 @@ function Icon({
|
|
|
820
824
|
...style
|
|
821
825
|
};
|
|
822
826
|
}, [tokens, size, opticalSize, fill, color, style]);
|
|
823
|
-
return /* @__PURE__ */
|
|
827
|
+
return /* @__PURE__ */ React14__default.default.createElement(
|
|
824
828
|
reactNative.Text,
|
|
825
829
|
{
|
|
826
830
|
ref,
|
|
@@ -828,12 +832,123 @@ function Icon({
|
|
|
828
832
|
nativeID,
|
|
829
833
|
accessibilityLabel,
|
|
830
834
|
importantForAccessibility: accessibilityLabel ? "yes" : "no-hide-descendants",
|
|
831
|
-
style: iconStyle
|
|
832
|
-
onPress
|
|
835
|
+
style: iconStyle
|
|
833
836
|
},
|
|
834
837
|
name
|
|
835
838
|
);
|
|
836
839
|
}
|
|
840
|
+
|
|
841
|
+
// src/fonts/measureFont.ts
|
|
842
|
+
var REF_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ";
|
|
843
|
+
async function measureAvgCharWidth(fontFamily, fontWeight, fallback, fontSize = 16) {
|
|
844
|
+
if (typeof document === "undefined") return 0.55;
|
|
845
|
+
try {
|
|
846
|
+
await document.fonts.load(`${fontWeight} ${fontSize}px "${fontFamily}"`);
|
|
847
|
+
const canvas = document.createElement("canvas");
|
|
848
|
+
const ctx = canvas.getContext("2d");
|
|
849
|
+
if (!ctx) return 0.55;
|
|
850
|
+
ctx.font = `${fontWeight} ${fontSize}px "${fontFamily}", ${fallback}`;
|
|
851
|
+
const ratio = ctx.measureText(REF_STRING).width / REF_STRING.length / fontSize;
|
|
852
|
+
return Math.round(ratio * 1e3) / 1e3;
|
|
853
|
+
} catch {
|
|
854
|
+
return 0.55;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// src/fonts/useLocalCalibration.ts
|
|
859
|
+
var STORAGE_KEY = "newtone:font-metrics:v1";
|
|
860
|
+
var TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
861
|
+
function readCache() {
|
|
862
|
+
if (typeof localStorage === "undefined") return {};
|
|
863
|
+
try {
|
|
864
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
865
|
+
return raw ? JSON.parse(raw) : {};
|
|
866
|
+
} catch {
|
|
867
|
+
return {};
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
function writeCache(cache) {
|
|
871
|
+
if (typeof localStorage === "undefined") return;
|
|
872
|
+
try {
|
|
873
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(cache));
|
|
874
|
+
} catch {
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
function cacheKey(fontFamily, fontWeight) {
|
|
878
|
+
return `${fontFamily}:${fontWeight}`;
|
|
879
|
+
}
|
|
880
|
+
function useLocalCalibration(fontFamily, fontWeight, fallback, baseCalibration) {
|
|
881
|
+
const key = cacheKey(fontFamily, fontWeight);
|
|
882
|
+
const [ratio, setRatio] = React14.useState(() => {
|
|
883
|
+
const cache = readCache();
|
|
884
|
+
const entry = cache[key];
|
|
885
|
+
if (entry && Date.now() - entry.measuredAt < TTL_MS) {
|
|
886
|
+
return entry.ratio;
|
|
887
|
+
}
|
|
888
|
+
return baseCalibration ?? 0.55;
|
|
889
|
+
});
|
|
890
|
+
React14.useEffect(() => {
|
|
891
|
+
const cache = readCache();
|
|
892
|
+
const entry = cache[key];
|
|
893
|
+
if (entry && Date.now() - entry.measuredAt < TTL_MS) {
|
|
894
|
+
if (entry.ratio !== ratio) setRatio(entry.ratio);
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
let cancelled = false;
|
|
898
|
+
measureAvgCharWidth(fontFamily, fontWeight, fallback).then((measured) => {
|
|
899
|
+
if (cancelled) return;
|
|
900
|
+
const updated = { ...readCache(), [key]: { ratio: measured, measuredAt: Date.now() } };
|
|
901
|
+
writeCache(updated);
|
|
902
|
+
setRatio(measured);
|
|
903
|
+
});
|
|
904
|
+
return () => {
|
|
905
|
+
cancelled = true;
|
|
906
|
+
};
|
|
907
|
+
}, [key, fontFamily, fontWeight, fallback]);
|
|
908
|
+
return ratio;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// src/fonts/useTypographyCalibrations.ts
|
|
912
|
+
function useTypographyCalibrations() {
|
|
913
|
+
const { config } = useNewtoneTheme();
|
|
914
|
+
return config.typography.calibrations ?? {};
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// src/fonts/reportQueue.ts
|
|
918
|
+
var queue = [];
|
|
919
|
+
var flushTimer;
|
|
920
|
+
function flush() {
|
|
921
|
+
if (queue.length === 0) return;
|
|
922
|
+
const byEndpoint = /* @__PURE__ */ new Map();
|
|
923
|
+
for (const item of queue) {
|
|
924
|
+
const group = byEndpoint.get(item.endpoint) ?? [];
|
|
925
|
+
group.push(item.payload);
|
|
926
|
+
byEndpoint.set(item.endpoint, group);
|
|
927
|
+
}
|
|
928
|
+
queue.length = 0;
|
|
929
|
+
for (const [endpoint, observations] of byEndpoint) {
|
|
930
|
+
fetch(endpoint, {
|
|
931
|
+
method: "POST",
|
|
932
|
+
headers: { "Content-Type": "application/json" },
|
|
933
|
+
body: JSON.stringify({ observations }),
|
|
934
|
+
// keepalive: true allows the request to outlive the page
|
|
935
|
+
keepalive: true
|
|
936
|
+
}).catch(() => {
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
function enqueueObservation(endpoint, payload) {
|
|
941
|
+
queue.push({ endpoint, payload });
|
|
942
|
+
if (flushTimer !== void 0) clearTimeout(flushTimer);
|
|
943
|
+
flushTimer = setTimeout(flush, 2e3);
|
|
944
|
+
}
|
|
945
|
+
function useBreakpoint() {
|
|
946
|
+
const { width } = reactNative.useWindowDimensions();
|
|
947
|
+
return fonts.getBreakpointForWidth(width);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// src/primitives/Text/Text.tsx
|
|
951
|
+
var TextScopeContext = React14.createContext(null);
|
|
837
952
|
function resolveTextColor(color, tokens) {
|
|
838
953
|
switch (color) {
|
|
839
954
|
case "primary":
|
|
@@ -854,53 +969,188 @@ function resolveTextColor(color, tokens) {
|
|
|
854
969
|
return newtone.srgbToHex(tokens.error.fill.srgb);
|
|
855
970
|
}
|
|
856
971
|
}
|
|
857
|
-
|
|
972
|
+
var ADAPTIVE_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
973
|
+
var ROLE_HEADING_LEVEL = {
|
|
974
|
+
headline: 1,
|
|
975
|
+
title: 2,
|
|
976
|
+
heading: 3
|
|
977
|
+
};
|
|
978
|
+
function extractCharacterCount(node) {
|
|
979
|
+
if (typeof node === "string") return node.length;
|
|
980
|
+
if (typeof node === "number") return String(node).length;
|
|
981
|
+
if (!node) return 0;
|
|
982
|
+
if (Array.isArray(node)) {
|
|
983
|
+
return node.reduce((sum, child) => sum + extractCharacterCount(child), 0);
|
|
984
|
+
}
|
|
985
|
+
if (typeof node === "object" && "props" in node) {
|
|
986
|
+
return extractCharacterCount(node.props?.children);
|
|
987
|
+
}
|
|
988
|
+
return 0;
|
|
989
|
+
}
|
|
990
|
+
function TextBase({
|
|
858
991
|
children,
|
|
859
|
-
|
|
860
|
-
|
|
992
|
+
scope = "main",
|
|
993
|
+
role = "body",
|
|
861
994
|
color = "primary",
|
|
862
|
-
|
|
863
|
-
lineHeight = "normal",
|
|
995
|
+
size: sizeOverride,
|
|
864
996
|
align,
|
|
865
997
|
numberOfLines,
|
|
866
998
|
elevation = 1,
|
|
867
999
|
style,
|
|
868
|
-
|
|
869
|
-
accessibilityRole,
|
|
870
|
-
// Testing & platform
|
|
1000
|
+
accessibilityRole: accessibilityRoleOverride,
|
|
871
1001
|
testID,
|
|
872
1002
|
nativeID,
|
|
873
|
-
ref
|
|
1003
|
+
ref,
|
|
1004
|
+
responsive = false,
|
|
1005
|
+
centerVertically = false,
|
|
1006
|
+
features
|
|
874
1007
|
}) {
|
|
875
1008
|
const tokens = useTokens(elevation);
|
|
876
|
-
const
|
|
877
|
-
|
|
1009
|
+
const { config, reportingEndpoint } = useNewtoneTheme();
|
|
1010
|
+
const size = sizeOverride ?? "md";
|
|
1011
|
+
const fontSlot = tokens.typography.fonts[scope];
|
|
1012
|
+
const resolvedFontWeight = config.typography.roleWeights?.[role] ?? fonts.ROLE_DEFAULT_WEIGHTS[role];
|
|
1013
|
+
const breakpoint = useBreakpoint();
|
|
1014
|
+
const baseStep = config.typography.roles[role][size];
|
|
1015
|
+
const bpScale = fonts.BREAKPOINT_ROLE_SCALE[breakpoint][role];
|
|
1016
|
+
const step = bpScale === 1 ? baseStep : fonts.scaleRoleStep(baseStep, bpScale);
|
|
1017
|
+
const calibrations = useTypographyCalibrations();
|
|
1018
|
+
const fontSlotFull = config.typography.fonts[scope];
|
|
1019
|
+
const localRatio = useLocalCalibration(
|
|
1020
|
+
fontSlot.family,
|
|
1021
|
+
fonts.SEMANTIC_WEIGHT_MAP.regular,
|
|
1022
|
+
fontSlotFull.config.fallback,
|
|
1023
|
+
calibrations[fontSlot.family]
|
|
1024
|
+
);
|
|
1025
|
+
const isAdaptive = ADAPTIVE_ROLES.has(role);
|
|
1026
|
+
const [containerWidth, setContainerWidth] = React14.useState(null);
|
|
1027
|
+
const characterCount = React14.useMemo(() => extractCharacterCount(children), [children]);
|
|
1028
|
+
const resolvedStep = React14.useMemo(
|
|
1029
|
+
() => fonts.resolveResponsiveSize(
|
|
1030
|
+
{
|
|
1031
|
+
role,
|
|
1032
|
+
size,
|
|
1033
|
+
responsive: responsive && isAdaptive,
|
|
1034
|
+
fontFamily: fontSlot.family,
|
|
1035
|
+
maxFontSize: step.fontSize,
|
|
1036
|
+
minFontSize: Math.max(8, Math.round(step.fontSize * 0.7))
|
|
1037
|
+
},
|
|
1038
|
+
config.typography.roles,
|
|
1039
|
+
containerWidth != null ? { containerWidth, characterCount } : void 0,
|
|
1040
|
+
{ [fontSlot.family]: localRatio }
|
|
1041
|
+
),
|
|
1042
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1043
|
+
[role, size, responsive, isAdaptive, fontSlot.family, step.fontSize, config.typography.roles, containerWidth, characterCount, localRatio]
|
|
1044
|
+
);
|
|
1045
|
+
React14.useEffect(() => {
|
|
1046
|
+
if (!reportingEndpoint || !responsive || !isAdaptive || containerWidth == null) return;
|
|
1047
|
+
const lineWidths = fonts.estimateLineWidths(characterCount, containerWidth, resolvedStep.fontSize, localRatio);
|
|
1048
|
+
const lastLine = lineWidths[lineWidths.length - 1];
|
|
1049
|
+
enqueueObservation(reportingEndpoint, {
|
|
1050
|
+
fontFamily: fontSlot.family,
|
|
1051
|
+
fontWeight: resolvedFontWeight,
|
|
1052
|
+
role,
|
|
1053
|
+
size,
|
|
1054
|
+
fontSize: resolvedStep.fontSize,
|
|
1055
|
+
containerWidth,
|
|
1056
|
+
characterCount,
|
|
1057
|
+
lineCount: lineWidths.length,
|
|
1058
|
+
lastLineRatio: containerWidth > 0 ? lastLine / containerWidth : 1
|
|
1059
|
+
});
|
|
1060
|
+
}, [reportingEndpoint, resolvedStep.fontSize, containerWidth]);
|
|
1061
|
+
const resolvedStyle = React14.useMemo(() => {
|
|
1062
|
+
const activeStep = responsive && isAdaptive ? resolvedStep : step;
|
|
1063
|
+
const currentMetrics = config.typography.fontMetrics?.[fontSlot.family];
|
|
1064
|
+
const correctedLineHeight = currentMetrics ? Math.round(activeStep.lineHeight * currentMetrics.naturalLineHeightRatio / fonts.REFERENCE_LINE_HEIGHT_RATIO / 4) * 4 : activeStep.lineHeight;
|
|
1065
|
+
const vcOffset = centerVertically && currentMetrics ? Math.round(currentMetrics.verticalCenterOffset * activeStep.fontSize * 2) / 2 : 0;
|
|
1066
|
+
const activeFeatures = features ? currentMetrics?.features ? features.filter((tag) => currentMetrics.features.includes(tag)) : [...features] : [];
|
|
1067
|
+
const featureSettings = activeFeatures.length > 0 ? fonts.buildFontFeatureSettings(activeFeatures) : void 0;
|
|
878
1068
|
return {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
// Font weight is stored as a number (e.g. 400, 600) but React Native expects a string.
|
|
883
|
-
fontWeight: String(tokens.typography.weight[weight]),
|
|
884
|
-
// Convert the theme color from internal sRGB format to a hex string (e.g. '#1a1a1a').
|
|
1069
|
+
fontFamily: fontSlot.family,
|
|
1070
|
+
fontSize: activeStep.fontSize,
|
|
1071
|
+
fontWeight: String(resolvedFontWeight),
|
|
885
1072
|
color: resolveTextColor(color, tokens),
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1073
|
+
lineHeight: correctedLineHeight,
|
|
1074
|
+
textAlign: align,
|
|
1075
|
+
...vcOffset !== 0 ? { transform: [{ translateY: vcOffset }] } : {},
|
|
1076
|
+
...featureSettings ? { fontFeatureSettings: featureSettings } : {}
|
|
889
1077
|
};
|
|
890
|
-
}, [tokens,
|
|
891
|
-
|
|
1078
|
+
}, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features]);
|
|
1079
|
+
const inferredA11yRole = role === "headline" || role === "title" || role === "heading" ? "header" : void 0;
|
|
1080
|
+
const effectiveA11yRole = accessibilityRoleOverride ?? inferredA11yRole;
|
|
1081
|
+
const ariaLevel = effectiveA11yRole === "header" ? ROLE_HEADING_LEVEL[role] : void 0;
|
|
1082
|
+
const scopeCtx = React14.useMemo(() => ({ weights: fonts.SEMANTIC_WEIGHT_MAP }), []);
|
|
1083
|
+
const textNode = /* @__PURE__ */ React14__default.default.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React14__default.default.createElement(
|
|
892
1084
|
reactNative.Text,
|
|
893
1085
|
{
|
|
894
1086
|
ref,
|
|
895
1087
|
testID,
|
|
896
1088
|
nativeID,
|
|
897
|
-
accessibilityRole,
|
|
1089
|
+
accessibilityRole: effectiveA11yRole,
|
|
1090
|
+
"aria-level": ariaLevel,
|
|
898
1091
|
style: style ? [resolvedStyle, ...Array.isArray(style) ? style : [style]] : resolvedStyle,
|
|
899
1092
|
numberOfLines
|
|
900
1093
|
},
|
|
901
1094
|
children
|
|
1095
|
+
));
|
|
1096
|
+
if (responsive && isAdaptive) {
|
|
1097
|
+
return /* @__PURE__ */ React14__default.default.createElement(
|
|
1098
|
+
reactNative.View,
|
|
1099
|
+
{
|
|
1100
|
+
onLayout: (e) => {
|
|
1101
|
+
const w = e.nativeEvent.layout.width;
|
|
1102
|
+
if (w > 0) setContainerWidth(w);
|
|
1103
|
+
},
|
|
1104
|
+
style: { width: "100%" }
|
|
1105
|
+
},
|
|
1106
|
+
textNode
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
return textNode;
|
|
1110
|
+
}
|
|
1111
|
+
function TextSpan({ children, color, weight, italic, underline, highlight, style }) {
|
|
1112
|
+
const tokens = useTokens(1);
|
|
1113
|
+
const scopeCtx = React14.useContext(TextScopeContext);
|
|
1114
|
+
const spanStyle = React14.useMemo(() => {
|
|
1115
|
+
const s = {};
|
|
1116
|
+
if (color) s.color = resolveTextColor(color, tokens);
|
|
1117
|
+
if (weight && scopeCtx) s.fontWeight = String(scopeCtx.weights[weight]);
|
|
1118
|
+
if (italic) s.fontStyle = "italic";
|
|
1119
|
+
if (underline) s.textDecorationLine = "underline";
|
|
1120
|
+
if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens);
|
|
1121
|
+
return s;
|
|
1122
|
+
}, [tokens, scopeCtx, color, weight, italic, underline, highlight]);
|
|
1123
|
+
return React14__default.default.createElement(
|
|
1124
|
+
reactNative.Text,
|
|
1125
|
+
{ style: style ? [spanStyle, ...Array.isArray(style) ? style : [style]] : spanStyle },
|
|
1126
|
+
children
|
|
902
1127
|
);
|
|
903
1128
|
}
|
|
1129
|
+
function TextBold(props) {
|
|
1130
|
+
return React14__default.default.createElement(TextSpan, { ...props, weight: "bold" });
|
|
1131
|
+
}
|
|
1132
|
+
function TextMedium(props) {
|
|
1133
|
+
return React14__default.default.createElement(TextSpan, { ...props, weight: "medium" });
|
|
1134
|
+
}
|
|
1135
|
+
function TextItalic(props) {
|
|
1136
|
+
return React14__default.default.createElement(TextSpan, { ...props, italic: true });
|
|
1137
|
+
}
|
|
1138
|
+
function TextUnderline(props) {
|
|
1139
|
+
return React14__default.default.createElement(TextSpan, { ...props, underline: true });
|
|
1140
|
+
}
|
|
1141
|
+
function TextHighlight(props) {
|
|
1142
|
+
return React14__default.default.createElement(TextSpan, props);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// src/primitives/Text/index.ts
|
|
1146
|
+
var Text2 = Object.assign(TextBase, {
|
|
1147
|
+
Span: TextSpan,
|
|
1148
|
+
Bold: TextBold,
|
|
1149
|
+
Medium: TextMedium,
|
|
1150
|
+
Italic: TextItalic,
|
|
1151
|
+
Underline: TextUnderline,
|
|
1152
|
+
Highlight: TextHighlight
|
|
1153
|
+
});
|
|
904
1154
|
|
|
905
1155
|
// src/primitives/Frame/Frame.utils.ts
|
|
906
1156
|
function resolveSpacing(value, tokens) {
|
|
@@ -1069,7 +1319,7 @@ function Wrapper({
|
|
|
1069
1319
|
ref
|
|
1070
1320
|
}) {
|
|
1071
1321
|
const tokens = useTokens(1);
|
|
1072
|
-
const containerStyle =
|
|
1322
|
+
const containerStyle = React14.useMemo(
|
|
1073
1323
|
() => getWrapperStyles({
|
|
1074
1324
|
tokens,
|
|
1075
1325
|
direction,
|
|
@@ -1104,7 +1354,7 @@ function Wrapper({
|
|
|
1104
1354
|
]
|
|
1105
1355
|
);
|
|
1106
1356
|
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
1107
|
-
return /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ React14__default.default.createElement(
|
|
1108
1358
|
reactNative.View,
|
|
1109
1359
|
{
|
|
1110
1360
|
ref,
|
|
@@ -1131,17 +1381,17 @@ function Button({
|
|
|
1131
1381
|
...pressableProps
|
|
1132
1382
|
}) {
|
|
1133
1383
|
const tokens = useTokens();
|
|
1134
|
-
const { variantColors, sizeTokens } =
|
|
1384
|
+
const { variantColors, sizeTokens } = React14__default.default.useMemo(
|
|
1135
1385
|
() => getButtonConfig(variant, semantic, size, disabled, tokens),
|
|
1136
1386
|
[variant, semantic, size, disabled, tokens]
|
|
1137
1387
|
);
|
|
1138
|
-
const padding =
|
|
1388
|
+
const padding = React14__default.default.useMemo(
|
|
1139
1389
|
() => computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
1140
1390
|
[size, icon, children, iconPosition]
|
|
1141
1391
|
);
|
|
1142
|
-
return /* @__PURE__ */
|
|
1392
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.Pressable, { disabled, ...pressableProps }, ({ pressed, hovered }) => (
|
|
1143
1393
|
// Wrapper handles layout: direction, gap, alignment (padding via style)
|
|
1144
|
-
/* @__PURE__ */
|
|
1394
|
+
/* @__PURE__ */ React14__default.default.createElement(
|
|
1145
1395
|
Wrapper,
|
|
1146
1396
|
{
|
|
1147
1397
|
direction: "horizontal",
|
|
@@ -1162,13 +1412,14 @@ function Button({
|
|
|
1162
1412
|
...Array.isArray(style) ? style : style ? [style] : []
|
|
1163
1413
|
]
|
|
1164
1414
|
},
|
|
1165
|
-
icon && iconPosition === "left" && /* @__PURE__ */
|
|
1415
|
+
icon && iconPosition === "left" && /* @__PURE__ */ React14__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
|
|
1166
1416
|
children && // Text primitive with semantic props + color style override
|
|
1167
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ React14__default.default.createElement(
|
|
1168
1418
|
Text2,
|
|
1169
1419
|
{
|
|
1420
|
+
role: "label",
|
|
1170
1421
|
size: sizeTokens.textSize,
|
|
1171
|
-
|
|
1422
|
+
centerVertically: true,
|
|
1172
1423
|
style: [
|
|
1173
1424
|
{ color: variantColors.textColor },
|
|
1174
1425
|
...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
|
|
@@ -1176,7 +1427,7 @@ function Button({
|
|
|
1176
1427
|
},
|
|
1177
1428
|
children
|
|
1178
1429
|
),
|
|
1179
|
-
icon && iconPosition === "right" && /* @__PURE__ */
|
|
1430
|
+
icon && iconPosition === "right" && /* @__PURE__ */ React14__default.default.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
|
|
1180
1431
|
)
|
|
1181
1432
|
));
|
|
1182
1433
|
}
|
|
@@ -1201,11 +1452,11 @@ function Card({
|
|
|
1201
1452
|
disabled = false
|
|
1202
1453
|
}) {
|
|
1203
1454
|
const tokens = useTokens(elevation);
|
|
1204
|
-
const styles =
|
|
1455
|
+
const styles = React14__default.default.useMemo(
|
|
1205
1456
|
() => getCardStyles(tokens, disabled),
|
|
1206
1457
|
[tokens, disabled]
|
|
1207
1458
|
);
|
|
1208
|
-
return /* @__PURE__ */
|
|
1459
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
|
|
1209
1460
|
}
|
|
1210
1461
|
var hadKeyboardEvent = false;
|
|
1211
1462
|
var isListenerSetup = false;
|
|
@@ -1235,16 +1486,16 @@ function setupModality() {
|
|
|
1235
1486
|
}, true);
|
|
1236
1487
|
}
|
|
1237
1488
|
function useFocusVisible() {
|
|
1238
|
-
const [isFocusVisible, setIsFocusVisible] =
|
|
1239
|
-
|
|
1489
|
+
const [isFocusVisible, setIsFocusVisible] = React14.useState(false);
|
|
1490
|
+
React14.useEffect(() => {
|
|
1240
1491
|
setupModality();
|
|
1241
1492
|
}, []);
|
|
1242
|
-
const onFocus =
|
|
1493
|
+
const onFocus = React14.useCallback(() => {
|
|
1243
1494
|
if (hadKeyboardEvent) {
|
|
1244
1495
|
setIsFocusVisible(true);
|
|
1245
1496
|
}
|
|
1246
1497
|
}, []);
|
|
1247
|
-
const onBlur =
|
|
1498
|
+
const onBlur = React14.useCallback(() => {
|
|
1248
1499
|
setIsFocusVisible(false);
|
|
1249
1500
|
}, []);
|
|
1250
1501
|
const focusProps = { onFocus, onBlur };
|
|
@@ -1356,9 +1607,9 @@ function getFrameStyles(input) {
|
|
|
1356
1607
|
|
|
1357
1608
|
// src/primitives/Frame/Frame.tsx
|
|
1358
1609
|
function wrapTextChildren(children, textStyle) {
|
|
1359
|
-
return
|
|
1610
|
+
return React14__default.default.Children.map(children, (child) => {
|
|
1360
1611
|
if (typeof child === "string" || typeof child === "number") {
|
|
1361
|
-
return /* @__PURE__ */
|
|
1612
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: textStyle }, child);
|
|
1362
1613
|
}
|
|
1363
1614
|
return child;
|
|
1364
1615
|
});
|
|
@@ -1413,7 +1664,7 @@ function Frame({
|
|
|
1413
1664
|
const parentFrameCtx = useFrameContext();
|
|
1414
1665
|
const resolvedFrameElevation = elevation ?? 0;
|
|
1415
1666
|
const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
|
|
1416
|
-
const tokens =
|
|
1667
|
+
const tokens = React14.useMemo(() => {
|
|
1417
1668
|
return computeTokens(
|
|
1418
1669
|
config.colorSystem,
|
|
1419
1670
|
mode,
|
|
@@ -1425,7 +1676,7 @@ function Frame({
|
|
|
1425
1676
|
config.tokenOverrides
|
|
1426
1677
|
);
|
|
1427
1678
|
}, [config, mode, resolvedElevation]);
|
|
1428
|
-
const styles =
|
|
1679
|
+
const styles = React14.useMemo(
|
|
1429
1680
|
() => getFrameStyles({
|
|
1430
1681
|
tokens,
|
|
1431
1682
|
frameElevation: resolvedFrameElevation,
|
|
@@ -1473,7 +1724,7 @@ function Frame({
|
|
|
1473
1724
|
disabled
|
|
1474
1725
|
]
|
|
1475
1726
|
);
|
|
1476
|
-
const contextValue =
|
|
1727
|
+
const contextValue = React14.useMemo(
|
|
1477
1728
|
() => ({ elevation: resolvedElevation, tokens }),
|
|
1478
1729
|
[resolvedElevation, tokens]
|
|
1479
1730
|
);
|
|
@@ -1494,23 +1745,23 @@ function Frame({
|
|
|
1494
1745
|
outlineOffset: 2
|
|
1495
1746
|
} : void 0;
|
|
1496
1747
|
const webFocusProps = isInteractive ? focusProps : {};
|
|
1497
|
-
const textStyle =
|
|
1748
|
+
const textStyle = React14.useMemo(
|
|
1498
1749
|
() => ({
|
|
1499
1750
|
color: newtone.srgbToHex(tokens.textPrimary.srgb),
|
|
1500
|
-
fontSize: tokens.typography.
|
|
1501
|
-
fontFamily: tokens.typography.fonts.
|
|
1502
|
-
lineHeight: tokens.typography.
|
|
1751
|
+
fontSize: tokens.typography.fontSizes["05"],
|
|
1752
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1753
|
+
lineHeight: tokens.typography.lineHeights["06"]
|
|
1503
1754
|
}),
|
|
1504
1755
|
[tokens]
|
|
1505
1756
|
);
|
|
1506
|
-
const wrappedChildren =
|
|
1757
|
+
const wrappedChildren = React14.useMemo(
|
|
1507
1758
|
() => wrapTextChildren(children, textStyle),
|
|
1508
1759
|
[children, textStyle]
|
|
1509
1760
|
);
|
|
1510
|
-
return /* @__PURE__ */
|
|
1761
|
+
return /* @__PURE__ */ React14__default.default.createElement(FrameContext.Provider, { value: contextValue }, isInteractive ? (
|
|
1511
1762
|
// Pressable handles taps. When href is set, react-native-web renders
|
|
1512
1763
|
// it as an <a> tag so it works like a regular link on the web.
|
|
1513
|
-
/* @__PURE__ */
|
|
1764
|
+
/* @__PURE__ */ React14__default.default.createElement(
|
|
1514
1765
|
reactNative.Pressable,
|
|
1515
1766
|
{
|
|
1516
1767
|
ref,
|
|
@@ -1535,7 +1786,7 @@ function Frame({
|
|
|
1535
1786
|
)
|
|
1536
1787
|
) : (
|
|
1537
1788
|
// Non-interactive Frame: just a plain View with no tap handling.
|
|
1538
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ React14__default.default.createElement(
|
|
1539
1790
|
reactNative.View,
|
|
1540
1791
|
{
|
|
1541
1792
|
ref,
|
|
@@ -1555,20 +1806,20 @@ function getTextInputStyles(tokens, disabled) {
|
|
|
1555
1806
|
gap: tokens.spacing["04"]
|
|
1556
1807
|
},
|
|
1557
1808
|
label: {
|
|
1558
|
-
fontFamily: tokens.typography.fonts.
|
|
1559
|
-
fontSize: tokens.typography.
|
|
1560
|
-
fontWeight: tokens.typography.
|
|
1809
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1810
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
1811
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1561
1812
|
color: newtone.srgbToHex(tokens.textSecondary.srgb)
|
|
1562
1813
|
},
|
|
1563
1814
|
input: {
|
|
1564
|
-
fontFamily: tokens.typography.fonts.
|
|
1815
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1565
1816
|
backgroundColor: newtone.srgbToHex(tokens.backgroundSunken.srgb),
|
|
1566
1817
|
borderWidth: 1,
|
|
1567
1818
|
borderColor: newtone.srgbToHex(tokens.border.srgb),
|
|
1568
1819
|
borderRadius: tokens.radius.md,
|
|
1569
1820
|
paddingVertical: tokens.spacing["08"],
|
|
1570
1821
|
paddingHorizontal: tokens.spacing["12"],
|
|
1571
|
-
fontSize: tokens.typography.
|
|
1822
|
+
fontSize: tokens.typography.fontSizes["05"],
|
|
1572
1823
|
color: disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : newtone.srgbToHex(tokens.textPrimary.srgb),
|
|
1573
1824
|
opacity: disabled ? 0.5 : 1
|
|
1574
1825
|
}
|
|
@@ -1581,11 +1832,11 @@ function TextInput({
|
|
|
1581
1832
|
...textInputProps
|
|
1582
1833
|
}) {
|
|
1583
1834
|
const tokens = useTokens(1);
|
|
1584
|
-
const styles =
|
|
1835
|
+
const styles = React14__default.default.useMemo(
|
|
1585
1836
|
() => getTextInputStyles(tokens, disabled),
|
|
1586
1837
|
[tokens, disabled]
|
|
1587
1838
|
);
|
|
1588
|
-
return /* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React14__default.default.createElement(
|
|
1589
1840
|
reactNative.TextInput,
|
|
1590
1841
|
{
|
|
1591
1842
|
style: styles.input,
|
|
@@ -1637,15 +1888,15 @@ function Popover({
|
|
|
1637
1888
|
contentStyle
|
|
1638
1889
|
}) {
|
|
1639
1890
|
const tokens = useTokens(1);
|
|
1640
|
-
const containerRef =
|
|
1641
|
-
const [triggerHeight, setTriggerHeight] =
|
|
1642
|
-
const onTriggerLayout =
|
|
1891
|
+
const containerRef = React14.useRef(null);
|
|
1892
|
+
const [triggerHeight, setTriggerHeight] = React14.useState(0);
|
|
1893
|
+
const onTriggerLayout = React14.useCallback(
|
|
1643
1894
|
(e) => {
|
|
1644
1895
|
setTriggerHeight(e.nativeEvent.layout.height);
|
|
1645
1896
|
},
|
|
1646
1897
|
[]
|
|
1647
1898
|
);
|
|
1648
|
-
|
|
1899
|
+
React14.useEffect(() => {
|
|
1649
1900
|
if (!isOpen) return;
|
|
1650
1901
|
openPopovers.forEach((closeFn) => closeFn());
|
|
1651
1902
|
openPopovers.clear();
|
|
@@ -1654,7 +1905,7 @@ function Popover({
|
|
|
1654
1905
|
openPopovers.delete(onClose);
|
|
1655
1906
|
};
|
|
1656
1907
|
}, [isOpen, onClose]);
|
|
1657
|
-
|
|
1908
|
+
React14.useEffect(() => {
|
|
1658
1909
|
if (!isOpen) return;
|
|
1659
1910
|
if (typeof document === "undefined") return;
|
|
1660
1911
|
const handleMouseDown = (e) => {
|
|
@@ -1666,7 +1917,7 @@ function Popover({
|
|
|
1666
1917
|
document.addEventListener("mousedown", handleMouseDown, true);
|
|
1667
1918
|
return () => document.removeEventListener("mousedown", handleMouseDown, true);
|
|
1668
1919
|
}, [isOpen, onClose]);
|
|
1669
|
-
const handleKeyDown =
|
|
1920
|
+
const handleKeyDown = React14.useCallback(
|
|
1670
1921
|
(e) => {
|
|
1671
1922
|
if (closeOnEscape && e.key === "Escape") {
|
|
1672
1923
|
e.stopPropagation();
|
|
@@ -1675,41 +1926,41 @@ function Popover({
|
|
|
1675
1926
|
},
|
|
1676
1927
|
[closeOnEscape, onClose]
|
|
1677
1928
|
);
|
|
1678
|
-
const styles =
|
|
1929
|
+
const styles = React14.useMemo(
|
|
1679
1930
|
() => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen),
|
|
1680
1931
|
[tokens, triggerHeight, offset, maxHeight, width, isOpen]
|
|
1681
1932
|
);
|
|
1682
|
-
const containerStyles =
|
|
1933
|
+
const containerStyles = React14.useMemo(
|
|
1683
1934
|
() => [styles.container, ...Array.isArray(style) ? style : style ? [style] : []],
|
|
1684
1935
|
[styles.container, style]
|
|
1685
1936
|
);
|
|
1686
|
-
const mergedContentStyles =
|
|
1937
|
+
const mergedContentStyles = React14.useMemo(
|
|
1687
1938
|
() => [styles.content, ...Array.isArray(contentStyle) ? contentStyle : contentStyle ? [contentStyle] : []],
|
|
1688
1939
|
[styles.content, contentStyle]
|
|
1689
1940
|
);
|
|
1690
1941
|
const webProps = { onKeyDown: handleKeyDown };
|
|
1691
|
-
return /* @__PURE__ */
|
|
1942
|
+
return /* @__PURE__ */ React14__default.default.createElement(
|
|
1692
1943
|
reactNative.View,
|
|
1693
1944
|
{
|
|
1694
1945
|
ref: containerRef,
|
|
1695
1946
|
style: containerStyles,
|
|
1696
1947
|
...webProps
|
|
1697
1948
|
},
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
isOpen && /* @__PURE__ */
|
|
1949
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { onLayout: onTriggerLayout }, trigger),
|
|
1950
|
+
isOpen && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: mergedContentStyles }, children)
|
|
1700
1951
|
);
|
|
1701
1952
|
}
|
|
1702
1953
|
function usePopover(options) {
|
|
1703
|
-
const [isOpen, setIsOpen] =
|
|
1704
|
-
const open =
|
|
1954
|
+
const [isOpen, setIsOpen] = React14.useState(options?.initialOpen ?? false);
|
|
1955
|
+
const open = React14.useCallback(() => {
|
|
1705
1956
|
setIsOpen(true);
|
|
1706
1957
|
options?.onOpenChange?.(true);
|
|
1707
1958
|
}, [options]);
|
|
1708
|
-
const close =
|
|
1959
|
+
const close = React14.useCallback(() => {
|
|
1709
1960
|
setIsOpen(false);
|
|
1710
1961
|
options?.onOpenChange?.(false);
|
|
1711
1962
|
}, [options]);
|
|
1712
|
-
const toggle =
|
|
1963
|
+
const toggle = React14.useCallback(() => {
|
|
1713
1964
|
setIsOpen((prev) => {
|
|
1714
1965
|
const next = !prev;
|
|
1715
1966
|
options?.onOpenChange?.(next);
|
|
@@ -1725,7 +1976,7 @@ function isOptionGroup(item) {
|
|
|
1725
1976
|
}
|
|
1726
1977
|
function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
1727
1978
|
const isSm = size === "sm";
|
|
1728
|
-
const fontSize = isSm ? tokens.typography.
|
|
1979
|
+
const fontSize = isSm ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1729
1980
|
const iconSize = fontSize + 2;
|
|
1730
1981
|
const iconSpace = iconSize + tokens.spacing["08"];
|
|
1731
1982
|
const paddingVertical = isSm ? tokens.spacing["04"] : tokens.spacing["08"];
|
|
@@ -1736,9 +1987,9 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
|
1736
1987
|
zIndex: isOpen ? 999 : 0
|
|
1737
1988
|
},
|
|
1738
1989
|
label: {
|
|
1739
|
-
fontFamily: tokens.typography.fonts.
|
|
1740
|
-
fontSize: tokens.typography.
|
|
1741
|
-
fontWeight: tokens.typography.
|
|
1990
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1991
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
1992
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1742
1993
|
color: newtone.srgbToHex(tokens.textSecondary.srgb)
|
|
1743
1994
|
},
|
|
1744
1995
|
trigger: {
|
|
@@ -1755,7 +2006,7 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
|
1755
2006
|
},
|
|
1756
2007
|
triggerText: {
|
|
1757
2008
|
flex: 1,
|
|
1758
|
-
fontFamily: tokens.typography.fonts.
|
|
2009
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1759
2010
|
fontSize,
|
|
1760
2011
|
color: disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : newtone.srgbToHex(tokens.textPrimary.srgb)
|
|
1761
2012
|
},
|
|
@@ -1767,9 +2018,9 @@ function getSelectStyles(tokens, disabled, size, isOpen) {
|
|
|
1767
2018
|
justifyContent: "center"
|
|
1768
2019
|
},
|
|
1769
2020
|
groupLabel: {
|
|
1770
|
-
fontFamily: tokens.typography.fonts.
|
|
1771
|
-
fontSize: tokens.typography.
|
|
1772
|
-
fontWeight: tokens.typography.
|
|
2021
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2022
|
+
fontSize: tokens.typography.fontSizes["01"],
|
|
2023
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1773
2024
|
color: newtone.srgbToHex(tokens.textSecondary.srgb),
|
|
1774
2025
|
textTransform: "uppercase",
|
|
1775
2026
|
letterSpacing: 0.5,
|
|
@@ -1796,10 +2047,10 @@ function useSelect({
|
|
|
1796
2047
|
onClose,
|
|
1797
2048
|
onOpen
|
|
1798
2049
|
}) {
|
|
1799
|
-
const [focusedIndex, setFocusedIndex] =
|
|
1800
|
-
const typeAheadRef =
|
|
1801
|
-
const typeAheadTimerRef =
|
|
1802
|
-
|
|
2050
|
+
const [focusedIndex, setFocusedIndex] = React14.useState(-1);
|
|
2051
|
+
const typeAheadRef = React14.useRef("");
|
|
2052
|
+
const typeAheadTimerRef = React14.useRef();
|
|
2053
|
+
React14.useEffect(() => {
|
|
1803
2054
|
if (isOpen) {
|
|
1804
2055
|
const selectedIdx = flatOptions.findIndex((o) => o.value === value);
|
|
1805
2056
|
if (selectedIdx >= 0 && !flatOptions[selectedIdx].disabled) {
|
|
@@ -1812,7 +2063,7 @@ function useSelect({
|
|
|
1812
2063
|
setFocusedIndex(-1);
|
|
1813
2064
|
}
|
|
1814
2065
|
}, [isOpen, flatOptions, value]);
|
|
1815
|
-
const handleKeyDown =
|
|
2066
|
+
const handleKeyDown = React14.useCallback(
|
|
1816
2067
|
(e) => {
|
|
1817
2068
|
const key = e.key;
|
|
1818
2069
|
if (!isOpen) {
|
|
@@ -1891,9 +2142,9 @@ function SelectOptionRow({
|
|
|
1891
2142
|
const tokens = useTokens(1);
|
|
1892
2143
|
const paddingVertical = size === "sm" ? tokens.spacing["04"] : tokens.spacing["08"];
|
|
1893
2144
|
const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
|
|
1894
|
-
const fontSize = size === "sm" ? tokens.typography.
|
|
2145
|
+
const fontSize = size === "sm" ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1895
2146
|
if (renderOption) {
|
|
1896
|
-
return /* @__PURE__ */
|
|
2147
|
+
return /* @__PURE__ */ React14__default.default.createElement(
|
|
1897
2148
|
reactNative.Pressable,
|
|
1898
2149
|
{
|
|
1899
2150
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1904,7 +2155,7 @@ function SelectOptionRow({
|
|
|
1904
2155
|
renderOption(option, { isSelected, isFocused })
|
|
1905
2156
|
);
|
|
1906
2157
|
}
|
|
1907
|
-
return /* @__PURE__ */
|
|
2158
|
+
return /* @__PURE__ */ React14__default.default.createElement(
|
|
1908
2159
|
reactNative.Pressable,
|
|
1909
2160
|
{
|
|
1910
2161
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1933,18 +2184,18 @@ function SelectOptionRow({
|
|
|
1933
2184
|
}
|
|
1934
2185
|
]
|
|
1935
2186
|
},
|
|
1936
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ React14__default.default.createElement(
|
|
1937
2188
|
reactNative.Text,
|
|
1938
2189
|
{
|
|
1939
2190
|
style: [
|
|
1940
2191
|
{
|
|
1941
2192
|
flex: 1,
|
|
1942
|
-
fontFamily: tokens.typography.fonts.
|
|
2193
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
1943
2194
|
fontSize,
|
|
1944
2195
|
color: newtone.srgbToHex(tokens.textPrimary.srgb)
|
|
1945
2196
|
},
|
|
1946
2197
|
isSelected && {
|
|
1947
|
-
fontWeight: tokens.typography.
|
|
2198
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1948
2199
|
color: newtone.srgbToHex(tokens.accent.fill.srgb)
|
|
1949
2200
|
},
|
|
1950
2201
|
option.disabled && {
|
|
@@ -1955,7 +2206,7 @@ function SelectOptionRow({
|
|
|
1955
2206
|
},
|
|
1956
2207
|
option.label
|
|
1957
2208
|
),
|
|
1958
|
-
isSelected && /* @__PURE__ */
|
|
2209
|
+
isSelected && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React14__default.default.createElement(
|
|
1959
2210
|
Icon,
|
|
1960
2211
|
{
|
|
1961
2212
|
name: "check",
|
|
@@ -1990,7 +2241,7 @@ function Select({
|
|
|
1990
2241
|
}) {
|
|
1991
2242
|
const tokens = useTokens(1);
|
|
1992
2243
|
const { isOpen, open, close, toggle } = usePopover();
|
|
1993
|
-
const flatOptions =
|
|
2244
|
+
const flatOptions = React14.useMemo(() => flattenOptions(options), [options]);
|
|
1994
2245
|
const { focusedIndex, handleKeyDown } = useSelect({
|
|
1995
2246
|
flatOptions,
|
|
1996
2247
|
value,
|
|
@@ -2002,7 +2253,7 @@ function Select({
|
|
|
2002
2253
|
onClose: close,
|
|
2003
2254
|
onOpen: open
|
|
2004
2255
|
});
|
|
2005
|
-
const styles =
|
|
2256
|
+
const styles = React14.useMemo(
|
|
2006
2257
|
() => getSelectStyles(tokens, disabled, size, isOpen),
|
|
2007
2258
|
[tokens, disabled, size, isOpen]
|
|
2008
2259
|
);
|
|
@@ -2010,7 +2261,7 @@ function Select({
|
|
|
2010
2261
|
const displayLabel = selectedOption?.label ?? placeholder ?? value;
|
|
2011
2262
|
const iconColor = disabled ? newtone.srgbToHex(tokens.textSecondary.srgb) : newtone.srgbToHex(tokens.textPrimary.srgb);
|
|
2012
2263
|
const triggerWebProps = { onKeyDown: handleKeyDown };
|
|
2013
|
-
const trigger = /* @__PURE__ */
|
|
2264
|
+
const trigger = /* @__PURE__ */ React14__default.default.createElement(
|
|
2014
2265
|
reactNative.Pressable,
|
|
2015
2266
|
{
|
|
2016
2267
|
onPress: disabled ? void 0 : toggle,
|
|
@@ -2020,24 +2271,24 @@ function Select({
|
|
|
2020
2271
|
...triggerWebProps,
|
|
2021
2272
|
style: styles.trigger
|
|
2022
2273
|
},
|
|
2023
|
-
renderValue ? renderValue(selectedOption) : /* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2274
|
+
renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
|
|
2275
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React14__default.default.createElement(
|
|
2025
2276
|
Icon,
|
|
2026
2277
|
{
|
|
2027
2278
|
name: isOpen ? "expand_less" : "expand_more",
|
|
2028
|
-
size: size === "sm" ? tokens.typography.
|
|
2279
|
+
size: size === "sm" ? tokens.typography.fontSizes["04"] + 2 : tokens.typography.fontSizes["05"] + 2,
|
|
2029
2280
|
color: iconColor
|
|
2030
2281
|
}
|
|
2031
2282
|
))
|
|
2032
2283
|
);
|
|
2033
|
-
return /* @__PURE__ */
|
|
2284
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React14__default.default.createElement(
|
|
2034
2285
|
Popover,
|
|
2035
2286
|
{
|
|
2036
2287
|
isOpen: isOpen && !disabled,
|
|
2037
2288
|
onClose: close,
|
|
2038
2289
|
trigger
|
|
2039
2290
|
},
|
|
2040
|
-
/* @__PURE__ */
|
|
2291
|
+
/* @__PURE__ */ React14__default.default.createElement(
|
|
2041
2292
|
reactNative.ScrollView,
|
|
2042
2293
|
{
|
|
2043
2294
|
bounces: false,
|
|
@@ -2046,7 +2297,7 @@ function Select({
|
|
|
2046
2297
|
},
|
|
2047
2298
|
options.map((item) => {
|
|
2048
2299
|
if (isOptionGroup(item)) {
|
|
2049
|
-
return /* @__PURE__ */
|
|
2300
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { key: item.label }, /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React14__default.default.createElement(
|
|
2050
2301
|
SelectOptionRow,
|
|
2051
2302
|
{
|
|
2052
2303
|
key: opt.value,
|
|
@@ -2062,7 +2313,7 @@ function Select({
|
|
|
2062
2313
|
}
|
|
2063
2314
|
)));
|
|
2064
2315
|
}
|
|
2065
|
-
return /* @__PURE__ */
|
|
2316
|
+
return /* @__PURE__ */ React14__default.default.createElement(
|
|
2066
2317
|
SelectOptionRow,
|
|
2067
2318
|
{
|
|
2068
2319
|
key: item.value,
|
|
@@ -2094,9 +2345,9 @@ function getToggleStyles(tokens, value, disabled) {
|
|
|
2094
2345
|
opacity: disabled ? 0.5 : 1
|
|
2095
2346
|
},
|
|
2096
2347
|
label: {
|
|
2097
|
-
fontFamily: tokens.typography.fonts.
|
|
2098
|
-
fontSize: tokens.typography.
|
|
2099
|
-
fontWeight: tokens.typography.
|
|
2348
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2349
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2350
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2100
2351
|
color: newtone.srgbToHex(tokens.textSecondary.srgb)
|
|
2101
2352
|
},
|
|
2102
2353
|
track: {
|
|
@@ -2126,16 +2377,16 @@ function Toggle({
|
|
|
2126
2377
|
style
|
|
2127
2378
|
}) {
|
|
2128
2379
|
const tokens = useTokens(1);
|
|
2129
|
-
const styles =
|
|
2380
|
+
const styles = React14__default.default.useMemo(
|
|
2130
2381
|
() => getToggleStyles(tokens, value, disabled),
|
|
2131
2382
|
[tokens, value, disabled]
|
|
2132
2383
|
);
|
|
2133
|
-
const handlePress =
|
|
2384
|
+
const handlePress = React14__default.default.useCallback(() => {
|
|
2134
2385
|
if (!disabled) {
|
|
2135
2386
|
onValueChange(!value);
|
|
2136
2387
|
}
|
|
2137
2388
|
}, [disabled, value, onValueChange]);
|
|
2138
|
-
return /* @__PURE__ */
|
|
2389
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), /* @__PURE__ */ React14__default.default.createElement(
|
|
2139
2390
|
reactNative.Pressable,
|
|
2140
2391
|
{
|
|
2141
2392
|
onPress: handlePress,
|
|
@@ -2143,7 +2394,7 @@ function Toggle({
|
|
|
2143
2394
|
accessibilityRole: "switch",
|
|
2144
2395
|
accessibilityState: { checked: value, disabled }
|
|
2145
2396
|
},
|
|
2146
|
-
/* @__PURE__ */
|
|
2397
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.track }, /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.thumb }))
|
|
2147
2398
|
));
|
|
2148
2399
|
}
|
|
2149
2400
|
var TRACK_HEIGHT2 = 6;
|
|
@@ -2160,15 +2411,15 @@ function getSliderStyles(tokens, disabled) {
|
|
|
2160
2411
|
alignItems: "center"
|
|
2161
2412
|
},
|
|
2162
2413
|
label: {
|
|
2163
|
-
fontFamily: tokens.typography.fonts.
|
|
2164
|
-
fontSize: tokens.typography.
|
|
2165
|
-
fontWeight: tokens.typography.
|
|
2414
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2415
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2416
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2166
2417
|
color: newtone.srgbToHex(tokens.textSecondary.srgb)
|
|
2167
2418
|
},
|
|
2168
2419
|
value: {
|
|
2169
|
-
fontFamily: tokens.typography.fonts.
|
|
2170
|
-
fontSize: tokens.typography.
|
|
2171
|
-
fontWeight: tokens.typography.
|
|
2420
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2421
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2422
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2172
2423
|
color: newtone.srgbToHex(tokens.textPrimary.srgb)
|
|
2173
2424
|
},
|
|
2174
2425
|
valueInput: {
|
|
@@ -2180,9 +2431,9 @@ function getSliderStyles(tokens, disabled) {
|
|
|
2180
2431
|
borderRadius: 4,
|
|
2181
2432
|
backgroundColor: "transparent",
|
|
2182
2433
|
color: newtone.srgbToHex(tokens.textPrimary.srgb),
|
|
2183
|
-
fontFamily: tokens.typography.fonts.
|
|
2184
|
-
fontSize: tokens.typography.
|
|
2185
|
-
fontWeight: tokens.typography.
|
|
2434
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2435
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2436
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2186
2437
|
textAlign: "right"
|
|
2187
2438
|
},
|
|
2188
2439
|
trackContainer: {
|
|
@@ -2229,41 +2480,41 @@ function Slider({
|
|
|
2229
2480
|
style
|
|
2230
2481
|
}) {
|
|
2231
2482
|
const tokens = useTokens(1);
|
|
2232
|
-
const styles =
|
|
2483
|
+
const styles = React14__default.default.useMemo(
|
|
2233
2484
|
() => getSliderStyles(tokens, disabled),
|
|
2234
2485
|
[tokens, disabled]
|
|
2235
2486
|
);
|
|
2236
|
-
const trackRef =
|
|
2237
|
-
const trackWidth =
|
|
2238
|
-
const trackPageX =
|
|
2239
|
-
const onValueChangeRef =
|
|
2240
|
-
const minRef =
|
|
2241
|
-
const maxRef =
|
|
2242
|
-
const stepRef =
|
|
2243
|
-
const disabledRef =
|
|
2244
|
-
|
|
2487
|
+
const trackRef = React14__default.default.useRef(null);
|
|
2488
|
+
const trackWidth = React14__default.default.useRef(0);
|
|
2489
|
+
const trackPageX = React14__default.default.useRef(0);
|
|
2490
|
+
const onValueChangeRef = React14__default.default.useRef(onValueChange);
|
|
2491
|
+
const minRef = React14__default.default.useRef(min);
|
|
2492
|
+
const maxRef = React14__default.default.useRef(max);
|
|
2493
|
+
const stepRef = React14__default.default.useRef(step);
|
|
2494
|
+
const disabledRef = React14__default.default.useRef(disabled);
|
|
2495
|
+
React14__default.default.useEffect(() => {
|
|
2245
2496
|
onValueChangeRef.current = onValueChange;
|
|
2246
2497
|
}, [onValueChange]);
|
|
2247
|
-
|
|
2498
|
+
React14__default.default.useEffect(() => {
|
|
2248
2499
|
minRef.current = min;
|
|
2249
2500
|
}, [min]);
|
|
2250
|
-
|
|
2501
|
+
React14__default.default.useEffect(() => {
|
|
2251
2502
|
maxRef.current = max;
|
|
2252
2503
|
}, [max]);
|
|
2253
|
-
|
|
2504
|
+
React14__default.default.useEffect(() => {
|
|
2254
2505
|
stepRef.current = step;
|
|
2255
2506
|
}, [step]);
|
|
2256
|
-
|
|
2507
|
+
React14__default.default.useEffect(() => {
|
|
2257
2508
|
disabledRef.current = disabled;
|
|
2258
2509
|
}, [disabled]);
|
|
2259
|
-
const computeValue =
|
|
2510
|
+
const computeValue = React14__default.default.useCallback((pageX) => {
|
|
2260
2511
|
const localX = pageX - trackPageX.current;
|
|
2261
2512
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2262
2513
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2263
2514
|
const stepped = Math.round(raw / stepRef.current) * stepRef.current;
|
|
2264
2515
|
return Math.min(maxRef.current, Math.max(minRef.current, stepped));
|
|
2265
2516
|
}, []);
|
|
2266
|
-
const panResponder =
|
|
2517
|
+
const panResponder = React14__default.default.useRef(
|
|
2267
2518
|
reactNative.PanResponder.create({
|
|
2268
2519
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2269
2520
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2279,7 +2530,7 @@ function Slider({
|
|
|
2279
2530
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE2);
|
|
2280
2531
|
const thumbLeft = ratio * usableWidth;
|
|
2281
2532
|
const fillWidth = thumbLeft + THUMB_SIZE2 / 2;
|
|
2282
|
-
const handleValueTextSubmit =
|
|
2533
|
+
const handleValueTextSubmit = React14__default.default.useCallback(
|
|
2283
2534
|
(text) => {
|
|
2284
2535
|
const raw = Number(text);
|
|
2285
2536
|
if (!Number.isNaN(raw)) {
|
|
@@ -2288,12 +2539,12 @@ function Slider({
|
|
|
2288
2539
|
},
|
|
2289
2540
|
[onValueChange, min, max]
|
|
2290
2541
|
);
|
|
2291
|
-
const [editText, setEditText] =
|
|
2292
|
-
|
|
2542
|
+
const [editText, setEditText] = React14__default.default.useState(String(value));
|
|
2543
|
+
React14__default.default.useEffect(() => {
|
|
2293
2544
|
setEditText(String(value));
|
|
2294
2545
|
}, [value]);
|
|
2295
2546
|
const showLabel = label || showValue || editableValue;
|
|
2296
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14__default.default.createElement(
|
|
2297
2548
|
reactNative.TextInput,
|
|
2298
2549
|
{
|
|
2299
2550
|
style: styles.valueInput,
|
|
@@ -2305,7 +2556,7 @@ function Slider({
|
|
|
2305
2556
|
selectTextOnFocus: true,
|
|
2306
2557
|
editable: !disabled
|
|
2307
2558
|
}
|
|
2308
|
-
) : showValue && /* @__PURE__ */
|
|
2559
|
+
) : showValue && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.value }, value)), /* @__PURE__ */ React14__default.default.createElement(
|
|
2309
2560
|
reactNative.View,
|
|
2310
2561
|
{
|
|
2311
2562
|
ref: trackRef,
|
|
@@ -2318,9 +2569,9 @@ function Slider({
|
|
|
2318
2569
|
},
|
|
2319
2570
|
...panResponder.panHandlers
|
|
2320
2571
|
},
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.trackRail }),
|
|
2573
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.trackFill, { width: fillWidth }] }),
|
|
2574
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2324
2575
|
));
|
|
2325
2576
|
}
|
|
2326
2577
|
var TRACK_HEIGHT3 = 22;
|
|
@@ -2376,15 +2627,15 @@ function getHueSliderStyles(tokens, disabled) {
|
|
|
2376
2627
|
alignItems: "center"
|
|
2377
2628
|
},
|
|
2378
2629
|
label: {
|
|
2379
|
-
fontFamily: tokens.typography.fonts.
|
|
2380
|
-
fontSize: tokens.typography.
|
|
2381
|
-
fontWeight: tokens.typography.
|
|
2630
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2631
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2632
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2382
2633
|
color: newtone.srgbToHex(tokens.textSecondary.srgb)
|
|
2383
2634
|
},
|
|
2384
2635
|
value: {
|
|
2385
|
-
fontFamily: tokens.typography.fonts.
|
|
2386
|
-
fontSize: tokens.typography.
|
|
2387
|
-
fontWeight: tokens.typography.
|
|
2636
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2637
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2638
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2388
2639
|
color: newtone.srgbToHex(tokens.textPrimary.srgb)
|
|
2389
2640
|
},
|
|
2390
2641
|
valueInput: {
|
|
@@ -2396,9 +2647,9 @@ function getHueSliderStyles(tokens, disabled) {
|
|
|
2396
2647
|
borderRadius: 4,
|
|
2397
2648
|
backgroundColor: "transparent",
|
|
2398
2649
|
color: newtone.srgbToHex(tokens.textPrimary.srgb),
|
|
2399
|
-
fontFamily: tokens.typography.fonts.
|
|
2400
|
-
fontSize: tokens.typography.
|
|
2401
|
-
fontWeight: tokens.typography.
|
|
2650
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2651
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2652
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2402
2653
|
textAlign: "right"
|
|
2403
2654
|
},
|
|
2404
2655
|
trackContainer: {
|
|
@@ -2443,41 +2694,41 @@ function HueSlider({
|
|
|
2443
2694
|
style
|
|
2444
2695
|
}) {
|
|
2445
2696
|
const tokens = useTokens(1);
|
|
2446
|
-
const styles =
|
|
2697
|
+
const styles = React14__default.default.useMemo(
|
|
2447
2698
|
() => getHueSliderStyles(tokens, disabled),
|
|
2448
2699
|
[tokens, disabled]
|
|
2449
2700
|
);
|
|
2450
|
-
const segments =
|
|
2701
|
+
const segments = React14__default.default.useMemo(
|
|
2451
2702
|
() => buildHueSegments(min, max),
|
|
2452
2703
|
[min, max]
|
|
2453
2704
|
);
|
|
2454
|
-
const trackRef =
|
|
2455
|
-
const trackWidth =
|
|
2456
|
-
const trackPageX =
|
|
2457
|
-
const onValueChangeRef =
|
|
2458
|
-
const minRef =
|
|
2459
|
-
const maxRef =
|
|
2460
|
-
const disabledRef =
|
|
2461
|
-
|
|
2705
|
+
const trackRef = React14__default.default.useRef(null);
|
|
2706
|
+
const trackWidth = React14__default.default.useRef(0);
|
|
2707
|
+
const trackPageX = React14__default.default.useRef(0);
|
|
2708
|
+
const onValueChangeRef = React14__default.default.useRef(onValueChange);
|
|
2709
|
+
const minRef = React14__default.default.useRef(min);
|
|
2710
|
+
const maxRef = React14__default.default.useRef(max);
|
|
2711
|
+
const disabledRef = React14__default.default.useRef(disabled);
|
|
2712
|
+
React14__default.default.useEffect(() => {
|
|
2462
2713
|
onValueChangeRef.current = onValueChange;
|
|
2463
2714
|
}, [onValueChange]);
|
|
2464
|
-
|
|
2715
|
+
React14__default.default.useEffect(() => {
|
|
2465
2716
|
minRef.current = min;
|
|
2466
2717
|
}, [min]);
|
|
2467
|
-
|
|
2718
|
+
React14__default.default.useEffect(() => {
|
|
2468
2719
|
maxRef.current = max;
|
|
2469
2720
|
}, [max]);
|
|
2470
|
-
|
|
2721
|
+
React14__default.default.useEffect(() => {
|
|
2471
2722
|
disabledRef.current = disabled;
|
|
2472
2723
|
}, [disabled]);
|
|
2473
|
-
const computeHue =
|
|
2724
|
+
const computeHue = React14__default.default.useCallback((pageX) => {
|
|
2474
2725
|
const localX = pageX - trackPageX.current;
|
|
2475
2726
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2476
2727
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2477
2728
|
const stepped = Math.round(raw);
|
|
2478
2729
|
return (stepped % 360 + 360) % 360;
|
|
2479
2730
|
}, []);
|
|
2480
|
-
const panResponder =
|
|
2731
|
+
const panResponder = React14__default.default.useRef(
|
|
2481
2732
|
reactNative.PanResponder.create({
|
|
2482
2733
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2483
2734
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2493,7 +2744,7 @@ function HueSlider({
|
|
|
2493
2744
|
const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
|
|
2494
2745
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE3);
|
|
2495
2746
|
const thumbLeft = ratio * usableWidth;
|
|
2496
|
-
const handleValueTextSubmit =
|
|
2747
|
+
const handleValueTextSubmit = React14__default.default.useCallback(
|
|
2497
2748
|
(text) => {
|
|
2498
2749
|
const raw = Number(text);
|
|
2499
2750
|
if (!Number.isNaN(raw)) {
|
|
@@ -2502,12 +2753,12 @@ function HueSlider({
|
|
|
2502
2753
|
},
|
|
2503
2754
|
[onValueChange]
|
|
2504
2755
|
);
|
|
2505
|
-
const [editText, setEditText] =
|
|
2506
|
-
|
|
2756
|
+
const [editText, setEditText] = React14__default.default.useState(String(value));
|
|
2757
|
+
React14__default.default.useEffect(() => {
|
|
2507
2758
|
setEditText(String(value));
|
|
2508
2759
|
}, [value]);
|
|
2509
2760
|
const showLabel = label || showValue || editableValue;
|
|
2510
|
-
return /* @__PURE__ */
|
|
2761
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.labelRow }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React14__default.default.createElement(
|
|
2511
2762
|
reactNative.TextInput,
|
|
2512
2763
|
{
|
|
2513
2764
|
style: styles.valueInput,
|
|
@@ -2519,7 +2770,7 @@ function HueSlider({
|
|
|
2519
2770
|
selectTextOnFocus: true,
|
|
2520
2771
|
editable: !disabled
|
|
2521
2772
|
}
|
|
2522
|
-
) : showValue && /* @__PURE__ */
|
|
2773
|
+
) : showValue && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React14__default.default.createElement(
|
|
2523
2774
|
reactNative.View,
|
|
2524
2775
|
{
|
|
2525
2776
|
ref: trackRef,
|
|
@@ -2532,8 +2783,8 @@ function HueSlider({
|
|
|
2532
2783
|
},
|
|
2533
2784
|
...panResponder.panHandlers
|
|
2534
2785
|
},
|
|
2535
|
-
/* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */
|
|
2786
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
|
|
2787
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2537
2788
|
));
|
|
2538
2789
|
}
|
|
2539
2790
|
var TRACK_HEIGHT4 = 22;
|
|
@@ -2550,9 +2801,9 @@ function getColorScaleSliderStyles(tokens, disabled) {
|
|
|
2550
2801
|
alignItems: "center"
|
|
2551
2802
|
},
|
|
2552
2803
|
label: {
|
|
2553
|
-
fontFamily: tokens.typography.fonts.
|
|
2554
|
-
fontSize: tokens.typography.
|
|
2555
|
-
fontWeight: tokens.typography.
|
|
2804
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2805
|
+
fontSize: tokens.typography.fontSizes["04"],
|
|
2806
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2556
2807
|
color: newtone.srgbToHex(tokens.textSecondary.srgb)
|
|
2557
2808
|
},
|
|
2558
2809
|
trackContainer: {
|
|
@@ -2582,9 +2833,9 @@ function getColorScaleSliderStyles(tokens, disabled) {
|
|
|
2582
2833
|
borderColor: newtone.srgbToHex(tokens.border.srgb)
|
|
2583
2834
|
},
|
|
2584
2835
|
warning: {
|
|
2585
|
-
fontFamily: tokens.typography.fonts.
|
|
2586
|
-
fontSize: tokens.typography.
|
|
2587
|
-
fontWeight: tokens.typography.
|
|
2836
|
+
fontFamily: tokens.typography.fonts.main.family,
|
|
2837
|
+
fontSize: tokens.typography.fontSizes["01"],
|
|
2838
|
+
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2588
2839
|
color: newtone.srgbToHex(tokens.error.fill.srgb)
|
|
2589
2840
|
}
|
|
2590
2841
|
});
|
|
@@ -2604,36 +2855,36 @@ function ColorScaleSlider({
|
|
|
2604
2855
|
style
|
|
2605
2856
|
}) {
|
|
2606
2857
|
const tokens = useTokens(1);
|
|
2607
|
-
const styles =
|
|
2858
|
+
const styles = React14__default.default.useMemo(
|
|
2608
2859
|
() => getColorScaleSliderStyles(tokens, disabled),
|
|
2609
2860
|
[tokens, disabled]
|
|
2610
2861
|
);
|
|
2611
|
-
const trackRef =
|
|
2612
|
-
const trackWidth =
|
|
2613
|
-
const trackPageX =
|
|
2614
|
-
const isDragging =
|
|
2615
|
-
const thumbAnim =
|
|
2616
|
-
const onValueChangeRef =
|
|
2617
|
-
const disabledRef =
|
|
2618
|
-
const colorsLengthRef =
|
|
2619
|
-
const trimEndsRef =
|
|
2620
|
-
const snapRef =
|
|
2621
|
-
|
|
2862
|
+
const trackRef = React14__default.default.useRef(null);
|
|
2863
|
+
const trackWidth = React14__default.default.useRef(0);
|
|
2864
|
+
const trackPageX = React14__default.default.useRef(0);
|
|
2865
|
+
const isDragging = React14__default.default.useRef(false);
|
|
2866
|
+
const thumbAnim = React14__default.default.useRef(new reactNative.Animated.Value(0)).current;
|
|
2867
|
+
const onValueChangeRef = React14__default.default.useRef(onValueChange);
|
|
2868
|
+
const disabledRef = React14__default.default.useRef(disabled);
|
|
2869
|
+
const colorsLengthRef = React14__default.default.useRef(colors.length);
|
|
2870
|
+
const trimEndsRef = React14__default.default.useRef(trimEnds);
|
|
2871
|
+
const snapRef = React14__default.default.useRef(snap);
|
|
2872
|
+
React14__default.default.useEffect(() => {
|
|
2622
2873
|
onValueChangeRef.current = onValueChange;
|
|
2623
2874
|
}, [onValueChange]);
|
|
2624
|
-
|
|
2875
|
+
React14__default.default.useEffect(() => {
|
|
2625
2876
|
disabledRef.current = disabled;
|
|
2626
2877
|
}, [disabled]);
|
|
2627
|
-
|
|
2878
|
+
React14__default.default.useEffect(() => {
|
|
2628
2879
|
colorsLengthRef.current = colors.length;
|
|
2629
2880
|
}, [colors.length]);
|
|
2630
|
-
|
|
2881
|
+
React14__default.default.useEffect(() => {
|
|
2631
2882
|
trimEndsRef.current = trimEnds;
|
|
2632
2883
|
}, [trimEnds]);
|
|
2633
|
-
|
|
2884
|
+
React14__default.default.useEffect(() => {
|
|
2634
2885
|
snapRef.current = snap;
|
|
2635
2886
|
}, [snap]);
|
|
2636
|
-
const computeNv =
|
|
2887
|
+
const computeNv = React14__default.default.useCallback((pageX) => {
|
|
2637
2888
|
const localX = pageX - trackPageX.current;
|
|
2638
2889
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2639
2890
|
const totalSteps2 = colorsLengthRef.current - 1;
|
|
@@ -2648,7 +2899,7 @@ function ColorScaleSlider({
|
|
|
2648
2899
|
}
|
|
2649
2900
|
return nv;
|
|
2650
2901
|
}, []);
|
|
2651
|
-
const panResponder =
|
|
2902
|
+
const panResponder = React14__default.default.useRef(
|
|
2652
2903
|
reactNative.PanResponder.create({
|
|
2653
2904
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2654
2905
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2676,7 +2927,7 @@ function ColorScaleSlider({
|
|
|
2676
2927
|
const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
|
|
2677
2928
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE4);
|
|
2678
2929
|
const thumbLeft = ratio * usableWidth;
|
|
2679
|
-
|
|
2930
|
+
React14__default.default.useEffect(() => {
|
|
2680
2931
|
if (isDragging.current || !animateValue) {
|
|
2681
2932
|
thumbAnim.setValue(thumbLeft);
|
|
2682
2933
|
} else {
|
|
@@ -2687,7 +2938,7 @@ function ColorScaleSlider({
|
|
|
2687
2938
|
}).start();
|
|
2688
2939
|
}
|
|
2689
2940
|
}, [thumbLeft, animateValue, thumbAnim]);
|
|
2690
|
-
return /* @__PURE__ */
|
|
2941
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.labelRow }, /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.label }, label)), /* @__PURE__ */ React14__default.default.createElement(
|
|
2691
2942
|
reactNative.View,
|
|
2692
2943
|
{
|
|
2693
2944
|
ref: trackRef,
|
|
@@ -2702,9 +2953,9 @@ function ColorScaleSlider({
|
|
|
2702
2953
|
},
|
|
2703
2954
|
...panResponder.panHandlers
|
|
2704
2955
|
},
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
), warning && /* @__PURE__ */
|
|
2956
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { key: i, style: [styles.segment, { backgroundColor: newtone.srgbToHex(color.srgb) }] }))),
|
|
2957
|
+
/* @__PURE__ */ React14__default.default.createElement(reactNative.Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
|
|
2958
|
+
), warning && /* @__PURE__ */ React14__default.default.createElement(reactNative.Text, { style: styles.warning }, warning));
|
|
2708
2959
|
}
|
|
2709
2960
|
function getAppShellStyles(tokens) {
|
|
2710
2961
|
return reactNative.StyleSheet.create({
|
|
@@ -2726,8 +2977,8 @@ function getAppShellStyles(tokens) {
|
|
|
2726
2977
|
// src/composites/layout/AppShell/AppShell.tsx
|
|
2727
2978
|
function AppShell({ sidebar, children }) {
|
|
2728
2979
|
const tokens = useTokens();
|
|
2729
|
-
const styles =
|
|
2730
|
-
return /* @__PURE__ */
|
|
2980
|
+
const styles = React14__default.default.useMemo(() => getAppShellStyles(tokens), [tokens]);
|
|
2981
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.container }, sidebar, /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.main }, children));
|
|
2731
2982
|
}
|
|
2732
2983
|
function getSidebarStyles({ tokens, width, bordered }) {
|
|
2733
2984
|
const borderColor = newtone.srgbToHex(tokens.border.srgb);
|
|
@@ -2765,11 +3016,11 @@ function Sidebar({
|
|
|
2765
3016
|
bordered = true
|
|
2766
3017
|
}) {
|
|
2767
3018
|
const tokens = useTokens();
|
|
2768
|
-
const styles =
|
|
3019
|
+
const styles = React14__default.default.useMemo(
|
|
2769
3020
|
() => getSidebarStyles({ tokens, width, bordered }),
|
|
2770
3021
|
[tokens, width, bordered]
|
|
2771
3022
|
);
|
|
2772
|
-
return /* @__PURE__ */
|
|
3023
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.container }, header && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.header }, header), /* @__PURE__ */ React14__default.default.createElement(reactNative.ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.footer }, footer));
|
|
2773
3024
|
}
|
|
2774
3025
|
function getNavbarStyles({ tokens, height, bordered }) {
|
|
2775
3026
|
const borderColor = newtone.srgbToHex(tokens.border.srgb);
|
|
@@ -2807,28 +3058,27 @@ function Navbar({
|
|
|
2807
3058
|
bordered = true
|
|
2808
3059
|
}) {
|
|
2809
3060
|
const tokens = useTokens();
|
|
2810
|
-
const styles =
|
|
3061
|
+
const styles = React14__default.default.useMemo(
|
|
2811
3062
|
() => getNavbarStyles({ tokens, height, bordered }),
|
|
2812
3063
|
[tokens, height, bordered]
|
|
2813
3064
|
);
|
|
2814
|
-
return /* @__PURE__ */
|
|
3065
|
+
return /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.container }, children ? children : /* @__PURE__ */ React14__default.default.createElement(React14__default.default.Fragment, null, /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.left }, left), /* @__PURE__ */ React14__default.default.createElement(reactNative.View, { style: styles.right }, right)));
|
|
2815
3066
|
}
|
|
2816
3067
|
|
|
2817
3068
|
// src/registry/registry.ts
|
|
2818
3069
|
var CATEGORIES = [
|
|
2819
|
-
{ id: "
|
|
2820
|
-
{ id: "
|
|
2821
|
-
{ id: "
|
|
2822
|
-
{ id: "
|
|
2823
|
-
{ id: "
|
|
2824
|
-
{ id: "overlays", name: "Overlays", description: "Floating and portal-based UI elements" }
|
|
3070
|
+
{ id: "colors", name: "Colors", description: "Color palettes and token visualization", icon: "palette" },
|
|
3071
|
+
{ id: "typography", name: "Typography", description: "Text roles, scopes, and weight control", icon: "text_fields" },
|
|
3072
|
+
{ id: "symbols", name: "Symbols", description: "Material Symbols icon browser", icon: "grid_view" },
|
|
3073
|
+
{ id: "layout", name: "Layout", description: "Structural containers \u2014 Frame and Wrapper", icon: "grid_on" },
|
|
3074
|
+
{ id: "components", name: "Components", description: "Interactive UI components", icon: "widgets" }
|
|
2825
3075
|
];
|
|
2826
3076
|
var COMPONENTS = [
|
|
2827
3077
|
{
|
|
2828
3078
|
id: "button",
|
|
2829
3079
|
name: "Button",
|
|
2830
3080
|
importName: "Button",
|
|
2831
|
-
categoryId: "
|
|
3081
|
+
categoryId: "components",
|
|
2832
3082
|
description: "Interactive button with multiple variants, sizes, and optional icon",
|
|
2833
3083
|
hasChildren: true,
|
|
2834
3084
|
variants: [
|
|
@@ -2910,7 +3160,7 @@ var COMPONENTS = [
|
|
|
2910
3160
|
id: "text-input",
|
|
2911
3161
|
name: "TextInput",
|
|
2912
3162
|
importName: "TextInput",
|
|
2913
|
-
categoryId: "
|
|
3163
|
+
categoryId: "components",
|
|
2914
3164
|
description: "Text input field with label support",
|
|
2915
3165
|
hasChildren: false,
|
|
2916
3166
|
variants: [
|
|
@@ -2937,7 +3187,7 @@ var COMPONENTS = [
|
|
|
2937
3187
|
id: "select",
|
|
2938
3188
|
name: "Select",
|
|
2939
3189
|
importName: "Select",
|
|
2940
|
-
categoryId: "
|
|
3190
|
+
categoryId: "components",
|
|
2941
3191
|
description: "Dropdown selector with options",
|
|
2942
3192
|
hasChildren: false,
|
|
2943
3193
|
variants: [
|
|
@@ -2984,7 +3234,7 @@ var COMPONENTS = [
|
|
|
2984
3234
|
id: "toggle",
|
|
2985
3235
|
name: "Toggle",
|
|
2986
3236
|
importName: "Toggle",
|
|
2987
|
-
categoryId: "
|
|
3237
|
+
categoryId: "components",
|
|
2988
3238
|
description: "Binary switch component",
|
|
2989
3239
|
hasChildren: false,
|
|
2990
3240
|
variants: [
|
|
@@ -3011,7 +3261,7 @@ var COMPONENTS = [
|
|
|
3011
3261
|
id: "slider",
|
|
3012
3262
|
name: "Slider",
|
|
3013
3263
|
importName: "Slider",
|
|
3014
|
-
categoryId: "
|
|
3264
|
+
categoryId: "components",
|
|
3015
3265
|
description: "Numeric range slider",
|
|
3016
3266
|
hasChildren: false,
|
|
3017
3267
|
variants: [
|
|
@@ -3055,7 +3305,7 @@ var COMPONENTS = [
|
|
|
3055
3305
|
id: "hue-slider",
|
|
3056
3306
|
name: "HueSlider",
|
|
3057
3307
|
importName: "HueSlider",
|
|
3058
|
-
categoryId: "
|
|
3308
|
+
categoryId: "components",
|
|
3059
3309
|
description: "Specialized slider for hue selection (0-360\xB0)",
|
|
3060
3310
|
hasChildren: false,
|
|
3061
3311
|
variants: [
|
|
@@ -3191,7 +3441,7 @@ var COMPONENTS = [
|
|
|
3191
3441
|
id: "card",
|
|
3192
3442
|
name: "Card",
|
|
3193
3443
|
importName: "Card",
|
|
3194
|
-
categoryId: "
|
|
3444
|
+
categoryId: "components",
|
|
3195
3445
|
description: "Surface container with elevation levels",
|
|
3196
3446
|
hasChildren: true,
|
|
3197
3447
|
variants: [
|
|
@@ -3224,45 +3474,59 @@ var COMPONENTS = [
|
|
|
3224
3474
|
id: "text",
|
|
3225
3475
|
name: "Text",
|
|
3226
3476
|
importName: "Text",
|
|
3227
|
-
categoryId: "
|
|
3228
|
-
description: "Typography primitive with semantic
|
|
3477
|
+
categoryId: "typography",
|
|
3478
|
+
description: "Typography primitive with semantic scope (font family) and role (purpose)",
|
|
3229
3479
|
hasChildren: true,
|
|
3480
|
+
previewLayout: "list",
|
|
3230
3481
|
variants: [
|
|
3231
|
-
{ id: "
|
|
3232
|
-
{ id: "
|
|
3233
|
-
{ id: "
|
|
3234
|
-
{ id: "
|
|
3235
|
-
{ id: "
|
|
3236
|
-
{ id: "
|
|
3237
|
-
{ id: "
|
|
3482
|
+
{ id: "body", label: "Body", props: { role: "body" } },
|
|
3483
|
+
{ id: "headline", label: "Headline", props: { role: "headline", scope: "display" } },
|
|
3484
|
+
{ id: "title", label: "Title", props: { role: "title", scope: "display" } },
|
|
3485
|
+
{ id: "heading", label: "Heading", props: { role: "heading" } },
|
|
3486
|
+
{ id: "subheading", label: "Subheading", props: { role: "subheading" } },
|
|
3487
|
+
{ id: "label", label: "Label", props: { role: "label" } },
|
|
3488
|
+
{ id: "caption", label: "Caption", props: { role: "caption", color: "secondary" } },
|
|
3489
|
+
{ id: "mono", label: "Monospace", props: { scope: "mono", role: "body" } },
|
|
3490
|
+
{ id: "currency", label: "Currency", props: { scope: "currency", role: "body" } }
|
|
3238
3491
|
],
|
|
3239
3492
|
editableProps: [
|
|
3240
3493
|
{
|
|
3241
|
-
name: "
|
|
3242
|
-
label: "
|
|
3494
|
+
name: "scope",
|
|
3495
|
+
label: "Scope",
|
|
3243
3496
|
control: "select",
|
|
3244
3497
|
options: [
|
|
3245
|
-
{ label: "
|
|
3246
|
-
{ label: "
|
|
3247
|
-
{ label: "
|
|
3248
|
-
{ label: "
|
|
3249
|
-
{ label: "Large", value: "lg" },
|
|
3250
|
-
{ label: "Extra Large", value: "xl" },
|
|
3251
|
-
{ label: "XXL", value: "xxl" }
|
|
3498
|
+
{ label: "Main", value: "main" },
|
|
3499
|
+
{ label: "Display", value: "display" },
|
|
3500
|
+
{ label: "Mono", value: "mono" },
|
|
3501
|
+
{ label: "Currency", value: "currency" }
|
|
3252
3502
|
],
|
|
3253
|
-
defaultValue: "
|
|
3503
|
+
defaultValue: "main"
|
|
3254
3504
|
},
|
|
3255
3505
|
{
|
|
3256
|
-
name: "
|
|
3257
|
-
label: "
|
|
3506
|
+
name: "role",
|
|
3507
|
+
label: "Role",
|
|
3508
|
+
control: "select",
|
|
3509
|
+
options: [
|
|
3510
|
+
{ label: "Headline", value: "headline" },
|
|
3511
|
+
{ label: "Title", value: "title" },
|
|
3512
|
+
{ label: "Heading", value: "heading" },
|
|
3513
|
+
{ label: "Subheading", value: "subheading" },
|
|
3514
|
+
{ label: "Body", value: "body" },
|
|
3515
|
+
{ label: "Label", value: "label" },
|
|
3516
|
+
{ label: "Caption", value: "caption" }
|
|
3517
|
+
],
|
|
3518
|
+
defaultValue: "body"
|
|
3519
|
+
},
|
|
3520
|
+
{
|
|
3521
|
+
name: "size",
|
|
3522
|
+
label: "Size",
|
|
3258
3523
|
control: "select",
|
|
3259
3524
|
options: [
|
|
3260
|
-
{ label: "
|
|
3261
|
-
{ label: "Medium", value: "
|
|
3262
|
-
{ label: "
|
|
3263
|
-
{ label: "Bold", value: "bold" }
|
|
3525
|
+
{ label: "Small", value: "sm" },
|
|
3526
|
+
{ label: "Medium", value: "md" },
|
|
3527
|
+
{ label: "Large", value: "lg" }
|
|
3264
3528
|
],
|
|
3265
|
-
defaultValue: "
|
|
3529
|
+
defaultValue: "md"
|
|
3266
3530
|
},
|
|
3267
3531
|
{
|
|
3268
3532
|
name: "color",
|
|
@@ -3279,17 +3543,6 @@ var COMPONENTS = [
|
|
|
3279
3543
|
{ label: "Error", value: "error" }
|
|
3280
3544
|
],
|
|
3281
3545
|
defaultValue: "primary"
|
|
3282
|
-
},
|
|
3283
|
-
{
|
|
3284
|
-
name: "font",
|
|
3285
|
-
label: "Font",
|
|
3286
|
-
control: "select",
|
|
3287
|
-
options: [
|
|
3288
|
-
{ label: "Default", value: "default" },
|
|
3289
|
-
{ label: "Display", value: "display" },
|
|
3290
|
-
{ label: "Mono", value: "mono" }
|
|
3291
|
-
],
|
|
3292
|
-
defaultValue: "default"
|
|
3293
3546
|
}
|
|
3294
3547
|
]
|
|
3295
3548
|
},
|
|
@@ -3297,41 +3550,36 @@ var COMPONENTS = [
|
|
|
3297
3550
|
id: "icon",
|
|
3298
3551
|
name: "Icon",
|
|
3299
3552
|
importName: "Icon",
|
|
3300
|
-
categoryId: "
|
|
3301
|
-
description: "Material Symbols icon with size
|
|
3553
|
+
categoryId: "symbols",
|
|
3554
|
+
description: "Material Symbols icon with size and fill",
|
|
3302
3555
|
hasChildren: false,
|
|
3303
3556
|
variants: [
|
|
3304
|
-
{ id: "
|
|
3305
|
-
{ id: "settings", label: "Settings", props: { name: "settings" } },
|
|
3306
|
-
{ id: "check", label: "Check", props: { name: "check" } },
|
|
3307
|
-
{ id: "add", label: "Add", props: { name: "add" } },
|
|
3308
|
-
{ id: "delete", label: "Delete", props: { name: "delete" } },
|
|
3309
|
-
{ id: "search", label: "Search", props: { name: "search" } },
|
|
3310
|
-
{ id: "filled", label: "Filled Icon", props: { name: "favorite", fill: 1 } },
|
|
3311
|
-
{ id: "large", label: "Large Icon", props: { name: "star", size: 32 } }
|
|
3557
|
+
{ id: "default", label: "Default", props: { name: "add" } }
|
|
3312
3558
|
],
|
|
3313
3559
|
editableProps: [
|
|
3314
3560
|
{
|
|
3315
3561
|
name: "name",
|
|
3316
3562
|
label: "Icon Name",
|
|
3317
3563
|
control: "text",
|
|
3318
|
-
defaultValue: "
|
|
3564
|
+
defaultValue: "add"
|
|
3319
3565
|
},
|
|
3320
3566
|
{
|
|
3321
3567
|
name: "size",
|
|
3322
3568
|
label: "Size",
|
|
3323
|
-
control: "
|
|
3569
|
+
control: "discrete-slider",
|
|
3570
|
+
options: [
|
|
3571
|
+
{ label: "20", value: 20 },
|
|
3572
|
+
{ label: "24", value: 24 },
|
|
3573
|
+
{ label: "40", value: 40 },
|
|
3574
|
+
{ label: "48", value: 48 }
|
|
3575
|
+
],
|
|
3324
3576
|
defaultValue: 24
|
|
3325
3577
|
},
|
|
3326
3578
|
{
|
|
3327
3579
|
name: "fill",
|
|
3328
3580
|
label: "Fill",
|
|
3329
|
-
control: "
|
|
3330
|
-
|
|
3331
|
-
{ label: "Outlined", value: 0 },
|
|
3332
|
-
{ label: "Filled", value: 1 }
|
|
3333
|
-
],
|
|
3334
|
-
defaultValue: 0
|
|
3581
|
+
control: "toggle",
|
|
3582
|
+
defaultValue: false
|
|
3335
3583
|
}
|
|
3336
3584
|
]
|
|
3337
3585
|
},
|
|
@@ -3339,7 +3587,7 @@ var COMPONENTS = [
|
|
|
3339
3587
|
id: "wrapper",
|
|
3340
3588
|
name: "Wrapper",
|
|
3341
3589
|
importName: "Wrapper",
|
|
3342
|
-
categoryId: "
|
|
3590
|
+
categoryId: "layout",
|
|
3343
3591
|
description: "Lightweight layout container with direction, spacing, and alignment (no theming)",
|
|
3344
3592
|
hasChildren: true,
|
|
3345
3593
|
variants: [
|
|
@@ -3413,7 +3661,7 @@ var COMPONENTS = [
|
|
|
3413
3661
|
id: "color-scale-slider",
|
|
3414
3662
|
name: "ColorScaleSlider",
|
|
3415
3663
|
importName: "ColorScaleSlider",
|
|
3416
|
-
categoryId: "
|
|
3664
|
+
categoryId: "components",
|
|
3417
3665
|
description: "Interactive palette preview slider with color segments",
|
|
3418
3666
|
hasChildren: false,
|
|
3419
3667
|
variants: [
|
|
@@ -3456,6 +3704,7 @@ var HANDLER_PROPS = {
|
|
|
3456
3704
|
};
|
|
3457
3705
|
var CHILDREN_CONTENT = {
|
|
3458
3706
|
button: "Button",
|
|
3707
|
+
text: "The quick brown fox",
|
|
3459
3708
|
card: "{/* content */}",
|
|
3460
3709
|
frame: "{/* content */}"
|
|
3461
3710
|
};
|
|
@@ -3535,72 +3784,248 @@ function formatProp(name, value) {
|
|
|
3535
3784
|
return `${name}={${JSON.stringify(value)}}`;
|
|
3536
3785
|
}
|
|
3537
3786
|
|
|
3538
|
-
// src/
|
|
3539
|
-
var
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
{
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3787
|
+
// src/registry/icons.ts
|
|
3788
|
+
var ICON_CATALOG = [
|
|
3789
|
+
{
|
|
3790
|
+
id: "navigation",
|
|
3791
|
+
label: "Navigation",
|
|
3792
|
+
icons: [
|
|
3793
|
+
"home",
|
|
3794
|
+
"menu",
|
|
3795
|
+
"close",
|
|
3796
|
+
"arrow_back",
|
|
3797
|
+
"arrow_forward",
|
|
3798
|
+
"arrow_upward",
|
|
3799
|
+
"arrow_downward",
|
|
3800
|
+
"chevron_left",
|
|
3801
|
+
"chevron_right",
|
|
3802
|
+
"expand_more",
|
|
3803
|
+
"expand_less",
|
|
3804
|
+
"first_page",
|
|
3805
|
+
"last_page",
|
|
3806
|
+
"more_vert",
|
|
3807
|
+
"more_horiz",
|
|
3808
|
+
"unfold_more",
|
|
3809
|
+
"unfold_less",
|
|
3810
|
+
"subdirectory_arrow_right"
|
|
3811
|
+
]
|
|
3812
|
+
},
|
|
3813
|
+
{
|
|
3814
|
+
id: "actions",
|
|
3815
|
+
label: "Actions",
|
|
3816
|
+
icons: [
|
|
3817
|
+
"search",
|
|
3818
|
+
"settings",
|
|
3819
|
+
"done",
|
|
3820
|
+
"add",
|
|
3821
|
+
"remove",
|
|
3822
|
+
"delete",
|
|
3823
|
+
"edit",
|
|
3824
|
+
"save",
|
|
3825
|
+
"refresh",
|
|
3826
|
+
"undo",
|
|
3827
|
+
"redo",
|
|
3828
|
+
"download",
|
|
3829
|
+
"upload",
|
|
3830
|
+
"share",
|
|
3831
|
+
"print",
|
|
3832
|
+
"content_copy",
|
|
3833
|
+
"content_paste",
|
|
3834
|
+
"open_in_new",
|
|
3835
|
+
"launch",
|
|
3836
|
+
"drag_indicator",
|
|
3837
|
+
"tune",
|
|
3838
|
+
"sort",
|
|
3839
|
+
"filter_list"
|
|
3840
|
+
]
|
|
3841
|
+
},
|
|
3587
3842
|
{
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3843
|
+
id: "communication",
|
|
3844
|
+
label: "Communication",
|
|
3845
|
+
icons: [
|
|
3846
|
+
"mail",
|
|
3847
|
+
"chat",
|
|
3848
|
+
"call",
|
|
3849
|
+
"notifications",
|
|
3850
|
+
"forum",
|
|
3851
|
+
"send",
|
|
3852
|
+
"inbox",
|
|
3853
|
+
"drafts",
|
|
3854
|
+
"mark_email_read",
|
|
3855
|
+
"contact_mail",
|
|
3856
|
+
"alternate_email",
|
|
3857
|
+
"comment",
|
|
3858
|
+
"chat_bubble",
|
|
3859
|
+
"sms",
|
|
3860
|
+
"voicemail"
|
|
3861
|
+
]
|
|
3862
|
+
},
|
|
3863
|
+
{
|
|
3864
|
+
id: "content",
|
|
3865
|
+
label: "Content",
|
|
3866
|
+
icons: [
|
|
3867
|
+
"add_circle",
|
|
3868
|
+
"remove_circle",
|
|
3869
|
+
"check_circle",
|
|
3870
|
+
"cancel",
|
|
3871
|
+
"flag",
|
|
3872
|
+
"bookmark",
|
|
3873
|
+
"star",
|
|
3874
|
+
"favorite",
|
|
3875
|
+
"thumb_up",
|
|
3876
|
+
"thumb_down",
|
|
3877
|
+
"push_pin",
|
|
3878
|
+
"link",
|
|
3879
|
+
"link_off",
|
|
3880
|
+
"bolt",
|
|
3881
|
+
"label",
|
|
3882
|
+
"inventory_2",
|
|
3883
|
+
"visibility",
|
|
3884
|
+
"visibility_off"
|
|
3885
|
+
]
|
|
3886
|
+
},
|
|
3887
|
+
{
|
|
3888
|
+
id: "media",
|
|
3889
|
+
label: "Media",
|
|
3890
|
+
icons: [
|
|
3891
|
+
"play_arrow",
|
|
3892
|
+
"pause",
|
|
3893
|
+
"stop",
|
|
3894
|
+
"skip_next",
|
|
3895
|
+
"skip_previous",
|
|
3896
|
+
"fast_forward",
|
|
3897
|
+
"fast_rewind",
|
|
3898
|
+
"replay",
|
|
3899
|
+
"shuffle",
|
|
3900
|
+
"repeat",
|
|
3901
|
+
"volume_up",
|
|
3902
|
+
"volume_off",
|
|
3903
|
+
"music_note",
|
|
3904
|
+
"image",
|
|
3905
|
+
"photo_camera",
|
|
3906
|
+
"videocam",
|
|
3907
|
+
"mic"
|
|
3908
|
+
]
|
|
3909
|
+
},
|
|
3910
|
+
{
|
|
3911
|
+
id: "file",
|
|
3912
|
+
label: "File & Folder",
|
|
3913
|
+
icons: [
|
|
3914
|
+
"folder",
|
|
3915
|
+
"folder_open",
|
|
3916
|
+
"create_new_folder",
|
|
3917
|
+
"description",
|
|
3918
|
+
"file_copy",
|
|
3919
|
+
"attach_file",
|
|
3920
|
+
"cloud",
|
|
3921
|
+
"cloud_upload",
|
|
3922
|
+
"cloud_download",
|
|
3923
|
+
"cloud_off",
|
|
3924
|
+
"storage",
|
|
3925
|
+
"snippet_folder"
|
|
3926
|
+
]
|
|
3591
3927
|
},
|
|
3592
3928
|
{
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3929
|
+
id: "social",
|
|
3930
|
+
label: "Social & People",
|
|
3931
|
+
icons: [
|
|
3932
|
+
"person",
|
|
3933
|
+
"group",
|
|
3934
|
+
"person_add",
|
|
3935
|
+
"person_remove",
|
|
3936
|
+
"people",
|
|
3937
|
+
"face",
|
|
3938
|
+
"sentiment_satisfied",
|
|
3939
|
+
"sentiment_dissatisfied",
|
|
3940
|
+
"public",
|
|
3941
|
+
"workspace_premium",
|
|
3942
|
+
"emoji_events",
|
|
3943
|
+
"military_tech"
|
|
3944
|
+
]
|
|
3945
|
+
},
|
|
3946
|
+
{
|
|
3947
|
+
id: "alerts",
|
|
3948
|
+
label: "Alerts & Status",
|
|
3949
|
+
icons: [
|
|
3950
|
+
"error",
|
|
3951
|
+
"warning",
|
|
3952
|
+
"info",
|
|
3953
|
+
"help",
|
|
3954
|
+
"check_circle",
|
|
3955
|
+
"report",
|
|
3956
|
+
"new_releases",
|
|
3957
|
+
"notification_important",
|
|
3958
|
+
"priority_high",
|
|
3959
|
+
"verified",
|
|
3960
|
+
"shield",
|
|
3961
|
+
"security",
|
|
3962
|
+
"lock",
|
|
3963
|
+
"lock_open"
|
|
3964
|
+
]
|
|
3596
3965
|
},
|
|
3597
3966
|
{
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3967
|
+
id: "device",
|
|
3968
|
+
label: "Device & Hardware",
|
|
3969
|
+
icons: [
|
|
3970
|
+
"phone_android",
|
|
3971
|
+
"computer",
|
|
3972
|
+
"tablet_mac",
|
|
3973
|
+
"watch",
|
|
3974
|
+
"keyboard",
|
|
3975
|
+
"mouse",
|
|
3976
|
+
"headphones",
|
|
3977
|
+
"speaker",
|
|
3978
|
+
"monitor",
|
|
3979
|
+
"devices",
|
|
3980
|
+
"memory",
|
|
3981
|
+
"battery_full",
|
|
3982
|
+
"wifi",
|
|
3983
|
+
"bluetooth",
|
|
3984
|
+
"usb",
|
|
3985
|
+
"dark_mode",
|
|
3986
|
+
"light_mode"
|
|
3987
|
+
]
|
|
3988
|
+
},
|
|
3989
|
+
{
|
|
3990
|
+
id: "editor",
|
|
3991
|
+
label: "Editor & Formatting",
|
|
3992
|
+
icons: [
|
|
3993
|
+
"format_bold",
|
|
3994
|
+
"format_italic",
|
|
3995
|
+
"format_underlined",
|
|
3996
|
+
"format_list_bulleted",
|
|
3997
|
+
"format_list_numbered",
|
|
3998
|
+
"format_quote",
|
|
3999
|
+
"format_align_left",
|
|
4000
|
+
"format_align_center",
|
|
4001
|
+
"format_align_right",
|
|
4002
|
+
"title",
|
|
4003
|
+
"text_fields",
|
|
4004
|
+
"code",
|
|
4005
|
+
"palette",
|
|
4006
|
+
"color_lens",
|
|
4007
|
+
"brush",
|
|
4008
|
+
"auto_fix_high"
|
|
4009
|
+
]
|
|
3601
4010
|
}
|
|
3602
4011
|
];
|
|
3603
4012
|
|
|
4013
|
+
Object.defineProperty(exports, "DEFAULT_FONT_SIZES", {
|
|
4014
|
+
enumerable: true,
|
|
4015
|
+
get: function () { return fonts.DEFAULT_FONT_SIZES; }
|
|
4016
|
+
});
|
|
4017
|
+
Object.defineProperty(exports, "DEFAULT_LINE_HEIGHTS", {
|
|
4018
|
+
enumerable: true,
|
|
4019
|
+
get: function () { return fonts.DEFAULT_LINE_HEIGHTS; }
|
|
4020
|
+
});
|
|
4021
|
+
Object.defineProperty(exports, "DEFAULT_ROLE_SCALES", {
|
|
4022
|
+
enumerable: true,
|
|
4023
|
+
get: function () { return fonts.DEFAULT_ROLE_SCALES; }
|
|
4024
|
+
});
|
|
4025
|
+
Object.defineProperty(exports, "buildGoogleFontsUrl", {
|
|
4026
|
+
enumerable: true,
|
|
4027
|
+
get: function () { return fonts.buildGoogleFontsUrl; }
|
|
4028
|
+
});
|
|
3604
4029
|
exports.ACCENT_DEFAULTS = ACCENT_DEFAULTS;
|
|
3605
4030
|
exports.AppShell = AppShell;
|
|
3606
4031
|
exports.Button = Button;
|
|
@@ -3611,15 +4036,14 @@ exports.ColorScaleSlider = ColorScaleSlider;
|
|
|
3611
4036
|
exports.DEFAULT_THEME_CONFIG = DEFAULT_THEME_CONFIG;
|
|
3612
4037
|
exports.ERROR_DEFAULTS = ERROR_DEFAULTS;
|
|
3613
4038
|
exports.Frame = Frame;
|
|
3614
|
-
exports.GOOGLE_FONTS = GOOGLE_FONTS;
|
|
3615
4039
|
exports.HueSlider = HueSlider;
|
|
4040
|
+
exports.ICON_CATALOG = ICON_CATALOG;
|
|
3616
4041
|
exports.Icon = Icon;
|
|
3617
4042
|
exports.NEUTRAL_DEFAULTS = NEUTRAL_DEFAULTS;
|
|
3618
4043
|
exports.Navbar = Navbar;
|
|
3619
4044
|
exports.NewtoneProvider = NewtoneProvider;
|
|
3620
4045
|
exports.Popover = Popover;
|
|
3621
4046
|
exports.SUCCESS_DEFAULTS = SUCCESS_DEFAULTS;
|
|
3622
|
-
exports.SYSTEM_FONTS = SYSTEM_FONTS;
|
|
3623
4047
|
exports.Select = Select;
|
|
3624
4048
|
exports.Sidebar = Sidebar;
|
|
3625
4049
|
exports.Slider = Slider;
|
|
@@ -3628,17 +4052,19 @@ exports.TextInput = TextInput;
|
|
|
3628
4052
|
exports.Toggle = Toggle;
|
|
3629
4053
|
exports.WARNING_DEFAULTS = WARNING_DEFAULTS;
|
|
3630
4054
|
exports.Wrapper = Wrapper;
|
|
3631
|
-
exports.buildGoogleFontsUrl = buildGoogleFontsUrl;
|
|
3632
4055
|
exports.computeTokens = computeTokens;
|
|
3633
4056
|
exports.generateComponentCode = generateComponentCode;
|
|
3634
4057
|
exports.getCategory = getCategory;
|
|
3635
4058
|
exports.getComponent = getComponent;
|
|
3636
4059
|
exports.getComponentsByCategory = getComponentsByCategory;
|
|
3637
4060
|
exports.isOptionGroup = isOptionGroup;
|
|
4061
|
+
exports.measureAvgCharWidth = measureAvgCharWidth;
|
|
3638
4062
|
exports.useFocusVisible = useFocusVisible;
|
|
3639
4063
|
exports.useFrameContext = useFrameContext;
|
|
4064
|
+
exports.useLocalCalibration = useLocalCalibration;
|
|
3640
4065
|
exports.useNewtoneTheme = useNewtoneTheme;
|
|
3641
4066
|
exports.usePopover = usePopover;
|
|
3642
4067
|
exports.useTokens = useTokens;
|
|
4068
|
+
exports.useTypographyCalibrations = useTypographyCalibrations;
|
|
3643
4069
|
//# sourceMappingURL=index.cjs.map
|
|
3644
4070
|
//# sourceMappingURL=index.cjs.map
|