@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.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useTokens, useNewtoneTheme, useBreakpoint, useTypographyCalibrations, useLocalCalibration, enqueueObservation,
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
1
|
+
import { useTokens, useNewtoneTheme, useFrameContext, useBreakpoint, useTypographyCalibrations, useLocalCalibration, enqueueObservation, computeTokens, _ThemeContext, FrameContext } from 'newtone-api';
|
|
2
|
+
export { DEFAULT_FONT_SIZES, DEFAULT_LINE_HEIGHTS, DEFAULT_ROLE_SCALES, DEFAULT_THEME_CONFIG, DEFAULT_THEME_MAPPINGS, ERROR_DEFAULTS, FrameContext, NON_PRIMARY_RELATIVE_DEFAULTS, NewtoneProvider, PRIMARY_DEFAULTS, SECONDARY_DEFAULTS, SUCCESS_DEFAULTS, TERTIARY_DEFAULTS, WARNING_DEFAULTS, buildGoogleFontsUrl, computeColors, computeSwatches, computeTokens, enqueueObservation, measureAvgCharWidth, resolveTheme, useBreakpoint, useFrameContext, useLocalCalibration, useNewtoneTheme, useScheme, useTokens, useTypographyCalibrations } from 'newtone-api';
|
|
3
|
+
import React16, { createContext, useState, useMemo, useEffect, useContext, useCallback, useRef } from 'react';
|
|
4
4
|
import { Text, View, Pressable, TextInput as TextInput$1, ScrollView, PanResponder, Animated, StyleSheet } from 'react-native';
|
|
5
5
|
import { SEMANTIC_WEIGHT_MAP, ROLE_DEFAULT_WEIGHTS, BREAKPOINT_ROLE_SCALE, scaleRoleStep, resolveResponsiveSize, estimateLineWidths, REFERENCE_LINE_HEIGHT_RATIO, buildFontFeatureSettings } from '@newtonedev/fonts';
|
|
6
6
|
import { srgbToHex, gamutMapToSrgb } from 'newtone';
|
|
@@ -155,8 +155,9 @@ function resolveFlexDirection(direction, reverse) {
|
|
|
155
155
|
function getFrameStyles(input) {
|
|
156
156
|
const {
|
|
157
157
|
tokens,
|
|
158
|
-
gamut,
|
|
159
158
|
frameElevation,
|
|
159
|
+
theme = "primary",
|
|
160
|
+
appearance = "main",
|
|
160
161
|
layout = "flex",
|
|
161
162
|
direction = "vertical",
|
|
162
163
|
wrap = false,
|
|
@@ -173,13 +174,22 @@ function getFrameStyles(input) {
|
|
|
173
174
|
maxWidth,
|
|
174
175
|
minHeight,
|
|
175
176
|
maxHeight,
|
|
177
|
+
position,
|
|
178
|
+
top,
|
|
179
|
+
right,
|
|
180
|
+
bottom,
|
|
181
|
+
left,
|
|
182
|
+
zIndex,
|
|
183
|
+
overflow,
|
|
184
|
+
opacity,
|
|
176
185
|
radius,
|
|
177
186
|
bordered = false,
|
|
178
187
|
disabled = false
|
|
179
188
|
} = input;
|
|
180
189
|
const container = {};
|
|
181
|
-
|
|
182
|
-
container.
|
|
190
|
+
const appearanceTokens = tokens.colors[theme][appearance];
|
|
191
|
+
container.backgroundColor = appearanceTokens.background;
|
|
192
|
+
container.color = appearanceTokens.fontPrimary;
|
|
183
193
|
if (layout === "flex") {
|
|
184
194
|
container.display = "flex";
|
|
185
195
|
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
@@ -210,6 +220,12 @@ function getFrameStyles(input) {
|
|
|
210
220
|
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
211
221
|
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
212
222
|
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
223
|
+
if (position) container.position = position;
|
|
224
|
+
if (top !== void 0) container.top = top;
|
|
225
|
+
if (right !== void 0) container.right = right;
|
|
226
|
+
if (bottom !== void 0) container.bottom = bottom;
|
|
227
|
+
if (left !== void 0) container.left = left;
|
|
228
|
+
if (zIndex !== void 0) container.zIndex = zIndex;
|
|
213
229
|
if (radius !== void 0) {
|
|
214
230
|
const corners = resolveRadiusCorners(radius, tokens);
|
|
215
231
|
container.borderTopLeftRadius = corners.topLeft;
|
|
@@ -220,9 +236,10 @@ function getFrameStyles(input) {
|
|
|
220
236
|
container.overflow = "hidden";
|
|
221
237
|
}
|
|
222
238
|
}
|
|
239
|
+
if (overflow) container.overflow = overflow;
|
|
223
240
|
if (bordered) {
|
|
224
241
|
container.borderWidth = 1;
|
|
225
|
-
container.borderColor =
|
|
242
|
+
container.borderColor = appearanceTokens.fontTertiary;
|
|
226
243
|
}
|
|
227
244
|
if (frameElevation === 2) {
|
|
228
245
|
container.shadowColor = "#000";
|
|
@@ -231,11 +248,13 @@ function getFrameStyles(input) {
|
|
|
231
248
|
container.shadowRadius = 6;
|
|
232
249
|
container.elevation = 4;
|
|
233
250
|
}
|
|
234
|
-
if (
|
|
251
|
+
if (opacity !== void 0) {
|
|
252
|
+
container.opacity = opacity;
|
|
253
|
+
} else if (disabled) {
|
|
235
254
|
container.opacity = 0.5;
|
|
236
255
|
}
|
|
237
256
|
const pressed = StyleSheet.create({
|
|
238
|
-
s: { backgroundColor:
|
|
257
|
+
s: { backgroundColor: appearanceTokens.fontSecondary }
|
|
239
258
|
}).s;
|
|
240
259
|
let gridWebStyle = null;
|
|
241
260
|
if (layout === "grid") {
|
|
@@ -259,13 +278,18 @@ function getFrameStyles(input) {
|
|
|
259
278
|
|
|
260
279
|
// src/primitives/Frame/Frame.tsx
|
|
261
280
|
function wrapTextChildren(children, textStyle) {
|
|
262
|
-
return
|
|
281
|
+
return React16.Children.map(children, (child) => {
|
|
263
282
|
if (typeof child === "string" || typeof child === "number") {
|
|
264
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ React16.createElement(Text, { style: textStyle }, child);
|
|
265
284
|
}
|
|
266
285
|
return child;
|
|
267
286
|
});
|
|
268
287
|
}
|
|
288
|
+
var ELEVATION_MAP = {
|
|
289
|
+
0: "sunken",
|
|
290
|
+
1: "grounded",
|
|
291
|
+
2: "elevated"
|
|
292
|
+
};
|
|
269
293
|
function toElevationLevel(frameElevation) {
|
|
270
294
|
if (frameElevation <= -1) return 0;
|
|
271
295
|
if (frameElevation === 0) return 1;
|
|
@@ -275,6 +299,11 @@ function Frame({
|
|
|
275
299
|
children,
|
|
276
300
|
// Elevation
|
|
277
301
|
elevation,
|
|
302
|
+
// Scheme
|
|
303
|
+
scheme,
|
|
304
|
+
// Theme / Appearance
|
|
305
|
+
theme,
|
|
306
|
+
appearance,
|
|
278
307
|
// Layout
|
|
279
308
|
layout,
|
|
280
309
|
direction,
|
|
@@ -295,6 +324,16 @@ function Frame({
|
|
|
295
324
|
maxWidth,
|
|
296
325
|
minHeight,
|
|
297
326
|
maxHeight,
|
|
327
|
+
// Positioning
|
|
328
|
+
position,
|
|
329
|
+
top,
|
|
330
|
+
right,
|
|
331
|
+
bottom,
|
|
332
|
+
left,
|
|
333
|
+
zIndex,
|
|
334
|
+
overflow,
|
|
335
|
+
pointerEvents,
|
|
336
|
+
opacity,
|
|
298
337
|
// Appearance
|
|
299
338
|
radius,
|
|
300
339
|
bordered,
|
|
@@ -312,27 +351,42 @@ function Frame({
|
|
|
312
351
|
// Style override
|
|
313
352
|
style
|
|
314
353
|
}) {
|
|
315
|
-
const
|
|
354
|
+
const themeCtx = useNewtoneTheme();
|
|
355
|
+
const { mode, gamut } = themeCtx;
|
|
316
356
|
const parentFrameCtx = useFrameContext();
|
|
357
|
+
const resolvedConfig = useMemo(() => {
|
|
358
|
+
if (scheme && themeCtx.schemes) {
|
|
359
|
+
const schemeConfig = themeCtx.schemes[scheme];
|
|
360
|
+
if (schemeConfig) return schemeConfig;
|
|
361
|
+
}
|
|
362
|
+
return themeCtx.config;
|
|
363
|
+
}, [scheme, themeCtx.schemes, themeCtx.config]);
|
|
364
|
+
const isSchemeOverride = resolvedConfig !== themeCtx.config;
|
|
365
|
+
const resolvedTheme = theme ?? parentFrameCtx?.theme ?? "primary";
|
|
366
|
+
const resolvedAppearance = appearance ?? parentFrameCtx?.appearance ?? "main";
|
|
317
367
|
const resolvedFrameElevation = elevation ?? 0;
|
|
318
368
|
const resolvedElevation = elevation !== void 0 ? toElevationLevel(elevation) : parentFrameCtx?.elevation ?? 1;
|
|
319
369
|
const tokens = useMemo(() => {
|
|
320
370
|
return computeTokens(
|
|
321
|
-
|
|
371
|
+
resolvedConfig.colorSystem,
|
|
322
372
|
mode,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
373
|
+
gamut,
|
|
374
|
+
ELEVATION_MAP[resolvedElevation],
|
|
375
|
+
resolvedConfig.spacing,
|
|
376
|
+
resolvedConfig.radius,
|
|
377
|
+
resolvedConfig.typography,
|
|
378
|
+
resolvedConfig.icons,
|
|
379
|
+
resolvedConfig.themeMappings,
|
|
380
|
+
resolvedConfig.swatchDefaults,
|
|
381
|
+
resolvedConfig.relativeSwatchDefaults
|
|
329
382
|
);
|
|
330
|
-
}, [
|
|
383
|
+
}, [resolvedConfig, mode, gamut, resolvedElevation]);
|
|
331
384
|
const styles = useMemo(
|
|
332
385
|
() => getFrameStyles({
|
|
333
386
|
tokens,
|
|
334
|
-
gamut,
|
|
335
387
|
frameElevation: resolvedFrameElevation,
|
|
388
|
+
theme: resolvedTheme,
|
|
389
|
+
appearance: resolvedAppearance,
|
|
336
390
|
layout,
|
|
337
391
|
direction,
|
|
338
392
|
wrap,
|
|
@@ -349,14 +403,23 @@ function Frame({
|
|
|
349
403
|
maxWidth,
|
|
350
404
|
minHeight,
|
|
351
405
|
maxHeight,
|
|
406
|
+
position,
|
|
407
|
+
top,
|
|
408
|
+
right,
|
|
409
|
+
bottom,
|
|
410
|
+
left,
|
|
411
|
+
zIndex,
|
|
412
|
+
overflow,
|
|
413
|
+
opacity,
|
|
352
414
|
radius,
|
|
353
415
|
bordered,
|
|
354
416
|
disabled
|
|
355
417
|
}),
|
|
356
418
|
[
|
|
357
419
|
tokens,
|
|
358
|
-
gamut,
|
|
359
420
|
resolvedFrameElevation,
|
|
421
|
+
resolvedTheme,
|
|
422
|
+
resolvedAppearance,
|
|
360
423
|
layout,
|
|
361
424
|
direction,
|
|
362
425
|
wrap,
|
|
@@ -373,15 +436,38 @@ function Frame({
|
|
|
373
436
|
maxWidth,
|
|
374
437
|
minHeight,
|
|
375
438
|
maxHeight,
|
|
439
|
+
position,
|
|
440
|
+
top,
|
|
441
|
+
right,
|
|
442
|
+
bottom,
|
|
443
|
+
left,
|
|
444
|
+
zIndex,
|
|
445
|
+
overflow,
|
|
446
|
+
opacity,
|
|
376
447
|
radius,
|
|
377
448
|
bordered,
|
|
378
449
|
disabled
|
|
379
450
|
]
|
|
380
451
|
);
|
|
452
|
+
const resolvedScheme = scheme ?? parentFrameCtx?.scheme;
|
|
381
453
|
const contextValue = useMemo(
|
|
382
|
-
() => ({
|
|
383
|
-
|
|
454
|
+
() => ({
|
|
455
|
+
elevation: resolvedElevation,
|
|
456
|
+
tokens,
|
|
457
|
+
scheme: resolvedScheme,
|
|
458
|
+
theme: resolvedTheme,
|
|
459
|
+
appearance: resolvedAppearance
|
|
460
|
+
}),
|
|
461
|
+
[resolvedElevation, tokens, resolvedScheme, resolvedTheme, resolvedAppearance]
|
|
384
462
|
);
|
|
463
|
+
const schemeThemeCtx = useMemo(() => {
|
|
464
|
+
if (!isSchemeOverride) return null;
|
|
465
|
+
return {
|
|
466
|
+
...themeCtx,
|
|
467
|
+
config: resolvedConfig,
|
|
468
|
+
activeScheme: scheme ?? themeCtx.activeScheme
|
|
469
|
+
};
|
|
470
|
+
}, [isSchemeOverride, themeCtx, resolvedConfig, scheme]);
|
|
385
471
|
const webOverrides = [];
|
|
386
472
|
if (styles.gridWebStyle) {
|
|
387
473
|
webOverrides.push(styles.gridWebStyle);
|
|
@@ -395,68 +481,65 @@ function Frame({
|
|
|
395
481
|
const focusRingStyle = isFocusVisible && !disabled ? {
|
|
396
482
|
outlineWidth: 2,
|
|
397
483
|
outlineStyle: "solid",
|
|
398
|
-
outlineColor: tokens.
|
|
484
|
+
outlineColor: tokens.colors[resolvedTheme].emphasis.background,
|
|
399
485
|
outlineOffset: 2
|
|
400
486
|
} : void 0;
|
|
401
487
|
const webFocusProps = isInteractive ? focusProps : {};
|
|
402
488
|
const textStyle = useMemo(
|
|
403
489
|
() => ({
|
|
404
|
-
color: tokens.
|
|
490
|
+
color: tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary,
|
|
405
491
|
fontSize: tokens.typography.fontSizes["05"],
|
|
406
492
|
fontFamily: tokens.typography.fonts.main.family,
|
|
407
493
|
lineHeight: tokens.typography.lineHeights["06"]
|
|
408
494
|
}),
|
|
409
|
-
[tokens]
|
|
495
|
+
[tokens, resolvedTheme, resolvedAppearance]
|
|
410
496
|
);
|
|
411
497
|
const wrappedChildren = useMemo(
|
|
412
498
|
() => wrapTextChildren(children, textStyle),
|
|
413
499
|
[children, textStyle]
|
|
414
500
|
);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
-
wrappedChildren
|
|
454
|
-
)
|
|
455
|
-
));
|
|
501
|
+
const content = isInteractive ? /* @__PURE__ */ React16.createElement(
|
|
502
|
+
Pressable,
|
|
503
|
+
{
|
|
504
|
+
ref,
|
|
505
|
+
testID,
|
|
506
|
+
nativeID,
|
|
507
|
+
pointerEvents,
|
|
508
|
+
accessibilityLabel,
|
|
509
|
+
accessibilityHint,
|
|
510
|
+
accessibilityState: disabled ? { disabled: true } : void 0,
|
|
511
|
+
onPress,
|
|
512
|
+
disabled,
|
|
513
|
+
...href ? { href, accessibilityRole: "link" } : { accessibilityRole: "button" },
|
|
514
|
+
...webFocusProps,
|
|
515
|
+
style: ({ pressed }) => [
|
|
516
|
+
styles.container,
|
|
517
|
+
pressed && !disabled && styles.pressed,
|
|
518
|
+
focusRingStyle,
|
|
519
|
+
...webOverrides,
|
|
520
|
+
...userStyles
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
wrappedChildren
|
|
524
|
+
) : /* @__PURE__ */ React16.createElement(
|
|
525
|
+
View,
|
|
526
|
+
{
|
|
527
|
+
ref,
|
|
528
|
+
testID,
|
|
529
|
+
nativeID,
|
|
530
|
+
pointerEvents,
|
|
531
|
+
accessibilityLabel,
|
|
532
|
+
accessibilityHint,
|
|
533
|
+
style: [styles.container, ...webOverrides, ...userStyles]
|
|
534
|
+
},
|
|
535
|
+
wrappedChildren
|
|
536
|
+
);
|
|
537
|
+
const wrappedContent = schemeThemeCtx ? /* @__PURE__ */ React16.createElement(_ThemeContext.Provider, { value: schemeThemeCtx }, content) : content;
|
|
538
|
+
return /* @__PURE__ */ React16.createElement(FrameContext.Provider, { value: contextValue }, wrappedContent);
|
|
456
539
|
}
|
|
457
540
|
function Icon({
|
|
458
|
-
name,
|
|
459
|
-
size,
|
|
541
|
+
name = "add",
|
|
542
|
+
size = 24,
|
|
460
543
|
opticalSize,
|
|
461
544
|
fill = 0,
|
|
462
545
|
color,
|
|
@@ -469,6 +552,9 @@ function Icon({
|
|
|
469
552
|
ref
|
|
470
553
|
}) {
|
|
471
554
|
const tokens = useTokens();
|
|
555
|
+
const frameCtx = useFrameContext();
|
|
556
|
+
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
557
|
+
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
472
558
|
const iconStyle = useMemo(() => {
|
|
473
559
|
const fontSize = size ?? tokens.typography.fontSizes["05"];
|
|
474
560
|
const getOpticalSize = (size2) => {
|
|
@@ -478,7 +564,7 @@ function Icon({
|
|
|
478
564
|
return 48;
|
|
479
565
|
};
|
|
480
566
|
const opsz = opticalSize ?? getOpticalSize(fontSize);
|
|
481
|
-
const iconColor = color ?? tokens.
|
|
567
|
+
const iconColor = color ?? tokens.colors[resolvedTheme][resolvedAppearance].fontPrimary;
|
|
482
568
|
const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
|
|
483
569
|
const fillValue = typeof fill === "boolean" ? fill ? 1 : 0 : fill;
|
|
484
570
|
const fontVariationSettings = `'FILL' ${fillValue}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
|
|
@@ -498,8 +584,8 @@ function Icon({
|
|
|
498
584
|
// web-only: controls the variable font axes listed above
|
|
499
585
|
...style
|
|
500
586
|
};
|
|
501
|
-
}, [tokens, size, opticalSize, fill, color, style]);
|
|
502
|
-
return /* @__PURE__ */
|
|
587
|
+
}, [tokens, size, opticalSize, fill, color, style, resolvedTheme, resolvedAppearance]);
|
|
588
|
+
return /* @__PURE__ */ React16.createElement(
|
|
503
589
|
Text,
|
|
504
590
|
{
|
|
505
591
|
ref,
|
|
@@ -527,7 +613,15 @@ function getWrapperStyles(input) {
|
|
|
527
613
|
minWidth,
|
|
528
614
|
maxWidth,
|
|
529
615
|
minHeight,
|
|
530
|
-
maxHeight
|
|
616
|
+
maxHeight,
|
|
617
|
+
position,
|
|
618
|
+
top,
|
|
619
|
+
right,
|
|
620
|
+
bottom,
|
|
621
|
+
left,
|
|
622
|
+
zIndex,
|
|
623
|
+
overflow,
|
|
624
|
+
opacity
|
|
531
625
|
} = input;
|
|
532
626
|
const container = {};
|
|
533
627
|
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
@@ -551,6 +645,14 @@ function getWrapperStyles(input) {
|
|
|
551
645
|
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
552
646
|
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
553
647
|
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
648
|
+
if (position) container.position = position;
|
|
649
|
+
if (top !== void 0) container.top = top;
|
|
650
|
+
if (right !== void 0) container.right = right;
|
|
651
|
+
if (bottom !== void 0) container.bottom = bottom;
|
|
652
|
+
if (left !== void 0) container.left = left;
|
|
653
|
+
if (zIndex !== void 0) container.zIndex = zIndex;
|
|
654
|
+
if (overflow) container.overflow = overflow;
|
|
655
|
+
if (opacity !== void 0) container.opacity = opacity;
|
|
554
656
|
return StyleSheet.create({ c: container }).c;
|
|
555
657
|
}
|
|
556
658
|
function Wrapper({
|
|
@@ -568,13 +670,23 @@ function Wrapper({
|
|
|
568
670
|
maxWidth,
|
|
569
671
|
minHeight,
|
|
570
672
|
maxHeight,
|
|
673
|
+
// Positioning
|
|
674
|
+
position,
|
|
675
|
+
top,
|
|
676
|
+
right,
|
|
677
|
+
bottom,
|
|
678
|
+
left,
|
|
679
|
+
zIndex,
|
|
680
|
+
overflow,
|
|
681
|
+
pointerEvents,
|
|
682
|
+
opacity,
|
|
571
683
|
style,
|
|
572
684
|
// Testing & platform
|
|
573
685
|
testID,
|
|
574
686
|
nativeID,
|
|
575
687
|
ref
|
|
576
688
|
}) {
|
|
577
|
-
const tokens = useTokens(
|
|
689
|
+
const tokens = useTokens();
|
|
578
690
|
const containerStyle = useMemo(
|
|
579
691
|
() => getWrapperStyles({
|
|
580
692
|
tokens,
|
|
@@ -590,7 +702,15 @@ function Wrapper({
|
|
|
590
702
|
minWidth,
|
|
591
703
|
maxWidth,
|
|
592
704
|
minHeight,
|
|
593
|
-
maxHeight
|
|
705
|
+
maxHeight,
|
|
706
|
+
position,
|
|
707
|
+
top,
|
|
708
|
+
right,
|
|
709
|
+
bottom,
|
|
710
|
+
left,
|
|
711
|
+
zIndex,
|
|
712
|
+
overflow,
|
|
713
|
+
opacity
|
|
594
714
|
}),
|
|
595
715
|
[
|
|
596
716
|
tokens,
|
|
@@ -606,16 +726,25 @@ function Wrapper({
|
|
|
606
726
|
minWidth,
|
|
607
727
|
maxWidth,
|
|
608
728
|
minHeight,
|
|
609
|
-
maxHeight
|
|
729
|
+
maxHeight,
|
|
730
|
+
position,
|
|
731
|
+
top,
|
|
732
|
+
right,
|
|
733
|
+
bottom,
|
|
734
|
+
left,
|
|
735
|
+
zIndex,
|
|
736
|
+
overflow,
|
|
737
|
+
opacity
|
|
610
738
|
]
|
|
611
739
|
);
|
|
612
740
|
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
613
|
-
return /* @__PURE__ */
|
|
741
|
+
return /* @__PURE__ */ React16.createElement(
|
|
614
742
|
View,
|
|
615
743
|
{
|
|
616
744
|
ref,
|
|
617
745
|
testID,
|
|
618
746
|
nativeID,
|
|
747
|
+
pointerEvents,
|
|
619
748
|
accessibilityRole: "none",
|
|
620
749
|
style: [containerStyle, ...userStyles]
|
|
621
750
|
},
|
|
@@ -623,25 +752,19 @@ function Wrapper({
|
|
|
623
752
|
);
|
|
624
753
|
}
|
|
625
754
|
var TextScopeContext = createContext(null);
|
|
626
|
-
|
|
627
|
-
|
|
755
|
+
var LARGE_TEXT_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
756
|
+
function resolveTextColor(color, tokens, theme = "primary", appearance = "main", role = "body") {
|
|
628
757
|
switch (color) {
|
|
629
758
|
case "primary":
|
|
630
|
-
return tokens.
|
|
759
|
+
return tokens.colors[theme][appearance].fontPrimary;
|
|
631
760
|
case "secondary":
|
|
632
|
-
return tokens.
|
|
761
|
+
return tokens.colors[theme][appearance].fontSecondary;
|
|
633
762
|
case "tertiary":
|
|
634
|
-
return tokens.
|
|
763
|
+
return tokens.colors[theme][appearance].fontTertiary;
|
|
635
764
|
case "disabled":
|
|
636
|
-
return tokens.
|
|
765
|
+
return tokens.colors[theme][appearance].fontDisabled;
|
|
637
766
|
case "accent":
|
|
638
|
-
return tokens.
|
|
639
|
-
case "success":
|
|
640
|
-
return tokens.success.fill[gamut];
|
|
641
|
-
case "warning":
|
|
642
|
-
return tokens.warning.fill[gamut];
|
|
643
|
-
case "error":
|
|
644
|
-
return tokens.error.fill[gamut];
|
|
767
|
+
return tokens.colors[theme][appearance][LARGE_TEXT_ROLES.has(role) ? "accentLarge" : "accentSmall"];
|
|
645
768
|
}
|
|
646
769
|
}
|
|
647
770
|
var ADAPTIVE_ROLES = /* @__PURE__ */ new Set(["headline", "title", "heading", "subheading"]);
|
|
@@ -671,7 +794,7 @@ function TextBase({
|
|
|
671
794
|
weight: weightOverride,
|
|
672
795
|
align,
|
|
673
796
|
numberOfLines,
|
|
674
|
-
elevation
|
|
797
|
+
elevation,
|
|
675
798
|
style,
|
|
676
799
|
accessibilityRole: accessibilityRoleOverride,
|
|
677
800
|
testID,
|
|
@@ -683,6 +806,9 @@ function TextBase({
|
|
|
683
806
|
}) {
|
|
684
807
|
const tokens = useTokens(elevation);
|
|
685
808
|
const { config, reportingEndpoint } = useNewtoneTheme();
|
|
809
|
+
const frameCtx = useFrameContext();
|
|
810
|
+
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
811
|
+
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
686
812
|
const size = sizeOverride ?? "md";
|
|
687
813
|
const fontSlot = tokens.typography.fonts[scope];
|
|
688
814
|
const resolvedFontWeight = weightOverride ? SEMANTIC_WEIGHT_MAP[weightOverride] : config.typography.roleWeights?.[role] ?? ROLE_DEFAULT_WEIGHTS[role];
|
|
@@ -745,18 +871,18 @@ function TextBase({
|
|
|
745
871
|
fontFamily: fontSlot.family,
|
|
746
872
|
fontSize: activeStep.fontSize,
|
|
747
873
|
fontWeight: String(resolvedFontWeight),
|
|
748
|
-
color: resolveTextColor(color, tokens),
|
|
874
|
+
color: resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance, role),
|
|
749
875
|
lineHeight: correctedLineHeight,
|
|
750
876
|
textAlign: align,
|
|
751
877
|
...vcOffset !== 0 ? { transform: [{ translateY: vcOffset }] } : {},
|
|
752
878
|
...featureSettings ? { fontFeatureSettings: featureSettings } : {}
|
|
753
879
|
};
|
|
754
|
-
}, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features]);
|
|
880
|
+
}, [tokens, fontSlot, step, resolvedStep, responsive, isAdaptive, resolvedFontWeight, color, align, config.typography.fontMetrics, centerVertically, features, resolvedTheme, resolvedAppearance]);
|
|
755
881
|
const inferredA11yRole = role === "headline" || role === "title" || role === "heading" ? "header" : void 0;
|
|
756
882
|
const effectiveA11yRole = accessibilityRoleOverride ?? inferredA11yRole;
|
|
757
883
|
const ariaLevel = effectiveA11yRole === "header" ? ROLE_HEADING_LEVEL[role] : void 0;
|
|
758
884
|
const scopeCtx = useMemo(() => ({ weights: SEMANTIC_WEIGHT_MAP }), []);
|
|
759
|
-
const textNode = /* @__PURE__ */
|
|
885
|
+
const textNode = /* @__PURE__ */ React16.createElement(TextScopeContext.Provider, { value: scopeCtx }, /* @__PURE__ */ React16.createElement(
|
|
760
886
|
Text,
|
|
761
887
|
{
|
|
762
888
|
ref,
|
|
@@ -770,7 +896,7 @@ function TextBase({
|
|
|
770
896
|
children
|
|
771
897
|
));
|
|
772
898
|
if (responsive && isAdaptive) {
|
|
773
|
-
return /* @__PURE__ */
|
|
899
|
+
return /* @__PURE__ */ React16.createElement(
|
|
774
900
|
View,
|
|
775
901
|
{
|
|
776
902
|
onLayout: (e) => {
|
|
@@ -785,37 +911,40 @@ function TextBase({
|
|
|
785
911
|
return textNode;
|
|
786
912
|
}
|
|
787
913
|
function TextSpan({ children, color, weight, italic, underline, highlight, style }) {
|
|
788
|
-
const tokens = useTokens(
|
|
914
|
+
const tokens = useTokens();
|
|
789
915
|
const scopeCtx = useContext(TextScopeContext);
|
|
916
|
+
const frameCtx = useFrameContext();
|
|
917
|
+
const resolvedTheme = frameCtx?.theme ?? "primary";
|
|
918
|
+
const resolvedAppearance = frameCtx?.appearance ?? "main";
|
|
790
919
|
const spanStyle = useMemo(() => {
|
|
791
920
|
const s = {};
|
|
792
|
-
if (color) s.color = resolveTextColor(color, tokens);
|
|
921
|
+
if (color) s.color = resolveTextColor(color, tokens, resolvedTheme, resolvedAppearance);
|
|
793
922
|
if (weight && scopeCtx) s.fontWeight = String(scopeCtx.weights[weight]);
|
|
794
923
|
if (italic) s.fontStyle = "italic";
|
|
795
924
|
if (underline) s.textDecorationLine = "underline";
|
|
796
|
-
if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens);
|
|
925
|
+
if (highlight) s.backgroundColor = resolveTextColor(highlight, tokens, resolvedTheme, resolvedAppearance);
|
|
797
926
|
return s;
|
|
798
|
-
}, [tokens, scopeCtx, color, weight, italic, underline, highlight]);
|
|
799
|
-
return
|
|
927
|
+
}, [tokens, scopeCtx, color, weight, italic, underline, highlight, resolvedTheme, resolvedAppearance]);
|
|
928
|
+
return React16.createElement(
|
|
800
929
|
Text,
|
|
801
930
|
{ style: style ? [spanStyle, ...Array.isArray(style) ? style : [style]] : spanStyle },
|
|
802
931
|
children
|
|
803
932
|
);
|
|
804
933
|
}
|
|
805
934
|
function TextBold(props) {
|
|
806
|
-
return
|
|
935
|
+
return React16.createElement(TextSpan, { ...props, weight: "bold" });
|
|
807
936
|
}
|
|
808
937
|
function TextMedium(props) {
|
|
809
|
-
return
|
|
938
|
+
return React16.createElement(TextSpan, { ...props, weight: "medium" });
|
|
810
939
|
}
|
|
811
940
|
function TextItalic(props) {
|
|
812
|
-
return
|
|
941
|
+
return React16.createElement(TextSpan, { ...props, italic: true });
|
|
813
942
|
}
|
|
814
943
|
function TextUnderline(props) {
|
|
815
|
-
return
|
|
944
|
+
return React16.createElement(TextSpan, { ...props, underline: true });
|
|
816
945
|
}
|
|
817
946
|
function TextHighlight(props) {
|
|
818
|
-
return
|
|
947
|
+
return React16.createElement(TextSpan, props);
|
|
819
948
|
}
|
|
820
949
|
|
|
821
950
|
// src/primitives/Text/index.ts
|
|
@@ -829,74 +958,43 @@ var Text3 = Object.assign(TextBase, {
|
|
|
829
958
|
});
|
|
830
959
|
|
|
831
960
|
// src/composites/actions/Button/Button.styles.ts
|
|
961
|
+
var BUTTON_HEIGHTS = {
|
|
962
|
+
sm: 40,
|
|
963
|
+
md: 48,
|
|
964
|
+
lg: 56,
|
|
965
|
+
xl: 64
|
|
966
|
+
};
|
|
832
967
|
function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
|
|
833
968
|
const basePadding = {
|
|
834
|
-
sm:
|
|
835
|
-
md:
|
|
836
|
-
lg:
|
|
969
|
+
sm: 12,
|
|
970
|
+
md: 16,
|
|
971
|
+
lg: 20,
|
|
972
|
+
xl: 24
|
|
837
973
|
};
|
|
838
974
|
const base = basePadding[size];
|
|
839
975
|
const textExtra = 8;
|
|
840
976
|
if (!hasText && hasIcon) {
|
|
841
|
-
return {
|
|
842
|
-
paddingLeft: base,
|
|
843
|
-
paddingRight: base,
|
|
844
|
-
paddingTop: base,
|
|
845
|
-
paddingBottom: base
|
|
846
|
-
};
|
|
977
|
+
return { paddingLeft: base, paddingRight: base };
|
|
847
978
|
}
|
|
848
979
|
if (hasText && !hasIcon) {
|
|
849
|
-
return {
|
|
850
|
-
paddingLeft: base + textExtra,
|
|
851
|
-
paddingRight: base + textExtra,
|
|
852
|
-
paddingTop: base,
|
|
853
|
-
paddingBottom: base
|
|
854
|
-
};
|
|
980
|
+
return { paddingLeft: base + textExtra, paddingRight: base + textExtra };
|
|
855
981
|
}
|
|
856
982
|
if (hasText && hasIcon) {
|
|
857
983
|
if (iconPosition === "left") {
|
|
858
|
-
return {
|
|
859
|
-
paddingLeft: base,
|
|
860
|
-
paddingRight: base + textExtra,
|
|
861
|
-
paddingTop: base,
|
|
862
|
-
paddingBottom: base
|
|
863
|
-
};
|
|
984
|
+
return { paddingLeft: base, paddingRight: base + textExtra };
|
|
864
985
|
} else {
|
|
865
|
-
return {
|
|
866
|
-
paddingLeft: base + textExtra,
|
|
867
|
-
paddingRight: base,
|
|
868
|
-
paddingTop: base,
|
|
869
|
-
paddingBottom: base
|
|
870
|
-
};
|
|
986
|
+
return { paddingLeft: base + textExtra, paddingRight: base };
|
|
871
987
|
}
|
|
872
988
|
}
|
|
873
|
-
return {
|
|
874
|
-
paddingLeft: base,
|
|
875
|
-
paddingRight: base,
|
|
876
|
-
paddingTop: base,
|
|
877
|
-
paddingBottom: base
|
|
878
|
-
};
|
|
879
|
-
}
|
|
880
|
-
function getPaletteTokens(semantic, tokens) {
|
|
881
|
-
switch (semantic) {
|
|
882
|
-
case "accent":
|
|
883
|
-
return tokens.accent;
|
|
884
|
-
case "success":
|
|
885
|
-
return tokens.success;
|
|
886
|
-
case "error":
|
|
887
|
-
return tokens.error;
|
|
888
|
-
case "warning":
|
|
889
|
-
return tokens.warning;
|
|
890
|
-
default:
|
|
891
|
-
return void 0;
|
|
892
|
-
}
|
|
989
|
+
return { paddingLeft: base, paddingRight: base };
|
|
893
990
|
}
|
|
894
|
-
function getButtonConfig(variant,
|
|
991
|
+
function getButtonConfig(variant, size, disabled, tokens, theme) {
|
|
895
992
|
const sizeConfig = getSizeConfig(size, tokens);
|
|
896
|
-
const variantColors = getVariantColors(variant,
|
|
993
|
+
const variantColors = getVariantColors(variant, disabled, tokens, theme);
|
|
897
994
|
return {
|
|
898
995
|
variantColors,
|
|
899
996
|
sizeTokens: {
|
|
997
|
+
height: sizeConfig.height,
|
|
900
998
|
padding: sizeConfig.padding,
|
|
901
999
|
gap: sizeConfig.gap,
|
|
902
1000
|
borderRadius: sizeConfig.borderRadius,
|
|
@@ -908,124 +1006,89 @@ function getButtonConfig(variant, semantic, size, disabled, tokens) {
|
|
|
908
1006
|
function getSizeConfig(size, tokens) {
|
|
909
1007
|
const configs = {
|
|
910
1008
|
sm: {
|
|
911
|
-
|
|
1009
|
+
height: BUTTON_HEIGHTS.sm,
|
|
1010
|
+
padding: 12,
|
|
912
1011
|
gap: tokens.spacing["08"],
|
|
913
1012
|
borderRadius: 8,
|
|
914
1013
|
textSize: "md",
|
|
915
|
-
|
|
916
|
-
iconSize: 24
|
|
1014
|
+
iconSize: 20
|
|
917
1015
|
},
|
|
918
1016
|
md: {
|
|
919
|
-
|
|
1017
|
+
height: BUTTON_HEIGHTS.md,
|
|
1018
|
+
padding: 16,
|
|
920
1019
|
gap: tokens.spacing["08"],
|
|
921
1020
|
borderRadius: 12,
|
|
922
1021
|
textSize: "md",
|
|
923
|
-
// 16px
|
|
924
1022
|
iconSize: 24
|
|
925
1023
|
},
|
|
926
1024
|
lg: {
|
|
927
|
-
|
|
1025
|
+
height: BUTTON_HEIGHTS.lg,
|
|
1026
|
+
padding: 20,
|
|
928
1027
|
gap: tokens.spacing["08"],
|
|
929
|
-
borderRadius:
|
|
1028
|
+
borderRadius: 14,
|
|
930
1029
|
textSize: "md",
|
|
931
|
-
|
|
1030
|
+
iconSize: 24
|
|
1031
|
+
},
|
|
1032
|
+
xl: {
|
|
1033
|
+
height: BUTTON_HEIGHTS.xl,
|
|
1034
|
+
padding: 24,
|
|
1035
|
+
gap: tokens.spacing["08"],
|
|
1036
|
+
borderRadius: 16,
|
|
1037
|
+
textSize: "lg",
|
|
932
1038
|
iconSize: 24
|
|
933
1039
|
}
|
|
934
1040
|
};
|
|
935
1041
|
return configs[size];
|
|
936
1042
|
}
|
|
937
|
-
function getVariantColors(variant,
|
|
1043
|
+
function getVariantColors(variant, disabled, tokens, theme) {
|
|
1044
|
+
const t = tokens.colors[theme];
|
|
938
1045
|
if (disabled) {
|
|
939
|
-
const baseColors = getVariantColorsForState(variant,
|
|
940
|
-
const { gamut } = tokens;
|
|
941
|
-
const disabledBg = tokens.backgroundSunken[gamut];
|
|
1046
|
+
const baseColors = getVariantColorsForState(variant, tokens, theme);
|
|
942
1047
|
return {
|
|
943
1048
|
...baseColors,
|
|
944
|
-
bg:
|
|
945
|
-
hoveredBg:
|
|
946
|
-
pressedBg:
|
|
947
|
-
textColor:
|
|
948
|
-
iconColor:
|
|
1049
|
+
bg: "transparent",
|
|
1050
|
+
hoveredBg: "transparent",
|
|
1051
|
+
pressedBg: "transparent",
|
|
1052
|
+
textColor: t.main.fontDisabled,
|
|
1053
|
+
iconColor: t.main.fontDisabled,
|
|
1054
|
+
borderWidth: 1,
|
|
1055
|
+
borderColor: t.main.divider
|
|
949
1056
|
};
|
|
950
1057
|
}
|
|
951
|
-
return getVariantColorsForState(variant,
|
|
1058
|
+
return getVariantColorsForState(variant, tokens, theme);
|
|
952
1059
|
}
|
|
953
|
-
function getVariantColorsForState(variant,
|
|
954
|
-
const
|
|
955
|
-
const paletteTokens = getPaletteTokens(semantic, tokens);
|
|
1060
|
+
function getVariantColorsForState(variant, tokens, theme) {
|
|
1061
|
+
const t = tokens.colors[theme];
|
|
956
1062
|
if (variant === "primary") {
|
|
957
|
-
if (semantic === "neutral") {
|
|
958
|
-
return {
|
|
959
|
-
bg: tokens.backgroundInteractive[gamut],
|
|
960
|
-
hoveredBg: tokens.backgroundInteractiveHover[gamut],
|
|
961
|
-
pressedBg: tokens.backgroundInteractiveActive[gamut],
|
|
962
|
-
textColor: tokens.textPrimary[gamut],
|
|
963
|
-
iconColor: tokens.textPrimary[gamut],
|
|
964
|
-
borderWidth: 1,
|
|
965
|
-
borderColor: "transparent"
|
|
966
|
-
};
|
|
967
|
-
}
|
|
968
1063
|
return {
|
|
969
|
-
bg:
|
|
970
|
-
hoveredBg:
|
|
971
|
-
pressedBg:
|
|
972
|
-
textColor:
|
|
973
|
-
iconColor:
|
|
974
|
-
borderWidth:
|
|
1064
|
+
bg: t.emphasis.actionEnabled,
|
|
1065
|
+
hoveredBg: t.emphasis.actionHovered,
|
|
1066
|
+
pressedBg: t.emphasis.actionPressed,
|
|
1067
|
+
textColor: t.emphasis.accentSmall,
|
|
1068
|
+
iconColor: t.emphasis.accentSmall,
|
|
1069
|
+
borderWidth: 0,
|
|
975
1070
|
borderColor: "transparent"
|
|
976
1071
|
};
|
|
977
1072
|
}
|
|
978
1073
|
if (variant === "secondary") {
|
|
979
|
-
if (semantic === "neutral") {
|
|
980
|
-
return {
|
|
981
|
-
bg: "transparent",
|
|
982
|
-
hoveredBg: tokens.backgroundInteractive[gamut],
|
|
983
|
-
pressedBg: tokens.backgroundInteractiveHover[gamut],
|
|
984
|
-
textColor: tokens.textPrimary[gamut],
|
|
985
|
-
iconColor: tokens.textPrimary[gamut],
|
|
986
|
-
borderWidth: 1,
|
|
987
|
-
borderColor: tokens.border[gamut]
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
1074
|
return {
|
|
991
|
-
bg:
|
|
992
|
-
hoveredBg:
|
|
993
|
-
pressedBg:
|
|
994
|
-
textColor:
|
|
995
|
-
iconColor:
|
|
996
|
-
borderWidth:
|
|
997
|
-
borderColor: "transparent"
|
|
998
|
-
};
|
|
999
|
-
}
|
|
1000
|
-
if (variant === "tertiary") {
|
|
1001
|
-
if (semantic === "neutral") {
|
|
1002
|
-
return {
|
|
1003
|
-
bg: "transparent",
|
|
1004
|
-
hoveredBg: tokens.backgroundInteractive[gamut],
|
|
1005
|
-
pressedBg: tokens.backgroundInteractiveHover[gamut],
|
|
1006
|
-
textColor: tokens.textPrimary[gamut],
|
|
1007
|
-
iconColor: tokens.textPrimary[gamut],
|
|
1008
|
-
borderWidth: 1,
|
|
1009
|
-
borderColor: "transparent"
|
|
1010
|
-
};
|
|
1011
|
-
}
|
|
1012
|
-
return {
|
|
1013
|
-
bg: "transparent",
|
|
1014
|
-
hoveredBg: paletteTokens.background[gamut],
|
|
1015
|
-
pressedBg: paletteTokens.backgroundInteractive[gamut],
|
|
1016
|
-
textColor: paletteTokens.fill[gamut],
|
|
1017
|
-
iconColor: paletteTokens.fill[gamut],
|
|
1018
|
-
borderWidth: 1,
|
|
1075
|
+
bg: t.main.actionEnabled,
|
|
1076
|
+
hoveredBg: t.main.actionHovered,
|
|
1077
|
+
pressedBg: t.main.actionPressed,
|
|
1078
|
+
textColor: t.main.fontPrimary,
|
|
1079
|
+
iconColor: t.main.fontPrimary,
|
|
1080
|
+
borderWidth: 0,
|
|
1019
1081
|
borderColor: "transparent"
|
|
1020
1082
|
};
|
|
1021
1083
|
}
|
|
1022
1084
|
return {
|
|
1023
1085
|
bg: "transparent",
|
|
1024
|
-
hoveredBg:
|
|
1025
|
-
pressedBg:
|
|
1026
|
-
textColor:
|
|
1027
|
-
iconColor:
|
|
1028
|
-
borderWidth: 0
|
|
1086
|
+
hoveredBg: t.main.actionEnabled,
|
|
1087
|
+
pressedBg: t.main.actionHovered,
|
|
1088
|
+
textColor: t.main.fontSecondary,
|
|
1089
|
+
iconColor: t.main.fontSecondary,
|
|
1090
|
+
borderWidth: 0,
|
|
1091
|
+
borderColor: "transparent"
|
|
1029
1092
|
};
|
|
1030
1093
|
}
|
|
1031
1094
|
function Button({
|
|
@@ -1033,70 +1096,72 @@ function Button({
|
|
|
1033
1096
|
icon,
|
|
1034
1097
|
iconPosition = "left",
|
|
1035
1098
|
variant = "primary",
|
|
1036
|
-
semantic = "neutral",
|
|
1037
1099
|
size = "md",
|
|
1038
1100
|
disabled = false,
|
|
1101
|
+
loading = false,
|
|
1102
|
+
fullWidth = false,
|
|
1039
1103
|
style,
|
|
1040
1104
|
textStyle,
|
|
1041
1105
|
...pressableProps
|
|
1042
1106
|
}) {
|
|
1043
1107
|
const tokens = useTokens();
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1108
|
+
const frameCtx = useFrameContext();
|
|
1109
|
+
const theme = frameCtx?.theme ?? "primary";
|
|
1110
|
+
const isDisabled = disabled || loading;
|
|
1111
|
+
const { variantColors, sizeTokens } = React16.useMemo(
|
|
1112
|
+
() => getButtonConfig(variant, size, isDisabled, tokens, theme),
|
|
1113
|
+
[variant, size, isDisabled, tokens, theme]
|
|
1047
1114
|
);
|
|
1048
|
-
const padding =
|
|
1115
|
+
const padding = React16.useMemo(
|
|
1049
1116
|
() => computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
1050
1117
|
[size, icon, children, iconPosition]
|
|
1051
1118
|
);
|
|
1052
|
-
return /* @__PURE__ */
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1119
|
+
return /* @__PURE__ */ React16.createElement(Pressable, { disabled: isDisabled, ...pressableProps }, ({ pressed, hovered }) => /* @__PURE__ */ React16.createElement(
|
|
1120
|
+
Wrapper,
|
|
1121
|
+
{
|
|
1122
|
+
direction: "horizontal",
|
|
1123
|
+
align: "center",
|
|
1124
|
+
justify: "center",
|
|
1125
|
+
gap: sizeTokens.gap,
|
|
1126
|
+
style: [
|
|
1127
|
+
{
|
|
1128
|
+
height: sizeTokens.height,
|
|
1129
|
+
paddingLeft: padding.paddingLeft,
|
|
1130
|
+
paddingRight: padding.paddingRight,
|
|
1131
|
+
backgroundColor: pressed && !isDisabled ? variantColors.pressedBg : hovered && !isDisabled ? variantColors.hoveredBg : variantColors.bg,
|
|
1132
|
+
borderRadius: sizeTokens.borderRadius,
|
|
1133
|
+
borderWidth: variantColors.borderWidth,
|
|
1134
|
+
borderColor: variantColors.borderColor || "transparent",
|
|
1135
|
+
opacity: isDisabled ? loading ? 0.6 : 0.4 : 1,
|
|
1136
|
+
...fullWidth && { width: "100%", alignSelf: "stretch" }
|
|
1137
|
+
},
|
|
1138
|
+
...Array.isArray(style) ? style : style ? [style] : []
|
|
1139
|
+
]
|
|
1140
|
+
},
|
|
1141
|
+
icon && iconPosition === "left" && /* @__PURE__ */ React16.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
|
|
1142
|
+
children && /* @__PURE__ */ React16.createElement(
|
|
1143
|
+
Text3,
|
|
1056
1144
|
{
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
gap: sizeTokens.gap,
|
|
1145
|
+
role: "label",
|
|
1146
|
+
size: sizeTokens.textSize,
|
|
1147
|
+
centerVertically: true,
|
|
1061
1148
|
style: [
|
|
1062
|
-
{
|
|
1063
|
-
|
|
1064
|
-
// Asymmetric horizontal padding for text optical balance
|
|
1065
|
-
backgroundColor: pressed && !disabled ? variantColors.pressedBg : hovered && !disabled ? variantColors.hoveredBg : variantColors.bg,
|
|
1066
|
-
borderRadius: sizeTokens.borderRadius,
|
|
1067
|
-
borderWidth: variantColors.borderWidth,
|
|
1068
|
-
// Always 1 for consistent sizing
|
|
1069
|
-
borderColor: variantColors.borderColor || "transparent",
|
|
1070
|
-
opacity: disabled ? 0.4 : 1
|
|
1071
|
-
},
|
|
1072
|
-
...Array.isArray(style) ? style : style ? [style] : []
|
|
1149
|
+
{ color: variantColors.textColor },
|
|
1150
|
+
...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
|
|
1073
1151
|
]
|
|
1074
1152
|
},
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
Text3,
|
|
1079
|
-
{
|
|
1080
|
-
role: "label",
|
|
1081
|
-
size: sizeTokens.textSize,
|
|
1082
|
-
centerVertically: true,
|
|
1083
|
-
style: [
|
|
1084
|
-
{ color: variantColors.textColor },
|
|
1085
|
-
...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
|
|
1086
|
-
]
|
|
1087
|
-
},
|
|
1088
|
-
children
|
|
1089
|
-
),
|
|
1090
|
-
icon && iconPosition === "right" && /* @__PURE__ */ React13.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
|
|
1091
|
-
)
|
|
1153
|
+
children
|
|
1154
|
+
),
|
|
1155
|
+
icon && iconPosition === "right" && /* @__PURE__ */ React16.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
|
|
1092
1156
|
));
|
|
1093
1157
|
}
|
|
1094
|
-
function getCardStyles(tokens,
|
|
1158
|
+
function getCardStyles(tokens, disabled, theme = "primary", appearance = "main") {
|
|
1159
|
+
const at = tokens.colors[theme][appearance];
|
|
1095
1160
|
return StyleSheet.create({
|
|
1096
1161
|
container: {
|
|
1097
|
-
backgroundColor:
|
|
1162
|
+
backgroundColor: at.background,
|
|
1098
1163
|
borderWidth: 1,
|
|
1099
|
-
borderColor:
|
|
1164
|
+
borderColor: at.fontSecondary,
|
|
1100
1165
|
borderRadius: tokens.radius.lg,
|
|
1101
1166
|
padding: tokens.spacing["16"],
|
|
1102
1167
|
opacity: disabled ? 0.5 : 1
|
|
@@ -1112,13 +1177,286 @@ function Card({
|
|
|
1112
1177
|
disabled = false
|
|
1113
1178
|
}) {
|
|
1114
1179
|
const tokens = useTokens(elevation);
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1117
|
-
|
|
1180
|
+
const frameCtx = useFrameContext();
|
|
1181
|
+
const styles = React16.useMemo(
|
|
1182
|
+
() => getCardStyles(tokens, disabled, frameCtx?.theme, frameCtx?.appearance),
|
|
1183
|
+
[tokens, disabled, frameCtx?.theme, frameCtx?.appearance]
|
|
1184
|
+
);
|
|
1185
|
+
return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// src/composites/display/Chip/Chip.styles.ts
|
|
1189
|
+
function semanticToTheme(semantic) {
|
|
1190
|
+
if (semantic === "accent") return "primary";
|
|
1191
|
+
return semantic;
|
|
1192
|
+
}
|
|
1193
|
+
function getSizeConfig2(size) {
|
|
1194
|
+
if (size === "sm") {
|
|
1195
|
+
return { paddingX: 10, paddingY: 3, gap: 4, textRole: "caption", iconSize: 16 };
|
|
1196
|
+
}
|
|
1197
|
+
return { paddingX: 16, paddingY: 8, gap: 6, textRole: "label", iconSize: 20 };
|
|
1198
|
+
}
|
|
1199
|
+
function getVariantColors2(variant, semantic, selected, disabled, tokens) {
|
|
1200
|
+
if (selected) {
|
|
1201
|
+
if (semantic === "neutral") {
|
|
1202
|
+
return {
|
|
1203
|
+
bg: tokens.colors.primary.strong.background,
|
|
1204
|
+
hoveredBg: tokens.colors.primary.strong.fontPrimary,
|
|
1205
|
+
pressedBg: tokens.colors.primary.strong.background,
|
|
1206
|
+
textColor: tokens.colors.primary.strong.fontPrimary,
|
|
1207
|
+
iconColor: tokens.colors.primary.strong.fontPrimary,
|
|
1208
|
+
borderWidth: 1,
|
|
1209
|
+
borderColor: "transparent"
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
const t2 = tokens.colors[semanticToTheme(semantic)];
|
|
1213
|
+
return {
|
|
1214
|
+
bg: t2.emphasis.background,
|
|
1215
|
+
hoveredBg: t2.emphasis.fontPrimary,
|
|
1216
|
+
pressedBg: t2.emphasis.background,
|
|
1217
|
+
textColor: t2.main.background,
|
|
1218
|
+
iconColor: t2.main.background,
|
|
1219
|
+
borderWidth: 1,
|
|
1220
|
+
borderColor: "transparent"
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
if (disabled) {
|
|
1224
|
+
return {
|
|
1225
|
+
bg: "transparent",
|
|
1226
|
+
hoveredBg: "transparent",
|
|
1227
|
+
pressedBg: "transparent",
|
|
1228
|
+
textColor: tokens.colors.primary.main.fontTertiary,
|
|
1229
|
+
iconColor: tokens.colors.primary.main.fontTertiary,
|
|
1230
|
+
borderWidth: 1,
|
|
1231
|
+
borderColor: tokens.colors.primary.main.divider
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
if (variant === "filled") {
|
|
1235
|
+
if (semantic === "neutral") {
|
|
1236
|
+
return {
|
|
1237
|
+
bg: tokens.colors.primary.main.fontPrimary,
|
|
1238
|
+
hoveredBg: tokens.colors.primary.main.fontSecondary,
|
|
1239
|
+
pressedBg: tokens.colors.primary.main.fontPrimary,
|
|
1240
|
+
textColor: tokens.colors.primary.main.divider,
|
|
1241
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
1242
|
+
borderWidth: 1,
|
|
1243
|
+
borderColor: "transparent"
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
const t2 = tokens.colors[semanticToTheme(semantic)];
|
|
1247
|
+
return {
|
|
1248
|
+
bg: t2.emphasis.background,
|
|
1249
|
+
hoveredBg: t2.emphasis.fontPrimary,
|
|
1250
|
+
pressedBg: t2.emphasis.fontSecondary,
|
|
1251
|
+
textColor: t2.main.background,
|
|
1252
|
+
iconColor: t2.main.background,
|
|
1253
|
+
borderWidth: 1,
|
|
1254
|
+
borderColor: "transparent"
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
if (variant === "tinted") {
|
|
1258
|
+
if (semantic === "neutral") {
|
|
1259
|
+
return {
|
|
1260
|
+
bg: tokens.colors.primary.tinted.background,
|
|
1261
|
+
hoveredBg: tokens.colors.primary.tinted.fontPrimary,
|
|
1262
|
+
pressedBg: tokens.colors.primary.tinted.fontSecondary,
|
|
1263
|
+
textColor: tokens.colors.primary.main.fontPrimary,
|
|
1264
|
+
iconColor: tokens.colors.primary.main.fontPrimary,
|
|
1265
|
+
borderWidth: 1,
|
|
1266
|
+
borderColor: "transparent"
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
const t2 = tokens.colors[semanticToTheme(semantic)];
|
|
1270
|
+
return {
|
|
1271
|
+
bg: t2.tinted.background,
|
|
1272
|
+
hoveredBg: t2.tinted.fontPrimary,
|
|
1273
|
+
pressedBg: t2.tinted.fontSecondary,
|
|
1274
|
+
textColor: t2.emphasis.divider,
|
|
1275
|
+
iconColor: t2.emphasis.divider,
|
|
1276
|
+
borderWidth: 1,
|
|
1277
|
+
borderColor: "transparent"
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
if (semantic === "neutral") {
|
|
1281
|
+
return {
|
|
1282
|
+
bg: "transparent",
|
|
1283
|
+
hoveredBg: tokens.colors.primary.tinted.background,
|
|
1284
|
+
pressedBg: tokens.colors.primary.tinted.fontPrimary,
|
|
1285
|
+
textColor: tokens.colors.primary.main.fontPrimary,
|
|
1286
|
+
iconColor: tokens.colors.primary.main.fontPrimary,
|
|
1287
|
+
borderWidth: 1,
|
|
1288
|
+
borderColor: tokens.colors.primary.main.divider
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
1292
|
+
return {
|
|
1293
|
+
bg: "transparent",
|
|
1294
|
+
hoveredBg: t.tinted.background,
|
|
1295
|
+
pressedBg: t.tinted.fontPrimary,
|
|
1296
|
+
textColor: t.emphasis.divider,
|
|
1297
|
+
iconColor: t.emphasis.divider,
|
|
1298
|
+
borderWidth: 1,
|
|
1299
|
+
borderColor: t.tinted.fontSecondary
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
function getChipConfig(variant, semantic, size, selected, disabled, tokens) {
|
|
1303
|
+
return {
|
|
1304
|
+
colors: getVariantColors2(variant, semantic, selected, disabled, tokens),
|
|
1305
|
+
sizeTokens: getSizeConfig2(size)
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
function Chip({
|
|
1309
|
+
children,
|
|
1310
|
+
variant = "tinted",
|
|
1311
|
+
size = "md",
|
|
1312
|
+
semantic = "neutral",
|
|
1313
|
+
selected = false,
|
|
1314
|
+
onPress,
|
|
1315
|
+
disabled = false,
|
|
1316
|
+
icon,
|
|
1317
|
+
style
|
|
1318
|
+
}) {
|
|
1319
|
+
const tokens = useTokens();
|
|
1320
|
+
const { colors, sizeTokens } = React16.useMemo(
|
|
1321
|
+
() => getChipConfig(variant, semantic, size, selected, disabled, tokens),
|
|
1322
|
+
[variant, semantic, size, selected, disabled, tokens]
|
|
1323
|
+
);
|
|
1324
|
+
const content = (state) => /* @__PURE__ */ React16.createElement(
|
|
1325
|
+
Wrapper,
|
|
1326
|
+
{
|
|
1327
|
+
direction: "horizontal",
|
|
1328
|
+
align: "center",
|
|
1329
|
+
gap: sizeTokens.gap,
|
|
1330
|
+
style: [
|
|
1331
|
+
{
|
|
1332
|
+
paddingLeft: sizeTokens.paddingX,
|
|
1333
|
+
paddingRight: sizeTokens.paddingX,
|
|
1334
|
+
paddingTop: sizeTokens.paddingY,
|
|
1335
|
+
paddingBottom: sizeTokens.paddingY,
|
|
1336
|
+
backgroundColor: state?.pressed && !disabled ? colors.pressedBg : state?.hovered && !disabled ? colors.hoveredBg : colors.bg,
|
|
1337
|
+
borderRadius: 99,
|
|
1338
|
+
borderWidth: colors.borderWidth,
|
|
1339
|
+
borderColor: colors.borderColor || "transparent",
|
|
1340
|
+
opacity: disabled ? 0.4 : 1
|
|
1341
|
+
},
|
|
1342
|
+
...Array.isArray(style) ? style : style ? [style] : []
|
|
1343
|
+
]
|
|
1344
|
+
},
|
|
1345
|
+
icon && /* @__PURE__ */ React16.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: colors.iconColor }),
|
|
1346
|
+
/* @__PURE__ */ React16.createElement(
|
|
1347
|
+
Text3,
|
|
1348
|
+
{
|
|
1349
|
+
role: sizeTokens.textRole,
|
|
1350
|
+
weight: selected ? "bold" : "medium",
|
|
1351
|
+
style: { color: colors.textColor }
|
|
1352
|
+
},
|
|
1353
|
+
children
|
|
1354
|
+
)
|
|
1118
1355
|
);
|
|
1119
|
-
|
|
1356
|
+
if (onPress) {
|
|
1357
|
+
return /* @__PURE__ */ React16.createElement(Pressable, { onPress, disabled }, ({ pressed, hovered }) => content({ pressed, hovered }));
|
|
1358
|
+
}
|
|
1359
|
+
return content();
|
|
1120
1360
|
}
|
|
1121
|
-
|
|
1361
|
+
|
|
1362
|
+
// src/composites/layout/Divider/Divider.styles.ts
|
|
1363
|
+
function getDividerStyles(orientation, spacing, tokens) {
|
|
1364
|
+
const color = tokens.colors.primary.main.divider;
|
|
1365
|
+
if (orientation === "vertical") {
|
|
1366
|
+
return {
|
|
1367
|
+
width: 1,
|
|
1368
|
+
height: "100%",
|
|
1369
|
+
backgroundColor: color,
|
|
1370
|
+
...spacing != null && { marginLeft: spacing, marginRight: spacing }
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
return {
|
|
1374
|
+
height: 1,
|
|
1375
|
+
width: "100%",
|
|
1376
|
+
backgroundColor: color,
|
|
1377
|
+
...spacing != null && { marginTop: spacing, marginBottom: spacing }
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
function Divider({
|
|
1381
|
+
orientation = "horizontal",
|
|
1382
|
+
spacing,
|
|
1383
|
+
style
|
|
1384
|
+
}) {
|
|
1385
|
+
const tokens = useTokens();
|
|
1386
|
+
const dividerStyle = React16.useMemo(
|
|
1387
|
+
() => getDividerStyles(orientation, spacing, tokens),
|
|
1388
|
+
[orientation, spacing, tokens]
|
|
1389
|
+
);
|
|
1390
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1391
|
+
View,
|
|
1392
|
+
{
|
|
1393
|
+
style: [dividerStyle, ...Array.isArray(style) ? style : style ? [style] : []],
|
|
1394
|
+
accessibilityRole: "none"
|
|
1395
|
+
}
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
// src/composites/layout/ContentCard/ContentCard.styles.ts
|
|
1400
|
+
function getContentCardStyles(variant, isInteractive, tokens) {
|
|
1401
|
+
const dividerColor = tokens.colors.primary.main.divider;
|
|
1402
|
+
const interactiveStyles = isInteractive ? { cursor: "pointer", textDecorationLine: "none" } : {};
|
|
1403
|
+
if (variant === "elevated") {
|
|
1404
|
+
return {
|
|
1405
|
+
borderRadius: 12,
|
|
1406
|
+
...interactiveStyles
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
if (variant === "bordered") {
|
|
1410
|
+
return {
|
|
1411
|
+
borderWidth: 1,
|
|
1412
|
+
borderColor: dividerColor,
|
|
1413
|
+
borderStyle: "solid",
|
|
1414
|
+
borderRadius: 12,
|
|
1415
|
+
...interactiveStyles
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
return {
|
|
1419
|
+
borderBottomWidth: 1,
|
|
1420
|
+
borderBottomColor: dividerColor,
|
|
1421
|
+
...interactiveStyles
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
function ContentCard({
|
|
1425
|
+
children,
|
|
1426
|
+
variant = "bordered",
|
|
1427
|
+
href,
|
|
1428
|
+
onPress,
|
|
1429
|
+
padding = 20,
|
|
1430
|
+
gap = 8,
|
|
1431
|
+
disabled = false,
|
|
1432
|
+
style
|
|
1433
|
+
}) {
|
|
1434
|
+
const tokens = useTokens();
|
|
1435
|
+
const isInteractive = !!(href || onPress);
|
|
1436
|
+
const variantStyles = React16.useMemo(
|
|
1437
|
+
() => getContentCardStyles(variant, isInteractive, tokens),
|
|
1438
|
+
[variant, isInteractive, tokens]
|
|
1439
|
+
);
|
|
1440
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1441
|
+
Frame,
|
|
1442
|
+
{
|
|
1443
|
+
elevation: variant === "elevated" ? 2 : void 0,
|
|
1444
|
+
appearance: variant === "elevated" ? "tinted" : void 0,
|
|
1445
|
+
href,
|
|
1446
|
+
onPress,
|
|
1447
|
+
disabled,
|
|
1448
|
+
padding,
|
|
1449
|
+
gap,
|
|
1450
|
+
style: [
|
|
1451
|
+
variantStyles,
|
|
1452
|
+
...Array.isArray(style) ? style : style ? [style] : []
|
|
1453
|
+
]
|
|
1454
|
+
},
|
|
1455
|
+
children
|
|
1456
|
+
);
|
|
1457
|
+
}
|
|
1458
|
+
function getTextInputStyles(tokens, disabled, theme = "primary", appearance = "main") {
|
|
1459
|
+
const at = tokens.colors[theme][appearance];
|
|
1122
1460
|
return StyleSheet.create({
|
|
1123
1461
|
container: {
|
|
1124
1462
|
gap: tokens.spacing["04"]
|
|
@@ -1127,18 +1465,18 @@ function getTextInputStyles(tokens, gamut, disabled) {
|
|
|
1127
1465
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1128
1466
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1129
1467
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1130
|
-
color:
|
|
1468
|
+
color: at.fontTertiary
|
|
1131
1469
|
},
|
|
1132
1470
|
input: {
|
|
1133
1471
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1134
|
-
backgroundColor:
|
|
1472
|
+
backgroundColor: at.fontSecondary,
|
|
1135
1473
|
borderWidth: 1,
|
|
1136
|
-
borderColor:
|
|
1474
|
+
borderColor: at.fontSecondary,
|
|
1137
1475
|
borderRadius: tokens.radius.md,
|
|
1138
1476
|
paddingVertical: tokens.spacing["08"],
|
|
1139
1477
|
paddingHorizontal: tokens.spacing["12"],
|
|
1140
1478
|
fontSize: tokens.typography.fontSizes["05"],
|
|
1141
|
-
color: disabled ?
|
|
1479
|
+
color: disabled ? at.fontTertiary : at.divider,
|
|
1142
1480
|
opacity: disabled ? 0.5 : 1
|
|
1143
1481
|
}
|
|
1144
1482
|
});
|
|
@@ -1152,21 +1490,25 @@ function TextInput({
|
|
|
1152
1490
|
...textInputProps
|
|
1153
1491
|
}) {
|
|
1154
1492
|
const tokens = useTokens(1);
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1493
|
+
const frameCtx = useFrameContext();
|
|
1494
|
+
const theme = frameCtx?.theme ?? "primary";
|
|
1495
|
+
const appearance = frameCtx?.appearance ?? "main";
|
|
1496
|
+
const styles = React16.useMemo(
|
|
1497
|
+
() => getTextInputStyles(tokens, disabled, theme, appearance),
|
|
1498
|
+
[tokens, disabled, theme, appearance]
|
|
1158
1499
|
);
|
|
1159
|
-
return /* @__PURE__ */
|
|
1500
|
+
return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React16.createElement(
|
|
1160
1501
|
TextInput$1,
|
|
1161
1502
|
{
|
|
1162
1503
|
style: styles.input,
|
|
1163
1504
|
editable: !disabled,
|
|
1164
|
-
placeholderTextColor: tokens.
|
|
1505
|
+
placeholderTextColor: tokens.colors[theme][appearance].fontTertiary,
|
|
1165
1506
|
...textInputProps
|
|
1166
1507
|
}
|
|
1167
1508
|
));
|
|
1168
1509
|
}
|
|
1169
|
-
function getPopoverStyles(tokens,
|
|
1510
|
+
function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, theme = "primary", appearance = "main") {
|
|
1511
|
+
const at = tokens.colors[theme][appearance];
|
|
1170
1512
|
const widthStyle = width === "trigger" ? { left: 0, right: 0 } : typeof width === "number" ? { width, left: 0 } : { left: 0 };
|
|
1171
1513
|
return StyleSheet.create({
|
|
1172
1514
|
container: {
|
|
@@ -1177,9 +1519,9 @@ function getPopoverStyles(tokens, gamut, triggerHeight, offset, maxHeight, width
|
|
|
1177
1519
|
position: "absolute",
|
|
1178
1520
|
top: triggerHeight + offset,
|
|
1179
1521
|
...widthStyle,
|
|
1180
|
-
backgroundColor:
|
|
1522
|
+
backgroundColor: at.fontPrimary,
|
|
1181
1523
|
borderWidth: 1,
|
|
1182
|
-
borderColor:
|
|
1524
|
+
borderColor: at.fontSecondary,
|
|
1183
1525
|
borderRadius: tokens.radius.md,
|
|
1184
1526
|
maxHeight,
|
|
1185
1527
|
zIndex: 1e3,
|
|
@@ -1208,6 +1550,7 @@ function Popover({
|
|
|
1208
1550
|
contentStyle
|
|
1209
1551
|
}) {
|
|
1210
1552
|
const tokens = useTokens(1);
|
|
1553
|
+
const frameCtx = useFrameContext();
|
|
1211
1554
|
const containerRef = useRef(null);
|
|
1212
1555
|
const [triggerHeight, setTriggerHeight] = useState(0);
|
|
1213
1556
|
const onTriggerLayout = useCallback(
|
|
@@ -1247,8 +1590,8 @@ function Popover({
|
|
|
1247
1590
|
[closeOnEscape, onClose]
|
|
1248
1591
|
);
|
|
1249
1592
|
const styles = useMemo(
|
|
1250
|
-
() => getPopoverStyles(tokens,
|
|
1251
|
-
[tokens, triggerHeight, offset, maxHeight, width, isOpen]
|
|
1593
|
+
() => getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance),
|
|
1594
|
+
[tokens, triggerHeight, offset, maxHeight, width, isOpen, frameCtx?.theme, frameCtx?.appearance]
|
|
1252
1595
|
);
|
|
1253
1596
|
const containerStyles = useMemo(
|
|
1254
1597
|
() => [styles.container, ...Array.isArray(style) ? style : style ? [style] : []],
|
|
@@ -1259,15 +1602,15 @@ function Popover({
|
|
|
1259
1602
|
[styles.content, contentStyle]
|
|
1260
1603
|
);
|
|
1261
1604
|
const webProps = { onKeyDown: handleKeyDown };
|
|
1262
|
-
return /* @__PURE__ */
|
|
1605
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1263
1606
|
View,
|
|
1264
1607
|
{
|
|
1265
1608
|
ref: containerRef,
|
|
1266
1609
|
style: containerStyles,
|
|
1267
1610
|
...webProps
|
|
1268
1611
|
},
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
isOpen && /* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ React16.createElement(View, { onLayout: onTriggerLayout }, trigger),
|
|
1613
|
+
isOpen && /* @__PURE__ */ React16.createElement(View, { style: mergedContentStyles }, children)
|
|
1271
1614
|
);
|
|
1272
1615
|
}
|
|
1273
1616
|
function usePopover(options) {
|
|
@@ -1294,7 +1637,8 @@ function usePopover(options) {
|
|
|
1294
1637
|
function isOptionGroup(item) {
|
|
1295
1638
|
return "options" in item;
|
|
1296
1639
|
}
|
|
1297
|
-
function getSelectStyles(tokens,
|
|
1640
|
+
function getSelectStyles(tokens, disabled, size, isOpen, theme = "primary", appearance = "main") {
|
|
1641
|
+
const at = tokens.colors[theme][appearance];
|
|
1298
1642
|
const isSm = size === "sm";
|
|
1299
1643
|
const fontSize = isSm ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1300
1644
|
const iconSize = fontSize + 2;
|
|
@@ -1310,14 +1654,14 @@ function getSelectStyles(tokens, gamut, disabled, size, isOpen) {
|
|
|
1310
1654
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1311
1655
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1312
1656
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1313
|
-
color:
|
|
1657
|
+
color: at.fontTertiary
|
|
1314
1658
|
},
|
|
1315
1659
|
trigger: {
|
|
1316
1660
|
flexDirection: "row",
|
|
1317
1661
|
alignItems: "center",
|
|
1318
|
-
backgroundColor:
|
|
1662
|
+
backgroundColor: at.fontSecondary,
|
|
1319
1663
|
borderWidth: 1,
|
|
1320
|
-
borderColor:
|
|
1664
|
+
borderColor: at.fontSecondary,
|
|
1321
1665
|
borderRadius: tokens.radius.md,
|
|
1322
1666
|
paddingVertical,
|
|
1323
1667
|
paddingLeft: paddingHorizontal,
|
|
@@ -1328,7 +1672,7 @@ function getSelectStyles(tokens, gamut, disabled, size, isOpen) {
|
|
|
1328
1672
|
flex: 1,
|
|
1329
1673
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1330
1674
|
fontSize,
|
|
1331
|
-
color: disabled ?
|
|
1675
|
+
color: disabled ? at.fontTertiary : at.divider
|
|
1332
1676
|
},
|
|
1333
1677
|
iconWrapper: {
|
|
1334
1678
|
position: "absolute",
|
|
@@ -1341,7 +1685,7 @@ function getSelectStyles(tokens, gamut, disabled, size, isOpen) {
|
|
|
1341
1685
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1342
1686
|
fontSize: tokens.typography.fontSizes["01"],
|
|
1343
1687
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1344
|
-
color:
|
|
1688
|
+
color: at.fontTertiary,
|
|
1345
1689
|
textTransform: "uppercase",
|
|
1346
1690
|
letterSpacing: 0.5,
|
|
1347
1691
|
paddingVertical: tokens.spacing["04"],
|
|
@@ -1460,11 +1804,14 @@ function SelectOptionRow({
|
|
|
1460
1804
|
size
|
|
1461
1805
|
}) {
|
|
1462
1806
|
const tokens = useTokens(1);
|
|
1807
|
+
const frameCtx = useFrameContext();
|
|
1808
|
+
const at = tokens.colors[frameCtx?.theme ?? "primary"][frameCtx?.appearance ?? "main"];
|
|
1809
|
+
const emphasisAt = tokens.colors[frameCtx?.theme ?? "primary"].emphasis;
|
|
1463
1810
|
const paddingVertical = size === "sm" ? tokens.spacing["04"] : tokens.spacing["08"];
|
|
1464
1811
|
const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
|
|
1465
1812
|
const fontSize = size === "sm" ? tokens.typography.fontSizes["04"] : tokens.typography.fontSizes["05"];
|
|
1466
1813
|
if (renderOption) {
|
|
1467
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1468
1815
|
Pressable,
|
|
1469
1816
|
{
|
|
1470
1817
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1475,7 +1822,7 @@ function SelectOptionRow({
|
|
|
1475
1822
|
renderOption(option, { isSelected, isFocused })
|
|
1476
1823
|
);
|
|
1477
1824
|
}
|
|
1478
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1479
1826
|
Pressable,
|
|
1480
1827
|
{
|
|
1481
1828
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1491,10 +1838,10 @@ function SelectOptionRow({
|
|
|
1491
1838
|
paddingHorizontal
|
|
1492
1839
|
},
|
|
1493
1840
|
isSelected && {
|
|
1494
|
-
backgroundColor:
|
|
1841
|
+
backgroundColor: at.fontSecondary
|
|
1495
1842
|
},
|
|
1496
1843
|
isFocused && !isSelected && {
|
|
1497
|
-
backgroundColor: `${
|
|
1844
|
+
backgroundColor: `${at.fontSecondary}20`
|
|
1498
1845
|
},
|
|
1499
1846
|
option.disabled && {
|
|
1500
1847
|
opacity: 0.5
|
|
@@ -1504,7 +1851,7 @@ function SelectOptionRow({
|
|
|
1504
1851
|
}
|
|
1505
1852
|
]
|
|
1506
1853
|
},
|
|
1507
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ React16.createElement(
|
|
1508
1855
|
Text,
|
|
1509
1856
|
{
|
|
1510
1857
|
style: [
|
|
@@ -1512,26 +1859,26 @@ function SelectOptionRow({
|
|
|
1512
1859
|
flex: 1,
|
|
1513
1860
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1514
1861
|
fontSize,
|
|
1515
|
-
color:
|
|
1862
|
+
color: at.divider
|
|
1516
1863
|
},
|
|
1517
1864
|
isSelected && {
|
|
1518
1865
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1519
|
-
color:
|
|
1866
|
+
color: emphasisAt.divider
|
|
1520
1867
|
},
|
|
1521
1868
|
option.disabled && {
|
|
1522
|
-
color:
|
|
1869
|
+
color: at.fontTertiary
|
|
1523
1870
|
}
|
|
1524
1871
|
],
|
|
1525
1872
|
numberOfLines: 1
|
|
1526
1873
|
},
|
|
1527
1874
|
option.label
|
|
1528
1875
|
),
|
|
1529
|
-
isSelected && /* @__PURE__ */
|
|
1876
|
+
isSelected && /* @__PURE__ */ React16.createElement(View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React16.createElement(
|
|
1530
1877
|
Icon,
|
|
1531
1878
|
{
|
|
1532
1879
|
name: "check",
|
|
1533
1880
|
size: fontSize,
|
|
1534
|
-
color:
|
|
1881
|
+
color: emphasisAt.divider
|
|
1535
1882
|
}
|
|
1536
1883
|
))
|
|
1537
1884
|
);
|
|
@@ -1562,6 +1909,7 @@ function Select({
|
|
|
1562
1909
|
style
|
|
1563
1910
|
}) {
|
|
1564
1911
|
const tokens = useTokens(1);
|
|
1912
|
+
const frameCtx = useFrameContext();
|
|
1565
1913
|
const { isOpen, open, close, toggle } = usePopover();
|
|
1566
1914
|
const flatOptions = useMemo(() => flattenOptions(options), [options]);
|
|
1567
1915
|
const { focusedIndex, handleKeyDown } = useSelect({
|
|
@@ -1575,15 +1923,18 @@ function Select({
|
|
|
1575
1923
|
onClose: close,
|
|
1576
1924
|
onOpen: open
|
|
1577
1925
|
});
|
|
1926
|
+
const inheritedTheme = frameCtx?.theme;
|
|
1927
|
+
const inheritedAppearance = frameCtx?.appearance;
|
|
1578
1928
|
const styles = useMemo(
|
|
1579
|
-
() => getSelectStyles(tokens,
|
|
1580
|
-
[tokens, disabled, size, isOpen]
|
|
1929
|
+
() => getSelectStyles(tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance),
|
|
1930
|
+
[tokens, disabled, size, isOpen, inheritedTheme, inheritedAppearance]
|
|
1581
1931
|
);
|
|
1582
1932
|
const selectedOption = flatOptions.find((o) => o.value === value);
|
|
1583
1933
|
const displayLabel = selectedOption?.label ?? placeholder ?? value;
|
|
1584
|
-
const
|
|
1934
|
+
const at = tokens.colors[inheritedTheme ?? "primary"][inheritedAppearance ?? "main"];
|
|
1935
|
+
const iconColor = disabled ? at.fontTertiary : at.divider;
|
|
1585
1936
|
const triggerWebProps = { onKeyDown: handleKeyDown };
|
|
1586
|
-
const trigger = /* @__PURE__ */
|
|
1937
|
+
const trigger = /* @__PURE__ */ React16.createElement(
|
|
1587
1938
|
Pressable,
|
|
1588
1939
|
{
|
|
1589
1940
|
onPress: disabled ? void 0 : toggle,
|
|
@@ -1593,8 +1944,8 @@ function Select({
|
|
|
1593
1944
|
...triggerWebProps,
|
|
1594
1945
|
style: styles.trigger
|
|
1595
1946
|
},
|
|
1596
|
-
renderValue ? renderValue(selectedOption) : /* @__PURE__ */
|
|
1597
|
-
/* @__PURE__ */
|
|
1947
|
+
renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React16.createElement(Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
|
|
1948
|
+
/* @__PURE__ */ React16.createElement(View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React16.createElement(
|
|
1598
1949
|
Icon,
|
|
1599
1950
|
{
|
|
1600
1951
|
name: isOpen ? "expand_less" : "expand_more",
|
|
@@ -1603,14 +1954,14 @@ function Select({
|
|
|
1603
1954
|
}
|
|
1604
1955
|
))
|
|
1605
1956
|
);
|
|
1606
|
-
return /* @__PURE__ */
|
|
1957
|
+
return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React16.createElement(
|
|
1607
1958
|
Popover,
|
|
1608
1959
|
{
|
|
1609
1960
|
isOpen: isOpen && !disabled,
|
|
1610
1961
|
onClose: close,
|
|
1611
1962
|
trigger
|
|
1612
1963
|
},
|
|
1613
|
-
/* @__PURE__ */
|
|
1964
|
+
/* @__PURE__ */ React16.createElement(
|
|
1614
1965
|
ScrollView,
|
|
1615
1966
|
{
|
|
1616
1967
|
bounces: false,
|
|
@@ -1619,7 +1970,7 @@ function Select({
|
|
|
1619
1970
|
},
|
|
1620
1971
|
options.map((item) => {
|
|
1621
1972
|
if (isOptionGroup(item)) {
|
|
1622
|
-
return /* @__PURE__ */
|
|
1973
|
+
return /* @__PURE__ */ React16.createElement(View, { key: item.label }, /* @__PURE__ */ React16.createElement(Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React16.createElement(
|
|
1623
1974
|
SelectOptionRow,
|
|
1624
1975
|
{
|
|
1625
1976
|
key: opt.value,
|
|
@@ -1635,7 +1986,7 @@ function Select({
|
|
|
1635
1986
|
}
|
|
1636
1987
|
)));
|
|
1637
1988
|
}
|
|
1638
|
-
return /* @__PURE__ */
|
|
1989
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1639
1990
|
SelectOptionRow,
|
|
1640
1991
|
{
|
|
1641
1992
|
key: item.value,
|
|
@@ -1658,7 +2009,9 @@ var TRACK_WIDTH = 40;
|
|
|
1658
2009
|
var TRACK_HEIGHT = 22;
|
|
1659
2010
|
var THUMB_SIZE = 18;
|
|
1660
2011
|
var THUMB_OFFSET = 2;
|
|
1661
|
-
function getToggleStyles(tokens,
|
|
2012
|
+
function getToggleStyles(tokens, value, disabled, theme = "primary", appearance = "main") {
|
|
2013
|
+
const at = tokens.colors[theme][appearance];
|
|
2014
|
+
const emphasisAt = tokens.colors[theme].emphasis;
|
|
1662
2015
|
return StyleSheet.create({
|
|
1663
2016
|
container: {
|
|
1664
2017
|
flexDirection: "row",
|
|
@@ -1670,13 +2023,13 @@ function getToggleStyles(tokens, gamut, value, disabled) {
|
|
|
1670
2023
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1671
2024
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1672
2025
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1673
|
-
color:
|
|
2026
|
+
color: at.fontTertiary
|
|
1674
2027
|
},
|
|
1675
2028
|
track: {
|
|
1676
2029
|
width: TRACK_WIDTH,
|
|
1677
2030
|
height: TRACK_HEIGHT,
|
|
1678
2031
|
borderRadius: TRACK_HEIGHT / 2,
|
|
1679
|
-
backgroundColor: value ?
|
|
2032
|
+
backgroundColor: value ? emphasisAt.divider : at.fontSecondary,
|
|
1680
2033
|
justifyContent: "center",
|
|
1681
2034
|
paddingHorizontal: THUMB_OFFSET
|
|
1682
2035
|
},
|
|
@@ -1684,7 +2037,7 @@ function getToggleStyles(tokens, gamut, value, disabled) {
|
|
|
1684
2037
|
width: THUMB_SIZE,
|
|
1685
2038
|
height: THUMB_SIZE,
|
|
1686
2039
|
borderRadius: THUMB_SIZE / 2,
|
|
1687
|
-
backgroundColor:
|
|
2040
|
+
backgroundColor: at.background,
|
|
1688
2041
|
alignSelf: value ? "flex-end" : "flex-start"
|
|
1689
2042
|
}
|
|
1690
2043
|
});
|
|
@@ -1699,16 +2052,17 @@ function Toggle({
|
|
|
1699
2052
|
style
|
|
1700
2053
|
}) {
|
|
1701
2054
|
const tokens = useTokens(1);
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1704
|
-
|
|
2055
|
+
const frameCtx = useFrameContext();
|
|
2056
|
+
const styles = React16.useMemo(
|
|
2057
|
+
() => getToggleStyles(tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance),
|
|
2058
|
+
[tokens, value, disabled, frameCtx?.theme, frameCtx?.appearance]
|
|
1705
2059
|
);
|
|
1706
|
-
const handlePress =
|
|
2060
|
+
const handlePress = React16.useCallback(() => {
|
|
1707
2061
|
if (!disabled) {
|
|
1708
2062
|
onValueChange(!value);
|
|
1709
2063
|
}
|
|
1710
2064
|
}, [disabled, value, onValueChange]);
|
|
1711
|
-
return /* @__PURE__ */
|
|
2065
|
+
return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React16.createElement(
|
|
1712
2066
|
Pressable,
|
|
1713
2067
|
{
|
|
1714
2068
|
onPress: handlePress,
|
|
@@ -1716,12 +2070,12 @@ function Toggle({
|
|
|
1716
2070
|
accessibilityRole: "switch",
|
|
1717
2071
|
accessibilityState: { checked: value, disabled }
|
|
1718
2072
|
},
|
|
1719
|
-
/* @__PURE__ */
|
|
2073
|
+
/* @__PURE__ */ React16.createElement(View, { style: styles.track }, /* @__PURE__ */ React16.createElement(View, { style: styles.thumb }))
|
|
1720
2074
|
));
|
|
1721
2075
|
}
|
|
1722
2076
|
var TRACK_HEIGHT2 = 6;
|
|
1723
2077
|
var THUMB_SIZE2 = 16;
|
|
1724
|
-
function getSliderStyles(tokens,
|
|
2078
|
+
function getSliderStyles(tokens, disabled) {
|
|
1725
2079
|
return StyleSheet.create({
|
|
1726
2080
|
container: {
|
|
1727
2081
|
gap: tokens.spacing["04"],
|
|
@@ -1736,23 +2090,23 @@ function getSliderStyles(tokens, gamut, disabled) {
|
|
|
1736
2090
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1737
2091
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1738
2092
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1739
|
-
color: tokens.
|
|
2093
|
+
color: tokens.colors.primary.main.fontTertiary
|
|
1740
2094
|
},
|
|
1741
2095
|
value: {
|
|
1742
2096
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1743
2097
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1744
2098
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1745
|
-
color: tokens.
|
|
2099
|
+
color: tokens.colors.primary.main.divider
|
|
1746
2100
|
},
|
|
1747
2101
|
valueInput: {
|
|
1748
2102
|
width: 48,
|
|
1749
2103
|
paddingVertical: 0,
|
|
1750
2104
|
paddingHorizontal: 4,
|
|
1751
2105
|
borderWidth: 1,
|
|
1752
|
-
borderColor: tokens.
|
|
2106
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
1753
2107
|
borderRadius: 4,
|
|
1754
2108
|
backgroundColor: "transparent",
|
|
1755
|
-
color: tokens.
|
|
2109
|
+
color: tokens.colors.primary.main.divider,
|
|
1756
2110
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1757
2111
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1758
2112
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
@@ -1769,21 +2123,21 @@ function getSliderStyles(tokens, gamut, disabled) {
|
|
|
1769
2123
|
right: 0,
|
|
1770
2124
|
height: TRACK_HEIGHT2,
|
|
1771
2125
|
borderRadius: TRACK_HEIGHT2 / 2,
|
|
1772
|
-
backgroundColor: tokens.
|
|
2126
|
+
backgroundColor: tokens.colors.primary.main.fontSecondary
|
|
1773
2127
|
},
|
|
1774
2128
|
trackFill: {
|
|
1775
2129
|
position: "absolute",
|
|
1776
2130
|
left: 0,
|
|
1777
2131
|
height: TRACK_HEIGHT2,
|
|
1778
2132
|
borderRadius: TRACK_HEIGHT2 / 2,
|
|
1779
|
-
backgroundColor: tokens.
|
|
2133
|
+
backgroundColor: tokens.colors.primary.emphasis.divider
|
|
1780
2134
|
},
|
|
1781
2135
|
thumb: {
|
|
1782
2136
|
position: "absolute",
|
|
1783
2137
|
width: THUMB_SIZE2,
|
|
1784
2138
|
height: THUMB_SIZE2,
|
|
1785
2139
|
borderRadius: THUMB_SIZE2 / 2,
|
|
1786
|
-
backgroundColor: tokens.
|
|
2140
|
+
backgroundColor: tokens.colors.primary.emphasis.divider
|
|
1787
2141
|
}
|
|
1788
2142
|
});
|
|
1789
2143
|
}
|
|
@@ -1802,42 +2156,42 @@ function Slider({
|
|
|
1802
2156
|
style
|
|
1803
2157
|
}) {
|
|
1804
2158
|
const tokens = useTokens(1);
|
|
1805
|
-
const styles =
|
|
1806
|
-
() => getSliderStyles(tokens,
|
|
2159
|
+
const styles = React16.useMemo(
|
|
2160
|
+
() => getSliderStyles(tokens, disabled),
|
|
1807
2161
|
[tokens, disabled]
|
|
1808
2162
|
);
|
|
1809
|
-
const trackRef =
|
|
1810
|
-
const trackWidth =
|
|
1811
|
-
const trackPageX =
|
|
1812
|
-
const [layoutWidth, setLayoutWidth] =
|
|
1813
|
-
const onValueChangeRef =
|
|
1814
|
-
const minRef =
|
|
1815
|
-
const maxRef =
|
|
1816
|
-
const stepRef =
|
|
1817
|
-
const disabledRef =
|
|
1818
|
-
|
|
2163
|
+
const trackRef = React16.useRef(null);
|
|
2164
|
+
const trackWidth = React16.useRef(0);
|
|
2165
|
+
const trackPageX = React16.useRef(0);
|
|
2166
|
+
const [layoutWidth, setLayoutWidth] = React16.useState(0);
|
|
2167
|
+
const onValueChangeRef = React16.useRef(onValueChange);
|
|
2168
|
+
const minRef = React16.useRef(min);
|
|
2169
|
+
const maxRef = React16.useRef(max);
|
|
2170
|
+
const stepRef = React16.useRef(step);
|
|
2171
|
+
const disabledRef = React16.useRef(disabled);
|
|
2172
|
+
React16.useEffect(() => {
|
|
1819
2173
|
onValueChangeRef.current = onValueChange;
|
|
1820
2174
|
}, [onValueChange]);
|
|
1821
|
-
|
|
2175
|
+
React16.useEffect(() => {
|
|
1822
2176
|
minRef.current = min;
|
|
1823
2177
|
}, [min]);
|
|
1824
|
-
|
|
2178
|
+
React16.useEffect(() => {
|
|
1825
2179
|
maxRef.current = max;
|
|
1826
2180
|
}, [max]);
|
|
1827
|
-
|
|
2181
|
+
React16.useEffect(() => {
|
|
1828
2182
|
stepRef.current = step;
|
|
1829
2183
|
}, [step]);
|
|
1830
|
-
|
|
2184
|
+
React16.useEffect(() => {
|
|
1831
2185
|
disabledRef.current = disabled;
|
|
1832
2186
|
}, [disabled]);
|
|
1833
|
-
const computeValue =
|
|
2187
|
+
const computeValue = React16.useCallback((pageX) => {
|
|
1834
2188
|
const localX = pageX - trackPageX.current;
|
|
1835
2189
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
1836
2190
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
1837
2191
|
const stepped = Math.round(raw / stepRef.current) * stepRef.current;
|
|
1838
2192
|
return Math.min(maxRef.current, Math.max(minRef.current, stepped));
|
|
1839
2193
|
}, []);
|
|
1840
|
-
const panResponder =
|
|
2194
|
+
const panResponder = React16.useRef(
|
|
1841
2195
|
PanResponder.create({
|
|
1842
2196
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
1843
2197
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -1865,7 +2219,7 @@ function Slider({
|
|
|
1865
2219
|
fillLeft = 0;
|
|
1866
2220
|
fillWidth = thumbLeft + THUMB_SIZE2 / 2;
|
|
1867
2221
|
}
|
|
1868
|
-
const handleValueTextSubmit =
|
|
2222
|
+
const handleValueTextSubmit = React16.useCallback(
|
|
1869
2223
|
(text) => {
|
|
1870
2224
|
const raw = Number(text);
|
|
1871
2225
|
if (!Number.isNaN(raw)) {
|
|
@@ -1874,12 +2228,12 @@ function Slider({
|
|
|
1874
2228
|
},
|
|
1875
2229
|
[onValueChange, min, max]
|
|
1876
2230
|
);
|
|
1877
|
-
const [editText, setEditText] =
|
|
1878
|
-
|
|
2231
|
+
const [editText, setEditText] = React16.useState(String(value));
|
|
2232
|
+
React16.useEffect(() => {
|
|
1879
2233
|
setEditText(String(value));
|
|
1880
2234
|
}, [value]);
|
|
1881
2235
|
const showLabel = label || showValue || editableValue;
|
|
1882
|
-
return /* @__PURE__ */
|
|
2236
|
+
return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16.createElement(
|
|
1883
2237
|
TextInput$1,
|
|
1884
2238
|
{
|
|
1885
2239
|
style: styles.valueInput,
|
|
@@ -1891,7 +2245,7 @@ function Slider({
|
|
|
1891
2245
|
selectTextOnFocus: true,
|
|
1892
2246
|
editable: !disabled
|
|
1893
2247
|
}
|
|
1894
|
-
) : showValue && /* @__PURE__ */
|
|
2248
|
+
) : showValue && /* @__PURE__ */ React16.createElement(Text, { style: styles.value }, value)), /* @__PURE__ */ React16.createElement(
|
|
1895
2249
|
View,
|
|
1896
2250
|
{
|
|
1897
2251
|
ref: trackRef,
|
|
@@ -1906,9 +2260,9 @@ function Slider({
|
|
|
1906
2260
|
},
|
|
1907
2261
|
...panResponder.panHandlers
|
|
1908
2262
|
},
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
2263
|
+
/* @__PURE__ */ React16.createElement(View, { style: styles.trackRail }),
|
|
2264
|
+
/* @__PURE__ */ React16.createElement(View, { style: [styles.trackFill, { left: fillLeft, width: fillWidth }] }),
|
|
2265
|
+
/* @__PURE__ */ React16.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
1912
2266
|
));
|
|
1913
2267
|
}
|
|
1914
2268
|
var TRACK_HEIGHT3 = 22;
|
|
@@ -1926,7 +2280,7 @@ function buildHueSegments(min, max) {
|
|
|
1926
2280
|
return hueToHex(hue);
|
|
1927
2281
|
});
|
|
1928
2282
|
}
|
|
1929
|
-
function getHueSliderStyles(tokens,
|
|
2283
|
+
function getHueSliderStyles(tokens, disabled) {
|
|
1930
2284
|
return StyleSheet.create({
|
|
1931
2285
|
container: {
|
|
1932
2286
|
gap: tokens.spacing["04"],
|
|
@@ -1941,23 +2295,23 @@ function getHueSliderStyles(tokens, gamut, disabled) {
|
|
|
1941
2295
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1942
2296
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1943
2297
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1944
|
-
color: tokens.
|
|
2298
|
+
color: tokens.colors.primary.main.fontTertiary
|
|
1945
2299
|
},
|
|
1946
2300
|
value: {
|
|
1947
2301
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1948
2302
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1949
2303
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
1950
|
-
color: tokens.
|
|
2304
|
+
color: tokens.colors.primary.main.divider
|
|
1951
2305
|
},
|
|
1952
2306
|
valueInput: {
|
|
1953
2307
|
width: 48,
|
|
1954
2308
|
paddingVertical: 0,
|
|
1955
2309
|
paddingHorizontal: 4,
|
|
1956
2310
|
borderWidth: 1,
|
|
1957
|
-
borderColor: tokens.
|
|
2311
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
1958
2312
|
borderRadius: 4,
|
|
1959
2313
|
backgroundColor: "transparent",
|
|
1960
|
-
color: tokens.
|
|
2314
|
+
color: tokens.colors.primary.main.divider,
|
|
1961
2315
|
fontFamily: tokens.typography.fonts.main.family,
|
|
1962
2316
|
fontSize: tokens.typography.fontSizes["04"],
|
|
1963
2317
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
@@ -1987,7 +2341,7 @@ function getHueSliderStyles(tokens, gamut, disabled) {
|
|
|
1987
2341
|
borderRadius: THUMB_SIZE3 / 2,
|
|
1988
2342
|
backgroundColor: "#ffffff",
|
|
1989
2343
|
borderWidth: 2,
|
|
1990
|
-
borderColor: tokens.
|
|
2344
|
+
borderColor: tokens.colors.primary.main.fontSecondary
|
|
1991
2345
|
}
|
|
1992
2346
|
});
|
|
1993
2347
|
}
|
|
@@ -2005,42 +2359,42 @@ function HueSlider({
|
|
|
2005
2359
|
style
|
|
2006
2360
|
}) {
|
|
2007
2361
|
const tokens = useTokens(1);
|
|
2008
|
-
const styles =
|
|
2009
|
-
() => getHueSliderStyles(tokens,
|
|
2362
|
+
const styles = React16.useMemo(
|
|
2363
|
+
() => getHueSliderStyles(tokens, disabled),
|
|
2010
2364
|
[tokens, disabled]
|
|
2011
2365
|
);
|
|
2012
|
-
const segments =
|
|
2366
|
+
const segments = React16.useMemo(
|
|
2013
2367
|
() => buildHueSegments(min, max),
|
|
2014
2368
|
[min, max]
|
|
2015
2369
|
);
|
|
2016
|
-
const trackRef =
|
|
2017
|
-
const trackWidth =
|
|
2018
|
-
const trackPageX =
|
|
2019
|
-
const [layoutWidth, setLayoutWidth] =
|
|
2020
|
-
const onValueChangeRef =
|
|
2021
|
-
const minRef =
|
|
2022
|
-
const maxRef =
|
|
2023
|
-
const disabledRef =
|
|
2024
|
-
|
|
2370
|
+
const trackRef = React16.useRef(null);
|
|
2371
|
+
const trackWidth = React16.useRef(0);
|
|
2372
|
+
const trackPageX = React16.useRef(0);
|
|
2373
|
+
const [layoutWidth, setLayoutWidth] = React16.useState(0);
|
|
2374
|
+
const onValueChangeRef = React16.useRef(onValueChange);
|
|
2375
|
+
const minRef = React16.useRef(min);
|
|
2376
|
+
const maxRef = React16.useRef(max);
|
|
2377
|
+
const disabledRef = React16.useRef(disabled);
|
|
2378
|
+
React16.useEffect(() => {
|
|
2025
2379
|
onValueChangeRef.current = onValueChange;
|
|
2026
2380
|
}, [onValueChange]);
|
|
2027
|
-
|
|
2381
|
+
React16.useEffect(() => {
|
|
2028
2382
|
minRef.current = min;
|
|
2029
2383
|
}, [min]);
|
|
2030
|
-
|
|
2384
|
+
React16.useEffect(() => {
|
|
2031
2385
|
maxRef.current = max;
|
|
2032
2386
|
}, [max]);
|
|
2033
|
-
|
|
2387
|
+
React16.useEffect(() => {
|
|
2034
2388
|
disabledRef.current = disabled;
|
|
2035
2389
|
}, [disabled]);
|
|
2036
|
-
const computeHue =
|
|
2390
|
+
const computeHue = React16.useCallback((pageX) => {
|
|
2037
2391
|
const localX = pageX - trackPageX.current;
|
|
2038
2392
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2039
2393
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2040
2394
|
const stepped = Math.round(raw);
|
|
2041
2395
|
return (stepped % 360 + 360) % 360;
|
|
2042
2396
|
}, []);
|
|
2043
|
-
const panResponder =
|
|
2397
|
+
const panResponder = React16.useRef(
|
|
2044
2398
|
PanResponder.create({
|
|
2045
2399
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2046
2400
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2056,7 +2410,7 @@ function HueSlider({
|
|
|
2056
2410
|
const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
|
|
2057
2411
|
const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE3);
|
|
2058
2412
|
const thumbLeft = ratio * usableWidth;
|
|
2059
|
-
const handleValueTextSubmit =
|
|
2413
|
+
const handleValueTextSubmit = React16.useCallback(
|
|
2060
2414
|
(text) => {
|
|
2061
2415
|
const raw = Number(text);
|
|
2062
2416
|
if (!Number.isNaN(raw)) {
|
|
@@ -2065,12 +2419,12 @@ function HueSlider({
|
|
|
2065
2419
|
},
|
|
2066
2420
|
[onValueChange]
|
|
2067
2421
|
);
|
|
2068
|
-
const [editText, setEditText] =
|
|
2069
|
-
|
|
2422
|
+
const [editText, setEditText] = React16.useState(String(value));
|
|
2423
|
+
React16.useEffect(() => {
|
|
2070
2424
|
setEditText(String(value));
|
|
2071
2425
|
}, [value]);
|
|
2072
2426
|
const showLabel = label || showValue || editableValue;
|
|
2073
|
-
return /* @__PURE__ */
|
|
2427
|
+
return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React16.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React16.createElement(
|
|
2074
2428
|
TextInput$1,
|
|
2075
2429
|
{
|
|
2076
2430
|
style: styles.valueInput,
|
|
@@ -2082,7 +2436,7 @@ function HueSlider({
|
|
|
2082
2436
|
selectTextOnFocus: true,
|
|
2083
2437
|
editable: !disabled
|
|
2084
2438
|
}
|
|
2085
|
-
) : showValue && /* @__PURE__ */
|
|
2439
|
+
) : showValue && /* @__PURE__ */ React16.createElement(Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React16.createElement(
|
|
2086
2440
|
View,
|
|
2087
2441
|
{
|
|
2088
2442
|
ref: trackRef,
|
|
@@ -2097,8 +2451,8 @@ function HueSlider({
|
|
|
2097
2451
|
},
|
|
2098
2452
|
...panResponder.panHandlers
|
|
2099
2453
|
},
|
|
2100
|
-
/* @__PURE__ */
|
|
2101
|
-
/* @__PURE__ */
|
|
2454
|
+
/* @__PURE__ */ React16.createElement(View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React16.createElement(View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
|
|
2455
|
+
/* @__PURE__ */ React16.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2102
2456
|
));
|
|
2103
2457
|
}
|
|
2104
2458
|
|
|
@@ -2159,7 +2513,7 @@ function oklchToP3Css(color) {
|
|
|
2159
2513
|
}
|
|
2160
2514
|
var TRACK_HEIGHT4 = 22;
|
|
2161
2515
|
var THUMB_SIZE4 = 18;
|
|
2162
|
-
function getColorScaleSliderStyles(tokens,
|
|
2516
|
+
function getColorScaleSliderStyles(tokens, disabled) {
|
|
2163
2517
|
return StyleSheet.create({
|
|
2164
2518
|
container: {
|
|
2165
2519
|
gap: tokens.spacing["04"],
|
|
@@ -2174,7 +2528,7 @@ function getColorScaleSliderStyles(tokens, gamut, disabled) {
|
|
|
2174
2528
|
fontFamily: tokens.typography.fonts.main.family,
|
|
2175
2529
|
fontSize: tokens.typography.fontSizes["04"],
|
|
2176
2530
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2177
|
-
color: tokens.
|
|
2531
|
+
color: tokens.colors.primary.main.fontTertiary
|
|
2178
2532
|
},
|
|
2179
2533
|
trackContainer: {
|
|
2180
2534
|
height: TRACK_HEIGHT4 + THUMB_SIZE4,
|
|
@@ -2200,13 +2554,13 @@ function getColorScaleSliderStyles(tokens, gamut, disabled) {
|
|
|
2200
2554
|
borderRadius: THUMB_SIZE4 / 2,
|
|
2201
2555
|
backgroundColor: "#ffffff",
|
|
2202
2556
|
borderWidth: 2,
|
|
2203
|
-
borderColor: tokens.
|
|
2557
|
+
borderColor: tokens.colors.primary.main.fontSecondary
|
|
2204
2558
|
},
|
|
2205
2559
|
warning: {
|
|
2206
2560
|
fontFamily: tokens.typography.fonts.main.family,
|
|
2207
2561
|
fontSize: tokens.typography.fontSizes["01"],
|
|
2208
2562
|
fontWeight: tokens.typography.fonts.main.weights.medium,
|
|
2209
|
-
color: tokens.error.
|
|
2563
|
+
color: tokens.colors.error.emphasis.divider
|
|
2210
2564
|
}
|
|
2211
2565
|
});
|
|
2212
2566
|
}
|
|
@@ -2226,37 +2580,38 @@ function ColorScaleSlider({
|
|
|
2226
2580
|
style
|
|
2227
2581
|
}) {
|
|
2228
2582
|
const tokens = useTokens(1);
|
|
2229
|
-
const
|
|
2230
|
-
|
|
2583
|
+
const { gamut } = useNewtoneTheme();
|
|
2584
|
+
const styles = React16.useMemo(
|
|
2585
|
+
() => getColorScaleSliderStyles(tokens, disabled),
|
|
2231
2586
|
[tokens, disabled]
|
|
2232
2587
|
);
|
|
2233
|
-
const trackRef =
|
|
2234
|
-
const trackWidth =
|
|
2235
|
-
const trackPageX =
|
|
2236
|
-
const isDragging =
|
|
2237
|
-
const thumbAnim =
|
|
2238
|
-
const [layoutWidth, setLayoutWidth] =
|
|
2239
|
-
const onValueChangeRef =
|
|
2240
|
-
const disabledRef =
|
|
2241
|
-
const colorsLengthRef =
|
|
2242
|
-
const trimEndsRef =
|
|
2243
|
-
const snapRef =
|
|
2244
|
-
|
|
2588
|
+
const trackRef = React16.useRef(null);
|
|
2589
|
+
const trackWidth = React16.useRef(0);
|
|
2590
|
+
const trackPageX = React16.useRef(0);
|
|
2591
|
+
const isDragging = React16.useRef(false);
|
|
2592
|
+
const thumbAnim = React16.useRef(new Animated.Value(0)).current;
|
|
2593
|
+
const [layoutWidth, setLayoutWidth] = React16.useState(0);
|
|
2594
|
+
const onValueChangeRef = React16.useRef(onValueChange);
|
|
2595
|
+
const disabledRef = React16.useRef(disabled);
|
|
2596
|
+
const colorsLengthRef = React16.useRef(colors.length);
|
|
2597
|
+
const trimEndsRef = React16.useRef(trimEnds);
|
|
2598
|
+
const snapRef = React16.useRef(snap);
|
|
2599
|
+
React16.useEffect(() => {
|
|
2245
2600
|
onValueChangeRef.current = onValueChange;
|
|
2246
2601
|
}, [onValueChange]);
|
|
2247
|
-
|
|
2602
|
+
React16.useEffect(() => {
|
|
2248
2603
|
disabledRef.current = disabled;
|
|
2249
2604
|
}, [disabled]);
|
|
2250
|
-
|
|
2605
|
+
React16.useEffect(() => {
|
|
2251
2606
|
colorsLengthRef.current = colors.length;
|
|
2252
2607
|
}, [colors.length]);
|
|
2253
|
-
|
|
2608
|
+
React16.useEffect(() => {
|
|
2254
2609
|
trimEndsRef.current = trimEnds;
|
|
2255
2610
|
}, [trimEnds]);
|
|
2256
|
-
|
|
2611
|
+
React16.useEffect(() => {
|
|
2257
2612
|
snapRef.current = snap;
|
|
2258
2613
|
}, [snap]);
|
|
2259
|
-
const computeNv =
|
|
2614
|
+
const computeNv = React16.useCallback((pageX) => {
|
|
2260
2615
|
const localX = pageX - trackPageX.current;
|
|
2261
2616
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2262
2617
|
const totalSteps2 = colorsLengthRef.current - 1;
|
|
@@ -2271,7 +2626,7 @@ function ColorScaleSlider({
|
|
|
2271
2626
|
}
|
|
2272
2627
|
return nv;
|
|
2273
2628
|
}, []);
|
|
2274
|
-
const panResponder =
|
|
2629
|
+
const panResponder = React16.useRef(
|
|
2275
2630
|
PanResponder.create({
|
|
2276
2631
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2277
2632
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2299,7 +2654,7 @@ function ColorScaleSlider({
|
|
|
2299
2654
|
const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
|
|
2300
2655
|
const usableWidth = Math.max(0, layoutWidth - THUMB_SIZE4);
|
|
2301
2656
|
const thumbLeft = ratio * usableWidth;
|
|
2302
|
-
|
|
2657
|
+
React16.useEffect(() => {
|
|
2303
2658
|
if (isDragging.current || !animateValue) {
|
|
2304
2659
|
thumbAnim.setValue(thumbLeft);
|
|
2305
2660
|
} else {
|
|
@@ -2310,7 +2665,7 @@ function ColorScaleSlider({
|
|
|
2310
2665
|
}).start();
|
|
2311
2666
|
}
|
|
2312
2667
|
}, [thumbLeft, animateValue, thumbAnim]);
|
|
2313
|
-
return /* @__PURE__ */
|
|
2668
|
+
return /* @__PURE__ */ React16.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React16.createElement(View, { style: styles.labelRow }, /* @__PURE__ */ React16.createElement(Text, { style: styles.label }, label)), /* @__PURE__ */ React16.createElement(
|
|
2314
2669
|
View,
|
|
2315
2670
|
{
|
|
2316
2671
|
ref: trackRef,
|
|
@@ -2325,17 +2680,18 @@ function ColorScaleSlider({
|
|
|
2325
2680
|
},
|
|
2326
2681
|
...panResponder.panHandlers
|
|
2327
2682
|
},
|
|
2328
|
-
/* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
), warning && /* @__PURE__ */
|
|
2683
|
+
/* @__PURE__ */ React16.createElement(View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React16.createElement(View, { key: i, style: [styles.segment, { backgroundColor: gamut === "p3" ? oklchToP3Css(color.oklch) : srgbToHex(color.srgb) }] }))),
|
|
2684
|
+
/* @__PURE__ */ React16.createElement(Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
|
|
2685
|
+
), warning && /* @__PURE__ */ React16.createElement(Text, { style: styles.warning }, warning));
|
|
2331
2686
|
}
|
|
2332
|
-
function getAppShellStyles(tokens,
|
|
2687
|
+
function getAppShellStyles(tokens, theme = "primary", appearance = "main") {
|
|
2688
|
+
const at = tokens.colors[theme][appearance];
|
|
2333
2689
|
return StyleSheet.create({
|
|
2334
2690
|
container: {
|
|
2335
2691
|
flex: 1,
|
|
2336
2692
|
flexDirection: "row",
|
|
2337
2693
|
overflow: "hidden",
|
|
2338
|
-
backgroundColor:
|
|
2694
|
+
backgroundColor: at.background
|
|
2339
2695
|
},
|
|
2340
2696
|
main: {
|
|
2341
2697
|
flex: 1,
|
|
@@ -2349,17 +2705,22 @@ function getAppShellStyles(tokens, gamut) {
|
|
|
2349
2705
|
// src/composites/layout/AppShell/AppShell.tsx
|
|
2350
2706
|
function AppShell({ sidebar, children }) {
|
|
2351
2707
|
const tokens = useTokens();
|
|
2352
|
-
const
|
|
2353
|
-
|
|
2708
|
+
const frameCtx = useFrameContext();
|
|
2709
|
+
const styles = React16.useMemo(
|
|
2710
|
+
() => getAppShellStyles(tokens, frameCtx?.theme, frameCtx?.appearance),
|
|
2711
|
+
[tokens, frameCtx?.theme, frameCtx?.appearance]
|
|
2712
|
+
);
|
|
2713
|
+
return /* @__PURE__ */ React16.createElement(View, { style: styles.container }, sidebar, /* @__PURE__ */ React16.createElement(View, { style: styles.main }, children));
|
|
2354
2714
|
}
|
|
2355
|
-
function getSidebarStyles({ tokens,
|
|
2356
|
-
const
|
|
2715
|
+
function getSidebarStyles({ tokens, width, bordered, theme = "primary", appearance = "main" }) {
|
|
2716
|
+
const at = tokens.colors[theme][appearance];
|
|
2717
|
+
const borderColor = at.fontSecondary;
|
|
2357
2718
|
return StyleSheet.create({
|
|
2358
2719
|
container: {
|
|
2359
2720
|
width,
|
|
2360
2721
|
flexShrink: 0,
|
|
2361
2722
|
flexDirection: "column",
|
|
2362
|
-
backgroundColor:
|
|
2723
|
+
backgroundColor: at.background,
|
|
2363
2724
|
borderRightWidth: bordered ? 1 : 0,
|
|
2364
2725
|
borderRightColor: borderColor
|
|
2365
2726
|
},
|
|
@@ -2388,14 +2749,16 @@ function Sidebar({
|
|
|
2388
2749
|
bordered = true
|
|
2389
2750
|
}) {
|
|
2390
2751
|
const tokens = useTokens();
|
|
2391
|
-
const
|
|
2392
|
-
|
|
2393
|
-
|
|
2752
|
+
const frameCtx = useFrameContext();
|
|
2753
|
+
const styles = React16.useMemo(
|
|
2754
|
+
() => getSidebarStyles({ tokens, width, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
|
|
2755
|
+
[tokens, width, bordered, frameCtx?.theme, frameCtx?.appearance]
|
|
2394
2756
|
);
|
|
2395
|
-
return /* @__PURE__ */
|
|
2757
|
+
return /* @__PURE__ */ React16.createElement(View, { style: styles.container }, header && /* @__PURE__ */ React16.createElement(View, { style: styles.header }, header), /* @__PURE__ */ React16.createElement(ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React16.createElement(View, { style: styles.footer }, footer));
|
|
2396
2758
|
}
|
|
2397
|
-
function getNavbarStyles({ tokens,
|
|
2398
|
-
const
|
|
2759
|
+
function getNavbarStyles({ tokens, height, bordered, theme = "primary", appearance = "main" }) {
|
|
2760
|
+
const at = tokens.colors[theme][appearance];
|
|
2761
|
+
const borderColor = at.fontSecondary;
|
|
2399
2762
|
return StyleSheet.create({
|
|
2400
2763
|
container: {
|
|
2401
2764
|
flexDirection: "row",
|
|
@@ -2403,7 +2766,7 @@ function getNavbarStyles({ tokens, gamut, height, bordered }) {
|
|
|
2403
2766
|
height,
|
|
2404
2767
|
flexShrink: 0,
|
|
2405
2768
|
paddingHorizontal: 24,
|
|
2406
|
-
backgroundColor:
|
|
2769
|
+
backgroundColor: at.background,
|
|
2407
2770
|
borderBottomWidth: bordered ? 1 : 0,
|
|
2408
2771
|
borderBottomColor: borderColor
|
|
2409
2772
|
},
|
|
@@ -2430,11 +2793,51 @@ function Navbar({
|
|
|
2430
2793
|
bordered = true
|
|
2431
2794
|
}) {
|
|
2432
2795
|
const tokens = useTokens();
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2435
|
-
|
|
2796
|
+
const frameCtx = useFrameContext();
|
|
2797
|
+
const styles = React16.useMemo(
|
|
2798
|
+
() => getNavbarStyles({ tokens, height, bordered, theme: frameCtx?.theme, appearance: frameCtx?.appearance }),
|
|
2799
|
+
[tokens, height, bordered, frameCtx?.theme, frameCtx?.appearance]
|
|
2800
|
+
);
|
|
2801
|
+
return /* @__PURE__ */ React16.createElement(View, { style: styles.container }, children ? children : /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(View, { style: styles.left }, left), /* @__PURE__ */ React16.createElement(View, { style: styles.right }, right)));
|
|
2802
|
+
}
|
|
2803
|
+
function LogoMonogram({ colorValue = 0, size = 32 }) {
|
|
2804
|
+
const fg = `rgb(${colorValue}, ${colorValue}, ${colorValue})`;
|
|
2805
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2806
|
+
"svg",
|
|
2807
|
+
{
|
|
2808
|
+
width: size,
|
|
2809
|
+
height: size,
|
|
2810
|
+
viewBox: "0 0 168 168",
|
|
2811
|
+
fill: "none",
|
|
2812
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2813
|
+
},
|
|
2814
|
+
/* @__PURE__ */ React16.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 }),
|
|
2815
|
+
/* @__PURE__ */ React16.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 }),
|
|
2816
|
+
/* @__PURE__ */ React16.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 }),
|
|
2817
|
+
/* @__PURE__ */ React16.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 }),
|
|
2818
|
+
/* @__PURE__ */ React16.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 })
|
|
2819
|
+
);
|
|
2820
|
+
}
|
|
2821
|
+
function LogoWordmark({ fill = "black" }) {
|
|
2822
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2823
|
+
"svg",
|
|
2824
|
+
{
|
|
2825
|
+
height: 32,
|
|
2826
|
+
viewBox: "0 0 504 168",
|
|
2827
|
+
fill: "none",
|
|
2828
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2829
|
+
},
|
|
2830
|
+
/* @__PURE__ */ React16.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 }),
|
|
2831
|
+
/* @__PURE__ */ React16.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 }),
|
|
2832
|
+
/* @__PURE__ */ React16.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 }),
|
|
2833
|
+
/* @__PURE__ */ React16.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 }),
|
|
2834
|
+
/* @__PURE__ */ React16.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 }),
|
|
2835
|
+
/* @__PURE__ */ React16.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 }),
|
|
2836
|
+
/* @__PURE__ */ React16.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 }),
|
|
2837
|
+
/* @__PURE__ */ React16.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 }),
|
|
2838
|
+
/* @__PURE__ */ React16.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 }),
|
|
2839
|
+
/* @__PURE__ */ React16.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 })
|
|
2436
2840
|
);
|
|
2437
|
-
return /* @__PURE__ */ React13.createElement(View, { style: styles.container }, children ? children : /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(View, { style: styles.left }, left), /* @__PURE__ */ React13.createElement(View, { style: styles.right }, right)));
|
|
2438
2841
|
}
|
|
2439
2842
|
|
|
2440
2843
|
// src/registry/registry.ts
|
|
@@ -2456,17 +2859,13 @@ var COMPONENTS = [
|
|
|
2456
2859
|
variants: [
|
|
2457
2860
|
{ id: "primary-md", label: "Primary", props: { variant: "primary", size: "md" } },
|
|
2458
2861
|
{ id: "secondary-md", label: "Secondary", props: { variant: "secondary", size: "md" } },
|
|
2459
|
-
{ id: "
|
|
2862
|
+
{ id: "ghost-md", label: "Ghost", props: { variant: "ghost", size: "md" } },
|
|
2460
2863
|
{ id: "primary-sm", label: "Primary Small", props: { variant: "primary", size: "sm" } },
|
|
2461
2864
|
{ id: "primary-lg", label: "Primary Large", props: { variant: "primary", size: "lg" } },
|
|
2462
|
-
{ id: "
|
|
2463
|
-
{ id: "accent-secondary", label: "Accent Secondary", props: { variant: "secondary", size: "md", semantic: "accent" } },
|
|
2464
|
-
{ id: "success-primary", label: "Success Primary", props: { variant: "primary", size: "md", semantic: "success" } },
|
|
2465
|
-
{ id: "error-primary", label: "Error Primary", props: { variant: "primary", size: "md", semantic: "error" } },
|
|
2466
|
-
{ id: "warning-primary", label: "Warning Primary", props: { variant: "primary", size: "md", semantic: "warning" } },
|
|
2865
|
+
{ id: "primary-xl", label: "Primary XL", props: { variant: "primary", size: "xl" } },
|
|
2467
2866
|
{ id: "icon-left", label: "Icon Left", props: { variant: "primary", size: "md", icon: "add" } },
|
|
2468
2867
|
{ id: "icon-right", label: "Icon Right", props: { variant: "primary", size: "md", icon: "arrow_forward", iconPosition: "right" } },
|
|
2469
|
-
{ id: "icon-only", label: "Icon Only", props: { variant: "
|
|
2868
|
+
{ id: "icon-only", label: "Icon Only", props: { variant: "ghost", size: "md", icon: "settings" } }
|
|
2470
2869
|
],
|
|
2471
2870
|
editableProps: [
|
|
2472
2871
|
{
|
|
@@ -2476,23 +2875,10 @@ var COMPONENTS = [
|
|
|
2476
2875
|
options: [
|
|
2477
2876
|
{ label: "Primary", value: "primary" },
|
|
2478
2877
|
{ label: "Secondary", value: "secondary" },
|
|
2479
|
-
{ label: "
|
|
2878
|
+
{ label: "Ghost", value: "ghost" }
|
|
2480
2879
|
],
|
|
2481
2880
|
defaultValue: "primary"
|
|
2482
2881
|
},
|
|
2483
|
-
{
|
|
2484
|
-
name: "semantic",
|
|
2485
|
-
label: "Semantic",
|
|
2486
|
-
control: "select",
|
|
2487
|
-
options: [
|
|
2488
|
-
{ label: "Neutral", value: "neutral" },
|
|
2489
|
-
{ label: "Accent", value: "accent" },
|
|
2490
|
-
{ label: "Success", value: "success" },
|
|
2491
|
-
{ label: "Warning", value: "warning" },
|
|
2492
|
-
{ label: "Error", value: "error" }
|
|
2493
|
-
],
|
|
2494
|
-
defaultValue: "neutral"
|
|
2495
|
-
},
|
|
2496
2882
|
{
|
|
2497
2883
|
name: "size",
|
|
2498
2884
|
label: "Size",
|
|
@@ -2500,7 +2886,8 @@ var COMPONENTS = [
|
|
|
2500
2886
|
options: [
|
|
2501
2887
|
{ label: "Small", value: "sm" },
|
|
2502
2888
|
{ label: "Medium", value: "md" },
|
|
2503
|
-
{ label: "Large", value: "lg" }
|
|
2889
|
+
{ label: "Large", value: "lg" },
|
|
2890
|
+
{ label: "Extra Large", value: "xl" }
|
|
2504
2891
|
],
|
|
2505
2892
|
defaultValue: "md"
|
|
2506
2893
|
},
|
|
@@ -3382,6 +3769,6 @@ var ICON_CATALOG = [
|
|
|
3382
3769
|
}
|
|
3383
3770
|
];
|
|
3384
3771
|
|
|
3385
|
-
export { AppShell, Button, CATEGORIES, COMPONENTS, Card, ColorScaleSlider, Frame, HueSlider, ICON_CATALOG, Icon, Navbar, Popover, Select, Sidebar, Slider, Text3 as Text, TextInput, Toggle, Wrapper, generateComponentCode, getCategory, getComponent, getComponentsByCategory, isOptionGroup, useFocusVisible, usePopover };
|
|
3772
|
+
export { AppShell, Button, CATEGORIES, COMPONENTS, Card, Chip, ColorScaleSlider, ContentCard, Divider, Frame, HueSlider, ICON_CATALOG, Icon, LogoMonogram, LogoWordmark, Navbar, Popover, Select, Sidebar, Slider, Text3 as Text, TextInput, Toggle, Wrapper, generateComponentCode, getCategory, getComponent, getComponentsByCategory, isOptionGroup, useFocusVisible, usePopover };
|
|
3386
3773
|
//# sourceMappingURL=index.js.map
|
|
3387
3774
|
//# sourceMappingURL=index.js.map
|