@julseb-lib/react 0.0.88 → 0.0.89
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/index.cjs.js +639 -639
- package/dist/index.es.js +3247 -2717
- package/dist/index.umd.js +586 -586
- package/dist/lib/Mixins.tsx +970 -970
- package/dist/lib/components/Image/Image.tsx +77 -73
- package/dist/lib/components/Image/ImageFunction.tsx +39 -37
- package/dist/lib/components/Timepicker/Timepicker.tsx +234 -235
- package/dist/lib/components/Youtube/types.ts +5 -4
- package/dist/lib/index.ts +56 -55
- package/dist/lib/types/global.ts +129 -128
- package/dist/lib/types/index.ts +0 -1
- package/license.md +21 -0
- package/package.json +1 -1
- /package/dist/lib/{types/design-tokens.ts → design-tokens.ts} +0 -0
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { useRef, type ChangeEvent, type FC } from "react"
|
|
2
|
-
import { useClickOutside } from "../../"
|
|
2
|
+
import { useClickOutside, designTokens } from "../../"
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
InputContainer,
|
|
5
|
+
InputAndListContainer,
|
|
6
|
+
InputWrapper,
|
|
7
|
+
InputLeftContainer,
|
|
8
|
+
InputPrefix,
|
|
9
|
+
InputIcon,
|
|
10
|
+
InputRightContainer,
|
|
11
|
+
InputButton,
|
|
12
|
+
InputValidationIcon,
|
|
13
|
+
ListInput,
|
|
14
|
+
ListInputItem,
|
|
15
15
|
} from "../InputComponents"
|
|
16
16
|
import { Clock } from "../../icons"
|
|
17
17
|
import { useKeyboardNavigation } from "../ComponentsMixins"
|
|
18
|
-
import { designTokens } from "../../types"
|
|
19
18
|
import { InputTime } from "./styles"
|
|
20
19
|
import type { ILibTimepicker } from "./types"
|
|
21
20
|
|
|
@@ -65,243 +64,243 @@ import type { ILibTimepicker } from "./types"
|
|
|
65
64
|
* />
|
|
66
65
|
*/
|
|
67
66
|
export const Timepicker: FC<ILibTimepicker> = ({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
67
|
+
"data-testid": testid,
|
|
68
|
+
ref,
|
|
69
|
+
className,
|
|
70
|
+
icon,
|
|
71
|
+
iconSize,
|
|
72
|
+
iconBaseUrl,
|
|
73
|
+
iconClockSize = 16,
|
|
74
|
+
iconClock = (
|
|
75
|
+
<Clock
|
|
76
|
+
data-testid={testid && `${testid}.RightContainer.IconClock`}
|
|
77
|
+
className={className && "IconClock"}
|
|
78
|
+
size={iconClockSize}
|
|
79
|
+
/>
|
|
80
|
+
),
|
|
81
|
+
id,
|
|
82
|
+
label,
|
|
83
|
+
labelComment,
|
|
84
|
+
helper,
|
|
85
|
+
helperBottom,
|
|
86
|
+
validation,
|
|
87
|
+
inputBackground,
|
|
88
|
+
inputVariant,
|
|
89
|
+
containerStyle,
|
|
90
|
+
inputAndListContainerStyle,
|
|
91
|
+
listDirection,
|
|
92
|
+
step = "1h",
|
|
93
|
+
minTime,
|
|
94
|
+
maxTime,
|
|
95
|
+
value,
|
|
96
|
+
setValue,
|
|
97
|
+
prefix,
|
|
98
|
+
disabled,
|
|
99
|
+
tabIndex,
|
|
100
|
+
...rest
|
|
102
101
|
}) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
102
|
+
const hasContainer: boolean = !!(
|
|
103
|
+
label ||
|
|
104
|
+
labelComment ||
|
|
105
|
+
helper ||
|
|
106
|
+
helperBottom ||
|
|
107
|
+
validation
|
|
108
|
+
)
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
const el = useRef<HTMLDivElement>(null)
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
let times: Array<string> =
|
|
113
|
+
step === "30min"
|
|
114
|
+
? Object.keys(designTokens.halfHours)
|
|
115
|
+
: step === "15min"
|
|
116
|
+
? Object.keys(designTokens.quarterHours)
|
|
117
|
+
: step === "1min"
|
|
118
|
+
? Object.keys(designTokens.minutes)
|
|
119
|
+
: Object.keys(designTokens.hours)
|
|
121
120
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
if (minTime) {
|
|
122
|
+
times = times.splice(
|
|
123
|
+
times.indexOf(times.find(found => found === minTime)!),
|
|
124
|
+
times.length - 1
|
|
125
|
+
)
|
|
126
|
+
}
|
|
128
127
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
if (maxTime) {
|
|
129
|
+
times = times.splice(0, times.indexOf(maxTime) + 1)
|
|
130
|
+
}
|
|
132
131
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
const { isOpen, setIsOpen, cursor, listRef } = useKeyboardNavigation<
|
|
133
|
+
typeof times
|
|
134
|
+
>({
|
|
135
|
+
data: times,
|
|
136
|
+
value,
|
|
137
|
+
setValue,
|
|
138
|
+
})
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
const handleClick = () => {
|
|
141
|
+
if (isOpen) setIsOpen(false)
|
|
142
|
+
setIsOpen(true)
|
|
143
|
+
}
|
|
145
144
|
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
const handleOpen = () => setIsOpen(true)
|
|
146
|
+
const handleClose = () => setIsOpen(false)
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
const handleChange = (e: ChangeEvent<HTMLInputElement>) =>
|
|
149
|
+
setValue(
|
|
150
|
+
e.target.value as keyof typeof designTokens.hours &
|
|
151
|
+
keyof typeof designTokens.halfHours &
|
|
152
|
+
keyof typeof designTokens.quarterHours &
|
|
153
|
+
keyof typeof designTokens.minutes
|
|
154
|
+
)
|
|
156
155
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
const handleSelectTime = (time: string) => {
|
|
157
|
+
setValue(time as any)
|
|
158
|
+
handleClose()
|
|
159
|
+
}
|
|
161
160
|
|
|
162
|
-
|
|
161
|
+
useClickOutside(listRef, handleClose)
|
|
163
162
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
163
|
+
return (
|
|
164
|
+
<InputContainer
|
|
165
|
+
data-testid={testid}
|
|
166
|
+
id={id}
|
|
167
|
+
label={label}
|
|
168
|
+
labelComment={labelComment}
|
|
169
|
+
helper={helper}
|
|
170
|
+
helperBottom={helperBottom}
|
|
171
|
+
validation={validation}
|
|
172
|
+
value={value}
|
|
173
|
+
className={className}
|
|
174
|
+
iconBaseUrl={iconBaseUrl}
|
|
175
|
+
style={containerStyle}
|
|
176
|
+
hasListOpen={isOpen}
|
|
177
|
+
counter={undefined}
|
|
178
|
+
maxLength={undefined}
|
|
179
|
+
>
|
|
180
|
+
<InputAndListContainer
|
|
181
|
+
data-testid={testid}
|
|
182
|
+
className={className}
|
|
183
|
+
hasListOpen={isOpen}
|
|
184
|
+
isParent={!hasContainer}
|
|
185
|
+
ref={el}
|
|
186
|
+
inputAndListContainerStyle={inputAndListContainerStyle}
|
|
187
|
+
>
|
|
188
|
+
<InputWrapper
|
|
189
|
+
data-testid={testid}
|
|
190
|
+
className={className}
|
|
191
|
+
isTextArea={false}
|
|
192
|
+
inputBackground={inputBackground}
|
|
193
|
+
inputVariant={inputVariant}
|
|
194
|
+
validationStatus={validation?.status}
|
|
195
|
+
hasListOpen={isOpen}
|
|
196
|
+
hasContainer
|
|
197
|
+
>
|
|
198
|
+
{(icon || prefix) && (
|
|
199
|
+
<InputLeftContainer
|
|
200
|
+
data-testid={testid}
|
|
201
|
+
className={className}
|
|
202
|
+
disabled={disabled}
|
|
203
|
+
>
|
|
204
|
+
{prefix && (
|
|
205
|
+
<InputPrefix
|
|
206
|
+
data-testid={testid}
|
|
207
|
+
className={className}
|
|
208
|
+
prefix={prefix}
|
|
209
|
+
inputBackground={inputBackground}
|
|
210
|
+
/>
|
|
211
|
+
)}
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
213
|
+
{icon && (
|
|
214
|
+
<InputIcon
|
|
215
|
+
data-testid={testid}
|
|
216
|
+
className={className}
|
|
217
|
+
icon={icon}
|
|
218
|
+
iconSize={iconSize}
|
|
219
|
+
validationStatus={validation?.status}
|
|
220
|
+
disabled={disabled}
|
|
221
|
+
inputBackground={inputBackground}
|
|
222
|
+
inputVariant={inputVariant}
|
|
223
|
+
iconBaseUrl={iconBaseUrl}
|
|
224
|
+
/>
|
|
225
|
+
)}
|
|
226
|
+
</InputLeftContainer>
|
|
227
|
+
)}
|
|
229
228
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
229
|
+
<InputTime
|
|
230
|
+
data-testid={
|
|
231
|
+
testid && `${testid}.InputWrapper.InputTime`
|
|
232
|
+
}
|
|
233
|
+
className={className && "InputTime"}
|
|
234
|
+
ref={ref}
|
|
235
|
+
onClick={handleClick}
|
|
236
|
+
onFocus={handleOpen}
|
|
237
|
+
tabIndex={tabIndex}
|
|
238
|
+
value={value}
|
|
239
|
+
onChange={handleChange}
|
|
240
|
+
disabled={disabled}
|
|
241
|
+
$disabled={disabled}
|
|
242
|
+
$validationStatus={validation?.status}
|
|
243
|
+
$inputBackground={inputBackground}
|
|
244
|
+
$inputVariant={inputVariant}
|
|
245
|
+
{...rest}
|
|
246
|
+
/>
|
|
248
247
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
248
|
+
<InputRightContainer
|
|
249
|
+
data-testid={testid}
|
|
250
|
+
className={className}
|
|
251
|
+
disabled={disabled}
|
|
252
|
+
withBorder={false}
|
|
253
|
+
withPadding
|
|
254
|
+
>
|
|
255
|
+
<InputButton
|
|
256
|
+
data-testid={testid}
|
|
257
|
+
className={className}
|
|
258
|
+
icon={iconClock}
|
|
259
|
+
iconSize={iconClockSize}
|
|
260
|
+
onClick={handleClick}
|
|
261
|
+
aria-label="Calendar"
|
|
262
|
+
disabled={disabled}
|
|
263
|
+
inputBackground={inputBackground}
|
|
264
|
+
validationStatus={validation?.status}
|
|
265
|
+
/>
|
|
267
266
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
267
|
+
{validation && (
|
|
268
|
+
<InputValidationIcon
|
|
269
|
+
data-testid={testid}
|
|
270
|
+
className={className}
|
|
271
|
+
validation={validation}
|
|
272
|
+
inputBackground={inputBackground}
|
|
273
|
+
/>
|
|
274
|
+
)}
|
|
275
|
+
</InputRightContainer>
|
|
276
|
+
</InputWrapper>
|
|
278
277
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
278
|
+
<ListInput
|
|
279
|
+
data-testid={testid}
|
|
280
|
+
className={className}
|
|
281
|
+
direction={listDirection}
|
|
282
|
+
inputBackground={inputBackground}
|
|
283
|
+
inputVariant={inputVariant}
|
|
284
|
+
validationStatus={validation?.status}
|
|
285
|
+
isOpen={!!(value && isOpen)}
|
|
286
|
+
ref={listRef}
|
|
287
|
+
>
|
|
288
|
+
{times.map((time, i) => (
|
|
289
|
+
<ListInputItem
|
|
290
|
+
key={time}
|
|
291
|
+
data-testid={testid}
|
|
292
|
+
className={className}
|
|
293
|
+
validationStatus={validation?.status}
|
|
294
|
+
inputBackground={inputBackground}
|
|
295
|
+
onClick={() => handleSelectTime(time)}
|
|
296
|
+
isActive={i === cursor}
|
|
297
|
+
isHovered={value === time}
|
|
298
|
+
>
|
|
299
|
+
{time}
|
|
300
|
+
</ListInputItem>
|
|
301
|
+
))}
|
|
302
|
+
</ListInput>
|
|
303
|
+
</InputAndListContainer>
|
|
304
|
+
</InputContainer>
|
|
305
|
+
)
|
|
307
306
|
}
|
|
@@ -2,8 +2,9 @@ import type { IframeHTMLAttributes } from "react"
|
|
|
2
2
|
import type { LibComponentBase } from "../../types"
|
|
3
3
|
|
|
4
4
|
export interface ILibYoutube
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
extends Exclude<LibComponentBase<HTMLIFrameElement>, "as">,
|
|
6
|
+
IframeHTMLAttributes<HTMLIFrameElement> {
|
|
7
|
+
src: string
|
|
8
|
+
aspectRatio?: string
|
|
9
|
+
children?: never
|
|
9
10
|
}
|
package/dist/lib/index.ts
CHANGED
|
@@ -3,68 +3,69 @@
|
|
|
3
3
|
export { ThemeProvider } from "styled-components"
|
|
4
4
|
// import {} from "styled-components/cssprop"
|
|
5
5
|
export * from "./utils"
|
|
6
|
+
export * from "./design-tokens"
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
8
|
+
addDay,
|
|
9
|
+
addMonth,
|
|
10
|
+
addYear,
|
|
11
|
+
calculateAverage,
|
|
12
|
+
calculateTotalSum,
|
|
13
|
+
capitalize,
|
|
14
|
+
convertDate,
|
|
15
|
+
convertDateShort,
|
|
16
|
+
convertPrice,
|
|
17
|
+
convertToEmail,
|
|
18
|
+
convertYoutube,
|
|
19
|
+
deleteDuplicates,
|
|
20
|
+
detectLanguage,
|
|
21
|
+
disableScroll,
|
|
22
|
+
enableScroll,
|
|
23
|
+
filterObject,
|
|
24
|
+
formatDate,
|
|
25
|
+
formatHour,
|
|
26
|
+
generateNumbers,
|
|
27
|
+
getFirstName,
|
|
28
|
+
getInitials,
|
|
29
|
+
getLastName,
|
|
30
|
+
getNextDay,
|
|
31
|
+
getPercentage,
|
|
32
|
+
getRandom,
|
|
33
|
+
getRandomAvatar,
|
|
34
|
+
getRandomDate,
|
|
35
|
+
getRandomNumber,
|
|
36
|
+
getRandomString,
|
|
37
|
+
getRandomTime,
|
|
38
|
+
getTimeNow,
|
|
39
|
+
getToday,
|
|
40
|
+
getTomorrow,
|
|
41
|
+
getYesterday,
|
|
42
|
+
hexToRgb,
|
|
43
|
+
emailRegex,
|
|
44
|
+
passwordRegex,
|
|
45
|
+
rgbToHex,
|
|
46
|
+
scrollToTop,
|
|
47
|
+
slugify,
|
|
48
|
+
sortByFrequency,
|
|
49
|
+
stringifyPx,
|
|
50
|
+
toCamelCase,
|
|
51
|
+
toConstantCase,
|
|
52
|
+
toDotCase,
|
|
53
|
+
toKebabCase,
|
|
54
|
+
toPascalCase,
|
|
55
|
+
toPathCase,
|
|
56
|
+
toSentenceCase,
|
|
57
|
+
toSnakeCase,
|
|
58
|
+
toTitleCase,
|
|
59
|
+
unslugify,
|
|
60
|
+
uuid,
|
|
60
61
|
} from "@julseb-lib/utils"
|
|
61
62
|
|
|
62
63
|
export * from "./Variables"
|
|
63
64
|
export * from "./Mixins"
|
|
64
65
|
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
optionsMarkdown,
|
|
68
|
+
markdownEditorOptions,
|
|
68
69
|
} from "./utils/options-markdown"
|
|
69
70
|
|
|
70
71
|
export * from "./hooks"
|