@castlabs/ui 7.15.1 → 7.16.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/castlabs-ui.common.js +3 -3
- package/dist/castlabs-ui.common.js.map +1 -1
- package/dist/castlabs-ui.core.js +31 -13
- package/dist/castlabs-ui.css +1 -1
- package/dist/castlabs-ui.module.d.ts +1 -0
- package/dist/castlabs-ui.module.js +31 -13
- package/dist/castlabs-ui.umd.js +4 -4
- package/dist/castlabs-ui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/styles/fonts/FontAwesome5/index.scss +20 -20
- package/src/styles/layout/helper.scss +3 -3
- package/src/styles/layout/meta.scss +1 -1
- package/src/styles/layout/screenreader.scss +29 -0
- package/src/styles/ui.scss +1 -0
- package/types/castlabs-ui.module.d.ts +1 -0
- package/types/index.d.ts +1 -0
package/dist/castlabs-ui.core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @castlabs/ui v7.
|
|
1
|
+
/* @castlabs/ui v7.16.0 */
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
4
|
* Bootstrap v5.3.8 (https://getbootstrap.com/)
|
|
@@ -1151,33 +1151,44 @@ function clFormatFilesize (bytes) {
|
|
|
1151
1151
|
return `${Math.floor(bytes / 1024 / 1024 / 1024)}GB`
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
1154
|
+
/**
|
|
1155
|
+
* Format an UTC date into our UI version.
|
|
1156
|
+
*
|
|
1157
|
+
* @param {Date} date Date to format.
|
|
1158
|
+
* @return {string} Formatted date, e.g. '01 Aug 2021'.
|
|
1159
|
+
*/
|
|
1160
|
+
function clFormatDateUTC (date) {
|
|
1161
|
+
// we use toISOString() to discard timezone information in date object
|
|
1162
|
+
const [yyyy, mm, dd] = date.toISOString().split(/[-T:.Z]/)
|
|
1163
|
+
const mmm = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][
|
|
1164
|
+
mm - 1
|
|
1165
|
+
]
|
|
1166
|
+
return `${dd} ${mmm} ${yyyy}`
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1154
1169
|
/**
|
|
1155
1170
|
* Format a date into our UI version.
|
|
1156
1171
|
*
|
|
1172
|
+
* @deprecated use clFormatDateUTC instead to avoid unexpected auto-timezone-shifts.
|
|
1173
|
+
*
|
|
1157
1174
|
* @param {Date} date Date to format.
|
|
1158
1175
|
* @return {string} Formatted date, e.g. '01 Aug 2021'.
|
|
1159
1176
|
*/
|
|
1160
1177
|
function clFormatDate (date) {
|
|
1161
|
-
|
|
1162
|
-
const mmm = new Intl.DateTimeFormat('en', { month: 'short' }).format(date)
|
|
1163
|
-
const dd = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(date)
|
|
1164
|
-
return `${dd} ${mmm} ${yyyy}`
|
|
1178
|
+
return clFormatDateUTC(date)
|
|
1165
1179
|
}
|
|
1166
1180
|
|
|
1167
1181
|
/**
|
|
1168
1182
|
* Format a time into our UI version.
|
|
1169
1183
|
*
|
|
1170
|
-
* @param {Date} date Date to format
|
|
1184
|
+
* @param {Date} date Date to format, assumed to be UTC.
|
|
1171
1185
|
* @param {boolean} seconds If true, seconds will be appended.
|
|
1172
1186
|
* @return {string} Formatted date, e.g. '18:21' or '18:21:59' (incl. seconds).
|
|
1173
1187
|
*/
|
|
1174
1188
|
function clFormatTimeUTC (date, seconds = false) {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
('' + date.getUTCSeconds()).padStart(2, '0')
|
|
1179
|
-
]
|
|
1180
|
-
return seconds ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`
|
|
1189
|
+
// we use toISOString() to discard timezone information in date object
|
|
1190
|
+
const utc = date.toISOString().split(/[-T:.Z]/)
|
|
1191
|
+
return seconds ? `${utc[3]}:${utc[4]}:${utc[5]}` : `${utc[3]}:${utc[4]}`
|
|
1181
1192
|
}
|
|
1182
1193
|
|
|
1183
1194
|
/**
|
|
@@ -1188,7 +1199,7 @@ function clFormatTimeUTC (date, seconds = false) {
|
|
|
1188
1199
|
* @return {string} Formatted date, e.g. '01 Aug 2021 18:21' or '01 Aug 2021 18:21:59' (incl. seconds).
|
|
1189
1200
|
*/
|
|
1190
1201
|
function clFormatDateTimeUTC (date, seconds = false) {
|
|
1191
|
-
return `${
|
|
1202
|
+
return `${clFormatDateUTC(date)} ${clFormatTimeUTC(date, seconds)}`
|
|
1192
1203
|
}
|
|
1193
1204
|
|
|
1194
1205
|
/**
|
|
@@ -1511,6 +1522,13 @@ function clTableSorterObjects (
|
|
|
1511
1522
|
// --- misc --------------------------------------------------------------------
|
|
1512
1523
|
// -----------------------------------------------------------------------------
|
|
1513
1524
|
|
|
1525
|
+
/**
|
|
1526
|
+
* Remove characters from user-provided IDs that can’t appear in our UUIDs or (CS) urns.
|
|
1527
|
+
*/
|
|
1528
|
+
function clSanitizeId (id) {
|
|
1529
|
+
return id.replace(/[^A-Za-z0-9:_-]*/g, '')
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1514
1532
|
/**
|
|
1515
1533
|
* Debounce a method to be called not faster than x ms.
|
|
1516
1534
|
*
|