@westpac/ui 1.11.0 → 1.12.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 (78) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/assets/icons/filled/panel-left-filled.svg +3 -0
  3. package/assets/icons/filled/panel-right-filled.svg +3 -0
  4. package/assets/icons/filled/phone-filled.svg +2 -1
  5. package/assets/icons/filled/tablet-filled.svg +2 -1
  6. package/assets/icons/outlined/panel-left-outlined.svg +3 -0
  7. package/assets/icons/outlined/panel-right-outlined.svg +3 -0
  8. package/assets/icons/outlined/phone-outlined.svg +2 -1
  9. package/assets/icons/outlined/tablet-outlined.svg +2 -1
  10. package/assets/pictograms/BOM/DUO/MapPinPictogram.svg +1 -0
  11. package/assets/pictograms/BOM/DUO/MobileDevicePictogram.svg +1 -5
  12. package/assets/pictograms/BOM/DUO/NotificationPictogram.svg +1 -0
  13. package/assets/pictograms/BOM/DUO/TabletPictogram.svg +1 -0
  14. package/assets/pictograms/BOM/Dark/MapPinPictogram.svg +1 -0
  15. package/assets/pictograms/BOM/Dark/MobileDevicePictogram.svg +1 -5
  16. package/assets/pictograms/BOM/Dark/NotificationPictogram.svg +1 -0
  17. package/assets/pictograms/BOM/Dark/TabletPictogram.svg +1 -0
  18. package/assets/pictograms/BSA/DUO/MapPinPictogram.svg +1 -0
  19. package/assets/pictograms/BSA/DUO/MobileDevicePictogram.svg +1 -5
  20. package/assets/pictograms/BSA/DUO/NotificationPictogram.svg +1 -0
  21. package/assets/pictograms/BSA/DUO/TabletPictogram.svg +1 -0
  22. package/assets/pictograms/BSA/Dark/MapPinPictogram.svg +1 -0
  23. package/assets/pictograms/BSA/Dark/MobileDevicePictogram.svg +1 -5
  24. package/assets/pictograms/BSA/Dark/NotificationPictogram.svg +1 -0
  25. package/assets/pictograms/BSA/Dark/TabletPictogram.svg +1 -0
  26. package/assets/pictograms/Light/MapPinPictogram.svg +1 -0
  27. package/assets/pictograms/Light/MobileDevicePictogram.svg +1 -5
  28. package/assets/pictograms/Light/NotificationPictogram.svg +1 -0
  29. package/assets/pictograms/Light/TabletPictogram.svg +1 -0
  30. package/assets/pictograms/STG/DUO/MapPinPictogram.svg +1 -0
  31. package/assets/pictograms/STG/DUO/MobileDevicePictogram.svg +1 -5
  32. package/assets/pictograms/STG/DUO/NotificationPictogram.svg +1 -0
  33. package/assets/pictograms/STG/DUO/TabletPictogram.svg +1 -0
  34. package/assets/pictograms/STG/Dark/MapPinPictogram.svg +1 -0
  35. package/assets/pictograms/STG/Dark/MobileDevicePictogram.svg +1 -5
  36. package/assets/pictograms/STG/Dark/NotificationPictogram.svg +1 -0
  37. package/assets/pictograms/STG/Dark/TabletPictogram.svg +1 -0
  38. package/assets/pictograms/WBC/DUO/MapPinPictogram.svg +1 -0
  39. package/assets/pictograms/WBC/DUO/MobileDevicePictogram.svg +1 -5
  40. package/assets/pictograms/WBC/DUO/NotificationPictogram.svg +1 -0
  41. package/assets/pictograms/WBC/DUO/TabletPictogram.svg +1 -0
  42. package/assets/pictograms/WBC/Dark/MapPinPictogram.svg +1 -0
  43. package/assets/pictograms/WBC/Dark/MobileDevicePictogram.svg +1 -5
  44. package/assets/pictograms/WBC/Dark/NotificationPictogram.svg +1 -0
  45. package/assets/pictograms/WBC/Dark/TabletPictogram.svg +1 -0
  46. package/dist/component-type.json +1 -1
  47. package/dist/components/icon/components/panel-left-icon.d.ts +2 -0
  48. package/dist/components/icon/components/panel-left-icon.js +17 -0
  49. package/dist/components/icon/components/panel-right-icon.d.ts +2 -0
  50. package/dist/components/icon/components/panel-right-icon.js +17 -0
  51. package/dist/components/icon/components/phone-icon.js +4 -1
  52. package/dist/components/icon/components/tablet-icon.js +4 -1
  53. package/dist/components/icon/index.d.ts +2 -0
  54. package/dist/components/icon/index.js +2 -0
  55. package/dist/components/pictogram/components/map-pin-pictogram.d.ts +2 -0
  56. package/dist/components/pictogram/components/map-pin-pictogram.js +32 -0
  57. package/dist/components/pictogram/components/mobile-device-pictogram.js +10 -6
  58. package/dist/components/pictogram/components/notification-pictogram.d.ts +2 -0
  59. package/dist/components/pictogram/components/notification-pictogram.js +54 -0
  60. package/dist/components/pictogram/components/tablet-pictogram.d.ts +2 -0
  61. package/dist/components/pictogram/components/tablet-pictogram.js +40 -0
  62. package/dist/components/pictogram/components/target-pictogram.js +1 -1
  63. package/dist/components/pictogram/index.d.ts +3 -0
  64. package/dist/components/pictogram/index.js +3 -0
  65. package/package.json +4 -3
  66. package/src/components/icon/components/panel-left-icon.tsx +29 -0
  67. package/src/components/icon/components/panel-right-icon.tsx +29 -0
  68. package/src/components/icon/components/phone-icon.tsx +5 -1
  69. package/src/components/icon/components/tablet-icon.tsx +5 -1
  70. package/src/components/icon/index.ts +2 -0
  71. package/src/components/pictogram/components/map-pin-pictogram.tsx +37 -0
  72. package/src/components/pictogram/components/mobile-device-pictogram.tsx +3 -6
  73. package/src/components/pictogram/components/notification-pictogram.tsx +47 -0
  74. package/src/components/pictogram/components/tablet-pictogram.tsx +41 -0
  75. package/src/components/pictogram/components/target-pictogram.tsx +1 -1
  76. package/src/components/pictogram/index.ts +3 -0
  77. package/utils/build-pictogram-assets/index.ts +85 -0
  78. package/utils/build-pictogram-assets/pictogram-colors.ts +57 -0
@@ -0,0 +1,41 @@
1
+ 'use client';
2
+
3
+ import { clsx } from 'clsx';
4
+ import React from 'react';
5
+
6
+ import { Pictogram } from '../pictogram.component.js';
7
+ import { fill } from '../pictogram.styles.js';
8
+ import { type PictogramProps } from '../pictogram.types.js';
9
+
10
+ export function TabletPictogram({
11
+ mode = 'duo',
12
+ viewBoxWidth = 78,
13
+ viewBoxHeight = 78,
14
+ 'aria-label': ariaLabel = 'Tablet',
15
+ copyrightYear = '2026',
16
+ className,
17
+ ...props
18
+ }: PictogramProps) {
19
+ return (
20
+ <Pictogram
21
+ className={clsx('size-13', className)}
22
+ viewBoxWidth={viewBoxWidth}
23
+ viewBoxHeight={viewBoxHeight}
24
+ aria-label={ariaLabel}
25
+ copyrightYear={copyrightYear}
26
+ {...props}
27
+ >
28
+ <g fill="none" fillRule="evenodd">
29
+ <path
30
+ className={fill({ mode, outline: true })}
31
+ d="M56.4102 5.98633C57.7769 5.98644 58.8896 7.03957 58.8896 8.33203V65.6396C58.8896 66.9321 57.7769 67.9862 56.4102 67.9863H17.3691C16.0023 67.9863 14.8896 66.9322 14.8896 65.6396V8.33203C14.8896 7.0395 16.0023 5.98633 17.3691 5.98633H56.4102ZM18.4316 65.2354H55.5625V8.73633H18.4316V65.2354Z"
32
+ />
33
+ <path
34
+ className={fill({ mode, outline: true })}
35
+ d="M58.0312 2C58.9684 2.00005 59.8424 2.19118 60.6328 2.50195C60.8104 2.55358 61.0289 2.6471 61.2891 2.78906C61.326 2.80891 61.3644 2.82584 61.4014 2.84668C61.4149 2.85461 61.4257 2.85926 61.4404 2.86816C64.5433 4.67301 66.3253 7.47727 66.3379 7.49707C66.3379 7.49707 66.3143 7.50483 66.3057 7.50684C66.7336 8.16917 67 8.91062 67 9.70801V70.1992C66.9997 72.8464 64.3247 75 61.0371 75H18.9678C17.4326 75 16.0514 74.5166 15.002 73.7441C12.2531 71.9617 10.6807 69.5254 10.6807 69.5254C10.6807 69.5254 10.6991 69.5196 10.7041 69.5176C10.2639 68.8533 10 68.1003 10 67.293V6.80176C10.0003 4.1536 12.6753 2 15.9629 2H58.0312ZM15.8662 4.48242C14.2793 4.48249 12.9876 5.523 12.9873 6.80176V67.293C12.9873 68.5719 14.2791 69.6122 15.8662 69.6123H57.9346C59.5217 69.6123 60.8145 68.572 60.8145 67.293V6.80176C60.8142 5.52296 59.5215 4.48242 57.9346 4.48242H15.8662Z"
36
+ />
37
+ <rect className={fill({ mode, highlight: true })} x="33" y="12" width="8" height="3" rx="1.5" />
38
+ </g>
39
+ </Pictogram>
40
+ );
41
+ }
@@ -11,7 +11,7 @@ export function TargetPictogram({
11
11
  mode = 'duo',
12
12
  viewBoxWidth = 78,
13
13
  viewBoxHeight = 78,
14
- 'aria-label': ariaLabel = 'Passport',
14
+ 'aria-label': ariaLabel = 'Target',
15
15
  copyrightYear = '2025',
16
16
  className,
17
17
  ...props
@@ -54,12 +54,14 @@ export { HeartPictogram } from './components/heart-pictogram.js';
54
54
  export { HousePictogram } from './components/house-pictogram.js';
55
55
  export { LightBulbPictogram } from './components/light-bulb-pictogram.js';
56
56
  export { LoopPictogram } from './components/loop-pictogram.js';
57
+ export { MapPinPictogram } from './components/map-pin-pictogram.js';
57
58
  export { MedicareCardPictogram } from './components/medicare-card-pictogram.js';
58
59
  export { MobileDevicePictogram } from './components/mobile-device-pictogram.js';
59
60
  export { MoneyInPictogram } from './components/money-in-pictogram.js';
60
61
  export { MoneyOutPictogram } from './components/money-out-pictogram.js';
61
62
  export { MovieTicketsPictogram } from './components/movie-tickets-pictogram.js';
62
63
  export { NestEggPictogram } from './components/nest-egg-pictogram.js';
64
+ export { NotificationPictogram } from './components/notification-pictogram.js';
63
65
  export { NoodlesPictogram } from './components/noodles-pictogram.js';
64
66
  export { Number1Pictogram } from './components/number-1-pictogram.js';
65
67
  export { Number2Pictogram } from './components/number-2-pictogram.js';
@@ -81,6 +83,7 @@ export { ShoppingPictogram } from './components/shopping-pictogram.js';
81
83
  export { SparklePictogram } from './components/sparkle-pictogram.js';
82
84
  export { StarPictogram } from './components/star-pictogram.js';
83
85
  export { StopwatchPictogram } from './components/stopwatch-pictogram.js';
86
+ export { TabletPictogram } from './components/tablet-pictogram.js';
84
87
  export { TargetPictogram } from './components/target-pictogram.js';
85
88
  export { TaxDocumentPictogram } from './components/tax-document-pictogram.js';
86
89
  export { TelephoneCallPictogram } from './components/telephone-call-pictogram.js';
@@ -0,0 +1,85 @@
1
+ // Generates static SVG assets for each brand from an existing pictogram component.
2
+
3
+ import { writeFile } from 'fs/promises';
4
+
5
+ import { type ComponentType, createElement } from 'react';
6
+ import { renderToStaticMarkup } from 'react-dom/server';
7
+
8
+ import { type PictogramProps } from '../../src/components/pictogram/pictogram.types.js';
9
+
10
+ import { getPictogramColors, pictogramBrands, type PictogramColors } from './pictogram-colors.js';
11
+
12
+ type PictogramComponent = ComponentType<PictogramProps>;
13
+
14
+ // Render the component as SVG markup.
15
+ const renderPictogram = (component: PictogramComponent, mode: 'base' | 'duo' | 'mono', colours: PictogramColors) => {
16
+ let svg = renderToStaticMarkup(
17
+ createElement(component, {
18
+ mode,
19
+ width: 78,
20
+ height: 78,
21
+ copyrightYear: '',
22
+ fill: 'none',
23
+ }),
24
+ );
25
+
26
+ // Replace theme-dependent colour fill classes with static brand colouring.
27
+ svg = svg
28
+ .replace(/ class="fill-surface-pictogram-base"/g, ` fill="${colours.base}"`)
29
+ .replace(/ class="fill-surface-pictogram-accent"/g, ` fill="${colours.accent}"`)
30
+ .replace(/ class="fill-surface-mono"/g, ` fill="${colours.mono}"`);
31
+
32
+ if (svg.includes('fill-surface-')) {
33
+ throw new Error('Generated SVG contains an unresolved fill class.');
34
+ }
35
+
36
+ // Remove unnecessary props svg will not need
37
+ svg = svg.replace(/\s(?:class|role|focusable|aria-label)="[^"]*"/g, '');
38
+
39
+ return `${svg}\n`;
40
+ };
41
+
42
+ // Write the SVG to its brand and colouring folder.
43
+ const writePictogram = async (folder: string, name: string, svg: string) => {
44
+ const file = `assets/pictograms/${folder}/${name}.svg`;
45
+ await writeFile(file, svg);
46
+ /* eslint-disable no-console */
47
+ console.log(`Written: ${file}`);
48
+ };
49
+
50
+ const main = async () => {
51
+ const fileNames = process.argv.slice(2);
52
+
53
+ if (!fileNames.length) {
54
+ throw new Error('Provide a pictogram component file name, for example: mobile-device-pictogram');
55
+ }
56
+
57
+ for (const fileName of fileNames) {
58
+ const pictogramModule = (await import(`../../src/components/pictogram/components/${fileName}.js`)) as Record<
59
+ string,
60
+ unknown
61
+ >;
62
+
63
+ const pictogramExport = Object.entries(pictogramModule).find(
64
+ ([name, component]) => name.endsWith('Pictogram') && typeof component === 'function',
65
+ );
66
+
67
+ if (!pictogramExport) {
68
+ throw new Error(`${fileName}.tsx does not export a pictogram component.`);
69
+ }
70
+
71
+ const [name, component] = pictogramExport as [string, PictogramComponent];
72
+
73
+ for (const brand of pictogramBrands) {
74
+ const colours = getPictogramColors(brand);
75
+
76
+ await writePictogram(`${brand}/Dark`, name, renderPictogram(component, 'base', colours));
77
+
78
+ await writePictogram(`${brand}/DUO`, name, renderPictogram(component, 'duo', colours));
79
+ }
80
+
81
+ await writePictogram('Light', name, renderPictogram(component, 'mono', getPictogramColors('WBC')));
82
+ }
83
+ };
84
+
85
+ void main();
@@ -0,0 +1,57 @@
1
+ import { readFileSync } from 'fs';
2
+
3
+ // Load the latest GEL brand colours when the script runs.
4
+ const allBrands: unknown = JSON.parse(readFileSync('../style-config/src/tokens/w3c/all-brands.json', 'utf8'));
5
+
6
+ export const pictogramBrands = ['WBC', 'BOM', 'BSA', 'STG'] as const;
7
+ export type PictogramBrand = (typeof pictogramBrands)[number];
8
+
9
+ export type PictogramColors = {
10
+ base: string;
11
+ accent: string;
12
+ mono: string;
13
+ };
14
+
15
+ type TokenObject = {
16
+ $value?: unknown;
17
+ [key: string]: unknown;
18
+ };
19
+
20
+ // Match each asset folder name to the brand name used in the GEL colour file.
21
+ const brandTokenNames: Record<PictogramBrand, string> = {
22
+ WBC: 'Westpac',
23
+ BOM: 'Bank of Melbourne',
24
+ BSA: 'Bank SA',
25
+ STG: 'StGeorge',
26
+ };
27
+
28
+ // Some colours point to other GEL colours instead of a hex value.
29
+ // Follow the references until final colour is found.
30
+ const resolveToken = (tokenPath: string): string => {
31
+ const token = tokenPath.split('.').reduce<unknown>((currentValue, key) => {
32
+ if (!currentValue || typeof currentValue !== 'object' || !(key in currentValue)) {
33
+ throw new Error(`Could not find GEL token: ${tokenPath}`);
34
+ }
35
+ return (currentValue as TokenObject)[key];
36
+ }, allBrands);
37
+
38
+ const value = (token as TokenObject).$value;
39
+
40
+ if (typeof value !== 'string') {
41
+ throw new Error(`GEL token does not contain a string value: ${tokenPath}`);
42
+ }
43
+
44
+ const reference = /^\{(.+)\}$/.exec(value);
45
+ return reference ? resolveToken(reference[1]) : value;
46
+ };
47
+
48
+ // Get the base, accent and mono colours used to build a brands SVG files.
49
+ export const getPictogramColors = (brand: PictogramBrand): PictogramColors => {
50
+ const tokenPath = `Tokens.${brandTokenNames[brand]}.light-mode.color`;
51
+
52
+ return {
53
+ base: resolveToken(`${tokenPath}.pictogram.surface-pictogram-base`),
54
+ accent: resolveToken(`${tokenPath}.pictogram.surface-pictogram-accent`),
55
+ mono: resolveToken(`${tokenPath}.surface.surface-mono`),
56
+ };
57
+ };