@newtonedev/components 0.1.12 → 0.1.14
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/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts +4 -3
- package/dist/_COMPONENT_TEMPLATE/ComponentName.styles.d.ts.map +1 -1
- package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts +1 -1
- package/dist/_COMPONENT_TEMPLATE/ComponentName.types.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.d.ts +11 -1
- package/dist/composites/actions/Button/Button.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.styles.d.ts +1 -1
- package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -1
- package/dist/composites/actions/Button/Button.types.d.ts +11 -1
- package/dist/composites/actions/Button/Button.types.d.ts.map +1 -1
- package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts +10 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.d.ts.map +1 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts +35 -0
- package/dist/composites/branding/LogoMonogram/LogoMonogram.types.d.ts.map +1 -0
- package/dist/composites/branding/LogoMonogram/index.d.ts +3 -0
- package/dist/composites/branding/LogoMonogram/index.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts +9 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts +26 -0
- package/dist/composites/branding/LogoWordmark/LogoWordmark.types.d.ts.map +1 -0
- package/dist/composites/branding/LogoWordmark/index.d.ts +3 -0
- package/dist/composites/branding/LogoWordmark/index.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.d.ts +25 -0
- package/dist/composites/display/Chip/Chip.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.styles.d.ts +29 -0
- package/dist/composites/display/Chip/Chip.styles.d.ts.map +1 -0
- package/dist/composites/display/Chip/Chip.types.d.ts +63 -0
- package/dist/composites/display/Chip/Chip.types.d.ts.map +1 -0
- package/dist/composites/display/Chip/index.d.ts +3 -0
- package/dist/composites/display/Chip/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/Select.d.ts.map +1 -1
- package/dist/composites/form-controls/Select/Select.styles.d.ts +2 -2
- package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts +2 -2
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts +2 -2
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -1
- package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -1
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts +2 -2
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -1
- package/dist/composites/layout/Card/Card.d.ts.map +1 -1
- package/dist/composites/layout/Card/Card.styles.d.ts +2 -2
- package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -1
- package/dist/composites/layout/Card/Card.types.d.ts +1 -1
- package/dist/composites/layout/Card/Card.types.d.ts.map +1 -1
- package/dist/composites/layout/ContentCard/ContentCard.d.ts +33 -0
- package/dist/composites/layout/ContentCard/ContentCard.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts +10 -0
- package/dist/composites/layout/ContentCard/ContentCard.styles.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/ContentCard.types.d.ts +52 -0
- package/dist/composites/layout/ContentCard/ContentCard.types.d.ts.map +1 -0
- package/dist/composites/layout/ContentCard/index.d.ts +3 -0
- package/dist/composites/layout/ContentCard/index.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.d.ts +25 -0
- package/dist/composites/layout/Divider/Divider.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.styles.d.ts +8 -0
- package/dist/composites/layout/Divider/Divider.styles.d.ts.map +1 -0
- package/dist/composites/layout/Divider/Divider.types.d.ts +25 -0
- package/dist/composites/layout/Divider/Divider.types.d.ts.map +1 -0
- package/dist/composites/layout/Divider/index.d.ts +3 -0
- package/dist/composites/layout/Divider/index.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -1
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts +4 -2
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts +4 -2
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -1
- package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -1
- package/dist/composites/overlays/Popover/Popover.styles.d.ts +2 -2
- package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.d.ts +2 -0
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +1 -1
- package/dist/composites/range-inputs/HueSlider/HueSlider.d.ts +3 -4
- package/dist/composites/range-inputs/HueSlider/HueSlider.d.ts.map +1 -1
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts +3 -3
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -1
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -1
- package/dist/index.cjs +1609 -1693
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +22 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1454 -1621
- package/dist/index.js.map +1 -1
- package/dist/primitives/Frame/Frame.d.ts +1 -35
- package/dist/primitives/Frame/Frame.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.styles.d.ts +13 -3
- package/dist/primitives/Frame/Frame.styles.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.types.d.ts +99 -1
- package/dist/primitives/Frame/Frame.types.d.ts.map +1 -1
- package/dist/primitives/Frame/Frame.utils.d.ts +1 -1
- package/dist/primitives/Frame/Frame.utils.d.ts.map +1 -1
- package/dist/primitives/Frame/index.d.ts +1 -1
- package/dist/primitives/Frame/index.d.ts.map +1 -1
- package/dist/primitives/Icon/Icon.d.ts.map +1 -1
- package/dist/primitives/Icon/Icon.types.d.ts +2 -2
- package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
- package/dist/primitives/Text/Text.d.ts +6 -4
- package/dist/primitives/Text/Text.d.ts.map +1 -1
- package/dist/primitives/Text/Text.spans.d.ts.map +1 -1
- package/dist/primitives/Text/Text.types.d.ts +4 -7
- package/dist/primitives/Text/Text.types.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.d.ts +1 -1
- package/dist/primitives/Wrapper/Wrapper.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts +10 -2
- package/dist/primitives/Wrapper/Wrapper.styles.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts +31 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/_COMPONENT_TEMPLATE/ComponentName.styles.ts +4 -4
- package/src/_COMPONENT_TEMPLATE/ComponentName.tsx +2 -2
- package/src/_COMPONENT_TEMPLATE/ComponentName.types.ts +1 -1
- package/src/composites/actions/Button/Button.styles.ts +72 -55
- package/src/composites/actions/Button/Button.tsx +35 -14
- package/src/composites/actions/Button/Button.types.ts +13 -1
- package/src/composites/branding/LogoMonogram/LogoMonogram.tsx +29 -0
- package/src/composites/branding/LogoMonogram/LogoMonogram.types.ts +35 -0
- package/src/composites/branding/LogoMonogram/index.ts +2 -0
- package/src/composites/branding/LogoWordmark/LogoWordmark.tsx +29 -0
- package/src/composites/branding/LogoWordmark/LogoWordmark.types.ts +25 -0
- package/src/composites/branding/LogoWordmark/index.ts +2 -0
- package/src/composites/display/Chip/Chip.styles.ts +189 -0
- package/src/composites/display/Chip/Chip.tsx +97 -0
- package/src/composites/display/Chip/Chip.types.ts +74 -0
- package/src/composites/display/Chip/index.ts +2 -0
- package/src/composites/form-controls/Select/Select.styles.ts +10 -10
- package/src/composites/form-controls/Select/Select.tsx +9 -7
- package/src/composites/form-controls/Select/SelectOption.tsx +10 -8
- package/src/composites/form-controls/TextInput/TextInput.styles.ts +12 -9
- package/src/composites/form-controls/TextInput/TextInput.tsx +7 -5
- package/src/composites/form-controls/Toggle/Toggle.styles.ts +10 -7
- package/src/composites/form-controls/Toggle/Toggle.tsx +4 -3
- package/src/composites/layout/AppShell/AppShell.styles.ts +8 -4
- package/src/composites/layout/AppShell/AppShell.tsx +6 -2
- package/src/composites/layout/Card/Card.styles.ts +10 -5
- package/src/composites/layout/Card/Card.tsx +4 -3
- package/src/composites/layout/Card/Card.types.ts +1 -1
- package/src/composites/layout/ContentCard/ContentCard.styles.ts +44 -0
- package/src/composites/layout/ContentCard/ContentCard.tsx +71 -0
- package/src/composites/layout/ContentCard/ContentCard.types.ts +60 -0
- package/src/composites/layout/ContentCard/index.ts +2 -0
- package/src/composites/layout/Divider/Divider.styles.ts +30 -0
- package/src/composites/layout/Divider/Divider.tsx +46 -0
- package/src/composites/layout/Divider/Divider.types.ts +28 -0
- package/src/composites/layout/Divider/index.ts +2 -0
- package/src/composites/layout/Navbar/Navbar.styles.ts +7 -5
- package/src/composites/layout/Navbar/Navbar.tsx +4 -3
- package/src/composites/layout/Sidebar/Sidebar.styles.ts +7 -5
- package/src/composites/layout/Sidebar/Sidebar.tsx +4 -3
- package/src/composites/overlays/Popover/Popover.styles.ts +7 -5
- package/src/composites/overlays/Popover/Popover.tsx +4 -3
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +4 -5
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.tsx +6 -2
- package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.ts +2 -0
- package/src/composites/range-inputs/HueSlider/HueSlider.styles.ts +13 -20
- package/src/composites/range-inputs/HueSlider/HueSlider.tsx +7 -8
- package/src/composites/range-inputs/Slider/Slider.styles.ts +8 -9
- package/src/composites/range-inputs/Slider/Slider.tsx +1 -1
- package/src/index.ts +108 -61
- package/src/primitives/Frame/Frame.styles.ts +55 -11
- package/src/primitives/Frame/Frame.tsx +140 -142
- package/src/primitives/Frame/Frame.types.ts +119 -1
- package/src/primitives/Frame/Frame.utils.ts +1 -1
- package/src/primitives/Frame/index.ts +4 -0
- package/src/primitives/Icon/Icon.tsx +9 -7
- package/src/primitives/Icon/Icon.types.ts +2 -2
- package/src/primitives/Text/Text.spans.ts +9 -5
- package/src/primitives/Text/Text.tsx +33 -22
- package/src/primitives/Text/Text.types.ts +4 -7
- package/src/primitives/Wrapper/Wrapper.styles.ts +33 -1
- package/src/primitives/Wrapper/Wrapper.tsx +23 -4
- package/src/primitives/Wrapper/Wrapper.types.ts +45 -0
- package/dist/fonts/GoogleFontLoader.d.ts +0 -20
- package/dist/fonts/GoogleFontLoader.d.ts.map +0 -1
- package/dist/fonts/IconFontLoader.d.ts +0 -13
- package/dist/fonts/IconFontLoader.d.ts.map +0 -1
- package/dist/fonts/SelfHostedFontLoader.d.ts +0 -14
- package/dist/fonts/SelfHostedFontLoader.d.ts.map +0 -1
- package/dist/fonts/buildGoogleFontsUrl.d.ts +0 -2
- package/dist/fonts/buildGoogleFontsUrl.d.ts.map +0 -1
- package/dist/fonts/measureFont.d.ts +0 -19
- package/dist/fonts/measureFont.d.ts.map +0 -1
- package/dist/fonts/reportQueue.d.ts +0 -7
- package/dist/fonts/reportQueue.d.ts.map +0 -1
- package/dist/fonts/useLocalCalibration.d.ts +0 -19
- package/dist/fonts/useLocalCalibration.d.ts.map +0 -1
- package/dist/fonts/useTypographyCalibrations.d.ts +0 -11
- package/dist/fonts/useTypographyCalibrations.d.ts.map +0 -1
- package/dist/theme/FrameContext.d.ts +0 -26
- package/dist/theme/FrameContext.d.ts.map +0 -1
- package/dist/theme/NewtoneProvider.d.ts +0 -40
- package/dist/theme/NewtoneProvider.d.ts.map +0 -1
- package/dist/theme/defaults.d.ts +0 -8
- package/dist/theme/defaults.d.ts.map +0 -1
- package/dist/theme/types.d.ts +0 -156
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/useBreakpoint.d.ts +0 -9
- package/dist/theme/useBreakpoint.d.ts.map +0 -1
- package/dist/tokens/computeTokens.d.ts +0 -151
- package/dist/tokens/computeTokens.d.ts.map +0 -1
- package/dist/tokens/types.d.ts +0 -162
- package/dist/tokens/types.d.ts.map +0 -1
- package/dist/tokens/useTokens.d.ts +0 -26
- package/dist/tokens/useTokens.d.ts.map +0 -1
- package/src/fonts/GoogleFontLoader.tsx +0 -80
- package/src/fonts/IconFontLoader.tsx +0 -51
- package/src/fonts/SelfHostedFontLoader.tsx +0 -44
- package/src/fonts/buildGoogleFontsUrl.ts +0 -2
- package/src/fonts/measureFont.ts +0 -55
- package/src/fonts/reportQueue.ts +0 -54
- package/src/fonts/useLocalCalibration.ts +0 -97
- package/src/fonts/useTypographyCalibrations.ts +0 -15
- package/src/theme/FrameContext.tsx +0 -31
- package/src/theme/NewtoneProvider.tsx +0 -84
- package/src/theme/defaults.ts +0 -71
- package/src/theme/types.ts +0 -191
- package/src/theme/useBreakpoint.ts +0 -14
- package/src/tokens/computeTokens.ts +0 -516
- package/src/tokens/types.ts +0 -146
- package/src/tokens/useTokens.ts +0 -62
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { UseTokensResult } from '../../../tokens/useTokens';
|
|
3
|
-
import type { PaletteTokens } from '../../../tokens/types';
|
|
1
|
+
import type { UseTokensResult } from 'newtone-api';
|
|
4
2
|
import type { ButtonVariant, ButtonSemantic, ButtonSize } from './Button.types';
|
|
5
3
|
import type { TextSize } from '../../../primitives/Text/Text.types';
|
|
6
4
|
|
|
@@ -113,17 +111,12 @@ export function computeButtonPadding(
|
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
114
|
+
* Map button semantic to theme name in the new token architecture.
|
|
115
|
+
* 'accent' maps to 'primary'; others map directly.
|
|
118
116
|
*/
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
case 'success': return tokens.success;
|
|
123
|
-
case 'error': return tokens.error;
|
|
124
|
-
case 'warning': return tokens.warning;
|
|
125
|
-
default: return undefined;
|
|
126
|
-
}
|
|
117
|
+
function semanticToTheme(semantic: ButtonSemantic): 'primary' | 'success' | 'error' | 'warning' {
|
|
118
|
+
if (semantic === 'accent') return 'primary';
|
|
119
|
+
return semantic as 'success' | 'error' | 'warning';
|
|
127
120
|
}
|
|
128
121
|
|
|
129
122
|
/**
|
|
@@ -219,14 +212,14 @@ function getVariantColors(
|
|
|
219
212
|
// Disabled state overrides for all variants
|
|
220
213
|
if (disabled) {
|
|
221
214
|
const baseColors = getVariantColorsForState(variant, semantic, tokens);
|
|
222
|
-
const disabledBg =
|
|
215
|
+
const disabledBg = tokens.colors.primary.main.fontSecondary;
|
|
223
216
|
return {
|
|
224
217
|
...baseColors,
|
|
225
218
|
bg: disabledBg,
|
|
226
219
|
hoveredBg: disabledBg,
|
|
227
220
|
pressedBg: disabledBg,
|
|
228
|
-
textColor:
|
|
229
|
-
iconColor:
|
|
221
|
+
textColor: tokens.colors.primary.main.fontTertiary,
|
|
222
|
+
iconColor: tokens.colors.primary.main.fontTertiary,
|
|
230
223
|
};
|
|
231
224
|
}
|
|
232
225
|
|
|
@@ -235,7 +228,7 @@ function getVariantColors(
|
|
|
235
228
|
|
|
236
229
|
/**
|
|
237
230
|
* Get variant colors for non-disabled state.
|
|
238
|
-
* Implements
|
|
231
|
+
* Implements 4 types × 5 semantics = 20 combinations.
|
|
239
232
|
* Uses proper PaletteTokens for all semantic variants — no opacity hacks.
|
|
240
233
|
*/
|
|
241
234
|
function getVariantColorsForState(
|
|
@@ -243,30 +236,28 @@ function getVariantColorsForState(
|
|
|
243
236
|
semantic: ButtonSemantic,
|
|
244
237
|
tokens: UseTokensResult
|
|
245
238
|
) {
|
|
246
|
-
const paletteTokens = getPaletteTokens(semantic, tokens);
|
|
247
|
-
|
|
248
239
|
// PRIMARY VARIANT: Filled background
|
|
249
240
|
if (variant === 'primary') {
|
|
250
241
|
if (semantic === 'neutral') {
|
|
251
|
-
// Neutral primary - uses backgroundInteractive tokens for consistent contrast across elevations
|
|
252
242
|
return {
|
|
253
|
-
bg:
|
|
254
|
-
hoveredBg:
|
|
255
|
-
pressedBg:
|
|
256
|
-
textColor:
|
|
257
|
-
iconColor:
|
|
243
|
+
bg: tokens.colors.primary.main.fontPrimary,
|
|
244
|
+
hoveredBg: tokens.colors.primary.main.fontSecondary,
|
|
245
|
+
pressedBg: tokens.colors.primary.main.fontPrimary,
|
|
246
|
+
textColor: tokens.colors.primary.main.divider,
|
|
247
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
258
248
|
borderWidth: 1,
|
|
259
249
|
borderColor: 'transparent',
|
|
260
250
|
};
|
|
261
251
|
}
|
|
262
252
|
|
|
263
|
-
// Semantic primary (accent, success, error, warning)
|
|
253
|
+
// Semantic primary (accent, success, error, warning)
|
|
254
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
264
255
|
return {
|
|
265
|
-
bg:
|
|
266
|
-
hoveredBg:
|
|
267
|
-
pressedBg:
|
|
268
|
-
textColor:
|
|
269
|
-
iconColor:
|
|
256
|
+
bg: t.emphasis.background,
|
|
257
|
+
hoveredBg: t.emphasis.fontPrimary,
|
|
258
|
+
pressedBg: t.emphasis.fontSecondary,
|
|
259
|
+
textColor: t.main.background,
|
|
260
|
+
iconColor: t.main.background,
|
|
270
261
|
borderWidth: 1,
|
|
271
262
|
borderColor: 'transparent',
|
|
272
263
|
};
|
|
@@ -275,25 +266,25 @@ function getVariantColorsForState(
|
|
|
275
266
|
// SECONDARY VARIANT: Outlined (border + subtle background for non-neutral)
|
|
276
267
|
if (variant === 'secondary') {
|
|
277
268
|
if (semantic === 'neutral') {
|
|
278
|
-
// Shifted action scale: transparent → 01 (hover) → 02 (pressed)
|
|
279
269
|
return {
|
|
280
270
|
bg: 'transparent',
|
|
281
|
-
hoveredBg:
|
|
282
|
-
pressedBg:
|
|
283
|
-
textColor:
|
|
284
|
-
iconColor:
|
|
271
|
+
hoveredBg: tokens.colors.primary.main.fontPrimary,
|
|
272
|
+
pressedBg: tokens.colors.primary.main.fontSecondary,
|
|
273
|
+
textColor: tokens.colors.primary.main.divider,
|
|
274
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
285
275
|
borderWidth: 1,
|
|
286
|
-
borderColor:
|
|
276
|
+
borderColor: tokens.colors.primary.main.fontSecondary,
|
|
287
277
|
};
|
|
288
278
|
}
|
|
289
279
|
|
|
290
|
-
// Semantic secondary
|
|
280
|
+
// Semantic secondary
|
|
281
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
291
282
|
return {
|
|
292
|
-
bg:
|
|
293
|
-
hoveredBg:
|
|
294
|
-
pressedBg:
|
|
295
|
-
textColor:
|
|
296
|
-
iconColor:
|
|
283
|
+
bg: t.tinted.background,
|
|
284
|
+
hoveredBg: t.tinted.fontPrimary,
|
|
285
|
+
pressedBg: t.tinted.fontSecondary,
|
|
286
|
+
textColor: t.emphasis.divider,
|
|
287
|
+
iconColor: t.emphasis.divider,
|
|
297
288
|
borderWidth: 1,
|
|
298
289
|
borderColor: 'transparent',
|
|
299
290
|
};
|
|
@@ -302,37 +293,63 @@ function getVariantColorsForState(
|
|
|
302
293
|
// TERTIARY VARIANT: Ghost (text-only, no visible border)
|
|
303
294
|
if (variant === 'tertiary') {
|
|
304
295
|
if (semantic === 'neutral') {
|
|
305
|
-
// Shifted action scale: transparent → 01 (hover) → 02 (pressed)
|
|
306
296
|
return {
|
|
307
297
|
bg: 'transparent',
|
|
308
|
-
hoveredBg:
|
|
309
|
-
pressedBg:
|
|
310
|
-
textColor:
|
|
311
|
-
iconColor:
|
|
298
|
+
hoveredBg: tokens.colors.primary.main.fontPrimary,
|
|
299
|
+
pressedBg: tokens.colors.primary.main.fontSecondary,
|
|
300
|
+
textColor: tokens.colors.primary.main.divider,
|
|
301
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
312
302
|
borderWidth: 1,
|
|
313
303
|
borderColor: 'transparent',
|
|
314
304
|
};
|
|
315
305
|
}
|
|
316
306
|
|
|
317
|
-
// Semantic tertiary
|
|
307
|
+
// Semantic tertiary
|
|
308
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
318
309
|
return {
|
|
319
310
|
bg: 'transparent',
|
|
320
|
-
hoveredBg:
|
|
321
|
-
pressedBg:
|
|
322
|
-
textColor:
|
|
323
|
-
iconColor:
|
|
311
|
+
hoveredBg: t.tinted.background,
|
|
312
|
+
pressedBg: t.tinted.fontPrimary,
|
|
313
|
+
textColor: t.emphasis.divider,
|
|
314
|
+
iconColor: t.emphasis.divider,
|
|
324
315
|
borderWidth: 1,
|
|
325
316
|
borderColor: 'transparent',
|
|
326
317
|
};
|
|
327
318
|
}
|
|
328
319
|
|
|
320
|
+
// LINK VARIANT: Text-only with underline on hover, no background
|
|
321
|
+
if (variant === 'link') {
|
|
322
|
+
if (semantic === 'neutral') {
|
|
323
|
+
return {
|
|
324
|
+
bg: 'transparent',
|
|
325
|
+
hoveredBg: 'transparent',
|
|
326
|
+
pressedBg: 'transparent',
|
|
327
|
+
textColor: tokens.colors.primary.main.fontSecondary,
|
|
328
|
+
iconColor: tokens.colors.primary.main.fontSecondary,
|
|
329
|
+
borderWidth: 0,
|
|
330
|
+
borderColor: 'transparent',
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
335
|
+
return {
|
|
336
|
+
bg: 'transparent',
|
|
337
|
+
hoveredBg: 'transparent',
|
|
338
|
+
pressedBg: 'transparent',
|
|
339
|
+
textColor: t.emphasis.divider,
|
|
340
|
+
iconColor: t.emphasis.divider,
|
|
341
|
+
borderWidth: 0,
|
|
342
|
+
borderColor: 'transparent',
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
329
346
|
// Fallback (should never reach here with proper types)
|
|
330
347
|
return {
|
|
331
348
|
bg: 'transparent',
|
|
332
349
|
hoveredBg: 'transparent',
|
|
333
350
|
pressedBg: 'transparent',
|
|
334
|
-
textColor:
|
|
335
|
-
iconColor:
|
|
351
|
+
textColor: tokens.colors.primary.main.divider,
|
|
352
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
336
353
|
borderWidth: 0,
|
|
337
354
|
};
|
|
338
355
|
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
import type { ButtonProps } from './Button.types';
|
|
4
4
|
import { getButtonConfig, computeButtonPadding } from './Button.styles';
|
|
5
|
-
import { useTokens } from '
|
|
5
|
+
import { useTokens } from 'newtone-api';
|
|
6
6
|
import { Icon } from '../../../primitives/Icon/Icon';
|
|
7
7
|
import { Text } from '../../../primitives/Text';
|
|
8
8
|
import { Wrapper } from '../../../primitives/Wrapper/Wrapper';
|
|
@@ -39,6 +39,16 @@ import { Wrapper } from '../../../primitives/Wrapper/Wrapper';
|
|
|
39
39
|
* ```tsx
|
|
40
40
|
* <Button icon="delete" variant="tertiary" semantic="neutral" size="sm" onPress={handleDelete} />
|
|
41
41
|
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <Button variant="link" semantic="accent" onPress={handleNav}>Learn more</Button>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Button loading onPress={handleSubmit}>Saving...</Button>
|
|
51
|
+
* ```
|
|
42
52
|
*/
|
|
43
53
|
export function Button({
|
|
44
54
|
children,
|
|
@@ -48,28 +58,35 @@ export function Button({
|
|
|
48
58
|
semantic = 'neutral',
|
|
49
59
|
size = 'md',
|
|
50
60
|
disabled = false,
|
|
61
|
+
loading = false,
|
|
62
|
+
fullWidth = false,
|
|
51
63
|
style,
|
|
52
64
|
textStyle,
|
|
53
65
|
...pressableProps
|
|
54
66
|
}: ButtonProps) {
|
|
55
67
|
// Read tokens from current elevation context
|
|
56
|
-
// backgroundInteractive provides consistent contrast across all elevations
|
|
57
68
|
const tokens = useTokens();
|
|
58
69
|
|
|
59
|
-
//
|
|
70
|
+
// Loading implies disabled
|
|
71
|
+
const isDisabled = disabled || loading;
|
|
72
|
+
|
|
73
|
+
// Get color tokens + size config
|
|
60
74
|
const { variantColors, sizeTokens } = React.useMemo(
|
|
61
|
-
() => getButtonConfig(variant, semantic, size,
|
|
62
|
-
[variant, semantic, size,
|
|
75
|
+
() => getButtonConfig(variant, semantic, size, isDisabled, tokens),
|
|
76
|
+
[variant, semantic, size, isDisabled, tokens]
|
|
63
77
|
);
|
|
64
78
|
|
|
65
79
|
// Compute asymmetric padding (+8px on text side for optical balance)
|
|
80
|
+
// Link variant uses minimal padding
|
|
66
81
|
const padding = React.useMemo(
|
|
67
|
-
() =>
|
|
68
|
-
|
|
82
|
+
() => variant === 'link'
|
|
83
|
+
? { paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0 }
|
|
84
|
+
: computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
85
|
+
[size, icon, children, iconPosition, variant]
|
|
69
86
|
);
|
|
70
87
|
|
|
71
88
|
return (
|
|
72
|
-
<Pressable disabled={
|
|
89
|
+
<Pressable disabled={isDisabled} {...pressableProps}>
|
|
73
90
|
{({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) => (
|
|
74
91
|
// Wrapper handles layout: direction, gap, alignment (padding via style)
|
|
75
92
|
<Wrapper
|
|
@@ -80,15 +97,16 @@ export function Button({
|
|
|
80
97
|
style={[
|
|
81
98
|
{
|
|
82
99
|
...padding, // Asymmetric horizontal padding for text optical balance
|
|
83
|
-
backgroundColor: pressed && !
|
|
100
|
+
backgroundColor: pressed && !isDisabled
|
|
84
101
|
? variantColors.pressedBg
|
|
85
|
-
: hovered && !
|
|
102
|
+
: hovered && !isDisabled
|
|
86
103
|
? variantColors.hoveredBg
|
|
87
104
|
: variantColors.bg,
|
|
88
|
-
borderRadius: sizeTokens.borderRadius,
|
|
89
|
-
borderWidth: variantColors.borderWidth,
|
|
105
|
+
borderRadius: variant === 'link' ? 0 : sizeTokens.borderRadius,
|
|
106
|
+
borderWidth: variantColors.borderWidth,
|
|
90
107
|
borderColor: variantColors.borderColor || 'transparent',
|
|
91
|
-
opacity:
|
|
108
|
+
opacity: isDisabled ? (loading ? 0.6 : 0.4) : (variant === 'link' && pressed ? 0.7 : 1),
|
|
109
|
+
...(fullWidth && { width: '100%' as any, alignSelf: 'stretch' as any }),
|
|
92
110
|
},
|
|
93
111
|
...(Array.isArray(style) ? style : style ? [style] : []),
|
|
94
112
|
]}
|
|
@@ -103,7 +121,10 @@ export function Button({
|
|
|
103
121
|
size={sizeTokens.textSize}
|
|
104
122
|
centerVertically
|
|
105
123
|
style={[
|
|
106
|
-
{
|
|
124
|
+
{
|
|
125
|
+
color: variantColors.textColor,
|
|
126
|
+
...(variant === 'link' && hovered && { textDecorationLine: 'underline' as any }),
|
|
127
|
+
},
|
|
107
128
|
...(Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []),
|
|
108
129
|
]}
|
|
109
130
|
>
|
|
@@ -3,7 +3,7 @@ import type { PressableProps, ViewStyle, TextStyle } from 'react-native';
|
|
|
3
3
|
/**
|
|
4
4
|
* Visual type for the Button component (describes visual weight)
|
|
5
5
|
*/
|
|
6
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
6
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'link';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Semantic meaning for the Button component (describes color purpose)
|
|
@@ -66,6 +66,18 @@ export interface ButtonProps extends Omit<PressableProps, 'children' | 'style'>
|
|
|
66
66
|
*/
|
|
67
67
|
readonly disabled?: boolean;
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Loading state — disables interaction and dims content.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
readonly loading?: boolean;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Full-width mode — stretches button to fill container width.
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
readonly fullWidth?: boolean;
|
|
80
|
+
|
|
69
81
|
/**
|
|
70
82
|
* Custom style overrides for container
|
|
71
83
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { LogoMonogramProps } from './LogoMonogram.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Newtone monogram — the "N" symbol mark rendered as an SVG.
|
|
6
|
+
*
|
|
7
|
+
* The fill color is derived from `colorValue` (0 = black, 255 = white),
|
|
8
|
+
* allowing smooth animated transitions between light and dark contexts.
|
|
9
|
+
*/
|
|
10
|
+
export function LogoMonogram({ colorValue = 0, size = 32 }: LogoMonogramProps) {
|
|
11
|
+
// Convert the 0–255 grayscale value to an rgb() string.
|
|
12
|
+
const fg = `rgb(${colorValue}, ${colorValue}, ${colorValue})`;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<svg
|
|
16
|
+
width={size}
|
|
17
|
+
height={size}
|
|
18
|
+
viewBox="0 0 168 168"
|
|
19
|
+
fill="none"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
>
|
|
22
|
+
<path d="M39.3574 70H12L20 84H36L30.2681 94.0309C28.8627 96.4903 28.8627 99.5096 30.2681 101.969L36 112L49.7319 87.9691C51.1373 85.5097 51.1373 82.4903 49.7319 80.0309L46.3034 74.0309C44.879 71.5383 42.2283 70 39.3574 70Z" fill={fg} />
|
|
23
|
+
<path d="M84 112H36L41.6966 121.969C43.121 124.462 45.7717 126 48.6426 126H79.3574C82.2283 126 84.879 124.462 86.3034 121.969L93.7319 108.969C95.1373 106.51 95.1373 103.49 93.7319 101.031L84 84L76 98L84 112Z" fill={fg} />
|
|
24
|
+
<path d="M76 70L84 84H64.6426C61.7717 84 59.121 82.4617 57.6966 79.9691L50.268 66.9691C48.8626 64.5097 48.8626 61.4903 50.268 59.0309L65.6966 32.0309C67.121 29.5383 69.7717 28 72.6426 28H84L60 70H76Z" fill={fg} />
|
|
25
|
+
<path d="M95.3574 28H84L132 112L137.732 101.969C139.137 99.5097 139.137 96.4903 137.732 94.0309L102.303 32.0309C100.879 29.5383 98.2283 28 95.3574 28Z" fill={fg} />
|
|
26
|
+
<path d="M104.643 112H132L126.303 121.969C124.879 124.462 122.228 126 119.357 126H108L116 140L108 154L94.268 129.969C92.8626 127.51 92.8626 124.49 94.268 122.031L97.6966 116.031C99.121 113.538 101.772 112 104.643 112Z" fill={fg} />
|
|
27
|
+
</svg>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for LogoMonogram — the Newtone "N" symbol mark.
|
|
3
|
+
*
|
|
4
|
+
* Renders a single-color SVG monogram that scales to the given size.
|
|
5
|
+
* The `colorValue` prop controls the grayscale fill, enabling smooth
|
|
6
|
+
* transitions between light and dark backgrounds.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <LogoMonogram colorValue={0} />
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <LogoMonogram colorValue={255} size={48} />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export interface LogoMonogramProps {
|
|
19
|
+
/**
|
|
20
|
+
* Grayscale fill value (0–255).
|
|
21
|
+
*
|
|
22
|
+
* - `0` produces black (for light backgrounds)
|
|
23
|
+
* - `255` produces white (for dark backgrounds)
|
|
24
|
+
*
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
readonly colorValue?: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Width and height of the SVG in pixels.
|
|
31
|
+
*
|
|
32
|
+
* @default 32
|
|
33
|
+
*/
|
|
34
|
+
readonly size?: number;
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { LogoWordmarkProps } from './LogoWordmark.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Newtone wordmark — the full "NEWTONE" text rendered as an SVG.
|
|
6
|
+
*
|
|
7
|
+
* Fixed height of 32px with proportional width derived from the viewBox.
|
|
8
|
+
*/
|
|
9
|
+
export function LogoWordmark({ fill = 'black' }: LogoWordmarkProps) {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
height={32}
|
|
13
|
+
viewBox="0 0 504 168"
|
|
14
|
+
fill="none"
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
>
|
|
17
|
+
<path d="M8 126H22V42H14.4C12.1598 42 11.0397 42 10.184 42.436C9.43139 42.8195 8.81947 43.4314 8.43597 44.184C8 45.0397 8 46.1598 8 48.4V126Z" fill={fill} />
|
|
18
|
+
<path d="M76 108.5V42H90V119.6C90 121.84 90 122.96 89.564 123.816C89.1805 124.569 88.5686 125.181 87.816 125.564C86.9603 126 85.8402 126 83.6 126H77.4281C74.7227 126 73.37 126 72.1603 125.605C71.0899 125.256 70.1054 124.684 69.271 123.928C68.328 123.074 67.6569 121.9 66.3146 119.551L22 42H30.5719C33.2773 42 34.63 42 35.8397 42.3949C36.9101 42.7442 37.8946 43.3156 38.729 44.0716C39.672 44.926 40.3431 46.1005 41.6854 48.4494L76 108.5Z" fill={fill} />
|
|
19
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M152.208 68.2077C153.395 69.3951 153.989 69.9888 154.439 70.6738C154.838 71.2814 155.152 71.9406 155.374 72.6332C155.623 73.4139 155.711 74.2489 155.886 75.9189L156.884 85.3951C157.27 89.0678 157.464 90.9042 156.867 92.3245C156.343 93.5721 155.412 94.6057 154.226 95.2577C152.876 96 151.03 96 147.337 96H112V114H154V126H115.302C113.345 126 112.367 126 111.446 125.779C110.63 125.583 109.849 125.26 109.134 124.821C108.326 124.326 107.635 123.635 106.251 122.251L101.749 117.749C100.365 116.365 99.6736 115.674 99.1789 114.866C98.7402 114.151 98.417 113.37 98.221 112.554C98 111.633 98 110.655 98 108.698V75.3019C98 73.3452 98 72.3668 98.221 71.4461C98.417 70.6299 98.7402 69.8495 99.1789 69.1337C99.6736 68.3264 100.365 67.6346 101.749 66.251L106.251 61.749C107.635 60.3654 108.326 59.6736 109.134 59.1789C109.849 58.7402 110.63 58.417 111.446 58.221C112.367 58 113.345 58 115.302 58H136.698C138.655 58 139.633 58 140.554 58.221C141.37 58.417 142.151 58.7402 142.866 59.1789C143.674 59.6736 144.365 60.3654 145.749 61.749L152.208 68.2077ZM112 70V87.5332L144.492 86.4502L141.895 70H112Z" fill={fill} />
|
|
20
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M492.208 68.2077C493.395 69.3951 493.989 69.9888 494.439 70.6738C494.838 71.2814 495.152 71.9406 495.374 72.6332C495.623 73.4139 495.711 74.2489 495.886 75.9189L496.884 85.3951C497.27 89.0678 497.464 90.9042 496.867 92.3245C496.343 93.5721 495.412 94.6057 494.226 95.2577C492.876 96 491.03 96 487.337 96H452V114H494V126H455.302C453.345 126 452.367 126 451.446 125.779C450.63 125.583 449.849 125.26 449.134 124.821C448.326 124.326 447.635 123.635 446.251 122.251L441.749 117.749C440.365 116.365 439.674 115.674 439.179 114.866C438.74 114.151 438.417 113.37 438.221 112.554C438 111.633 438 110.655 438 108.698V75.3019C438 73.3452 438 72.3668 438.221 71.4461C438.417 70.6299 438.74 69.8495 439.179 69.1337C439.674 68.3264 440.365 67.6346 441.749 66.251L446.251 61.749C447.635 60.3654 448.326 59.6736 449.134 59.1789C449.849 58.7402 450.63 58.417 451.446 58.221C452.367 58 453.345 58 455.302 58H476.698C478.655 58 479.633 58 480.554 58.221C481.37 58.417 482.151 58.7402 482.866 59.1789C483.674 59.6736 484.365 60.3654 485.749 61.749L492.208 68.2077ZM452 70V87.5332L484.492 86.4502L481.895 70H452Z" fill={fill} />
|
|
21
|
+
<path d="M168.794 117.797L160 58H174L184 126H178.291C175.35 126 173.88 126 172.695 125.46C171.651 124.984 170.765 124.219 170.142 123.255C169.435 122.161 169.222 120.706 168.794 117.797Z" fill={fill} />
|
|
22
|
+
<path d="M192.794 66.2033L184 126H187.674C190.626 126 192.102 126 193.29 125.457C194.337 124.979 195.224 124.209 195.846 123.241C196.551 122.141 196.76 120.68 197.177 117.758L204 70L210.823 117.758C211.24 120.68 211.449 122.141 212.154 123.241C212.776 124.209 213.663 124.979 214.71 125.457C215.898 126 217.374 126 220.326 126H224L215.206 66.2033C214.778 63.2936 214.565 61.8387 213.858 60.7448C213.235 59.7808 212.349 59.0155 211.305 58.5398C210.12 58 208.65 58 205.709 58H202.291C199.35 58 197.88 58 196.695 58.5398C195.651 59.0155 194.765 59.7808 194.142 60.7448C193.435 61.8387 193.222 63.2936 192.794 66.2033Z" fill={fill} />
|
|
23
|
+
<path d="M224 126H229.709C232.65 126 234.12 126 235.305 125.46C236.349 124.984 237.235 124.219 237.858 123.255C238.565 122.161 238.778 120.706 239.206 117.797L246.235 70H298V58H251.302C249.345 58 248.367 58 247.446 58.221C246.63 58.417 245.849 58.7402 245.134 59.1789C244.326 59.6736 243.635 60.3654 242.251 61.749L234.927 69.0727C233.815 70.1845 233.26 70.7405 232.829 71.3785C232.447 71.9446 232.139 72.5573 231.913 73.2016C231.658 73.9277 231.543 74.7056 231.315 76.2613L224 126Z" fill={fill} />
|
|
24
|
+
<path d="M264.251 122.251L259.749 117.749C258.365 116.365 257.674 115.674 257.179 114.866C256.74 114.151 256.417 113.37 256.221 112.554C256 111.633 256 110.655 256 108.698V69.2L260 42H270V114H298V126H273.302C271.345 126 270.367 126 269.446 125.779C268.63 125.583 267.849 125.26 267.134 124.821C266.326 124.326 265.635 123.635 264.251 122.251Z" fill={fill} />
|
|
25
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M358.251 66.251C359.635 67.6346 360.326 68.3264 360.821 69.1337C361.26 69.8495 361.583 70.6299 361.779 71.4461C362 72.3668 362 73.3452 362 75.3019V108.698C362 110.655 362 111.633 361.779 112.554C361.583 113.37 361.26 114.151 360.821 114.866C360.326 115.674 359.635 116.365 358.251 117.749L353.749 122.251C352.365 123.635 351.674 124.326 350.866 124.821C350.151 125.26 349.37 125.583 348.554 125.779C347.633 126 346.655 126 344.698 126H319.302C317.345 126 316.367 126 315.446 125.779C314.63 125.583 313.849 125.26 313.134 124.821C312.326 124.326 311.635 123.635 310.251 122.251L305.749 117.749C304.365 116.365 303.674 115.674 303.179 114.866C302.74 114.151 302.417 113.37 302.221 112.554C302 111.633 302 110.655 302 108.698V75.3019C302 73.3452 302 72.3668 302.221 71.4461C302.417 70.6299 302.74 69.8495 303.179 69.1337C303.674 68.3264 304.365 67.6346 305.749 66.251L310.224 61.7757C311.606 60.3937 312.297 59.7027 313.104 59.2083C313.818 58.77 314.598 58.4468 315.413 58.2506C316.333 58.0292 317.31 58.0284 319.264 58.0267L344.692 58.0046C346.651 58.0029 347.63 58.0021 348.552 58.2228C349.369 58.4185 350.151 58.7417 350.867 59.1807C351.676 59.6757 352.368 60.3684 353.754 61.7536L358.251 66.251ZM316 70V114H348V70H316Z" fill={fill} />
|
|
26
|
+
<path d="M370 64.4V126H384V70H416V126H430V75.3019C430 73.3452 430 72.3668 429.779 71.4461C429.583 70.6299 429.26 69.8495 428.821 69.1337C428.326 68.3264 427.635 67.6346 426.251 66.251L421.749 61.749C420.365 60.3654 419.674 59.6736 418.866 59.1789C418.151 58.7402 417.37 58.417 416.554 58.221C415.633 58 414.655 58 412.698 58H376.4C374.16 58 373.04 58 372.184 58.436C371.431 58.8195 370.819 59.4314 370.436 60.184C370 61.0397 370 62.1598 370 64.4Z" fill={fill} />
|
|
27
|
+
</svg>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for LogoWordmark — the full "NEWTONE" text logo.
|
|
3
|
+
*
|
|
4
|
+
* Renders an SVG wordmark at a fixed 32px height with configurable fill color.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <LogoWordmark />
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <LogoWordmark fill="white" />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export interface LogoWordmarkProps {
|
|
17
|
+
/**
|
|
18
|
+
* Fill color for the wordmark paths.
|
|
19
|
+
*
|
|
20
|
+
* Accepts any valid CSS color string (hex, rgb, named color).
|
|
21
|
+
*
|
|
22
|
+
* @default "black"
|
|
23
|
+
*/
|
|
24
|
+
readonly fill?: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { UseTokensResult } from 'newtone-api';
|
|
2
|
+
import type { ChipVariant, ChipSemantic, ChipSize } from './Chip.types';
|
|
3
|
+
import type { TextRole } from '../../../primitives/Text';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration returned by getChipConfig
|
|
7
|
+
*/
|
|
8
|
+
export interface ChipConfig {
|
|
9
|
+
colors: {
|
|
10
|
+
bg: string;
|
|
11
|
+
hoveredBg: string;
|
|
12
|
+
pressedBg: string;
|
|
13
|
+
textColor: string;
|
|
14
|
+
iconColor: string;
|
|
15
|
+
borderWidth: number;
|
|
16
|
+
borderColor: string;
|
|
17
|
+
};
|
|
18
|
+
sizeTokens: {
|
|
19
|
+
paddingX: number;
|
|
20
|
+
paddingY: number;
|
|
21
|
+
gap: number;
|
|
22
|
+
textRole: TextRole;
|
|
23
|
+
iconSize: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Map chip semantic to theme name.
|
|
29
|
+
* 'accent' maps to 'primary'; others map directly.
|
|
30
|
+
*/
|
|
31
|
+
function semanticToTheme(semantic: ChipSemantic): 'primary' | 'success' | 'error' | 'warning' {
|
|
32
|
+
if (semantic === 'accent') return 'primary';
|
|
33
|
+
return semantic as 'success' | 'error' | 'warning';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get size configuration for the chip.
|
|
38
|
+
*/
|
|
39
|
+
function getSizeConfig(size: ChipSize): {
|
|
40
|
+
paddingX: number;
|
|
41
|
+
paddingY: number;
|
|
42
|
+
gap: number;
|
|
43
|
+
textRole: TextRole;
|
|
44
|
+
iconSize: number;
|
|
45
|
+
} {
|
|
46
|
+
if (size === 'sm') {
|
|
47
|
+
return { paddingX: 10, paddingY: 3, gap: 4, textRole: 'caption', iconSize: 16 };
|
|
48
|
+
}
|
|
49
|
+
return { paddingX: 16, paddingY: 8, gap: 6, textRole: 'label', iconSize: 20 };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get variant colors for the chip.
|
|
54
|
+
*/
|
|
55
|
+
function getVariantColors(
|
|
56
|
+
variant: ChipVariant,
|
|
57
|
+
semantic: ChipSemantic,
|
|
58
|
+
selected: boolean,
|
|
59
|
+
disabled: boolean,
|
|
60
|
+
tokens: UseTokensResult
|
|
61
|
+
) {
|
|
62
|
+
// Selected state overrides to strong appearance
|
|
63
|
+
if (selected) {
|
|
64
|
+
if (semantic === 'neutral') {
|
|
65
|
+
return {
|
|
66
|
+
bg: tokens.colors.primary.strong.background,
|
|
67
|
+
hoveredBg: tokens.colors.primary.strong.fontPrimary,
|
|
68
|
+
pressedBg: tokens.colors.primary.strong.background,
|
|
69
|
+
textColor: tokens.colors.primary.strong.fontPrimary,
|
|
70
|
+
iconColor: tokens.colors.primary.strong.fontPrimary,
|
|
71
|
+
borderWidth: 1,
|
|
72
|
+
borderColor: 'transparent',
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
76
|
+
return {
|
|
77
|
+
bg: t.emphasis.background,
|
|
78
|
+
hoveredBg: t.emphasis.fontPrimary,
|
|
79
|
+
pressedBg: t.emphasis.background,
|
|
80
|
+
textColor: t.main.background,
|
|
81
|
+
iconColor: t.main.background,
|
|
82
|
+
borderWidth: 1,
|
|
83
|
+
borderColor: 'transparent',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Disabled state
|
|
88
|
+
if (disabled) {
|
|
89
|
+
return {
|
|
90
|
+
bg: 'transparent',
|
|
91
|
+
hoveredBg: 'transparent',
|
|
92
|
+
pressedBg: 'transparent',
|
|
93
|
+
textColor: tokens.colors.primary.main.fontTertiary,
|
|
94
|
+
iconColor: tokens.colors.primary.main.fontTertiary,
|
|
95
|
+
borderWidth: 1,
|
|
96
|
+
borderColor: tokens.colors.primary.main.divider,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Filled variant
|
|
101
|
+
if (variant === 'filled') {
|
|
102
|
+
if (semantic === 'neutral') {
|
|
103
|
+
return {
|
|
104
|
+
bg: tokens.colors.primary.main.fontPrimary,
|
|
105
|
+
hoveredBg: tokens.colors.primary.main.fontSecondary,
|
|
106
|
+
pressedBg: tokens.colors.primary.main.fontPrimary,
|
|
107
|
+
textColor: tokens.colors.primary.main.divider,
|
|
108
|
+
iconColor: tokens.colors.primary.main.divider,
|
|
109
|
+
borderWidth: 1,
|
|
110
|
+
borderColor: 'transparent',
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
114
|
+
return {
|
|
115
|
+
bg: t.emphasis.background,
|
|
116
|
+
hoveredBg: t.emphasis.fontPrimary,
|
|
117
|
+
pressedBg: t.emphasis.fontSecondary,
|
|
118
|
+
textColor: t.main.background,
|
|
119
|
+
iconColor: t.main.background,
|
|
120
|
+
borderWidth: 1,
|
|
121
|
+
borderColor: 'transparent',
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Tinted variant
|
|
126
|
+
if (variant === 'tinted') {
|
|
127
|
+
if (semantic === 'neutral') {
|
|
128
|
+
return {
|
|
129
|
+
bg: tokens.colors.primary.tinted.background,
|
|
130
|
+
hoveredBg: tokens.colors.primary.tinted.fontPrimary,
|
|
131
|
+
pressedBg: tokens.colors.primary.tinted.fontSecondary,
|
|
132
|
+
textColor: tokens.colors.primary.main.fontPrimary,
|
|
133
|
+
iconColor: tokens.colors.primary.main.fontPrimary,
|
|
134
|
+
borderWidth: 1,
|
|
135
|
+
borderColor: 'transparent',
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
139
|
+
return {
|
|
140
|
+
bg: t.tinted.background,
|
|
141
|
+
hoveredBg: t.tinted.fontPrimary,
|
|
142
|
+
pressedBg: t.tinted.fontSecondary,
|
|
143
|
+
textColor: t.emphasis.divider,
|
|
144
|
+
iconColor: t.emphasis.divider,
|
|
145
|
+
borderWidth: 1,
|
|
146
|
+
borderColor: 'transparent',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Outlined variant
|
|
151
|
+
if (semantic === 'neutral') {
|
|
152
|
+
return {
|
|
153
|
+
bg: 'transparent',
|
|
154
|
+
hoveredBg: tokens.colors.primary.tinted.background,
|
|
155
|
+
pressedBg: tokens.colors.primary.tinted.fontPrimary,
|
|
156
|
+
textColor: tokens.colors.primary.main.fontPrimary,
|
|
157
|
+
iconColor: tokens.colors.primary.main.fontPrimary,
|
|
158
|
+
borderWidth: 1,
|
|
159
|
+
borderColor: tokens.colors.primary.main.divider,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
const t = tokens.colors[semanticToTheme(semantic)];
|
|
163
|
+
return {
|
|
164
|
+
bg: 'transparent',
|
|
165
|
+
hoveredBg: t.tinted.background,
|
|
166
|
+
pressedBg: t.tinted.fontPrimary,
|
|
167
|
+
textColor: t.emphasis.divider,
|
|
168
|
+
iconColor: t.emphasis.divider,
|
|
169
|
+
borderWidth: 1,
|
|
170
|
+
borderColor: t.tinted.fontSecondary,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Compute chip configuration based on variant, semantic, size, and state.
|
|
176
|
+
*/
|
|
177
|
+
export function getChipConfig(
|
|
178
|
+
variant: ChipVariant,
|
|
179
|
+
semantic: ChipSemantic,
|
|
180
|
+
size: ChipSize,
|
|
181
|
+
selected: boolean,
|
|
182
|
+
disabled: boolean,
|
|
183
|
+
tokens: UseTokensResult
|
|
184
|
+
): ChipConfig {
|
|
185
|
+
return {
|
|
186
|
+
colors: getVariantColors(variant, semantic, selected, disabled, tokens),
|
|
187
|
+
sizeTokens: getSizeConfig(size),
|
|
188
|
+
};
|
|
189
|
+
}
|