@jobber/components 6.104.0 → 6.104.1

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 (92) hide show
  1. package/dist/Autocomplete/Autocomplete.types.d.ts +9 -51
  2. package/dist/Autocomplete/index.cjs +10 -20
  3. package/dist/Autocomplete/index.mjs +10 -20
  4. package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +1 -1
  5. package/dist/Autocomplete/useAutocomplete.d.ts +2 -2
  6. package/dist/Checkbox/Checkbox.rebuilt.d.ts +1 -2
  7. package/dist/Checkbox/Checkbox.types.d.ts +3 -34
  8. package/dist/Checkbox/index.cjs +9 -2
  9. package/dist/Checkbox/index.mjs +9 -2
  10. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
  11. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
  12. package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
  13. package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
  14. package/dist/Chips/index.cjs +2 -2
  15. package/dist/Chips/index.mjs +2 -2
  16. package/dist/DataList/components/DataListHeader/index.cjs +1 -0
  17. package/dist/DataList/components/DataListHeader/index.mjs +1 -0
  18. package/dist/DataList/components/DataListItem/index.cjs +1 -0
  19. package/dist/DataList/components/DataListItem/index.mjs +1 -0
  20. package/dist/DataList/components/DataListItems/index.cjs +1 -0
  21. package/dist/DataList/components/DataListItems/index.mjs +1 -0
  22. package/dist/DataList/components/DataListLayout/index.cjs +1 -0
  23. package/dist/DataList/components/DataListLayout/index.mjs +1 -0
  24. package/dist/DataList/components/DataListSearch/index.cjs +2 -12
  25. package/dist/DataList/components/DataListSearch/index.mjs +2 -12
  26. package/dist/DataList/index.cjs +1 -8
  27. package/dist/DataList/index.mjs +1 -8
  28. package/dist/DataTable/index.cjs +3 -2
  29. package/dist/DataTable/index.mjs +3 -2
  30. package/dist/DatePicker/index.cjs +2 -2
  31. package/dist/DatePicker/index.mjs +2 -2
  32. package/dist/FormField/FormFieldTypes.d.ts +0 -2
  33. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +7 -2
  34. package/dist/FormField-cjs.js +0 -1
  35. package/dist/FormField-es.js +1 -1
  36. package/dist/InputDate/InputDate.types.d.ts +12 -7
  37. package/dist/InputDate/index.cjs +6 -9
  38. package/dist/InputDate/index.mjs +6 -9
  39. package/dist/InputDate/useInputDateActivatorActions.d.ts +4 -8
  40. package/dist/InputEmail/InputEmail.types.d.ts +10 -20
  41. package/dist/InputEmail/hooks/useInputEmailActions.d.ts +4 -3
  42. package/dist/InputEmail/index.cjs +18 -49
  43. package/dist/InputEmail/index.mjs +18 -49
  44. package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +7 -15
  45. package/dist/InputNumber/index.cjs +6 -4
  46. package/dist/InputNumber/index.mjs +6 -4
  47. package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +12 -28
  48. package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
  49. package/dist/InputPhoneNumber/index.cjs +20 -34
  50. package/dist/InputPhoneNumber/index.mjs +20 -34
  51. package/dist/InputText/InputText.types.d.ts +31 -25
  52. package/dist/InputText/index.cjs +41 -62
  53. package/dist/InputText/index.mjs +42 -63
  54. package/dist/InputText/useInputTextActions.d.ts +4 -3
  55. package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
  56. package/dist/InputTime/InputTime.types.d.ts +13 -4
  57. package/dist/InputTime/hooks/useInputTimeActions.d.ts +16 -0
  58. package/dist/InputTime/index.cjs +66 -30
  59. package/dist/InputTime/index.mjs +69 -33
  60. package/dist/List/index.cjs +2 -2
  61. package/dist/List/index.mjs +2 -2
  62. package/dist/MultiSelect/index.cjs +1 -0
  63. package/dist/MultiSelect/index.mjs +1 -0
  64. package/dist/RecurringSelect/index.cjs +3 -2
  65. package/dist/RecurringSelect/index.mjs +3 -2
  66. package/dist/Select/Select.types.d.ts +7 -3
  67. package/dist/Select/hooks/useSelectActions.d.ts +5 -5
  68. package/dist/Select/index.cjs +27 -41
  69. package/dist/Select/index.mjs +29 -43
  70. package/dist/Tabs-es.js +1 -1
  71. package/dist/_baseEach-cjs.js +12 -12
  72. package/dist/_baseEach-es.js +1 -1
  73. package/dist/_baseFlatten-cjs.js +2 -2
  74. package/dist/_baseFlatten-es.js +1 -1
  75. package/dist/{_baseGet-cjs.js → _getAllKeys-cjs.js} +181 -181
  76. package/dist/{_baseGet-es.js → _getAllKeys-es.js} +182 -182
  77. package/dist/debounce-es.js +1 -1
  78. package/dist/filterDataAttributes-cjs.js +26 -0
  79. package/dist/filterDataAttributes-es.js +24 -0
  80. package/dist/index.cjs +3 -2
  81. package/dist/index.mjs +3 -2
  82. package/dist/omit-cjs.js +14 -14
  83. package/dist/omit-es.js +1 -1
  84. package/dist/sharedHelpers/filterDataAttributes.d.ts +17 -0
  85. package/dist/sharedHelpers/types.d.ts +205 -0
  86. package/dist/useScrollToActive-cjs.js +3 -3
  87. package/dist/useScrollToActive-es.js +2 -2
  88. package/package.json +2 -2
  89. package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +0 -32
  90. package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +0 -71
  91. package/dist/InputText/useInputTextFormField.d.ts +0 -366
  92. package/dist/Select/hooks/useSelectFormField.d.ts +0 -34
@@ -16,19 +16,9 @@ import '../../../useFormFieldFocus-es.js';
16
16
  import '../../../InputValidation-es.js';
17
17
  import '../../../Spinner-es.js';
18
18
  import 'react-hook-form';
19
- import '../../../omit-es.js';
20
- import '../../../_commonjsHelpers-es.js';
21
- import '../../../_baseGet-es.js';
22
- import '../../../isTypedArray-es.js';
23
- import '../../../isObjectLike-es.js';
24
- import '../../../identity-es.js';
25
- import '../../../_getTag-es.js';
26
- import '../../../isSymbol-es.js';
27
- import '../../../keysIn-es.js';
28
- import '../../../_baseAssignValue-es.js';
29
- import '../../../_baseFlatten-es.js';
30
- import '../../../_setToString-es.js';
19
+ import '../../../filterDataAttributes-es.js';
31
20
  import '../../../DataListContext-es.js';
32
21
  import '../../../noop-es.js';
22
+ import '../../../_commonjsHelpers-es.js';
33
23
  import '../../../DataList.const-es.js';
34
24
  import '../../../AnimatedSwitcher-es.js';
@@ -48,6 +48,7 @@ require('../DataListItemActionsOverflow-cjs.js');
48
48
  require('../DataListActionsMenu-cjs.js');
49
49
  require('../Checkbox/index.cjs');
50
50
  require('react-hook-form');
51
+ require('../filterDataAttributes-cjs.js');
51
52
  require('../useBatchSelect-cjs.js');
52
53
  require('../DataListItemClickable-cjs.js');
53
54
  require('../DataListHeader-cjs.js');
@@ -81,14 +82,6 @@ require('../InputText/index.cjs');
81
82
  require('../FormField-cjs.js');
82
83
  require('../useFormFieldFocus-cjs.js');
83
84
  require('../InputValidation-cjs.js');
84
- require('../omit-cjs.js');
85
- require('../_baseGet-cjs.js');
86
- require('../identity-cjs.js');
87
- require('../isSymbol-cjs.js');
88
- require('../keysIn-cjs.js');
89
- require('../_baseAssignValue-cjs.js');
90
- require('../_baseFlatten-cjs.js');
91
- require('../_setToString-cjs.js');
92
85
  require('../DataListEmptyState-cjs.js');
93
86
  require('../DataListLoadMore-cjs.js');
94
87
  require('../DataListAction-cjs.js');
@@ -46,6 +46,7 @@ import '../DataListItemActionsOverflow-es.js';
46
46
  import '../DataListActionsMenu-es.js';
47
47
  import '../Checkbox/index.mjs';
48
48
  import 'react-hook-form';
49
+ import '../filterDataAttributes-es.js';
49
50
  import '../useBatchSelect-es.js';
50
51
  import '../DataListItemClickable-es.js';
51
52
  import '../DataListHeader-es.js';
@@ -79,14 +80,6 @@ import '../InputText/index.mjs';
79
80
  import '../FormField-es.js';
80
81
  import '../useFormFieldFocus-es.js';
81
82
  import '../InputValidation-es.js';
82
- import '../omit-es.js';
83
- import '../_baseGet-es.js';
84
- import '../identity-es.js';
85
- import '../isSymbol-es.js';
86
- import '../keysIn-es.js';
87
- import '../_baseAssignValue-es.js';
88
- import '../_baseFlatten-es.js';
89
- import '../_setToString-es.js';
90
83
  import '../DataListEmptyState-es.js';
91
84
  import '../DataListLoadMore-es.js';
92
85
  import '../DataListAction-es.js';
@@ -13,12 +13,12 @@ require('../Content-cjs.js');
13
13
  require('../Select/index.cjs');
14
14
  require('../omit-cjs.js');
15
15
  require('../_commonjsHelpers-cjs.js');
16
- require('../_baseGet-cjs.js');
16
+ require('../_getAllKeys-cjs.js');
17
17
  require('../isTypedArray-cjs.js');
18
18
  require('../isObjectLike-cjs.js');
19
+ require('../isSymbol-cjs.js');
19
20
  require('../identity-cjs.js');
20
21
  require('../_getTag-cjs.js');
21
- require('../isSymbol-cjs.js');
22
22
  require('../keysIn-cjs.js');
23
23
  require('../_baseAssignValue-cjs.js');
24
24
  require('../_baseFlatten-cjs.js');
@@ -35,6 +35,7 @@ require('../useFormFieldFocus-cjs.js');
35
35
  require('../InputValidation-cjs.js');
36
36
  require('../Spinner-cjs.js');
37
37
  require('react-hook-form');
38
+ require('../filterDataAttributes-cjs.js');
38
39
 
39
40
 
40
41
 
@@ -11,12 +11,12 @@ import '../Content-es.js';
11
11
  import '../Select/index.mjs';
12
12
  import '../omit-es.js';
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';
@@ -33,3 +33,4 @@ import '../useFormFieldFocus-es.js';
33
33
  import '../InputValidation-es.js';
34
34
  import '../Spinner-es.js';
35
35
  import 'react-hook-form';
36
+ import '../filterDataAttributes-es.js';
@@ -16,12 +16,12 @@ require('../Icon-cjs.js');
16
16
  require('@jobber/design');
17
17
  require('../omit-cjs.js');
18
18
  require('../_commonjsHelpers-cjs.js');
19
- require('../_baseGet-cjs.js');
19
+ require('../_getAllKeys-cjs.js');
20
20
  require('../isTypedArray-cjs.js');
21
21
  require('../isObjectLike-cjs.js');
22
+ require('../isSymbol-cjs.js');
22
23
  require('../identity-cjs.js');
23
24
  require('../_getTag-cjs.js');
24
- require('../isSymbol-cjs.js');
25
25
  require('../keysIn-cjs.js');
26
26
  require('../_baseAssignValue-cjs.js');
27
27
  require('../_baseFlatten-cjs.js');
@@ -14,12 +14,12 @@ import '../Icon-es.js';
14
14
  import '@jobber/design';
15
15
  import '../omit-es.js';
16
16
  import '../_commonjsHelpers-es.js';
17
- import '../_baseGet-es.js';
17
+ import '../_getAllKeys-es.js';
18
18
  import '../isTypedArray-es.js';
19
19
  import '../isObjectLike-es.js';
20
+ import '../isSymbol-es.js';
20
21
  import '../identity-es.js';
21
22
  import '../_getTag-es.js';
22
- import '../isSymbol-es.js';
23
23
  import '../keysIn-es.js';
24
24
  import '../_baseAssignValue-es.js';
25
25
  import '../_baseFlatten-es.js';
@@ -158,8 +158,6 @@ export interface FormFieldProps extends CommonFormFieldProps {
158
158
  */
159
159
  readonly suffix?: XOR<Affix, Suffix>;
160
160
  /**
161
- * Simplified onChange handler that only provides the new value.
162
- * @param newValue
163
161
  * Specifies the minimum numerical or date value that a user can type
164
162
  */
165
163
  readonly min?: number;
@@ -1,7 +1,12 @@
1
1
  import type { RefObject } from "react";
2
2
  import type { FormFieldProps } from "../FormFieldTypes";
3
- export interface useFormFieldWrapperStylesProps extends Pick<FormFieldProps, "size" | "align" | "placeholder" | "value" | "invalid" | "max" | "maxLength" | "type" | "disabled" | "inline"> {
3
+ export interface useFormFieldWrapperStylesProps extends Pick<FormFieldProps, "size" | "align" | "placeholder" | "value" | "invalid" | "maxLength" | "type" | "disabled" | "inline"> {
4
4
  readonly error?: string;
5
+ /**
6
+ * Maximum numerical or date value
7
+ * In v2 components, this is typically undefined.
8
+ */
9
+ readonly max?: number | string;
5
10
  suffixRef?: RefObject<HTMLDivElement | null>;
6
11
  prefixRef?: RefObject<HTMLDivElement | null>;
7
12
  showMiniLabel?: boolean;
@@ -18,7 +23,7 @@ export declare function useFormFieldWrapperStyles({ size, align, placeholder, va
18
23
  wrapperClasses: string;
19
24
  containerClasses: string;
20
25
  wrapperInlineStyle: {
21
- [x: string]: number | undefined;
26
+ [x: string]: string | number | undefined;
22
27
  };
23
28
  labelStyle: LabelPadding;
24
29
  setLabelStyle: import("react").Dispatch<import("react").SetStateAction<LabelPadding>>;
@@ -471,7 +471,6 @@ exports.FormFieldWrapper = FormFieldWrapper;
471
471
  exports.FormFieldWrapperMain = FormFieldWrapperMain;
472
472
  exports.FormFieldWrapperToolbar = FormFieldWrapperToolbar;
473
473
  exports.mergeRefs = mergeRefs;
474
- exports.styles = styles$1;
475
474
  exports.useAtlantisFormField = useAtlantisFormField;
476
475
  exports.useAtlantisFormFieldActions = useAtlantisFormFieldActions;
477
476
  exports.useAtlantisFormFieldName = useAtlantisFormFieldName;
@@ -458,4 +458,4 @@ function setAutocomplete(autocompleteSetting) {
458
458
  return autocompleteSetting;
459
459
  }
460
460
 
461
- export { AffixIcon as A, FormFieldInputHorizontalWrapper as F, useAtlantisFormFieldActions as a, useAtlantisFormFieldName as b, useAtlantisReactHookForm as c, FormFieldInputWrapperStyles as d, FormFieldLabel as e, FormFieldWrapper as f, FormFieldWrapperMain as g, FormFieldWrapperToolbar as h, AffixLabel as i, useFormFieldWrapperStyles as j, FormField as k, FormFieldPostFix as l, mergeRefs as m, styles$1 as s, useAtlantisFormField as u };
461
+ export { AffixIcon as A, FormFieldInputHorizontalWrapper as F, useAtlantisFormFieldActions as a, useAtlantisFormFieldName as b, useAtlantisReactHookForm as c, FormFieldInputWrapperStyles as d, FormFieldLabel as e, FormFieldWrapper as f, FormFieldWrapperMain as g, FormFieldWrapperToolbar as h, AffixLabel as i, useFormFieldWrapperStyles as j, FormField as k, FormFieldPostFix as l, mergeRefs as m, useAtlantisFormField as u };
@@ -1,11 +1,21 @@
1
1
  import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
2
- import type { InputTextRebuiltProps } from "../InputText/InputText.types";
3
- export interface InputDateRebuiltProps extends Omit<InputTextRebuiltProps, "clearable" | "onChange" | "value" | "prefix" | "suffix" | "multiline" | "rows" | "type" | "version"> {
2
+ import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
3
+ export interface InputDateRebuiltProps extends HTMLInputBaseProps, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix"> {
4
4
  /**
5
5
  * A Date object value
6
6
  * (e.g., `new Date("11/11/2011")`)
7
7
  * */
8
8
  readonly value?: Date;
9
+ /**
10
+ * Callback for value changes.
11
+ * @param newValue - The new Date value
12
+ * @param event - Optional change event
13
+ */
14
+ readonly onChange: (newValue: Date, event?: React.ChangeEvent<HTMLInputElement>) => void;
15
+ /**
16
+ * @deprecated Use `onKeyDown` or `onKeyUp` instead.
17
+ */
18
+ readonly onEnter?: FormFieldProps["onEnter"];
9
19
  /**
10
20
  * The maximum selectable date.
11
21
  */
@@ -23,11 +33,6 @@ export interface InputDateRebuiltProps extends Omit<InputTextRebuiltProps, "clea
23
33
  * Text to display instead of a date value
24
34
  */
25
35
  readonly emptyValueLabel?: string;
26
- /**
27
- * Version 2 is highly experimental, avoid using it unless you have talked with Atlantis first.
28
- */
29
- readonly version: 2;
30
- readonly onChange: (newValue: Date, event?: React.ChangeEvent<HTMLInputElement>) => void;
31
36
  }
32
37
  export interface InputDateProps extends Omit<CommonFormFieldProps, "clearable">, Pick<FormFieldProps, "readonly" | "disabled" | "onEnter" | "onFocus" | "inputRef" | "validations" | "placeholder" | "onChange" | "onBlur"> {
33
38
  /**
@@ -13,12 +13,12 @@ require('../Button-cjs.js');
13
13
  var DatePicker = require('../DatePicker-cjs.js');
14
14
  var InputText_index = require('../InputText/index.cjs');
15
15
  require('../_commonjsHelpers-cjs.js');
16
- require('../_baseGet-cjs.js');
16
+ require('../_getAllKeys-cjs.js');
17
17
  require('../isTypedArray-cjs.js');
18
18
  require('../isObjectLike-cjs.js');
19
+ require('../isSymbol-cjs.js');
19
20
  require('../identity-cjs.js');
20
21
  require('../_getTag-cjs.js');
21
- require('../isSymbol-cjs.js');
22
22
  require('../keysIn-cjs.js');
23
23
  require('../_baseAssignValue-cjs.js');
24
24
  require('../_baseFlatten-cjs.js');
@@ -35,6 +35,7 @@ require('../floating-ui.react-cjs.js');
35
35
  require('react/jsx-runtime');
36
36
  require('react-dom');
37
37
  require('../AtlantisContext-cjs.js');
38
+ require('../filterDataAttributes-cjs.js');
38
39
 
39
40
  function InputDate$1(inputProps) {
40
41
  const formFieldActionsRef = React.useRef(null);
@@ -79,13 +80,9 @@ function InputDate$1(inputProps) {
79
80
  } }));
80
81
  }
81
82
 
82
- /**
83
- * Combines the actions on the InputDate such as onChange, onFocus, onBlur to forward event handler passed to the InputDate component to the DatePicker component.
84
- * 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.
85
- */
86
83
  function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
87
84
  const [isFocused, setIsFocused] = React.useState(false);
88
- function handleChange(_, event) {
85
+ function handleChange(_newValue, event) {
89
86
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
90
87
  }
91
88
  function handleFocus(event) {
@@ -93,8 +90,8 @@ function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
93
90
  setIsFocused(true);
94
91
  }
95
92
  function handleBlur(event) {
96
- setIsFocused(false);
97
93
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
94
+ setIsFocused(false);
98
95
  }
99
96
  return {
100
97
  handleBlur,
@@ -135,7 +132,7 @@ const InputDateRebuilt = React.forwardRef((props, forwardedRef) => {
135
132
  return (
136
133
  // 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
137
134
  React.createElement("div", { onClick: onClick },
138
- React.createElement(InputText_index.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 => {
135
+ React.createElement(InputText_index.InputText, { "aria-describedby": activatorProps.ariaDescribedBy, "aria-labelledby": activatorProps.ariaLabelledBy, "aria-required": activatorProps.ariaRequired === "true" ? true : false, autoFocus: props.autoFocus, 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 => {
139
136
  var _a, _b;
140
137
  if (props.showIcon === false && event.key === "ArrowDown") {
141
138
  (_a = activatorProps.onClick) === null || _a === void 0 ? void 0 : _a.call(activatorProps);
@@ -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';
@@ -33,6 +33,7 @@ import '../floating-ui.react-es.js';
33
33
  import 'react/jsx-runtime';
34
34
  import 'react-dom';
35
35
  import '../AtlantisContext-es.js';
36
+ import '../filterDataAttributes-es.js';
36
37
 
37
38
  function InputDate$1(inputProps) {
38
39
  const formFieldActionsRef = useRef(null);
@@ -77,13 +78,9 @@ function InputDate$1(inputProps) {
77
78
  } }));
78
79
  }
79
80
 
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
81
  function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
85
82
  const [isFocused, setIsFocused] = useState(false);
86
- function handleChange(_, event) {
83
+ function handleChange(_newValue, event) {
87
84
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
88
85
  }
89
86
  function handleFocus(event) {
@@ -91,8 +88,8 @@ function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
91
88
  setIsFocused(true);
92
89
  }
93
90
  function handleBlur(event) {
94
- setIsFocused(false);
95
91
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
92
+ setIsFocused(false);
96
93
  }
97
94
  return {
98
95
  handleBlur,
@@ -133,7 +130,7 @@ const InputDateRebuilt = forwardRef((props, forwardedRef) => {
133
130
  return (
134
131
  // 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
132
  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 => {
133
+ React__default.createElement(InputText, { "aria-describedby": activatorProps.ariaDescribedBy, "aria-labelledby": activatorProps.ariaLabelledBy, "aria-required": activatorProps.ariaRequired === "true" ? true : false, autoFocus: props.autoFocus, 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
134
  var _a, _b;
138
135
  if (props.showIcon === false && event.key === "ArrowDown") {
139
136
  (_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, 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,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 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 {
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
+ * @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,13 @@
1
1
  import type { ChangeEvent, FocusEvent, KeyboardEvent } 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"> {
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, }: 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?: FocusEvent) => void;
12
+ handleBlur: (event: FocusEvent<HTMLInputElement>) => void;
12
13
  };
@@ -3,13 +3,13 @@
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');
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, }) {
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,28 +62,23 @@ 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
+ }
77
68
  return {
78
69
  handleClear,
79
70
  handleChange,
80
71
  handleKeyDown,
72
+ handleKeyUp,
81
73
  handleFocus,
82
74
  handleBlur,
83
75
  };
84
76
  }
85
77
 
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
78
  const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, ref) {
97
79
  var _a, _b, _c;
98
- const id = React.useId();
80
+ const generatedId = React.useId();
81
+ const id = props.id || generatedId;
99
82
  const inputRef = (_a = ref) !== null && _a !== void 0 ? _a : React.useRef(null);
100
83
  const wrapperRef = React.useRef(null);
101
84
  const { inputStyle } = FormField.useFormFieldWrapperStyles({
@@ -106,7 +89,6 @@ const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, re
106
89
  value: props.value,
107
90
  invalid: props.invalid,
108
91
  error: props.error,
109
- maxLength: props.maxLength,
110
92
  disabled: props.disabled,
111
93
  placeholder: props.placeholder,
112
94
  });
@@ -114,35 +96,22 @@ const InputEmailRebuilt = React.forwardRef(function InputEmailInternal(props, re
114
96
  nameProp: props.name,
115
97
  id,
116
98
  });
117
- const { handleChange, handleBlur, handleFocus, handleKeyDown, handleClear } = useInputEmailActions({
99
+ const { handleChange, handleBlur, handleFocus, handleKeyDown, handleKeyUp, handleClear, } = useInputEmailActions({
118
100
  onChange: props.onChange,
119
101
  onBlur: props.onBlur,
120
102
  onFocus: props.onFocus,
121
103
  onKeyDown: props.onKeyDown,
104
+ onKeyUp: props.onKeyUp,
122
105
  onEnter: props.onEnter,
123
106
  inputRef,
124
107
  });
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" })),
144
- React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false }),
145
- props.children));
108
+ const descriptionIdentifier = `descriptionUUID--${id}`;
109
+ const descriptionVisible = props.description && !props.inline;
110
+ const isInvalid = Boolean(props.error || props.invalid);
111
+ const dataAttrs = filterDataAttributes.filterDataAttributes(props);
112
+ 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, disabled: props.disabled, type: "email", value: props.value, placeholder: props.placeholder, name: name },
113
+ React.createElement("input", Object.assign({ 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, 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, "data-testid": "ATL-InputEmail-input" }, dataAttrs)),
114
+ React.createElement(FormField.FormFieldPostFix, { variation: "spinner", visible: (_c = props.loading) !== null && _c !== void 0 ? _c : false })));
146
115
  });
147
116
 
148
117
  function isNewInputEmailProps(props) {