@jobber/components 6.103.2-JOB-140609-8386817.45 → 6.103.2-JOB-141426-ee803fd.19
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/components/MenuList.d.ts +2 -1
- package/dist/Autocomplete/components/PersistentRegion.d.ts +2 -1
- package/dist/Autocomplete/hooks/useAutocompleteListNav.d.ts +2 -1
- package/dist/Autocomplete/index.cjs +85 -35
- package/dist/Autocomplete/index.mjs +86 -36
- package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +13 -0
- package/dist/Autocomplete/useAutocomplete.d.ts +1 -0
- package/dist/Checkbox/Checkbox.types.d.ts +9 -2
- package/dist/Checkbox/index.cjs +2 -4
- package/dist/Checkbox/index.mjs +2 -4
- 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/DatePicker-es.js +1 -1
- package/dist/FormField/FormFieldTypes.d.ts +2 -0
- package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +2 -7
- package/dist/FormField-cjs.js +6 -1
- package/dist/FormField-es.js +6 -2
- package/dist/InputDate/index.cjs +9 -5
- package/dist/InputDate/index.mjs +9 -5
- package/dist/InputDate/useInputDateActivatorActions.d.ts +8 -4
- package/dist/InputEmail/InputEmail.types.d.ts +20 -12
- package/dist/InputEmail/hooks/useInputEmailActions.d.ts +1 -1
- package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +32 -0
- package/dist/InputEmail/index.cjs +44 -8
- package/dist/InputEmail/index.mjs +44 -8
- package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +3 -20
- package/dist/InputNumber/index.cjs +3 -3
- package/dist/InputNumber/index.mjs +3 -3
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +27 -13
- package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
- package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +71 -0
- package/dist/InputPhoneNumber/index.cjs +34 -17
- package/dist/InputPhoneNumber/index.mjs +34 -17
- package/dist/InputText/InputText.types.d.ts +24 -24
- package/dist/InputText/index.cjs +54 -54
- package/dist/InputText/index.mjs +55 -55
- 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 +33 -63
- package/dist/InputTime/index.d.ts +1 -1
- package/dist/InputTime/index.mjs +36 -66
- 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 -28
- package/dist/Select/index.d.ts +5 -7
- package/dist/Select/index.mjs +43 -30
- package/dist/Tabs-es.js +1 -1
- 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/debounce-es.js +1 -1
- package/dist/floating-ui.react-cjs.js +115 -0
- package/dist/floating-ui.react-es.js +115 -1
- 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/sharedHelpers/types.d.ts +0 -235
- package/dist/styles.css +3 -0
- package/dist/useScrollToActive-cjs.js +3 -3
- package/dist/useScrollToActive-es.js +2 -2
- package/package.json +2 -2
- package/dist/InputTime/hooks/useInputTimeActions.d.ts +0 -16
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,7 +204,23 @@ function timeStringToDate(timeString, baseDate) {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
function
|
|
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);
|
|
211
|
+
const { setTypedTime } = useTimePredict({
|
|
212
|
+
value,
|
|
213
|
+
handleChange,
|
|
214
|
+
});
|
|
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)
|
|
221
|
+
return;
|
|
222
|
+
!isNaN(parseInt(e.key, 10)) && setTypedTime(prev => prev + e.key);
|
|
223
|
+
}, value: dateToTimeString(value) })));
|
|
208
224
|
function handleChangeEvent(event) {
|
|
209
225
|
handleChange(event.target.value);
|
|
210
226
|
}
|
|
@@ -212,76 +228,30 @@ function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKey
|
|
|
212
228
|
onChange === null || onChange === void 0 ? void 0 : onChange(timeStringToDate(newValue, value));
|
|
213
229
|
}
|
|
214
230
|
function handleBlur(event) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
231
|
+
var _a;
|
|
232
|
+
(_a = params.onBlur) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
233
|
+
if (ref.current) {
|
|
234
|
+
if (!ref.current.checkValidity()) {
|
|
235
|
+
ref.current.value = "";
|
|
219
236
|
}
|
|
220
237
|
}
|
|
221
238
|
}
|
|
222
239
|
function handleClear() {
|
|
223
240
|
var _a;
|
|
224
|
-
|
|
241
|
+
handleBlur();
|
|
225
242
|
onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
|
|
226
|
-
(_a =
|
|
243
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
227
244
|
}
|
|
228
245
|
function handleFocus(event) {
|
|
229
|
-
|
|
246
|
+
var _a;
|
|
247
|
+
(_a = params.onFocus) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
230
248
|
}
|
|
231
|
-
function
|
|
232
|
-
|
|
249
|
+
function getId(props) {
|
|
250
|
+
const generatedId = React.useId();
|
|
251
|
+
return props.id || generatedId;
|
|
233
252
|
}
|
|
234
|
-
return {
|
|
235
|
-
handleChangeEvent,
|
|
236
|
-
handleChange,
|
|
237
|
-
handleBlur,
|
|
238
|
-
handleClear,
|
|
239
|
-
handleFocus,
|
|
240
|
-
handleKeyDown,
|
|
241
|
-
};
|
|
242
253
|
}
|
|
243
254
|
|
|
244
|
-
const InputTimeRebuilt = React.forwardRef(function InputTimeRebuilt(_a, forwardedRef) {
|
|
245
|
-
var _b;
|
|
246
|
-
var { value, onChange, readOnly, autoComplete,
|
|
247
|
-
// Deprecated props
|
|
248
|
-
inputRef: deprecatedInputRef } = _a, params = tslib_es6.__rest(_a, ["value", "onChange", "readOnly", "autoComplete", "inputRef"]);
|
|
249
|
-
const internalRef = React.useRef(null);
|
|
250
|
-
const mergedRef = FormField.mergeRefs([
|
|
251
|
-
internalRef,
|
|
252
|
-
deprecatedInputRef,
|
|
253
|
-
forwardedRef,
|
|
254
|
-
]);
|
|
255
|
-
const id = params.id || React.useId();
|
|
256
|
-
const wrapperRef = React.useRef(null);
|
|
257
|
-
const { inputStyle } = FormField.useFormFieldWrapperStyles(params);
|
|
258
|
-
const { handleChangeEvent, handleChange, handleBlur, handleClear, handleFocus, handleKeyDown, } = useInputTimeActions({
|
|
259
|
-
onChange,
|
|
260
|
-
value,
|
|
261
|
-
readOnly,
|
|
262
|
-
disabled: params.disabled,
|
|
263
|
-
inputRef: internalRef,
|
|
264
|
-
onFocus: params.onFocus,
|
|
265
|
-
onBlur: params.onBlur,
|
|
266
|
-
onKeyDown: params.onKeyDown,
|
|
267
|
-
});
|
|
268
|
-
const { setTypedTime } = useTimePredict({
|
|
269
|
-
value,
|
|
270
|
-
handleChange,
|
|
271
|
-
});
|
|
272
|
-
// Kept outside the useInputTimeActions hook to avoid circular dependency via setTypedTime and handleChange
|
|
273
|
-
function handleKeyUp(event) {
|
|
274
|
-
var _a;
|
|
275
|
-
(_a = params.onKeyUp) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
276
|
-
if (params.disabled || readOnly)
|
|
277
|
-
return;
|
|
278
|
-
!isNaN(parseInt(event.key, 10)) && setTypedTime(prev => prev + event.key);
|
|
279
|
-
}
|
|
280
|
-
const isInvalid = Boolean(params.error || params.invalid);
|
|
281
|
-
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, maxLength: params.maxLength, clearable: (_b = params.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: "time", readonly: readOnly, placeholder: params.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
|
|
282
|
-
React.createElement("input", { ref: mergedRef, type: "time", name: params.name, className: inputStyle, id: id, disabled: params.disabled, readOnly: readOnly, autoComplete: autoComplete, maxLength: params.maxLength, max: params.max, min: params.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, "data-testid": "ATL-InputTime-input", "aria-label": params.ariaLabel, "aria-describedby": params.ariaDescribedBy, "aria-invalid": isInvalid ? true : undefined, "aria-required": params.ariaRequired })));
|
|
283
|
-
});
|
|
284
|
-
|
|
285
255
|
function InputTime$1(_a) {
|
|
286
256
|
var { defaultValue, value, onChange } = _a, params = tslib_es6.__rest(_a, ["defaultValue", "value", "onChange"]);
|
|
287
257
|
const ref = React.useRef(null);
|
|
@@ -312,13 +282,13 @@ function InputTime$1(_a) {
|
|
|
312
282
|
function isNewInputTimeProps(props) {
|
|
313
283
|
return props.version === 2;
|
|
314
284
|
}
|
|
315
|
-
|
|
285
|
+
function InputTime(props) {
|
|
316
286
|
if (isNewInputTimeProps(props)) {
|
|
317
|
-
return React.createElement(InputTimeRebuilt, Object.assign({}, props
|
|
287
|
+
return React.createElement(InputTimeRebuilt, Object.assign({}, props));
|
|
318
288
|
}
|
|
319
289
|
else {
|
|
320
290
|
return React.createElement(InputTime$1, Object.assign({}, props));
|
|
321
291
|
}
|
|
322
|
-
}
|
|
292
|
+
}
|
|
323
293
|
|
|
324
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
|
-
import {
|
|
4
|
-
import { j as useFormFieldWrapperStyles, f as FormFieldWrapper,
|
|
3
|
+
import { d as debounce } from '../debounce-es.js';
|
|
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,7 +202,23 @@ function timeStringToDate(timeString, baseDate) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
function
|
|
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);
|
|
209
|
+
const { setTypedTime } = useTimePredict({
|
|
210
|
+
value,
|
|
211
|
+
handleChange,
|
|
212
|
+
});
|
|
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)
|
|
219
|
+
return;
|
|
220
|
+
!isNaN(parseInt(e.key, 10)) && setTypedTime(prev => prev + e.key);
|
|
221
|
+
}, value: dateToTimeString(value) })));
|
|
206
222
|
function handleChangeEvent(event) {
|
|
207
223
|
handleChange(event.target.value);
|
|
208
224
|
}
|
|
@@ -210,76 +226,30 @@ function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKey
|
|
|
210
226
|
onChange === null || onChange === void 0 ? void 0 : onChange(timeStringToDate(newValue, value));
|
|
211
227
|
}
|
|
212
228
|
function handleBlur(event) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
229
|
+
var _a;
|
|
230
|
+
(_a = params.onBlur) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
231
|
+
if (ref.current) {
|
|
232
|
+
if (!ref.current.checkValidity()) {
|
|
233
|
+
ref.current.value = "";
|
|
217
234
|
}
|
|
218
235
|
}
|
|
219
236
|
}
|
|
220
237
|
function handleClear() {
|
|
221
238
|
var _a;
|
|
222
|
-
|
|
239
|
+
handleBlur();
|
|
223
240
|
onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
|
|
224
|
-
(_a =
|
|
241
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
225
242
|
}
|
|
226
243
|
function handleFocus(event) {
|
|
227
|
-
|
|
244
|
+
var _a;
|
|
245
|
+
(_a = params.onFocus) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
228
246
|
}
|
|
229
|
-
function
|
|
230
|
-
|
|
247
|
+
function getId(props) {
|
|
248
|
+
const generatedId = useId();
|
|
249
|
+
return props.id || generatedId;
|
|
231
250
|
}
|
|
232
|
-
return {
|
|
233
|
-
handleChangeEvent,
|
|
234
|
-
handleChange,
|
|
235
|
-
handleBlur,
|
|
236
|
-
handleClear,
|
|
237
|
-
handleFocus,
|
|
238
|
-
handleKeyDown,
|
|
239
|
-
};
|
|
240
251
|
}
|
|
241
252
|
|
|
242
|
-
const InputTimeRebuilt = forwardRef(function InputTimeRebuilt(_a, forwardedRef) {
|
|
243
|
-
var _b;
|
|
244
|
-
var { value, onChange, readOnly, autoComplete,
|
|
245
|
-
// Deprecated props
|
|
246
|
-
inputRef: deprecatedInputRef } = _a, params = __rest(_a, ["value", "onChange", "readOnly", "autoComplete", "inputRef"]);
|
|
247
|
-
const internalRef = useRef(null);
|
|
248
|
-
const mergedRef = mergeRefs([
|
|
249
|
-
internalRef,
|
|
250
|
-
deprecatedInputRef,
|
|
251
|
-
forwardedRef,
|
|
252
|
-
]);
|
|
253
|
-
const id = params.id || useId();
|
|
254
|
-
const wrapperRef = React__default.useRef(null);
|
|
255
|
-
const { inputStyle } = useFormFieldWrapperStyles(params);
|
|
256
|
-
const { handleChangeEvent, handleChange, handleBlur, handleClear, handleFocus, handleKeyDown, } = useInputTimeActions({
|
|
257
|
-
onChange,
|
|
258
|
-
value,
|
|
259
|
-
readOnly,
|
|
260
|
-
disabled: params.disabled,
|
|
261
|
-
inputRef: internalRef,
|
|
262
|
-
onFocus: params.onFocus,
|
|
263
|
-
onBlur: params.onBlur,
|
|
264
|
-
onKeyDown: params.onKeyDown,
|
|
265
|
-
});
|
|
266
|
-
const { setTypedTime } = useTimePredict({
|
|
267
|
-
value,
|
|
268
|
-
handleChange,
|
|
269
|
-
});
|
|
270
|
-
// Kept outside the useInputTimeActions hook to avoid circular dependency via setTypedTime and handleChange
|
|
271
|
-
function handleKeyUp(event) {
|
|
272
|
-
var _a;
|
|
273
|
-
(_a = params.onKeyUp) === null || _a === void 0 ? void 0 : _a.call(params, event);
|
|
274
|
-
if (params.disabled || readOnly)
|
|
275
|
-
return;
|
|
276
|
-
!isNaN(parseInt(event.key, 10)) && setTypedTime(prev => prev + event.key);
|
|
277
|
-
}
|
|
278
|
-
const isInvalid = Boolean(params.error || params.invalid);
|
|
279
|
-
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, maxLength: params.maxLength, clearable: (_b = params.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: "time", readonly: readOnly, placeholder: params.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
|
|
280
|
-
React__default.createElement("input", { ref: mergedRef, type: "time", name: params.name, className: inputStyle, id: id, disabled: params.disabled, readOnly: readOnly, autoComplete: autoComplete, maxLength: params.maxLength, max: params.max, min: params.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, "data-testid": "ATL-InputTime-input", "aria-label": params.ariaLabel, "aria-describedby": params.ariaDescribedBy, "aria-invalid": isInvalid ? true : undefined, "aria-required": params.ariaRequired })));
|
|
281
|
-
});
|
|
282
|
-
|
|
283
253
|
function InputTime$1(_a) {
|
|
284
254
|
var { defaultValue, value, onChange } = _a, params = __rest(_a, ["defaultValue", "value", "onChange"]);
|
|
285
255
|
const ref = useRef(null);
|
|
@@ -310,13 +280,13 @@ function InputTime$1(_a) {
|
|
|
310
280
|
function isNewInputTimeProps(props) {
|
|
311
281
|
return props.version === 2;
|
|
312
282
|
}
|
|
313
|
-
|
|
283
|
+
function InputTime(props) {
|
|
314
284
|
if (isNewInputTimeProps(props)) {
|
|
315
|
-
return React__default.createElement(InputTimeRebuilt, Object.assign({}, props
|
|
285
|
+
return React__default.createElement(InputTimeRebuilt, Object.assign({}, props));
|
|
316
286
|
}
|
|
317
287
|
else {
|
|
318
288
|
return React__default.createElement(InputTime$1, Object.assign({}, props));
|
|
319
289
|
}
|
|
320
|
-
}
|
|
290
|
+
}
|
|
321
291
|
|
|
322
292
|
export { InputTime };
|
package/dist/List/index.cjs
CHANGED
|
@@ -8,9 +8,9 @@ require('../identity-cjs.js');
|
|
|
8
8
|
require('../isTypedArray-cjs.js');
|
|
9
9
|
require('../isObjectLike-cjs.js');
|
|
10
10
|
require('../_commonjsHelpers-cjs.js');
|
|
11
|
-
require('../
|
|
12
|
-
require('../isSymbol-cjs.js');
|
|
11
|
+
require('../_baseGet-cjs.js');
|
|
13
12
|
require('../_getTag-cjs.js');
|
|
13
|
+
require('../isSymbol-cjs.js');
|
|
14
14
|
require('../_baseFor-cjs.js');
|
|
15
15
|
require('../_baseAssignValue-cjs.js');
|
|
16
16
|
require('../Typography-cjs.js');
|
package/dist/List/index.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import '../identity-es.js';
|
|
|
6
6
|
import '../isTypedArray-es.js';
|
|
7
7
|
import '../isObjectLike-es.js';
|
|
8
8
|
import '../_commonjsHelpers-es.js';
|
|
9
|
-
import '../
|
|
10
|
-
import '../isSymbol-es.js';
|
|
9
|
+
import '../_baseGet-es.js';
|
|
11
10
|
import '../_getTag-es.js';
|
|
11
|
+
import '../isSymbol-es.js';
|
|
12
12
|
import '../_baseFor-es.js';
|
|
13
13
|
import '../_baseAssignValue-es.js';
|
|
14
14
|
import '../Typography-es.js';
|
|
@@ -9,12 +9,12 @@ require('classnames');
|
|
|
9
9
|
require('../Select/index.cjs');
|
|
10
10
|
require('../omit-cjs.js');
|
|
11
11
|
require('../_commonjsHelpers-cjs.js');
|
|
12
|
-
require('../
|
|
12
|
+
require('../_baseGet-cjs.js');
|
|
13
13
|
require('../isTypedArray-cjs.js');
|
|
14
14
|
require('../isObjectLike-cjs.js');
|
|
15
|
-
require('../isSymbol-cjs.js');
|
|
16
15
|
require('../identity-cjs.js');
|
|
17
16
|
require('../_getTag-cjs.js');
|
|
17
|
+
require('../isSymbol-cjs.js');
|
|
18
18
|
require('../keysIn-cjs.js');
|
|
19
19
|
require('../_baseAssignValue-cjs.js');
|
|
20
20
|
require('../_baseFlatten-cjs.js');
|
|
@@ -7,12 +7,12 @@ import 'classnames';
|
|
|
7
7
|
import '../Select/index.mjs';
|
|
8
8
|
import '../omit-es.js';
|
|
9
9
|
import '../_commonjsHelpers-es.js';
|
|
10
|
-
import '../
|
|
10
|
+
import '../_baseGet-es.js';
|
|
11
11
|
import '../isTypedArray-es.js';
|
|
12
12
|
import '../isObjectLike-es.js';
|
|
13
|
-
import '../isSymbol-es.js';
|
|
14
13
|
import '../identity-es.js';
|
|
15
14
|
import '../_getTag-es.js';
|
|
15
|
+
import '../isSymbol-es.js';
|
|
16
16
|
import '../keysIn-es.js';
|
|
17
17
|
import '../_baseAssignValue-es.js';
|
|
18
18
|
import '../_baseFlatten-es.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SelectRebuiltProps } from "./Select.types";
|
|
3
|
-
export declare
|
|
3
|
+
export declare function SelectRebuilt(props: SelectRebuiltProps): React.JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
2
|
-
import type { AriaInputProps, FocusEvents } from "../sharedHelpers/types";
|
|
3
2
|
export interface SelectLegacyProps extends Pick<CommonFormFieldProps, "id" | "align" | "description" | "disabled" | "invalid" | "inline" | "name" | "onValidation" | "placeholder" | "size" | "value" | "onChange">, Pick<FormFieldProps, "autofocus" | "onEnter" | "onBlur" | "onFocus" | "inputRef" | "wrapperRef" | "validations" | "children" | "prefix" | "suffix" | "defaultValue" | "version"> {
|
|
4
3
|
/**
|
|
5
4
|
* Changes the width to roughly the same size as the maximum character length
|
|
@@ -9,24 +8,12 @@ export interface SelectLegacyProps extends Pick<CommonFormFieldProps, "id" | "al
|
|
|
9
8
|
/**
|
|
10
9
|
* Rebuilt version of the Select component without React Hook Form dependency.
|
|
11
10
|
*/
|
|
12
|
-
export interface SelectRebuiltProps extends Omit<SelectLegacyProps, "defaultValue" | "version" | "onChange" | "value" | "validations" | "onValidation"
|
|
11
|
+
export interface SelectRebuiltProps extends Omit<SelectLegacyProps, "defaultValue" | "version" | "onChange" | "value" | "validations" | "onValidation"> {
|
|
13
12
|
defaultValue?: never;
|
|
14
13
|
readonly value?: string | number;
|
|
15
14
|
onChange?(newValue?: string | number): void;
|
|
16
15
|
version: 2;
|
|
17
16
|
error?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Automatically focus the select when mounted.
|
|
20
|
-
*/
|
|
21
|
-
readonly autoFocus?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Use `ref` instead. Note: `ref` support requires React 18+ forwardRef.
|
|
24
|
-
*/
|
|
25
|
-
readonly inputRef?: FormFieldProps["inputRef"];
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated Use `onKeyDown` or `onKeyUp` instead.
|
|
28
|
-
*/
|
|
29
|
-
readonly onEnter?: FormFieldProps["onEnter"];
|
|
30
17
|
/**
|
|
31
18
|
* Opt-in to the customizable select UI (Chromium 123+).
|
|
32
19
|
* When true, the component will apply the custom select styles
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { ChangeEvent
|
|
1
|
+
import type { ChangeEvent } from "react";
|
|
2
2
|
interface UseSelectActionsProps {
|
|
3
3
|
readonly onChange?: (newValue: string | number, event?: ChangeEvent<HTMLSelectElement>) => void;
|
|
4
|
-
readonly onBlur?: (
|
|
5
|
-
readonly onFocus?: (
|
|
4
|
+
readonly onBlur?: () => void;
|
|
5
|
+
readonly onFocus?: () => void;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Hook with actions on the Select component.
|
|
9
9
|
*/
|
|
10
10
|
export declare function useSelectActions({ onChange, onBlur, onFocus, }: UseSelectActionsProps): {
|
|
11
11
|
handleChange: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
12
|
-
handleBlur: (
|
|
13
|
-
handleFocus: (
|
|
12
|
+
handleBlur: () => void;
|
|
13
|
+
handleFocus: () => void;
|
|
14
14
|
};
|
|
15
15
|
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ChangeEvent, ReactNode } from "react";
|
|
2
|
+
export interface UseSelectFormFieldProps {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly disabled?: boolean;
|
|
6
|
+
readonly autofocus?: boolean;
|
|
7
|
+
readonly description?: ReactNode;
|
|
8
|
+
readonly inline?: boolean;
|
|
9
|
+
readonly error?: string;
|
|
10
|
+
readonly invalid?: boolean;
|
|
11
|
+
readonly value?: string | number;
|
|
12
|
+
readonly handleChange: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
13
|
+
readonly handleBlur: () => void;
|
|
14
|
+
readonly handleFocus: () => void;
|
|
15
|
+
}
|
|
16
|
+
export interface UseSelectFormFieldReturn {
|
|
17
|
+
readonly fieldProps: {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly disabled?: boolean;
|
|
21
|
+
readonly autoFocus?: boolean;
|
|
22
|
+
readonly onChange: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
23
|
+
readonly onBlur: () => void;
|
|
24
|
+
readonly onFocus: () => void;
|
|
25
|
+
readonly value?: string | number;
|
|
26
|
+
readonly "aria-describedby"?: string;
|
|
27
|
+
};
|
|
28
|
+
readonly descriptionIdentifier: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Hook for managing the props of a Select component.
|
|
32
|
+
* Extracted from FormField's useAtlantisFormField.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useSelectFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, }: UseSelectFormFieldProps): UseSelectFormFieldReturn;
|
package/dist/Select/index.cjs
CHANGED
|
@@ -11,12 +11,12 @@ require('framer-motion');
|
|
|
11
11
|
require('@jobber/design');
|
|
12
12
|
require('../Button-cjs.js');
|
|
13
13
|
require('../_commonjsHelpers-cjs.js');
|
|
14
|
-
require('../
|
|
14
|
+
require('../_baseGet-cjs.js');
|
|
15
15
|
require('../isTypedArray-cjs.js');
|
|
16
16
|
require('../isObjectLike-cjs.js');
|
|
17
|
-
require('../isSymbol-cjs.js');
|
|
18
17
|
require('../identity-cjs.js');
|
|
19
18
|
require('../_getTag-cjs.js');
|
|
19
|
+
require('../isSymbol-cjs.js');
|
|
20
20
|
require('../keysIn-cjs.js');
|
|
21
21
|
require('../_baseAssignValue-cjs.js');
|
|
22
22
|
require('../_baseFlatten-cjs.js');
|
|
@@ -42,11 +42,11 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
|
|
|
42
42
|
const newValue = event.currentTarget.value;
|
|
43
43
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
|
|
44
44
|
}
|
|
45
|
-
function handleBlur(
|
|
46
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(
|
|
45
|
+
function handleBlur() {
|
|
46
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
47
47
|
}
|
|
48
|
-
function handleFocus(
|
|
49
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(
|
|
48
|
+
function handleFocus() {
|
|
49
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
50
50
|
}
|
|
51
51
|
return {
|
|
52
52
|
handleChange,
|
|
@@ -55,22 +55,27 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Hook for managing the props of a Select component.
|
|
60
|
+
* Extracted from FormField's useAtlantisFormField.
|
|
61
|
+
*/
|
|
62
|
+
function useSelectFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, }) {
|
|
63
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
64
|
+
const fieldProps = Object.assign({ id,
|
|
65
|
+
name,
|
|
66
|
+
disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value }, (description &&
|
|
67
|
+
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
68
|
+
return { fieldProps, descriptionIdentifier };
|
|
69
|
+
}
|
|
70
|
+
|
|
58
71
|
var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
var _a;
|
|
62
|
-
|
|
63
|
-
const { inputRef: deprecatedInputRef } = props;
|
|
64
|
-
const internalRef = React.useRef(null);
|
|
65
|
-
const mergedRef = FormField.mergeRefs([
|
|
66
|
-
internalRef,
|
|
67
|
-
deprecatedInputRef,
|
|
68
|
-
forwardedRef,
|
|
69
|
-
]);
|
|
73
|
+
function SelectRebuilt(props) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : React.useRef(null);
|
|
70
76
|
const wrapperRef = React.useRef(null);
|
|
71
77
|
const { inputStyle } = FormField.useFormFieldWrapperStyles(Object.assign({}, omit.omit(props, ["version"])));
|
|
72
78
|
const id = useSelectId(props);
|
|
73
|
-
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
74
79
|
const { name } = FormField.useAtlantisFormFieldName({
|
|
75
80
|
nameProp: props.name,
|
|
76
81
|
id: id,
|
|
@@ -80,15 +85,24 @@ const SelectRebuilt = React.forwardRef(function SelectRebuilt(props, forwardedRe
|
|
|
80
85
|
onBlur: props.onBlur,
|
|
81
86
|
onFocus: props.onFocus,
|
|
82
87
|
});
|
|
83
|
-
const
|
|
84
|
-
|
|
88
|
+
const inputProps = omit.omit(props, [
|
|
89
|
+
"onChange",
|
|
90
|
+
"onBlur",
|
|
91
|
+
"onFocus",
|
|
92
|
+
"size",
|
|
93
|
+
"placeholder",
|
|
94
|
+
"version",
|
|
95
|
+
]);
|
|
96
|
+
const { fieldProps, descriptionIdentifier } = useSelectFormField(Object.assign(Object.assign({}, inputProps), { id,
|
|
97
|
+
name,
|
|
98
|
+
handleChange,
|
|
99
|
+
handleBlur,
|
|
100
|
+
handleFocus }));
|
|
101
|
+
return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: (_b = props.error) !== null && _b !== void 0 ? _b : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never", maxLength: props.maxLength },
|
|
85
102
|
React.createElement(React.Fragment, null,
|
|
86
|
-
React.createElement("select", {
|
|
87
|
-
(props.description && !props.inline
|
|
88
|
-
? descriptionIdentifier
|
|
89
|
-
: undefined), "aria-invalid": isInvalid ? true : undefined, "aria-required": props.ariaRequired, ref: mergedRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }, props.children),
|
|
103
|
+
React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }), props.children),
|
|
90
104
|
React.createElement(FormField.FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
|
|
91
|
-
}
|
|
105
|
+
}
|
|
92
106
|
function useSelectId(props) {
|
|
93
107
|
const generatedId = React.useId();
|
|
94
108
|
return props.id || generatedId;
|
|
@@ -105,15 +119,14 @@ function OptionGroup({ children, label, disabled, UNSAFE_className, UNSAFE_style
|
|
|
105
119
|
function isNewSelectProps(props) {
|
|
106
120
|
return props.version === 2;
|
|
107
121
|
}
|
|
108
|
-
|
|
122
|
+
function Select(props) {
|
|
109
123
|
if (isNewSelectProps(props)) {
|
|
110
|
-
return React.createElement(SelectRebuilt, Object.assign({}, props
|
|
124
|
+
return React.createElement(SelectRebuilt, Object.assign({}, props));
|
|
111
125
|
}
|
|
112
126
|
else {
|
|
113
127
|
return React.createElement(Select$1, Object.assign({}, props));
|
|
114
128
|
}
|
|
115
|
-
}
|
|
116
|
-
const Select = SelectBase;
|
|
129
|
+
}
|
|
117
130
|
Select.Option = SelectOption;
|
|
118
131
|
Select.OptionGroup = OptionGroup;
|
|
119
132
|
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Option } from "./Option";
|
|
3
|
-
import { OptionGroup } from "./OptionGroup";
|
|
4
2
|
import { type SelectLegacyProps, type SelectRebuiltProps } from "./Select.types";
|
|
5
3
|
export { Option } from "./Option";
|
|
6
4
|
export type SelectShimProps = SelectLegacyProps | SelectRebuiltProps;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
export declare function Select(props: SelectShimProps): React.JSX.Element;
|
|
6
|
+
export declare namespace Select {
|
|
7
|
+
var Option: typeof import("./Option").Option;
|
|
8
|
+
var OptionGroup: typeof import("./OptionGroup").OptionGroup;
|
|
9
|
+
}
|
|
12
10
|
export type { SelectRebuiltProps, SelectLegacyProps };
|