@jobber/components 6.101.5-JOB-140604-4c8f8f2.41 → 6.101.5-JOB-140604-4487daa.55
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 +11 -51
- package/dist/Autocomplete/components/MenuList.d.ts +3 -2
- package/dist/Autocomplete/components/PersistentRegion.d.ts +3 -2
- package/dist/Autocomplete/hooks/useAutocompleteListNav.d.ts +3 -2
- package/dist/Autocomplete/index.cjs +95 -51
- package/dist/Autocomplete/index.mjs +97 -53
- package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +14 -1
- package/dist/Autocomplete/useAutocomplete.d.ts +4 -3
- package/dist/Autocomplete/utils/interactionUtils.d.ts +14 -0
- package/dist/Card-cjs.js +1 -1
- package/dist/Card-es.js +1 -1
- package/dist/Checkbox/Checkbox.rebuilt.d.ts +2 -2
- package/dist/Checkbox/Checkbox.types.d.ts +24 -18
- package/dist/Checkbox/index.cjs +9 -2
- package/dist/Checkbox/index.mjs +9 -2
- package/dist/Chip/Chip.d.ts +1 -2
- package/dist/Chip/hooks/useChildComponent.d.ts +4 -3
- package/dist/Chip/index.cjs +1 -1
- package/dist/Chip-cjs.js +5 -4
- package/dist/Chip-es.js +5 -4
- package/dist/ChipDismissible-cjs.js +4 -4
- package/dist/ChipDismissible-es.js +5 -5
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
- package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +1 -1
- 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/Combobox/Combobox.d.ts +2 -1
- package/dist/Combobox/Combobox.types.d.ts +2 -2
- package/dist/Combobox/ComboboxProvider.d.ts +3 -3
- package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +2 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts +2 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContentList.d.ts +2 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts +2 -1
- package/dist/Combobox/hooks/useCombobox.d.ts +1 -1
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +2 -2
- package/dist/Combobox/hooks/useComboboxContent.d.ts +2 -1
- package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +1 -1
- package/dist/ComboboxActivator-cjs.js +2 -2
- package/dist/ComboboxActivator-es.js +3 -3
- package/dist/ComboboxTrigger-cjs.js +1 -1
- package/dist/ComboboxTrigger-es.js +2 -2
- package/dist/DataList/DataList.types.d.ts +2 -2
- package/dist/DataList/DataList.utils.d.ts +2 -2
- package/dist/DataList/components/DataListHeader/index.cjs +1 -0
- package/dist/DataList/components/DataListHeader/index.mjs +1 -0
- package/dist/DataList/components/DataListHeaderTile/components/DataListSortingOptions.d.ts +2 -2
- package/dist/DataList/components/DataListItem/DataListItemInternal.d.ts +2 -2
- package/dist/DataList/components/DataListItem/index.cjs +1 -0
- package/dist/DataList/components/DataListItem/index.mjs +1 -0
- package/dist/DataList/components/DataListItems/index.cjs +1 -0
- package/dist/DataList/components/DataListItems/index.mjs +1 -0
- package/dist/DataList/components/DataListLayout/index.cjs +1 -0
- package/dist/DataList/components/DataListLayout/index.mjs +1 -0
- package/dist/DataList/components/DataListSearch/index.cjs +2 -12
- package/dist/DataList/components/DataListSearch/index.mjs +2 -12
- package/dist/DataList/hooks/useGetItemActions.d.ts +1 -1
- package/dist/DataList/index.cjs +1 -8
- package/dist/DataList/index.mjs +1 -8
- package/dist/DataListActions-cjs.js +4 -2
- package/dist/DataListActions-es.js +4 -2
- package/dist/DataListItem-cjs.js +8 -7
- package/dist/DataListItem-es.js +9 -8
- package/dist/DataListSort-cjs.js +1 -1
- package/dist/DataListSort-es.js +2 -2
- package/dist/DataTable/SortIcon.d.ts +2 -1
- package/dist/DataTable/components/DataTableSortableHeader.d.ts +1 -1
- package/dist/DataTable/index.cjs +3 -2
- package/dist/DataTable/index.mjs +3 -2
- package/dist/DatePicker/DatePicker.d.ts +5 -1
- package/dist/DatePicker/index.cjs +2 -2
- package/dist/DatePicker/index.mjs +2 -2
- package/dist/DatePicker/useFocusOnSelectedDate.d.ts +1 -2
- package/dist/DatePicker-cjs.js +4 -2
- package/dist/DatePicker-es.js +5 -3
- package/dist/FormField/FormFieldAffix.d.ts +2 -2
- package/dist/FormField/FormFieldTypes.d.ts +3 -5
- package/dist/FormField/FormFieldWrapper.d.ts +5 -1
- package/dist/FormField/hooks/useFormFieldFocus.d.ts +1 -1
- package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +9 -4
- package/dist/FormField-cjs.js +35 -31
- package/dist/FormField-es.js +35 -31
- package/dist/InputDate/InputDate.types.d.ts +12 -7
- package/dist/InputDate/index.cjs +35 -12
- package/dist/InputDate/index.mjs +35 -12
- package/dist/InputDate/useInputDateActivatorActions.d.ts +4 -8
- package/dist/InputEmail/InputEmail.types.d.ts +10 -20
- package/dist/InputEmail/hooks/useInputEmailActions.d.ts +10 -4
- package/dist/InputEmail/index.cjs +43 -60
- package/dist/InputEmail/index.mjs +44 -61
- package/dist/InputFile-cjs.js +5 -2
- package/dist/InputFile-es.js +5 -2
- package/dist/InputGroup-cjs.js +5 -2
- package/dist/InputGroup-es.js +5 -2
- package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +7 -15
- package/dist/InputNumber/index.cjs +7 -5
- package/dist/InputNumber/index.mjs +7 -5
- package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +12 -28
- package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +9 -4
- package/dist/InputPhoneNumber/index.cjs +37 -36
- package/dist/InputPhoneNumber/index.mjs +38 -37
- package/dist/InputText/InputText.d.ts +2 -2
- package/dist/InputText/InputText.types.d.ts +30 -25
- package/dist/InputText/index.cjs +54 -62
- package/dist/InputText/index.mjs +55 -63
- package/dist/InputText/useInputTextActions.d.ts +11 -5
- package/dist/InputText/useTextAreaResize.d.ts +2 -2
- package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
- package/dist/InputTime/InputTime.types.d.ts +13 -4
- package/dist/InputTime/hooks/useInputTimeActions.d.ts +21 -0
- package/dist/InputTime/index.cjs +90 -30
- package/dist/InputTime/index.mjs +93 -33
- package/dist/InternalChipDismissible-cjs.js +3 -3
- package/dist/InternalChipDismissible-es.js +4 -4
- package/dist/List/index.cjs +2 -2
- package/dist/List/index.mjs +2 -2
- package/dist/Menu/Menu.d.ts +2 -4
- package/dist/Menu/Menu.types.d.ts +21 -5
- package/dist/Menu-cjs.js +9 -9
- package/dist/Menu-es.js +9 -9
- package/dist/Modal/Modal.types.d.ts +3 -3
- package/dist/Modal/ModalContext.rebuilt.d.ts +2 -2
- package/dist/MultiSelect/DropDownMenu.d.ts +1 -1
- package/dist/MultiSelect/index.cjs +1 -0
- package/dist/MultiSelect/index.mjs +1 -0
- package/dist/MultiSelect-cjs.js +13 -7
- package/dist/MultiSelect-es.js +13 -7
- package/dist/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/RadioGroup/RadioOption.d.ts +1 -1
- package/dist/RecurringSelect/index.cjs +3 -2
- package/dist/RecurringSelect/index.mjs +3 -2
- package/dist/Select/Select.types.d.ts +7 -3
- package/dist/Select/hooks/useSelectActions.d.ts +5 -5
- package/dist/Select/index.cjs +27 -42
- package/dist/Select/index.mjs +29 -44
- package/dist/StatusLabel/StatusLabel.d.ts +2 -1
- package/dist/Tabs/hooks/useTabsOverflow.d.ts +2 -2
- package/dist/Tabs-cjs.js +4 -2
- package/dist/Tabs-es.js +5 -3
- package/dist/Tooltip/useTooltipPositioning.d.ts +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/{_baseGet-cjs.js → _getAllKeys-cjs.js} +181 -181
- package/dist/{_baseGet-es.js → _getAllKeys-es.js} +182 -182
- package/dist/debounce-es.js +1 -1
- package/dist/filterDataAttributes-cjs.js +26 -0
- package/dist/filterDataAttributes-es.js +24 -0
- package/dist/floating-ui.react-cjs.js +115 -0
- package/dist/floating-ui.react-es.js +115 -1
- package/dist/helpers-cjs.js +1 -1
- package/dist/helpers-es.js +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.mjs +3 -2
- package/dist/omit-cjs.js +14 -14
- package/dist/omit-es.js +1 -1
- package/dist/sharedHelpers/filterDataAttributes.d.ts +17 -0
- package/dist/sharedHelpers/types.d.ts +231 -0
- package/dist/showToast-cjs.js +2 -2
- package/dist/showToast-es.js +2 -2
- package/dist/styles.css +32 -23
- package/dist/useChildComponent-cjs.js +1 -1
- package/dist/useChildComponent-es.js +1 -1
- package/dist/useScrollToActive-cjs.js +3 -3
- package/dist/useScrollToActive-es.js +2 -2
- package/dist/utils/mergeRefs.d.ts +2 -2
- package/package.json +3 -3
- package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +0 -32
- package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +0 -71
- package/dist/InputText/useInputTextFormField.d.ts +0 -352
- package/dist/Select/hooks/useSelectFormField.d.ts +0 -34
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import type { ChangeEvent
|
|
1
|
+
import type { ChangeEvent } from "react";
|
|
2
2
|
import type { InputDateRebuiltProps } from "./InputDate.types";
|
|
3
3
|
import type { DatePickerActivatorProps } from "../DatePicker/DatePickerActivator";
|
|
4
4
|
export interface useInputDateActivatorActionsProps extends Pick<InputDateRebuiltProps, "onFocus" | "onBlur"> {
|
|
5
5
|
onChange: DatePickerActivatorProps["onChange"];
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Combines the actions on the InputDate such as onChange, onFocus, onBlur to forward event handler passed to the InputDate component to the DatePicker component.
|
|
9
|
-
* 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.
|
|
10
|
-
*/
|
|
11
7
|
export declare function useInputDateActivatorActions({ onChange, onBlur, onFocus, }: useInputDateActivatorActionsProps): {
|
|
12
|
-
handleBlur: (event: FocusEvent<HTMLInputElement>) => void;
|
|
13
|
-
handleChange: (
|
|
14
|
-
handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
8
|
+
handleBlur: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
9
|
+
handleChange: (_newValue: string, event?: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
10
|
+
handleFocus: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
15
11
|
isFocused: boolean;
|
|
16
12
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Clearable } from "@jobber/hooks";
|
|
2
1
|
import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
2
|
+
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
3
3
|
export type InputEmailLegacyProps = CommonFormFieldProps & Pick<FormFieldProps, "maxLength" | "readonly" | "validations" | "defaultValue">;
|
|
4
4
|
export declare const validationMessage = "Please enter a valid email";
|
|
5
5
|
export type InputEmailVersion = 1 | 2 | undefined;
|
|
@@ -7,27 +7,17 @@ export type InputEmailVersion = 1 | 2 | undefined;
|
|
|
7
7
|
* Experimental version 2 of the InputEmail component.
|
|
8
8
|
* Do not use unless you have talked with Atlantis first.
|
|
9
9
|
*/
|
|
10
|
-
export interface InputEmailRebuiltProps extends
|
|
11
|
-
readonly error?: string;
|
|
12
|
-
readonly invalid?: boolean;
|
|
13
|
-
readonly identifier?: string;
|
|
14
|
-
readonly autocomplete?: boolean | string;
|
|
15
|
-
readonly loading?: boolean;
|
|
16
|
-
readonly onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
17
|
-
readonly children?: React.ReactNode;
|
|
18
|
-
readonly clearable?: Clearable;
|
|
10
|
+
export interface InputEmailRebuiltProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, RebuiltInputCommonProps {
|
|
19
11
|
/**
|
|
20
|
-
*
|
|
12
|
+
* The current value of the input.
|
|
13
|
+
*/
|
|
14
|
+
readonly value?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom onChange handler that provides the new value as the first argument.
|
|
21
17
|
*/
|
|
22
|
-
readonly version: 2;
|
|
23
18
|
readonly onChange?: (newValue: string, event?: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `onKeyDown` or `onKeyUp` instead.
|
|
21
|
+
*/
|
|
24
22
|
readonly onEnter?: FormFieldProps["onEnter"];
|
|
25
|
-
readonly onBlur?: FormFieldProps["onBlur"];
|
|
26
|
-
readonly value?: string;
|
|
27
|
-
readonly size?: FormFieldProps["size"];
|
|
28
|
-
readonly inline?: FormFieldProps["inline"];
|
|
29
|
-
readonly align?: FormFieldProps["align"];
|
|
30
|
-
readonly prefix?: FormFieldProps["prefix"];
|
|
31
|
-
readonly suffix?: FormFieldProps["suffix"];
|
|
32
|
-
readonly description?: FormFieldProps["description"];
|
|
33
23
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import type { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
|
|
1
|
+
import type { ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent, PointerEvent } from "react";
|
|
2
2
|
import type { InputEmailRebuiltProps } from "../InputEmail.types";
|
|
3
|
-
export interface UseInputEmailActionsProps extends Pick<InputEmailRebuiltProps, "onChange" | "onEnter" | "onFocus" | "onBlur" | "onKeyDown"> {
|
|
3
|
+
export interface UseInputEmailActionsProps extends Pick<InputEmailRebuiltProps, "onChange" | "onEnter" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "onClick" | "onMouseDown" | "onMouseUp" | "onPointerDown" | "onPointerUp"> {
|
|
4
4
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
5
5
|
}
|
|
6
|
-
export declare function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }: UseInputEmailActionsProps): {
|
|
6
|
+
export declare function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, onKeyUp, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, }: UseInputEmailActionsProps): {
|
|
7
7
|
handleClear: () => void;
|
|
8
8
|
handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
9
9
|
handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
10
|
+
handleKeyUp: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
10
11
|
handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
|
|
11
|
-
handleBlur: (event
|
|
12
|
+
handleBlur: (event: FocusEvent<HTMLInputElement>) => void;
|
|
13
|
+
handleClick: (event: MouseEvent<HTMLInputElement>) => void;
|
|
14
|
+
handleMouseDown: (event: MouseEvent<HTMLInputElement>) => void;
|
|
15
|
+
handleMouseUp: (event: MouseEvent<HTMLInputElement>) => void;
|
|
16
|
+
handlePointerDown: (event: PointerEvent<HTMLInputElement>) => void;
|
|
17
|
+
handlePointerUp: (event: PointerEvent<HTMLInputElement>) => void;
|
|
12
18
|
};
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var FormField = require('../FormField-cjs.js');
|
|
5
5
|
require('classnames');
|
|
6
|
-
|
|
6
|
+
require('../tslib.es6-cjs.js');
|
|
7
7
|
require('react-hook-form');
|
|
8
8
|
require('@jobber/hooks');
|
|
9
9
|
require('framer-motion');
|
|
10
10
|
require('@jobber/design');
|
|
11
11
|
require('../Button-cjs.js');
|
|
12
|
-
var
|
|
12
|
+
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
13
13
|
require('../Icon-cjs.js');
|
|
14
14
|
require('../Text-cjs.js');
|
|
15
15
|
require('../Typography-cjs.js');
|
|
@@ -17,17 +17,6 @@ require('../useFormFieldFocus-cjs.js');
|
|
|
17
17
|
require('../InputValidation-cjs.js');
|
|
18
18
|
require('../Spinner-cjs.js');
|
|
19
19
|
require('react-router-dom');
|
|
20
|
-
require('../_commonjsHelpers-cjs.js');
|
|
21
|
-
require('../_baseGet-cjs.js');
|
|
22
|
-
require('../isTypedArray-cjs.js');
|
|
23
|
-
require('../isObjectLike-cjs.js');
|
|
24
|
-
require('../identity-cjs.js');
|
|
25
|
-
require('../_getTag-cjs.js');
|
|
26
|
-
require('../isSymbol-cjs.js');
|
|
27
|
-
require('../keysIn-cjs.js');
|
|
28
|
-
require('../_baseAssignValue-cjs.js');
|
|
29
|
-
require('../_baseFlatten-cjs.js');
|
|
30
|
-
require('../_setToString-cjs.js');
|
|
31
20
|
|
|
32
21
|
const validationMessage = "Please enter a valid email";
|
|
33
22
|
|
|
@@ -46,10 +35,9 @@ function InputEmail$1(props) {
|
|
|
46
35
|
}
|
|
47
36
|
}
|
|
48
37
|
|
|
49
|
-
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
|
|
38
|
+
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, onKeyUp, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, }) {
|
|
50
39
|
function handleClear() {
|
|
51
40
|
var _a;
|
|
52
|
-
handleBlur();
|
|
53
41
|
onChange === null || onChange === void 0 ? void 0 : onChange("");
|
|
54
42
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
55
43
|
}
|
|
@@ -74,75 +62,70 @@ function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, on
|
|
|
74
62
|
function handleBlur(event) {
|
|
75
63
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
76
64
|
}
|
|
65
|
+
function handleKeyUp(event) {
|
|
66
|
+
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(event);
|
|
67
|
+
}
|
|
68
|
+
function handleClick(event) {
|
|
69
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
70
|
+
}
|
|
71
|
+
function handleMouseDown(event) {
|
|
72
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
73
|
+
}
|
|
74
|
+
function handleMouseUp(event) {
|
|
75
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(event);
|
|
76
|
+
}
|
|
77
|
+
function handlePointerDown(event) {
|
|
78
|
+
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);
|
|
79
|
+
}
|
|
80
|
+
function handlePointerUp(event) {
|
|
81
|
+
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp(event);
|
|
82
|
+
}
|
|
77
83
|
return {
|
|
78
84
|
handleClear,
|
|
79
85
|
handleChange,
|
|
80
86
|
handleKeyDown,
|
|
87
|
+
handleKeyUp,
|
|
81
88
|
handleFocus,
|
|
82
89
|
handleBlur,
|
|
90
|
+
handleClick,
|
|
91
|
+
handleMouseDown,
|
|
92
|
+
handleMouseUp,
|
|
93
|
+
handlePointerDown,
|
|
94
|
+
handlePointerUp,
|
|
83
95
|
};
|
|
84
96
|
}
|
|
85
97
|
|
|
86
|
-
function useInputEmailFormField(_a) {
|
|
87
|
-
var { id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, handleKeyDown, error } = _a, rest = tslib_es6.__rest(_a, ["id", "name", "disabled", "autofocus", "description", "inline", "value", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error"]);
|
|
88
|
-
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
89
|
-
const fieldProps = Object.assign(Object.assign(Object.assign({}, rest), { id,
|
|
90
|
-
name,
|
|
91
|
-
disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
|
|
92
|
-
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
93
|
-
return { fieldProps, descriptionIdentifier };
|
|
94
|
-
}
|
|
95
|
-
|
|
96
98
|
const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, ref) {
|
|
97
99
|
var _a, _b, _c;
|
|
98
|
-
const
|
|
100
|
+
const generatedId = React.useId();
|
|
101
|
+
const id = props.id || generatedId;
|
|
99
102
|
const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : React.useRef(null);
|
|
100
103
|
const wrapperRef = React.useRef(null);
|
|
101
|
-
const { inputStyle } = FormField.useFormFieldWrapperStyles({
|
|
102
|
-
size: props.size,
|
|
103
|
-
inline: props.inline,
|
|
104
|
-
align: props.align,
|
|
105
|
-
type: "email",
|
|
106
|
-
value: props.value,
|
|
107
|
-
invalid: props.invalid,
|
|
108
|
-
error: props.error,
|
|
109
|
-
maxLength: props.maxLength,
|
|
110
|
-
disabled: props.disabled,
|
|
111
|
-
placeholder: props.placeholder,
|
|
112
|
-
});
|
|
113
104
|
const { name } = FormField.useAtlantisFormFieldName({
|
|
114
105
|
nameProp: props.name,
|
|
115
106
|
id,
|
|
116
107
|
});
|
|
117
|
-
const { handleChange, handleBlur, handleFocus, handleKeyDown, handleClear } = useInputEmailActions({
|
|
108
|
+
const { handleChange, handleBlur, handleFocus, handleKeyDown, handleKeyUp, handleClear, handleClick, handleMouseDown, handleMouseUp, handlePointerDown, handlePointerUp, } = useInputEmailActions({
|
|
118
109
|
onChange: props.onChange,
|
|
119
110
|
onBlur: props.onBlur,
|
|
120
111
|
onFocus: props.onFocus,
|
|
121
112
|
onKeyDown: props.onKeyDown,
|
|
113
|
+
onKeyUp: props.onKeyUp,
|
|
122
114
|
onEnter: props.onEnter,
|
|
115
|
+
onClick: props.onClick,
|
|
116
|
+
onMouseDown: props.onMouseDown,
|
|
117
|
+
onMouseUp: props.onMouseUp,
|
|
118
|
+
onPointerDown: props.onPointerDown,
|
|
119
|
+
onPointerUp: props.onPointerUp,
|
|
123
120
|
inputRef,
|
|
124
121
|
});
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"prefix",
|
|
133
|
-
"suffix",
|
|
134
|
-
"version",
|
|
135
|
-
]);
|
|
136
|
-
const { fieldProps, descriptionIdentifier } = useInputEmailFormField(Object.assign(Object.assign({}, inputProps), { id,
|
|
137
|
-
name,
|
|
138
|
-
handleChange,
|
|
139
|
-
handleBlur,
|
|
140
|
-
handleFocus,
|
|
141
|
-
handleKeyDown }));
|
|
142
|
-
return (React.createElement(FormField.FormFieldWrapper, { error: props.error || "", invalid: props.invalid, identifier: props.identifier || id, descriptionIdentifier: descriptionIdentifier, size: props.size, inline: props.inline, align: props.align, prefix: props.prefix, suffix: props.suffix, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, wrapperRef: wrapperRef, maxLength: props.maxLength, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, autofocus: props.autoFocus, name: name },
|
|
143
|
-
React.createElement("input", Object.assign({}, fieldProps, { ref: inputRef, type: "email", className: inputStyle, value: props.value, "data-testid": "ATL-InputEmail-input" })),
|
|
144
|
-
React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
|
|
145
|
-
props.children));
|
|
122
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
123
|
+
const descriptionVisible = props.description && !props.inline;
|
|
124
|
+
const isInvalid = Boolean(props.error || props.invalid);
|
|
125
|
+
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
126
|
+
return (React.createElement(FormField.FormFieldWrapper, { error: props.error || "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, size: props.size, inline: props.inline, align: props.align, prefix: props.prefix, suffix: props.suffix, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, readonly: props.readOnly, wrapperRef: wrapperRef, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, name: name },
|
|
127
|
+
React.createElement("input", Object.assign({ id: id, name: name, type: "email", ref: inputRef, className: FormField.formFieldStyles.input, value: props.value, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, pattern: props.pattern, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-controls": props["aria-controls"], "aria-expanded": props["aria-expanded"], "aria-activedescendant": props["aria-activedescendant"], "aria-autocomplete": props["aria-autocomplete"], "aria-required": props["aria-required"], onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, "data-testid": "ATL-InputEmail-input" }, dataAttrs)),
|
|
128
|
+
React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false })));
|
|
146
129
|
});
|
|
147
130
|
|
|
148
131
|
function isNewInputEmailProps(props) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React__default, { forwardRef, useId, useRef } from 'react';
|
|
2
|
-
import { k as FormField,
|
|
2
|
+
import { k as FormField, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as formFieldStyles, m as FormFieldPostFix } from '../FormField-es.js';
|
|
3
3
|
import 'classnames';
|
|
4
|
-
import
|
|
4
|
+
import '../tslib.es6-es.js';
|
|
5
5
|
import 'react-hook-form';
|
|
6
6
|
import '@jobber/hooks';
|
|
7
7
|
import 'framer-motion';
|
|
8
8
|
import '@jobber/design';
|
|
9
9
|
import '../Button-es.js';
|
|
10
|
-
import {
|
|
10
|
+
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
11
11
|
import '../Icon-es.js';
|
|
12
12
|
import '../Text-es.js';
|
|
13
13
|
import '../Typography-es.js';
|
|
@@ -15,17 +15,6 @@ import '../useFormFieldFocus-es.js';
|
|
|
15
15
|
import '../InputValidation-es.js';
|
|
16
16
|
import '../Spinner-es.js';
|
|
17
17
|
import 'react-router-dom';
|
|
18
|
-
import '../_commonjsHelpers-es.js';
|
|
19
|
-
import '../_baseGet-es.js';
|
|
20
|
-
import '../isTypedArray-es.js';
|
|
21
|
-
import '../isObjectLike-es.js';
|
|
22
|
-
import '../identity-es.js';
|
|
23
|
-
import '../_getTag-es.js';
|
|
24
|
-
import '../isSymbol-es.js';
|
|
25
|
-
import '../keysIn-es.js';
|
|
26
|
-
import '../_baseAssignValue-es.js';
|
|
27
|
-
import '../_baseFlatten-es.js';
|
|
28
|
-
import '../_setToString-es.js';
|
|
29
18
|
|
|
30
19
|
const validationMessage = "Please enter a valid email";
|
|
31
20
|
|
|
@@ -44,10 +33,9 @@ function InputEmail$1(props) {
|
|
|
44
33
|
}
|
|
45
34
|
}
|
|
46
35
|
|
|
47
|
-
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
|
|
36
|
+
function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, onKeyUp, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, }) {
|
|
48
37
|
function handleClear() {
|
|
49
38
|
var _a;
|
|
50
|
-
handleBlur();
|
|
51
39
|
onChange === null || onChange === void 0 ? void 0 : onChange("");
|
|
52
40
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
53
41
|
}
|
|
@@ -72,75 +60,70 @@ function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, on
|
|
|
72
60
|
function handleBlur(event) {
|
|
73
61
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
74
62
|
}
|
|
63
|
+
function handleKeyUp(event) {
|
|
64
|
+
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(event);
|
|
65
|
+
}
|
|
66
|
+
function handleClick(event) {
|
|
67
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
68
|
+
}
|
|
69
|
+
function handleMouseDown(event) {
|
|
70
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
71
|
+
}
|
|
72
|
+
function handleMouseUp(event) {
|
|
73
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(event);
|
|
74
|
+
}
|
|
75
|
+
function handlePointerDown(event) {
|
|
76
|
+
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);
|
|
77
|
+
}
|
|
78
|
+
function handlePointerUp(event) {
|
|
79
|
+
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp(event);
|
|
80
|
+
}
|
|
75
81
|
return {
|
|
76
82
|
handleClear,
|
|
77
83
|
handleChange,
|
|
78
84
|
handleKeyDown,
|
|
85
|
+
handleKeyUp,
|
|
79
86
|
handleFocus,
|
|
80
87
|
handleBlur,
|
|
88
|
+
handleClick,
|
|
89
|
+
handleMouseDown,
|
|
90
|
+
handleMouseUp,
|
|
91
|
+
handlePointerDown,
|
|
92
|
+
handlePointerUp,
|
|
81
93
|
};
|
|
82
94
|
}
|
|
83
95
|
|
|
84
|
-
function useInputEmailFormField(_a) {
|
|
85
|
-
var { id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, handleKeyDown, error } = _a, rest = __rest(_a, ["id", "name", "disabled", "autofocus", "description", "inline", "value", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error"]);
|
|
86
|
-
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
87
|
-
const fieldProps = Object.assign(Object.assign(Object.assign({}, rest), { id,
|
|
88
|
-
name,
|
|
89
|
-
disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
|
|
90
|
-
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
91
|
-
return { fieldProps, descriptionIdentifier };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
96
|
const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
|
|
95
97
|
var _a, _b, _c;
|
|
96
|
-
const
|
|
98
|
+
const generatedId = useId();
|
|
99
|
+
const id = props.id || generatedId;
|
|
97
100
|
const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : useRef(null);
|
|
98
101
|
const wrapperRef = useRef(null);
|
|
99
|
-
const { inputStyle } = useFormFieldWrapperStyles({
|
|
100
|
-
size: props.size,
|
|
101
|
-
inline: props.inline,
|
|
102
|
-
align: props.align,
|
|
103
|
-
type: "email",
|
|
104
|
-
value: props.value,
|
|
105
|
-
invalid: props.invalid,
|
|
106
|
-
error: props.error,
|
|
107
|
-
maxLength: props.maxLength,
|
|
108
|
-
disabled: props.disabled,
|
|
109
|
-
placeholder: props.placeholder,
|
|
110
|
-
});
|
|
111
102
|
const { name } = useAtlantisFormFieldName({
|
|
112
103
|
nameProp: props.name,
|
|
113
104
|
id,
|
|
114
105
|
});
|
|
115
|
-
const { handleChange, handleBlur, handleFocus, handleKeyDown, handleClear } = useInputEmailActions({
|
|
106
|
+
const { handleChange, handleBlur, handleFocus, handleKeyDown, handleKeyUp, handleClear, handleClick, handleMouseDown, handleMouseUp, handlePointerDown, handlePointerUp, } = useInputEmailActions({
|
|
116
107
|
onChange: props.onChange,
|
|
117
108
|
onBlur: props.onBlur,
|
|
118
109
|
onFocus: props.onFocus,
|
|
119
110
|
onKeyDown: props.onKeyDown,
|
|
111
|
+
onKeyUp: props.onKeyUp,
|
|
120
112
|
onEnter: props.onEnter,
|
|
113
|
+
onClick: props.onClick,
|
|
114
|
+
onMouseDown: props.onMouseDown,
|
|
115
|
+
onMouseUp: props.onMouseUp,
|
|
116
|
+
onPointerDown: props.onPointerDown,
|
|
117
|
+
onPointerUp: props.onPointerUp,
|
|
121
118
|
inputRef,
|
|
122
119
|
});
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"prefix",
|
|
131
|
-
"suffix",
|
|
132
|
-
"version",
|
|
133
|
-
]);
|
|
134
|
-
const { fieldProps, descriptionIdentifier } = useInputEmailFormField(Object.assign(Object.assign({}, inputProps), { id,
|
|
135
|
-
name,
|
|
136
|
-
handleChange,
|
|
137
|
-
handleBlur,
|
|
138
|
-
handleFocus,
|
|
139
|
-
handleKeyDown }));
|
|
140
|
-
return (React__default.createElement(FormFieldWrapper, { error: props.error || "", invalid: props.invalid, identifier: props.identifier || id, descriptionIdentifier: descriptionIdentifier, size: props.size, inline: props.inline, align: props.align, prefix: props.prefix, suffix: props.suffix, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, wrapperRef: wrapperRef, maxLength: props.maxLength, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, autofocus: props.autoFocus, name: name },
|
|
141
|
-
React__default.createElement("input", Object.assign({}, fieldProps, { ref: inputRef, type: "email", className: inputStyle, value: props.value, "data-testid": "ATL-InputEmail-input" })),
|
|
142
|
-
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
|
|
143
|
-
props.children));
|
|
120
|
+
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
121
|
+
const descriptionVisible = props.description && !props.inline;
|
|
122
|
+
const isInvalid = Boolean(props.error || props.invalid);
|
|
123
|
+
const dataAttrs = filterDataAttributes(props);
|
|
124
|
+
return (React__default.createElement(FormFieldWrapper, { error: props.error || "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, size: props.size, inline: props.inline, align: props.align, prefix: props.prefix, suffix: props.suffix, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, readonly: props.readOnly, wrapperRef: wrapperRef, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, name: name },
|
|
125
|
+
React__default.createElement("input", Object.assign({ id: id, name: name, type: "email", ref: inputRef, className: formFieldStyles.input, value: props.value, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, pattern: props.pattern, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-controls": props["aria-controls"], "aria-expanded": props["aria-expanded"], "aria-activedescendant": props["aria-activedescendant"], "aria-autocomplete": props["aria-autocomplete"], "aria-required": props["aria-required"], onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, "data-testid": "ATL-InputEmail-input" }, dataAttrs)),
|
|
126
|
+
React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false })));
|
|
144
127
|
});
|
|
145
128
|
|
|
146
129
|
function isNewInputEmailProps(props) {
|
package/dist/InputFile-cjs.js
CHANGED
|
@@ -1649,8 +1649,11 @@ function InputFile({ variation = "dropzone", size = "base", name, buttonLabel: p
|
|
|
1649
1649
|
try {
|
|
1650
1650
|
params = yield getUploadParams(file);
|
|
1651
1651
|
}
|
|
1652
|
-
catch (
|
|
1653
|
-
onUploadError &&
|
|
1652
|
+
catch (error) {
|
|
1653
|
+
onUploadError &&
|
|
1654
|
+
onUploadError(error instanceof Error
|
|
1655
|
+
? error
|
|
1656
|
+
: new Error("Failed to get upload params"));
|
|
1654
1657
|
return;
|
|
1655
1658
|
}
|
|
1656
1659
|
const { url, key = generateId(), fields = {}, httpMethod = "POST", } = params;
|
package/dist/InputFile-es.js
CHANGED
|
@@ -1647,8 +1647,11 @@ function InputFile({ variation = "dropzone", size = "base", name, buttonLabel: p
|
|
|
1647
1647
|
try {
|
|
1648
1648
|
params = yield getUploadParams(file);
|
|
1649
1649
|
}
|
|
1650
|
-
catch (
|
|
1651
|
-
onUploadError &&
|
|
1650
|
+
catch (error) {
|
|
1651
|
+
onUploadError &&
|
|
1652
|
+
onUploadError(error instanceof Error
|
|
1653
|
+
? error
|
|
1654
|
+
: new Error("Failed to get upload params"));
|
|
1652
1655
|
return;
|
|
1653
1656
|
}
|
|
1654
1657
|
const { url, key = generateId(), fields = {}, httpMethod = "POST", } = params;
|
package/dist/InputGroup-cjs.js
CHANGED
|
@@ -11,10 +11,13 @@ function InputGroup({ children, flowDirection = "vertical", }) {
|
|
|
11
11
|
const className = classnames(styles.inputGroup, styles[flowDirection]);
|
|
12
12
|
return React.createElement("div", { className: className }, children);
|
|
13
13
|
}
|
|
14
|
+
function isInputGroupElement(node) {
|
|
15
|
+
return React.isValidElement(node) && node.type === InputGroup;
|
|
16
|
+
}
|
|
14
17
|
function isInvalidGroupNesting(childs) {
|
|
15
18
|
return React.Children.toArray(childs).some(child => {
|
|
16
|
-
if (child
|
|
17
|
-
child.props.flowDirection
|
|
19
|
+
if (isInputGroupElement(child) &&
|
|
20
|
+
child.props.flowDirection !== "horizontal") {
|
|
18
21
|
console.error(`ERROR: InputGroup not rendered: nesting 'flowDirection="vertical"' columns not supported.`, `https://atlantis.getjobber.com/?path=/story/components-forms-and-inputs-inputgroup-web--nested`);
|
|
19
22
|
return true;
|
|
20
23
|
}
|
package/dist/InputGroup-es.js
CHANGED
|
@@ -9,10 +9,13 @@ function InputGroup({ children, flowDirection = "vertical", }) {
|
|
|
9
9
|
const className = classnames(styles.inputGroup, styles[flowDirection]);
|
|
10
10
|
return React__default.createElement("div", { className: className }, children);
|
|
11
11
|
}
|
|
12
|
+
function isInputGroupElement(node) {
|
|
13
|
+
return React__default.isValidElement(node) && node.type === InputGroup;
|
|
14
|
+
}
|
|
12
15
|
function isInvalidGroupNesting(childs) {
|
|
13
16
|
return React__default.Children.toArray(childs).some(child => {
|
|
14
|
-
if (child
|
|
15
|
-
child.props.flowDirection
|
|
17
|
+
if (isInputGroupElement(child) &&
|
|
18
|
+
child.props.flowDirection !== "horizontal") {
|
|
16
19
|
console.error(`ERROR: InputGroup not rendered: nesting 'flowDirection="vertical"' columns not supported.`, `https://atlantis.getjobber.com/?path=/story/components-forms-and-inputs-inputgroup-web--nested`);
|
|
17
20
|
return true;
|
|
18
21
|
}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
1
|
import type React from "react";
|
|
3
|
-
import type {
|
|
2
|
+
import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
4
3
|
export type InputNumberVersion = 1 | 2 | undefined;
|
|
5
|
-
export interface InputNumberRebuiltProps extends
|
|
6
|
-
readonly align?: "center" | "right";
|
|
7
|
-
readonly autocomplete?: boolean;
|
|
8
|
-
readonly autoFocus?: boolean;
|
|
4
|
+
export interface InputNumberRebuiltProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, MouseEvents<HTMLInputElement>, Omit<RebuiltInputCommonProps, "clearable" | "suffix" | "prefix"> {
|
|
9
5
|
readonly defaultValue?: number;
|
|
10
|
-
readonly description?: ReactNode;
|
|
11
|
-
readonly error?: string;
|
|
12
6
|
readonly formatOptions?: Intl.NumberFormatOptions;
|
|
13
|
-
readonly identifier?: string;
|
|
14
|
-
readonly inline?: boolean;
|
|
15
|
-
readonly invalid?: boolean;
|
|
16
7
|
readonly maxValue?: number;
|
|
17
8
|
readonly minValue?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Callback for value changes.
|
|
11
|
+
* @param newValue - The new numeric value
|
|
12
|
+
* @param event - Optional change event
|
|
13
|
+
*/
|
|
18
14
|
readonly onChange?: (newValue: number, event?: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
15
|
readonly showMiniLabel?: boolean;
|
|
20
16
|
readonly value?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
|
|
23
|
-
*/
|
|
24
|
-
readonly version: 2;
|
|
25
17
|
}
|
|
26
18
|
export interface InputNumberRebuiltRef {
|
|
27
19
|
focus: () => void;
|
|
@@ -7,6 +7,7 @@ require('react-dom');
|
|
|
7
7
|
var classnames = require('classnames');
|
|
8
8
|
var Icon = require('../Icon-cjs.js');
|
|
9
9
|
var Text = require('../Text-cjs.js');
|
|
10
|
+
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
10
11
|
var FormField = require('../FormField-cjs.js');
|
|
11
12
|
require('react-hook-form');
|
|
12
13
|
require('@jobber/hooks');
|
|
@@ -2740,14 +2741,15 @@ const InputNumberRebuilt = React.forwardRef((props, ref) => {
|
|
|
2740
2741
|
}
|
|
2741
2742
|
},
|
|
2742
2743
|
}));
|
|
2743
|
-
const { align, description, disabled, error, inline, invalid, placeholder,
|
|
2744
|
+
const { align, description, disabled, error, inline, invalid, placeholder, readOnly, showMiniLabel = true, size, minValue, maxValue } = props, ariaNumberFieldProps = tslib_es6.__rest(props, ["align", "description", "disabled", "error", "inline", "invalid", "placeholder", "readOnly", "showMiniLabel", "size", "minValue", "maxValue"]);
|
|
2745
|
+
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
2744
2746
|
const stringDescription = typeof description === "string";
|
|
2745
|
-
return (React.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly:
|
|
2747
|
+
return (React.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, minValue: minValue, maxValue: maxValue, onBlur: e => { var _a; return (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onFocus: e => { var _a; return (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onClick: props.onClick, onMouseDown: props.onMouseDown, onMouseUp: props.onMouseUp, onPointerDown: props.onPointerDown, onPointerUp: props.onPointerUp, onChange: handleChange }),
|
|
2746
2748
|
React.createElement($a049562f99e7db0e$export$eb2fcfdbd7ba97d4, { className: classnames(styles.wrapper, align && styles[align], invalid && styles.invalid, disabled && styles.disabled) },
|
|
2747
2749
|
React.createElement("div", { className: styles.horizontalWrapper },
|
|
2748
2750
|
React.createElement("div", { className: classnames(styles.inputWrapper, disabled && styles.disabled, !showMiniLabel && styles.hideLabel, size && styles[size]) },
|
|
2749
|
-
React.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, { className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2750
|
-
, ref: inputRef }),
|
|
2751
|
+
React.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, Object.assign({ className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2752
|
+
, ref: inputRef }, dataAttrs)),
|
|
2751
2753
|
React.createElement($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: styles.label }, placeholder)))),
|
|
2752
2754
|
description && (React.createElement(Tree.$514c0188e459b4c0$export$5f1af8db9871e1d6, { className: styles.description, elementType: "div", slot: "description" }, stringDescription ? (React.createElement(Text.Text, { size: "small", variation: "subdued" }, description)) : (description))),
|
|
2753
2755
|
error && (React.createElement($ee014567cb39d3f0$export$f551688fc98f2e09, { className: styles.fieldError },
|
|
@@ -2773,7 +2775,7 @@ function InputNumberInternal(props, ref) {
|
|
|
2773
2775
|
}
|
|
2774
2776
|
},
|
|
2775
2777
|
}));
|
|
2776
|
-
return (React.createElement(FormField.FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2778
|
+
return (React.createElement(FormField.FormField, Object.assign({}, props, { clearable: "never", type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2777
2779
|
function customValidators(validators) {
|
|
2778
2780
|
if (validators == null) {
|
|
2779
2781
|
return getOverLimitMessage;
|
|
@@ -5,6 +5,7 @@ import 'react-dom';
|
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import { I as Icon } from '../Icon-es.js';
|
|
7
7
|
import { T as Text } from '../Text-es.js';
|
|
8
|
+
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
8
9
|
import { k as FormField } from '../FormField-es.js';
|
|
9
10
|
import 'react-hook-form';
|
|
10
11
|
import '@jobber/hooks';
|
|
@@ -2738,14 +2739,15 @@ const InputNumberRebuilt = forwardRef((props, ref) => {
|
|
|
2738
2739
|
}
|
|
2739
2740
|
},
|
|
2740
2741
|
}));
|
|
2741
|
-
const { align, description, disabled, error, inline, invalid, placeholder,
|
|
2742
|
+
const { align, description, disabled, error, inline, invalid, placeholder, readOnly, showMiniLabel = true, size, minValue, maxValue } = props, ariaNumberFieldProps = __rest(props, ["align", "description", "disabled", "error", "inline", "invalid", "placeholder", "readOnly", "showMiniLabel", "size", "minValue", "maxValue"]);
|
|
2743
|
+
const dataAttrs = filterDataAttributes(props);
|
|
2742
2744
|
const stringDescription = typeof description === "string";
|
|
2743
|
-
return (React__default.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly:
|
|
2745
|
+
return (React__default.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, minValue: minValue, maxValue: maxValue, onBlur: e => { var _a; return (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onFocus: e => { var _a; return (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e); }, onClick: props.onClick, onMouseDown: props.onMouseDown, onMouseUp: props.onMouseUp, onPointerDown: props.onPointerDown, onPointerUp: props.onPointerUp, onChange: handleChange }),
|
|
2744
2746
|
React__default.createElement($a049562f99e7db0e$export$eb2fcfdbd7ba97d4, { className: classnames(styles.wrapper, align && styles[align], invalid && styles.invalid, disabled && styles.disabled) },
|
|
2745
2747
|
React__default.createElement("div", { className: styles.horizontalWrapper },
|
|
2746
2748
|
React__default.createElement("div", { className: classnames(styles.inputWrapper, disabled && styles.disabled, !showMiniLabel && styles.hideLabel, size && styles[size]) },
|
|
2747
|
-
React__default.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, { className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2748
|
-
, ref: inputRef }),
|
|
2749
|
+
React__default.createElement($3985021b0ad6602f$export$f5b8910cec6cf069, Object.assign({ className: styles.input, placeholder: " " // used for CSS minilabel
|
|
2750
|
+
, ref: inputRef }, dataAttrs)),
|
|
2749
2751
|
React__default.createElement($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: styles.label }, placeholder)))),
|
|
2750
2752
|
description && (React__default.createElement($514c0188e459b4c0$export$5f1af8db9871e1d6, { className: styles.description, elementType: "div", slot: "description" }, stringDescription ? (React__default.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description))),
|
|
2751
2753
|
error && (React__default.createElement($ee014567cb39d3f0$export$f551688fc98f2e09, { className: styles.fieldError },
|
|
@@ -2771,7 +2773,7 @@ function InputNumberInternal(props, ref) {
|
|
|
2771
2773
|
}
|
|
2772
2774
|
},
|
|
2773
2775
|
}));
|
|
2774
|
-
return (React__default.createElement(FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2776
|
+
return (React__default.createElement(FormField, Object.assign({}, props, { clearable: "never", type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
|
|
2775
2777
|
function customValidators(validators) {
|
|
2776
2778
|
if (validators == null) {
|
|
2777
2779
|
return getOverLimitMessage;
|