@ballistix.digital/react-components 5.0.0 → 5.1.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.
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ var $iA2ta$lodashset = require("lodash/set");
25
25
  var $iA2ta$reacttailwindcssdatepicker = require("react-tailwindcss-datepicker");
26
26
  var $iA2ta$formik = require("formik");
27
27
  var $iA2ta$reactdropzone = require("react-dropzone");
28
- var $iA2ta$moment = require("moment");
28
+ var $iA2ta$luxon = require("luxon");
29
29
  var $iA2ta$ubilabsreactgeosuggest = require("@ubilabs/react-geosuggest");
30
30
 
31
31
 
@@ -110,6 +110,21 @@ var $622cd2936b18c771$export$4370d69198e9314a = function() {
110
110
  for(var _i = 0; _i < arguments.length; _i++)values[_i] = arguments[_i];
111
111
  return values.filter(Boolean).join(' ');
112
112
  };
113
+ var $622cd2936b18c771$export$155f7ed6f228c17c = function(size) {
114
+ var _a;
115
+ if (size < 0) return '';
116
+ if (size === 0) return '0 B';
117
+ var i = Math.floor(Math.log(size) / Math.log(1024));
118
+ var value = (size / Math.pow(1024, i)).toFixed(2);
119
+ var unit = (_a = [
120
+ 'B',
121
+ 'kB',
122
+ 'MB',
123
+ 'GB',
124
+ 'TB'
125
+ ][i]) !== null && _a !== void 0 ? _a : 'B';
126
+ return "".concat(value, " ").concat(unit);
127
+ };
113
128
  var $622cd2936b18c771$export$f169ab786cd97dc0 = function(_a) {
114
129
  var styles = _a.styles, stylesOverrides = _a.stylesOverrides, customStyles = _a.customStyles, identifier = _a.identifier, type = _a.type;
115
130
  return $622cd2936b18c771$export$4370d69198e9314a((0, ($parcel$interopDefault($iA2ta$lodashget)))(type ? (0, ($parcel$interopDefault($iA2ta$lodashget)))(styles, type) : styles, identifier), (0, ($parcel$interopDefault($iA2ta$lodashget)))(type ? (0, ($parcel$interopDefault($iA2ta$lodashget)))(stylesOverrides, type) : stylesOverrides, identifier), customStyles);
@@ -119,6 +134,60 @@ var $622cd2936b18c771$export$7493424cf90fe793 = function(value) {
119
134
  if ((0, $iA2ta$lodash.isArray)(value)) return (0, $iA2ta$lodash.map)(value, 'value');
120
135
  return value === null || value === void 0 ? void 0 : value.value;
121
136
  };
137
+ var $622cd2936b18c771$export$648c405ef8d23fec = function(price) {
138
+ if (price == null || isNaN(price)) return "\u20AC -,-";
139
+ return (price / 100).toLocaleString('nl-BE', {
140
+ style: 'currency',
141
+ currency: 'EUR'
142
+ });
143
+ };
144
+ var $622cd2936b18c771$export$f3f93e5bb54c3de5 = function(nrn) {
145
+ if (!nrn || nrn.length > 11) return '';
146
+ var formatted = nrn;
147
+ if (nrn.length < 11) formatted = (0, $iA2ta$lodash.padStart)(nrn, 11, '0');
148
+ return "".concat(formatted.slice(0, 2), ".").concat(formatted.slice(2, 4), ".").concat(formatted.slice(4, 6), "-").concat(formatted.slice(6, 9), ".").concat(formatted.slice(9, 11));
149
+ };
150
+ var $622cd2936b18c771$export$b2669f8969cc59be = function(user) {
151
+ if (!user) return '';
152
+ var firstName = user.firstName, lastName = user.lastName, email = user.email;
153
+ if (firstName && lastName) return "".concat(firstName, " ").concat(lastName);
154
+ if (firstName) return firstName;
155
+ if (email) return email;
156
+ return '';
157
+ };
158
+ var $622cd2936b18c771$export$d9f806f9324c35ff = function(user) {
159
+ if (!user) return '';
160
+ var firstName = user.firstName, lastName = user.lastName, email = user.email;
161
+ if (firstName && lastName) return "".concat(firstName[0]).concat(lastName[0]);
162
+ if (email) return email[0];
163
+ return '?';
164
+ };
165
+ var $622cd2936b18c771$export$91d20e9290e3c358 = function(value) {
166
+ if (!value) return '';
167
+ var street = value.street, houseNumber = value.houseNumber, busNumber = value.busNumber, zipCode = value.zipCode, city = value.city, country = value.country;
168
+ var parts = [
169
+ street && houseNumber ? "".concat(street, " ").concat(houseNumber) : street || '',
170
+ busNumber ? "Bus ".concat(busNumber) : '',
171
+ zipCode && city ? "".concat(zipCode, " ").concat(city) : '',
172
+ country || ''
173
+ ].filter(Boolean);
174
+ return parts.join(', ');
175
+ };
176
+ var $622cd2936b18c771$export$ba96624aa3b67894 = function(value) {
177
+ if (!value) return undefined;
178
+ var street = value.street, houseNumber = value.houseNumber, busNumber = value.busNumber, zipCode = value.zipCode, city = value.city, country = value.country, lat = value.lat, lng = value.lng;
179
+ if (lat != null && lng != null) return "https://www.google.com/maps/search/?api=1&query=".concat(lat, "%2C").concat(lng);
180
+ var parts = [
181
+ street,
182
+ houseNumber,
183
+ busNumber ? "Bus ".concat(busNumber) : '',
184
+ zipCode,
185
+ city,
186
+ country
187
+ ].filter(Boolean).join(' ');
188
+ var query = encodeURIComponent(parts);
189
+ return "https://www.google.com/maps/search/?api=1&query=".concat(query);
190
+ };
122
191
 
123
192
 
124
193
  var $f0c671820c340322$export$e2d2075c69d9100d = function(object) {
@@ -450,7 +519,7 @@ var $fbfda6b39c475fe4$var$styles = {
450
519
  var $fbfda6b39c475fe4$export$2e2bcd8739ae039 = $fbfda6b39c475fe4$var$styles;
451
520
 
452
521
 
453
- var $29a51bd84954e590$var$BadgeElement = function(props) {
522
+ var $29a51bd84954e590$var$AlertElement = function(props) {
454
523
  var title = props.title, message = props.message, _a = props.type, type = _a === void 0 ? 'generic' : _a, _b = props.onClose, onClose = _b === void 0 ? (0, $iA2ta$lodash.noop) : _b, _c = props.onCollapse, onCollapse = _c === void 0 ? (0, $iA2ta$lodash.noop) : _c, _d = props.isCollapsible, isCollapsible = _d === void 0 ? false : _d, stylesOverrides = props.styles, iconAccessorOverride = props.iconAccessor;
455
524
  var _e = (0, $iA2ta$react.useState)(false), isCollapsed = _e[0], setIsCollapsed = _e[1];
456
525
  var handleGenerateStyle = function() {
@@ -534,7 +603,7 @@ var $29a51bd84954e590$var$BadgeElement = function(props) {
534
603
  ]
535
604
  });
536
605
  };
537
- var $29a51bd84954e590$export$2e2bcd8739ae039 = $29a51bd84954e590$var$BadgeElement;
606
+ var $29a51bd84954e590$export$2e2bcd8739ae039 = $29a51bd84954e590$var$AlertElement;
538
607
 
539
608
 
540
609
 
@@ -5928,8 +5997,12 @@ var $17bb03e8d27b8746$var$OpeningHourItem = function(props) {
5928
5997
  value: (_g = options[(_f = (_e = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.day) !== null && _e !== void 0 ? _e : dayPlaceholder) !== null && _f !== void 0 ? _f : 0]) === null || _g === void 0 ? void 0 : _g.value
5929
5998
  },
5930
5999
  closed: (_h = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.closed) !== null && _h !== void 0 ? _h : false,
5931
- openingTime: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.openingTime) ? (0, ($parcel$interopDefault($iA2ta$moment)))(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.openingTime).subtract(2, 'h').format('HH:mm') : '',
5932
- closingTime: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.closingTime) ? (0, ($parcel$interopDefault($iA2ta$moment)))(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.closingTime).subtract(2, 'h').format('HH:mm') : ''
6000
+ openingTime: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.openingTime) ? (0, $iA2ta$luxon.DateTime).fromISO(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.openingTime).minus({
6001
+ hours: 2
6002
+ }).toFormat('HH:mm') : '',
6003
+ closingTime: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.closingTime) ? (0, $iA2ta$luxon.DateTime).fromISO(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.closingTime).minus({
6004
+ hours: 2
6005
+ }).toFormat('HH:mm') : ''
5933
6006
  };
5934
6007
  }, [
5935
6008
  dayPlaceholder,
@@ -5944,7 +6017,12 @@ var $17bb03e8d27b8746$var$OpeningHourItem = function(props) {
5944
6017
  var toTimeStamp = (0, $iA2ta$react.useCallback)(function(value) {
5945
6018
  if (value === undefined) return undefined;
5946
6019
  var _a = value.split(':'), hours = _a[0], minutes = _a[1];
5947
- return (0, ($parcel$interopDefault($iA2ta$moment)))().hour(Number(hours)).minute(Number(minutes)).second(0).format('YYYY-MM-DDTHH:mm:ss.000') + 'Z';
6020
+ return (0, $iA2ta$luxon.DateTime).utc().set({
6021
+ hour: Number(hours),
6022
+ minute: Number(minutes),
6023
+ second: 0,
6024
+ millisecond: 0
6025
+ }).toISO();
5948
6026
  }, []);
5949
6027
  var onSubmit = (0, $iA2ta$react.useCallback)(function(values) {
5950
6028
  var _a;