@westpac/ui 0.12.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/components/grid/components/container/container.styles.d.ts +1 -1
  3. package/dist/components/grid/components/container/container.styles.js +1 -1
  4. package/dist/components/grid/grid.styles.d.ts +1 -1
  5. package/dist/components/grid/grid.styles.js +1 -1
  6. package/dist/css/westpac-ui.css +86 -2
  7. package/dist/css/westpac-ui.min.css +86 -2
  8. package/dist/tailwind/__mocks__/utils.constants.d.ts +8 -0
  9. package/dist/tailwind/__mocks__/utils.constants.js +106 -0
  10. package/dist/tailwind/constants/typography.d.ts +38 -0
  11. package/dist/tailwind/constants/typography.js +92 -0
  12. package/dist/tailwind/tailwind-plugin.d.ts +6 -2
  13. package/dist/tailwind/tailwind-plugin.js +165 -152
  14. package/dist/tailwind/tailwind-transformer.js +4 -2
  15. package/dist/tailwind/types/brand.types.d.ts +8 -0
  16. package/dist/tailwind/types/tailwind.types.d.ts +7 -0
  17. package/dist/tailwind/types/tailwind.types.js +1 -0
  18. package/dist/tailwind/utils/create-brand-fonts.d.ts +7 -0
  19. package/dist/tailwind/utils/create-brand-fonts.js +26 -0
  20. package/dist/tailwind/utils/generate-date-picker-component.d.ts +1 -1
  21. package/dist/tailwind/utils/generate-date-picker-component.js +1 -1
  22. package/dist/tailwind/utils/index.d.ts +1 -0
  23. package/dist/tailwind/utils/index.js +1 -0
  24. package/package.json +3 -3
  25. package/src/components/grid/components/container/container.styles.ts +1 -1
  26. package/src/components/grid/grid.styles.ts +1 -1
  27. package/src/css/brand-fonts.css +99 -0
  28. package/src/tailwind/__mocks__/utils.constants.ts +108 -0
  29. package/src/tailwind/constants/typography.ts +94 -0
  30. package/src/tailwind/tailwind-plugin.ts +181 -150
  31. package/src/tailwind/tailwind-transformer.ts +1 -1
  32. package/src/tailwind/types/brand.types.ts +9 -0
  33. package/src/tailwind/types/tailwind.types.ts +8 -0
  34. package/src/tailwind/utils/create-brand-fonts.ts +22 -0
  35. package/src/tailwind/utils/generate-date-picker-component.ts +1 -1
  36. package/src/tailwind/utils/index.ts +1 -0
  37. 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 { createFontSizes, generateFontComponents, generateFormControlComponents } from './utils/index.js';
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
- // Adding the typography components
16
- ({ addComponents, addUtilities, addVariant, addBase, theme }) => {
17
- addBase({
18
- html: { color: theme('colors.text.DEFAULT') },
19
- });
20
- addUtilities({
21
- '.focus-outline': { [`@apply ${theme('focusOutline')}`]: {} },
22
- '.background-transition': { [`@apply ${theme('backgroundTransition')}`]: {} },
23
- '.select-caret': {
24
- backgroundImage:
25
- "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>\")",
26
- },
27
- });
28
- addComponents(generateFontComponents(theme('typographySizes'), theme));
29
- addComponents(generateFormControlComponents(theme('formControl')));
30
- addComponents(generateDatePicker());
31
- THEMES.forEach(({ name }) => {
32
- addVariant(`active-theme-${name.toLowerCase()}`, [
33
- `[data-theme="${name.toLowerCase()}"] &`,
34
- `.theme-${name.toLowerCase()} &`,
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
- theme: {
40
- screens: BREAKPOINTS,
41
- fontFamily: {
42
- sans: DEFAULT_BODY_TYPOGRAPHY,
43
- brand: DEFAULT_BODY_TYPOGRAPHY,
44
- },
45
- gap: SPACING,
46
- spacing: SPACING,
47
- colors: COLORS,
48
- extend: {
49
- lineHeight: {
50
- tight: '1.2',
51
- normal: '1.4',
52
- // See https://stackoverflow.com/questions/19982651/why-does-bootstrap-set-the-line-height-property-to-1-428571429 for below line height reasoning
53
- loose: '1.428571429',
54
- },
55
- borderRadius: {
56
- DEFAULT: '0.1875rem',
57
- },
58
- borderWidth: {
59
- 5: '0.3125rem',
60
- },
61
- fontSize: createFontSizes(FONT_TYPES),
62
- keyframes: {
63
- fadeIn: {
64
- '0%': { opacity: '0' },
65
- '100%': { opacity: '1' },
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
- '100%': {
73
- opacity: '1',
74
- transform: 'translateY(0)',
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
- animation: {
79
- fadeIn: 'fadeIn 0.2s ease',
80
- fadeInDown: 'fadeInDown 0.4s ease',
81
- },
82
- boxShadow: {
83
- switch: '0.1875rem 0 0.375rem 0 rgba(0,0,0,0.53)',
84
- },
85
- maxWidth: {
86
- xsl: BREAKPOINTS.xsl,
87
- sm: BREAKPOINTS.sm,
88
- md: BREAKPOINTS.md,
89
- lg: BREAKPOINTS.lg,
90
- container: '1320px', //1200 (lg) + 60 (paddingHorizontal) + 60 (paddingHorizontal)
91
- },
92
- transitionTimingFunction: {
93
- ease: 'cubic-bezier(0.25, 0.1, 0.25, 1.0)', // based on css ease timing function used in GEL 3.0
94
- },
95
- },
96
- typographySizes: {
97
- 1: {
98
- fontSize: '3.75rem',
99
- lineHeight: 'tight',
100
- },
101
- 2: {
102
- fontSize: '3.375rem',
103
- lineHeight: 'tight',
104
- },
105
- 3: {
106
- fontSize: '3rem',
107
- lineHeight: 'tight',
108
- },
109
- 4: {
110
- fontSize: '2.625rem',
111
- lineHeight: 'tight',
112
- },
113
- 5: {
114
- fontSize: '2.25rem',
115
- lineHeight: 'tight',
116
- },
117
- 6: {
118
- fontSize: '1.875rem',
119
- lineHeight: 'tight',
120
- },
121
- 7: {
122
- fontSize: '1.5rem',
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
- formControl: {
143
- 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',
144
- disabled: 'cursor-not-allowed border-dashed bg-background text-muted',
145
- sizes: {
146
- // Some of the values are not following the spacing so we needed to use static values as following
147
- small: 'px-[0.5625rem] pb-[0.25rem] pt-[0.1875rem] text-sm leading-[1.3rem]',
148
- medium: 'typography-body-9 px-2 py-[0.3125rem] leading-6',
149
- large: 'px-[0.9375rem] py-[0.5rem] text-base',
150
- xlarge: 'px-3 pb-[0.625rem] pt-[0.5625rem] text-lg leading-[1.685rem]',
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
- button: {
154
- 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',
155
- look: {
156
- base: {
157
- primary: 'border border-primary bg-primary text-white hover:bg-primary-70 active:bg-primary-50',
158
- hero: 'border border-hero bg-hero text-white hover:bg-hero-70 active:bg-hero-50',
159
- faint: 'border border-border bg-light text-muted hover:bg-white active:bg-white',
160
- link: 'text-link underline',
161
- },
162
- soft: {
163
- primary:
164
- 'border border-primary bg-white text-text hover:text-white hover:bg-primary-70 active:bg-primary-50',
165
- hero: 'border border-hero bg-hero bg-white text-text hover:text-white hover:bg-hero-70 active:bg-hero-50',
166
- faint: 'border border-border bg-white text-muted hover:bg-light active:bg-light',
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
- focusOutline: 'outline outline-2 outline-offset-[3px] outline-focus',
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
  ],
@@ -28,3 +28,12 @@ export type BrandConfig = {
28
28
  colors: ColorConfig & PictogramConfig;
29
29
  name: string;
30
30
  };
31
+
32
+ export type FontFace = {
33
+ '@font-face': {
34
+ 'font-family': string;
35
+ 'font-style': string;
36
+ 'font-weight': string;
37
+ src: string;
38
+ };
39
+ };
@@ -0,0 +1,8 @@
1
+ import { type BrandKey } from './brand.types.js';
2
+
3
+ export type PluginOptions = {
4
+ brandFonts?: {
5
+ brands?: Exclude<BrandKey, 'btfg'> | Exclude<BrandKey, 'btfg'>[];
6
+ src: string;
7
+ };
8
+ };
@@ -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';
@@ -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;