@westpac/ui 0.11.0 → 0.13.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.
- package/CHANGELOG.md +12 -0
- package/dist/component-type.json +1 -1
- package/dist/components/date-picker/date-picker.component.js +1 -1
- package/dist/components/grid/components/container/container.styles.d.ts +1 -1
- package/dist/components/grid/components/container/container.styles.js +1 -1
- package/dist/components/grid/grid.styles.d.ts +1 -1
- package/dist/components/grid/grid.styles.js +1 -1
- package/dist/css/westpac-ui.css +86 -2
- package/dist/css/westpac-ui.min.css +86 -2
- package/dist/tailwind/__mocks__/utils.constants.d.ts +8 -0
- package/dist/tailwind/__mocks__/utils.constants.js +106 -0
- package/dist/tailwind/constants/typography.d.ts +38 -0
- package/dist/tailwind/constants/typography.js +92 -0
- package/dist/tailwind/tailwind-plugin.d.ts +6 -2
- package/dist/tailwind/tailwind-plugin.js +165 -152
- package/dist/tailwind/tailwind-transformer.js +4 -2
- package/dist/tailwind/types/brand.types.d.ts +8 -0
- package/dist/tailwind/types/tailwind.types.d.ts +7 -0
- package/dist/tailwind/types/tailwind.types.js +1 -0
- package/dist/tailwind/utils/create-brand-fonts.d.ts +7 -0
- package/dist/tailwind/utils/create-brand-fonts.js +26 -0
- package/dist/tailwind/utils/generate-date-picker-component.d.ts +1 -1
- package/dist/tailwind/utils/generate-date-picker-component.js +1 -1
- package/dist/tailwind/utils/index.d.ts +1 -0
- package/dist/tailwind/utils/index.js +1 -0
- package/package.json +3 -3
- package/src/components/date-picker/date-picker.component.tsx +1 -1
- package/src/components/grid/components/container/container.styles.ts +1 -1
- package/src/components/grid/grid.styles.ts +1 -1
- package/src/css/brand-fonts.css +99 -0
- package/src/tailwind/__mocks__/utils.constants.ts +108 -0
- package/src/tailwind/constants/typography.ts +94 -0
- package/src/tailwind/tailwind-plugin.ts +181 -150
- package/src/tailwind/tailwind-transformer.ts +1 -1
- package/src/tailwind/types/brand.types.ts +9 -0
- package/src/tailwind/types/tailwind.types.ts +8 -0
- package/src/tailwind/utils/create-brand-fonts.ts +22 -0
- package/src/tailwind/utils/generate-date-picker-component.ts +1 -1
- package/src/tailwind/utils/index.ts +1 -0
- package/tailwind.config.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable sonarjs/no-duplicate-string */
|
|
1
2
|
export const EXPECTED_SPACING = {
|
|
2
3
|
'0': '0rem',
|
|
3
4
|
'1': '0.375rem',
|
|
@@ -153,3 +154,110 @@ export const EXPECTED_TYPOGRAPHY = {
|
|
|
153
154
|
lineHeight: 'MOCK',
|
|
154
155
|
},
|
|
155
156
|
};
|
|
157
|
+
|
|
158
|
+
export const EXPECTED_FONT_FACES = [
|
|
159
|
+
{
|
|
160
|
+
'@font-face': {
|
|
161
|
+
src: "url('/fonts/lineto-brown-pro-light.woff2') format('woff2'), url('/fonts/lineto-brown-pro-light.woff') format('woff')",
|
|
162
|
+
'font-family': 'Brown Pro',
|
|
163
|
+
'font-weight': '100 300',
|
|
164
|
+
'font-style': 'normal',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
'@font-face': {
|
|
169
|
+
src: "url('/fonts/lineto-brown-pro-regular.woff2') format('woff2'), url('/fonts/lineto-brown-pro-regular.woff') format('woff')",
|
|
170
|
+
'font-family': 'Brown Pro',
|
|
171
|
+
'font-weight': '400 600',
|
|
172
|
+
'font-style': 'normal',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
'@font-face': {
|
|
177
|
+
src: "url('/fonts/lineto-brown-pro-bold.woff2') format('woff2'), url('/fonts/lineto-brown-pro-bold.woff') format('woff')",
|
|
178
|
+
'font-family': 'Brown Pro',
|
|
179
|
+
'font-weight': '700 900',
|
|
180
|
+
'font-style': 'normal',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
'@font-face': {
|
|
185
|
+
src: "url('/fonts/Aller_Lt.woff2') format('woff2'), url('/fonts/Aller_Lt.woff') format('woff')",
|
|
186
|
+
'font-family': 'Aller',
|
|
187
|
+
'font-weight': '100 600',
|
|
188
|
+
'font-style': 'normal',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
'@font-face': {
|
|
193
|
+
src: "url('/fonts/Aller_Bd.woff2') format('woff2'), url('/fonts/Aller_Bd.woff') format('woff')",
|
|
194
|
+
'font-family': 'Aller',
|
|
195
|
+
'font-weight': '700 900',
|
|
196
|
+
'font-style': 'normal',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
'@font-face': {
|
|
201
|
+
src: "url('/fonts/source-sans-pro-v14-latin-regular.woff2') format('woff2'), url('/fonts/source-sans-pro-v14-latin-regular.woff') format('woff')",
|
|
202
|
+
'font-family': 'Source Sans Pro',
|
|
203
|
+
'font-weight': '100 500',
|
|
204
|
+
'font-style': 'normal',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
'@font-face': {
|
|
209
|
+
src: "url('/fonts/source-sans-pro-v14-latin-600.woff2') format('woff2'), url('/fonts/source-sans-pro-v14-latin-600.woff') format('woff')",
|
|
210
|
+
'font-family': 'Source Sans Pro',
|
|
211
|
+
'font-weight': '600',
|
|
212
|
+
'font-style': 'normal',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
'@font-face': {
|
|
217
|
+
src: "url('/fonts/source-sans-pro-v14-latin-700.woff2') format('woff2'), url('/fonts/source-sans-pro-v14-latin-700.woff') format('woff')",
|
|
218
|
+
'font-family': 'Source Sans Pro',
|
|
219
|
+
'font-weight': '700 900',
|
|
220
|
+
'font-style': 'normal',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
'@font-face': {
|
|
225
|
+
src: "url('/fonts/dragonbold-bold-webfont.woff2') format('woff2'), url('/fonts/dragonbold-bold-webfont.woff') format('woff')",
|
|
226
|
+
'font-family': 'Dragon Bold',
|
|
227
|
+
'font-weight': '100 900',
|
|
228
|
+
'font-style': 'normal',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
'@font-face': {
|
|
233
|
+
src: "url('/fonts/Westpac-Bold-v2.007.woff2') format('woff2'), url('/fonts/Westpac-Bold-v2.007.woff') format('woff')",
|
|
234
|
+
'font-family': 'Westpac',
|
|
235
|
+
'font-weight': '100 900',
|
|
236
|
+
'font-style': 'normal',
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
'@font-face': {
|
|
241
|
+
src: "url('/fonts/montserrat-v14-latin-300.woff2') format('woff2'), url('/fonts/montserrat-v14-latin-300.woff') format('woff')",
|
|
242
|
+
'font-family': 'Montserrat',
|
|
243
|
+
'font-weight': '100 300',
|
|
244
|
+
'font-style': 'normal',
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
'@font-face': {
|
|
249
|
+
src: "url('/fonts/montserrat-v14-latin-regular.woff2') format('woff2'), url('/fonts/montserrat-v14-latin-regular.woff') format('woff')",
|
|
250
|
+
'font-family': 'Montserrat',
|
|
251
|
+
'font-weight': '400 600',
|
|
252
|
+
'font-style': 'normal',
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
'@font-face': {
|
|
257
|
+
src: "url('/fonts/montserrat-v14-latin-700.woff2') format('woff2'), url('/fonts/montserrat-v14-latin-700.woff') format('woff')",
|
|
258
|
+
'font-family': 'Montserrat',
|
|
259
|
+
'font-weight': '700 900',
|
|
260
|
+
'font-style': 'normal',
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable sonarjs/no-duplicate-string */
|
|
1
2
|
export const DEFAULT_BODY_TYPOGRAPHY = [
|
|
2
3
|
'-apple-system',
|
|
3
4
|
'BlinkMacSystemFont',
|
|
@@ -58,3 +59,96 @@ export const FONT_SIZES = {
|
|
|
58
59
|
lineHeight: 'loose',
|
|
59
60
|
},
|
|
60
61
|
};
|
|
62
|
+
|
|
63
|
+
export const BRAND_FONTS = {
|
|
64
|
+
bom: [
|
|
65
|
+
{
|
|
66
|
+
src: `url('{src}/lineto-brown-pro-light.woff2') format('woff2'), url('{src}/lineto-brown-pro-light.woff') format('woff')`,
|
|
67
|
+
'font-family': 'Brown Pro',
|
|
68
|
+
'font-weight': '100 300',
|
|
69
|
+
'font-style': 'normal',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
src: `url('{src}/lineto-brown-pro-regular.woff2') format('woff2'), url('{src}/lineto-brown-pro-regular.woff') format('woff')`,
|
|
73
|
+
'font-family': 'Brown Pro',
|
|
74
|
+
'font-weight': '400 600',
|
|
75
|
+
'font-style': 'normal',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
src: `url('{src}/lineto-brown-pro-bold.woff2') format('woff2'), url('{src}/lineto-brown-pro-bold.woff') format('woff')`,
|
|
79
|
+
'font-family': 'Brown Pro',
|
|
80
|
+
'font-weight': '700 900',
|
|
81
|
+
'font-style': 'normal',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
bsa: [
|
|
85
|
+
{
|
|
86
|
+
src: `url('{src}/Aller_Lt.woff2') format('woff2'), url('{src}/Aller_Lt.woff') format('woff')`,
|
|
87
|
+
'font-family': 'Aller',
|
|
88
|
+
'font-weight': '100 600',
|
|
89
|
+
'font-style': 'normal',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
src: `url('{src}/Aller_Bd.woff2') format('woff2'), url('{src}/Aller_Bd.woff') format('woff')`,
|
|
93
|
+
'font-family': 'Aller',
|
|
94
|
+
'font-weight': '700 900',
|
|
95
|
+
'font-style': 'normal',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
rams: [
|
|
99
|
+
{
|
|
100
|
+
src: `url('{src}/source-sans-pro-v14-latin-regular.woff2') format('woff2'), url('{src}/source-sans-pro-v14-latin-regular.woff') format('woff')`,
|
|
101
|
+
'font-family': 'Source Sans Pro',
|
|
102
|
+
'font-weight': '100 500',
|
|
103
|
+
'font-style': 'normal',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
src: `url('{src}/source-sans-pro-v14-latin-600.woff2') format('woff2'), url('{src}/source-sans-pro-v14-latin-600.woff') format('woff')`,
|
|
107
|
+
'font-family': 'Source Sans Pro',
|
|
108
|
+
'font-weight': '600',
|
|
109
|
+
'font-style': 'normal',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
src: `url('{src}/source-sans-pro-v14-latin-700.woff2') format('woff2'), url('{src}/source-sans-pro-v14-latin-700.woff') format('woff')`,
|
|
113
|
+
'font-family': 'Source Sans Pro',
|
|
114
|
+
'font-weight': '700 900',
|
|
115
|
+
'font-style': 'normal',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
stg: [
|
|
119
|
+
{
|
|
120
|
+
src: `url('{src}/dragonbold-bold-webfont.woff2') format('woff2'), url('{src}/dragonbold-bold-webfont.woff') format('woff')`,
|
|
121
|
+
'font-family': 'Dragon Bold',
|
|
122
|
+
'font-weight': '100 900',
|
|
123
|
+
'font-style': 'normal',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
wbc: [
|
|
127
|
+
{
|
|
128
|
+
src: `url('{src}/Westpac-Bold-v2.007.woff2') format('woff2'), url('{src}/Westpac-Bold-v2.007.woff') format('woff')`,
|
|
129
|
+
'font-family': 'Westpac',
|
|
130
|
+
'font-weight': '100 900',
|
|
131
|
+
'font-style': 'normal',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
wbg: [
|
|
135
|
+
{
|
|
136
|
+
src: `url('{src}/montserrat-v14-latin-300.woff2') format('woff2'), url('{src}/montserrat-v14-latin-300.woff') format('woff')`,
|
|
137
|
+
'font-family': 'Montserrat',
|
|
138
|
+
'font-weight': '100 300',
|
|
139
|
+
'font-style': 'normal',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
src: `url('{src}/montserrat-v14-latin-regular.woff2') format('woff2'), url('{src}/montserrat-v14-latin-regular.woff') format('woff')`,
|
|
143
|
+
'font-family': 'Montserrat',
|
|
144
|
+
'font-weight': '400 600',
|
|
145
|
+
'font-style': 'normal',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
src: `url('{src}/montserrat-v14-latin-700.woff2') format('woff2'), url('{src}/montserrat-v14-latin-700.woff') format('woff')`,
|
|
149
|
+
'font-family': 'Montserrat',
|
|
150
|
+
'font-weight': '700 900',
|
|
151
|
+
'font-style': 'normal',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
};
|
|
@@ -5,171 +5,202 @@ import { BREAKPOINTS } from './constants/breakpoints.js';
|
|
|
5
5
|
import { COLORS, DEFAULT_BODY_TYPOGRAPHY, FONT_TYPES, SPACING } from './constants/index.js';
|
|
6
6
|
import { THEMES } from './themes/index.js';
|
|
7
7
|
import { theme as WBCTheme } from './themes/wbc.js';
|
|
8
|
+
import { type PluginOptions } from './types/tailwind.types.js';
|
|
8
9
|
import { generateDatePicker } from './utils/generate-date-picker-component.js';
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
createBrandFonts,
|
|
12
|
+
createFontSizes,
|
|
13
|
+
generateFontComponents,
|
|
14
|
+
generateFormControlComponents,
|
|
15
|
+
} from './utils/index.js';
|
|
10
16
|
|
|
11
17
|
/**
|
|
12
18
|
* Base Plugin responsible for default theming and adding the typography components
|
|
13
19
|
*/
|
|
14
|
-
export const WestpacUIKitBasePlugin = plugin(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
export const WestpacUIKitBasePlugin = plugin.withOptions(
|
|
21
|
+
function (options: PluginOptions = {}) {
|
|
22
|
+
return ({ addComponents, addUtilities, addVariant, addBase, theme }) => {
|
|
23
|
+
/**
|
|
24
|
+
* Base
|
|
25
|
+
*/
|
|
26
|
+
addBase({
|
|
27
|
+
html: { color: theme('colors.text.DEFAULT') },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (options?.brandFonts?.src) {
|
|
31
|
+
const fonts = createBrandFonts({
|
|
32
|
+
src: options.brandFonts.src,
|
|
33
|
+
brand: options.brandFonts?.brands,
|
|
34
|
+
});
|
|
35
|
+
fonts.forEach(font => addBase(font));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Utilities
|
|
39
|
+
*/
|
|
40
|
+
addUtilities({
|
|
41
|
+
'.focus-outline': { [`@apply ${theme('focusOutline')}`]: {} },
|
|
42
|
+
'.background-transition': { [`@apply ${theme('backgroundTransition')}`]: {} },
|
|
43
|
+
'.select-caret': {
|
|
44
|
+
backgroundImage:
|
|
45
|
+
"url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='8' style='color: rgb(89,87,103);'><path fill='currentColor' d='M0 0l7 8 7-8z'/></svg>\")",
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Components
|
|
51
|
+
*/
|
|
52
|
+
addComponents(generateFontComponents(theme('typographySizes'), theme));
|
|
53
|
+
addComponents(generateFormControlComponents(theme('formControl')));
|
|
54
|
+
addComponents(generateDatePicker());
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Variants
|
|
58
|
+
*/
|
|
59
|
+
THEMES.forEach(({ name }) => {
|
|
60
|
+
addVariant(`active-theme-${name.toLowerCase()}`, [
|
|
61
|
+
`[data-theme="${name.toLowerCase()}"] &`,
|
|
62
|
+
`.theme-${name.toLowerCase()} &`,
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
37
66
|
},
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
fadeInDown: {
|
|
68
|
-
'0%': {
|
|
69
|
-
opacity: '0',
|
|
70
|
-
transform: 'translateY(-10vh)',
|
|
67
|
+
function () {
|
|
68
|
+
return {
|
|
69
|
+
theme: {
|
|
70
|
+
screens: BREAKPOINTS,
|
|
71
|
+
fontFamily: {
|
|
72
|
+
sans: DEFAULT_BODY_TYPOGRAPHY,
|
|
73
|
+
brand: DEFAULT_BODY_TYPOGRAPHY,
|
|
74
|
+
},
|
|
75
|
+
gap: SPACING,
|
|
76
|
+
spacing: SPACING,
|
|
77
|
+
colors: COLORS,
|
|
78
|
+
extend: {
|
|
79
|
+
lineHeight: {
|
|
80
|
+
tight: '1.2',
|
|
81
|
+
normal: '1.4',
|
|
82
|
+
// See https://stackoverflow.com/questions/19982651/why-does-bootstrap-set-the-line-height-property-to-1-428571429 for below line height reasoning
|
|
83
|
+
loose: '1.428571429',
|
|
84
|
+
},
|
|
85
|
+
borderRadius: {
|
|
86
|
+
DEFAULT: '0.1875rem',
|
|
87
|
+
},
|
|
88
|
+
borderWidth: {
|
|
89
|
+
5: '0.3125rem',
|
|
90
|
+
},
|
|
91
|
+
fontSize: createFontSizes(FONT_TYPES),
|
|
92
|
+
keyframes: {
|
|
93
|
+
fadeIn: {
|
|
94
|
+
'0%': { opacity: '0' },
|
|
95
|
+
'100%': { opacity: '1' },
|
|
71
96
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
97
|
+
fadeInDown: {
|
|
98
|
+
'0%': {
|
|
99
|
+
opacity: '0',
|
|
100
|
+
transform: 'translateY(-10vh)',
|
|
101
|
+
},
|
|
102
|
+
'100%': {
|
|
103
|
+
opacity: '1',
|
|
104
|
+
transform: 'translateY(0)',
|
|
105
|
+
},
|
|
75
106
|
},
|
|
76
107
|
},
|
|
108
|
+
animation: {
|
|
109
|
+
fadeIn: 'fadeIn 0.2s ease',
|
|
110
|
+
fadeInDown: 'fadeInDown 0.4s ease',
|
|
111
|
+
},
|
|
112
|
+
boxShadow: {
|
|
113
|
+
switch: '0.1875rem 0 0.375rem 0 rgba(0,0,0,0.53)',
|
|
114
|
+
},
|
|
115
|
+
maxWidth: {
|
|
116
|
+
xsl: BREAKPOINTS.xsl,
|
|
117
|
+
sm: BREAKPOINTS.sm,
|
|
118
|
+
md: BREAKPOINTS.md,
|
|
119
|
+
lg: BREAKPOINTS.lg,
|
|
120
|
+
container: '1320px', //1200 (lg) + 60 (paddingHorizontal) + 60 (paddingHorizontal)
|
|
121
|
+
},
|
|
122
|
+
transitionTimingFunction: {
|
|
123
|
+
ease: 'cubic-bezier(0.25, 0.1, 0.25, 1.0)', // based on css ease timing function used in GEL 3.0
|
|
124
|
+
},
|
|
77
125
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
lineHeight: 'tight',
|
|
124
|
-
},
|
|
125
|
-
8: {
|
|
126
|
-
fontSize: '1.125rem',
|
|
127
|
-
lineHeight: 'normal',
|
|
128
|
-
},
|
|
129
|
-
9: {
|
|
130
|
-
fontSize: '1rem',
|
|
131
|
-
lineHeight: 'normal',
|
|
132
|
-
},
|
|
133
|
-
10: {
|
|
134
|
-
fontSize: '0.875rem',
|
|
135
|
-
lineHeight: 'normal',
|
|
136
|
-
},
|
|
137
|
-
11: {
|
|
138
|
-
fontSize: '0.875rem',
|
|
139
|
-
lineHeight: 'loose',
|
|
126
|
+
typographySizes: {
|
|
127
|
+
1: {
|
|
128
|
+
fontSize: '3.75rem',
|
|
129
|
+
lineHeight: 'tight',
|
|
130
|
+
},
|
|
131
|
+
2: {
|
|
132
|
+
fontSize: '3.375rem',
|
|
133
|
+
lineHeight: 'tight',
|
|
134
|
+
},
|
|
135
|
+
3: {
|
|
136
|
+
fontSize: '3rem',
|
|
137
|
+
lineHeight: 'tight',
|
|
138
|
+
},
|
|
139
|
+
4: {
|
|
140
|
+
fontSize: '2.625rem',
|
|
141
|
+
lineHeight: 'tight',
|
|
142
|
+
},
|
|
143
|
+
5: {
|
|
144
|
+
fontSize: '2.25rem',
|
|
145
|
+
lineHeight: 'tight',
|
|
146
|
+
},
|
|
147
|
+
6: {
|
|
148
|
+
fontSize: '1.875rem',
|
|
149
|
+
lineHeight: 'tight',
|
|
150
|
+
},
|
|
151
|
+
7: {
|
|
152
|
+
fontSize: '1.5rem',
|
|
153
|
+
lineHeight: 'tight',
|
|
154
|
+
},
|
|
155
|
+
8: {
|
|
156
|
+
fontSize: '1.125rem',
|
|
157
|
+
lineHeight: 'normal',
|
|
158
|
+
},
|
|
159
|
+
9: {
|
|
160
|
+
fontSize: '1rem',
|
|
161
|
+
lineHeight: 'normal',
|
|
162
|
+
},
|
|
163
|
+
10: {
|
|
164
|
+
fontSize: '0.875rem',
|
|
165
|
+
lineHeight: 'normal',
|
|
166
|
+
},
|
|
167
|
+
11: {
|
|
168
|
+
fontSize: '0.875rem',
|
|
169
|
+
lineHeight: 'loose',
|
|
170
|
+
},
|
|
140
171
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
formControl: {
|
|
173
|
+
base: 'no-inner-spin-button box-border w-fit appearance-none overflow-visible rounded border bg-white align-middle text-text transition placeholder:font-light placeholder:text-text-50 placeholder:opacity-100 focus:focus-outline disabled:form-control-disabled',
|
|
174
|
+
disabled: 'cursor-not-allowed border-dashed bg-background text-muted',
|
|
175
|
+
sizes: {
|
|
176
|
+
// Some of the values are not following the spacing so we needed to use static values as following
|
|
177
|
+
small: 'px-[0.5625rem] pb-[0.25rem] pt-[0.1875rem] text-sm leading-[1.3rem]',
|
|
178
|
+
medium: 'typography-body-9 px-2 py-[0.3125rem] leading-6',
|
|
179
|
+
large: 'px-[0.9375rem] py-[0.5rem] text-base',
|
|
180
|
+
xlarge: 'px-3 pb-[0.625rem] pt-[0.5625rem] text-lg leading-[1.685rem]',
|
|
181
|
+
},
|
|
151
182
|
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
'border border-
|
|
165
|
-
|
|
166
|
-
|
|
183
|
+
button: {
|
|
184
|
+
base: 'inline-flex items-center justify-center rounded leading-[1.5] transition-[background] disabled:pointer-events-none disabled:opacity-50 group-[.add-on-after]:rounded-l-none group-[.add-on-before]:rounded-r-none',
|
|
185
|
+
look: {
|
|
186
|
+
base: {
|
|
187
|
+
primary: 'border border-primary bg-primary text-white hover:bg-primary-70 active:bg-primary-50',
|
|
188
|
+
hero: 'border border-hero bg-hero text-white hover:bg-hero-70 active:bg-hero-50',
|
|
189
|
+
faint: 'border border-border bg-light text-muted hover:bg-white active:bg-white',
|
|
190
|
+
link: 'text-link underline',
|
|
191
|
+
},
|
|
192
|
+
soft: {
|
|
193
|
+
primary:
|
|
194
|
+
'border border-primary bg-white text-text hover:text-white hover:bg-primary-70 active:bg-primary-50',
|
|
195
|
+
hero: 'border border-hero bg-hero bg-white text-text hover:text-white hover:bg-hero-70 active:bg-hero-50',
|
|
196
|
+
faint: 'border border-border bg-white text-muted hover:bg-light active:bg-light',
|
|
197
|
+
},
|
|
167
198
|
},
|
|
168
199
|
},
|
|
200
|
+
focusOutline: 'outline outline-2 outline-offset-[3px] outline-focus',
|
|
201
|
+
backgroundTransition: 'transition-[background] duration-300 ease-ease',
|
|
169
202
|
},
|
|
170
|
-
|
|
171
|
-
backgroundTransition: 'transition-[background] duration-300 ease-ease',
|
|
172
|
-
},
|
|
203
|
+
};
|
|
173
204
|
},
|
|
174
205
|
);
|
|
175
206
|
|
|
@@ -13,7 +13,7 @@ export const withGEL = (config: Config) =>
|
|
|
13
13
|
...(Array.isArray(config.safelist) ? config.safelist : []),
|
|
14
14
|
],
|
|
15
15
|
plugins: [
|
|
16
|
-
WestpacUIKitBasePlugin,
|
|
16
|
+
WestpacUIKitBasePlugin(config?.options),
|
|
17
17
|
WestpacUIKitThemesPlugin,
|
|
18
18
|
...(config.plugins ? (Array.isArray(config.plugins) ? config.plugins : [config.plugins]) : []),
|
|
19
19
|
],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BRAND_FONTS } from '../constants/typography.js';
|
|
2
|
+
import { type BrandKey, type FontFace } from '../types/index.js';
|
|
3
|
+
|
|
4
|
+
type Brand = Exclude<BrandKey, 'btfg'>;
|
|
5
|
+
|
|
6
|
+
export function createBrandFonts({
|
|
7
|
+
src = '',
|
|
8
|
+
brand = ['bom', 'bsa', 'rams', 'stg', 'wbc', 'wbg'],
|
|
9
|
+
}: {
|
|
10
|
+
brand?: Brand | Brand[];
|
|
11
|
+
src: string;
|
|
12
|
+
}) {
|
|
13
|
+
const trimSrc = src.replace(/\/$/, '');
|
|
14
|
+
const brandList: Brand[] = Array.isArray(brand) ? brand : [brand];
|
|
15
|
+
|
|
16
|
+
return brandList.reduce((acc, curr) => {
|
|
17
|
+
const fonts = BRAND_FONTS[curr].map(font => ({
|
|
18
|
+
'@font-face': { ...font, src: font.src.replace(/{src}/g, trimSrc) },
|
|
19
|
+
}));
|
|
20
|
+
return [...acc, ...fonts];
|
|
21
|
+
}, [] as FontFace[]);
|
|
22
|
+
}
|
|
@@ -90,7 +90,7 @@ export const generateDatePicker = () => {
|
|
|
90
90
|
'@apply hover:!bg-primary/5 focus:!bg-white/0 focus:!text-text': {},
|
|
91
91
|
'@apply active:shadow active:focus-outline focus:focus-outline focus:!shadow-none !outline-offset-0': {},
|
|
92
92
|
'&.is-today': {
|
|
93
|
-
'@apply !shadow-primary !text-text !bg-primary/5': {},
|
|
93
|
+
'@apply !shadow-primary !text-text !bg-primary/5 !border !border-solid !border-primary': {},
|
|
94
94
|
},
|
|
95
95
|
'&.is-disabled': {
|
|
96
96
|
'@apply line-through': {},
|
|
@@ -3,3 +3,4 @@ export { generateColorTints } from './generate-color-tints.js';
|
|
|
3
3
|
export { createFontSizes } from './create-font-sizes.js';
|
|
4
4
|
export { generateFontComponents } from './generate-font-components.js';
|
|
5
5
|
export { generateFormControlComponents } from './generate-form-control.js';
|
|
6
|
+
export { createBrandFonts } from './create-brand-fonts.js';
|
package/tailwind.config.ts
CHANGED
|
@@ -7,7 +7,7 @@ const config: Config = withTV({
|
|
|
7
7
|
jit: true,
|
|
8
8
|
relative: true,
|
|
9
9
|
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
|
|
10
|
-
plugins: [WestpacUIKitBasePlugin, WestpacUIKitThemesPlugin],
|
|
10
|
+
plugins: [WestpacUIKitBasePlugin({ brandFonts: { src: '/fonts' } }), WestpacUIKitThemesPlugin],
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
export default config;
|