@jobber/components 6.103.2-JOB-140609-9051081.26 → 6.103.2
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/Autocomplete/Autocomplete.types.d.ts +1 -12
- package/dist/Autocomplete/index.cjs +13 -1
- package/dist/Autocomplete/index.mjs +13 -1
- package/dist/Checkbox/Checkbox.types.d.ts +9 -2
- package/dist/Checkbox/index.cjs +2 -3
- package/dist/Checkbox/index.mjs +2 -3
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
- package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
- package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
- package/dist/Chips/index.cjs +2 -2
- package/dist/Chips/index.mjs +2 -2
- package/dist/DataList/components/DataListSearch/index.cjs +12 -1
- package/dist/DataList/components/DataListSearch/index.mjs +12 -1
- package/dist/DataList/index.cjs +8 -0
- package/dist/DataList/index.mjs +8 -0
- package/dist/DataTable/index.cjs +2 -2
- package/dist/DataTable/index.mjs +2 -2
- package/dist/DatePicker/index.cjs +2 -2
- package/dist/DatePicker/index.mjs +2 -2
- package/dist/FormField/FormFieldTypes.d.ts +1 -217
- package/dist/FormField-cjs.js +6 -1
- package/dist/FormField-es.js +6 -2
- package/dist/InputDate/index.cjs +4 -8
- package/dist/InputDate/index.mjs +4 -8
- package/dist/InputDate/useInputDateActivatorActions.d.ts +2 -2
- package/dist/InputEmail/InputEmail.types.d.ts +21 -16
- package/dist/InputEmail/hooks/useInputEmailActions.d.ts +1 -1
- package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +32 -0
- package/dist/InputEmail/index.cjs +45 -10
- package/dist/InputEmail/index.mjs +45 -10
- package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +2 -23
- package/dist/InputNumber/index.cjs +3 -6
- package/dist/InputNumber/index.mjs +3 -6
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +26 -15
- package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
- package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +71 -0
- package/dist/InputPhoneNumber/index.cjs +35 -20
- package/dist/InputPhoneNumber/index.mjs +35 -20
- package/dist/InputText/InputText.d.ts +2 -2
- package/dist/InputText/InputText.types.d.ts +24 -27
- package/dist/InputText/index.cjs +55 -26
- package/dist/InputText/index.mjs +56 -27
- package/dist/InputText/useInputTextActions.d.ts +1 -1
- package/dist/InputText/useInputTextFormField.d.ts +352 -0
- package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
- package/dist/InputTime/InputTime.types.d.ts +1 -21
- package/dist/InputTime/index.cjs +25 -30
- package/dist/InputTime/index.d.ts +1 -1
- package/dist/InputTime/index.mjs +27 -32
- package/dist/List/index.cjs +2 -2
- package/dist/List/index.mjs +2 -2
- package/dist/RecurringSelect/index.cjs +2 -2
- package/dist/RecurringSelect/index.mjs +2 -2
- package/dist/Select/Select.rebuilt.d.ts +1 -1
- package/dist/Select/Select.types.d.ts +1 -14
- package/dist/Select/hooks/useSelectActions.d.ts +5 -5
- package/dist/Select/hooks/useSelectFormField.d.ts +34 -0
- package/dist/Select/index.cjs +41 -27
- package/dist/Select/index.d.ts +5 -7
- package/dist/Select/index.mjs +43 -29
- package/dist/_baseEach-cjs.js +12 -12
- package/dist/_baseEach-es.js +1 -1
- package/dist/_baseFlatten-cjs.js +2 -2
- package/dist/_baseFlatten-es.js +1 -1
- package/dist/{_getAllKeys-cjs.js → _baseGet-cjs.js} +181 -181
- package/dist/{_getAllKeys-es.js → _baseGet-es.js} +182 -182
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/omit-cjs.js +14 -14
- package/dist/omit-es.js +1 -1
- package/dist/useScrollToActive-cjs.js +3 -3
- package/dist/useScrollToActive-es.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import type { ChangeEvent, FocusEvent, KeyboardEvent, ReactNode } from "react";
|
|
2
|
+
export interface useInputTextFormFieldProps extends React.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The html id for the field
|
|
5
|
+
*/
|
|
6
|
+
readonly id: string;
|
|
7
|
+
/**
|
|
8
|
+
* The auto-generated name for the html input field if a nameProp is not provided
|
|
9
|
+
*/
|
|
10
|
+
readonly name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The error message for the field
|
|
13
|
+
*/
|
|
14
|
+
readonly error?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Adjusts the form field to go inline with a content. This also silences the
|
|
17
|
+
* given `validations` prop. You'd have to used the `onValidate` prop to
|
|
18
|
+
* capture the message and render it somewhere else using the
|
|
19
|
+
* `InputValidation` component.
|
|
20
|
+
*/
|
|
21
|
+
readonly inline?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Further description of the input, can be used for a hint.
|
|
24
|
+
*/
|
|
25
|
+
readonly description?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Callback for when the field value changes
|
|
28
|
+
*/
|
|
29
|
+
handleChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Callback for when the field loses focus
|
|
32
|
+
*/
|
|
33
|
+
handleBlur: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Callback for when the field gains focus
|
|
36
|
+
*/
|
|
37
|
+
handleFocus: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Callback for when keydown event is triggered on the field
|
|
40
|
+
*/
|
|
41
|
+
handleKeyDown: (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
42
|
+
readonly invalid?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface UseInputTextFormFieldReturn {
|
|
45
|
+
fieldProps: React.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Provides the props for the html fields rendered by the html input.
|
|
49
|
+
* DO not repeat this pattern. We are doing this as a proof of concept relating to the refactoring of Form inputs to see what can be removed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useInputTextFormField({ id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error, ...rest }: useInputTextFormFieldProps): {
|
|
52
|
+
fieldProps: {
|
|
53
|
+
"aria-invalid": boolean | undefined;
|
|
54
|
+
autoFocus: boolean | undefined;
|
|
55
|
+
invalid: string | undefined;
|
|
56
|
+
onKeyDown: (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
57
|
+
"aria-describedby"?: string | undefined;
|
|
58
|
+
id: string;
|
|
59
|
+
className: string;
|
|
60
|
+
name: string;
|
|
61
|
+
disabled: boolean | undefined;
|
|
62
|
+
inputMode: "none" | "text" | "search" | "email" | "decimal" | "tel" | "url" | "numeric" | undefined;
|
|
63
|
+
onChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
64
|
+
onBlur: () => void;
|
|
65
|
+
onFocus: (event: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
66
|
+
accept?: string | undefined;
|
|
67
|
+
alt?: string | undefined;
|
|
68
|
+
autoComplete?: import("react").HTMLInputAutoCompleteAttribute | undefined;
|
|
69
|
+
capture?: boolean | "user" | "environment" | undefined;
|
|
70
|
+
checked?: boolean | undefined;
|
|
71
|
+
form?: string | undefined;
|
|
72
|
+
formAction?: string | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
|
|
73
|
+
formEncType?: string | undefined;
|
|
74
|
+
formMethod?: string | undefined;
|
|
75
|
+
formNoValidate?: boolean | undefined;
|
|
76
|
+
formTarget?: string | undefined;
|
|
77
|
+
height?: number | string | undefined;
|
|
78
|
+
list?: string | undefined;
|
|
79
|
+
max?: number | string | undefined;
|
|
80
|
+
maxLength?: number | undefined;
|
|
81
|
+
min?: number | string | undefined;
|
|
82
|
+
minLength?: number | undefined;
|
|
83
|
+
multiple?: boolean | undefined;
|
|
84
|
+
pattern?: string | undefined;
|
|
85
|
+
placeholder?: string | undefined;
|
|
86
|
+
readOnly?: boolean | undefined;
|
|
87
|
+
required?: boolean | undefined;
|
|
88
|
+
size?: number | undefined;
|
|
89
|
+
src?: string | undefined;
|
|
90
|
+
step?: number | string | undefined;
|
|
91
|
+
type?: import("react").HTMLInputTypeAttribute | undefined;
|
|
92
|
+
value?: string | readonly string[] | number | undefined;
|
|
93
|
+
width?: number | string | undefined;
|
|
94
|
+
defaultChecked?: boolean | undefined;
|
|
95
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
96
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
97
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
98
|
+
accessKey?: string | undefined;
|
|
99
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
|
100
|
+
contentEditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only" | undefined;
|
|
101
|
+
contextMenu?: string | undefined;
|
|
102
|
+
dir?: string | undefined;
|
|
103
|
+
draggable?: (boolean | "false" | "true") | undefined;
|
|
104
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
105
|
+
hidden?: boolean | undefined;
|
|
106
|
+
lang?: string | undefined;
|
|
107
|
+
nonce?: string | undefined;
|
|
108
|
+
slot?: string | undefined;
|
|
109
|
+
spellCheck?: (boolean | "false" | "true") | undefined;
|
|
110
|
+
style?: import("react").CSSProperties | undefined;
|
|
111
|
+
tabIndex?: number | undefined;
|
|
112
|
+
title?: string | undefined;
|
|
113
|
+
translate?: "yes" | "no" | undefined;
|
|
114
|
+
radioGroup?: string | undefined;
|
|
115
|
+
role?: import("react").AriaRole | undefined;
|
|
116
|
+
about?: string | undefined;
|
|
117
|
+
content?: string | undefined;
|
|
118
|
+
datatype?: string | undefined;
|
|
119
|
+
inlist?: any;
|
|
120
|
+
prefix?: string | undefined;
|
|
121
|
+
property?: string | undefined;
|
|
122
|
+
rel?: string | undefined;
|
|
123
|
+
resource?: string | undefined;
|
|
124
|
+
rev?: string | undefined;
|
|
125
|
+
typeof?: string | undefined;
|
|
126
|
+
vocab?: string | undefined;
|
|
127
|
+
autoCorrect?: string | undefined;
|
|
128
|
+
autoSave?: string | undefined;
|
|
129
|
+
color?: string | undefined;
|
|
130
|
+
itemProp?: string | undefined;
|
|
131
|
+
itemScope?: boolean | undefined;
|
|
132
|
+
itemType?: string | undefined;
|
|
133
|
+
itemID?: string | undefined;
|
|
134
|
+
itemRef?: string | undefined;
|
|
135
|
+
results?: number | undefined;
|
|
136
|
+
security?: string | undefined;
|
|
137
|
+
unselectable?: "on" | "off" | undefined;
|
|
138
|
+
is?: string | undefined;
|
|
139
|
+
exportparts?: string | undefined;
|
|
140
|
+
part?: string | undefined;
|
|
141
|
+
"aria-activedescendant"?: string | undefined;
|
|
142
|
+
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
|
143
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
144
|
+
"aria-braillelabel"?: string | undefined;
|
|
145
|
+
"aria-brailleroledescription"?: string | undefined;
|
|
146
|
+
"aria-busy"?: (boolean | "false" | "true") | undefined;
|
|
147
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
148
|
+
"aria-colcount"?: number | undefined;
|
|
149
|
+
"aria-colindex"?: number | undefined;
|
|
150
|
+
"aria-colindextext"?: string | undefined;
|
|
151
|
+
"aria-colspan"?: number | undefined;
|
|
152
|
+
"aria-controls"?: string | undefined;
|
|
153
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
|
154
|
+
"aria-description"?: string | undefined;
|
|
155
|
+
"aria-details"?: string | undefined;
|
|
156
|
+
"aria-disabled"?: (boolean | "false" | "true") | undefined;
|
|
157
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
|
158
|
+
"aria-errormessage"?: string | undefined;
|
|
159
|
+
"aria-expanded"?: (boolean | "false" | "true") | undefined;
|
|
160
|
+
"aria-flowto"?: string | undefined;
|
|
161
|
+
"aria-grabbed"?: (boolean | "false" | "true") | undefined;
|
|
162
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
163
|
+
"aria-hidden"?: (boolean | "false" | "true") | undefined;
|
|
164
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
165
|
+
"aria-label"?: string | undefined;
|
|
166
|
+
"aria-labelledby"?: string | undefined;
|
|
167
|
+
"aria-level"?: number | undefined;
|
|
168
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
169
|
+
"aria-modal"?: (boolean | "false" | "true") | undefined;
|
|
170
|
+
"aria-multiline"?: (boolean | "false" | "true") | undefined;
|
|
171
|
+
"aria-multiselectable"?: (boolean | "false" | "true") | undefined;
|
|
172
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
173
|
+
"aria-owns"?: string | undefined;
|
|
174
|
+
"aria-placeholder"?: string | undefined;
|
|
175
|
+
"aria-posinset"?: number | undefined;
|
|
176
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
177
|
+
"aria-readonly"?: (boolean | "false" | "true") | undefined;
|
|
178
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
179
|
+
"aria-required"?: (boolean | "false" | "true") | undefined;
|
|
180
|
+
"aria-roledescription"?: string | undefined;
|
|
181
|
+
"aria-rowcount"?: number | undefined;
|
|
182
|
+
"aria-rowindex"?: number | undefined;
|
|
183
|
+
"aria-rowindextext"?: string | undefined;
|
|
184
|
+
"aria-rowspan"?: number | undefined;
|
|
185
|
+
"aria-selected"?: (boolean | "false" | "true") | undefined;
|
|
186
|
+
"aria-setsize"?: number | undefined;
|
|
187
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
188
|
+
"aria-valuemax"?: number | undefined;
|
|
189
|
+
"aria-valuemin"?: number | undefined;
|
|
190
|
+
"aria-valuenow"?: number | undefined;
|
|
191
|
+
"aria-valuetext"?: string | undefined;
|
|
192
|
+
children?: ReactNode | undefined;
|
|
193
|
+
dangerouslySetInnerHTML?: {
|
|
194
|
+
__html: string | TrustedHTML;
|
|
195
|
+
} | undefined;
|
|
196
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
197
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
198
|
+
onCut?: import("react").ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
199
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
200
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
201
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
202
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
203
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
204
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
205
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
206
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
207
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
208
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
209
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
210
|
+
onChangeCapture?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
211
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
212
|
+
onBeforeInputCapture?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
213
|
+
onInput?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
214
|
+
onInputCapture?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
215
|
+
onReset?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
216
|
+
onResetCapture?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
217
|
+
onSubmit?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
218
|
+
onSubmitCapture?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
219
|
+
onInvalid?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
220
|
+
onInvalidCapture?: import("react").FormEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
221
|
+
onLoad?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
222
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
223
|
+
onError?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
224
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
225
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
226
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
227
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
228
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
229
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
230
|
+
onAbort?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
231
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
232
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
233
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
234
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
235
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
236
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
237
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
238
|
+
onEmptied?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
239
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
240
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
241
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
242
|
+
onEnded?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
243
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
244
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
245
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
246
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
247
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
248
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
249
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
250
|
+
onPause?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
251
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
252
|
+
onPlay?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
253
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
254
|
+
onPlaying?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
255
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
256
|
+
onProgress?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
257
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
258
|
+
onRateChange?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
259
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
260
|
+
onSeeked?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
261
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
262
|
+
onSeeking?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
263
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
264
|
+
onStalled?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
265
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
266
|
+
onSuspend?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
267
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
268
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
269
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
270
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
271
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
272
|
+
onWaiting?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
273
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
274
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
275
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
276
|
+
onClick?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
277
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
278
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
279
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
280
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
281
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
282
|
+
onDrag?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
283
|
+
onDragCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
284
|
+
onDragEnd?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
285
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
286
|
+
onDragEnter?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
287
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
288
|
+
onDragExit?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
289
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
290
|
+
onDragLeave?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
291
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
292
|
+
onDragOver?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
293
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
294
|
+
onDragStart?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
295
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
296
|
+
onDrop?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
297
|
+
onDropCapture?: import("react").DragEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
298
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
299
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
300
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
301
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
302
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
303
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
304
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
305
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
306
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
307
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
308
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
309
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
310
|
+
onSelect?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
311
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
312
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
313
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
314
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
315
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
316
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
317
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
318
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
319
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
320
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
321
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
322
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
323
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
324
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
325
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
326
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
327
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
328
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
329
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
330
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
331
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
332
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
333
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
334
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
335
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
336
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
337
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
338
|
+
onScroll?: import("react").UIEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
339
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
340
|
+
onWheel?: import("react").WheelEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
341
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
342
|
+
onAnimationStart?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
343
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
344
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
345
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
346
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
347
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
348
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
349
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
350
|
+
};
|
|
351
|
+
descriptionIdentifier: string;
|
|
352
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { InputTimeRebuiltProps } from "./InputTime.types";
|
|
3
|
-
export declare
|
|
3
|
+
export declare function InputTimeRebuilt({ value, onChange, ...params }: InputTimeRebuiltProps): React.JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
2
|
-
import type { AriaInputProps, FocusEvents, KeyboardEvents } from "../FormField/FormFieldTypes";
|
|
3
2
|
export interface InputTimeProps extends Pick<CommonFormFieldProps, "id" | "align" | "description" | "disabled" | "invalid" | "inline" | "loading" | "name" | "onValidation" | "placeholder" | "size" | "clearable">, Pick<FormFieldProps, "maxLength" | "readonly" | "autocomplete" | "max" | "min" | "onEnter" | "onFocus" | "onBlur" | "inputRef" | "validations"> {
|
|
4
3
|
/**
|
|
5
4
|
* Intial value of the input. Only use this when you need to prepopulate the
|
|
@@ -19,29 +18,10 @@ export interface InputTimeProps extends Pick<CommonFormFieldProps, "id" | "align
|
|
|
19
18
|
export interface InputTimeLegacyProps extends InputTimeProps {
|
|
20
19
|
version?: 1;
|
|
21
20
|
}
|
|
22
|
-
export interface InputTimeRebuiltProps extends Omit<InputTimeProps, "defaultValue" | "version" | "validations" | "onValidation"
|
|
21
|
+
export interface InputTimeRebuiltProps extends Omit<InputTimeProps, "defaultValue" | "version" | "validations" | "onValidation"> {
|
|
23
22
|
/**
|
|
24
23
|
* Version 2 is highly experimental, avoid using it unless you have talked with Atlantis first.
|
|
25
24
|
*/
|
|
26
25
|
version: 2;
|
|
27
|
-
/**
|
|
28
|
-
* Error message to display.
|
|
29
|
-
*/
|
|
30
26
|
error?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the input is read-only.
|
|
33
|
-
*/
|
|
34
|
-
readonly readOnly?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* HTML autocomplete attribute for browser autofill.
|
|
37
|
-
*/
|
|
38
|
-
readonly autoComplete?: string;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use `ref` instead. Note: `ref` support requires React 18+ forwardRef.
|
|
41
|
-
*/
|
|
42
|
-
readonly inputRef?: FormFieldProps["inputRef"];
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Use `onKeyDown` or `onKeyUp` instead.
|
|
45
|
-
*/
|
|
46
|
-
readonly onEnter?: FormFieldProps["onEnter"];
|
|
47
27
|
}
|
package/dist/InputTime/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ require('../useFormFieldFocus-cjs.js');
|
|
|
21
21
|
require('../InputValidation-cjs.js');
|
|
22
22
|
require('../Spinner-cjs.js');
|
|
23
23
|
require('react-router-dom');
|
|
24
|
-
require('../
|
|
24
|
+
require('../_baseGet-cjs.js');
|
|
25
25
|
require('../isTypedArray-cjs.js');
|
|
26
26
|
require('../identity-cjs.js');
|
|
27
27
|
require('../_getTag-cjs.js');
|
|
@@ -204,32 +204,23 @@ function timeStringToDate(timeString, baseDate) {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
|
|
208
|
-
var _b;
|
|
209
|
-
var { value, onChange,
|
|
210
|
-
|
|
211
|
-
inputRef: deprecatedInputRef } = _a, params = tslib_es6.__rest(_a, ["value", "onChange", "readOnly", "autoComplete", "inputRef"]);
|
|
212
|
-
const internalRef = React.useRef(null);
|
|
213
|
-
const mergedRef = FormField.mergeRefs([
|
|
214
|
-
internalRef,
|
|
215
|
-
deprecatedInputRef,
|
|
216
|
-
forwardedRef,
|
|
217
|
-
]);
|
|
218
|
-
const id = params.id || React.useId();
|
|
219
|
-
const wrapperRef = React.useRef(null);
|
|
220
|
-
const { inputStyle } = FormField.useFormFieldWrapperStyles(params);
|
|
207
|
+
function InputTimeRebuilt(_a) {
|
|
208
|
+
var _b, _c;
|
|
209
|
+
var { value, onChange } = _a, params = tslib_es6.__rest(_a, ["value", "onChange"]);
|
|
210
|
+
const ref = (_b = params.inputRef) !== null && _b !== void 0 ? _b : React.useRef(null);
|
|
221
211
|
const { setTypedTime } = useTimePredict({
|
|
222
212
|
value,
|
|
223
213
|
handleChange,
|
|
224
214
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
215
|
+
const { inputStyle } = FormField.useFormFieldWrapperStyles(params);
|
|
216
|
+
const wrapperRef = React.useRef(null);
|
|
217
|
+
const id = getId(params);
|
|
218
|
+
return (React.createElement(FormField.FormFieldWrapper, { disabled: params.disabled, size: params.size, align: params.align, inline: params.inline, name: params.name, error: params.error || "", identifier: id, descriptionIdentifier: `descriptionUUID--${id}`, invalid: Boolean(params.invalid), description: params.description, clearable: (_c = params.clearable) !== null && _c !== void 0 ? _c : "never", onClear: handleClear, type: "time", readonly: params.readonly, placeholder: params.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
|
|
219
|
+
React.createElement("input", { ref: ref, type: "time", name: params.name, className: inputStyle, onBlur: handleBlur, id: id, disabled: params.disabled, readOnly: params.readonly, onChange: handleChangeEvent, onFocus: handleFocus, "data-testid": "ATL-InputTime-input", onKeyUp: e => {
|
|
220
|
+
if (params.disabled || params.readonly)
|
|
230
221
|
return;
|
|
231
222
|
!isNaN(parseInt(e.key, 10)) && setTypedTime(prev => prev + e.key);
|
|
232
|
-
},
|
|
223
|
+
}, value: dateToTimeString(value) })));
|
|
233
224
|
function handleChangeEvent(event) {
|
|
234
225
|
handleChange(event.target.value);
|
|
235
226
|
}
|
|
@@ -239,23 +230,27 @@ const InputTimeRebuilt = React.forwardRef(function InputTimeRebuilt(_a, forwarde
|
|
|
239
230
|
function handleBlur(event) {
|
|
240
231
|
var _a;
|
|
241
232
|
(_a = params.onBlur) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
242
|
-
if (
|
|
243
|
-
if (!
|
|
244
|
-
|
|
233
|
+
if (ref.current) {
|
|
234
|
+
if (!ref.current.checkValidity()) {
|
|
235
|
+
ref.current.value = "";
|
|
245
236
|
}
|
|
246
237
|
}
|
|
247
238
|
}
|
|
248
239
|
function handleClear() {
|
|
249
240
|
var _a;
|
|
250
|
-
|
|
241
|
+
handleBlur();
|
|
251
242
|
onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
|
|
252
|
-
(_a =
|
|
243
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
253
244
|
}
|
|
254
245
|
function handleFocus(event) {
|
|
255
246
|
var _a;
|
|
256
247
|
(_a = params.onFocus) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
257
248
|
}
|
|
258
|
-
|
|
249
|
+
function getId(props) {
|
|
250
|
+
const generatedId = React.useId();
|
|
251
|
+
return props.id || generatedId;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
259
254
|
|
|
260
255
|
function InputTime$1(_a) {
|
|
261
256
|
var { defaultValue, value, onChange } = _a, params = tslib_es6.__rest(_a, ["defaultValue", "value", "onChange"]);
|
|
@@ -287,13 +282,13 @@ function InputTime$1(_a) {
|
|
|
287
282
|
function isNewInputTimeProps(props) {
|
|
288
283
|
return props.version === 2;
|
|
289
284
|
}
|
|
290
|
-
|
|
285
|
+
function InputTime(props) {
|
|
291
286
|
if (isNewInputTimeProps(props)) {
|
|
292
|
-
return React.createElement(InputTimeRebuilt, Object.assign({}, props
|
|
287
|
+
return React.createElement(InputTimeRebuilt, Object.assign({}, props));
|
|
293
288
|
}
|
|
294
289
|
else {
|
|
295
290
|
return React.createElement(InputTime$1, Object.assign({}, props));
|
|
296
291
|
}
|
|
297
|
-
}
|
|
292
|
+
}
|
|
298
293
|
|
|
299
294
|
exports.InputTime = InputTime;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { InputTimeLegacyProps, InputTimeRebuiltProps } from "./InputTime.types";
|
|
3
3
|
export type InputTimeShimProps = InputTimeLegacyProps | InputTimeRebuiltProps;
|
|
4
|
-
export declare
|
|
4
|
+
export declare function InputTime(props: InputTimeShimProps): React.JSX.Element;
|
package/dist/InputTime/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React__default, { useState, useCallback, useEffect,
|
|
1
|
+
import React__default, { useState, useCallback, useEffect, useRef, useId } from 'react';
|
|
2
2
|
import { _ as __rest } from '../tslib.es6-es.js';
|
|
3
3
|
import { d as debounce } from '../debounce-es.js';
|
|
4
|
-
import { j as useFormFieldWrapperStyles, f as FormFieldWrapper,
|
|
4
|
+
import { j as useFormFieldWrapperStyles, f as FormFieldWrapper, k as FormField } from '../FormField-es.js';
|
|
5
5
|
import 'classnames';
|
|
6
6
|
import '@jobber/design';
|
|
7
7
|
import 'react-hook-form';
|
|
@@ -19,7 +19,7 @@ import '../useFormFieldFocus-es.js';
|
|
|
19
19
|
import '../InputValidation-es.js';
|
|
20
20
|
import '../Spinner-es.js';
|
|
21
21
|
import 'react-router-dom';
|
|
22
|
-
import '../
|
|
22
|
+
import '../_baseGet-es.js';
|
|
23
23
|
import '../isTypedArray-es.js';
|
|
24
24
|
import '../identity-es.js';
|
|
25
25
|
import '../_getTag-es.js';
|
|
@@ -202,32 +202,23 @@ function timeStringToDate(timeString, baseDate) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
var _b;
|
|
207
|
-
var { value, onChange,
|
|
208
|
-
|
|
209
|
-
inputRef: deprecatedInputRef } = _a, params = __rest(_a, ["value", "onChange", "readOnly", "autoComplete", "inputRef"]);
|
|
210
|
-
const internalRef = useRef(null);
|
|
211
|
-
const mergedRef = mergeRefs([
|
|
212
|
-
internalRef,
|
|
213
|
-
deprecatedInputRef,
|
|
214
|
-
forwardedRef,
|
|
215
|
-
]);
|
|
216
|
-
const id = params.id || useId();
|
|
217
|
-
const wrapperRef = React__default.useRef(null);
|
|
218
|
-
const { inputStyle } = useFormFieldWrapperStyles(params);
|
|
205
|
+
function InputTimeRebuilt(_a) {
|
|
206
|
+
var _b, _c;
|
|
207
|
+
var { value, onChange } = _a, params = __rest(_a, ["value", "onChange"]);
|
|
208
|
+
const ref = (_b = params.inputRef) !== null && _b !== void 0 ? _b : useRef(null);
|
|
219
209
|
const { setTypedTime } = useTimePredict({
|
|
220
210
|
value,
|
|
221
211
|
handleChange,
|
|
222
212
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
213
|
+
const { inputStyle } = useFormFieldWrapperStyles(params);
|
|
214
|
+
const wrapperRef = React__default.useRef(null);
|
|
215
|
+
const id = getId(params);
|
|
216
|
+
return (React__default.createElement(FormFieldWrapper, { disabled: params.disabled, size: params.size, align: params.align, inline: params.inline, name: params.name, error: params.error || "", identifier: id, descriptionIdentifier: `descriptionUUID--${id}`, invalid: Boolean(params.invalid), description: params.description, clearable: (_c = params.clearable) !== null && _c !== void 0 ? _c : "never", onClear: handleClear, type: "time", readonly: params.readonly, placeholder: params.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
|
|
217
|
+
React__default.createElement("input", { ref: ref, type: "time", name: params.name, className: inputStyle, onBlur: handleBlur, id: id, disabled: params.disabled, readOnly: params.readonly, onChange: handleChangeEvent, onFocus: handleFocus, "data-testid": "ATL-InputTime-input", onKeyUp: e => {
|
|
218
|
+
if (params.disabled || params.readonly)
|
|
228
219
|
return;
|
|
229
220
|
!isNaN(parseInt(e.key, 10)) && setTypedTime(prev => prev + e.key);
|
|
230
|
-
},
|
|
221
|
+
}, value: dateToTimeString(value) })));
|
|
231
222
|
function handleChangeEvent(event) {
|
|
232
223
|
handleChange(event.target.value);
|
|
233
224
|
}
|
|
@@ -237,23 +228,27 @@ const InputTimeRebuilt = forwardRef(function InputTimeRebuilt(_a, forwardedRef)
|
|
|
237
228
|
function handleBlur(event) {
|
|
238
229
|
var _a;
|
|
239
230
|
(_a = params.onBlur) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
240
|
-
if (
|
|
241
|
-
if (!
|
|
242
|
-
|
|
231
|
+
if (ref.current) {
|
|
232
|
+
if (!ref.current.checkValidity()) {
|
|
233
|
+
ref.current.value = "";
|
|
243
234
|
}
|
|
244
235
|
}
|
|
245
236
|
}
|
|
246
237
|
function handleClear() {
|
|
247
238
|
var _a;
|
|
248
|
-
|
|
239
|
+
handleBlur();
|
|
249
240
|
onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
|
|
250
|
-
(_a =
|
|
241
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
251
242
|
}
|
|
252
243
|
function handleFocus(event) {
|
|
253
244
|
var _a;
|
|
254
245
|
(_a = params.onFocus) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
255
246
|
}
|
|
256
|
-
|
|
247
|
+
function getId(props) {
|
|
248
|
+
const generatedId = useId();
|
|
249
|
+
return props.id || generatedId;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
257
252
|
|
|
258
253
|
function InputTime$1(_a) {
|
|
259
254
|
var { defaultValue, value, onChange } = _a, params = __rest(_a, ["defaultValue", "value", "onChange"]);
|
|
@@ -285,13 +280,13 @@ function InputTime$1(_a) {
|
|
|
285
280
|
function isNewInputTimeProps(props) {
|
|
286
281
|
return props.version === 2;
|
|
287
282
|
}
|
|
288
|
-
|
|
283
|
+
function InputTime(props) {
|
|
289
284
|
if (isNewInputTimeProps(props)) {
|
|
290
|
-
return React__default.createElement(InputTimeRebuilt, Object.assign({}, props
|
|
285
|
+
return React__default.createElement(InputTimeRebuilt, Object.assign({}, props));
|
|
291
286
|
}
|
|
292
287
|
else {
|
|
293
288
|
return React__default.createElement(InputTime$1, Object.assign({}, props));
|
|
294
289
|
}
|
|
295
|
-
}
|
|
290
|
+
}
|
|
296
291
|
|
|
297
292
|
export { InputTime };
|