@newtonedev/components 0.1.3 → 0.1.5
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 +37 -0
- package/dist/composites/actions/Button/Button.d.ts.map +1 -0
- package/dist/composites/actions/Button/Button.styles.d.ts +63 -0
- package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -0
- package/dist/{Button → composites/actions/Button}/Button.types.d.ts +12 -3
- package/dist/composites/actions/Button/Button.types.d.ts.map +1 -0
- package/dist/composites/actions/Button/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/Select.d.ts.map +1 -0
- package/dist/{Select → composites/form-controls/Select}/Select.styles.d.ts +1 -1
- package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/Select.types.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/useSelect.d.ts.map +1 -0
- package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -0
- package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.styles.d.ts +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -0
- package/dist/composites/form-controls/TextInput/TextInput.types.d.ts.map +1 -0
- package/dist/composites/form-controls/TextInput/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -0
- package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.styles.d.ts +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -0
- package/dist/composites/form-controls/Toggle/Toggle.types.d.ts.map +1 -0
- package/dist/composites/form-controls/Toggle/index.d.ts.map +1 -0
- package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -0
- package/dist/{AppShell → composites/layout/AppShell}/AppShell.styles.d.ts +1 -1
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -0
- package/dist/composites/layout/AppShell/AppShell.types.d.ts.map +1 -0
- package/dist/composites/layout/AppShell/index.d.ts.map +1 -0
- package/dist/composites/layout/Card/Card.d.ts.map +1 -0
- package/dist/{Card → composites/layout/Card}/Card.styles.d.ts +1 -1
- package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -0
- package/dist/{Card → composites/layout/Card}/Card.types.d.ts +1 -1
- package/dist/composites/layout/Card/Card.types.d.ts.map +1 -0
- package/dist/composites/layout/Card/index.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -0
- package/dist/{Navbar → composites/layout/Navbar}/Navbar.styles.d.ts +1 -1
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/Navbar.types.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/index.d.ts.map +1 -0
- package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.styles.d.ts +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -0
- package/dist/composites/layout/Sidebar/Sidebar.types.d.ts.map +1 -0
- package/dist/composites/layout/Sidebar/index.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -0
- package/dist/{Popover → composites/overlays/Popover}/Popover.styles.d.ts +1 -1
- package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/Popover.types.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/index.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/usePopover.d.ts.map +1 -0
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -0
- package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -0
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +1 -0
- package/dist/composites/range-inputs/ColorScaleSlider/index.d.ts.map +1 -0
- package/dist/composites/range-inputs/HueSlider/HueSlider.d.ts.map +1 -0
- package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -0
- package/dist/composites/range-inputs/HueSlider/HueSlider.types.d.ts.map +1 -0
- package/dist/composites/range-inputs/HueSlider/index.d.ts.map +1 -0
- package/dist/composites/range-inputs/Slider/Slider.d.ts.map +1 -0
- package/dist/{Slider → composites/range-inputs/Slider}/Slider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -0
- package/dist/composites/range-inputs/Slider/Slider.types.d.ts.map +1 -0
- package/dist/composites/range-inputs/Slider/index.d.ts.map +1 -0
- package/dist/index.cjs +999 -620
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +955 -576
- package/dist/index.js.map +1 -1
- package/dist/primitives/Icon/Icon.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts +1 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +1 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/tokens/computeTokens.d.ts.map +1 -1
- package/dist/tokens/types.d.ts +10 -0
- package/dist/tokens/types.d.ts.map +1 -1
- package/dist/tokens/useTokens.d.ts +20 -2
- package/dist/tokens/useTokens.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/composites/actions/Button/Button.styles.ts +365 -0
- package/src/composites/actions/Button/Button.tsx +115 -0
- package/src/{Button → composites/actions/Button}/Button.types.ts +14 -3
- package/src/{Select → composites/form-controls/Select}/Select.styles.ts +1 -1
- package/src/{Select → composites/form-controls/Select}/Select.tsx +4 -4
- package/src/{Select → composites/form-controls/Select}/SelectOption.tsx +2 -2
- package/src/{TextInput → composites/form-controls/TextInput}/TextInput.styles.ts +1 -1
- package/src/{TextInput → composites/form-controls/TextInput}/TextInput.tsx +1 -1
- package/src/{Toggle → composites/form-controls/Toggle}/Toggle.styles.ts +1 -1
- package/src/{Toggle → composites/form-controls/Toggle}/Toggle.tsx +1 -1
- package/src/{AppShell → composites/layout/AppShell}/AppShell.styles.ts +1 -1
- package/src/{AppShell → composites/layout/AppShell}/AppShell.tsx +1 -1
- package/src/{Card → composites/layout/Card}/Card.styles.ts +1 -1
- package/src/{Card → composites/layout/Card}/Card.tsx +1 -1
- package/src/{Card → composites/layout/Card}/Card.types.ts +1 -1
- package/src/{Navbar → composites/layout/Navbar}/Navbar.styles.ts +1 -1
- package/src/{Navbar → composites/layout/Navbar}/Navbar.tsx +1 -1
- package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.styles.ts +1 -1
- package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.tsx +1 -1
- package/src/{Popover → composites/overlays/Popover}/Popover.styles.ts +1 -1
- package/src/{Popover → composites/overlays/Popover}/Popover.tsx +1 -1
- package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.styles.ts +1 -1
- package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.tsx +1 -1
- package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.styles.ts +1 -1
- package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.tsx +1 -1
- package/src/{Slider → composites/range-inputs/Slider}/Slider.styles.ts +1 -1
- package/src/{Slider → composites/range-inputs/Slider}/Slider.tsx +1 -1
- package/src/index.ts +27 -27
- package/src/primitives/Icon/Icon.tsx +16 -1
- package/src/primitives/Wrapper/Wrapper.types.ts +1 -1
- package/src/registry/registry.ts +213 -1
- package/src/tokens/computeTokens.ts +16 -0
- package/src/tokens/types.ts +10 -0
- package/src/tokens/useTokens.ts +25 -3
- package/dist/AppShell/AppShell.d.ts.map +0 -1
- package/dist/AppShell/AppShell.styles.d.ts.map +0 -1
- package/dist/AppShell/AppShell.types.d.ts.map +0 -1
- package/dist/AppShell/index.d.ts.map +0 -1
- package/dist/Button/Button.d.ts +0 -28
- package/dist/Button/Button.d.ts.map +0 -1
- package/dist/Button/Button.styles.d.ts +0 -46
- package/dist/Button/Button.styles.d.ts.map +0 -1
- package/dist/Button/Button.types.d.ts.map +0 -1
- package/dist/Button/index.d.ts.map +0 -1
- package/dist/Card/Card.d.ts.map +0 -1
- package/dist/Card/Card.styles.d.ts.map +0 -1
- package/dist/Card/Card.types.d.ts.map +0 -1
- package/dist/Card/index.d.ts.map +0 -1
- package/dist/ColorScaleSlider/ColorScaleSlider.d.ts.map +0 -1
- package/dist/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +0 -1
- package/dist/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +0 -1
- package/dist/ColorScaleSlider/index.d.ts.map +0 -1
- package/dist/HueSlider/HueSlider.d.ts.map +0 -1
- package/dist/HueSlider/HueSlider.styles.d.ts.map +0 -1
- package/dist/HueSlider/HueSlider.types.d.ts.map +0 -1
- package/dist/HueSlider/index.d.ts.map +0 -1
- package/dist/Navbar/Navbar.d.ts.map +0 -1
- package/dist/Navbar/Navbar.styles.d.ts.map +0 -1
- package/dist/Navbar/Navbar.types.d.ts.map +0 -1
- package/dist/Navbar/index.d.ts.map +0 -1
- package/dist/Popover/Popover.d.ts.map +0 -1
- package/dist/Popover/Popover.styles.d.ts.map +0 -1
- package/dist/Popover/Popover.types.d.ts.map +0 -1
- package/dist/Popover/index.d.ts.map +0 -1
- package/dist/Popover/usePopover.d.ts.map +0 -1
- package/dist/Select/Select.d.ts.map +0 -1
- package/dist/Select/Select.styles.d.ts.map +0 -1
- package/dist/Select/Select.types.d.ts.map +0 -1
- package/dist/Select/SelectOption.d.ts.map +0 -1
- package/dist/Select/index.d.ts.map +0 -1
- package/dist/Select/useSelect.d.ts.map +0 -1
- package/dist/Sidebar/Sidebar.d.ts.map +0 -1
- package/dist/Sidebar/Sidebar.styles.d.ts.map +0 -1
- package/dist/Sidebar/Sidebar.types.d.ts.map +0 -1
- package/dist/Sidebar/index.d.ts.map +0 -1
- package/dist/Slider/Slider.d.ts.map +0 -1
- package/dist/Slider/Slider.styles.d.ts.map +0 -1
- package/dist/Slider/Slider.types.d.ts.map +0 -1
- package/dist/Slider/index.d.ts.map +0 -1
- package/dist/TextInput/TextInput.d.ts.map +0 -1
- package/dist/TextInput/TextInput.styles.d.ts.map +0 -1
- package/dist/TextInput/TextInput.types.d.ts.map +0 -1
- package/dist/TextInput/index.d.ts.map +0 -1
- package/dist/Toggle/Toggle.d.ts.map +0 -1
- package/dist/Toggle/Toggle.styles.d.ts.map +0 -1
- package/dist/Toggle/Toggle.types.d.ts.map +0 -1
- package/dist/Toggle/index.d.ts.map +0 -1
- package/src/Button/Button.styles.ts +0 -133
- package/src/Button/Button.tsx +0 -86
- /package/dist/{Button → composites/actions/Button}/index.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/Select.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/Select.types.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/SelectOption.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/index.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/useSelect.d.ts +0 -0
- /package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.d.ts +0 -0
- /package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.types.d.ts +0 -0
- /package/dist/{TextInput → composites/form-controls/TextInput}/index.d.ts +0 -0
- /package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.d.ts +0 -0
- /package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.types.d.ts +0 -0
- /package/dist/{Toggle → composites/form-controls/Toggle}/index.d.ts +0 -0
- /package/dist/{AppShell → composites/layout/AppShell}/AppShell.d.ts +0 -0
- /package/dist/{AppShell → composites/layout/AppShell}/AppShell.types.d.ts +0 -0
- /package/dist/{AppShell → composites/layout/AppShell}/index.d.ts +0 -0
- /package/dist/{Card → composites/layout/Card}/Card.d.ts +0 -0
- /package/dist/{Card → composites/layout/Card}/index.d.ts +0 -0
- /package/dist/{Navbar → composites/layout/Navbar}/Navbar.d.ts +0 -0
- /package/dist/{Navbar → composites/layout/Navbar}/Navbar.types.d.ts +0 -0
- /package/dist/{Navbar → composites/layout/Navbar}/index.d.ts +0 -0
- /package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.d.ts +0 -0
- /package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.types.d.ts +0 -0
- /package/dist/{Sidebar → composites/layout/Sidebar}/index.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/Popover.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/Popover.types.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/index.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/usePopover.d.ts +0 -0
- /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.d.ts +0 -0
- /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.types.d.ts +0 -0
- /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/index.d.ts +0 -0
- /package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.d.ts +0 -0
- /package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.types.d.ts +0 -0
- /package/dist/{HueSlider → composites/range-inputs/HueSlider}/index.d.ts +0 -0
- /package/dist/{Slider → composites/range-inputs/Slider}/Slider.d.ts +0 -0
- /package/dist/{Slider → composites/range-inputs/Slider}/Slider.types.d.ts +0 -0
- /package/dist/{Slider → composites/range-inputs/Slider}/index.d.ts +0 -0
- /package/src/{Button → composites/actions/Button}/index.ts +0 -0
- /package/src/{Select → composites/form-controls/Select}/Select.types.ts +0 -0
- /package/src/{Select → composites/form-controls/Select}/index.ts +0 -0
- /package/src/{Select → composites/form-controls/Select}/useSelect.ts +0 -0
- /package/src/{TextInput → composites/form-controls/TextInput}/TextInput.types.ts +0 -0
- /package/src/{TextInput → composites/form-controls/TextInput}/index.ts +0 -0
- /package/src/{Toggle → composites/form-controls/Toggle}/Toggle.types.ts +0 -0
- /package/src/{Toggle → composites/form-controls/Toggle}/index.ts +0 -0
- /package/src/{AppShell → composites/layout/AppShell}/AppShell.types.ts +0 -0
- /package/src/{AppShell → composites/layout/AppShell}/index.ts +0 -0
- /package/src/{Card → composites/layout/Card}/index.ts +0 -0
- /package/src/{Navbar → composites/layout/Navbar}/Navbar.types.ts +0 -0
- /package/src/{Navbar → composites/layout/Navbar}/index.ts +0 -0
- /package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.types.ts +0 -0
- /package/src/{Sidebar → composites/layout/Sidebar}/index.ts +0 -0
- /package/src/{Popover → composites/overlays/Popover}/Popover.types.ts +0 -0
- /package/src/{Popover → composites/overlays/Popover}/index.ts +0 -0
- /package/src/{Popover → composites/overlays/Popover}/usePopover.ts +0 -0
- /package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.types.ts +0 -0
- /package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/index.ts +0 -0
- /package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.types.ts +0 -0
- /package/src/{HueSlider → composites/range-inputs/HueSlider}/index.ts +0 -0
- /package/src/{Slider → composites/range-inputs/Slider}/Slider.types.ts +0 -0
- /package/src/{Slider → composites/range-inputs/Slider}/index.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React13, { createContext, useState, useMemo, useContext, useEffect, useCallback, useRef } from 'react';
|
|
2
2
|
import { DEFAULT_NEUTRAL_SATURATION, DEFAULT_NEUTRAL_HUE, DEFAULT_ACCENT_SATURATION, DEFAULT_ACCENT_HUE, DEFAULT_SUCCESS_SATURATION, DEFAULT_SUCCESS_HUE, DEFAULT_WARNING_SATURATION, DEFAULT_WARNING_HUE, DEFAULT_ERROR_SATURATION, DEFAULT_ERROR_HUE, getColor, getColorByContrast, srgbToHex } from 'newtone';
|
|
3
|
-
import { Text,
|
|
3
|
+
import { Text, View, Pressable, TextInput as TextInput$1, ScrollView, PanResponder, Animated, StyleSheet } from 'react-native';
|
|
4
4
|
|
|
5
5
|
// src/theme/NewtoneProvider.tsx
|
|
6
6
|
var DEFAULT_THEME_CONFIG = {
|
|
@@ -205,7 +205,7 @@ function NewtoneProvider({
|
|
|
205
205
|
}),
|
|
206
206
|
[config, mode, theme]
|
|
207
207
|
);
|
|
208
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ React13.createElement(ThemeContext.Provider, { value }, /* @__PURE__ */ React13.createElement(GoogleFontLoader, { fonts: config.typography.fonts }), /* @__PURE__ */ React13.createElement(IconFontLoader, { icons: config.icons }), children);
|
|
209
209
|
}
|
|
210
210
|
function useNewtoneTheme() {
|
|
211
211
|
const context = useContext(ThemeContext);
|
|
@@ -258,6 +258,16 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
|
|
|
258
258
|
palette.desaturation,
|
|
259
259
|
palette.paletteHueGrading
|
|
260
260
|
);
|
|
261
|
+
const INTERACTIVE_COMPONENT_OFFSET = -0.035;
|
|
262
|
+
const interactiveComponentNv = Math.max(0, Math.min(1, backgroundNv + INTERACTIVE_COMPONENT_OFFSET));
|
|
263
|
+
const backgroundInteractive = getColor(
|
|
264
|
+
palette.hue,
|
|
265
|
+
palette.saturation,
|
|
266
|
+
dynamicRange,
|
|
267
|
+
interactiveComponentNv,
|
|
268
|
+
palette.desaturation,
|
|
269
|
+
palette.paletteHueGrading
|
|
270
|
+
);
|
|
261
271
|
const textPrimary = getColorByContrast(
|
|
262
272
|
palette.hue,
|
|
263
273
|
palette.saturation,
|
|
@@ -388,6 +398,7 @@ function computeTokens(config, mode, themeMapping, elevation, elevationOffsets,
|
|
|
388
398
|
background,
|
|
389
399
|
backgroundElevated,
|
|
390
400
|
backgroundSunken,
|
|
401
|
+
backgroundInteractive,
|
|
391
402
|
textPrimary,
|
|
392
403
|
textSecondary,
|
|
393
404
|
interactive,
|
|
@@ -425,7 +436,7 @@ function useTokens(elevation) {
|
|
|
425
436
|
const resolvedElevation = elevation ?? frameCtx?.elevation ?? 1;
|
|
426
437
|
return useMemo(() => {
|
|
427
438
|
const themeMapping = config.themes[resolvedTheme];
|
|
428
|
-
|
|
439
|
+
const tokens = computeTokens(
|
|
429
440
|
config.colorSystem,
|
|
430
441
|
mode,
|
|
431
442
|
themeMapping,
|
|
@@ -436,102 +447,228 @@ function useTokens(elevation) {
|
|
|
436
447
|
config.typography,
|
|
437
448
|
config.icons
|
|
438
449
|
);
|
|
450
|
+
return { ...tokens, elevation: resolvedElevation };
|
|
439
451
|
}, [config, mode, resolvedTheme, resolvedElevation]);
|
|
440
452
|
}
|
|
441
|
-
function
|
|
453
|
+
function withOpacity(hexColor, opacity) {
|
|
454
|
+
const alpha = Math.round(opacity * 255).toString(16).padStart(2, "0");
|
|
455
|
+
return `${hexColor}${alpha}`;
|
|
456
|
+
}
|
|
457
|
+
function computeButtonPadding(size, hasIcon, hasText, iconPosition) {
|
|
458
|
+
const basePadding = {
|
|
459
|
+
sm: 8,
|
|
460
|
+
md: 12,
|
|
461
|
+
lg: 16
|
|
462
|
+
};
|
|
463
|
+
const base = basePadding[size];
|
|
464
|
+
const textExtra = 8;
|
|
465
|
+
if (!hasText && hasIcon) {
|
|
466
|
+
return {
|
|
467
|
+
paddingLeft: base,
|
|
468
|
+
paddingRight: base,
|
|
469
|
+
paddingTop: base,
|
|
470
|
+
paddingBottom: base
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
if (hasText && !hasIcon) {
|
|
474
|
+
return {
|
|
475
|
+
paddingLeft: base + textExtra,
|
|
476
|
+
paddingRight: base + textExtra,
|
|
477
|
+
paddingTop: base,
|
|
478
|
+
paddingBottom: base
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
if (hasText && hasIcon) {
|
|
482
|
+
if (iconPosition === "left") {
|
|
483
|
+
return {
|
|
484
|
+
paddingLeft: base,
|
|
485
|
+
paddingRight: base + textExtra,
|
|
486
|
+
paddingTop: base,
|
|
487
|
+
paddingBottom: base
|
|
488
|
+
};
|
|
489
|
+
} else {
|
|
490
|
+
return {
|
|
491
|
+
paddingLeft: base + textExtra,
|
|
492
|
+
paddingRight: base,
|
|
493
|
+
paddingTop: base,
|
|
494
|
+
paddingBottom: base
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
paddingLeft: base,
|
|
500
|
+
paddingRight: base,
|
|
501
|
+
paddingTop: base,
|
|
502
|
+
paddingBottom: base
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
function getNeutralPrimaryBg(tokens) {
|
|
506
|
+
return srgbToHex(tokens.backgroundInteractive.srgb);
|
|
507
|
+
}
|
|
508
|
+
function getButtonConfig(variant, semantic, size, disabled, tokens) {
|
|
509
|
+
const sizeConfig = getSizeConfig(size, tokens);
|
|
510
|
+
const variantColors = getVariantColors(variant, semantic, disabled, tokens);
|
|
442
511
|
return {
|
|
512
|
+
variantColors,
|
|
513
|
+
sizeTokens: {
|
|
514
|
+
padding: sizeConfig.padding,
|
|
515
|
+
gap: sizeConfig.gap,
|
|
516
|
+
borderRadius: sizeConfig.borderRadius,
|
|
517
|
+
textSize: sizeConfig.textSize,
|
|
518
|
+
iconSize: sizeConfig.iconSize
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function getSizeConfig(size, tokens) {
|
|
523
|
+
const configs = {
|
|
443
524
|
sm: {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
iconSize:
|
|
525
|
+
padding: 8,
|
|
526
|
+
gap: tokens.spacing["08"],
|
|
527
|
+
borderRadius: 8,
|
|
528
|
+
textSize: "base",
|
|
529
|
+
// 16px
|
|
530
|
+
iconSize: 24
|
|
450
531
|
},
|
|
451
532
|
md: {
|
|
452
|
-
|
|
453
|
-
paddingHorizontal: tokens.spacing["16"],
|
|
454
|
-
fontSize: tokens.typography.size.base,
|
|
455
|
-
borderRadius: tokens.radius.md,
|
|
533
|
+
padding: 12,
|
|
456
534
|
gap: tokens.spacing["08"],
|
|
457
|
-
|
|
535
|
+
borderRadius: 12,
|
|
536
|
+
textSize: "base",
|
|
537
|
+
// 16px
|
|
538
|
+
iconSize: 24
|
|
458
539
|
},
|
|
459
540
|
lg: {
|
|
460
|
-
|
|
461
|
-
paddingHorizontal: tokens.spacing["24"],
|
|
462
|
-
fontSize: tokens.typography.size.base,
|
|
463
|
-
borderRadius: tokens.radius.lg,
|
|
541
|
+
padding: 16,
|
|
464
542
|
gap: tokens.spacing["08"],
|
|
465
|
-
|
|
543
|
+
borderRadius: 16,
|
|
544
|
+
textSize: "base",
|
|
545
|
+
// 16px
|
|
546
|
+
iconSize: 24
|
|
466
547
|
}
|
|
467
548
|
};
|
|
549
|
+
return configs[size];
|
|
468
550
|
}
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
551
|
+
function getVariantColors(variant, semantic, disabled, tokens) {
|
|
552
|
+
if (disabled) {
|
|
553
|
+
const baseColors = getVariantColorsForState(variant, semantic, tokens);
|
|
554
|
+
return {
|
|
555
|
+
...baseColors,
|
|
556
|
+
bg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
557
|
+
pressedBg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
558
|
+
textColor: srgbToHex(tokens.textSecondary.srgb),
|
|
559
|
+
iconColor: srgbToHex(tokens.textSecondary.srgb)
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
return getVariantColorsForState(variant, semantic, tokens);
|
|
563
|
+
}
|
|
564
|
+
function getVariantColorsForState(variant, semantic, tokens) {
|
|
565
|
+
const getSemanticColor = () => {
|
|
566
|
+
switch (semantic) {
|
|
567
|
+
case "accent":
|
|
568
|
+
return srgbToHex(tokens.interactive.srgb);
|
|
569
|
+
case "success":
|
|
570
|
+
return srgbToHex(tokens.success.srgb);
|
|
571
|
+
case "error":
|
|
572
|
+
return srgbToHex(tokens.error.srgb);
|
|
573
|
+
case "warning":
|
|
574
|
+
return srgbToHex(tokens.warning.srgb);
|
|
575
|
+
default:
|
|
576
|
+
return srgbToHex(tokens.textPrimary.srgb);
|
|
577
|
+
}
|
|
479
578
|
};
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
579
|
+
if (variant === "primary") {
|
|
580
|
+
if (semantic === "neutral") {
|
|
581
|
+
const bg = getNeutralPrimaryBg(tokens);
|
|
582
|
+
return {
|
|
583
|
+
bg,
|
|
584
|
+
pressedBg: withOpacity(bg, 0.8),
|
|
585
|
+
// Slightly darker on press
|
|
586
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
587
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
588
|
+
borderWidth: 1,
|
|
589
|
+
borderColor: "transparent"
|
|
590
|
+
// Invisible border for consistent sizing
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
if (semantic === "accent") {
|
|
594
|
+
return {
|
|
595
|
+
bg: srgbToHex(tokens.interactive.srgb),
|
|
596
|
+
pressedBg: srgbToHex(tokens.interactiveActive.srgb),
|
|
597
|
+
textColor: srgbToHex(tokens.background.srgb),
|
|
598
|
+
// Contrast inversion
|
|
599
|
+
iconColor: srgbToHex(tokens.background.srgb),
|
|
600
|
+
borderWidth: 1,
|
|
601
|
+
borderColor: "transparent"
|
|
602
|
+
// Invisible border for consistent sizing
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
const semanticColor = getSemanticColor();
|
|
606
|
+
return {
|
|
607
|
+
bg: semanticColor,
|
|
608
|
+
pressedBg: withOpacity(semanticColor, 0.8),
|
|
609
|
+
// Darken on press
|
|
610
|
+
textColor: srgbToHex(tokens.background.srgb),
|
|
611
|
+
// Contrast text
|
|
612
|
+
iconColor: srgbToHex(tokens.background.srgb),
|
|
613
|
+
borderWidth: 1,
|
|
614
|
+
borderColor: "transparent"
|
|
615
|
+
// Invisible border for consistent sizing
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
if (variant === "secondary") {
|
|
619
|
+
if (semantic === "neutral") {
|
|
620
|
+
return {
|
|
621
|
+
bg: "transparent",
|
|
622
|
+
pressedBg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
623
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
624
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
625
|
+
borderWidth: 1,
|
|
626
|
+
borderColor: srgbToHex(tokens.border.srgb)
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
const semanticColor = getSemanticColor();
|
|
630
|
+
return {
|
|
631
|
+
bg: withOpacity(semanticColor, 0.1),
|
|
632
|
+
// Light background tint
|
|
633
|
+
pressedBg: withOpacity(semanticColor, 0.15),
|
|
634
|
+
// Slightly darker on press
|
|
635
|
+
textColor: semanticColor,
|
|
636
|
+
iconColor: semanticColor,
|
|
637
|
+
borderWidth: 1,
|
|
638
|
+
borderColor: "transparent"
|
|
639
|
+
// Invisible border for consistent sizing
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
if (variant === "tertiary") {
|
|
643
|
+
if (semantic === "neutral") {
|
|
644
|
+
return {
|
|
645
|
+
bg: "transparent",
|
|
646
|
+
pressedBg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
647
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
648
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
649
|
+
borderWidth: 1,
|
|
650
|
+
borderColor: "transparent"
|
|
651
|
+
// Invisible border for consistent sizing
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
const semanticColor = getSemanticColor();
|
|
655
|
+
return {
|
|
656
|
+
bg: "transparent",
|
|
657
|
+
pressedBg: withOpacity(semanticColor, 0.1),
|
|
658
|
+
// Subtle background tint
|
|
659
|
+
textColor: semanticColor,
|
|
660
|
+
iconColor: semanticColor,
|
|
661
|
+
borderWidth: 1,
|
|
662
|
+
borderColor: "transparent"
|
|
663
|
+
// Invisible border for consistent sizing
|
|
664
|
+
};
|
|
503
665
|
}
|
|
504
|
-
const resolvedTextColor = disabled ? srgbToHex(tokens.textSecondary.srgb) : textColor;
|
|
505
666
|
return {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
backgroundColor: disabled ? srgbToHex(tokens.backgroundSunken.srgb) : backgroundColor,
|
|
512
|
-
borderWidth,
|
|
513
|
-
...borderColor && { borderColor }
|
|
514
|
-
},
|
|
515
|
-
pressed: {
|
|
516
|
-
backgroundColor: variant === "primary" ? srgbToHex(tokens.interactiveActive.srgb) : variant === "secondary" ? srgbToHex(tokens.backgroundSunken.srgb) : "transparent",
|
|
517
|
-
opacity: variant === "ghost" || variant === "outline" ? 0.7 : 1
|
|
518
|
-
},
|
|
519
|
-
disabled: {
|
|
520
|
-
opacity: 0.4
|
|
521
|
-
},
|
|
522
|
-
text: {
|
|
523
|
-
fontFamily: tokens.typography.fonts.default,
|
|
524
|
-
fontSize: sizeConfig.fontSize,
|
|
525
|
-
fontWeight: tokens.typography.weight.semibold,
|
|
526
|
-
color: resolvedTextColor
|
|
527
|
-
},
|
|
528
|
-
textPressed: {
|
|
529
|
-
// Color changes handled by parent opacity
|
|
530
|
-
},
|
|
531
|
-
textDisabled: {
|
|
532
|
-
// Color already set in text style via disabled check
|
|
533
|
-
}
|
|
534
|
-
})
|
|
667
|
+
bg: "transparent",
|
|
668
|
+
pressedBg: "transparent",
|
|
669
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
670
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
671
|
+
borderWidth: 0
|
|
535
672
|
};
|
|
536
673
|
}
|
|
537
674
|
function Icon({
|
|
@@ -553,13 +690,25 @@ function Icon({
|
|
|
553
690
|
const tokens = useTokens(elevation);
|
|
554
691
|
const iconStyle = useMemo(() => {
|
|
555
692
|
const fontSize = size ?? tokens.typography.size.base;
|
|
556
|
-
const
|
|
693
|
+
const getOpticalSize = (size2) => {
|
|
694
|
+
if (size2 <= 22) return 20;
|
|
695
|
+
if (size2 <= 32) return 24;
|
|
696
|
+
if (size2 <= 44) return 40;
|
|
697
|
+
return 48;
|
|
698
|
+
};
|
|
699
|
+
const opsz = opticalSize ?? getOpticalSize(fontSize);
|
|
557
700
|
const iconColor = color ?? srgbToHex(tokens.textPrimary.srgb);
|
|
558
701
|
const fontFamily = `Material Symbols ${tokens.icons.variant.charAt(0).toUpperCase() + tokens.icons.variant.slice(1)}`;
|
|
559
702
|
const fontVariationSettings = `'FILL' ${fill}, 'wght' ${tokens.icons.weight}, 'GRAD' ${tokens.icons.grade}, 'opsz' ${opsz}`;
|
|
560
703
|
return {
|
|
561
704
|
fontFamily,
|
|
562
705
|
fontSize,
|
|
706
|
+
width: fontSize,
|
|
707
|
+
// Explicit width ensures square rendering
|
|
708
|
+
height: fontSize,
|
|
709
|
+
// Explicit height ensures square rendering
|
|
710
|
+
lineHeight: fontSize,
|
|
711
|
+
// Prevent text line-height from affecting total height
|
|
563
712
|
color: iconColor,
|
|
564
713
|
userSelect: "none",
|
|
565
714
|
// web-only: prevents users from selecting the icon as text
|
|
@@ -568,7 +717,7 @@ function Icon({
|
|
|
568
717
|
...style
|
|
569
718
|
};
|
|
570
719
|
}, [tokens, size, opticalSize, fill, color, style]);
|
|
571
|
-
return /* @__PURE__ */
|
|
720
|
+
return /* @__PURE__ */ React13.createElement(
|
|
572
721
|
Text,
|
|
573
722
|
{
|
|
574
723
|
ref,
|
|
@@ -582,121 +731,57 @@ function Icon({
|
|
|
582
731
|
name
|
|
583
732
|
);
|
|
584
733
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
variant = "primary",
|
|
592
|
-
size = "md",
|
|
593
|
-
disabled = false,
|
|
594
|
-
style,
|
|
595
|
-
textStyle,
|
|
596
|
-
...pressableProps
|
|
597
|
-
}) {
|
|
598
|
-
const tokens = useTokens(1);
|
|
599
|
-
const isIconOnly = !!icon && !children;
|
|
600
|
-
const { styles, iconColor, iconSize } = React11.useMemo(
|
|
601
|
-
() => getButtonStyles(tokens, variant, size, disabled, isIconOnly),
|
|
602
|
-
[tokens, variant, size, disabled, isIconOnly]
|
|
603
|
-
);
|
|
604
|
-
const renderIcon = () => /* @__PURE__ */ React11.createElement(Icon, { name: icon, size: iconSize, color: iconColor });
|
|
605
|
-
return /* @__PURE__ */ React11.createElement(
|
|
606
|
-
Pressable,
|
|
607
|
-
{
|
|
608
|
-
style: ({ pressed }) => [
|
|
609
|
-
styles.base,
|
|
610
|
-
pressed && !disabled && styles.pressed,
|
|
611
|
-
disabled && styles.disabled,
|
|
612
|
-
...Array.isArray(style) ? style : [style]
|
|
613
|
-
],
|
|
614
|
-
disabled,
|
|
615
|
-
...pressableProps
|
|
616
|
-
},
|
|
617
|
-
({ pressed }) => /* @__PURE__ */ React11.createElement(React11.Fragment, null, icon && iconPosition === "left" && renderIcon(), children != null && /* @__PURE__ */ React11.createElement(
|
|
618
|
-
Text,
|
|
619
|
-
{
|
|
620
|
-
style: [
|
|
621
|
-
styles.text,
|
|
622
|
-
pressed && !disabled && styles.textPressed,
|
|
623
|
-
disabled && styles.textDisabled,
|
|
624
|
-
...Array.isArray(textStyle) ? textStyle : [textStyle]
|
|
625
|
-
]
|
|
626
|
-
},
|
|
627
|
-
children
|
|
628
|
-
), icon && iconPosition === "right" && renderIcon())
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
function getCardStyles(tokens, disabled) {
|
|
632
|
-
return StyleSheet.create({
|
|
633
|
-
container: {
|
|
634
|
-
backgroundColor: srgbToHex(tokens.background.srgb),
|
|
635
|
-
borderWidth: 1,
|
|
636
|
-
borderColor: srgbToHex(tokens.border.srgb),
|
|
637
|
-
borderRadius: tokens.radius.lg,
|
|
638
|
-
padding: tokens.spacing["16"],
|
|
639
|
-
opacity: disabled ? 0.5 : 1
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
// src/Card/Card.tsx
|
|
645
|
-
function Card({
|
|
734
|
+
var COLOR_MAP = {
|
|
735
|
+
primary: "textPrimary",
|
|
736
|
+
secondary: "textSecondary",
|
|
737
|
+
interactive: "interactive"
|
|
738
|
+
};
|
|
739
|
+
function Text2({
|
|
646
740
|
children,
|
|
741
|
+
size = "base",
|
|
742
|
+
weight = "regular",
|
|
743
|
+
color = "primary",
|
|
744
|
+
font = "default",
|
|
745
|
+
lineHeight = "normal",
|
|
746
|
+
align,
|
|
747
|
+
numberOfLines,
|
|
647
748
|
elevation = 1,
|
|
648
749
|
style,
|
|
649
|
-
|
|
750
|
+
// Accessibility
|
|
751
|
+
accessibilityRole,
|
|
752
|
+
// Testing & platform
|
|
753
|
+
testID,
|
|
754
|
+
nativeID,
|
|
755
|
+
ref
|
|
650
756
|
}) {
|
|
651
757
|
const tokens = useTokens(elevation);
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
|
|
758
|
+
const resolvedStyle = useMemo(() => {
|
|
759
|
+
const fontSize = tokens.typography.size[size];
|
|
760
|
+
return {
|
|
761
|
+
// Font family from the theme (e.g. 'default' → 'Inter', 'mono' → 'JetBrains Mono').
|
|
762
|
+
fontFamily: tokens.typography.fonts[font],
|
|
763
|
+
fontSize,
|
|
764
|
+
// Font weight is stored as a number (e.g. 400, 600) but React Native expects a string.
|
|
765
|
+
fontWeight: String(tokens.typography.weight[weight]),
|
|
766
|
+
// Convert the theme color from internal sRGB format to a hex string (e.g. '#1a1a1a').
|
|
767
|
+
color: srgbToHex(tokens[COLOR_MAP[color]].srgb),
|
|
768
|
+
// Line height = font size × multiplier (e.g. 16px × 1.5 = 24px line height).
|
|
769
|
+
lineHeight: fontSize * tokens.typography.lineHeight[lineHeight],
|
|
770
|
+
textAlign: align
|
|
771
|
+
};
|
|
772
|
+
}, [tokens, size, weight, color, font, lineHeight, align]);
|
|
773
|
+
return /* @__PURE__ */ React13.createElement(
|
|
774
|
+
Text,
|
|
775
|
+
{
|
|
776
|
+
ref,
|
|
777
|
+
testID,
|
|
778
|
+
nativeID,
|
|
779
|
+
accessibilityRole,
|
|
780
|
+
style: style ? [resolvedStyle, ...Array.isArray(style) ? style : [style]] : resolvedStyle,
|
|
781
|
+
numberOfLines
|
|
782
|
+
},
|
|
783
|
+
children
|
|
655
784
|
);
|
|
656
|
-
return /* @__PURE__ */ React11.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
|
|
657
|
-
}
|
|
658
|
-
var hadKeyboardEvent = false;
|
|
659
|
-
var isListenerSetup = false;
|
|
660
|
-
function setupModality() {
|
|
661
|
-
if (isListenerSetup || typeof document === "undefined") return;
|
|
662
|
-
isListenerSetup = true;
|
|
663
|
-
const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
664
|
-
"Tab",
|
|
665
|
-
"ArrowUp",
|
|
666
|
-
"ArrowDown",
|
|
667
|
-
"ArrowLeft",
|
|
668
|
-
"ArrowRight",
|
|
669
|
-
"Enter",
|
|
670
|
-
" ",
|
|
671
|
-
"Escape"
|
|
672
|
-
]);
|
|
673
|
-
document.addEventListener("keydown", (e) => {
|
|
674
|
-
if (NAVIGATION_KEYS.has(e.key)) {
|
|
675
|
-
hadKeyboardEvent = true;
|
|
676
|
-
}
|
|
677
|
-
}, true);
|
|
678
|
-
document.addEventListener("pointerdown", () => {
|
|
679
|
-
hadKeyboardEvent = false;
|
|
680
|
-
}, true);
|
|
681
|
-
document.addEventListener("mousedown", () => {
|
|
682
|
-
hadKeyboardEvent = false;
|
|
683
|
-
}, true);
|
|
684
|
-
}
|
|
685
|
-
function useFocusVisible() {
|
|
686
|
-
const [isFocusVisible, setIsFocusVisible] = useState(false);
|
|
687
|
-
useEffect(() => {
|
|
688
|
-
setupModality();
|
|
689
|
-
}, []);
|
|
690
|
-
const onFocus = useCallback(() => {
|
|
691
|
-
if (hadKeyboardEvent) {
|
|
692
|
-
setIsFocusVisible(true);
|
|
693
|
-
}
|
|
694
|
-
}, []);
|
|
695
|
-
const onBlur = useCallback(() => {
|
|
696
|
-
setIsFocusVisible(false);
|
|
697
|
-
}, []);
|
|
698
|
-
const focusProps = { onFocus, onBlur };
|
|
699
|
-
return { isFocusVisible, focusProps };
|
|
700
785
|
}
|
|
701
786
|
|
|
702
787
|
// src/primitives/Frame/Frame.utils.ts
|
|
@@ -799,8 +884,254 @@ function resolveFlexDirection(direction, reverse) {
|
|
|
799
884
|
}
|
|
800
885
|
return reverse ? "column-reverse" : "column";
|
|
801
886
|
}
|
|
802
|
-
|
|
803
|
-
// src/primitives/
|
|
887
|
+
|
|
888
|
+
// src/primitives/Wrapper/Wrapper.styles.ts
|
|
889
|
+
function getWrapperStyles(input) {
|
|
890
|
+
const {
|
|
891
|
+
tokens,
|
|
892
|
+
direction = "vertical",
|
|
893
|
+
wrap = false,
|
|
894
|
+
reverse = false,
|
|
895
|
+
align,
|
|
896
|
+
justify,
|
|
897
|
+
padding,
|
|
898
|
+
gap,
|
|
899
|
+
width,
|
|
900
|
+
height,
|
|
901
|
+
minWidth,
|
|
902
|
+
maxWidth,
|
|
903
|
+
minHeight,
|
|
904
|
+
maxHeight
|
|
905
|
+
} = input;
|
|
906
|
+
const container = {};
|
|
907
|
+
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
908
|
+
if (wrap) container.flexWrap = "wrap";
|
|
909
|
+
if (align) container.alignItems = resolveAlignment(align);
|
|
910
|
+
if (justify) container.justifyContent = resolveJustification(justify);
|
|
911
|
+
if (padding !== void 0) {
|
|
912
|
+
const p = resolvePadding(padding, tokens);
|
|
913
|
+
container.paddingTop = p.top;
|
|
914
|
+
container.paddingRight = p.right;
|
|
915
|
+
container.paddingBottom = p.bottom;
|
|
916
|
+
container.paddingLeft = p.left;
|
|
917
|
+
}
|
|
918
|
+
if (gap !== void 0) {
|
|
919
|
+
const g = resolveGap(gap, tokens);
|
|
920
|
+
container.rowGap = g.rowGap;
|
|
921
|
+
container.columnGap = g.columnGap;
|
|
922
|
+
}
|
|
923
|
+
Object.assign(container, resolveSizing(width, height));
|
|
924
|
+
if (minWidth !== void 0) container.minWidth = minWidth;
|
|
925
|
+
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
926
|
+
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
927
|
+
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
928
|
+
return StyleSheet.create({ c: container }).c;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// src/primitives/Wrapper/Wrapper.tsx
|
|
932
|
+
function Wrapper({
|
|
933
|
+
children,
|
|
934
|
+
direction,
|
|
935
|
+
wrap,
|
|
936
|
+
reverse,
|
|
937
|
+
align,
|
|
938
|
+
justify,
|
|
939
|
+
padding,
|
|
940
|
+
gap,
|
|
941
|
+
width,
|
|
942
|
+
height,
|
|
943
|
+
minWidth,
|
|
944
|
+
maxWidth,
|
|
945
|
+
minHeight,
|
|
946
|
+
maxHeight,
|
|
947
|
+
style,
|
|
948
|
+
// Testing & platform
|
|
949
|
+
testID,
|
|
950
|
+
nativeID,
|
|
951
|
+
ref
|
|
952
|
+
}) {
|
|
953
|
+
const tokens = useTokens(1);
|
|
954
|
+
const containerStyle = useMemo(
|
|
955
|
+
() => getWrapperStyles({
|
|
956
|
+
tokens,
|
|
957
|
+
direction,
|
|
958
|
+
wrap,
|
|
959
|
+
reverse,
|
|
960
|
+
align,
|
|
961
|
+
justify,
|
|
962
|
+
padding,
|
|
963
|
+
gap,
|
|
964
|
+
width,
|
|
965
|
+
height,
|
|
966
|
+
minWidth,
|
|
967
|
+
maxWidth,
|
|
968
|
+
minHeight,
|
|
969
|
+
maxHeight
|
|
970
|
+
}),
|
|
971
|
+
[
|
|
972
|
+
tokens,
|
|
973
|
+
direction,
|
|
974
|
+
wrap,
|
|
975
|
+
reverse,
|
|
976
|
+
align,
|
|
977
|
+
justify,
|
|
978
|
+
padding,
|
|
979
|
+
gap,
|
|
980
|
+
width,
|
|
981
|
+
height,
|
|
982
|
+
minWidth,
|
|
983
|
+
maxWidth,
|
|
984
|
+
minHeight,
|
|
985
|
+
maxHeight
|
|
986
|
+
]
|
|
987
|
+
);
|
|
988
|
+
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
989
|
+
return /* @__PURE__ */ React13.createElement(
|
|
990
|
+
View,
|
|
991
|
+
{
|
|
992
|
+
ref,
|
|
993
|
+
testID,
|
|
994
|
+
nativeID,
|
|
995
|
+
accessibilityRole: "none",
|
|
996
|
+
style: [containerStyle, ...userStyles]
|
|
997
|
+
},
|
|
998
|
+
children
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// src/composites/actions/Button/Button.tsx
|
|
1003
|
+
function Button({
|
|
1004
|
+
children,
|
|
1005
|
+
icon,
|
|
1006
|
+
iconPosition = "left",
|
|
1007
|
+
variant = "primary",
|
|
1008
|
+
semantic = "neutral",
|
|
1009
|
+
size = "md",
|
|
1010
|
+
disabled = false,
|
|
1011
|
+
style,
|
|
1012
|
+
textStyle,
|
|
1013
|
+
...pressableProps
|
|
1014
|
+
}) {
|
|
1015
|
+
const tokens = useTokens();
|
|
1016
|
+
const { variantColors, sizeTokens } = React13.useMemo(
|
|
1017
|
+
() => getButtonConfig(variant, semantic, size, disabled, tokens),
|
|
1018
|
+
[variant, semantic, size, disabled, tokens]
|
|
1019
|
+
);
|
|
1020
|
+
const padding = React13.useMemo(
|
|
1021
|
+
() => computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
1022
|
+
[size, icon, children, iconPosition]
|
|
1023
|
+
);
|
|
1024
|
+
return /* @__PURE__ */ React13.createElement(Pressable, { disabled, ...pressableProps }, ({ pressed }) => (
|
|
1025
|
+
// Wrapper handles layout: direction, gap, alignment (padding via style)
|
|
1026
|
+
/* @__PURE__ */ React13.createElement(
|
|
1027
|
+
Wrapper,
|
|
1028
|
+
{
|
|
1029
|
+
direction: "horizontal",
|
|
1030
|
+
align: "center",
|
|
1031
|
+
justify: "center",
|
|
1032
|
+
gap: sizeTokens.gap,
|
|
1033
|
+
style: [
|
|
1034
|
+
{
|
|
1035
|
+
...padding,
|
|
1036
|
+
// Asymmetric horizontal padding for text optical balance
|
|
1037
|
+
backgroundColor: pressed && !disabled ? variantColors.pressedBg : variantColors.bg,
|
|
1038
|
+
borderRadius: sizeTokens.borderRadius,
|
|
1039
|
+
borderWidth: variantColors.borderWidth,
|
|
1040
|
+
// Always 1 for consistent sizing
|
|
1041
|
+
borderColor: variantColors.borderColor || "transparent",
|
|
1042
|
+
opacity: disabled ? 0.4 : 1
|
|
1043
|
+
},
|
|
1044
|
+
...Array.isArray(style) ? style : style ? [style] : []
|
|
1045
|
+
]
|
|
1046
|
+
},
|
|
1047
|
+
icon && iconPosition === "left" && /* @__PURE__ */ React13.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor }),
|
|
1048
|
+
children && // Text primitive with semantic props + color style override
|
|
1049
|
+
/* @__PURE__ */ React13.createElement(
|
|
1050
|
+
Text2,
|
|
1051
|
+
{
|
|
1052
|
+
size: sizeTokens.textSize,
|
|
1053
|
+
weight: "semibold",
|
|
1054
|
+
style: [
|
|
1055
|
+
{ color: variantColors.textColor },
|
|
1056
|
+
...Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []
|
|
1057
|
+
]
|
|
1058
|
+
},
|
|
1059
|
+
children
|
|
1060
|
+
),
|
|
1061
|
+
icon && iconPosition === "right" && /* @__PURE__ */ React13.createElement(Icon, { name: icon, size: sizeTokens.iconSize, color: variantColors.iconColor })
|
|
1062
|
+
)
|
|
1063
|
+
));
|
|
1064
|
+
}
|
|
1065
|
+
function getCardStyles(tokens, disabled) {
|
|
1066
|
+
return StyleSheet.create({
|
|
1067
|
+
container: {
|
|
1068
|
+
backgroundColor: srgbToHex(tokens.background.srgb),
|
|
1069
|
+
borderWidth: 1,
|
|
1070
|
+
borderColor: srgbToHex(tokens.border.srgb),
|
|
1071
|
+
borderRadius: tokens.radius.lg,
|
|
1072
|
+
padding: tokens.spacing["16"],
|
|
1073
|
+
opacity: disabled ? 0.5 : 1
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// src/composites/layout/Card/Card.tsx
|
|
1079
|
+
function Card({
|
|
1080
|
+
children,
|
|
1081
|
+
elevation = 1,
|
|
1082
|
+
style,
|
|
1083
|
+
disabled = false
|
|
1084
|
+
}) {
|
|
1085
|
+
const tokens = useTokens(elevation);
|
|
1086
|
+
const styles = React13.useMemo(
|
|
1087
|
+
() => getCardStyles(tokens, disabled),
|
|
1088
|
+
[tokens, disabled]
|
|
1089
|
+
);
|
|
1090
|
+
return /* @__PURE__ */ React13.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, children);
|
|
1091
|
+
}
|
|
1092
|
+
var hadKeyboardEvent = false;
|
|
1093
|
+
var isListenerSetup = false;
|
|
1094
|
+
function setupModality() {
|
|
1095
|
+
if (isListenerSetup || typeof document === "undefined") return;
|
|
1096
|
+
isListenerSetup = true;
|
|
1097
|
+
const NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
1098
|
+
"Tab",
|
|
1099
|
+
"ArrowUp",
|
|
1100
|
+
"ArrowDown",
|
|
1101
|
+
"ArrowLeft",
|
|
1102
|
+
"ArrowRight",
|
|
1103
|
+
"Enter",
|
|
1104
|
+
" ",
|
|
1105
|
+
"Escape"
|
|
1106
|
+
]);
|
|
1107
|
+
document.addEventListener("keydown", (e) => {
|
|
1108
|
+
if (NAVIGATION_KEYS.has(e.key)) {
|
|
1109
|
+
hadKeyboardEvent = true;
|
|
1110
|
+
}
|
|
1111
|
+
}, true);
|
|
1112
|
+
document.addEventListener("pointerdown", () => {
|
|
1113
|
+
hadKeyboardEvent = false;
|
|
1114
|
+
}, true);
|
|
1115
|
+
document.addEventListener("mousedown", () => {
|
|
1116
|
+
hadKeyboardEvent = false;
|
|
1117
|
+
}, true);
|
|
1118
|
+
}
|
|
1119
|
+
function useFocusVisible() {
|
|
1120
|
+
const [isFocusVisible, setIsFocusVisible] = useState(false);
|
|
1121
|
+
useEffect(() => {
|
|
1122
|
+
setupModality();
|
|
1123
|
+
}, []);
|
|
1124
|
+
const onFocus = useCallback(() => {
|
|
1125
|
+
if (hadKeyboardEvent) {
|
|
1126
|
+
setIsFocusVisible(true);
|
|
1127
|
+
}
|
|
1128
|
+
}, []);
|
|
1129
|
+
const onBlur = useCallback(() => {
|
|
1130
|
+
setIsFocusVisible(false);
|
|
1131
|
+
}, []);
|
|
1132
|
+
const focusProps = { onFocus, onBlur };
|
|
1133
|
+
return { isFocusVisible, focusProps };
|
|
1134
|
+
}
|
|
804
1135
|
function getFrameStyles(input) {
|
|
805
1136
|
const {
|
|
806
1137
|
tokens,
|
|
@@ -907,9 +1238,9 @@ function getFrameStyles(input) {
|
|
|
907
1238
|
|
|
908
1239
|
// src/primitives/Frame/Frame.tsx
|
|
909
1240
|
function wrapTextChildren(children, textStyle) {
|
|
910
|
-
return
|
|
1241
|
+
return React13.Children.map(children, (child) => {
|
|
911
1242
|
if (typeof child === "string" || typeof child === "number") {
|
|
912
|
-
return /* @__PURE__ */
|
|
1243
|
+
return /* @__PURE__ */ React13.createElement(Text, { style: textStyle }, child);
|
|
913
1244
|
}
|
|
914
1245
|
return child;
|
|
915
1246
|
});
|
|
@@ -1062,10 +1393,10 @@ function Frame({
|
|
|
1062
1393
|
() => wrapTextChildren(children, textStyle),
|
|
1063
1394
|
[children, textStyle]
|
|
1064
1395
|
);
|
|
1065
|
-
return /* @__PURE__ */
|
|
1396
|
+
return /* @__PURE__ */ React13.createElement(FrameContext.Provider, { value: contextValue }, isInteractive ? (
|
|
1066
1397
|
// Pressable handles taps. When href is set, react-native-web renders
|
|
1067
1398
|
// it as an <a> tag so it works like a regular link on the web.
|
|
1068
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ React13.createElement(
|
|
1069
1400
|
Pressable,
|
|
1070
1401
|
{
|
|
1071
1402
|
ref,
|
|
@@ -1090,7 +1421,7 @@ function Frame({
|
|
|
1090
1421
|
)
|
|
1091
1422
|
) : (
|
|
1092
1423
|
// Non-interactive Frame: just a plain View with no tap handling.
|
|
1093
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ React13.createElement(
|
|
1094
1425
|
View,
|
|
1095
1426
|
{
|
|
1096
1427
|
ref,
|
|
@@ -1136,11 +1467,11 @@ function TextInput({
|
|
|
1136
1467
|
...textInputProps
|
|
1137
1468
|
}) {
|
|
1138
1469
|
const tokens = useTokens(1);
|
|
1139
|
-
const styles =
|
|
1470
|
+
const styles = React13.useMemo(
|
|
1140
1471
|
() => getTextInputStyles(tokens, disabled),
|
|
1141
1472
|
[tokens, disabled]
|
|
1142
1473
|
);
|
|
1143
|
-
return /* @__PURE__ */
|
|
1474
|
+
return /* @__PURE__ */ React13.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React13.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React13.createElement(
|
|
1144
1475
|
TextInput$1,
|
|
1145
1476
|
{
|
|
1146
1477
|
style: styles.input,
|
|
@@ -1177,7 +1508,7 @@ function getPopoverStyles(tokens, triggerHeight, offset, maxHeight, width, isOpe
|
|
|
1177
1508
|
});
|
|
1178
1509
|
}
|
|
1179
1510
|
|
|
1180
|
-
// src/Popover/Popover.tsx
|
|
1511
|
+
// src/composites/overlays/Popover/Popover.tsx
|
|
1181
1512
|
var openPopovers = /* @__PURE__ */ new Set();
|
|
1182
1513
|
function Popover({
|
|
1183
1514
|
isOpen,
|
|
@@ -1243,15 +1574,15 @@ function Popover({
|
|
|
1243
1574
|
[styles.content, contentStyle]
|
|
1244
1575
|
);
|
|
1245
1576
|
const webProps = { onKeyDown: handleKeyDown };
|
|
1246
|
-
return /* @__PURE__ */
|
|
1577
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1247
1578
|
View,
|
|
1248
1579
|
{
|
|
1249
1580
|
ref: containerRef,
|
|
1250
1581
|
style: containerStyles,
|
|
1251
1582
|
...webProps
|
|
1252
1583
|
},
|
|
1253
|
-
/* @__PURE__ */
|
|
1254
|
-
isOpen && /* @__PURE__ */
|
|
1584
|
+
/* @__PURE__ */ React13.createElement(View, { onLayout: onTriggerLayout }, trigger),
|
|
1585
|
+
isOpen && /* @__PURE__ */ React13.createElement(View, { style: mergedContentStyles }, children)
|
|
1255
1586
|
);
|
|
1256
1587
|
}
|
|
1257
1588
|
function usePopover(options) {
|
|
@@ -1274,7 +1605,7 @@ function usePopover(options) {
|
|
|
1274
1605
|
return { isOpen, open, close, toggle };
|
|
1275
1606
|
}
|
|
1276
1607
|
|
|
1277
|
-
// src/Select/Select.types.ts
|
|
1608
|
+
// src/composites/form-controls/Select/Select.types.ts
|
|
1278
1609
|
function isOptionGroup(item) {
|
|
1279
1610
|
return "options" in item;
|
|
1280
1611
|
}
|
|
@@ -1448,7 +1779,7 @@ function SelectOptionRow({
|
|
|
1448
1779
|
const paddingHorizontal = size === "sm" ? tokens.spacing["08"] : tokens.spacing["12"];
|
|
1449
1780
|
const fontSize = size === "sm" ? tokens.typography.size.sm : tokens.typography.size.base;
|
|
1450
1781
|
if (renderOption) {
|
|
1451
|
-
return /* @__PURE__ */
|
|
1782
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1452
1783
|
Pressable,
|
|
1453
1784
|
{
|
|
1454
1785
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1459,7 +1790,7 @@ function SelectOptionRow({
|
|
|
1459
1790
|
renderOption(option, { isSelected, isFocused })
|
|
1460
1791
|
);
|
|
1461
1792
|
}
|
|
1462
|
-
return /* @__PURE__ */
|
|
1793
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1463
1794
|
Pressable,
|
|
1464
1795
|
{
|
|
1465
1796
|
onPress: option.disabled ? void 0 : onSelect,
|
|
@@ -1488,7 +1819,7 @@ function SelectOptionRow({
|
|
|
1488
1819
|
}
|
|
1489
1820
|
]
|
|
1490
1821
|
},
|
|
1491
|
-
/* @__PURE__ */
|
|
1822
|
+
/* @__PURE__ */ React13.createElement(
|
|
1492
1823
|
Text,
|
|
1493
1824
|
{
|
|
1494
1825
|
style: [
|
|
@@ -1510,7 +1841,7 @@ function SelectOptionRow({
|
|
|
1510
1841
|
},
|
|
1511
1842
|
option.label
|
|
1512
1843
|
),
|
|
1513
|
-
isSelected && /* @__PURE__ */
|
|
1844
|
+
isSelected && /* @__PURE__ */ React13.createElement(View, { style: { marginLeft: tokens.spacing["08"] } }, /* @__PURE__ */ React13.createElement(
|
|
1514
1845
|
Icon,
|
|
1515
1846
|
{
|
|
1516
1847
|
name: "check",
|
|
@@ -1565,7 +1896,7 @@ function Select({
|
|
|
1565
1896
|
const displayLabel = selectedOption?.label ?? placeholder ?? value;
|
|
1566
1897
|
const iconColor = disabled ? srgbToHex(tokens.textSecondary.srgb) : srgbToHex(tokens.textPrimary.srgb);
|
|
1567
1898
|
const triggerWebProps = { onKeyDown: handleKeyDown };
|
|
1568
|
-
const trigger = /* @__PURE__ */
|
|
1899
|
+
const trigger = /* @__PURE__ */ React13.createElement(
|
|
1569
1900
|
Pressable,
|
|
1570
1901
|
{
|
|
1571
1902
|
onPress: disabled ? void 0 : toggle,
|
|
@@ -1575,8 +1906,8 @@ function Select({
|
|
|
1575
1906
|
...triggerWebProps,
|
|
1576
1907
|
style: styles.trigger
|
|
1577
1908
|
},
|
|
1578
|
-
renderValue ? renderValue(selectedOption) : /* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1909
|
+
renderValue ? renderValue(selectedOption) : /* @__PURE__ */ React13.createElement(Text, { style: styles.triggerText, numberOfLines: 1 }, displayLabel),
|
|
1910
|
+
/* @__PURE__ */ React13.createElement(View, { style: styles.iconWrapper, pointerEvents: "none" }, /* @__PURE__ */ React13.createElement(
|
|
1580
1911
|
Icon,
|
|
1581
1912
|
{
|
|
1582
1913
|
name: isOpen ? "expand_less" : "expand_more",
|
|
@@ -1585,14 +1916,14 @@ function Select({
|
|
|
1585
1916
|
}
|
|
1586
1917
|
))
|
|
1587
1918
|
);
|
|
1588
|
-
return /* @__PURE__ */
|
|
1919
|
+
return /* @__PURE__ */ React13.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : style ? [style] : []] }, label && /* @__PURE__ */ React13.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React13.createElement(
|
|
1589
1920
|
Popover,
|
|
1590
1921
|
{
|
|
1591
1922
|
isOpen: isOpen && !disabled,
|
|
1592
1923
|
onClose: close,
|
|
1593
1924
|
trigger
|
|
1594
1925
|
},
|
|
1595
|
-
/* @__PURE__ */
|
|
1926
|
+
/* @__PURE__ */ React13.createElement(
|
|
1596
1927
|
ScrollView,
|
|
1597
1928
|
{
|
|
1598
1929
|
bounces: false,
|
|
@@ -1601,7 +1932,7 @@ function Select({
|
|
|
1601
1932
|
},
|
|
1602
1933
|
options.map((item) => {
|
|
1603
1934
|
if (isOptionGroup(item)) {
|
|
1604
|
-
return /* @__PURE__ */
|
|
1935
|
+
return /* @__PURE__ */ React13.createElement(View, { key: item.label }, /* @__PURE__ */ React13.createElement(Text, { style: styles.groupLabel }, item.label), item.options.map((opt) => /* @__PURE__ */ React13.createElement(
|
|
1605
1936
|
SelectOptionRow,
|
|
1606
1937
|
{
|
|
1607
1938
|
key: opt.value,
|
|
@@ -1617,7 +1948,7 @@ function Select({
|
|
|
1617
1948
|
}
|
|
1618
1949
|
)));
|
|
1619
1950
|
}
|
|
1620
|
-
return /* @__PURE__ */
|
|
1951
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1621
1952
|
SelectOptionRow,
|
|
1622
1953
|
{
|
|
1623
1954
|
key: item.value,
|
|
@@ -1672,7 +2003,7 @@ function getToggleStyles(tokens, value, disabled) {
|
|
|
1672
2003
|
});
|
|
1673
2004
|
}
|
|
1674
2005
|
|
|
1675
|
-
// src/Toggle/Toggle.tsx
|
|
2006
|
+
// src/composites/form-controls/Toggle/Toggle.tsx
|
|
1676
2007
|
function Toggle({
|
|
1677
2008
|
value,
|
|
1678
2009
|
onValueChange,
|
|
@@ -1681,16 +2012,16 @@ function Toggle({
|
|
|
1681
2012
|
style
|
|
1682
2013
|
}) {
|
|
1683
2014
|
const tokens = useTokens(1);
|
|
1684
|
-
const styles =
|
|
2015
|
+
const styles = React13.useMemo(
|
|
1685
2016
|
() => getToggleStyles(tokens, value, disabled),
|
|
1686
2017
|
[tokens, value, disabled]
|
|
1687
2018
|
);
|
|
1688
|
-
const handlePress =
|
|
2019
|
+
const handlePress = React13.useCallback(() => {
|
|
1689
2020
|
if (!disabled) {
|
|
1690
2021
|
onValueChange(!value);
|
|
1691
2022
|
}
|
|
1692
2023
|
}, [disabled, value, onValueChange]);
|
|
1693
|
-
return /* @__PURE__ */
|
|
2024
|
+
return /* @__PURE__ */ React13.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React13.createElement(Text, { style: styles.label }, label), /* @__PURE__ */ React13.createElement(
|
|
1694
2025
|
Pressable,
|
|
1695
2026
|
{
|
|
1696
2027
|
onPress: handlePress,
|
|
@@ -1698,7 +2029,7 @@ function Toggle({
|
|
|
1698
2029
|
accessibilityRole: "switch",
|
|
1699
2030
|
accessibilityState: { checked: value, disabled }
|
|
1700
2031
|
},
|
|
1701
|
-
/* @__PURE__ */
|
|
2032
|
+
/* @__PURE__ */ React13.createElement(View, { style: styles.track }, /* @__PURE__ */ React13.createElement(View, { style: styles.thumb }))
|
|
1702
2033
|
));
|
|
1703
2034
|
}
|
|
1704
2035
|
var TRACK_HEIGHT2 = 6;
|
|
@@ -1770,7 +2101,7 @@ function getSliderStyles(tokens, disabled) {
|
|
|
1770
2101
|
});
|
|
1771
2102
|
}
|
|
1772
2103
|
|
|
1773
|
-
// src/Slider/Slider.tsx
|
|
2104
|
+
// src/composites/range-inputs/Slider/Slider.tsx
|
|
1774
2105
|
function Slider({
|
|
1775
2106
|
value,
|
|
1776
2107
|
onValueChange,
|
|
@@ -1784,41 +2115,41 @@ function Slider({
|
|
|
1784
2115
|
style
|
|
1785
2116
|
}) {
|
|
1786
2117
|
const tokens = useTokens(1);
|
|
1787
|
-
const styles =
|
|
2118
|
+
const styles = React13.useMemo(
|
|
1788
2119
|
() => getSliderStyles(tokens, disabled),
|
|
1789
2120
|
[tokens, disabled]
|
|
1790
2121
|
);
|
|
1791
|
-
const trackRef =
|
|
1792
|
-
const trackWidth =
|
|
1793
|
-
const trackPageX =
|
|
1794
|
-
const onValueChangeRef =
|
|
1795
|
-
const minRef =
|
|
1796
|
-
const maxRef =
|
|
1797
|
-
const stepRef =
|
|
1798
|
-
const disabledRef =
|
|
1799
|
-
|
|
2122
|
+
const trackRef = React13.useRef(null);
|
|
2123
|
+
const trackWidth = React13.useRef(0);
|
|
2124
|
+
const trackPageX = React13.useRef(0);
|
|
2125
|
+
const onValueChangeRef = React13.useRef(onValueChange);
|
|
2126
|
+
const minRef = React13.useRef(min);
|
|
2127
|
+
const maxRef = React13.useRef(max);
|
|
2128
|
+
const stepRef = React13.useRef(step);
|
|
2129
|
+
const disabledRef = React13.useRef(disabled);
|
|
2130
|
+
React13.useEffect(() => {
|
|
1800
2131
|
onValueChangeRef.current = onValueChange;
|
|
1801
2132
|
}, [onValueChange]);
|
|
1802
|
-
|
|
2133
|
+
React13.useEffect(() => {
|
|
1803
2134
|
minRef.current = min;
|
|
1804
2135
|
}, [min]);
|
|
1805
|
-
|
|
2136
|
+
React13.useEffect(() => {
|
|
1806
2137
|
maxRef.current = max;
|
|
1807
2138
|
}, [max]);
|
|
1808
|
-
|
|
2139
|
+
React13.useEffect(() => {
|
|
1809
2140
|
stepRef.current = step;
|
|
1810
2141
|
}, [step]);
|
|
1811
|
-
|
|
2142
|
+
React13.useEffect(() => {
|
|
1812
2143
|
disabledRef.current = disabled;
|
|
1813
2144
|
}, [disabled]);
|
|
1814
|
-
const computeValue =
|
|
2145
|
+
const computeValue = React13.useCallback((pageX) => {
|
|
1815
2146
|
const localX = pageX - trackPageX.current;
|
|
1816
2147
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
1817
2148
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
1818
2149
|
const stepped = Math.round(raw / stepRef.current) * stepRef.current;
|
|
1819
2150
|
return Math.min(maxRef.current, Math.max(minRef.current, stepped));
|
|
1820
2151
|
}, []);
|
|
1821
|
-
const panResponder =
|
|
2152
|
+
const panResponder = React13.useRef(
|
|
1822
2153
|
PanResponder.create({
|
|
1823
2154
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
1824
2155
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -1834,7 +2165,7 @@ function Slider({
|
|
|
1834
2165
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE2);
|
|
1835
2166
|
const thumbLeft = ratio * usableWidth;
|
|
1836
2167
|
const fillWidth = thumbLeft + THUMB_SIZE2 / 2;
|
|
1837
|
-
const handleValueTextSubmit =
|
|
2168
|
+
const handleValueTextSubmit = React13.useCallback(
|
|
1838
2169
|
(text) => {
|
|
1839
2170
|
const raw = Number(text);
|
|
1840
2171
|
if (!Number.isNaN(raw)) {
|
|
@@ -1843,12 +2174,12 @@ function Slider({
|
|
|
1843
2174
|
},
|
|
1844
2175
|
[onValueChange, min, max]
|
|
1845
2176
|
);
|
|
1846
|
-
const [editText, setEditText] =
|
|
1847
|
-
|
|
2177
|
+
const [editText, setEditText] = React13.useState(String(value));
|
|
2178
|
+
React13.useEffect(() => {
|
|
1848
2179
|
setEditText(String(value));
|
|
1849
2180
|
}, [value]);
|
|
1850
2181
|
const showLabel = label || showValue || editableValue;
|
|
1851
|
-
return /* @__PURE__ */
|
|
2182
|
+
return /* @__PURE__ */ React13.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React13.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React13.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React13.createElement(
|
|
1852
2183
|
TextInput$1,
|
|
1853
2184
|
{
|
|
1854
2185
|
style: styles.valueInput,
|
|
@@ -1860,7 +2191,7 @@ function Slider({
|
|
|
1860
2191
|
selectTextOnFocus: true,
|
|
1861
2192
|
editable: !disabled
|
|
1862
2193
|
}
|
|
1863
|
-
) : showValue && /* @__PURE__ */
|
|
2194
|
+
) : showValue && /* @__PURE__ */ React13.createElement(Text, { style: styles.value }, value)), /* @__PURE__ */ React13.createElement(
|
|
1864
2195
|
View,
|
|
1865
2196
|
{
|
|
1866
2197
|
ref: trackRef,
|
|
@@ -1873,9 +2204,9 @@ function Slider({
|
|
|
1873
2204
|
},
|
|
1874
2205
|
...panResponder.panHandlers
|
|
1875
2206
|
},
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
/* @__PURE__ */
|
|
1878
|
-
/* @__PURE__ */
|
|
2207
|
+
/* @__PURE__ */ React13.createElement(View, { style: styles.trackRail }),
|
|
2208
|
+
/* @__PURE__ */ React13.createElement(View, { style: [styles.trackFill, { width: fillWidth }] }),
|
|
2209
|
+
/* @__PURE__ */ React13.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
1879
2210
|
));
|
|
1880
2211
|
}
|
|
1881
2212
|
var TRACK_HEIGHT3 = 22;
|
|
@@ -1985,7 +2316,7 @@ function getHueSliderStyles(tokens, disabled) {
|
|
|
1985
2316
|
});
|
|
1986
2317
|
}
|
|
1987
2318
|
|
|
1988
|
-
// src/HueSlider/HueSlider.tsx
|
|
2319
|
+
// src/composites/range-inputs/HueSlider/HueSlider.tsx
|
|
1989
2320
|
function HueSlider({
|
|
1990
2321
|
value,
|
|
1991
2322
|
onValueChange,
|
|
@@ -1998,41 +2329,41 @@ function HueSlider({
|
|
|
1998
2329
|
style
|
|
1999
2330
|
}) {
|
|
2000
2331
|
const tokens = useTokens(1);
|
|
2001
|
-
const styles =
|
|
2332
|
+
const styles = React13.useMemo(
|
|
2002
2333
|
() => getHueSliderStyles(tokens, disabled),
|
|
2003
2334
|
[tokens, disabled]
|
|
2004
2335
|
);
|
|
2005
|
-
const segments =
|
|
2336
|
+
const segments = React13.useMemo(
|
|
2006
2337
|
() => buildHueSegments(min, max),
|
|
2007
2338
|
[min, max]
|
|
2008
2339
|
);
|
|
2009
|
-
const trackRef =
|
|
2010
|
-
const trackWidth =
|
|
2011
|
-
const trackPageX =
|
|
2012
|
-
const onValueChangeRef =
|
|
2013
|
-
const minRef =
|
|
2014
|
-
const maxRef =
|
|
2015
|
-
const disabledRef =
|
|
2016
|
-
|
|
2340
|
+
const trackRef = React13.useRef(null);
|
|
2341
|
+
const trackWidth = React13.useRef(0);
|
|
2342
|
+
const trackPageX = React13.useRef(0);
|
|
2343
|
+
const onValueChangeRef = React13.useRef(onValueChange);
|
|
2344
|
+
const minRef = React13.useRef(min);
|
|
2345
|
+
const maxRef = React13.useRef(max);
|
|
2346
|
+
const disabledRef = React13.useRef(disabled);
|
|
2347
|
+
React13.useEffect(() => {
|
|
2017
2348
|
onValueChangeRef.current = onValueChange;
|
|
2018
2349
|
}, [onValueChange]);
|
|
2019
|
-
|
|
2350
|
+
React13.useEffect(() => {
|
|
2020
2351
|
minRef.current = min;
|
|
2021
2352
|
}, [min]);
|
|
2022
|
-
|
|
2353
|
+
React13.useEffect(() => {
|
|
2023
2354
|
maxRef.current = max;
|
|
2024
2355
|
}, [max]);
|
|
2025
|
-
|
|
2356
|
+
React13.useEffect(() => {
|
|
2026
2357
|
disabledRef.current = disabled;
|
|
2027
2358
|
}, [disabled]);
|
|
2028
|
-
const computeHue =
|
|
2359
|
+
const computeHue = React13.useCallback((pageX) => {
|
|
2029
2360
|
const localX = pageX - trackPageX.current;
|
|
2030
2361
|
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2031
2362
|
const raw = minRef.current + ratio2 * (maxRef.current - minRef.current);
|
|
2032
2363
|
const stepped = Math.round(raw);
|
|
2033
2364
|
return (stepped % 360 + 360) % 360;
|
|
2034
2365
|
}, []);
|
|
2035
|
-
const panResponder =
|
|
2366
|
+
const panResponder = React13.useRef(
|
|
2036
2367
|
PanResponder.create({
|
|
2037
2368
|
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2038
2369
|
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
@@ -2048,7 +2379,7 @@ function HueSlider({
|
|
|
2048
2379
|
const ratio = max > min ? (sliderValue - min) / (max - min) : 0;
|
|
2049
2380
|
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE3);
|
|
2050
2381
|
const thumbLeft = ratio * usableWidth;
|
|
2051
|
-
const handleValueTextSubmit =
|
|
2382
|
+
const handleValueTextSubmit = React13.useCallback(
|
|
2052
2383
|
(text) => {
|
|
2053
2384
|
const raw = Number(text);
|
|
2054
2385
|
if (!Number.isNaN(raw)) {
|
|
@@ -2057,12 +2388,12 @@ function HueSlider({
|
|
|
2057
2388
|
},
|
|
2058
2389
|
[onValueChange]
|
|
2059
2390
|
);
|
|
2060
|
-
const [editText, setEditText] =
|
|
2061
|
-
|
|
2391
|
+
const [editText, setEditText] = React13.useState(String(value));
|
|
2392
|
+
React13.useEffect(() => {
|
|
2062
2393
|
setEditText(String(value));
|
|
2063
2394
|
}, [value]);
|
|
2064
2395
|
const showLabel = label || showValue || editableValue;
|
|
2065
|
-
return /* @__PURE__ */
|
|
2396
|
+
return /* @__PURE__ */ React13.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, showLabel && /* @__PURE__ */ React13.createElement(View, { style: styles.labelRow }, label && /* @__PURE__ */ React13.createElement(Text, { style: styles.label }, label), editableValue ? /* @__PURE__ */ React13.createElement(
|
|
2066
2397
|
TextInput$1,
|
|
2067
2398
|
{
|
|
2068
2399
|
style: styles.valueInput,
|
|
@@ -2074,7 +2405,7 @@ function HueSlider({
|
|
|
2074
2405
|
selectTextOnFocus: true,
|
|
2075
2406
|
editable: !disabled
|
|
2076
2407
|
}
|
|
2077
|
-
) : showValue && /* @__PURE__ */
|
|
2408
|
+
) : showValue && /* @__PURE__ */ React13.createElement(Text, { style: styles.value }, value, "\xB0")), /* @__PURE__ */ React13.createElement(
|
|
2078
2409
|
View,
|
|
2079
2410
|
{
|
|
2080
2411
|
ref: trackRef,
|
|
@@ -2087,8 +2418,8 @@ function HueSlider({
|
|
|
2087
2418
|
},
|
|
2088
2419
|
...panResponder.panHandlers
|
|
2089
2420
|
},
|
|
2090
|
-
/* @__PURE__ */
|
|
2091
|
-
/* @__PURE__ */
|
|
2421
|
+
/* @__PURE__ */ React13.createElement(View, { style: styles.gradientTrack }, segments.map((color, i) => /* @__PURE__ */ React13.createElement(View, { key: i, style: [styles.segment, { backgroundColor: color }] }))),
|
|
2422
|
+
/* @__PURE__ */ React13.createElement(View, { style: [styles.thumb, { left: thumbLeft }] })
|
|
2092
2423
|
));
|
|
2093
2424
|
}
|
|
2094
2425
|
var TRACK_HEIGHT4 = 22;
|
|
@@ -2130,300 +2461,136 @@ function getColorScaleSliderStyles(tokens, disabled) {
|
|
|
2130
2461
|
thumb: {
|
|
2131
2462
|
position: "absolute",
|
|
2132
2463
|
width: THUMB_SIZE4,
|
|
2133
|
-
height: THUMB_SIZE4,
|
|
2134
|
-
borderRadius: THUMB_SIZE4 / 2,
|
|
2135
|
-
backgroundColor: "#ffffff",
|
|
2136
|
-
borderWidth: 2,
|
|
2137
|
-
borderColor: srgbToHex(tokens.border.srgb)
|
|
2138
|
-
},
|
|
2139
|
-
warning: {
|
|
2140
|
-
fontFamily: tokens.typography.fonts.default,
|
|
2141
|
-
fontSize: tokens.typography.size.xs,
|
|
2142
|
-
fontWeight: tokens.typography.weight.medium,
|
|
2143
|
-
color: srgbToHex(tokens.error.srgb)
|
|
2144
|
-
}
|
|
2145
|
-
});
|
|
2146
|
-
}
|
|
2147
|
-
|
|
2148
|
-
// src/ColorScaleSlider/ColorScaleSlider.tsx
|
|
2149
|
-
function ColorScaleSlider({
|
|
2150
|
-
colors,
|
|
2151
|
-
value,
|
|
2152
|
-
onValueChange,
|
|
2153
|
-
label,
|
|
2154
|
-
warning,
|
|
2155
|
-
trimEnds = false,
|
|
2156
|
-
snap = false,
|
|
2157
|
-
disabled = false,
|
|
2158
|
-
animateValue = false,
|
|
2159
|
-
style
|
|
2160
|
-
}) {
|
|
2161
|
-
const tokens = useTokens(1);
|
|
2162
|
-
const styles = React11.useMemo(
|
|
2163
|
-
() => getColorScaleSliderStyles(tokens, disabled),
|
|
2164
|
-
[tokens, disabled]
|
|
2165
|
-
);
|
|
2166
|
-
const trackRef = React11.useRef(null);
|
|
2167
|
-
const trackWidth = React11.useRef(0);
|
|
2168
|
-
const trackPageX = React11.useRef(0);
|
|
2169
|
-
const isDragging = React11.useRef(false);
|
|
2170
|
-
const thumbAnim = React11.useRef(new Animated.Value(0)).current;
|
|
2171
|
-
const onValueChangeRef = React11.useRef(onValueChange);
|
|
2172
|
-
const disabledRef = React11.useRef(disabled);
|
|
2173
|
-
const colorsLengthRef = React11.useRef(colors.length);
|
|
2174
|
-
const trimEndsRef = React11.useRef(trimEnds);
|
|
2175
|
-
const snapRef = React11.useRef(snap);
|
|
2176
|
-
React11.useEffect(() => {
|
|
2177
|
-
onValueChangeRef.current = onValueChange;
|
|
2178
|
-
}, [onValueChange]);
|
|
2179
|
-
React11.useEffect(() => {
|
|
2180
|
-
disabledRef.current = disabled;
|
|
2181
|
-
}, [disabled]);
|
|
2182
|
-
React11.useEffect(() => {
|
|
2183
|
-
colorsLengthRef.current = colors.length;
|
|
2184
|
-
}, [colors.length]);
|
|
2185
|
-
React11.useEffect(() => {
|
|
2186
|
-
trimEndsRef.current = trimEnds;
|
|
2187
|
-
}, [trimEnds]);
|
|
2188
|
-
React11.useEffect(() => {
|
|
2189
|
-
snapRef.current = snap;
|
|
2190
|
-
}, [snap]);
|
|
2191
|
-
const computeNv = React11.useCallback((pageX) => {
|
|
2192
|
-
const localX = pageX - trackPageX.current;
|
|
2193
|
-
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2194
|
-
const totalSteps2 = colorsLengthRef.current - 1;
|
|
2195
|
-
const minNV2 = trimEndsRef.current ? 1 / totalSteps2 : 0;
|
|
2196
|
-
const maxNV2 = trimEndsRef.current ? 1 - 1 / totalSteps2 : 1;
|
|
2197
|
-
const range2 = maxNV2 - minNV2;
|
|
2198
|
-
let nv = maxNV2 - ratio2 * range2;
|
|
2199
|
-
if (snapRef.current && totalSteps2 > 0) {
|
|
2200
|
-
const stepNv = 1 / totalSteps2;
|
|
2201
|
-
nv = Math.round(nv / stepNv) * stepNv;
|
|
2202
|
-
nv = Math.min(maxNV2, Math.max(minNV2, nv));
|
|
2203
|
-
}
|
|
2204
|
-
return nv;
|
|
2205
|
-
}, []);
|
|
2206
|
-
const panResponder = React11.useRef(
|
|
2207
|
-
PanResponder.create({
|
|
2208
|
-
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2209
|
-
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
2210
|
-
onPanResponderGrant: (evt) => {
|
|
2211
|
-
isDragging.current = true;
|
|
2212
|
-
onValueChangeRef.current(computeNv(evt.nativeEvent.pageX));
|
|
2213
|
-
},
|
|
2214
|
-
onPanResponderMove: (_evt, gestureState) => {
|
|
2215
|
-
onValueChangeRef.current(computeNv(gestureState.moveX));
|
|
2216
|
-
},
|
|
2217
|
-
onPanResponderRelease: () => {
|
|
2218
|
-
isDragging.current = false;
|
|
2219
|
-
},
|
|
2220
|
-
onPanResponderTerminate: () => {
|
|
2221
|
-
isDragging.current = false;
|
|
2222
|
-
}
|
|
2223
|
-
})
|
|
2224
|
-
).current;
|
|
2225
|
-
const visibleColors = trimEnds ? colors.slice(1, -1) : colors;
|
|
2226
|
-
const totalSteps = colors.length - 1;
|
|
2227
|
-
const minNV = trimEnds ? 1 / totalSteps : 0;
|
|
2228
|
-
const maxNV = trimEnds ? 1 - 1 / totalSteps : 1;
|
|
2229
|
-
const range = maxNV - minNV;
|
|
2230
|
-
const clampedValue = value !== void 0 ? Math.min(maxNV, Math.max(minNV, value)) : (maxNV + minNV) / 2;
|
|
2231
|
-
const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
|
|
2232
|
-
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE4);
|
|
2233
|
-
const thumbLeft = ratio * usableWidth;
|
|
2234
|
-
React11.useEffect(() => {
|
|
2235
|
-
if (isDragging.current || !animateValue) {
|
|
2236
|
-
thumbAnim.setValue(thumbLeft);
|
|
2237
|
-
} else {
|
|
2238
|
-
Animated.timing(thumbAnim, {
|
|
2239
|
-
toValue: thumbLeft,
|
|
2240
|
-
duration: 300,
|
|
2241
|
-
useNativeDriver: false
|
|
2242
|
-
}).start();
|
|
2243
|
-
}
|
|
2244
|
-
}, [thumbLeft, animateValue, thumbAnim]);
|
|
2245
|
-
return /* @__PURE__ */ React11.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React11.createElement(View, { style: styles.labelRow }, /* @__PURE__ */ React11.createElement(Text, { style: styles.label }, label)), /* @__PURE__ */ React11.createElement(
|
|
2246
|
-
View,
|
|
2247
|
-
{
|
|
2248
|
-
ref: trackRef,
|
|
2249
|
-
style: styles.trackContainer,
|
|
2250
|
-
onLayout: (e) => {
|
|
2251
|
-
trackWidth.current = e.nativeEvent.layout.width;
|
|
2252
|
-
const newUsableWidth = Math.max(0, e.nativeEvent.layout.width - THUMB_SIZE4);
|
|
2253
|
-
thumbAnim.setValue(ratio * newUsableWidth);
|
|
2254
|
-
trackRef.current?.measure((_x, _y, _w, _h, pageX) => {
|
|
2255
|
-
if (pageX != null) trackPageX.current = pageX;
|
|
2256
|
-
});
|
|
2257
|
-
},
|
|
2258
|
-
...panResponder.panHandlers
|
|
2259
|
-
},
|
|
2260
|
-
/* @__PURE__ */ React11.createElement(View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React11.createElement(View, { key: i, style: [styles.segment, { backgroundColor: srgbToHex(color.srgb) }] }))),
|
|
2261
|
-
/* @__PURE__ */ React11.createElement(Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
|
|
2262
|
-
), warning && /* @__PURE__ */ React11.createElement(Text, { style: styles.warning }, warning));
|
|
2263
|
-
}
|
|
2264
|
-
function getWrapperStyles(input) {
|
|
2265
|
-
const {
|
|
2266
|
-
tokens,
|
|
2267
|
-
direction = "vertical",
|
|
2268
|
-
wrap = false,
|
|
2269
|
-
reverse = false,
|
|
2270
|
-
align,
|
|
2271
|
-
justify,
|
|
2272
|
-
padding,
|
|
2273
|
-
gap,
|
|
2274
|
-
width,
|
|
2275
|
-
height,
|
|
2276
|
-
minWidth,
|
|
2277
|
-
maxWidth,
|
|
2278
|
-
minHeight,
|
|
2279
|
-
maxHeight
|
|
2280
|
-
} = input;
|
|
2281
|
-
const container = {};
|
|
2282
|
-
container.flexDirection = resolveFlexDirection(direction, reverse);
|
|
2283
|
-
if (wrap) container.flexWrap = "wrap";
|
|
2284
|
-
if (align) container.alignItems = resolveAlignment(align);
|
|
2285
|
-
if (justify) container.justifyContent = resolveJustification(justify);
|
|
2286
|
-
if (padding !== void 0) {
|
|
2287
|
-
const p = resolvePadding(padding, tokens);
|
|
2288
|
-
container.paddingTop = p.top;
|
|
2289
|
-
container.paddingRight = p.right;
|
|
2290
|
-
container.paddingBottom = p.bottom;
|
|
2291
|
-
container.paddingLeft = p.left;
|
|
2292
|
-
}
|
|
2293
|
-
if (gap !== void 0) {
|
|
2294
|
-
const g = resolveGap(gap, tokens);
|
|
2295
|
-
container.rowGap = g.rowGap;
|
|
2296
|
-
container.columnGap = g.columnGap;
|
|
2297
|
-
}
|
|
2298
|
-
Object.assign(container, resolveSizing(width, height));
|
|
2299
|
-
if (minWidth !== void 0) container.minWidth = minWidth;
|
|
2300
|
-
if (maxWidth !== void 0) container.maxWidth = maxWidth;
|
|
2301
|
-
if (minHeight !== void 0) container.minHeight = minHeight;
|
|
2302
|
-
if (maxHeight !== void 0) container.maxHeight = maxHeight;
|
|
2303
|
-
return StyleSheet.create({ c: container }).c;
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
|
-
// src/primitives/Wrapper/Wrapper.tsx
|
|
2307
|
-
function Wrapper({
|
|
2308
|
-
children,
|
|
2309
|
-
direction,
|
|
2310
|
-
wrap,
|
|
2311
|
-
reverse,
|
|
2312
|
-
align,
|
|
2313
|
-
justify,
|
|
2314
|
-
padding,
|
|
2315
|
-
gap,
|
|
2316
|
-
width,
|
|
2317
|
-
height,
|
|
2318
|
-
minWidth,
|
|
2319
|
-
maxWidth,
|
|
2320
|
-
minHeight,
|
|
2321
|
-
maxHeight,
|
|
2322
|
-
style,
|
|
2323
|
-
// Testing & platform
|
|
2324
|
-
testID,
|
|
2325
|
-
nativeID,
|
|
2326
|
-
ref
|
|
2327
|
-
}) {
|
|
2328
|
-
const tokens = useTokens(1);
|
|
2329
|
-
const containerStyle = useMemo(
|
|
2330
|
-
() => getWrapperStyles({
|
|
2331
|
-
tokens,
|
|
2332
|
-
direction,
|
|
2333
|
-
wrap,
|
|
2334
|
-
reverse,
|
|
2335
|
-
align,
|
|
2336
|
-
justify,
|
|
2337
|
-
padding,
|
|
2338
|
-
gap,
|
|
2339
|
-
width,
|
|
2340
|
-
height,
|
|
2341
|
-
minWidth,
|
|
2342
|
-
maxWidth,
|
|
2343
|
-
minHeight,
|
|
2344
|
-
maxHeight
|
|
2345
|
-
}),
|
|
2346
|
-
[
|
|
2347
|
-
tokens,
|
|
2348
|
-
direction,
|
|
2349
|
-
wrap,
|
|
2350
|
-
reverse,
|
|
2351
|
-
align,
|
|
2352
|
-
justify,
|
|
2353
|
-
padding,
|
|
2354
|
-
gap,
|
|
2355
|
-
width,
|
|
2356
|
-
height,
|
|
2357
|
-
minWidth,
|
|
2358
|
-
maxWidth,
|
|
2359
|
-
minHeight,
|
|
2360
|
-
maxHeight
|
|
2361
|
-
]
|
|
2362
|
-
);
|
|
2363
|
-
const userStyles = Array.isArray(style) ? style : style ? [style] : [];
|
|
2364
|
-
return /* @__PURE__ */ React11.createElement(
|
|
2365
|
-
View,
|
|
2366
|
-
{
|
|
2367
|
-
ref,
|
|
2368
|
-
testID,
|
|
2369
|
-
nativeID,
|
|
2370
|
-
accessibilityRole: "none",
|
|
2371
|
-
style: [containerStyle, ...userStyles]
|
|
2372
|
-
},
|
|
2373
|
-
children
|
|
2374
|
-
);
|
|
2375
|
-
}
|
|
2376
|
-
var COLOR_MAP = {
|
|
2377
|
-
primary: "textPrimary",
|
|
2378
|
-
secondary: "textSecondary",
|
|
2379
|
-
interactive: "interactive"
|
|
2380
|
-
};
|
|
2381
|
-
function Text11({
|
|
2382
|
-
children,
|
|
2383
|
-
size = "base",
|
|
2384
|
-
weight = "regular",
|
|
2385
|
-
color = "primary",
|
|
2386
|
-
font = "default",
|
|
2387
|
-
lineHeight = "normal",
|
|
2388
|
-
align,
|
|
2389
|
-
numberOfLines,
|
|
2390
|
-
elevation = 1,
|
|
2391
|
-
style,
|
|
2392
|
-
// Accessibility
|
|
2393
|
-
accessibilityRole,
|
|
2394
|
-
// Testing & platform
|
|
2395
|
-
testID,
|
|
2396
|
-
nativeID,
|
|
2397
|
-
ref
|
|
2464
|
+
height: THUMB_SIZE4,
|
|
2465
|
+
borderRadius: THUMB_SIZE4 / 2,
|
|
2466
|
+
backgroundColor: "#ffffff",
|
|
2467
|
+
borderWidth: 2,
|
|
2468
|
+
borderColor: srgbToHex(tokens.border.srgb)
|
|
2469
|
+
},
|
|
2470
|
+
warning: {
|
|
2471
|
+
fontFamily: tokens.typography.fonts.default,
|
|
2472
|
+
fontSize: tokens.typography.size.xs,
|
|
2473
|
+
fontWeight: tokens.typography.weight.medium,
|
|
2474
|
+
color: srgbToHex(tokens.error.srgb)
|
|
2475
|
+
}
|
|
2476
|
+
});
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
// src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.tsx
|
|
2480
|
+
function ColorScaleSlider({
|
|
2481
|
+
colors,
|
|
2482
|
+
value,
|
|
2483
|
+
onValueChange,
|
|
2484
|
+
label,
|
|
2485
|
+
warning,
|
|
2486
|
+
trimEnds = false,
|
|
2487
|
+
snap = false,
|
|
2488
|
+
disabled = false,
|
|
2489
|
+
animateValue = false,
|
|
2490
|
+
style
|
|
2398
2491
|
}) {
|
|
2399
|
-
const tokens = useTokens(
|
|
2400
|
-
const
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2492
|
+
const tokens = useTokens(1);
|
|
2493
|
+
const styles = React13.useMemo(
|
|
2494
|
+
() => getColorScaleSliderStyles(tokens, disabled),
|
|
2495
|
+
[tokens, disabled]
|
|
2496
|
+
);
|
|
2497
|
+
const trackRef = React13.useRef(null);
|
|
2498
|
+
const trackWidth = React13.useRef(0);
|
|
2499
|
+
const trackPageX = React13.useRef(0);
|
|
2500
|
+
const isDragging = React13.useRef(false);
|
|
2501
|
+
const thumbAnim = React13.useRef(new Animated.Value(0)).current;
|
|
2502
|
+
const onValueChangeRef = React13.useRef(onValueChange);
|
|
2503
|
+
const disabledRef = React13.useRef(disabled);
|
|
2504
|
+
const colorsLengthRef = React13.useRef(colors.length);
|
|
2505
|
+
const trimEndsRef = React13.useRef(trimEnds);
|
|
2506
|
+
const snapRef = React13.useRef(snap);
|
|
2507
|
+
React13.useEffect(() => {
|
|
2508
|
+
onValueChangeRef.current = onValueChange;
|
|
2509
|
+
}, [onValueChange]);
|
|
2510
|
+
React13.useEffect(() => {
|
|
2511
|
+
disabledRef.current = disabled;
|
|
2512
|
+
}, [disabled]);
|
|
2513
|
+
React13.useEffect(() => {
|
|
2514
|
+
colorsLengthRef.current = colors.length;
|
|
2515
|
+
}, [colors.length]);
|
|
2516
|
+
React13.useEffect(() => {
|
|
2517
|
+
trimEndsRef.current = trimEnds;
|
|
2518
|
+
}, [trimEnds]);
|
|
2519
|
+
React13.useEffect(() => {
|
|
2520
|
+
snapRef.current = snap;
|
|
2521
|
+
}, [snap]);
|
|
2522
|
+
const computeNv = React13.useCallback((pageX) => {
|
|
2523
|
+
const localX = pageX - trackPageX.current;
|
|
2524
|
+
const ratio2 = Math.min(1, Math.max(0, localX / trackWidth.current));
|
|
2525
|
+
const totalSteps2 = colorsLengthRef.current - 1;
|
|
2526
|
+
const minNV2 = trimEndsRef.current ? 1 / totalSteps2 : 0;
|
|
2527
|
+
const maxNV2 = trimEndsRef.current ? 1 - 1 / totalSteps2 : 1;
|
|
2528
|
+
const range2 = maxNV2 - minNV2;
|
|
2529
|
+
let nv = maxNV2 - ratio2 * range2;
|
|
2530
|
+
if (snapRef.current && totalSteps2 > 0) {
|
|
2531
|
+
const stepNv = 1 / totalSteps2;
|
|
2532
|
+
nv = Math.round(nv / stepNv) * stepNv;
|
|
2533
|
+
nv = Math.min(maxNV2, Math.max(minNV2, nv));
|
|
2534
|
+
}
|
|
2535
|
+
return nv;
|
|
2536
|
+
}, []);
|
|
2537
|
+
const panResponder = React13.useRef(
|
|
2538
|
+
PanResponder.create({
|
|
2539
|
+
onStartShouldSetPanResponder: () => !disabledRef.current,
|
|
2540
|
+
onMoveShouldSetPanResponder: () => !disabledRef.current,
|
|
2541
|
+
onPanResponderGrant: (evt) => {
|
|
2542
|
+
isDragging.current = true;
|
|
2543
|
+
onValueChangeRef.current(computeNv(evt.nativeEvent.pageX));
|
|
2544
|
+
},
|
|
2545
|
+
onPanResponderMove: (_evt, gestureState) => {
|
|
2546
|
+
onValueChangeRef.current(computeNv(gestureState.moveX));
|
|
2547
|
+
},
|
|
2548
|
+
onPanResponderRelease: () => {
|
|
2549
|
+
isDragging.current = false;
|
|
2550
|
+
},
|
|
2551
|
+
onPanResponderTerminate: () => {
|
|
2552
|
+
isDragging.current = false;
|
|
2553
|
+
}
|
|
2554
|
+
})
|
|
2555
|
+
).current;
|
|
2556
|
+
const visibleColors = trimEnds ? colors.slice(1, -1) : colors;
|
|
2557
|
+
const totalSteps = colors.length - 1;
|
|
2558
|
+
const minNV = trimEnds ? 1 / totalSteps : 0;
|
|
2559
|
+
const maxNV = trimEnds ? 1 - 1 / totalSteps : 1;
|
|
2560
|
+
const range = maxNV - minNV;
|
|
2561
|
+
const clampedValue = value !== void 0 ? Math.min(maxNV, Math.max(minNV, value)) : (maxNV + minNV) / 2;
|
|
2562
|
+
const ratio = range > 0 ? (maxNV - clampedValue) / range : 0.5;
|
|
2563
|
+
const usableWidth = Math.max(0, trackWidth.current - THUMB_SIZE4);
|
|
2564
|
+
const thumbLeft = ratio * usableWidth;
|
|
2565
|
+
React13.useEffect(() => {
|
|
2566
|
+
if (isDragging.current || !animateValue) {
|
|
2567
|
+
thumbAnim.setValue(thumbLeft);
|
|
2568
|
+
} else {
|
|
2569
|
+
Animated.timing(thumbAnim, {
|
|
2570
|
+
toValue: thumbLeft,
|
|
2571
|
+
duration: 300,
|
|
2572
|
+
useNativeDriver: false
|
|
2573
|
+
}).start();
|
|
2574
|
+
}
|
|
2575
|
+
}, [thumbLeft, animateValue, thumbAnim]);
|
|
2576
|
+
return /* @__PURE__ */ React13.createElement(View, { style: [styles.container, ...Array.isArray(style) ? style : [style]] }, label && /* @__PURE__ */ React13.createElement(View, { style: styles.labelRow }, /* @__PURE__ */ React13.createElement(Text, { style: styles.label }, label)), /* @__PURE__ */ React13.createElement(
|
|
2577
|
+
View,
|
|
2417
2578
|
{
|
|
2418
|
-
ref,
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2579
|
+
ref: trackRef,
|
|
2580
|
+
style: styles.trackContainer,
|
|
2581
|
+
onLayout: (e) => {
|
|
2582
|
+
trackWidth.current = e.nativeEvent.layout.width;
|
|
2583
|
+
const newUsableWidth = Math.max(0, e.nativeEvent.layout.width - THUMB_SIZE4);
|
|
2584
|
+
thumbAnim.setValue(ratio * newUsableWidth);
|
|
2585
|
+
trackRef.current?.measure((_x, _y, _w, _h, pageX) => {
|
|
2586
|
+
if (pageX != null) trackPageX.current = pageX;
|
|
2587
|
+
});
|
|
2588
|
+
},
|
|
2589
|
+
...panResponder.panHandlers
|
|
2424
2590
|
},
|
|
2425
|
-
|
|
2426
|
-
|
|
2591
|
+
/* @__PURE__ */ React13.createElement(View, { style: styles.gradientTrack }, visibleColors.map((color, i) => /* @__PURE__ */ React13.createElement(View, { key: i, style: [styles.segment, { backgroundColor: srgbToHex(color.srgb) }] }))),
|
|
2592
|
+
/* @__PURE__ */ React13.createElement(Animated.View, { style: [styles.thumb, { left: thumbAnim }] })
|
|
2593
|
+
), warning && /* @__PURE__ */ React13.createElement(Text, { style: styles.warning }, warning));
|
|
2427
2594
|
}
|
|
2428
2595
|
function getAppShellStyles(tokens) {
|
|
2429
2596
|
return StyleSheet.create({
|
|
@@ -2442,11 +2609,11 @@ function getAppShellStyles(tokens) {
|
|
|
2442
2609
|
});
|
|
2443
2610
|
}
|
|
2444
2611
|
|
|
2445
|
-
// src/AppShell/AppShell.tsx
|
|
2612
|
+
// src/composites/layout/AppShell/AppShell.tsx
|
|
2446
2613
|
function AppShell({ sidebar, children }) {
|
|
2447
2614
|
const tokens = useTokens();
|
|
2448
|
-
const styles =
|
|
2449
|
-
return /* @__PURE__ */
|
|
2615
|
+
const styles = React13.useMemo(() => getAppShellStyles(tokens), [tokens]);
|
|
2616
|
+
return /* @__PURE__ */ React13.createElement(View, { style: styles.container }, sidebar, /* @__PURE__ */ React13.createElement(View, { style: styles.main }, children));
|
|
2450
2617
|
}
|
|
2451
2618
|
function getSidebarStyles({ tokens, width, bordered }) {
|
|
2452
2619
|
const borderColor = srgbToHex(tokens.border.srgb);
|
|
@@ -2475,7 +2642,7 @@ function getSidebarStyles({ tokens, width, bordered }) {
|
|
|
2475
2642
|
});
|
|
2476
2643
|
}
|
|
2477
2644
|
|
|
2478
|
-
// src/Sidebar/Sidebar.tsx
|
|
2645
|
+
// src/composites/layout/Sidebar/Sidebar.tsx
|
|
2479
2646
|
function Sidebar({
|
|
2480
2647
|
children,
|
|
2481
2648
|
header,
|
|
@@ -2484,11 +2651,11 @@ function Sidebar({
|
|
|
2484
2651
|
bordered = true
|
|
2485
2652
|
}) {
|
|
2486
2653
|
const tokens = useTokens();
|
|
2487
|
-
const styles =
|
|
2654
|
+
const styles = React13.useMemo(
|
|
2488
2655
|
() => getSidebarStyles({ tokens, width, bordered }),
|
|
2489
2656
|
[tokens, width, bordered]
|
|
2490
2657
|
);
|
|
2491
|
-
return /* @__PURE__ */
|
|
2658
|
+
return /* @__PURE__ */ React13.createElement(View, { style: styles.container }, header && /* @__PURE__ */ React13.createElement(View, { style: styles.header }, header), /* @__PURE__ */ React13.createElement(ScrollView, { style: styles.body }, children), footer && /* @__PURE__ */ React13.createElement(View, { style: styles.footer }, footer));
|
|
2492
2659
|
}
|
|
2493
2660
|
function getNavbarStyles({ tokens, height, bordered }) {
|
|
2494
2661
|
const borderColor = srgbToHex(tokens.border.srgb);
|
|
@@ -2517,7 +2684,7 @@ function getNavbarStyles({ tokens, height, bordered }) {
|
|
|
2517
2684
|
});
|
|
2518
2685
|
}
|
|
2519
2686
|
|
|
2520
|
-
// src/Navbar/Navbar.tsx
|
|
2687
|
+
// src/composites/layout/Navbar/Navbar.tsx
|
|
2521
2688
|
function Navbar({
|
|
2522
2689
|
children,
|
|
2523
2690
|
left,
|
|
@@ -2526,19 +2693,21 @@ function Navbar({
|
|
|
2526
2693
|
bordered = true
|
|
2527
2694
|
}) {
|
|
2528
2695
|
const tokens = useTokens();
|
|
2529
|
-
const styles =
|
|
2696
|
+
const styles = React13.useMemo(
|
|
2530
2697
|
() => getNavbarStyles({ tokens, height, bordered }),
|
|
2531
2698
|
[tokens, height, bordered]
|
|
2532
2699
|
);
|
|
2533
|
-
return /* @__PURE__ */
|
|
2700
|
+
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)));
|
|
2534
2701
|
}
|
|
2535
2702
|
|
|
2536
2703
|
// src/registry/registry.ts
|
|
2537
2704
|
var CATEGORIES = [
|
|
2705
|
+
{ id: "primitives", name: "Design Primitives", description: "Core building blocks for theme-aware layouts and typography" },
|
|
2538
2706
|
{ id: "actions", name: "Actions", description: "Interactive elements that trigger actions" },
|
|
2539
2707
|
{ id: "form-controls", name: "Form Controls", description: "Input elements for user data entry" },
|
|
2540
|
-
{ id: "range-inputs", name: "Range Inputs", description: "Slider controls for numeric values" },
|
|
2541
|
-
{ id: "layout", name: "Layout", description: "Structural and container components" }
|
|
2708
|
+
{ id: "range-inputs", name: "Range Inputs", description: "Slider controls for numeric and continuous values" },
|
|
2709
|
+
{ id: "layout", name: "Layout", description: "Structural and container components" },
|
|
2710
|
+
{ id: "overlays", name: "Overlays", description: "Floating and portal-based UI elements" }
|
|
2542
2711
|
];
|
|
2543
2712
|
var COMPONENTS = [
|
|
2544
2713
|
{
|
|
@@ -2919,6 +3088,216 @@ var COMPONENTS = [
|
|
|
2919
3088
|
defaultValue: false
|
|
2920
3089
|
}
|
|
2921
3090
|
]
|
|
3091
|
+
},
|
|
3092
|
+
// ── Design Primitives ──
|
|
3093
|
+
{
|
|
3094
|
+
id: "text",
|
|
3095
|
+
name: "Text",
|
|
3096
|
+
importName: "Text",
|
|
3097
|
+
categoryId: "primitives",
|
|
3098
|
+
description: "Typography primitive with semantic size, weight, color, font, and lineHeight",
|
|
3099
|
+
hasChildren: true,
|
|
3100
|
+
variants: [
|
|
3101
|
+
{ id: "default", label: "Default", props: {} },
|
|
3102
|
+
{ id: "heading", label: "Heading", props: { size: "xl", weight: "bold" } },
|
|
3103
|
+
{ id: "subheading", label: "Subheading", props: { size: "lg", weight: "semibold" } },
|
|
3104
|
+
{ id: "body", label: "Body", props: { size: "base" } },
|
|
3105
|
+
{ id: "caption", label: "Caption", props: { size: "sm", color: "secondary" } },
|
|
3106
|
+
{ id: "link", label: "Link", props: { color: "interactive", weight: "medium" } },
|
|
3107
|
+
{ id: "mono", label: "Monospace", props: { font: "mono", size: "sm" } }
|
|
3108
|
+
],
|
|
3109
|
+
editableProps: [
|
|
3110
|
+
{
|
|
3111
|
+
name: "size",
|
|
3112
|
+
label: "Size",
|
|
3113
|
+
control: "select",
|
|
3114
|
+
options: [
|
|
3115
|
+
{ label: "Extra Small", value: "xs" },
|
|
3116
|
+
{ label: "Small", value: "sm" },
|
|
3117
|
+
{ label: "Base", value: "base" },
|
|
3118
|
+
{ label: "Medium", value: "md" },
|
|
3119
|
+
{ label: "Large", value: "lg" },
|
|
3120
|
+
{ label: "Extra Large", value: "xl" },
|
|
3121
|
+
{ label: "XXL", value: "xxl" }
|
|
3122
|
+
],
|
|
3123
|
+
defaultValue: "base"
|
|
3124
|
+
},
|
|
3125
|
+
{
|
|
3126
|
+
name: "weight",
|
|
3127
|
+
label: "Weight",
|
|
3128
|
+
control: "select",
|
|
3129
|
+
options: [
|
|
3130
|
+
{ label: "Regular", value: "regular" },
|
|
3131
|
+
{ label: "Medium", value: "medium" },
|
|
3132
|
+
{ label: "Semibold", value: "semibold" },
|
|
3133
|
+
{ label: "Bold", value: "bold" }
|
|
3134
|
+
],
|
|
3135
|
+
defaultValue: "regular"
|
|
3136
|
+
},
|
|
3137
|
+
{
|
|
3138
|
+
name: "color",
|
|
3139
|
+
label: "Color",
|
|
3140
|
+
control: "select",
|
|
3141
|
+
options: [
|
|
3142
|
+
{ label: "Primary", value: "primary" },
|
|
3143
|
+
{ label: "Secondary", value: "secondary" },
|
|
3144
|
+
{ label: "Interactive", value: "interactive" }
|
|
3145
|
+
],
|
|
3146
|
+
defaultValue: "primary"
|
|
3147
|
+
},
|
|
3148
|
+
{
|
|
3149
|
+
name: "font",
|
|
3150
|
+
label: "Font",
|
|
3151
|
+
control: "select",
|
|
3152
|
+
options: [
|
|
3153
|
+
{ label: "Default", value: "default" },
|
|
3154
|
+
{ label: "Display", value: "display" },
|
|
3155
|
+
{ label: "Mono", value: "mono" }
|
|
3156
|
+
],
|
|
3157
|
+
defaultValue: "default"
|
|
3158
|
+
}
|
|
3159
|
+
]
|
|
3160
|
+
},
|
|
3161
|
+
{
|
|
3162
|
+
id: "icon",
|
|
3163
|
+
name: "Icon",
|
|
3164
|
+
importName: "Icon",
|
|
3165
|
+
categoryId: "primitives",
|
|
3166
|
+
description: "Material Symbols icon with size, fill, and color",
|
|
3167
|
+
hasChildren: false,
|
|
3168
|
+
variants: [
|
|
3169
|
+
{ id: "home", label: "Home", props: { name: "home" } },
|
|
3170
|
+
{ id: "settings", label: "Settings", props: { name: "settings" } },
|
|
3171
|
+
{ id: "check", label: "Check", props: { name: "check" } },
|
|
3172
|
+
{ id: "add", label: "Add", props: { name: "add" } },
|
|
3173
|
+
{ id: "delete", label: "Delete", props: { name: "delete" } },
|
|
3174
|
+
{ id: "search", label: "Search", props: { name: "search" } },
|
|
3175
|
+
{ id: "filled", label: "Filled Icon", props: { name: "favorite", fill: 1 } },
|
|
3176
|
+
{ id: "large", label: "Large Icon", props: { name: "star", size: 32 } }
|
|
3177
|
+
],
|
|
3178
|
+
editableProps: [
|
|
3179
|
+
{
|
|
3180
|
+
name: "name",
|
|
3181
|
+
label: "Icon Name",
|
|
3182
|
+
control: "text",
|
|
3183
|
+
defaultValue: "home"
|
|
3184
|
+
},
|
|
3185
|
+
{
|
|
3186
|
+
name: "size",
|
|
3187
|
+
label: "Size",
|
|
3188
|
+
control: "number",
|
|
3189
|
+
defaultValue: 24
|
|
3190
|
+
},
|
|
3191
|
+
{
|
|
3192
|
+
name: "fill",
|
|
3193
|
+
label: "Fill",
|
|
3194
|
+
control: "select",
|
|
3195
|
+
options: [
|
|
3196
|
+
{ label: "Outlined", value: 0 },
|
|
3197
|
+
{ label: "Filled", value: 1 }
|
|
3198
|
+
],
|
|
3199
|
+
defaultValue: 0
|
|
3200
|
+
}
|
|
3201
|
+
]
|
|
3202
|
+
},
|
|
3203
|
+
{
|
|
3204
|
+
id: "wrapper",
|
|
3205
|
+
name: "Wrapper",
|
|
3206
|
+
importName: "Wrapper",
|
|
3207
|
+
categoryId: "primitives",
|
|
3208
|
+
description: "Lightweight layout container with direction, spacing, and alignment (no theming)",
|
|
3209
|
+
hasChildren: true,
|
|
3210
|
+
variants: [
|
|
3211
|
+
{ id: "vertical", label: "Vertical Stack", props: { direction: "vertical", gap: "md" } },
|
|
3212
|
+
{ id: "horizontal", label: "Horizontal Row", props: { direction: "horizontal", gap: "md", align: "center" } },
|
|
3213
|
+
{ id: "padded", label: "Padded", props: { padding: "lg", gap: "md" } },
|
|
3214
|
+
{ id: "centered", label: "Centered", props: { align: "center", justify: "center", padding: "xl" } }
|
|
3215
|
+
],
|
|
3216
|
+
editableProps: [
|
|
3217
|
+
{
|
|
3218
|
+
name: "direction",
|
|
3219
|
+
label: "Direction",
|
|
3220
|
+
control: "select",
|
|
3221
|
+
options: [
|
|
3222
|
+
{ label: "Vertical", value: "vertical" },
|
|
3223
|
+
{ label: "Horizontal", value: "horizontal" }
|
|
3224
|
+
],
|
|
3225
|
+
defaultValue: "vertical"
|
|
3226
|
+
},
|
|
3227
|
+
{
|
|
3228
|
+
name: "gap",
|
|
3229
|
+
label: "Gap",
|
|
3230
|
+
control: "select",
|
|
3231
|
+
options: [
|
|
3232
|
+
{ label: "None", value: "" },
|
|
3233
|
+
{ label: "Small", value: "sm" },
|
|
3234
|
+
{ label: "Medium", value: "md" },
|
|
3235
|
+
{ label: "Large", value: "lg" }
|
|
3236
|
+
],
|
|
3237
|
+
defaultValue: ""
|
|
3238
|
+
},
|
|
3239
|
+
{
|
|
3240
|
+
name: "padding",
|
|
3241
|
+
label: "Padding",
|
|
3242
|
+
control: "select",
|
|
3243
|
+
options: [
|
|
3244
|
+
{ label: "None", value: "" },
|
|
3245
|
+
{ label: "Small", value: "sm" },
|
|
3246
|
+
{ label: "Medium", value: "md" },
|
|
3247
|
+
{ label: "Large", value: "lg" }
|
|
3248
|
+
],
|
|
3249
|
+
defaultValue: ""
|
|
3250
|
+
},
|
|
3251
|
+
{
|
|
3252
|
+
name: "align",
|
|
3253
|
+
label: "Align",
|
|
3254
|
+
control: "select",
|
|
3255
|
+
options: [
|
|
3256
|
+
{ label: "Start", value: "start" },
|
|
3257
|
+
{ label: "Center", value: "center" },
|
|
3258
|
+
{ label: "End", value: "end" }
|
|
3259
|
+
],
|
|
3260
|
+
defaultValue: "start"
|
|
3261
|
+
},
|
|
3262
|
+
{
|
|
3263
|
+
name: "justify",
|
|
3264
|
+
label: "Justify",
|
|
3265
|
+
control: "select",
|
|
3266
|
+
options: [
|
|
3267
|
+
{ label: "Start", value: "start" },
|
|
3268
|
+
{ label: "Center", value: "center" },
|
|
3269
|
+
{ label: "End", value: "end" },
|
|
3270
|
+
{ label: "Space Between", value: "space-between" }
|
|
3271
|
+
],
|
|
3272
|
+
defaultValue: "start"
|
|
3273
|
+
}
|
|
3274
|
+
]
|
|
3275
|
+
},
|
|
3276
|
+
// ── Range Inputs (Addition: ColorScaleSlider) ──
|
|
3277
|
+
{
|
|
3278
|
+
id: "color-scale-slider",
|
|
3279
|
+
name: "ColorScaleSlider",
|
|
3280
|
+
importName: "ColorScaleSlider",
|
|
3281
|
+
categoryId: "range-inputs",
|
|
3282
|
+
description: "Interactive palette preview slider with color segments",
|
|
3283
|
+
hasChildren: false,
|
|
3284
|
+
variants: [
|
|
3285
|
+
{ id: "default", label: "Default", props: { label: "Key Color" } }
|
|
3286
|
+
],
|
|
3287
|
+
editableProps: [
|
|
3288
|
+
{
|
|
3289
|
+
name: "label",
|
|
3290
|
+
label: "Label",
|
|
3291
|
+
control: "text",
|
|
3292
|
+
defaultValue: "Key Color"
|
|
3293
|
+
},
|
|
3294
|
+
{
|
|
3295
|
+
name: "disabled",
|
|
3296
|
+
label: "Disabled",
|
|
3297
|
+
control: "toggle",
|
|
3298
|
+
defaultValue: false
|
|
3299
|
+
}
|
|
3300
|
+
]
|
|
2922
3301
|
}
|
|
2923
3302
|
];
|
|
2924
3303
|
function getComponent(id) {
|
|
@@ -3087,6 +3466,6 @@ var SYSTEM_FONTS = [
|
|
|
3087
3466
|
}
|
|
3088
3467
|
];
|
|
3089
3468
|
|
|
3090
|
-
export { AppShell, Button, CATEGORIES, COMPONENTS, Card, ColorScaleSlider, DEFAULT_THEME_CONFIG, Frame, GOOGLE_FONTS, HueSlider, Icon, Navbar, NewtoneProvider, Popover, SYSTEM_FONTS, Select, Sidebar, Slider,
|
|
3469
|
+
export { AppShell, Button, CATEGORIES, COMPONENTS, Card, ColorScaleSlider, DEFAULT_THEME_CONFIG, Frame, GOOGLE_FONTS, HueSlider, Icon, Navbar, NewtoneProvider, Popover, SYSTEM_FONTS, Select, Sidebar, Slider, Text2 as Text, TextInput, Toggle, Wrapper, buildGoogleFontsUrl, computeTokens, generateComponentCode, getCategory, getComponent, getComponentsByCategory, isOptionGroup, useFocusVisible, useFrameContext, useNewtoneTheme, usePopover, useTokens };
|
|
3091
3470
|
//# sourceMappingURL=index.js.map
|
|
3092
3471
|
//# sourceMappingURL=index.js.map
|