@zuzjs/ui 0.3.6 → 0.3.7
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/ui.js +11 -2
- package/package.json +1 -1
package/dist/ui.js
CHANGED
|
@@ -418,7 +418,7 @@ const _withStyle = (props, pseudo = ``) => {
|
|
|
418
418
|
if (props[k].toString().indexOf("-") > -1) {
|
|
419
419
|
props[k].toString().split("-").map(c => _cp += c.substring(0, 1));
|
|
420
420
|
}
|
|
421
|
-
const _id = `${_cp}${_Hashids.encode(cssProps[k].length + _indices + (isNaN(parseInt(props[k])) ? 0 : parseInt(props[k])))}
|
|
421
|
+
const _id = `${_cp}${_Hashids.encode(cssProps[k].length + _indices + (isNaN(parseInt(props[k])) ? 0 : parseInt(props[k])))}`.replace(/\s/g, '-');
|
|
422
422
|
// const _id = `${_cp}${cssProps[k]}-${props[k]}`
|
|
423
423
|
cx.push(_id);
|
|
424
424
|
StyleCache[_id + pseudo] = buildCSS(k, props[k]);
|
|
@@ -568,6 +568,15 @@ const formatSeconds = (n) => {
|
|
|
568
568
|
let d = new Date(n * 1000).toISOString().slice(11, 19);
|
|
569
569
|
return d.indexOf("00:") > -1 ? d.replace("00:", "") : d;
|
|
570
570
|
};
|
|
571
|
+
const formatTime = time => {
|
|
572
|
+
time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [time];
|
|
573
|
+
if (time.length > 1) { // If time format correct
|
|
574
|
+
time = time.slice(1); // Remove full string match value
|
|
575
|
+
time[5] = +time[0] < 12 ? 'AM' : 'PM'; // Set AM/PM
|
|
576
|
+
time[0] = +time[0] % 12 || 12;
|
|
577
|
+
}
|
|
578
|
+
return time.join('');
|
|
579
|
+
};
|
|
571
580
|
|
|
572
581
|
const Stylesheet = (props) => jsx("style", { className: props.id || undefined, children: getStylesheet().join("") });
|
|
573
582
|
|
|
@@ -676,4 +685,4 @@ const Select = forwardRef((props, ref) => {
|
|
|
676
685
|
return jsx("select", Object.assign({ className: _styles }, cleanProps(props), { onChange: e => { props.onChange && props.onChange(e); }, children: props.options && props.options.map(o => jsx("option", { value: o.value, children: o.label }, `${props.id || props.as || props.name}-option-${o.value}`)) }));
|
|
677
686
|
});
|
|
678
687
|
|
|
679
|
-
export { Box, Button, Crumb, Form, Heading, Icon, Input, Select, Spinner, Stylesheet, buildCSS, buildFormData, cleanProps, formatBytes, formatSeconds, getCookie, getStylesheet, isEmail, makeCSSValue, removeCookie, setCookie, uuid, withRest, withStyle };
|
|
688
|
+
export { Box, Button, Crumb, Form, Heading, Icon, Input, Select, Spinner, Stylesheet, buildCSS, buildFormData, cleanProps, formatBytes, formatSeconds, formatTime, getCookie, getStylesheet, isEmail, makeCSSValue, removeCookie, setCookie, uuid, withRest, withStyle };
|