server-time-timer-yolabs-ui 1.0.16 β 1.0.18
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/README.md
CHANGED
|
@@ -15,7 +15,6 @@ Unlike traditional timers that rely on the **clientβs clock**, this UI uses **
|
|
|
15
15
|
* π Server-trusted time β no client clock manipulation
|
|
16
16
|
* π Consistent countdown across all devices
|
|
17
17
|
* π§© Dynamic layouts, sizes, themes, and colors
|
|
18
|
-
* β‘ Optional animated progress bar
|
|
19
18
|
* π Configurable units (days, hours, minutes, seconds)
|
|
20
19
|
* π’ Enterprise UI inspired by Fluent UI / SharePoint
|
|
21
20
|
|
|
@@ -30,7 +29,6 @@ Unlike traditional timers that rely on the **clientβs clock**, this UI uses **
|
|
|
30
29
|
| Drift Handling | β None | β
Auto-corrected |
|
|
31
30
|
| Layouts | β Fixed | β
Horizontal / Vertical / Compact |
|
|
32
31
|
| Unit Visibility | β Fixed | β
Per-unit control |
|
|
33
|
-
| Progress Bar | β Missing | β
Built-in |
|
|
34
32
|
| Enterprise Styling | β Basic | β
SharePoint-style |
|
|
35
33
|
| Tamper Resistance | β Easy to cheat | β
Secure |
|
|
36
34
|
|
|
@@ -67,7 +65,7 @@ export default function App() {
|
|
|
67
65
|
background: '#fef9f3',
|
|
68
66
|
text: '#323130',
|
|
69
67
|
unitBackground: '#fffbdd',
|
|
70
|
-
|
|
68
|
+
|
|
71
69
|
}}
|
|
72
70
|
onEnd={() => alert('β° Time is up!')}
|
|
73
71
|
/>
|
|
@@ -109,7 +107,7 @@ export interface ServerTimerUIProps {
|
|
|
109
107
|
background?: string;
|
|
110
108
|
text?: string;
|
|
111
109
|
unitBackground?: string;
|
|
112
|
-
|
|
110
|
+
|
|
113
111
|
};
|
|
114
112
|
|
|
115
113
|
/** Callback when timer ends */
|
|
@@ -146,7 +144,6 @@ customColors={{
|
|
|
146
144
|
background: '#fff8f0',
|
|
147
145
|
text: '#333',
|
|
148
146
|
unitBackground: '#ffe5b4',
|
|
149
|
-
progress: '#0078d4'
|
|
150
147
|
}}
|
|
151
148
|
```
|
|
152
149
|
|
|
@@ -7,6 +7,9 @@ interface TimerUnitProps {
|
|
|
7
7
|
background?: string;
|
|
8
8
|
color?: string;
|
|
9
9
|
numberSize?: 'sm' | 'md' | 'lg';
|
|
10
|
+
showLabel?: boolean;
|
|
11
|
+
shape?: 'rectangle' | 'circle';
|
|
12
|
+
equalSize?: boolean;
|
|
10
13
|
}
|
|
11
14
|
declare const TimerUnit: React.FC<TimerUnitProps>;
|
|
12
15
|
export default TimerUnit;
|
|
@@ -1,50 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const TimerUnit = ({ label, value, size = 'md', background = '#f3f2f1',
|
|
5
|
-
|
|
6
|
-
numberSize = 'md', }) => {
|
|
7
|
-
/**
|
|
8
|
-
* Label Typography - Based on your Engine Body Options
|
|
9
|
-
* sm: 11px, md: 13px, lg: 15px
|
|
10
|
-
*/
|
|
4
|
+
const TimerUnit = ({ label, value, size = 'md', background = '#f3f2f1', color = '#323130', numberSize = 'md', showLabel = true, shape = 'rectangle', equalSize = true, }) => {
|
|
5
|
+
// 1. Typography from your Engine Settings
|
|
11
6
|
const getLabelStyles = () => {
|
|
12
7
|
if (size === 'sm')
|
|
13
8
|
return { fontSize: '11px', lineHeight: 1.4, fontWeight: 400 };
|
|
14
9
|
if (size === 'lg')
|
|
15
10
|
return { fontSize: '15px', lineHeight: 1.5, fontWeight: 400 };
|
|
16
|
-
return { fontSize: '13px', lineHeight: 1.5, fontWeight: 400 };
|
|
11
|
+
return { fontSize: '13px', lineHeight: 1.5, fontWeight: 400 };
|
|
17
12
|
};
|
|
18
|
-
/**
|
|
19
|
-
* Number Typography - Based on your Engine Title/Heading Options
|
|
20
|
-
* sm (Heading): 18px, md (Title): 24px, lg (Hero): 32px
|
|
21
|
-
*/
|
|
22
13
|
const getNumberStyles = () => {
|
|
23
14
|
if (numberSize === 'sm')
|
|
24
|
-
return { fontSize: '18px', fontWeight: 600, lineHeight: 1
|
|
15
|
+
return { fontSize: '18px', fontWeight: 600, lineHeight: 1 };
|
|
25
16
|
if (numberSize === 'lg')
|
|
26
|
-
return { fontSize: '32px', fontWeight: 700, lineHeight: 1
|
|
27
|
-
return { fontSize: '24px', fontWeight: 600, lineHeight: 1
|
|
17
|
+
return { fontSize: '32px', fontWeight: 700, lineHeight: 1 };
|
|
18
|
+
return { fontSize: '24px', fontWeight: 600, lineHeight: 1 };
|
|
28
19
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
borderRadius: '2px',
|
|
38
|
-
border: '1px solid #edebe9',
|
|
39
|
-
// Spacing
|
|
40
|
-
padding: size === 'sm' ? '4px 8px' : size === 'md' ? '8px 12px' : '12px 16px',
|
|
41
|
-
minWidth: size === 'sm' ? '48px' : size === 'md' ? '64px' : '80px',
|
|
42
|
-
// Visuals
|
|
43
|
-
boxShadow: '0 1.6px 3.6px 0 rgba(0,0,0,0.132), 0 0.3px 0.9px 0 rgba(0,0,0,0.108)', // Fluent Depth
|
|
44
|
-
transition: 'transform 0.1s ease, box-shadow 0.1s ease',
|
|
45
|
-
boxSizing: 'border-box',
|
|
46
|
-
fontFamily: '"Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, sans-serif',
|
|
20
|
+
// 2. Square/Circle Dimension Logic
|
|
21
|
+
// Forces height to match width if equalSize or circle is requested
|
|
22
|
+
const getDimensions = () => {
|
|
23
|
+
const baseWidth = size === 'sm' ? '56px' : size === 'md' ? '72px' : '96px';
|
|
24
|
+
if (equalSize || shape === 'circle') {
|
|
25
|
+
return { width: baseWidth, height: baseWidth };
|
|
26
|
+
}
|
|
27
|
+
return { minWidth: baseWidth };
|
|
47
28
|
};
|
|
48
|
-
|
|
29
|
+
const containerStyles = Object.assign(Object.assign({ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', backgroundColor: background, color: color, boxSizing: 'border-box', fontFamily: '"Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif', transition: 'all 0.2s ease-in-out', border: '1px solid #edebe9',
|
|
30
|
+
// Shape logic
|
|
31
|
+
borderRadius: shape === 'circle' ? '50%' : '2px' }, getDimensions()), {
|
|
32
|
+
// Visuals (Fluent Depth)
|
|
33
|
+
boxShadow: '0 1.6px 3.6px 0 rgba(0,0,0,0.1), 0 0.3px 0.9px 0 rgba(0,0,0,0.05)', padding: shape === 'circle' ? '0' : (size === 'sm' ? '4px' : '8px') });
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: containerStyles, className: `timer-unit timer-unit--${shape}`, children: [(0, jsx_runtime_1.jsx)("span", { style: getNumberStyles(), children: value.toString().padStart(2, '0') }), showLabel && ((0, jsx_runtime_1.jsx)("span", { style: Object.assign(Object.assign({}, getLabelStyles()), { marginTop: shape === 'circle' ? '2px' : '4px', textTransform: 'lowercase', opacity: 0.8, whiteSpace: 'nowrap' }), children: label }))] }));
|
|
49
35
|
};
|
|
50
36
|
exports.default = TimerUnit;
|
package/dist/ui/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type TimerSize = 'sm' | 'md' | 'lg';
|
|
2
2
|
export type TimerLayout = 'horizontal' | 'vertical' | 'compact';
|
|
3
3
|
export type TimerTheme = 'light' | 'dark' | 'brand';
|
|
4
|
+
export type TimerInnerShape = 'rectangle' | 'circle';
|
|
4
5
|
export interface TimerUnits {
|
|
5
6
|
days?: boolean;
|
|
6
7
|
hours?: boolean;
|
|
@@ -14,6 +15,11 @@ export interface ServerTimerUIProps {
|
|
|
14
15
|
theme?: TimerTheme;
|
|
15
16
|
showUnits?: TimerUnits;
|
|
16
17
|
className?: string;
|
|
18
|
+
/** Show or hide labels */
|
|
19
|
+
showLabels?: boolean;
|
|
20
|
+
/** Inner background shape */
|
|
21
|
+
innerShape?: TimerInnerShape;
|
|
22
|
+
equalUnitSize: boolean;
|
|
17
23
|
customColors?: {
|
|
18
24
|
background?: string;
|
|
19
25
|
text?: string;
|
package/package.json
CHANGED