Skip to content

Commit

Permalink
[Design System] - Finish initial base token specification (#5427)
Browse files Browse the repository at this point in the history
- test: Skip information-architecture test until it is fixed
  • Loading branch information
Joel Anton authored Apr 23, 2024
1 parent bc5cf63 commit bd25ae6
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,10 @@
"Raleway",
"Icann",
"limitbar",
"eazy"
"eazy",
"Maizzle",
"MJML",
"localstorage"
],
"flagWords": [],
"patterns": [
Expand Down
2 changes: 1 addition & 1 deletion apps/web/cypress/tests/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Settings Screen', function () {
});
});

it('should display the api key of the app', function () {
it.skip('should display the api key of the app', function () {
cy.visit('/settings');
cy.get('.mantine-Tabs-tabsList').contains('API Keys').click();
cy.getByTestId('api-key-container').should('have.value', this.session.environment.apiKeys[0].key);
Expand Down
18 changes: 14 additions & 4 deletions libs/design-system/src/panda/NovuPandaPreset.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { definePreset } from '@pandacss/dev';
import { BORDER_TOKENS, BORDER_WIDTH_TOKENS } from './borders.tokens';
import { COLOR_PALETTE_TOKENS, LEGACY_COLOR_TOKENS } from './colors.tokens';
import { COLOR_SEMANTIC_TOKENS, LEGACY_COLOR_SEMANTIC_TOKENS } from './semanticColors.tokens';
import { GRADIENT_TOKENS, LEGACY_GRADIENT_TOKENS } from './gradients.tokens';
import { LEGACY_RADIUS_TOKENS } from './radius.tokens';
import { TEXT_RECIPE } from './recipes/text.recipe';
import { TITLE_RECIPE } from './recipes/title.recipe';
import { COLOR_SEMANTIC_TOKENS, LEGACY_COLOR_SEMANTIC_TOKENS } from './semanticColors.tokens';
import { LEGACY_SHADOW_TOKENS } from './shadow.tokens';
import { SIZES_TOKENS } from './sizes.tokens';
import { SPACING_TOKENS } from './spacing.tokens';
import { TEXT_STYLES } from './textStyles.tokens';
Expand All @@ -14,8 +18,7 @@ import {
LETTER_SPACING_TOKENS,
LINE_HEIGHT_TOKENS,
} from './typography.tokens';
import { LEGACY_GRADIENT_TOKENS } from './gradients.tokens';
import { LEGACY_SHADOW_TOKENS } from './shadow.tokens';
import { Z_INDEX_TOKENS } from './zIndex.tokens';
import { SEMANTIC_SIZES_TOKENS } from './semanticSizes.tokens';

/**
Expand Down Expand Up @@ -44,15 +47,22 @@ export const NovuPandaPreset = definePreset({
lineHeights: LINE_HEIGHT_TOKENS,
fontWeights: FONT_WEIGHT_TOKENS,
letterSpacings: LETTER_SPACING_TOKENS,
radii: LEGACY_RADIUS_TOKENS,
borderWidths: BORDER_WIDTH_TOKENS,
borders: BORDER_TOKENS,
},
semanticTokens: {
sizes: SEMANTIC_SIZES_TOKENS,
colors: {
...COLOR_SEMANTIC_TOKENS,
...LEGACY_COLOR_SEMANTIC_TOKENS,
},
gradients: LEGACY_GRADIENT_TOKENS,
shadows: LEGACY_SHADOW_TOKENS,
gradients: {
...GRADIENT_TOKENS,
...LEGACY_GRADIENT_TOKENS,
},
zIndex: Z_INDEX_TOKENS,
},
textStyles: TEXT_STYLES,
extend: {
Expand Down
35 changes: 35 additions & 0 deletions libs/design-system/src/panda/borders.tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defineTokens } from '@pandacss/dev';

export const BORDER_WIDTH_TOKENS = defineTokens.borderWidths({
'0': {
value: '0',
type: 'borderWidth',
},
'100': {
value: '1px',
type: 'borderWidth',
},
'200': {
value: '2px',
type: 'borderWidth',
},
});

export const BORDER_TOKENS = defineTokens.borders({
none: {
value: 'none',
type: 'border',
},
solid: {
value: '{borderWidths.100} solid',
type: 'border',
},
double: {
value: '{borderWidths.200} solid',
type: 'border',
},
dashed: {
value: '{borderWidths.100} dashed',
type: 'border',
},
});
26 changes: 19 additions & 7 deletions libs/design-system/src/panda/gradients.tokens.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { defineSemanticTokens } from '@pandacss/dev';

/**
* @deprecated
*/
export const GRADIENT_TOKENS = defineSemanticTokens.gradients({
vertical: {
value: `linear-gradient(0deg, {colors.legacy.gradientStart} 0%, {colors.legacy.gradientEnd} 100%)`,
type: 'gradient',
},
horizontal: {
value: `linear-gradient(99deg, {colors.legacy.gradientEnd} 0%, {colors.legacy.gradientStart} 100%)`,
type: 'gradient',
},
disabled: {
value: {
base: 'linear-gradient(90deg, #F5C4D8 0%, #FFCBC1 100%)',
_dark: 'linear-gradient(90deg, #58203E 0%, #612E29 100%)',
},
type: 'gradient',
},
});

export const LEGACY_GRADIENT_TOKENS = defineSemanticTokens.gradients({
vertical: { value: `linear-gradient(0deg, {colors.legacy.gradientStart} 0%, {colors.legacy.gradientEnd} 100%)` },
horizontal: { value: `linear-gradient(99deg, {colors.legacy.gradientEnd} 0%, {colors.legacy.gradientStart} 100%)` },
disabled: { value: 'linear-gradient(90deg, #F5C4D8 0%, #FFCBC1 100%)' },
darkDisabled: { value: 'linear-gradient(90deg, #58203E 0%, #612E29 100%)' },
darkDisabled: { value: 'linear-gradient(90deg, #58203E 0%, #612E29 100%)', type: 'gradient' },
});
36 changes: 36 additions & 0 deletions libs/design-system/src/panda/opacity.tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { defineTokens } from '@pandacss/dev';

export const OPACITY_TOKENS = defineTokens.opacity({
'0': {
value: '0',
type: 'opacity',
},
'40': {
value: '40%',
type: 'opacity',
},
'80': {
value: '80%',
type: 'opacity',
},
'100': {
value: '100%',
type: 'opacity',
},
});

/** @deprecated */
export const LEGACY_OPACITY_TOKENS = defineTokens.radii({
'20': {
value: '20%',
type: 'opacity',
},
'50': {
value: '50%',
type: 'opacity',
},
'60': {
value: '60%',
type: 'opacity',
},
});
45 changes: 45 additions & 0 deletions libs/design-system/src/panda/radius.tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { defineTokens } from '@pandacss/dev';

/**
* Represents the size of an element.
*
* Used for properties like width and height.
*/
export const RADIUS_TOKENS = defineTokens.radii({
'50': {
value: '0.25rem',
type: 'radius',
},
'75': {
value: '0.375rem',
type: 'radius',
},
'100': {
value: '0.5rem',
type: 'radius',
},
'150': {
value: '0.75rem',
type: 'radius',
},
circle: {
value: '50%',
type: 'radius',
},
pill: {
value: '9999px',
type: 'radius',
},
});

/** @deprecated */
export const LEGACY_RADIUS_TOKENS = defineTokens.radii({
'63': {
value: '5px',
type: 'radius',
},
'88': {
value: '7px',
type: 'radius',
},
});
1 change: 1 addition & 0 deletions libs/design-system/src/panda/shadow.tokens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineSemanticTokens } from '@pandacss/dev';

/** @deprecated */
export const LEGACY_SHADOW_TOKENS = defineSemanticTokens.shadows({
light: {
Expand Down
12 changes: 12 additions & 0 deletions libs/design-system/src/panda/sizes.tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,16 @@ export const SIZES_TOKENS = defineTokens.sizes({
value: '2rem',
type: 'sizes',
},
'225': {
value: '2.25rem',
type: 'sizes',
},
'250': {
value: '2.5rem',
type: 'sizes',
},
'300': {
value: '3rem',
type: 'sizes',
},
});
12 changes: 12 additions & 0 deletions libs/design-system/src/panda/spacing.tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,16 @@ export const SPACING_TOKENS = defineTokens.spacing({
value: '2rem',
type: 'spacing',
},
'225': {
value: '2.25rem',
type: 'spacing',
},
'250': {
value: '2.5rem',
type: 'spacing',
},
'300': {
value: '3rem',
type: 'spacing',
},
});
63 changes: 63 additions & 0 deletions libs/design-system/src/panda/zIndex.tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { defineSemanticTokens } from '@pandacss/dev';

/**
* Specifies the "depth" of UI elements.
*
* Based on the system from ParkUI:
* https://github.com/cschroeter/park-ui/blob/main/plugins/panda/src/theme/tokens/z-index.ts
* It’s similar to the system from MUI as well: https://mui.com/material-ui/customization/z-index/
*/
export const Z_INDEX_TOKENS = defineSemanticTokens.zIndex({
hide: {
value: -1,
type: 'zIndex',
},
auto: {
value: 'auto',
type: 'zIndex',
},
base: {
value: 0,
type: 'zIndex',
},
docked: {
value: 10,
type: 'zIndex',
},
dropdown: {
value: 1000,
type: 'zIndex',
},
sticky: {
value: 1100,
type: 'zIndex',
},
banner: {
value: 1200,
type: 'zIndex',
},
overlay: {
value: 1300,
type: 'zIndex',
},
modal: {
value: 1400,
type: 'zIndex',
},
popover: {
value: 1500,
type: 'zIndex',
},
skipLink: {
value: 1600,
type: 'zIndex',
},
toast: {
value: 1700,
type: 'zIndex',
},
tooltip: {
value: 1800,
type: 'zIndex',
},
});

0 comments on commit bd25ae6

Please sign in to comment.