@balena/ui-shared-components 15.2.12-build-renovate-major-7-react-router-dom-6c9d51ee6ce9a9a62c21e29a05364feb43b7f719-1 → 15.3.0-build-add-mui-x-date-pickers-bd5d9a1317fa9206941bbff64a55425b7d23439c-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.
- package/dist/hooks/useDayjsAdapterLocale.d.ts +1 -0
- package/dist/hooks/useDayjsAdapterLocale.js +32 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/theme.js +17 -63
- package/package.json +5 -3
|
@@ -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: {
|
|
@@ -1106,19 +1051,24 @@ export const theme = createTheme({
|
|
|
1106
1051
|
notched: false,
|
|
1107
1052
|
},
|
|
1108
1053
|
styleOverrides: {
|
|
1109
|
-
root: ({ theme }) => (
|
|
1054
|
+
root: ({ theme }) => ({
|
|
1055
|
+
background: 'white',
|
|
1056
|
+
legend: {
|
|
1110
1057
|
// We should be able to remove this but there is a css override somewhere that
|
|
1111
1058
|
// set the fieldset > legend max-width to 100%, and this invalidate the notched: false rule for some inputs.
|
|
1112
1059
|
maxWidth: 0,
|
|
1113
|
-
},
|
|
1060
|
+
},
|
|
1061
|
+
fieldset: {
|
|
1114
1062
|
borderColor: color.border.value,
|
|
1115
1063
|
'&:hover': {
|
|
1116
1064
|
borderColor: color.border.strong.value,
|
|
1117
1065
|
},
|
|
1118
|
-
},
|
|
1066
|
+
},
|
|
1067
|
+
'[type="color"]': {
|
|
1119
1068
|
padding: theme.spacing(1),
|
|
1120
1069
|
height: '20px',
|
|
1121
|
-
}
|
|
1070
|
+
},
|
|
1071
|
+
}),
|
|
1122
1072
|
input: {
|
|
1123
1073
|
'&:not(.MuiInputBase-inputMultiline)': {
|
|
1124
1074
|
paddingTop: '14px',
|
|
@@ -1133,13 +1083,17 @@ export const theme = createTheme({
|
|
|
1133
1083
|
},
|
|
1134
1084
|
MuiInput: {
|
|
1135
1085
|
styleOverrides: {
|
|
1136
|
-
root:
|
|
1086
|
+
root: {
|
|
1087
|
+
'&::before': {
|
|
1137
1088
|
borderBottom: `1px solid ${color.border.value}`,
|
|
1138
|
-
},
|
|
1089
|
+
},
|
|
1090
|
+
'&::after': {
|
|
1139
1091
|
borderBottomColor: color.border.accent.value,
|
|
1140
|
-
},
|
|
1092
|
+
},
|
|
1093
|
+
'&:hover:not(.Mui-disabled, .Mui-error)::before': {
|
|
1141
1094
|
borderBottom: `solid 1px ${color.border.strong.value}`,
|
|
1142
|
-
}
|
|
1095
|
+
},
|
|
1096
|
+
},
|
|
1143
1097
|
},
|
|
1144
1098
|
},
|
|
1145
1099
|
MuiInputLabel: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.3.0-build-add-mui-x-date-pickers-bd5d9a1317fa9206941bbff64a55425b7d23439c-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",
|
|
@@ -47,7 +49,7 @@
|
|
|
47
49
|
"react-helmet": "^6.1.0",
|
|
48
50
|
"react-is": "^18.2.0",
|
|
49
51
|
"react-markdown": "^10.0.0",
|
|
50
|
-
"react-router-dom": "^
|
|
52
|
+
"react-router-dom": "^6.28.0",
|
|
51
53
|
"remark-breaks": "^4.0.0",
|
|
52
54
|
"remark-gfm": "^4.0.0",
|
|
53
55
|
"rimraf": "^6.0.0",
|
|
@@ -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-
|
|
140
|
+
"publishedAt": "2025-12-18T12:35:39.646Z"
|
|
139
141
|
},
|
|
140
142
|
"overrides": {
|
|
141
143
|
"storybook": "$storybook",
|