@aivenio/aquarium 1.72.0 → 1.73.0-rc1

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 (35) hide show
  1. package/dist/_variables.scss +255 -244
  2. package/dist/atoms.cjs +1084 -947
  3. package/dist/atoms.mjs +1084 -947
  4. package/dist/src/atoms/Banner/Banner.js +3 -7
  5. package/dist/src/atoms/DataList/DataList.js +2 -2
  6. package/dist/src/atoms/Select/Select.js +2 -2
  7. package/dist/src/atoms/Toast/Toast.js +2 -2
  8. package/dist/src/atoms/Typography/Typography.js +3 -3
  9. package/dist/src/icons/award.d.ts +9 -0
  10. package/dist/src/icons/award.js +11 -0
  11. package/dist/src/icons/index.d.ts +1 -0
  12. package/dist/src/icons/index.js +2 -1
  13. package/dist/src/molecules/Box/Box.d.ts +5 -6
  14. package/dist/src/molecules/Box/Box.js +13 -7
  15. package/dist/src/molecules/Grid/Grid.js +4 -4
  16. package/dist/src/molecules/Section/Section.js +3 -3
  17. package/dist/src/molecules/Tailwindify/Tailwindify.d.ts +2 -1
  18. package/dist/src/molecules/Tailwindify/Tailwindify.js +1 -1
  19. package/dist/src/system.d.ts +1 -6
  20. package/dist/src/system.js +2 -11
  21. package/dist/src/tokens/tokens.json +647 -0
  22. package/dist/src/utils/breakpoints.js +3 -3
  23. package/dist/src/utils/useStyle.js +6 -2
  24. package/dist/styles.css +2074 -1473
  25. package/dist/system.cjs +1103 -971
  26. package/dist/system.mjs +1103 -973
  27. package/dist/tailwind.config.js +73 -161
  28. package/dist/tailwind.theme.json +383 -331
  29. package/dist/tokens.json +644 -562
  30. package/dist/tsconfig.module.tsbuildinfo +1 -1
  31. package/dist/types/designTokens.d.ts +12 -11
  32. package/dist/types/tailwindGenerated.d.ts +1 -1
  33. package/package.json +11 -9
  34. package/dist/src/js/resolveTheme.d.ts +0 -8
  35. package/dist/src/js/resolveTheme.js +0 -10
@@ -1,159 +1,74 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
2
  const plugin = require('tailwindcss/plugin');
3
- const defaultTheme = require('tailwindcss/defaultTheme');
4
- const _ = require('lodash');
5
- const { theme } = require('./src/js/resolveTheme');
6
- const { themeTransformer } = require('./themeTransformer');
7
- /*
8
- * Shortens a given spacing key to a minimal differentiable string
9
- * example for resulting classnames with/without the shortening:
10
- * h-l1 / h-layout01; m-1 / m-spacing01
11
- */
12
- const shortenSpacingKey = (key) => key.replace('ayout0', '').replace('spacing0', '');
13
-
14
- const spacing = _.reduce(theme.spacing, (acc, { px }, key) => ({ ...acc, [shortenSpacingKey(key)]: `${px}px` }), {
15
- '0': '0',
16
- '1px': '1px',
17
- });
18
-
19
- const originalTheme = {
20
- extend: {
21
- zIndex: {
22
- modal: '100',
23
- },
24
- borderColor: {
25
- 'muted': 'var(--aquarium-colors-grey-5)',
26
- 'default': 'var(--aquarium-colors-grey-20)',
27
- 'intense': 'var(--aquarium-colors-grey-50)',
28
- 'primary-muted': 'var(--aquarium-colors-primary-60)',
29
- 'primary-default': 'var(--aquarium-colors-primary-80)',
30
- 'primary-intense': 'var(--aquarium-colors-primary-100)',
31
- 'info-muted': 'var(--aquarium-colors-info-50)',
32
- 'info-default': 'var(--aquarium-colors-info-70)',
33
- 'info-intense': 'var(--aquarium-colors-info-90)',
34
- 'success-muted': 'var(--aquarium-colors-success-10)',
35
- 'success-default': 'var(--aquarium-colors-success-40)',
36
- 'success-intense': 'var(--aquarium-colors-success-70)',
37
- 'warning-muted': 'var(--aquarium-colors-warning-20)',
38
- 'warning-default': 'var(--aquarium-colors-warning-70)',
39
- 'warning-intense': 'var(--aquarium-colors-warning-90)',
40
- 'danger-muted': 'var(--aquarium-colors-error-10)',
41
- 'danger-default': 'var(--aquarium-colors-error-50)',
42
- 'danger-intense': 'var(--aquarium-colors-error-80)',
43
- },
44
- backgroundColor: {
45
- 'body': 'var(--aquarium-colors-white)',
46
- 'body-intense': 'var(--aquarium-colors-grey-80)',
47
- 'popover-content': 'var(--aquarium-colors-white)',
48
- 'muted': 'var(--aquarium-colors-grey-0)',
49
- 'default': 'var(--aquarium-colors-grey-5)',
50
- 'intense': 'var(--aquarium-colors-grey-20)',
51
- 'primary-muted': 'var(--aquarium-colors-primary-40)',
52
- 'primary-default': 'var(--aquarium-colors-primary-80)',
53
- 'primary-intense': 'var(--aquarium-colors-primary-90)',
54
- 'primary-active': 'var(--aquarium-colors-primary-5)',
55
- 'primary-hover': 'var(--aquarium-colors-primary-5)',
56
- 'info-muted': 'var(--aquarium-colors-info-10)',
57
- 'info-default': 'var(--aquarium-colors-info-70)',
58
- 'info-intense': 'var(--aquarium-colors-info-90)',
59
- 'success-muted': 'var(--aquarium-colors-success-5)',
60
- 'success-default': 'var(--aquarium-colors-success-70)',
61
- 'success-intense': 'var(--aquarium-colors-success-90)',
62
- 'warning-muted': 'var(--aquarium-colors-warning-5)',
63
- 'warning-default': 'var(--aquarium-colors-warning-70)',
64
- 'warning-intense': 'var(--aquarium-colors-warning-90)',
65
- 'danger-muted': 'var(--aquarium-colors-error-10)',
66
- 'danger-default': 'var(--aquarium-colors-error-20)',
67
- 'danger-intense': 'var(--aquarium-colors-error-50)',
68
- 'status-announcement': 'var(--aquarium-colors-primary-5)',
69
- 'status-info': 'var(--aquarium-colors-info-10)',
70
- 'status-warning': 'var(--aquarium-colors-warning-5)',
71
- 'status-danger': 'var(--aquarium-colors-error-5)',
72
- 'status-success': 'var(--aquarium-colors-success-5)',
73
- 'icon-button-hover': 'rgba(25,25,29,.05)', // rgb value is from grey-100
74
- },
75
- textColor: {
76
- 'inactive': 'var(--aquarium-colors-grey-40)',
77
- 'muted': 'var(--aquarium-colors-grey-50)',
78
- 'default': 'var(--aquarium-colors-grey-70)',
79
- 'intense': 'var(--aquarium-colors-grey-90)',
80
- 'primary-inactive': 'var(--aquarium-colors-primary-40)',
81
- 'primary-active': 'var(--aquarium-colors-primary-90)',
82
- 'primary-muted': 'var(--aquarium-colors-primary-60)',
83
- 'primary-default': 'var(--aquarium-colors-primary-70)',
84
- 'primary-intense': 'var(--aquarium-colors-primary-80)',
85
- 'info-inactive': 'var(--aquarium-colors-info-20)',
86
- 'info-muted': 'var(--aquarium-colors-info-40)',
87
- 'info-default': 'var(--aquarium-colors-info-70)',
88
- 'info-intense': 'var(--aquarium-colors-info-90)',
89
- 'success-inactive': 'var(--aquarium-colors-success-10)',
90
- 'success-muted': 'var(--aquarium-colors-success-30)',
91
- 'success-default': 'var(--aquarium-colors-success-70)',
92
- 'success-intense': 'var(--aquarium-colors-success-90)',
93
- 'warning-inactive': 'var(--aquarium-colors-warning-20)',
94
- 'warning-muted': 'var(--aquarium-colors-warning-40)',
95
- 'warning-default': 'var(--aquarium-colors-warning-80)',
96
- 'warning-intense': 'var(--aquarium-colors-warning-100)',
97
- 'danger-inactive': 'var(--aquarium-colors-error-10)',
98
- 'danger-muted': 'var(--aquarium-colors-error-20)',
99
- 'danger-default': 'var(--aquarium-colors-error-50)',
100
- 'danger-intense': 'var(--aquarium-colors-error-80)',
101
- },
102
- ringWidth: {
103
- DEFAULT: '2px',
104
- 1: '1px',
105
- 2: '2px',
106
- },
107
- },
108
- borderRadius: {
109
- ...defaultTheme.borderRadius,
110
- DEFAULT: '4px',
111
- },
112
- colors: {
113
- ...theme.colors,
114
- transparent: 'transparent',
115
- current: 'currentColor',
116
- white: 'white',
117
- black: 'black',
118
- },
119
- spacing,
120
- margin: {
121
- ...spacing,
122
- auto: 'auto',
123
- ..._.reduce(spacing, (acc, value, key) => ({ ...acc, [`-${key}`]: `-${value}` })),
124
- },
125
- boxShadow: {
126
- ...theme.elevations,
127
- whiteInset: 'inset 0 0 0 3px rgba(255,255,255,1)',
128
- },
129
- screens: {
130
- // "default" here means the width from 0px to "xs"
131
- default: '0px',
132
- xs: '320px',
133
- sm: '672px',
134
- md: '1056px',
135
- lg: '1312px',
136
- xl: '1536px',
137
- },
138
- animation: {
139
- ...defaultTheme.animation,
140
- 'positioner-fade-in': 'positioner-fade-in 300ms ease-in-out',
141
- },
142
- keyframes: {
143
- ...defaultTheme.keyframes,
144
- 'positioner-fade-in': {
145
- from: { opacity: '0' },
146
- to: { opacity: '1' },
147
- },
148
- },
149
- };
150
3
 
151
- const transformedTheme = themeTransformer(originalTheme);
4
+ const backgroundColor = require('./tailwind/tailwind.backgroundColor');
5
+ const borderColor = require('./tailwind/tailwind.borderColor');
6
+ const borderRadius = require('./tailwind/tailwind.borderRadius');
7
+ const borderWidth = require('./tailwind/tailwind.borderWidth');
8
+ const boxShadow = require('./tailwind/tailwind.boxShadow');
9
+ const colors = require('./tailwind/tailwind.colors');
10
+ const elevations = require('./tailwind/tailwind.elevations');
11
+ const margin = require('./tailwind/tailwind.margin');
12
+ const screens = require('./tailwind/tailwind.screens');
13
+ const spacing = require('./tailwind/tailwind.spacing');
14
+ const textColor = require('./tailwind/tailwind.textColor');
15
+ const typography = require('./tailwind/tailwind.typography');
16
+
17
+ // Convert the typography object into a format that tailwind can understand
18
+ const typographyComponents = Object.fromEntries(Object.entries(typography).map(([key, font]) => [`.${key}`, { font }]));
19
+
20
+ // Utility function used to collect all the keys from an object that can be used in the safelist.
21
+ const collectKeys = (obj, prefix = '') =>
22
+ Object.entries(obj).reduce((acc, [key, value]) => {
23
+ if (typeof value === 'object') {
24
+ return acc.concat(collectKeys(value, `${prefix}${key}-`));
25
+ }
26
+
27
+ return acc.concat(`${prefix}${key}`);
28
+ }, []);
29
+
30
+ // Generate negative margin values
31
+ const negativeMargin = Object.entries(margin).reduce((acc, [key, value]) => {
32
+ if (!['auto', '0'].includes(key)) {
33
+ acc[`-${key}`] = `-${value}`;
34
+ }
35
+
36
+ return acc;
37
+ }, {});
152
38
 
153
39
  /** @type {import('tailwindcss').Config} */
154
40
  module.exports = {
155
- originalTheme,
156
- theme: transformedTheme,
41
+ theme: {
42
+ boxShadow,
43
+ colors,
44
+ elevations,
45
+ margin: {
46
+ auto: 'auto',
47
+ ...margin,
48
+ ...negativeMargin,
49
+ },
50
+ screens,
51
+ spacing,
52
+ borderWidth,
53
+ extend: {
54
+ backgroundColor,
55
+ borderColor,
56
+ borderRadius,
57
+ textColor,
58
+ zIndex: {
59
+ modal: '100',
60
+ },
61
+ animation: {
62
+ 'positioner-fade-in': 'positioner-fade-in 300ms ease-in-out',
63
+ },
64
+ keyframes: {
65
+ 'positioner-fade-in': {
66
+ from: { opacity: '0' },
67
+ to: { opacity: '1' },
68
+ },
69
+ },
70
+ },
71
+ },
157
72
  // https://tailwindcss.com/docs/configuring-variants#ordering-variants
158
73
  variants: {
159
74
  backgroundColor: ['odd', 'even', 'hover', 'group-hover', 'active', 'disabled', 'focus'],
@@ -169,9 +84,13 @@ module.exports = {
169
84
  },
170
85
  content: ['./src/**/*.tsx', './src/**/*.ts'],
171
86
  safelist: [
172
- ...theme.typography.sizes.map((s) => s.className),
173
- ...Object.keys(theme.colors).map((s) => `text-${s}`),
174
- ...Object.keys(transformedTheme.extend.textColor).map((s) => `text-${s}`),
87
+ ...Object.keys(typographyComponents),
88
+ ...collectKeys(colors, 'text-'),
89
+ ...collectKeys(colors, 'bg-'),
90
+ ...collectKeys(colors, 'border-'),
91
+ ...collectKeys(textColor, 'text-'),
92
+ ...collectKeys(backgroundColor, 'bg-'),
93
+ ...collectKeys(borderColor, 'border-'),
175
94
  'line-clamp-1',
176
95
  'line-clamp-2',
177
96
  'line-clamp-3',
@@ -192,14 +111,7 @@ module.exports = {
192
111
  }),
193
112
 
194
113
  plugin(({ addComponents, variants }) => {
195
- const typography = theme.typography.sizes.reduce(
196
- (acc, { className, style }) => ({
197
- ...acc,
198
- [`.${className}`]: style,
199
- }),
200
- {},
201
- );
202
- return addComponents(typography, variants('aivenTypographyComponent'));
114
+ return addComponents(typographyComponents, variants('aivenTypographyComponent'));
203
115
  }),
204
116
 
205
117
  plugin(({ addVariant, e }) => {