@atb-as/theme 5.0.1 → 6.0.0-alpha.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 (40) hide show
  1. package/lib/index.d.ts +3 -0
  2. package/lib/index.js +16 -0
  3. package/lib/index.js.map +1 -0
  4. package/lib/sizes.d.ts +22 -0
  5. package/lib/sizes.js +25 -0
  6. package/lib/sizes.js.map +1 -0
  7. package/lib/theme.d.ts +128 -0
  8. package/lib/theme.js +80 -0
  9. package/lib/theme.js.map +1 -0
  10. package/lib/themes/atb-theme/theme.css +522 -0
  11. package/lib/themes/atb-theme/theme.d.ts +109 -0
  12. package/lib/themes/atb-theme/theme.js +301 -0
  13. package/lib/themes/atb-theme/theme.js.map +1 -0
  14. package/lib/themes/atb-theme/theme.module.css +522 -0
  15. package/lib/themes/index.d.ts +2 -0
  16. package/lib/themes/index.js +11 -0
  17. package/lib/themes/index.js.map +1 -0
  18. package/lib/themes/nfk-theme/theme.css +522 -0
  19. package/lib/themes/nfk-theme/theme.d.ts +3 -0
  20. package/lib/themes/nfk-theme/theme.js +197 -0
  21. package/lib/themes/nfk-theme/theme.js.map +1 -0
  22. package/lib/themes/nfk-theme/theme.module.css +522 -0
  23. package/lib/typography/android.d.ts +3 -0
  24. package/lib/typography/android.js +65 -0
  25. package/lib/typography/android.js.map +1 -0
  26. package/lib/typography/index.d.ts +63 -0
  27. package/lib/typography/index.js +94 -0
  28. package/lib/typography/index.js.map +1 -0
  29. package/lib/typography/ios.d.ts +3 -0
  30. package/lib/typography/ios.js +64 -0
  31. package/lib/typography/ios.js.map +1 -0
  32. package/lib/typography/types.d.ts +21 -0
  33. package/lib/typography/types.js +19 -0
  34. package/lib/typography/types.js.map +1 -0
  35. package/lib/typography.css +166 -0
  36. package/lib/typography.module.css +166 -0
  37. package/lib/utils/override-config.d.ts +8 -0
  38. package/lib/utils/override-config.js +38 -0
  39. package/lib/utils/override-config.js.map +1 -0
  40. package/package.json +2 -2
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './sizes';
2
+ export * from './theme';
3
+ export * from './typography';
package/lib/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./sizes"), exports);
14
+ __exportStar(require("./theme"), exports);
15
+ __exportStar(require("./typography"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,+CAA6B"}
package/lib/sizes.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export declare const spacings: {
2
+ xLarge: number;
3
+ large: number;
4
+ medium: number;
5
+ small: number;
6
+ xSmall: number;
7
+ };
8
+ export declare const iconSizes: {
9
+ large: number;
10
+ normal: number;
11
+ small: number;
12
+ };
13
+ export declare const borderRadius: {
14
+ readonly circle: 20;
15
+ readonly regular: 8;
16
+ readonly small: 4;
17
+ };
18
+ export declare const borderWidth: {
19
+ slim: number;
20
+ medium: number;
21
+ };
22
+ export declare type RadiusSizes = keyof typeof borderRadius;
package/lib/sizes.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.borderWidth = exports.borderRadius = exports.iconSizes = exports.spacings = void 0;
4
+ exports.spacings = {
5
+ xLarge: 24,
6
+ large: 20,
7
+ medium: 12,
8
+ small: 8,
9
+ xSmall: 4,
10
+ };
11
+ exports.iconSizes = {
12
+ large: 28,
13
+ normal: 20,
14
+ small: 10,
15
+ };
16
+ exports.borderRadius = {
17
+ circle: 20,
18
+ regular: 8,
19
+ small: 4,
20
+ };
21
+ exports.borderWidth = {
22
+ slim: 1,
23
+ medium: 2,
24
+ };
25
+ //# sourceMappingURL=sizes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sizes.js","sourceRoot":"","sources":["../src/sizes.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV,CAAC;AAEW,QAAA,YAAY,GAAG;IAC1B,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;CACA,CAAC;AAEE,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;CACV,CAAC"}
package/lib/theme.d.ts ADDED
@@ -0,0 +1,128 @@
1
+ import { borderRadius, borderWidth, iconSizes, spacings } from './sizes';
2
+ import { ConfigurationOverride } from './utils/override-config';
3
+ export declare type Themes = {
4
+ light: Theme;
5
+ dark: Theme;
6
+ };
7
+ export declare type Mode = keyof Themes;
8
+ export declare type TextColor = 'primary' | 'secondary' | 'disabled';
9
+ export declare type TextColorType = 'dark' | 'light';
10
+ export declare type ContrastColor = {
11
+ background: string;
12
+ text: string;
13
+ };
14
+ export declare type InteractiveColor = {
15
+ default: ContrastColor;
16
+ hover: ContrastColor;
17
+ active: ContrastColor;
18
+ disabled: ContrastColor;
19
+ outline: ContrastColor;
20
+ };
21
+ export interface Theme {
22
+ spacings: typeof spacings;
23
+ interactive: {
24
+ interactive_0: InteractiveColor;
25
+ interactive_1: InteractiveColor;
26
+ interactive_2: InteractiveColor;
27
+ interactive_3: InteractiveColor;
28
+ interactive_destructive: InteractiveColor;
29
+ };
30
+ static: {
31
+ background: {
32
+ background_0: ContrastColor;
33
+ background_1: ContrastColor;
34
+ background_2: ContrastColor;
35
+ background_3: ContrastColor;
36
+ background_accent_0: ContrastColor;
37
+ background_accent_1: ContrastColor;
38
+ background_accent_2: ContrastColor;
39
+ background_accent_3: ContrastColor;
40
+ background_accent_4: ContrastColor;
41
+ };
42
+ transport: {
43
+ transport_city: ContrastColor;
44
+ transport_region: ContrastColor;
45
+ transport_boat: ContrastColor;
46
+ transport_train: ContrastColor;
47
+ transport_airport: ContrastColor;
48
+ transport_plane: ContrastColor;
49
+ transport_other: ContrastColor;
50
+ };
51
+ status: {
52
+ valid: ContrastColor;
53
+ info: ContrastColor;
54
+ warning: ContrastColor;
55
+ error: ContrastColor;
56
+ };
57
+ };
58
+ text: {
59
+ colors: {
60
+ [key in TextColor]: string;
61
+ };
62
+ };
63
+ border: {
64
+ primary: string;
65
+ secondary: string;
66
+ focus: string;
67
+ radius: typeof borderRadius;
68
+ width: typeof borderWidth;
69
+ };
70
+ icon: {
71
+ size: typeof iconSizes;
72
+ };
73
+ }
74
+ export declare type Statuses = keyof Theme['static']['status'];
75
+ export declare enum ThemeVariant {
76
+ AtB = 0,
77
+ Nfk = 1
78
+ }
79
+ export declare function createThemesFor(themeVariant: ThemeVariant): Themes;
80
+ /**
81
+ * Create new themes (light/dark) with optinally overriden defaults.
82
+ *
83
+ * @example extending nested features
84
+ * ```ts
85
+ * const themes = createThemes({
86
+ * light: {
87
+ * spacings: {
88
+ * medium: 20,
89
+ * },
90
+ * },
91
+ * });
92
+ *
93
+ * themes.dark.spacings.medium;
94
+ * //=> 20
95
+ * ```
96
+ *
97
+ * @param overrides - Properties to override base themes with, on `Theme` level
98
+ * @returns themes
99
+ */
100
+ export declare function createThemes(themes: Themes, overrides?: ConfigurationOverride<Themes>): Themes;
101
+ /**
102
+ * Use Theme as base and extend with new properties. Properties
103
+ * can be nested and will be deep merged.
104
+ *
105
+ * @example extending nested features
106
+ * ```ts
107
+ * type FooExtension = {
108
+ * statusBarStyle: 'dark' | 'light';
109
+ * }
110
+ * const _themes = createExtendedThemes<FooExtension>({
111
+ * light: {statusBarStyle: 'dark'},
112
+ * dark: {statusBarStyle: 'light'}
113
+ * });
114
+ *
115
+ * _themes.dark.statusBarStyle;
116
+ * //=> (property) statusBarStyle: "dark" | "light"
117
+ * ```
118
+ *
119
+ * @param extension - Object to extend original theme. Can be nested with same keys
120
+ * @returns new deep merged intersection themes
121
+ */
122
+ export declare function createExtendedThemes<T>(themes: Themes, extension: {
123
+ light: T;
124
+ dark: T;
125
+ }): {
126
+ light: ((k: Theme) => void) | (T extends any ? (k: T) => void : never) extends (k: infer I) => void ? I : never;
127
+ dark: ((k: Theme) => void) | (T extends any ? (k: T) => void : never) extends (k: infer I) => void ? I : never;
128
+ };
package/lib/theme.js ADDED
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createExtendedThemes = exports.createThemes = exports.createThemesFor = exports.ThemeVariant = void 0;
7
+ var ts_deepmerge_1 = __importDefault(require("ts-deepmerge"));
8
+ var override_config_1 = require("./utils/override-config");
9
+ var themes_1 = require("./themes");
10
+ var ThemeVariant;
11
+ (function (ThemeVariant) {
12
+ ThemeVariant[ThemeVariant["AtB"] = 0] = "AtB";
13
+ ThemeVariant[ThemeVariant["Nfk"] = 1] = "Nfk";
14
+ })(ThemeVariant = exports.ThemeVariant || (exports.ThemeVariant = {}));
15
+ function createThemesFor(themeVariant) {
16
+ switch (themeVariant) {
17
+ case ThemeVariant.AtB:
18
+ return themes_1.AtBThemes;
19
+ case ThemeVariant.Nfk:
20
+ return themes_1.NfkThemes;
21
+ default:
22
+ throw Error('A valid ThemeVariant must be provided');
23
+ }
24
+ }
25
+ exports.createThemesFor = createThemesFor;
26
+ /**
27
+ * Create new themes (light/dark) with optinally overriden defaults.
28
+ *
29
+ * @example extending nested features
30
+ * ```ts
31
+ * const themes = createThemes({
32
+ * light: {
33
+ * spacings: {
34
+ * medium: 20,
35
+ * },
36
+ * },
37
+ * });
38
+ *
39
+ * themes.dark.spacings.medium;
40
+ * //=> 20
41
+ * ```
42
+ *
43
+ * @param overrides - Properties to override base themes with, on `Theme` level
44
+ * @returns themes
45
+ */
46
+ function createThemes(themes, overrides) {
47
+ if (!overrides)
48
+ return themes;
49
+ return (0, override_config_1.overrideConfig)(themes, overrides);
50
+ }
51
+ exports.createThemes = createThemes;
52
+ /**
53
+ * Use Theme as base and extend with new properties. Properties
54
+ * can be nested and will be deep merged.
55
+ *
56
+ * @example extending nested features
57
+ * ```ts
58
+ * type FooExtension = {
59
+ * statusBarStyle: 'dark' | 'light';
60
+ * }
61
+ * const _themes = createExtendedThemes<FooExtension>({
62
+ * light: {statusBarStyle: 'dark'},
63
+ * dark: {statusBarStyle: 'light'}
64
+ * });
65
+ *
66
+ * _themes.dark.statusBarStyle;
67
+ * //=> (property) statusBarStyle: "dark" | "light"
68
+ * ```
69
+ *
70
+ * @param extension - Object to extend original theme. Can be nested with same keys
71
+ * @returns new deep merged intersection themes
72
+ */
73
+ function createExtendedThemes(themes, extension) {
74
+ return {
75
+ light: (0, ts_deepmerge_1.default)(themes.light, extension.light),
76
+ dark: (0, ts_deepmerge_1.default)(themes.dark, extension.dark),
77
+ };
78
+ }
79
+ exports.createExtendedThemes = createExtendedThemes;
80
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAiC;AAEjC,2DAA8E;AAC9E,mCAA8C;AAoF9C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6CAAG,CAAA;IACH,6CAAG,CAAA;AACL,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAED,SAAgB,eAAe,CAAC,YAA0B;IACxD,QAAQ,YAAY,EAAE;QACpB,KAAK,YAAY,CAAC,GAAG;YACnB,OAAO,kBAAS,CAAC;QACnB,KAAK,YAAY,CAAC,GAAG;YACnB,OAAO,kBAAS,CAAC;QACnB;YACE,MAAM,KAAK,CAAC,uCAAuC,CAAC,CAAC;KACxD;AACH,CAAC;AATD,0CASC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,YAAY,CAC1B,MAAc,EACd,SAAyC;IAEzC,IAAI,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC;IAC9B,OAAO,IAAA,gCAAc,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC;AAND,oCAMC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,oBAAoB,CAClC,MAAc,EACd,SAA8B;IAE9B,OAAO;QACL,KAAK,EAAE,IAAA,sBAAK,EAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC;QAC3C,IAAI,EAAE,IAAA,sBAAK,EAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC;KACzC,CAAC;AACJ,CAAC;AARD,oDAQC"}