@atb-as/theme 11.0.0-alpha.8 → 11.0.0-rc.0

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.
Files changed (50) hide show
  1. package/package.json +11 -12
  2. package/lib/index.d.ts +0 -2
  3. package/lib/index.js +0 -3
  4. package/lib/index.js.map +0 -1
  5. package/lib/theme.d.ts +0 -300
  6. package/lib/theme.js +0 -113
  7. package/lib/theme.js.map +0 -1
  8. package/lib/themes/atb-theme/dark.d.ts +0 -419
  9. package/lib/themes/atb-theme/dark.js +0 -419
  10. package/lib/themes/atb-theme/dark.js.map +0 -1
  11. package/lib/themes/atb-theme/light.d.ts +0 -419
  12. package/lib/themes/atb-theme/light.js +0 -419
  13. package/lib/themes/atb-theme/light.js.map +0 -1
  14. package/lib/themes/atb-theme/theme.css +0 -760
  15. package/lib/themes/atb-theme/theme.d.ts +0 -836
  16. package/lib/themes/atb-theme/theme.js +0 -11
  17. package/lib/themes/atb-theme/theme.js.map +0 -1
  18. package/lib/themes/atb-theme/theme.module.css +0 -760
  19. package/lib/themes/index.d.ts +0 -1
  20. package/lib/themes/index.js +0 -6
  21. package/lib/themes/index.js.map +0 -1
  22. package/lib/themes-fs/atb-theme/dark.d.ts +0 -722
  23. package/lib/themes-fs/atb-theme/dark.js +0 -722
  24. package/lib/themes-fs/atb-theme/dark.js.map +0 -1
  25. package/lib/themes-fs/atb-theme/light.d.ts +0 -722
  26. package/lib/themes-fs/atb-theme/light.js +0 -722
  27. package/lib/themes-fs/atb-theme/light.js.map +0 -1
  28. package/lib/themes-fs/atb-theme/theme.d.ts +0 -1442
  29. package/lib/themes-fs/atb-theme/theme.js +0 -11
  30. package/lib/themes-fs/atb-theme/theme.js.map +0 -1
  31. package/lib/themes-fs/index.d.ts +0 -1
  32. package/lib/themes-fs/index.js +0 -6
  33. package/lib/themes-fs/index.js.map +0 -1
  34. package/lib/typography/android.d.ts +0 -3
  35. package/lib/typography/android.js +0 -116
  36. package/lib/typography/android.js.map +0 -1
  37. package/lib/typography/index.d.ts +0 -63
  38. package/lib/typography/index.js +0 -73
  39. package/lib/typography/index.js.map +0 -1
  40. package/lib/typography/ios.d.ts +0 -3
  41. package/lib/typography/ios.js +0 -115
  42. package/lib/typography/ios.js.map +0 -1
  43. package/lib/typography/types.d.ts +0 -21
  44. package/lib/typography/types.js +0 -24
  45. package/lib/typography/types.js.map +0 -1
  46. package/lib/typography.css +0 -260
  47. package/lib/typography.module.css +0 -260
  48. package/lib/utils/override-config.d.ts +0 -8
  49. package/lib/utils/override-config.js +0 -23
  50. package/lib/utils/override-config.js.map +0 -1
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@atb-as/theme",
3
- "version": "11.0.0-alpha.8",
3
+ "version": "11.0.0-rc.0",
4
4
  "private": false,
5
5
  "description": "AtB Design System Colors",
6
6
  "license": "EUPL-1.2",
7
- "type": "module",
8
- "main": "lib/index.js",
9
- "types": "lib/index.d.ts",
7
+ "type": "commonjs",
8
+ "main": "./lib/index.js",
9
+ "types": "./lib/index.d.ts",
10
10
  "files": [
11
- "lib"
11
+ "./lib/**/*"
12
12
  ],
13
13
  "scripts": {
14
14
  "pack": "yarn pack",
15
15
  "tsc": "tsc",
16
16
  "clean": "rm -rf lib",
17
17
  "test": "echo \"Error: run tests from root\" && exit 1",
18
- "build": "yarn fetch-variables && tsc -p tsconfig.build.json && yarn create-css && yarn copy-css",
19
- "copy-css": "copyfiles -u 1 \"src/**/*.{css,woff,woff2,ttf,eot,svg,png}\" lib/",
18
+ "build": "yarn create-css && tsc -p tsconfig.build.json && yarn copy-css",
19
+ "copy-css": "copyfiles -u 1 \"src/**/*.{css,woff,woff2,ttf,eot,svg,png}\" lib",
20
20
  "create-css": "tsx ./tools/create-css.ts",
21
21
  "fetch-variables": "tsx ./tools/fetch-figma-variables.ts"
22
22
  },
@@ -26,16 +26,15 @@
26
26
  "copyfiles": "^2.4.1",
27
27
  "style-dictionary": "^4.0.0",
28
28
  "tsx": "^4.16.2",
29
- "typescript": "^4.4.3"
29
+ "typescript": "^5.1.6"
30
30
  },
31
31
  "dependencies": {
32
- "@tfk-samf/figma-to-dtcg": "0.3.4",
32
+ "@tfk-samf/figma-to-dtcg": "0.3.8",
33
33
  "hex-to-rgba": "^2.0.1",
34
- "ts-deepmerge": "^4.0.0",
35
- "typescript": "^4.4.3"
34
+ "ts-deepmerge": "^4.0.0"
36
35
  },
37
36
  "publishConfig": {
38
37
  "access": "public"
39
38
  },
40
- "gitHead": "1579c9255034f6cce97a63b26719c826427b2ecd"
39
+ "gitHead": "b27fa3883fc58a07bfe6cc8c4873f81e231004ef"
41
40
  }
package/lib/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './theme';
2
- export * from './typography';
package/lib/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from './theme';
2
- export * from './typography';
3
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
package/lib/theme.d.ts DELETED
@@ -1,300 +0,0 @@
1
- import { ConfigurationOverride } from './utils/override-config';
2
- export declare type Themes<T = Theme> = {
3
- light: T;
4
- dark: T;
5
- };
6
- export declare type Mode = keyof Themes;
7
- export declare type TextColor = 'primary' | 'secondary' | 'disabled';
8
- export declare type TextColorType = 'dark' | 'light';
9
- export declare type ContrastColor = {
10
- background: string;
11
- text: string;
12
- };
13
- export declare type TransportColor<T = ContrastColor> = {
14
- primary: T;
15
- secondary: T;
16
- };
17
- export declare type StatusColor<T = ContrastColor> = {
18
- primary: T;
19
- secondary: T;
20
- };
21
- export declare type InteractiveColor<T = ContrastColor> = {
22
- default: T;
23
- hover: T;
24
- active: T;
25
- disabled: T;
26
- outline: T;
27
- };
28
- export declare enum GeofencingZoneCodes {
29
- allowed = "Allowed",
30
- slow = "Slow",
31
- noParking = "NoParking",
32
- noEntry = "NoEntry"
33
- }
34
- export declare type GeofencingZoneKeys = keyof typeof GeofencingZoneCodes;
35
- export declare type GeofencingZoneStyle<T = ContrastColor> = {
36
- color: T;
37
- fillOpacity: number;
38
- strokeOpacity: number;
39
- layerIndexWeight: number;
40
- };
41
- export declare type GeofencingZoneStyles<T = ContrastColor> = {
42
- [GZKey in GeofencingZoneKeys]: GeofencingZoneStyle<T>;
43
- };
44
- export interface Theme {
45
- spacings: {
46
- xSmall: number;
47
- small: number;
48
- medium: number;
49
- large: number;
50
- xLarge: number;
51
- };
52
- interactive: {
53
- interactive_0: InteractiveColor;
54
- interactive_1: InteractiveColor;
55
- interactive_2: InteractiveColor;
56
- interactive_3: InteractiveColor;
57
- interactive_destructive: InteractiveColor;
58
- };
59
- transport: {
60
- transport_city: TransportColor;
61
- transport_region: TransportColor;
62
- transport_airport_express: TransportColor;
63
- transport_boat: TransportColor;
64
- transport_train: TransportColor;
65
- transport_flexible: TransportColor;
66
- transport_scooter: TransportColor;
67
- transport_bike: TransportColor;
68
- transport_car: TransportColor;
69
- transport_other: TransportColor;
70
- };
71
- status: {
72
- valid: StatusColor;
73
- info: StatusColor;
74
- warning: StatusColor;
75
- error: StatusColor;
76
- };
77
- static: {
78
- background: {
79
- background_0: ContrastColor;
80
- background_1: ContrastColor;
81
- background_2: ContrastColor;
82
- background_3: ContrastColor;
83
- background_accent_0: ContrastColor;
84
- background_accent_1: ContrastColor;
85
- background_accent_2: ContrastColor;
86
- background_accent_3: ContrastColor;
87
- background_accent_4: ContrastColor;
88
- background_accent_5: ContrastColor;
89
- };
90
- zone_selection: {
91
- from: ContrastColor;
92
- to: ContrastColor;
93
- };
94
- };
95
- text: {
96
- colors: {
97
- [key in TextColor]: string;
98
- };
99
- };
100
- border: {
101
- primary: string;
102
- secondary: string;
103
- focus: string;
104
- radius: {
105
- small: number;
106
- regular: number;
107
- circle: number;
108
- };
109
- width: {
110
- slim: number;
111
- medium: number;
112
- };
113
- };
114
- icon: {
115
- size: {
116
- xSmall: number;
117
- small: number;
118
- normal: number;
119
- large: number;
120
- };
121
- };
122
- geofencingZones: GeofencingZoneStyles;
123
- }
124
- export declare type ContrastColorFs = {
125
- background: string;
126
- foreground: {
127
- primary: string;
128
- secondary: string;
129
- disabled: string;
130
- };
131
- };
132
- export interface ThemeFs {
133
- color: {
134
- foreground: {
135
- dark: ContrastColorFs['foreground'];
136
- light: ContrastColorFs['foreground'];
137
- dynamic: ContrastColorFs['foreground'];
138
- inverse: ContrastColorFs['foreground'];
139
- };
140
- interactive: {
141
- 0: InteractiveColor<ContrastColorFs>;
142
- 1: InteractiveColor<ContrastColorFs>;
143
- 2: InteractiveColor<ContrastColorFs>;
144
- 3: InteractiveColor<ContrastColorFs>;
145
- destructive: InteractiveColor<ContrastColorFs>;
146
- };
147
- transport: {
148
- city: TransportColor<ContrastColorFs>;
149
- region: TransportColor<ContrastColorFs>;
150
- airportExpress: TransportColor<ContrastColorFs>;
151
- boat: TransportColor<ContrastColorFs>;
152
- train: TransportColor<ContrastColorFs>;
153
- flexible: TransportColor<ContrastColorFs>;
154
- scooter: TransportColor<ContrastColorFs>;
155
- bike: TransportColor<ContrastColorFs>;
156
- car: TransportColor<ContrastColorFs>;
157
- other: TransportColor<ContrastColorFs>;
158
- };
159
- status: {
160
- valid: StatusColor<ContrastColorFs>;
161
- info: StatusColor<ContrastColorFs>;
162
- warning: StatusColor<ContrastColorFs>;
163
- error: StatusColor<ContrastColorFs>;
164
- };
165
- background: {
166
- neutral: {
167
- 0: ContrastColorFs;
168
- 1: ContrastColorFs;
169
- 2: ContrastColorFs;
170
- 3: ContrastColorFs;
171
- };
172
- accent: {
173
- 0: ContrastColorFs;
174
- 1: ContrastColorFs;
175
- 2: ContrastColorFs;
176
- 3: ContrastColorFs;
177
- 4: ContrastColorFs;
178
- 5: ContrastColorFs;
179
- };
180
- };
181
- zone: {
182
- from: ContrastColorFs;
183
- to: ContrastColorFs;
184
- };
185
- geofencingZone: GeofencingZoneStyles<ContrastColorFs>;
186
- border: {
187
- primary: ContrastColorFs;
188
- secondary: ContrastColorFs;
189
- focus: ContrastColorFs;
190
- };
191
- };
192
- border: {
193
- radius: {
194
- small: number;
195
- regular: number;
196
- circle: number;
197
- };
198
- width: {
199
- slim: number;
200
- medium: number;
201
- };
202
- };
203
- icon: {
204
- size: {
205
- xSmall: number;
206
- small: number;
207
- normal: number;
208
- large: number;
209
- };
210
- };
211
- spacing: {
212
- xSmall: number;
213
- small: number;
214
- medium: number;
215
- large: number;
216
- xLarge: number;
217
- };
218
- typography: {
219
- ios: {
220
- font: string;
221
- number: number;
222
- };
223
- android: {
224
- font: string;
225
- number: number;
226
- };
227
- web: {
228
- font: string;
229
- number: number;
230
- };
231
- };
232
- }
233
- export declare type Statuses = keyof Theme['status'];
234
- export declare enum ThemeVariant {
235
- AtB = 0,
236
- Nfk = 1,
237
- FRAM = 2,
238
- Troms = 3,
239
- Innlandet = 4
240
- }
241
- export interface ThemeOptions {
242
- useFigmaStructure?: boolean;
243
- }
244
- /**
245
- * Get a theme object for a specific organization in the desired format.
246
- *
247
- * @param themeVariant Organization
248
- * @param themeOptions Set if the new Figma structure should be used
249
- * @returns Theme object
250
- */
251
- export declare function createThemesFor<T extends ThemeOptions>(themeVariant: ThemeVariant, themeOptions?: T): T['useFigmaStructure'] extends true ? Themes<ThemeFs> : Themes<Theme>;
252
- /**
253
- * Create new themes (light/dark) with optinally overriden defaults.
254
- *
255
- * @example extending nested features
256
- * ```ts
257
- * const themes = createThemes({
258
- * light: {
259
- * spacings: {
260
- * medium: 20,
261
- * },
262
- * },
263
- * });
264
- *
265
- * themes.dark.spacings.medium;
266
- * //=> 20
267
- * ```
268
- *
269
- * @param overrides - Properties to override base themes with, on `Theme` level
270
- * @returns themes
271
- */
272
- export declare function createThemes(themes: Themes, overrides?: ConfigurationOverride<Themes>): Themes;
273
- /**
274
- * Use Theme as base and extend with new properties. Properties
275
- * can be nested and will be deep merged.
276
- *
277
- * @example extending nested features
278
- * ```ts
279
- * type FooExtension = {
280
- * statusBarStyle: 'dark' | 'light';
281
- * }
282
- * const _themes = createExtendedThemes<FooExtension>({
283
- * light: {statusBarStyle: 'dark'},
284
- * dark: {statusBarStyle: 'light'}
285
- * });
286
- *
287
- * _themes.dark.statusBarStyle;
288
- * //=> (property) statusBarStyle: "dark" | "light"
289
- * ```
290
- *
291
- * @param extension - Object to extend original theme. Can be nested with same keys
292
- * @returns new deep merged intersection themes
293
- */
294
- export declare function createExtendedThemes<T extends {}, M extends Theme | ThemeFs = Theme>(themes: Themes<M>, extension: {
295
- light: T;
296
- dark: T;
297
- }): {
298
- light: Themes<M>['light'] & T;
299
- dark: Themes<M>['dark'] & T;
300
- };
package/lib/theme.js DELETED
@@ -1,113 +0,0 @@
1
- import merge from 'ts-deepmerge';
2
- import { overrideConfig } from './utils/override-config';
3
- import { AtBThemes,
4
- // NfkThemes,
5
- // FRAMThemes,
6
- // TromsThemes,
7
- // InnlandetThemes,
8
- } from './themes';
9
- import { AtBThemesFs,
10
- // NfkThemes,
11
- // FRAMThemes,
12
- // TromsThemes,
13
- // InnlandetThemes,
14
- } from './themes-fs';
15
- // The colors can be changed, but should follow standard practice as commented:
16
- export var GeofencingZoneCodes;
17
- (function (GeofencingZoneCodes) {
18
- GeofencingZoneCodes["allowed"] = "Allowed";
19
- GeofencingZoneCodes["slow"] = "Slow";
20
- GeofencingZoneCodes["noParking"] = "NoParking";
21
- GeofencingZoneCodes["noEntry"] = "NoEntry";
22
- })(GeofencingZoneCodes || (GeofencingZoneCodes = {}));
23
- ;
24
- export var ThemeVariant;
25
- (function (ThemeVariant) {
26
- ThemeVariant[ThemeVariant["AtB"] = 0] = "AtB";
27
- ThemeVariant[ThemeVariant["Nfk"] = 1] = "Nfk";
28
- ThemeVariant[ThemeVariant["FRAM"] = 2] = "FRAM";
29
- ThemeVariant[ThemeVariant["Troms"] = 3] = "Troms";
30
- ThemeVariant[ThemeVariant["Innlandet"] = 4] = "Innlandet";
31
- })(ThemeVariant || (ThemeVariant = {}));
32
- /**
33
- * Get a theme object for a specific organization in the desired format.
34
- *
35
- * @param themeVariant Organization
36
- * @param themeOptions Set if the new Figma structure should be used
37
- * @returns Theme object
38
- */
39
- export function createThemesFor(themeVariant, themeOptions = { useFigmaStructure: false }) {
40
- switch (themeVariant) {
41
- case ThemeVariant.AtB:
42
- if (themeOptions?.useFigmaStructure) {
43
- return AtBThemesFs;
44
- }
45
- else {
46
- return AtBThemes;
47
- ;
48
- }
49
- // case ThemeVariant.Nfk:
50
- // return NfkThemes;
51
- // case ThemeVariant.FRAM:
52
- // return FRAMThemes;
53
- // case ThemeVariant.Troms:
54
- // return TromsThemes;
55
- // case ThemeVariant.Innlandet:
56
- // return InnlandetThemes;
57
- default:
58
- throw Error('A valid ThemeVariant must be provided');
59
- }
60
- }
61
- /**
62
- * Create new themes (light/dark) with optinally overriden defaults.
63
- *
64
- * @example extending nested features
65
- * ```ts
66
- * const themes = createThemes({
67
- * light: {
68
- * spacings: {
69
- * medium: 20,
70
- * },
71
- * },
72
- * });
73
- *
74
- * themes.dark.spacings.medium;
75
- * //=> 20
76
- * ```
77
- *
78
- * @param overrides - Properties to override base themes with, on `Theme` level
79
- * @returns themes
80
- */
81
- export function createThemes(themes, overrides) {
82
- if (!overrides)
83
- return themes;
84
- return overrideConfig(themes, overrides);
85
- }
86
- /**
87
- * Use Theme as base and extend with new properties. Properties
88
- * can be nested and will be deep merged.
89
- *
90
- * @example extending nested features
91
- * ```ts
92
- * type FooExtension = {
93
- * statusBarStyle: 'dark' | 'light';
94
- * }
95
- * const _themes = createExtendedThemes<FooExtension>({
96
- * light: {statusBarStyle: 'dark'},
97
- * dark: {statusBarStyle: 'light'}
98
- * });
99
- *
100
- * _themes.dark.statusBarStyle;
101
- * //=> (property) statusBarStyle: "dark" | "light"
102
- * ```
103
- *
104
- * @param extension - Object to extend original theme. Can be nested with same keys
105
- * @returns new deep merged intersection themes
106
- */
107
- export function createExtendedThemes(themes, extension) {
108
- return {
109
- light: merge(themes.light, extension.light),
110
- dark: merge(themes.dark, extension.dark),
111
- };
112
- }
113
- //# sourceMappingURL=theme.js.map
package/lib/theme.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAwB,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACL,SAAS;AACT,aAAa;AACb,cAAc;AACd,eAAe;AACf,mBAAmB;EACpB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,WAAW;AACX,aAAa;AACb,cAAc;AACd,eAAe;AACf,mBAAmB;EACpB,MAAM,aAAa,CAAC;AAkCrB,+EAA+E;AAC/E,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,oCAAa,CAAA;IACb,8CAAuB,CAAA;IACvB,0CAAmB,CAAA;AACrB,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AA8NA,CAAC;AAIF,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,6CAAG,CAAA;IACH,6CAAG,CAAA;IACH,+CAAI,CAAA;IACJ,iDAAK,CAAA;IACL,yDAAS,CAAA;AACX,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB;AAMD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,YAA0B,EAC1B,eAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAO;IAEnD,QAAQ,YAAY,EAAE;QACpB,KAAK,YAAY,CAAC,GAAG;YACnB,IAAI,YAAY,EAAE,iBAAiB,EAAE;gBACnC,OAAO,WAA+F,CAAC;aACxG;iBAAM;gBACL,OAAO,SAA6F,CAAC;gBAAA,CAAC;aACvG;QACH,yBAAyB;QACzB,sBAAsB;QACtB,0BAA0B;QAC1B,uBAAuB;QACvB,2BAA2B;QAC3B,wBAAwB;QACxB,+BAA+B;QAC/B,4BAA4B;QAC5B;YACE,MAAM,KAAK,CAAC,uCAAuC,CAAC,CAAC;KACxD;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAc,EACd,SAAyC;IAEzC,IAAI,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC;IAC9B,OAAO,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAiB,EACjB,SAAgC;IAKhC,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAA2B;QACrE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAA0B;KAClE,CAAC;AACJ,CAAC"}