@jobber/components 6.103.2-JOB-141426-1b49367.0 → 6.103.2-JOB-140609-8386817.45

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.
Files changed (79) hide show
  1. package/dist/Autocomplete/Autocomplete.types.d.ts +12 -1
  2. package/dist/Autocomplete/index.cjs +3 -24
  3. package/dist/Autocomplete/index.mjs +3 -24
  4. package/dist/Autocomplete/useAutocomplete.d.ts +0 -1
  5. package/dist/Checkbox/Checkbox.types.d.ts +2 -9
  6. package/dist/Checkbox/index.cjs +4 -2
  7. package/dist/Checkbox/index.mjs +4 -2
  8. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
  9. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
  10. package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
  11. package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
  12. package/dist/Chips/index.cjs +2 -2
  13. package/dist/Chips/index.mjs +2 -2
  14. package/dist/DataList/components/DataListSearch/index.cjs +1 -12
  15. package/dist/DataList/components/DataListSearch/index.mjs +1 -12
  16. package/dist/DataList/index.cjs +0 -8
  17. package/dist/DataList/index.mjs +0 -8
  18. package/dist/DataTable/index.cjs +2 -2
  19. package/dist/DataTable/index.mjs +2 -2
  20. package/dist/DatePicker/index.cjs +2 -2
  21. package/dist/DatePicker/index.mjs +2 -2
  22. package/dist/FormField/FormFieldTypes.d.ts +0 -2
  23. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +7 -2
  24. package/dist/FormField-cjs.js +0 -1
  25. package/dist/FormField-es.js +1 -1
  26. package/dist/InputDate/index.cjs +5 -9
  27. package/dist/InputDate/index.mjs +5 -9
  28. package/dist/InputDate/useInputDateActivatorActions.d.ts +4 -8
  29. package/dist/InputEmail/InputEmail.types.d.ts +12 -20
  30. package/dist/InputEmail/hooks/useInputEmailActions.d.ts +1 -1
  31. package/dist/InputEmail/index.cjs +8 -44
  32. package/dist/InputEmail/index.mjs +8 -44
  33. package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +20 -3
  34. package/dist/InputNumber/index.cjs +2 -2
  35. package/dist/InputNumber/index.mjs +2 -2
  36. package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +13 -27
  37. package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
  38. package/dist/InputPhoneNumber/index.cjs +17 -34
  39. package/dist/InputPhoneNumber/index.mjs +17 -34
  40. package/dist/InputText/InputText.types.d.ts +24 -24
  41. package/dist/InputText/index.cjs +54 -54
  42. package/dist/InputText/index.mjs +55 -55
  43. package/dist/InputText/useInputTextActions.d.ts +1 -1
  44. package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
  45. package/dist/InputTime/InputTime.types.d.ts +21 -1
  46. package/dist/InputTime/hooks/useInputTimeActions.d.ts +16 -0
  47. package/dist/InputTime/index.cjs +63 -33
  48. package/dist/InputTime/index.d.ts +1 -1
  49. package/dist/InputTime/index.mjs +66 -36
  50. package/dist/List/index.cjs +2 -2
  51. package/dist/List/index.mjs +2 -2
  52. package/dist/RecurringSelect/index.cjs +2 -2
  53. package/dist/RecurringSelect/index.mjs +2 -2
  54. package/dist/Select/Select.rebuilt.d.ts +1 -1
  55. package/dist/Select/Select.types.d.ts +14 -1
  56. package/dist/Select/hooks/useSelectActions.d.ts +5 -5
  57. package/dist/Select/index.cjs +28 -41
  58. package/dist/Select/index.d.ts +7 -5
  59. package/dist/Select/index.mjs +30 -43
  60. package/dist/Tabs-es.js +1 -1
  61. package/dist/_baseEach-cjs.js +12 -12
  62. package/dist/_baseEach-es.js +1 -1
  63. package/dist/_baseFlatten-cjs.js +2 -2
  64. package/dist/_baseFlatten-es.js +1 -1
  65. package/dist/{_baseGet-cjs.js → _getAllKeys-cjs.js} +181 -181
  66. package/dist/{_baseGet-es.js → _getAllKeys-es.js} +182 -182
  67. package/dist/debounce-es.js +1 -1
  68. package/dist/index.cjs +2 -2
  69. package/dist/index.mjs +2 -2
  70. package/dist/omit-cjs.js +14 -14
  71. package/dist/omit-es.js +1 -1
  72. package/dist/sharedHelpers/types.d.ts +235 -0
  73. package/dist/useScrollToActive-cjs.js +3 -3
  74. package/dist/useScrollToActive-es.js +2 -2
  75. package/package.json +2 -2
  76. package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +0 -32
  77. package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +0 -71
  78. package/dist/InputText/useInputTextFormField.d.ts +0 -352
  79. package/dist/Select/hooks/useSelectFormField.d.ts +0 -34
@@ -11,12 +11,12 @@ import '../Button-es.js';
11
11
  import { D as DatePicker } from '../DatePicker-es.js';
12
12
  import { InputText } from '../InputText/index.mjs';
13
13
  import '../_commonjsHelpers-es.js';
14
- import '../_baseGet-es.js';
14
+ import '../_getAllKeys-es.js';
15
15
  import '../isTypedArray-es.js';
16
16
  import '../isObjectLike-es.js';
17
+ import '../isSymbol-es.js';
17
18
  import '../identity-es.js';
18
19
  import '../_getTag-es.js';
19
- import '../isSymbol-es.js';
20
20
  import '../keysIn-es.js';
21
21
  import '../_baseAssignValue-es.js';
22
22
  import '../_baseFlatten-es.js';
@@ -77,13 +77,9 @@ function InputDate$1(inputProps) {
77
77
  } }));
78
78
  }
79
79
 
80
- /**
81
- * Combines the actions on the InputDate such as onChange, onFocus, onBlur to forward event handler passed to the InputDate component to the DatePicker component.
82
- * 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.
83
- */
84
80
  function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
85
81
  const [isFocused, setIsFocused] = useState(false);
86
- function handleChange(_, event) {
82
+ function handleChange(_newValue, event) {
87
83
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
88
84
  }
89
85
  function handleFocus(event) {
@@ -91,8 +87,8 @@ function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
91
87
  setIsFocused(true);
92
88
  }
93
89
  function handleBlur(event) {
94
- setIsFocused(false);
95
90
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
91
+ setIsFocused(false);
96
92
  }
97
93
  return {
98
94
  handleBlur,
@@ -133,7 +129,7 @@ const InputDateRebuilt = forwardRef((props, forwardedRef) => {
133
129
  return (
134
130
  // We prevent the picker from opening on focus for keyboard navigation, so to maintain a good UX for mouse users we want to open the picker on click
135
131
  React__default.createElement("div", { onClick: onClick },
136
- React__default.createElement(InputText, { "aria-describedby": activatorProps.ariaDescribedBy, "aria-invalid": activatorProps.ariaInvalid === "true" ? true : false, "aria-labelledby": activatorProps.ariaLabelledBy, "aria-required": activatorProps.ariaRequired === "true" ? true : false, id: activatorProps.id, disabled: props.disabled, error: props.error, readOnly: props.readOnly, placeholder: props.placeholder, size: props.size, inline: props.inline, align: props.align, description: props.description, invalid: props.invalid, name: props.name, version: 2, value: showEmptyValueLabel ? props.emptyValueLabel || "" : value || "", ref: forwardedRef, suffix: suffix, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: event => {
132
+ React__default.createElement(InputText, { "aria-describedby": activatorProps.ariaDescribedBy, "aria-labelledby": activatorProps.ariaLabelledBy, "aria-required": activatorProps.ariaRequired === "true" ? true : false, id: activatorProps.id, disabled: props.disabled, error: props.error, readOnly: props.readOnly, placeholder: props.placeholder, size: props.size, inline: props.inline, align: props.align, description: props.description, invalid: props.invalid, name: props.name, version: 2, value: showEmptyValueLabel ? props.emptyValueLabel || "" : value || "", ref: forwardedRef, suffix: suffix, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: event => {
137
133
  var _a, _b;
138
134
  if (props.showIcon === false && event.key === "ArrowDown") {
139
135
  (_a = activatorProps.onClick) === null || _a === void 0 ? void 0 : _a.call(activatorProps);
@@ -1,16 +1,12 @@
1
- import type { ChangeEvent, FocusEvent } from "react";
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: (_: unknown, event?: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
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, InputLengthConstraint, KeyboardEvents, 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,19 @@ 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 Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur" | "size" | "suffix" | "prefix" | "value" | "max" | "min" | "defaultValue"> {
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>, RebuiltInputCommonProps, InputLengthConstraint {
19
11
  /**
20
- * Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
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
+ * A callback to handle "Enter" keypress. This will only run
21
+ * if Enter is the only key. Will not run if Shift or Control
22
+ * are being held.
23
+ */
24
24
  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
25
  }
@@ -8,5 +8,5 @@ export declare function useInputEmailActions({ onChange, inputRef, onEnter, onFo
8
8
  handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
9
9
  handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
10
10
  handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
11
- handleBlur: (event?: FocusEvent) => void;
11
+ handleBlur: (event: FocusEvent<HTMLInputElement>) => void;
12
12
  };
@@ -3,13 +3,12 @@
3
3
  var React = require('react');
4
4
  var FormField = require('../FormField-cjs.js');
5
5
  require('classnames');
6
- var tslib_es6 = require('../tslib.es6-cjs.js');
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 omit = require('../omit-cjs.js');
13
12
  require('../Icon-cjs.js');
14
13
  require('../Text-cjs.js');
15
14
  require('../Typography-cjs.js');
@@ -17,17 +16,6 @@ require('../useFormFieldFocus-cjs.js');
17
16
  require('../InputValidation-cjs.js');
18
17
  require('../Spinner-cjs.js');
19
18
  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
19
 
32
20
  const validationMessage = "Please enter a valid email";
33
21
 
@@ -49,7 +37,6 @@ function InputEmail$1(props) {
49
37
  function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
50
38
  function handleClear() {
51
39
  var _a;
52
- handleBlur();
53
40
  onChange === null || onChange === void 0 ? void 0 : onChange("");
54
41
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
55
42
  }
@@ -83,19 +70,10 @@ function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, on
83
70
  };
84
71
  }
85
72
 
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
73
  const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, ref) {
97
74
  var _a, _b, _c;
98
- const id = React.useId();
75
+ const generatedId = React.useId();
76
+ const id = props.id || generatedId;
99
77
  const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : React.useRef(null);
100
78
  const wrapperRef = React.useRef(null);
101
79
  const { inputStyle } = FormField.useFormFieldWrapperStyles({
@@ -122,25 +100,11 @@ const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, re
122
100
  onEnter: props.onEnter,
123
101
  inputRef,
124
102
  });
125
- const inputProps = omit.omit(props, [
126
- "placeholder",
127
- "onChange",
128
- "onBlur",
129
- "onFocus",
130
- "onEnter",
131
- "size",
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" })),
103
+ const descriptionIdentifier = `descriptionUUID--${id}`;
104
+ const hasDescription = props.description && !props.inline;
105
+ const isInvalid = Boolean(props.error || props.invalid);
106
+ 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, wrapperRef: wrapperRef, maxLength: props.maxLength, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, autofocus: props.autoFocus, name: name },
107
+ React.createElement("input", { id: id, name: name, type: "email", ref: inputRef, className: inputStyle, value: props.value, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, maxLength: props.maxLength, pattern: props.pattern, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props.ariaLabel, "aria-describedby": hasDescription ? descriptionIdentifier : props.ariaDescribedBy, "aria-invalid": isInvalid ? true : undefined, "aria-controls": props.ariaControls, "aria-expanded": props.ariaExpanded, "aria-activedescendant": props.ariaActiveDescendant, "aria-autocomplete": props.ariaAutocomplete, "aria-required": props.ariaRequired, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: props.onKeyUp, "data-testid": "ATL-InputEmail-input" }),
144
108
  React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
145
109
  props.children));
146
110
  });
@@ -1,13 +1,12 @@
1
1
  import React__default, { forwardRef, useId, useRef } from 'react';
2
2
  import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix } from '../FormField-es.js';
3
3
  import 'classnames';
4
- import { _ as __rest } from '../tslib.es6-es.js';
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 { o as omit } from '../omit-es.js';
11
10
  import '../Icon-es.js';
12
11
  import '../Text-es.js';
13
12
  import '../Typography-es.js';
@@ -15,17 +14,6 @@ import '../useFormFieldFocus-es.js';
15
14
  import '../InputValidation-es.js';
16
15
  import '../Spinner-es.js';
17
16
  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
17
 
30
18
  const validationMessage = "Please enter a valid email";
31
19
 
@@ -47,7 +35,6 @@ function InputEmail$1(props) {
47
35
  function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, onKeyDown, }) {
48
36
  function handleClear() {
49
37
  var _a;
50
- handleBlur();
51
38
  onChange === null || onChange === void 0 ? void 0 : onChange("");
52
39
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
53
40
  }
@@ -81,19 +68,10 @@ function useInputEmailActions({ onChange, inputRef, onEnter, onFocus, onBlur, on
81
68
  };
82
69
  }
83
70
 
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
71
  const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
95
72
  var _a, _b, _c;
96
- const id = useId();
73
+ const generatedId = useId();
74
+ const id = props.id || generatedId;
97
75
  const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : useRef(null);
98
76
  const wrapperRef = useRef(null);
99
77
  const { inputStyle } = useFormFieldWrapperStyles({
@@ -120,25 +98,11 @@ const InputEmailRebuilt = forwardRef(function InputEmailInternal(props, ref) {
120
98
  onEnter: props.onEnter,
121
99
  inputRef,
122
100
  });
123
- const inputProps = omit(props, [
124
- "placeholder",
125
- "onChange",
126
- "onBlur",
127
- "onFocus",
128
- "onEnter",
129
- "size",
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" })),
101
+ const descriptionIdentifier = `descriptionUUID--${id}`;
102
+ const hasDescription = props.description && !props.inline;
103
+ const isInvalid = Boolean(props.error || props.invalid);
104
+ 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, wrapperRef: wrapperRef, maxLength: props.maxLength, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, autofocus: props.autoFocus, name: name },
105
+ React__default.createElement("input", { id: id, name: name, type: "email", ref: inputRef, className: inputStyle, value: props.value, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, maxLength: props.maxLength, pattern: props.pattern, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props.ariaLabel, "aria-describedby": hasDescription ? descriptionIdentifier : props.ariaDescribedBy, "aria-invalid": isInvalid ? true : undefined, "aria-controls": props.ariaControls, "aria-expanded": props.ariaExpanded, "aria-activedescendant": props.ariaActiveDescendant, "aria-autocomplete": props.ariaAutocomplete, "aria-required": props.ariaRequired, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: props.onKeyUp, "data-testid": "ATL-InputEmail-input" }),
142
106
  React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
143
107
  props.children));
144
108
  });
@@ -1,22 +1,39 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type React from "react";
3
3
  import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
4
+ import type { AriaInputProps, FocusEvents, InputConstraintProps, KeyboardEvents } from "../sharedHelpers/types";
4
5
  export type InputNumberVersion = 1 | 2 | undefined;
5
- export interface InputNumberRebuiltProps extends Omit<CommonFormFieldProps, "version">, Pick<FormFieldProps, "onFocus" | "onBlur" | "inputRef" | "readonly" | "size"> {
6
+ export interface InputNumberRebuiltProps extends Omit<CommonFormFieldProps, "version">, AriaInputProps, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, InputConstraintProps {
6
7
  readonly align?: "center" | "right";
7
- readonly autocomplete?: boolean;
8
+ /**
9
+ * HTML autocomplete attribute for browser autofill.
10
+ */
11
+ readonly autoComplete?: string;
8
12
  readonly autoFocus?: boolean;
9
13
  readonly defaultValue?: number;
10
14
  readonly description?: ReactNode;
11
15
  readonly error?: string;
12
16
  readonly formatOptions?: Intl.NumberFormatOptions;
13
- readonly identifier?: string;
17
+ /**
18
+ * The ID of the input element.
19
+ */
20
+ readonly id?: string;
14
21
  readonly inline?: boolean;
15
22
  readonly invalid?: boolean;
16
23
  readonly maxValue?: number;
17
24
  readonly minValue?: number;
25
+ /**
26
+ * Callback for value changes.
27
+ * @param newValue - The new numeric value
28
+ * @param event - Optional change event
29
+ */
18
30
  readonly onChange?: (newValue: number, event?: React.ChangeEvent<HTMLInputElement>) => void;
31
+ /**
32
+ * Whether the input is read-only.
33
+ */
34
+ readonly readOnly?: boolean;
19
35
  readonly showMiniLabel?: boolean;
36
+ readonly size?: FormFieldProps["size"];
20
37
  readonly value?: number;
21
38
  /**
22
39
  * Version 2 is highly experimental. Avoid using it unless you have talked with Atlantis first.
@@ -2740,9 +2740,9 @@ const InputNumberRebuilt = React.forwardRef((props, ref) => {
2740
2740
  }
2741
2741
  },
2742
2742
  }));
2743
- 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"]);
2743
+ 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"]);
2744
2744
  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: 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); }, onChange: handleChange }),
2745
+ return (React.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, id: props.id, 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); }, onChange: handleChange }),
2746
2746
  React.createElement($a049562f99e7db0e$export$eb2fcfdbd7ba97d4, { className: classnames(styles.wrapper, align && styles[align], invalid && styles.invalid, disabled && styles.disabled) },
2747
2747
  React.createElement("div", { className: styles.horizontalWrapper },
2748
2748
  React.createElement("div", { className: classnames(styles.inputWrapper, disabled && styles.disabled, !showMiniLabel && styles.hideLabel, size && styles[size]) },
@@ -2738,9 +2738,9 @@ const InputNumberRebuilt = forwardRef((props, ref) => {
2738
2738
  }
2739
2739
  },
2740
2740
  }));
2741
- 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"]);
2741
+ 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"]);
2742
2742
  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: 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); }, onChange: handleChange }),
2743
+ return (React__default.createElement($b91743d66a0ed188$export$63c5fa0b2fdccd2e, Object.assign({}, ariaNumberFieldProps, { className: classnames(styles.container, inline && styles.inline), formatOptions: mergedFormatOptions, id: props.id, 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); }, onChange: handleChange }),
2744
2744
  React__default.createElement($a049562f99e7db0e$export$eb2fcfdbd7ba97d4, { className: classnames(styles.wrapper, align && styles[align], invalid && styles.invalid, disabled && styles.disabled) },
2745
2745
  React__default.createElement("div", { className: styles.horizontalWrapper },
2746
2746
  React__default.createElement("div", { className: classnames(styles.inputWrapper, disabled && styles.disabled, !showMiniLabel && styles.hideLabel, size && styles[size]) },
@@ -1,6 +1,6 @@
1
- import type { Clearable } from "@jobber/hooks";
2
1
  import type { InputMaskProps } from "./InputMask";
3
2
  import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
3
+ import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
4
4
  export interface InputPhoneNumberLegacyProps extends Omit<CommonFormFieldProps, "align">, Pick<FormFieldProps, "autocomplete" | "onEnter" | "onFocus" | "onBlur" | "validations" | "readonly" | "prefix" | "suffix"> {
5
5
  readonly value: string;
6
6
  readonly onChange: (value: string) => void;
@@ -16,20 +16,21 @@ export interface InputPhoneNumberLegacyProps extends Omit<CommonFormFieldProps,
16
16
  */
17
17
  readonly required?: boolean;
18
18
  }
19
- export interface InputPhoneNumberRebuiltProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "onBlur" | "size" | "suffix" | "prefix" | "value" | "max" | "min" | "defaultValue" | "readOnly" | "type" | "maxLength" | "minLength"> {
20
- readonly error?: string;
21
- readonly invalid?: boolean;
22
- readonly identifier?: string;
23
- readonly autocomplete?: boolean | string;
24
- readonly loading?: boolean;
25
- readonly onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
26
- readonly children?: React.ReactNode;
27
- readonly clearable?: Clearable;
19
+ export interface InputPhoneNumberRebuiltProps extends Omit<HTMLInputBaseProps, "type" | "maxLength" | "minLength">, FocusEvents<HTMLInputElement>, KeyboardEvents<HTMLInputElement>, RebuiltInputCommonProps {
20
+ /**
21
+ * The current value of the input.
22
+ */
28
23
  readonly value: string;
24
+ /**
25
+ * Custom onChange handler that provides the new value as the first argument.
26
+ */
29
27
  readonly onChange: (value: string, event?: React.ChangeEvent<HTMLInputElement>) => void;
30
- readonly onBlur?: (event?: React.FocusEvent<HTMLInputElement>) => void;
28
+ /**
29
+ * A callback to handle "Enter" keypress. This will only run
30
+ * if Enter is the only key. Will not run if Shift or Control
31
+ * are being held.
32
+ */
31
33
  readonly onEnter?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
32
- readonly onFocus?: (event?: React.FocusEvent<HTMLInputElement>) => void;
33
34
  /**
34
35
  * A pattern to specify the format to display the phone number in.
35
36
  * For example if you want to display the format for [Denmark](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Denmark)
@@ -37,20 +38,5 @@ export interface InputPhoneNumberRebuiltProps extends Omit<React.InputHTMLAttrib
37
38
  * @default "(***) ***-****"
38
39
  */
39
40
  readonly pattern?: InputMaskProps["pattern"];
40
- /**
41
- * Shows a "required" validation message when the component is left empty.
42
- */
43
- readonly required?: boolean;
44
- /**
45
- * Version 2 is highly experimental, avoid using it unless you have talked with Atlantis first.
46
- */
47
- readonly version: 2;
48
- readonly size?: FormFieldProps["size"];
49
- readonly inline?: FormFieldProps["inline"];
50
- readonly align?: FormFieldProps["align"];
51
- readonly prefix?: FormFieldProps["prefix"];
52
- readonly suffix?: FormFieldProps["suffix"];
53
- readonly description?: FormFieldProps["description"];
54
- readonly readonly?: boolean;
55
41
  }
56
42
  export declare const DEFAULT_PATTERN = "(***) ***-****";
@@ -11,6 +11,6 @@ export declare function useInputPhoneActions({ onChange, inputRef, onFocus, onBl
11
11
  handleClear: () => void;
12
12
  handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
13
13
  handleFocus: (event: FocusEvent<HTMLInputElement>) => void;
14
- handleBlur: (event?: FocusEvent<HTMLInputElement>) => void;
14
+ handleBlur: (event: FocusEvent<HTMLInputElement>) => void;
15
15
  handleKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
16
16
  };
@@ -115,7 +115,6 @@ const DEFAULT_PATTERN = "(***) ***-****";
115
115
  function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown, onEnter, }) {
116
116
  function handleClear() {
117
117
  var _a;
118
- handleBlur();
119
118
  onChange && onChange("");
120
119
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
121
120
  }
@@ -149,26 +148,22 @@ function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown,
149
148
  };
150
149
  }
151
150
 
152
- /**
153
- * Provides the props for the html fields rendered by the html input.
154
- * 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.
155
- */
156
- function useInputPhoneFormField(_a) {
157
- var { id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error, disabled, autofocus, value, readonly } = _a, rest = tslib_es6.__rest(_a, ["id", "name", "description", "inline", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error", "disabled", "autofocus", "value", "readonly"]);
158
- const descriptionIdentifier = `descriptionUUID--${id}`;
159
- const fieldProps = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { id,
160
- name,
161
- disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
162
- !inline && { "aria-describedby": descriptionIdentifier })), { readOnly: readonly });
163
- return { fieldProps, descriptionIdentifier };
164
- }
165
-
166
151
  const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberInternal(_a, ref) {
167
152
  var _b, _c, _d, _e;
168
153
  var { pattern = DEFAULT_PATTERN } = _a, props = tslib_es6.__rest(_a, ["pattern"]);
169
154
  const inputPhoneNumberRef = (_b = ref) !== null && _b !== void 0 ? _b : React.useRef(null);
170
155
  const wrapperRef = React.useRef(null);
171
- const { inputStyle } = FormField.useFormFieldWrapperStyles(Object.assign(Object.assign({}, props), { type: "tel" }));
156
+ const { inputStyle } = FormField.useFormFieldWrapperStyles({
157
+ size: props.size,
158
+ align: props.align,
159
+ placeholder: props.placeholder,
160
+ value: props.value,
161
+ invalid: props.invalid,
162
+ error: props.error,
163
+ disabled: props.disabled,
164
+ inline: props.inline,
165
+ type: "tel",
166
+ });
172
167
  const generatedId = React.useId();
173
168
  const id = props.id || generatedId;
174
169
  const { name } = FormField.useAtlantisFormFieldName({
@@ -188,25 +183,13 @@ const InputPhoneNumberRebuilt = React.forwardRef(function InputPhoneNumberIntern
188
183
  onEnter: props.onEnter,
189
184
  inputRef: inputPhoneNumberRef,
190
185
  });
191
- const { fieldProps, descriptionIdentifier } = useInputPhoneFormField({
192
- id,
193
- name,
194
- handleChange,
195
- handleBlur,
196
- handleFocus,
197
- handleKeyDown,
198
- autofocus: props.autoFocus,
199
- disabled: props.disabled,
200
- readonly: props.readonly,
201
- invalid: props.invalid,
202
- error: props.error,
203
- description: props.description,
204
- inline: props.inline,
205
- });
206
- return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, inline: props.inline, wrapperRef: wrapperRef, error: (_c = props.error) !== null && _c !== void 0 ? _c : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_d = props.clearable) !== null && _d !== void 0 ? _d : "never", onClear: handleClear, type: "tel", placeholder: props.placeholder, value: formattedValue, prefix: props.prefix, suffix: props.suffix, readonly: props.readonly, loading: props.loading },
207
- React.createElement("input", Object.assign({ type: "tel" }, fieldProps, { ref: inputPhoneNumberRef, className: classnames(inputStyle, {
186
+ const descriptionIdentifier = `descriptionUUID--${id}`;
187
+ const hasDescription = props.description && !props.inline;
188
+ const isInvalid = Boolean(props.error || props.invalid);
189
+ return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, inline: props.inline, wrapperRef: wrapperRef, error: (_c = props.error) !== null && _c !== void 0 ? _c : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_d = props.clearable) !== null && _d !== void 0 ? _d : "never", onClear: handleClear, type: "tel", placeholder: props.placeholder, value: formattedValue, prefix: props.prefix, suffix: props.suffix, readonly: props.readOnly, loading: props.loading },
190
+ React.createElement("input", { id: id, name: name, type: "tel", ref: inputPhoneNumberRef, className: classnames(inputStyle, {
208
191
  [styles.emptyValue]: inputValue.length === 0 && pattern[0] === "(",
209
- }), value: formattedValue })),
192
+ }), value: formattedValue, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props.ariaLabel, "aria-describedby": hasDescription ? descriptionIdentifier : props.ariaDescribedBy, "aria-invalid": isInvalid ? true : undefined, "aria-controls": props.ariaControls, "aria-expanded": props.ariaExpanded, "aria-activedescendant": props.ariaActiveDescendant, "aria-autocomplete": props.ariaAutocomplete, "aria-required": props.ariaRequired, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown }),
210
193
  React.createElement(MaskElement, { isMasking: isMasking, formattedValue: formattedValue, placeholderMask: placeholderMask }),
211
194
  React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_e = props.loading) !== null && _e !== void 0 ? _e : false })));
212
195
  });
@@ -113,7 +113,6 @@ const DEFAULT_PATTERN = "(***) ***-****";
113
113
  function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown, onEnter, }) {
114
114
  function handleClear() {
115
115
  var _a;
116
- handleBlur();
117
116
  onChange && onChange("");
118
117
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
119
118
  }
@@ -147,26 +146,22 @@ function useInputPhoneActions({ onChange, inputRef, onFocus, onBlur, onKeyDown,
147
146
  };
148
147
  }
149
148
 
150
- /**
151
- * Provides the props for the html fields rendered by the html input.
152
- * 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.
153
- */
154
- function useInputPhoneFormField(_a) {
155
- var { id, name, description, inline, handleChange, handleBlur, handleFocus, handleKeyDown, error, disabled, autofocus, value, readonly } = _a, rest = __rest(_a, ["id", "name", "description", "inline", "handleChange", "handleBlur", "handleFocus", "handleKeyDown", "error", "disabled", "autofocus", "value", "readonly"]);
156
- const descriptionIdentifier = `descriptionUUID--${id}`;
157
- const fieldProps = Object.assign(Object.assign(Object.assign(Object.assign({}, rest), { id,
158
- name,
159
- disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, value, invalid: error || rest.invalid ? "true" : undefined }), (description &&
160
- !inline && { "aria-describedby": descriptionIdentifier })), { readOnly: readonly });
161
- return { fieldProps, descriptionIdentifier };
162
- }
163
-
164
149
  const InputPhoneNumberRebuilt = forwardRef(function InputPhoneNumberInternal(_a, ref) {
165
150
  var _b, _c, _d, _e;
166
151
  var { pattern = DEFAULT_PATTERN } = _a, props = __rest(_a, ["pattern"]);
167
152
  const inputPhoneNumberRef = (_b = ref) !== null && _b !== void 0 ? _b : React__default.useRef(null);
168
153
  const wrapperRef = React__default.useRef(null);
169
- const { inputStyle } = useFormFieldWrapperStyles(Object.assign(Object.assign({}, props), { type: "tel" }));
154
+ const { inputStyle } = useFormFieldWrapperStyles({
155
+ size: props.size,
156
+ align: props.align,
157
+ placeholder: props.placeholder,
158
+ value: props.value,
159
+ invalid: props.invalid,
160
+ error: props.error,
161
+ disabled: props.disabled,
162
+ inline: props.inline,
163
+ type: "tel",
164
+ });
170
165
  const generatedId = useId();
171
166
  const id = props.id || generatedId;
172
167
  const { name } = useAtlantisFormFieldName({
@@ -186,25 +181,13 @@ const InputPhoneNumberRebuilt = forwardRef(function InputPhoneNumberInternal(_a,
186
181
  onEnter: props.onEnter,
187
182
  inputRef: inputPhoneNumberRef,
188
183
  });
189
- const { fieldProps, descriptionIdentifier } = useInputPhoneFormField({
190
- id,
191
- name,
192
- handleChange,
193
- handleBlur,
194
- handleFocus,
195
- handleKeyDown,
196
- autofocus: props.autoFocus,
197
- disabled: props.disabled,
198
- readonly: props.readonly,
199
- invalid: props.invalid,
200
- error: props.error,
201
- description: props.description,
202
- inline: props.inline,
203
- });
204
- return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, inline: props.inline, wrapperRef: wrapperRef, error: (_c = props.error) !== null && _c !== void 0 ? _c : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_d = props.clearable) !== null && _d !== void 0 ? _d : "never", onClear: handleClear, type: "tel", placeholder: props.placeholder, value: formattedValue, prefix: props.prefix, suffix: props.suffix, readonly: props.readonly, loading: props.loading },
205
- React__default.createElement("input", Object.assign({ type: "tel" }, fieldProps, { ref: inputPhoneNumberRef, className: classnames(inputStyle, {
184
+ const descriptionIdentifier = `descriptionUUID--${id}`;
185
+ const hasDescription = props.description && !props.inline;
186
+ const isInvalid = Boolean(props.error || props.invalid);
187
+ return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, inline: props.inline, wrapperRef: wrapperRef, error: (_c = props.error) !== null && _c !== void 0 ? _c : "", invalid: Boolean(props.error || props.invalid), identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, clearable: (_d = props.clearable) !== null && _d !== void 0 ? _d : "never", onClear: handleClear, type: "tel", placeholder: props.placeholder, value: formattedValue, prefix: props.prefix, suffix: props.suffix, readonly: props.readOnly, loading: props.loading },
188
+ React__default.createElement("input", { id: id, name: name, type: "tel", ref: inputPhoneNumberRef, className: classnames(inputStyle, {
206
189
  [styles.emptyValue]: inputValue.length === 0 && pattern[0] === "(",
207
- }), value: formattedValue })),
190
+ }), value: formattedValue, disabled: props.disabled, readOnly: props.readOnly, autoFocus: props.autoFocus, autoComplete: props.autoComplete, inputMode: props.inputMode, tabIndex: props.tabIndex, role: props.role, "aria-label": props.ariaLabel, "aria-describedby": hasDescription ? descriptionIdentifier : props.ariaDescribedBy, "aria-invalid": isInvalid ? true : undefined, "aria-controls": props.ariaControls, "aria-expanded": props.ariaExpanded, "aria-activedescendant": props.ariaActiveDescendant, "aria-autocomplete": props.ariaAutocomplete, "aria-required": props.ariaRequired, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown }),
208
191
  React__default.createElement(MaskElement, { isMasking: isMasking, formattedValue: formattedValue, placeholderMask: placeholderMask }),
209
192
  React__default.createElement(FormFieldPostFix, { variation: "spinner", visible: (_e = props.loading) !== null && _e !== void 0 ? _e : false })));
210
193
  });