|
| 1 | +import * as colorTokens from 'outsystems-design-tokens/tokens/color scheme.json'; |
| 2 | +import * as primitiveTokens from 'outsystems-design-tokens/tokens/primitives.json'; |
| 3 | +import * as lightTokens from 'outsystems-design-tokens/tokens/theme/light.json'; |
| 4 | +import * as typographyTokens from 'outsystems-design-tokens/tokens/typography.json'; |
| 5 | + |
| 6 | +import { currentColor, cachedResolveOsToken } from '../../utils/theme'; |
1 | 7 | import { defaultTheme as baseDefaultTheme } from '../base/default.tokens'; |
2 | 8 | import type { DefaultTheme } from '../themes.interfaces'; |
3 | 9 |
|
4 | 10 | import { darkTheme } from './dark.tokens'; |
5 | 11 | import { lightTheme } from './light.tokens'; |
6 | 12 |
|
| 13 | +const tokenMap = { |
| 14 | + colorTokens, |
| 15 | + primitiveTokens, |
| 16 | + lightTokens, |
| 17 | + typographyTokens, |
| 18 | +}; |
| 19 | + |
7 | 20 | export const defaultTheme: DefaultTheme = { |
8 | 21 | ...baseDefaultTheme, |
9 | 22 |
|
@@ -76,4 +89,102 @@ export const defaultTheme: DefaultTheme = { |
76 | 89 | xxxl: 'var(--ion-radii-1000)', |
77 | 90 | xxxxl: 'var(--ion-radii-full)', |
78 | 91 | }, |
| 92 | + |
| 93 | + components: { |
| 94 | + IonChip: { |
| 95 | + margin: '0px', |
| 96 | + padding: { |
| 97 | + vertical: primitiveTokens.scale['150'].$value, |
| 98 | + horizontal: primitiveTokens.scale['200'].$value, |
| 99 | + }, |
| 100 | + typography: cachedResolveOsToken(typographyTokens.body.sm.medium.$value, tokenMap), |
| 101 | + lineHeight: primitiveTokens.font['line-height']['full'].$value, |
| 102 | + |
| 103 | + // Sizes |
| 104 | + size: { |
| 105 | + small: { |
| 106 | + height: primitiveTokens.scale['600'].$value, |
| 107 | + fontSize: primitiveTokens.font['font-size']['300'].$value, |
| 108 | + }, |
| 109 | + large: { |
| 110 | + height: primitiveTokens.scale['800'].$value, |
| 111 | + fontSize: primitiveTokens.font['font-size']['350'].$value, |
| 112 | + }, |
| 113 | + }, |
| 114 | + |
| 115 | + // States |
| 116 | + state: { |
| 117 | + disabled: { |
| 118 | + opacity: '0.4', |
| 119 | + }, |
| 120 | + focus: { |
| 121 | + ring: { |
| 122 | + color: lightTokens.primitives.blue['400'].$value, |
| 123 | + width: primitiveTokens.scale['050'].$value, |
| 124 | + }, |
| 125 | + }, |
| 126 | + }, |
| 127 | + |
| 128 | + // Shapes |
| 129 | + shape: { |
| 130 | + soft: { |
| 131 | + borderRadius: primitiveTokens.scale['100'].$value, |
| 132 | + }, |
| 133 | + round: { |
| 134 | + borderRadius: primitiveTokens.scale['400'].$value, |
| 135 | + }, |
| 136 | + rectangular: { |
| 137 | + borderRadius: primitiveTokens.scale['0'].$value, |
| 138 | + }, |
| 139 | + }, |
| 140 | + |
| 141 | + // Hues |
| 142 | + hue: { |
| 143 | + bold: { |
| 144 | + bg: cachedResolveOsToken(colorTokens.bg.neutral.bold.default, tokenMap), |
| 145 | + color: lightTokens.primitives.base.white.$value, |
| 146 | + |
| 147 | + outline: { |
| 148 | + borderColor: lightTokens.primitives.neutral['1200'].$value, |
| 149 | + }, |
| 150 | + |
| 151 | + // Any of the semantic colors like primary, secondary, etc. |
| 152 | + semantic: { |
| 153 | + color: currentColor('contrast'), |
| 154 | + |
| 155 | + outline: { |
| 156 | + borderColor: currentColor('shade'), |
| 157 | + bg: currentColor('base'), |
| 158 | + }, |
| 159 | + }, |
| 160 | + }, |
| 161 | + subtle: { |
| 162 | + bg: cachedResolveOsToken(lightTokens.primitives.neutral['100'], tokenMap), |
| 163 | + color: lightTokens.primitives.neutral['800'].$value, |
| 164 | + |
| 165 | + outline: { |
| 166 | + borderColor: lightTokens.primitives.neutral['300'].$value, |
| 167 | + }, |
| 168 | + |
| 169 | + semantic: { |
| 170 | + outline: { |
| 171 | + borderColor: currentColor('shade', null, true), |
| 172 | + bg: currentColor('base', null, true), |
| 173 | + }, |
| 174 | + }, |
| 175 | + }, |
| 176 | + }, |
| 177 | + |
| 178 | + // Variants |
| 179 | + variant: { |
| 180 | + outline: { |
| 181 | + borderWidth: primitiveTokens.scale['025'].$value, |
| 182 | + }, |
| 183 | + }, |
| 184 | + |
| 185 | + icon: { |
| 186 | + size: primitiveTokens.font['font-size']['400'].$value, |
| 187 | + }, |
| 188 | + }, |
| 189 | + }, |
79 | 190 | }; |
0 commit comments