@balena/ui-shared-components 15.2.12-build-renovate-npm-storybook-vulnerability-5ad2ac0ff70811ea0461826283039a47e6ea3c99-1 → 15.3.0-build-add-mui-x-date-pickers-f063a7dc748338d0558be1f6e1197b38e316438e-1

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.
@@ -0,0 +1 @@
1
+ export declare function useDayjsAdapterLocale(fallback?: string): string;
@@ -0,0 +1,32 @@
1
+ import * as React from 'react';
2
+ import dayjs from 'dayjs';
3
+ const getBrowserBaseLocale = (fallback = 'en') => {
4
+ const lang = navigator.language || fallback;
5
+ return lang.toLowerCase().split('-')[0];
6
+ };
7
+ const loaded = new Set();
8
+ async function ensureDayjsLocale(locale) {
9
+ if (loaded.has(locale)) {
10
+ return;
11
+ }
12
+ await import(`dayjs/locale/${locale}.js`);
13
+ loaded.add(locale);
14
+ }
15
+ export function useDayjsAdapterLocale(fallback = 'en') {
16
+ const [adapterLocale, setAdapterLocale] = React.useState(fallback);
17
+ React.useEffect(() => {
18
+ const browserLocale = getBrowserBaseLocale(fallback);
19
+ void (async () => {
20
+ try {
21
+ await ensureDayjsLocale(browserLocale);
22
+ dayjs.locale(browserLocale);
23
+ setAdapterLocale(browserLocale);
24
+ }
25
+ catch (_a) {
26
+ dayjs.locale(fallback);
27
+ setAdapterLocale(fallback);
28
+ }
29
+ })();
30
+ }, [fallback]);
31
+ return adapterLocale;
32
+ }
package/dist/index.d.ts CHANGED
@@ -91,7 +91,10 @@ export * as MaterialLab from '@mui/lab';
91
91
  export * as MaterialDataGrid from '@mui/x-data-grid';
92
92
  export { enqueueSnackbar, closeSnackbar } from 'notistack';
93
93
  export { useRandomUUID } from './hooks/useRandomUUID';
94
+ export { useDayjsAdapterLocale } from './hooks/useDayjsAdapterLocale';
94
95
  export { token } from './utils/token';
95
96
  export { uniq, toArray } from './utils/arrays';
96
97
  export * as designTokens from '@balena/design-tokens';
97
98
  export * as ReactQuery from '@tanstack/react-query';
99
+ export { default as dayjs } from 'dayjs';
100
+ export * as XDatePickers from '@mui/x-date-pickers';
package/dist/index.js CHANGED
@@ -52,7 +52,10 @@ export * as MaterialLab from '@mui/lab';
52
52
  export * as MaterialDataGrid from '@mui/x-data-grid';
53
53
  export { enqueueSnackbar, closeSnackbar } from 'notistack';
54
54
  export { useRandomUUID } from './hooks/useRandomUUID';
55
+ export { useDayjsAdapterLocale } from './hooks/useDayjsAdapterLocale';
55
56
  export { token } from './utils/token';
56
57
  export { uniq, toArray } from './utils/arrays';
57
58
  export * as designTokens from '@balena/design-tokens';
58
59
  export * as ReactQuery from '@tanstack/react-query';
60
+ export { default as dayjs } from 'dayjs';
61
+ export * as XDatePickers from '@mui/x-date-pickers';
package/dist/theme.js CHANGED
@@ -9,61 +9,6 @@ export const severityIcons = {
9
9
  warning: faWarning,
10
10
  danger: faExclamationCircle,
11
11
  };
12
- // SVG calendar icon used for date inputs
13
- const calendarSvg = `
14
- <svg
15
- xmlns="http://www.w3.org/2000/svg"
16
- viewBox="0 0 24 24"
17
- fill="none"
18
- stroke="#000"
19
- stroke-width="2"
20
- stroke-linecap="round"
21
- stroke-linejoin="round"
22
- >
23
- <path d="M5 4 H19 A2 2 0 0 1 21 6 V8 H3 V6 A2 2 0 0 1 5 4 Z" fill="#000" />
24
- <line x1="16" y1="2" x2="16" y2="6" />
25
- <line x1="8" y1="2" x2="8" y2="6" />
26
- <path d="M3 8 H21 V18 A2 2 0 0 1 19 20 H5 A2 2 0 0 1 3 18 V8 Z" />
27
- </svg>
28
- `;
29
- const calendarDataUrl = `url("data:image/svg+xml;utf8,${encodeURIComponent(calendarSvg)}")`;
30
- // Fix placeholder text for date inputs in Safari: https://github.com/mui/material-ui/issues/37226
31
- const safariEmptyDateBugFix = {
32
- '@supports (font: -apple-system-body) and (-webkit-appearance: none)': {
33
- '&:has(input[type="date"][value=""]):not(:focus-within), &:has(input[type="datetime-local"][value=""]):not(:focus-within)': {
34
- color: 'rgba(0,0,0,0)',
35
- position: 'relative',
36
- minWidth: 120,
37
- },
38
- '&:has(input[type="date"][value=""]):not(:focus-within)::before': {
39
- content: '"dd / mm / yyyy"',
40
- left: 16,
41
- color: '#333',
42
- display: 'inline-block',
43
- position: 'absolute',
44
- },
45
- '&:has(input[type="datetime-local"][value=""]):not(:focus-within)::before': {
46
- content: '"dd / mm / yyyy, --:--"',
47
- left: 16,
48
- color: '#333',
49
- display: 'inline-block',
50
- position: 'absolute',
51
- },
52
- '&:has(input[type="date"])::after, &:has(input[type="datetime-local"])::after': {
53
- content: '""',
54
- position: 'absolute',
55
- right: 10,
56
- top: '50%',
57
- transform: 'translateY(-50%)',
58
- width: 16,
59
- height: 16,
60
- pointerEvents: 'none',
61
- backgroundImage: calendarDataUrl,
62
- backgroundRepeat: 'no-repeat',
63
- backgroundSize: '16px 16px',
64
- },
65
- },
66
- };
67
12
  export const theme = createTheme({
68
13
  cssVariables: true,
69
14
  unstable_sxConfig: {
@@ -468,6 +413,9 @@ export const theme = createTheme({
468
413
  styleOverrides: {
469
414
  root: {
470
415
  padding: '0px 24px 24px',
416
+ '&.MuiPickersLayout-actionBar': {
417
+ padding: '8px',
418
+ },
471
419
  },
472
420
  },
473
421
  },
@@ -1106,19 +1054,24 @@ export const theme = createTheme({
1106
1054
  notched: false,
1107
1055
  },
1108
1056
  styleOverrides: {
1109
- root: ({ theme }) => (Object.assign(Object.assign({ background: 'white' }, safariEmptyDateBugFix), { legend: {
1057
+ root: ({ theme }) => ({
1058
+ background: 'white',
1059
+ legend: {
1110
1060
  // We should be able to remove this but there is a css override somewhere that
1111
1061
  // set the fieldset > legend max-width to 100%, and this invalidate the notched: false rule for some inputs.
1112
1062
  maxWidth: 0,
1113
- }, fieldset: {
1063
+ },
1064
+ fieldset: {
1114
1065
  borderColor: color.border.value,
1115
1066
  '&:hover': {
1116
1067
  borderColor: color.border.strong.value,
1117
1068
  },
1118
- }, '[type="color"]': {
1069
+ },
1070
+ '[type="color"]': {
1119
1071
  padding: theme.spacing(1),
1120
1072
  height: '20px',
1121
- } })),
1073
+ },
1074
+ }),
1122
1075
  input: {
1123
1076
  '&:not(.MuiInputBase-inputMultiline)': {
1124
1077
  paddingTop: '14px',
@@ -1133,13 +1086,17 @@ export const theme = createTheme({
1133
1086
  },
1134
1087
  MuiInput: {
1135
1088
  styleOverrides: {
1136
- root: Object.assign(Object.assign({}, safariEmptyDateBugFix), { '&::before': {
1089
+ root: {
1090
+ '&::before': {
1137
1091
  borderBottom: `1px solid ${color.border.value}`,
1138
- }, '&::after': {
1092
+ },
1093
+ '&::after': {
1139
1094
  borderBottomColor: color.border.accent.value,
1140
- }, '&:hover:not(.Mui-disabled, .Mui-error)::before': {
1095
+ },
1096
+ '&:hover:not(.Mui-disabled, .Mui-error)::before': {
1141
1097
  borderBottom: `solid 1px ${color.border.strong.value}`,
1142
- } }),
1098
+ },
1099
+ },
1143
1100
  },
1144
1101
  },
1145
1102
  MuiInputLabel: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/ui-shared-components",
3
- "version": "15.2.12-build-renovate-npm-storybook-vulnerability-5ad2ac0ff70811ea0461826283039a47e6ea3c99-1",
3
+ "version": "15.3.0-build-add-mui-x-date-pickers-f063a7dc748338d0558be1f6e1197b38e316438e-1",
4
4
  "main": "./dist/index.js",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -22,6 +22,7 @@
22
22
  "@mui/material": "^7.3.5",
23
23
  "@mui/styled-engine-sc": "^7.3.5",
24
24
  "@mui/x-data-grid": "^7.29.8",
25
+ "@mui/x-date-pickers": "^8.22.0",
25
26
  "@react-google-maps/api": "^2.18.1",
26
27
  "@rjsf/core": "^6.0.1",
27
28
  "@rjsf/mui": "^6.0.1",
@@ -37,6 +38,7 @@
37
38
  "color": "^5.0.0",
38
39
  "color-hash": "^2.0.2",
39
40
  "date-fns": "^4.1.0",
41
+ "dayjs": "^1.11.19",
40
42
  "jest": "^29.7.0",
41
43
  "lodash": "^4.17.21",
42
44
  "notistack": "^3.0.1",
@@ -135,7 +137,7 @@
135
137
  },
136
138
  "homepage": "https://github.com/balena-io/ui-shared-components#readme",
137
139
  "versionist": {
138
- "publishedAt": "2025-12-18T19:12:46.272Z"
140
+ "publishedAt": "2025-12-18T18:09:19.125Z"
139
141
  },
140
142
  "overrides": {
141
143
  "storybook": "$storybook",