@@ -27,32 +27,179 @@ import type {
27
27
} from './shared/types.js' ;
28
28
29
29
export type ClockProps = {
30
+ /**
31
+ * Class name(s) that will be added along with `"react-clock"` to the main react-clock `<time>` element.
32
+ *
33
+ * @example 'class1 class2'
34
+ * @example ['class1', 'class2 class3']
35
+ */
30
36
className ?: ClassName ;
37
+ /**
38
+ * Function called to override default formatting of hour marks. Can be used to use your own formatting function.
39
+ *
40
+ * @example (locale, hour) => formatHour(hour, 'HH')
41
+ */
31
42
formatHour ?: typeof defaultFormatHour ;
43
+ /**
44
+ * Hour hand length, in %.
45
+ *
46
+ * @default 50
47
+ * @example 80
48
+ */
32
49
hourHandLength ?: HandLength ;
50
+ /**
51
+ * The length of the part of an hour hand on the opposite side the hand is pointing to, in %.
52
+ *
53
+ * @default 10
54
+ * @example 20
55
+ */
33
56
hourHandOppositeLength ?: OppositeHandLength ;
57
+ /**
58
+ * Hour hand width, in pixels.
59
+ *
60
+ * @default 4
61
+ * @example 3
62
+ */
34
63
hourHandWidth ?: HandWidth ;
64
+ /**
65
+ * Hour marks length, in %.
66
+ *
67
+ * @default 10
68
+ * @example 8
69
+ */
35
70
hourMarksLength ?: MarkLength ;
71
+ /**
72
+ * Hour marks width, in pixels.
73
+ *
74
+ * @default 3
75
+ * @example 2
76
+ */
36
77
hourMarksWidth ?: MarkWidth ;
78
+ /**
79
+ * Locale that should be used by the clock. Can be any [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag).
80
+ *
81
+ * **Note**: When using SSR, setting this prop may help resolving hydration errors caused by locale mismatch between server and client.
82
+ *
83
+ * @example 'hu-HU'
84
+ */
37
85
locale ?: string ;
86
+ /**
87
+ * Minute hand length, in %.
88
+ *
89
+ * @default 70
90
+ * @example 80
91
+ */
38
92
minuteHandLength ?: HandLength ;
93
+ /**
94
+ * The length of the part of a minute hand on the opposite side the hand is pointing to, in %.
95
+ *
96
+ * @default 10
97
+ * @example 20
98
+ */
39
99
minuteHandOppositeLength ?: OppositeHandLength ;
100
+ /**
101
+ * Minute hand width, in pixels.
102
+ *
103
+ * @default 2
104
+ * @example 3
105
+ */
40
106
minuteHandWidth ?: HandWidth ;
107
+ /**
108
+ * Minute marks length, in %.
109
+ *
110
+ * @default 6
111
+ * @example 8
112
+ */
41
113
minuteMarksLength ?: MarkLength ;
114
+ /**
115
+ * Minute marks width, in pixels.
116
+ *
117
+ * @default 1
118
+ * @example 2
119
+ */
42
120
minuteMarksWidth ?: MarkWidth ;
121
+ /**
122
+ * Whether hour marks shall be rendered.
123
+ *
124
+ * @default true
125
+ * @example false
126
+ */
43
127
renderHourMarks ?: boolean ;
128
+ /**
129
+ * Whether minute hand shall be rendered.
130
+ *
131
+ * @default true
132
+ * @example false
133
+ */
44
134
renderMinuteHand ?: boolean ;
135
+ /**
136
+ * Whether minute marks shall be rendered.
137
+ *
138
+ * @default true
139
+ * @example false
140
+ */
45
141
renderMinuteMarks ?: boolean ;
142
+ /**
143
+ * Whether numbers shall be rendered.
144
+ *
145
+ * @default true
146
+ * @example false
147
+ */
46
148
renderNumbers ?: boolean ;
149
+ /**
150
+ * Whether second hand shall be rendered.
151
+ *
152
+ * @default true
153
+ * @example false
154
+ */
47
155
renderSecondHand ?: boolean ;
156
+ /**
157
+ * Second hand length, in %.
158
+ *
159
+ * @default 90
160
+ * @example 80
161
+ */
48
162
secondHandLength ?: HandLength ;
163
+ /**
164
+ * The length of the part of a second hand on the opposite side the hand is pointing to, in %.
165
+ *
166
+ * @default 10
167
+ * @example 20
168
+ */
49
169
secondHandOppositeLength ?: OppositeHandLength ;
170
+ /**
171
+ * Second hand width, in pixels.
172
+ *
173
+ * @default 1
174
+ * @example 2
175
+ */
50
176
secondHandWidth ?: HandWidth ;
177
+ /**
178
+ * Clock size, in pixels (e.g. `200`) or as string (e.g. `"50vw"`).
179
+ *
180
+ * @default 150
181
+ * @example 260
182
+ * @example '50vw'
183
+ */
51
184
size ?: React . CSSProperties [ 'width' ] ;
185
+ /**
186
+ * Whether to use millisecond precision.
187
+ *
188
+ * @default false
189
+ * @example true
190
+ */
52
191
useMillisecondPrecision ?: boolean ;
192
+ /**
193
+ * Clock value. Must be provided.
194
+ *
195
+ * @example new Date()
196
+ */
53
197
value ?: string | Date | null ;
54
198
} ;
55
199
200
+ /**
201
+ * Displays a complete clock.
202
+ */
56
203
const Clock : React . FC < ClockProps > = function Clock ( {
57
204
className,
58
205
formatHour,
0 commit comments