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