server-time-timer-yolabs-ui 1.0.14 → 1.0.15
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.
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
/**
|
|
5
|
+
* Mapping for layout-specific spacing.
|
|
6
|
+
* Using rem values consistent with the eth-type-engine scale.
|
|
7
|
+
*/
|
|
4
8
|
const gapMap = {
|
|
5
9
|
horizontal: '0.625rem',
|
|
6
10
|
vertical: '0.625rem',
|
|
7
11
|
compact: '0.25rem',
|
|
8
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Maps the size prop to your project's Body Option classes.
|
|
15
|
+
*/
|
|
16
|
+
const sizeToTextClass = {
|
|
17
|
+
sm: 'eth-text-body-sm',
|
|
18
|
+
md: 'eth-text-body-md',
|
|
19
|
+
lg: 'eth-text-body-lg',
|
|
20
|
+
};
|
|
9
21
|
const TimerContainer = ({ children, size = 'md', className = '', background = '#ffffff', color = '#323130', layout = 'horizontal', }) => {
|
|
10
|
-
|
|
22
|
+
// Define layout styles without manual casting by typing the Record
|
|
23
|
+
const flexLayouts = {
|
|
11
24
|
horizontal: { flexDirection: 'row', flexWrap: 'nowrap' },
|
|
12
25
|
vertical: { flexDirection: 'column', flexWrap: 'nowrap' },
|
|
13
26
|
compact: { flexDirection: 'row', flexWrap: 'wrap' },
|
|
14
|
-
}
|
|
15
|
-
|
|
27
|
+
};
|
|
28
|
+
const containerStyles = Object.assign(Object.assign({ display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%', boxSizing: 'border-box', transition: 'all 0.2s ease', overflow: 'hidden',
|
|
29
|
+
// Dynamic Props
|
|
30
|
+
backgroundColor: background, color: color, gap: gapMap[layout] }, flexLayouts[layout]), {
|
|
31
|
+
// Size-based Padding
|
|
32
|
+
padding: size === 'sm' ? '0.25rem' : size === 'md' ? '0.5rem' : '0.75rem',
|
|
33
|
+
// Border token defaults
|
|
34
|
+
border: '1px solid #e1e1e1', borderRadius: '6px' });
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `timer-container ${sizeToTextClass[size]} ${className}`.trim(), style: containerStyles, role: "timer", "aria-label": "timer container", children: children }));
|
|
16
36
|
};
|
|
17
37
|
exports.default = TimerContainer;
|
package/package.json
CHANGED