From 65bb41023bfdec8b869bd9adf0ac422de0d1bb80 Mon Sep 17 00:00:00 2001 From: Esthefanie Vila Maior Date: Thu, 16 May 2024 19:10:16 +0100 Subject: [PATCH 1/2] feat: add border types --- .../system/src/{ => border}/border.test.js | 2 +- .../system/src/{border.js => border/index.ts} | 4 +- packages/system/src/border/types.ts | 128 ++++++++++++++++++ packages/tokens/src/index.ts | 1 + 4 files changed, 132 insertions(+), 3 deletions(-) rename packages/system/src/{ => border}/border.test.js (99%) rename packages/system/src/{border.js => border/index.ts} (98%) create mode 100644 packages/system/src/border/types.ts diff --git a/packages/system/src/border.test.js b/packages/system/src/border/border.test.js similarity index 99% rename from packages/system/src/border.test.js rename to packages/system/src/border/border.test.js index fdaf0be9e5..5ae9e1620c 100644 --- a/packages/system/src/border.test.js +++ b/packages/system/src/border/border.test.js @@ -20,7 +20,7 @@ import { borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius, -} from './border'; +} from '.'; const borders = [0, 1, 2]; diff --git a/packages/system/src/border.js b/packages/system/src/border/index.ts similarity index 98% rename from packages/system/src/border.js rename to packages/system/src/border/index.ts index 2d2efc141d..47300dc3dc 100644 --- a/packages/system/src/border.js +++ b/packages/system/src/border/index.ts @@ -1,11 +1,11 @@ -import { toPx } from './unit'; +import { toPx } from '../unit'; import { getBorder, getColor, getBorderRadius, generator, compose, -} from './theme'; +} from '../theme'; const transform = value => { if (Number(value) && value !== 0) { diff --git a/packages/system/src/border/types.ts b/packages/system/src/border/types.ts new file mode 100644 index 0000000000..6cfe5406f2 --- /dev/null +++ b/packages/system/src/border/types.ts @@ -0,0 +1,128 @@ +import { borders, colors, radii } from '@gympass/yoga-tokens'; + +type BorderValues = typeof borders | number | string; +type BorderColorsValues = typeof colors | string; +type BorderRadiusValues = typeof radii | number | string; + +type Border = { + border?: BorderValues; + b?: BorderValues; +}; + +type BorderTop = { + borderTop?: BorderValues; + bt?: BorderValues; +}; + +type BorderRight = { + borderRight?: BorderValues; + br?: BorderValues; +}; + +type BorderBottom = { + borderBottom?: BorderValues; + bb?: BorderValues; +}; + +type BorderLeft = { + borderLeft?: BorderValues; + bl?: BorderValues; +}; + +type BorderColor = { + borderColor?: BorderColorsValues; + bc?: BorderColorsValues; +}; + +type BorderTopColor = { + borderTopColor?: BorderColorsValues; + btc?: BorderColorsValues; +}; + +type BorderRightColor = { + borderRightColor?: BorderColorsValues; + brc?: BorderColorsValues; +}; + +type BorderBottomColor = { + borderBottomColor?: BorderColorsValues; + bbc?: BorderColorsValues; +}; + +type BorderLeftColor = { + borderLeftColor?: BorderColorsValues; + blc?: BorderColorsValues; +}; + +type BorderWidth = { + borderWidth?: BorderValues; + bw?: BorderValues; +}; + +type BorderTopWidth = { + borderTopWidth?: BorderValues; + btw?: BorderValues; +}; + +type BorderRightWidth = { + borderRightWidth?: BorderValues; + brw?: BorderValues; +}; + +type BorderBottomWidth = { + borderBottomWidth?: BorderValues; + bbw?: BorderValues; +}; + +type BorderLeftWidth = { + borderLeftWidth?: BorderValues; + blw?: BorderValues; +}; + +type BorderRadius = { + borderRadius?: BorderRadiusValues; + bRadius?: BorderRadiusValues; +}; + +type BorderTopLeftRadius = { + borderTopLeftRadius?: BorderRadiusValues; + btlr?: BorderRadiusValues; +}; + +type BorderTopRightRadius = { + borderTopRightRadius?: BorderRadiusValues; + btrr?: BorderRadiusValues; +}; + +type BorderBottomLeftRadius = { + borderBottomLeftRadius?: BorderRadiusValues; + bblr?: BorderRadiusValues; +}; + +type BorderBottomRightRadius = { + borderBottomRightRadius?: BorderRadiusValues; + bbrr?: BorderRadiusValues; +}; + +export type Borders = { + borderStyle?: string; +} & Border & + BorderTop & + BorderRight & + BorderBottom & + BorderLeft & + BorderColor & + BorderTopColor & + BorderRightColor & + BorderBottomColor & + BorderLeftColor & + BorderWidth & + BorderTopWidth & + BorderRightWidth & + BorderBottomWidth & + BorderLeftWidth & + BorderRadius & + BorderTopLeftRadius & + BorderTopRightRadius & + BorderBottomLeftRadius & + BorderBottomRightRadius; diff --git a/packages/tokens/src/index.ts b/packages/tokens/src/index.ts index 92c336930f..5308d91f8e 100644 --- a/packages/tokens/src/index.ts +++ b/packages/tokens/src/index.ts @@ -3,3 +3,4 @@ import znCn from './locale/zn-cn'; import { BreakpointsKey, BreakpointsType } from './global/breakpoints'; export { tokens as default, znCn, BreakpointsKey, BreakpointsType }; +export * from './global' From 66e2497ff635798f40c746c9f11ce81bb481759c Mon Sep 17 00:00:00 2001 From: Matheus Henrique Date: Wed, 22 May 2024 16:14:03 -0300 Subject: [PATCH 2/2] fix(tokens): fix semicolon --- packages/tokens/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tokens/src/index.ts b/packages/tokens/src/index.ts index 5308d91f8e..71529f2510 100644 --- a/packages/tokens/src/index.ts +++ b/packages/tokens/src/index.ts @@ -3,4 +3,4 @@ import znCn from './locale/zn-cn'; import { BreakpointsKey, BreakpointsType } from './global/breakpoints'; export { tokens as default, znCn, BreakpointsKey, BreakpointsType }; -export * from './global' +export * from './global';