@balena/ui-shared-components 15.2.5-build-remove-column-management-experimental-code-7fcde6d42e2c56ec5437b9b7530d8ea24f8b4eea-2 → 15.2.6-build-fix-safari-date-picker-cc361b88341e93cddd2fa722c3d9709b826b02ca-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.
Files changed (2) hide show
  1. package/dist/theme.js +63 -17
  2. package/package.json +2 -2
package/dist/theme.js CHANGED
@@ -9,6 +9,61 @@ 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"]):not([value]), &:has(input[type="datetime-local"]):not([value])': {
34
+ color: 'rgba(0,0,0,0)',
35
+ position: 'relative',
36
+ minWidth: 120,
37
+ },
38
+ '&:has(input[type="date"]):not([value])::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"]):not([value])::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"]):not([value])::after, &:has(input[type="datetime-local"]):not([value])::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
+ };
12
67
  export const theme = createTheme({
13
68
  cssVariables: true,
14
69
  unstable_sxConfig: {
@@ -1051,24 +1106,19 @@ export const theme = createTheme({
1051
1106
  notched: false,
1052
1107
  },
1053
1108
  styleOverrides: {
1054
- root: ({ theme }) => ({
1055
- background: 'white',
1056
- legend: {
1109
+ root: ({ theme }) => (Object.assign(Object.assign({ background: 'white' }, safariEmptyDateBugFix), { legend: {
1057
1110
  // We should be able to remove this but there is a css override somewhere that
1058
1111
  // set the fieldset > legend max-width to 100%, and this invalidate the notched: false rule for some inputs.
1059
1112
  maxWidth: 0,
1060
- },
1061
- fieldset: {
1113
+ }, fieldset: {
1062
1114
  borderColor: color.border.value,
1063
1115
  '&:hover': {
1064
1116
  borderColor: color.border.strong.value,
1065
1117
  },
1066
- },
1067
- '[type="color"]': {
1118
+ }, '[type="color"]': {
1068
1119
  padding: theme.spacing(1),
1069
1120
  height: '20px',
1070
- },
1071
- }),
1121
+ } })),
1072
1122
  input: {
1073
1123
  '&:not(.MuiInputBase-inputMultiline)': {
1074
1124
  paddingTop: '14px',
@@ -1083,17 +1133,13 @@ export const theme = createTheme({
1083
1133
  },
1084
1134
  MuiInput: {
1085
1135
  styleOverrides: {
1086
- root: {
1087
- '&::before': {
1136
+ root: Object.assign(Object.assign({}, safariEmptyDateBugFix), { '&::before': {
1088
1137
  borderBottom: `1px solid ${color.border.value}`,
1089
- },
1090
- '&::after': {
1138
+ }, '&::after': {
1091
1139
  borderBottomColor: color.border.accent.value,
1092
- },
1093
- '&:hover:not(.Mui-disabled, .Mui-error)::before': {
1140
+ }, '&:hover:not(.Mui-disabled, .Mui-error)::before': {
1094
1141
  borderBottom: `solid 1px ${color.border.strong.value}`,
1095
- },
1096
- },
1142
+ } }),
1097
1143
  },
1098
1144
  },
1099
1145
  MuiInputLabel: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/ui-shared-components",
3
- "version": "15.2.5-build-remove-column-management-experimental-code-7fcde6d42e2c56ec5437b9b7530d8ea24f8b4eea-2",
3
+ "version": "15.2.6-build-fix-safari-date-picker-cc361b88341e93cddd2fa722c3d9709b826b02ca-1",
4
4
  "main": "./dist/index.js",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -135,7 +135,7 @@
135
135
  },
136
136
  "homepage": "https://github.com/balena-io/ui-shared-components#readme",
137
137
  "versionist": {
138
- "publishedAt": "2025-11-18T14:56:53.481Z"
138
+ "publishedAt": "2025-11-18T15:56:31.869Z"
139
139
  },
140
140
  "overrides": {
141
141
  "storybook": "$storybook",