@balena/ui-shared-components 15.4.1-build-replace-lodash-with-es-toolkit-e2e3d75a9bc1b7e752ee567a47956674e2b1a654-1 → 15.4.1-build-replace-lodash-with-es-toolkit-366e2166c19de2abc07d1f183588d670fe585847-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.
@@ -74,17 +74,6 @@ const translationMap = {
74
74
  // DisabledTextWidget
75
75
  'info.not_defined': 'not defined',
76
76
  };
77
- /**
78
- * Creates a reusable template function (mimics _.template with {{ }} regex)
79
- */
80
- const createTemplate = (tpl) => (data) => {
81
- return tpl.replace(/{{([\s\S]+?)}}/g, (match, key) => {
82
- // 1. Trim whitespace: "{{ name }}" -> "name"
83
- const trimmedKey = key.trim();
84
- // 2. Return value from data, or empty string if undefined
85
- return data[trimmedKey] != null ? String(data[trimmedKey]) : '';
86
- });
87
- };
88
77
  const getTranslation = (str, opts) => {
89
78
  var _a;
90
79
  let translation = translationMap[str];
@@ -96,8 +85,12 @@ const getTranslation = (str, opts) => {
96
85
  translation =
97
86
  (_a = translationMap[pluralKey]) !== null && _a !== void 0 ? _a : translationMap[str];
98
87
  }
99
- const compiled = createTemplate(translation);
100
- return compiled(opts);
88
+ return translation.replace(/{{([\s\S]+?)}}/g, (_match, key) => {
89
+ const trimmedKey = key.trim();
90
+ // Look up the value in opts. If null/undefined, return empty string.
91
+ const value = opts[trimmedKey];
92
+ return value != null ? String(value) : '';
93
+ });
101
94
  };
102
95
  export const useTranslation = () => {
103
96
  const { t: externalT } = React.useContext(UiSharedComponentsContextProvider);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/ui-shared-components",
3
- "version": "15.4.1-build-replace-lodash-with-es-toolkit-e2e3d75a9bc1b7e752ee567a47956674e2b1a654-1",
3
+ "version": "15.4.1-build-replace-lodash-with-es-toolkit-366e2166c19de2abc07d1f183588d670fe585847-1",
4
4
  "main": "./dist/index.js",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -136,7 +136,7 @@
136
136
  },
137
137
  "homepage": "https://github.com/balena-io/ui-shared-components#readme",
138
138
  "versionist": {
139
- "publishedAt": "2025-12-23T22:22:11.653Z"
139
+ "publishedAt": "2025-12-23T22:44:14.082Z"
140
140
  },
141
141
  "overrides": {
142
142
  "storybook": "$storybook",