@jobber/components 7.13.2 → 7.14.1-JOB-166755-2e6d91b.0

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 (77) hide show
  1. package/dist/Autocomplete/index.cjs +3 -2
  2. package/dist/Autocomplete/index.mjs +2 -1
  3. package/dist/Card/index.cjs +6 -3
  4. package/dist/Card/index.mjs +6 -3
  5. package/dist/DataDump/index.cjs +6 -3
  6. package/dist/DataDump/index.mjs +6 -3
  7. package/dist/DataList/components/DataListSearch/index.cjs +2 -1
  8. package/dist/DataList/components/DataListSearch/index.mjs +2 -1
  9. package/dist/DataList/index.cjs +2 -1
  10. package/dist/DataList/index.mjs +2 -1
  11. package/dist/DataTable/index.cjs +2 -1
  12. package/dist/DataTable/index.mjs +2 -1
  13. package/dist/DrawerRoot-es.js +2 -2
  14. package/dist/FormField/index.cjs +11 -10
  15. package/dist/FormField/index.mjs +2 -1
  16. package/dist/FormField-cjs.js +7 -6
  17. package/dist/FormField-es.js +2 -1
  18. package/dist/FormFieldPostFix-cjs.js +250 -0
  19. package/dist/FormFieldPostFix-es.js +238 -0
  20. package/dist/InputDate/index.cjs +2 -1
  21. package/dist/InputDate/index.mjs +2 -1
  22. package/dist/InputEmail/index.cjs +1 -0
  23. package/dist/InputEmail/index.mjs +1 -0
  24. package/dist/InputEmail-cjs.js +4 -3
  25. package/dist/InputEmail-es.js +2 -1
  26. package/dist/InputNumber/index.cjs +2 -1
  27. package/dist/InputNumber/index.mjs +2 -1
  28. package/dist/InputNumberExperimental-cjs.js +3 -4
  29. package/dist/InputNumberExperimental-es.js +3 -4
  30. package/dist/InputPassword/index.cjs +2 -1
  31. package/dist/InputPassword/index.mjs +2 -1
  32. package/dist/InputPhoneNumber/InputPhoneNumber.d.ts +2 -2
  33. package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +2 -20
  34. package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +2 -2
  35. package/dist/InputPhoneNumber/index.cjs +13 -250
  36. package/dist/InputPhoneNumber/index.d.ts +2 -5
  37. package/dist/InputPhoneNumber/index.mjs +12 -253
  38. package/dist/InputPhoneNumber-cjs.js +190 -0
  39. package/dist/InputPhoneNumber-es.js +188 -0
  40. package/dist/InputText/index.cjs +5 -4
  41. package/dist/InputText/index.mjs +2 -1
  42. package/dist/InputTime/index.cjs +4 -3
  43. package/dist/InputTime/index.mjs +2 -1
  44. package/dist/Menu/index.cjs +6 -3
  45. package/dist/Menu/index.mjs +6 -3
  46. package/dist/Menu-cjs.js +3 -1
  47. package/dist/Menu-es.js +3 -1
  48. package/dist/MenuSubmenuTrigger-cjs.js +16 -16
  49. package/dist/MenuSubmenuTrigger-es.js +3 -3
  50. package/dist/NumberFieldInput-cjs.js +252 -4
  51. package/dist/NumberFieldInput-es.js +249 -5
  52. package/dist/Page/index.cjs +5 -3
  53. package/dist/Page/index.mjs +5 -3
  54. package/dist/RecurringSelect/index.cjs +2 -1
  55. package/dist/RecurringSelect/index.mjs +2 -1
  56. package/dist/Select/index.cjs +2 -1
  57. package/dist/Select/index.mjs +2 -1
  58. package/dist/Select-cjs.js +5 -4
  59. package/dist/Select-es.js +2 -1
  60. package/dist/docs/InputPhoneNumber/InputPhoneNumber.md +40 -21
  61. package/dist/docs/usage-guidelines/usage-guidelines.md +7 -8
  62. package/dist/index.cjs +18 -15
  63. package/dist/index.mjs +8 -5
  64. package/dist/mergeRefs-cjs.js +0 -248
  65. package/dist/mergeRefs-es.js +1 -238
  66. package/dist/primitives/InputNumberExperimental/index.cjs +0 -1
  67. package/dist/primitives/InputNumberExperimental/index.mjs +0 -1
  68. package/dist/primitives/index.cjs +0 -1
  69. package/dist/primitives/index.mjs +0 -1
  70. package/dist/unstyledPrimitives/index.cjs +13 -14
  71. package/dist/unstyledPrimitives/index.mjs +3 -4
  72. package/dist/useRenderElement-es.js +1 -1
  73. package/dist/useValueChanged-es.js +2 -2
  74. package/package.json +5 -5
  75. package/dist/InputPhoneNumber/InputPhoneNumber.rebuilt.d.ts +0 -3
  76. package/dist/useBaseUiId-cjs.js +0 -275
  77. package/dist/useBaseUiId-es.js +0 -251
@@ -13,9 +13,10 @@ var Typography = require('../Typography-cjs.js');
13
13
  var Icon = require('../Icon-cjs.js');
14
14
  var Glimmer = require('../Glimmer-cjs.js');
15
15
  var InputText_index = require('../InputText/index.cjs');
16
- var mergeRefs = require('../mergeRefs-cjs.js');
16
+ var FormFieldPostFix = require('../FormFieldPostFix-cjs.js');
17
17
  var tslib_es6 = require('../tslib.es6-cjs.js');
18
18
  require('react-hook-form');
19
+ var mergeRefs = require('../mergeRefs-cjs.js');
19
20
  require('../Button-cjs.js');
20
21
  var filterDataAttributes = require('../filterDataAttributes-cjs.js');
21
22
  require('../floating-ui.utils.dom-cjs.js');
@@ -1302,7 +1303,7 @@ function MultipleSelectionLayout({ selectedValues, inputValue, disabled, error,
1302
1303
  }, []);
1303
1304
  return (React.createElement("div", { "data-testid": "ATL-AutocompleteRebuilt", onFocus: handleFocusIn, onBlur: handleFocusOut },
1304
1305
  React.createElement("div", { className: styles$1.multiSelectField, "data-testid": "ATL-AutocompleteRebuilt-multiSelectContainer" },
1305
- React.createElement(mergeRefs.FormFieldWrapper, { disabled: disabled, size: sizeProp ? sizeProp : undefined, error: (_a = error) !== null && _a !== void 0 ? _a : "", invalid: Boolean(error || invalid), identifier: inputId, descriptionIdentifier: descriptionId, description: description, clearable: clearable !== null && clearable !== void 0 ? clearable : "never", onClear: () => {
1306
+ React.createElement(FormFieldPostFix.FormFieldWrapper, { disabled: disabled, size: sizeProp ? sizeProp : undefined, error: (_a = error) !== null && _a !== void 0 ? _a : "", invalid: Boolean(error || invalid), identifier: inputId, descriptionIdentifier: descriptionId, description: description, clearable: clearable !== null && clearable !== void 0 ? clearable : "never", onClear: () => {
1306
1307
  var _a;
1307
1308
  clearAll();
1308
1309
  (_a = internalInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -11,9 +11,10 @@ import { T as Typography } from '../Typography-es.js';
11
11
  import { I as Icon } from '../Icon-es.js';
12
12
  import { G as Glimmer } from '../Glimmer-es.js';
13
13
  import { InputText } from '../InputText/index.mjs';
14
- import { m as mergeRefs, c as FormFieldWrapper } from '../mergeRefs-es.js';
14
+ import { c as FormFieldWrapper } from '../FormFieldPostFix-es.js';
15
15
  import { _ as __rest, a as __awaiter } from '../tslib.es6-es.js';
16
16
  import 'react-hook-form';
17
+ import { m as mergeRefs } from '../mergeRefs-es.js';
17
18
  import '../Button-es.js';
18
19
  import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
19
20
  import '../floating-ui.utils.dom-es.js';
@@ -22,13 +22,16 @@ require('../floating-ui.react-dom-cjs.js');
22
22
  require('../useFormFieldFocus-cjs.js');
23
23
  require('../maxHeight-cjs.js');
24
24
  require('../useRenderElement-cjs.js');
25
+ require('../OverlaySeparator-cjs.js');
26
+ require('../Separator-cjs.js');
25
27
  require('../BottomSheet-cjs.js');
26
28
  require('../DrawerRoot-cjs.js');
27
29
  require('../useValueChanged-cjs.js');
28
- require('../OverlaySeparator-cjs.js');
29
- require('../Separator-cjs.js');
30
+ require('../HelperText-cjs.js');
31
+ require('../Text-cjs.js');
32
+ require('../InputNumberExperimental-cjs.js');
33
+ require('../NumberFieldInput-cjs.js');
30
34
  require('../MenuSubmenuTrigger-cjs.js');
31
- require('../useBaseUiId-cjs.js');
32
35
 
33
36
 
34
37
 
@@ -20,10 +20,13 @@ import '../floating-ui.react-dom-es.js';
20
20
  import '../useFormFieldFocus-es.js';
21
21
  import '../maxHeight-es.js';
22
22
  import '../useRenderElement-es.js';
23
+ import '../OverlaySeparator-es.js';
24
+ import '../Separator-es.js';
23
25
  import '../BottomSheet-es.js';
24
26
  import '../DrawerRoot-es.js';
25
27
  import '../useValueChanged-es.js';
26
- import '../OverlaySeparator-es.js';
27
- import '../Separator-es.js';
28
+ import '../HelperText-es.js';
29
+ import '../Text-es.js';
30
+ import '../InputNumberExperimental-es.js';
31
+ import '../NumberFieldInput-es.js';
28
32
  import '../MenuSubmenuTrigger-es.js';
29
- import '../useBaseUiId-es.js';
@@ -23,13 +23,16 @@ require('../floating-ui.react-dom-cjs.js');
23
23
  require('../useFormFieldFocus-cjs.js');
24
24
  require('../maxHeight-cjs.js');
25
25
  require('../useRenderElement-cjs.js');
26
+ require('../OverlaySeparator-cjs.js');
27
+ require('../Separator-cjs.js');
26
28
  require('../BottomSheet-cjs.js');
27
29
  require('../DrawerRoot-cjs.js');
28
30
  require('../useValueChanged-cjs.js');
29
- require('../OverlaySeparator-cjs.js');
30
- require('../Separator-cjs.js');
31
+ require('../HelperText-cjs.js');
32
+ require('../Text-cjs.js');
33
+ require('../InputNumberExperimental-cjs.js');
34
+ require('../NumberFieldInput-cjs.js');
31
35
  require('../MenuSubmenuTrigger-cjs.js');
32
- require('../useBaseUiId-cjs.js');
33
36
  require('../Content-cjs.js');
34
37
  require('../Emphasis-cjs.js');
35
38
 
@@ -21,12 +21,15 @@ import '../floating-ui.react-dom-es.js';
21
21
  import '../useFormFieldFocus-es.js';
22
22
  import '../maxHeight-es.js';
23
23
  import '../useRenderElement-es.js';
24
+ import '../OverlaySeparator-es.js';
25
+ import '../Separator-es.js';
24
26
  import '../BottomSheet-es.js';
25
27
  import '../DrawerRoot-es.js';
26
28
  import '../useValueChanged-es.js';
27
- import '../OverlaySeparator-es.js';
28
- import '../Separator-es.js';
29
+ import '../HelperText-es.js';
30
+ import '../Text-es.js';
31
+ import '../InputNumberExperimental-es.js';
32
+ import '../NumberFieldInput-es.js';
29
33
  import '../MenuSubmenuTrigger-es.js';
30
- import '../useBaseUiId-es.js';
31
34
  import '../Content-es.js';
32
35
  import '../Emphasis-es.js';
@@ -7,7 +7,7 @@ require('@jobber/design');
7
7
  require('@jobber/hooks');
8
8
  require('../../../InputText/index.cjs');
9
9
  require('../../../FormField-cjs.js');
10
- require('../../../mergeRefs-cjs.js');
10
+ require('../../../FormFieldPostFix-cjs.js');
11
11
  require('framer-motion');
12
12
  require('../../../Button-cjs.js');
13
13
  require('../../../tslib.es6-cjs.js');
@@ -20,6 +20,7 @@ require('../../../InputValidation-cjs.js');
20
20
  require('../../../Spinner-cjs.js');
21
21
  require('../../../useAtlantisFormFieldName-cjs.js');
22
22
  require('react-hook-form');
23
+ require('../../../mergeRefs-cjs.js');
23
24
  require('../../../filterDataAttributes-cjs.js');
24
25
  require('../../../DataListContext-cjs.js');
25
26
  require('../../../noop-cjs.js');
@@ -5,7 +5,7 @@ import '@jobber/design';
5
5
  import '@jobber/hooks';
6
6
  import '../../../InputText/index.mjs';
7
7
  import '../../../FormField-es.js';
8
- import '../../../mergeRefs-es.js';
8
+ import '../../../FormFieldPostFix-es.js';
9
9
  import 'framer-motion';
10
10
  import '../../../Button-es.js';
11
11
  import '../../../tslib.es6-es.js';
@@ -18,6 +18,7 @@ import '../../../InputValidation-es.js';
18
18
  import '../../../Spinner-es.js';
19
19
  import '../../../useAtlantisFormFieldName-es.js';
20
20
  import 'react-hook-form';
21
+ import '../../../mergeRefs-es.js';
21
22
  import '../../../filterDataAttributes-es.js';
22
23
  import '../../../DataListContext-es.js';
23
24
  import '../../../noop-es.js';
@@ -82,11 +82,12 @@ require('../DataListStickyHeader-cjs.js');
82
82
  require('../DataListSearch-cjs.js');
83
83
  require('../InputText/index.cjs');
84
84
  require('../FormField-cjs.js');
85
- require('../mergeRefs-cjs.js');
85
+ require('../FormFieldPostFix-cjs.js');
86
86
  require('../useFormFieldFocus-cjs.js');
87
87
  require('../InputValidation-cjs.js');
88
88
  require('../useAtlantisFormFieldName-cjs.js');
89
89
  require('react-hook-form');
90
+ require('../mergeRefs-cjs.js');
90
91
  require('../DataListEmptyState-cjs.js');
91
92
  require('../DataListLoadMore-cjs.js');
92
93
  require('../DataListAction-cjs.js');
@@ -80,11 +80,12 @@ import '../DataListStickyHeader-es.js';
80
80
  import '../DataListSearch-es.js';
81
81
  import '../InputText/index.mjs';
82
82
  import '../FormField-es.js';
83
- import '../mergeRefs-es.js';
83
+ import '../FormFieldPostFix-es.js';
84
84
  import '../useFormFieldFocus-es.js';
85
85
  import '../InputValidation-es.js';
86
86
  import '../useAtlantisFormFieldName-es.js';
87
87
  import 'react-hook-form';
88
+ import '../mergeRefs-es.js';
88
89
  import '../DataListEmptyState-es.js';
89
90
  import '../DataListLoadMore-es.js';
90
91
  import '../DataListAction-es.js';
@@ -11,7 +11,7 @@ require('../Glimmer-cjs.js');
11
11
  require('../tslib.es6-cjs.js');
12
12
  require('../Content-cjs.js');
13
13
  require('../Select-cjs.js');
14
- require('../mergeRefs-cjs.js');
14
+ require('../FormFieldPostFix-cjs.js');
15
15
  require('framer-motion');
16
16
  require('@jobber/design');
17
17
  require('../Button-cjs.js');
@@ -24,6 +24,7 @@ require('../InputValidation-cjs.js');
24
24
  require('../Spinner-cjs.js');
25
25
  require('../useAtlantisFormFieldName-cjs.js');
26
26
  require('react-hook-form');
27
+ require('../mergeRefs-cjs.js');
27
28
  require('../filterDataAttributes-cjs.js');
28
29
 
29
30
 
@@ -9,7 +9,7 @@ import '../Glimmer-es.js';
9
9
  import '../tslib.es6-es.js';
10
10
  import '../Content-es.js';
11
11
  import '../Select-es.js';
12
- import '../mergeRefs-es.js';
12
+ import '../FormFieldPostFix-es.js';
13
13
  import 'framer-motion';
14
14
  import '@jobber/design';
15
15
  import '../Button-es.js';
@@ -22,4 +22,5 @@ import '../InputValidation-es.js';
22
22
  import '../Spinner-es.js';
23
23
  import '../useAtlantisFormFieldName-es.js';
24
24
  import 'react-hook-form';
25
+ import '../mergeRefs-es.js';
25
26
  import '../filterDataAttributes-es.js';
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { f as formatErrorMessage, u as useRenderElement, E as EMPTY_OBJECT, b as useRefWithInit, c as useMergedRefs, i as isReactVersionAtLeast, N as NOOP } from './useRenderElement-es.js';
4
- import { X as TransitionStatusDataAttributes, t as transitionStatusMapping, Y as isJSDOM, z as stopEvent, s as ownerDocument, u as useIsoLayoutEffect, I as isSafari, l as visuallyHidden, k as createChangeEventDetails, M as focusOut, b as useId, a as useStableCallback, i as useValueAsRef, c as useTimeout, D as useAnimationFrame, Z as resolveRef, K as triggerHover, Q as outsidePress, N as isVirtualClick, O as isVirtualPointerEvent, _ as isWebKit, $ as isReactEvent, J as escapeKey, F as triggerPress, T as Timeout, E as isClickLikeEvent, d as useTransitionStatus, e as useOpenChangeComplete, g as clamp, j as isIOS, a0 as AnimationFrame, y as useValueChanged, V as imperativeAction, h as useControlled, n as none, a1 as isAndroid, a2 as closeWatcher } from './useValueChanged-es.js';
3
+ import { f as formatErrorMessage, u as useRenderElement, E as EMPTY_OBJECT, a as useRefWithInit, c as useMergedRefs, i as isReactVersionAtLeast, N as NOOP } from './useRenderElement-es.js';
4
+ import { X as TransitionStatusDataAttributes, t as transitionStatusMapping, Y as isJSDOM, z as stopEvent, s as ownerDocument, c as useIsoLayoutEffect, I as isSafari, l as visuallyHidden, k as createChangeEventDetails, M as focusOut, e as useId, u as useStableCallback, i as useValueAsRef, a as useTimeout, D as useAnimationFrame, Z as resolveRef, K as triggerHover, Q as outsidePress, N as isVirtualClick, O as isVirtualPointerEvent, _ as isWebKit, $ as isReactEvent, J as escapeKey, F as triggerPress, T as Timeout, E as isClickLikeEvent, b as useTransitionStatus, d as useOpenChangeComplete, g as clamp, j as isIOS, a0 as AnimationFrame, y as useValueChanged, V as imperativeAction, h as useControlled, n as none, a1 as isAndroid, a2 as closeWatcher } from './useValueChanged-es.js';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
6
6
  import { f as floor, t as tabbable, i as isTabbable, a as focusable } from './index.esm-es.js';
7
7
  import { i as isShadowRoot, b as isElement, a as isHTMLElement, f as getComputedStyle$1, g as getNodeName, c as isNode, k as getWindow, j as isWebKit$1, d as isLastTraversableNode, e as getParentNode, o as isOverflowElement } from './floating-ui.utils.dom-es.js';
@@ -2,11 +2,12 @@
2
2
 
3
3
  var FormField = require('../FormField-cjs.js');
4
4
  var useAtlantisFormFieldName = require('../useAtlantisFormFieldName-cjs.js');
5
- var mergeRefs = require('../mergeRefs-cjs.js');
5
+ var FormFieldPostFix = require('../FormFieldPostFix-cjs.js');
6
6
  require('react');
7
7
  require('classnames');
8
8
  require('../tslib.es6-cjs.js');
9
9
  require('react-hook-form');
10
+ require('../mergeRefs-cjs.js');
10
11
  require('@jobber/hooks');
11
12
  require('framer-motion');
12
13
  require('@jobber/design');
@@ -26,12 +27,12 @@ exports.useAtlantisFormField = FormField.useAtlantisFormField;
26
27
  exports.useAtlantisFormFieldActions = FormField.useAtlantisFormFieldActions;
27
28
  exports.useAtlantisReactHookForm = FormField.useAtlantisReactHookForm;
28
29
  exports.useAtlantisFormFieldName = useAtlantisFormFieldName.useAtlantisFormFieldName;
29
- exports.AffixIcon = mergeRefs.AffixIcon;
30
- exports.AffixLabel = mergeRefs.AffixLabel;
31
- exports.FormFieldInputHorizontalWrapper = mergeRefs.FormFieldInputHorizontalWrapper;
32
- exports.FormFieldInputWrapperStyles = mergeRefs.FormFieldInputWrapperStyles;
33
- exports.FormFieldLabel = mergeRefs.FormFieldLabel;
34
- exports.FormFieldWrapper = mergeRefs.FormFieldWrapper;
35
- exports.FormFieldWrapperMain = mergeRefs.FormFieldWrapperMain;
36
- exports.FormFieldWrapperToolbar = mergeRefs.FormFieldWrapperToolbar;
37
- exports.useFormFieldWrapperStyles = mergeRefs.useFormFieldWrapperStyles;
30
+ exports.AffixIcon = FormFieldPostFix.AffixIcon;
31
+ exports.AffixLabel = FormFieldPostFix.AffixLabel;
32
+ exports.FormFieldInputHorizontalWrapper = FormFieldPostFix.FormFieldInputHorizontalWrapper;
33
+ exports.FormFieldInputWrapperStyles = FormFieldPostFix.FormFieldInputWrapperStyles;
34
+ exports.FormFieldLabel = FormFieldPostFix.FormFieldLabel;
35
+ exports.FormFieldWrapper = FormFieldPostFix.FormFieldWrapper;
36
+ exports.FormFieldWrapperMain = FormFieldPostFix.FormFieldWrapperMain;
37
+ exports.FormFieldWrapperToolbar = FormFieldPostFix.FormFieldWrapperToolbar;
38
+ exports.useFormFieldWrapperStyles = FormFieldPostFix.useFormFieldWrapperStyles;
@@ -1,10 +1,11 @@
1
1
  export { F as FormField, u as useAtlantisFormField, a as useAtlantisFormFieldActions, b as useAtlantisReactHookForm } from '../FormField-es.js';
2
2
  export { u as useAtlantisFormFieldName } from '../useAtlantisFormFieldName-es.js';
3
- export { A as AffixIcon, f as AffixLabel, F as FormFieldInputHorizontalWrapper, a as FormFieldInputWrapperStyles, b as FormFieldLabel, c as FormFieldWrapper, d as FormFieldWrapperMain, e as FormFieldWrapperToolbar, u as useFormFieldWrapperStyles } from '../mergeRefs-es.js';
3
+ export { A as AffixIcon, f as AffixLabel, F as FormFieldInputHorizontalWrapper, a as FormFieldInputWrapperStyles, b as FormFieldLabel, c as FormFieldWrapper, d as FormFieldWrapperMain, e as FormFieldWrapperToolbar, u as useFormFieldWrapperStyles } from '../FormFieldPostFix-es.js';
4
4
  import 'react';
5
5
  import 'classnames';
6
6
  import '../tslib.es6-es.js';
7
7
  import 'react-hook-form';
8
+ import '../mergeRefs-es.js';
8
9
  import '@jobber/hooks';
9
10
  import 'framer-motion';
10
11
  import '@jobber/design';
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var mergeRefs = require('./mergeRefs-cjs.js');
4
+ var FormFieldPostFix = require('./FormFieldPostFix-cjs.js');
5
5
  var classnames = require('classnames');
6
6
  var useAtlantisFormFieldName = require('./useAtlantisFormFieldName-cjs.js');
7
7
  var tslib_es6 = require('./tslib.es6-cjs.js');
8
8
  var reactHookForm = require('react-hook-form');
9
+ var mergeRefs = require('./mergeRefs-cjs.js');
9
10
 
10
11
  /**
11
12
  * Combines the actions from the props of the FormField with the actions from react-hook-form. This is used to
@@ -67,8 +68,8 @@ function useAtlantisFormFieldActions({ name, onChange, inputRef, onControllerCha
67
68
  */
68
69
  function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, pattern, type, value, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }) {
69
70
  const descriptionIdentifier = `descriptionUUID--${id}`;
70
- const fieldProps = Object.assign(Object.assign(Object.assign({}, useControllerField), { id, className: classnames(mergeRefs.formFieldStyles.input, {
71
- [mergeRefs.formFieldStyles.emptyPhoneNumber]: shouldAddPhoneNumberClass(type, value, pattern),
71
+ const fieldProps = Object.assign(Object.assign(Object.assign({}, useControllerField), { id, className: classnames(FormFieldPostFix.formFieldStyles.input, {
72
+ [FormFieldPostFix.formFieldStyles.emptyPhoneNumber]: shouldAddPhoneNumberClass(type, value, pattern),
72
73
  }), name: (validations || nameProp) && name, disabled: disabled, readOnly: readonly, inputMode: keyboard, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, autoFocus: autofocus }), (description &&
73
74
  !inline && { "aria-describedby": descriptionIdentifier }));
74
75
  const textFieldProps = Object.assign(Object.assign({}, fieldProps), { autoFocus: autofocus, onKeyDown: handleKeyDown });
@@ -174,19 +175,19 @@ function FormFieldInternal(props) {
174
175
  // Ensure focus tracking works by providing a wrapperRef when none is passed
175
176
  const internalWrapperRef = React.useRef(null);
176
177
  const wrapperRef = (_a = props.wrapperRef) !== null && _a !== void 0 ? _a : internalWrapperRef;
177
- return (React.createElement(mergeRefs.FormFieldWrapper, Object.assign({}, props, { value: useControllerField.value, error: errorMessage, identifier: id, descriptionIdentifier: descriptionIdentifier, clearable: clearable, onClear: handleClear, wrapperRef: wrapperRef }), renderField()));
178
+ return (React.createElement(FormFieldPostFix.FormFieldWrapper, Object.assign({}, props, { value: useControllerField.value, error: errorMessage, identifier: id, descriptionIdentifier: descriptionIdentifier, clearable: clearable, onClear: handleClear, wrapperRef: wrapperRef }), renderField()));
178
179
  function renderField() {
179
180
  switch (type) {
180
181
  case "select":
181
182
  return (React.createElement(React.Fragment, null,
182
183
  React.createElement("select", Object.assign({}, fieldProps), children),
183
- React.createElement(mergeRefs.FormFieldPostFix, { variation: "select" })));
184
+ React.createElement(FormFieldPostFix.FormFieldPostFix, { variation: "select" })));
184
185
  case "textarea":
185
186
  return React.createElement("textarea", Object.assign({}, textFieldProps, { rows: rows, ref: inputRefs }));
186
187
  default:
187
188
  return (React.createElement(React.Fragment, null,
188
189
  React.createElement("input", Object.assign({}, textFieldProps, { autoComplete: setAutocomplete(autocomplete), type: type, maxLength: maxLength, max: max, min: min, ref: inputRefs, onKeyUp: onKeyUp })),
189
- loading && React.createElement(mergeRefs.FormFieldPostFix, { variation: "spinner" }),
190
+ loading && React.createElement(FormFieldPostFix.FormFieldPostFix, { variation: "spinner" }),
190
191
  children));
191
192
  }
192
193
  }
@@ -1,9 +1,10 @@
1
1
  import React__default, { useEffect, useImperativeHandle, useId, useRef } from 'react';
2
- import { g as formFieldStyles, m as mergeRefs, c as FormFieldWrapper, h as FormFieldPostFix } from './mergeRefs-es.js';
2
+ import { g as formFieldStyles, c as FormFieldWrapper, h as FormFieldPostFix } from './FormFieldPostFix-es.js';
3
3
  import classnames from 'classnames';
4
4
  import { u as useAtlantisFormFieldName } from './useAtlantisFormFieldName-es.js';
5
5
  import { _ as __rest } from './tslib.es6-es.js';
6
6
  import { useFormContext, useForm, useController } from 'react-hook-form';
7
+ import { m as mergeRefs } from './mergeRefs-es.js';
7
8
 
8
9
  /**
9
10
  * Combines the actions from the props of the FormField with the actions from react-hook-form. This is used to
@@ -0,0 +1,250 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var jobberHooks = require('@jobber/hooks');
5
+ var framerMotion = require('framer-motion');
6
+ var design = require('@jobber/design');
7
+ var classnames = require('classnames');
8
+ var Button = require('./Button-cjs.js');
9
+ var Icon = require('./Icon-cjs.js');
10
+ var Text = require('./Text-cjs.js');
11
+ var useFormFieldFocus = require('./useFormFieldFocus-cjs.js');
12
+ var InputValidation = require('./InputValidation-cjs.js');
13
+ var Spinner = require('./Spinner-cjs.js');
14
+
15
+ var formFieldStyles = {"container":"YL-mNv-Bl6g-","wrapper":"_8lhbGTQ-hhg-","disabled":"Tz9LK9ABKMk-","horizontalWrapper":"b5mv1x1H7YE-","textarea":"hGr6YW4AeLM-","safari":"QBCWi9GBgMs-","timeInputLabel":"_0pmqVa2zSE4-","miniLabel":"F1t76G6bDKo-","large":"_9tjyT9QUtP8-","text":"QmMiyoAWp-g-","invalid":"XWDSfe6weSY-","small":"Sw5O4I0lMJg-","inline":"SaORbL7SYWY-","center":"ozy2UoT2vsg-","right":"_3TJdT91YD3c-","maxLength":"W6GrMqLy2qk-","inputWrapper":"-LmjnYRU0r0-","childrenWrapper":"yVXYv6hkuOA-","input":"vtSDcuzNr9Q-","emptyPhoneNumber":"MVhuQuzUBUs-","label":"Dgk00tzlODA-","select":"NwQGiWBWIsc-","externalLabel":"Qb8zQ8n-8vc-","postfix":"yTDzs9h1otI-","affixIcon":"m0YpdssD2dY-","suffix":"_-3mMnjSh6ok-","affixLabel":"-Wzcb0pBh5I-","description":"DHX5ijY3xIw-","toolbar":"AL-2brNI7dk-","spinning":"_8Rzv7CcDW80-"};
16
+
17
+ /**
18
+ * @internal Reach out to UX Foundations if using this component since it is possible it might change
19
+ */
20
+ function AffixLabel({ label, variation = "prefix", labelRef, }) {
21
+ const affixLabelClass = classnames(formFieldStyles.affixLabel, {
22
+ [formFieldStyles.suffix]: variation === "suffix",
23
+ });
24
+ if (!label)
25
+ return null;
26
+ return (React.createElement("div", { ref: labelRef, className: affixLabelClass }, label));
27
+ }
28
+ function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
29
+ const affixIconClass = classnames(formFieldStyles.affixIcon, {
30
+ [formFieldStyles.suffix]: variation === "suffix",
31
+ });
32
+ const iconSize = size === "small" ? "small" : "base";
33
+ if (!icon)
34
+ return null;
35
+ return (React.createElement("div", { className: affixIconClass }, onClick ? (React.createElement(Button.Button
36
+ /**
37
+ * We can cast the ariaLabel here as a `Suffix`
38
+ * requires an ariaLabel if there is an action
39
+ */
40
+ , {
41
+ /**
42
+ * We can cast the ariaLabel here as a `Suffix`
43
+ * requires an ariaLabel if there is an action
44
+ */
45
+ ariaLabel: ariaLabel, icon: icon, onClick: onClick, variation: "subtle", type: "tertiary", size: iconSize })) : (React.createElement(Icon.Icon, { name: icon, size: iconSize, color: "greyBlue" }))));
46
+ }
47
+
48
+ function FormFieldDescription({ id, description, visible = true, }) {
49
+ if (!visible)
50
+ return null;
51
+ const useStringFormat = !description || typeof description === "string";
52
+ return (React.createElement("div", { id: id, className: formFieldStyles.description }, useStringFormat ? (React.createElement(Text.Text, { size: "small", variation: "subdued" }, description)) : (description)));
53
+ }
54
+
55
+ var styles = {"clearInput":"YmRTd-KeXv4-","spinning":"B25z9B8I3gs-"};
56
+
57
+ function ClearAction({ onClick, visible, }) {
58
+ if (!visible)
59
+ return null;
60
+ return (React.createElement("button", { className: styles.clearInput, onClick: onClick, type: "button", "aria-label": "Clear input", "data-testid": "ATL-FormField-clearButton" },
61
+ React.createElement(Icon.Icon, { name: "remove", size: "small" })));
62
+ }
63
+
64
+ function useToolbar(props) {
65
+ const isToolbarVisible = props.toolbar !== undefined &&
66
+ (props.toolbarVisibility === "always" || props.focused);
67
+ const toolbarAnimationEnd = { opacity: 0, height: 0 };
68
+ const toolbarAnimationStart = { opacity: 1, height: "auto" };
69
+ return {
70
+ isToolbarVisible,
71
+ toolbarAnimationEnd,
72
+ toolbarAnimationStart,
73
+ };
74
+ }
75
+
76
+ function useIsSafari() {
77
+ return (globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator)
78
+ ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
79
+ : false;
80
+ }
81
+
82
+ /**
83
+ * Hook for getting the correct styles for the FormField and its children
84
+ */
85
+ function useFormFieldWrapperStyles({ size, align, placeholder, value, invalid, error, max, prefixRef, suffixRef, maxLength, type, disabled, inline, showMiniLabel = true, }) {
86
+ const isSafari = useIsSafari();
87
+ const wrapperClasses = classnames(formFieldStyles.wrapper, size && formFieldStyles[size], align && formFieldStyles[align], {
88
+ [formFieldStyles.miniLabel]: (showMiniLabel && placeholder && value !== "") ||
89
+ (placeholder && type === "select") ||
90
+ // Naively assume that if the the type is tel, it is the InputPhoneNumber
91
+ (placeholder && type === "tel"),
92
+ [formFieldStyles.text]: type === "textarea" || type === "text",
93
+ [formFieldStyles.textarea]: type === "textarea",
94
+ [formFieldStyles.safari]: isSafari && type === "textarea",
95
+ [formFieldStyles.select]: type === "select",
96
+ [formFieldStyles.invalid]: invalid !== null && invalid !== void 0 ? invalid : error,
97
+ [formFieldStyles.disabled]: disabled,
98
+ [formFieldStyles.maxLength]: maxLength,
99
+ [formFieldStyles.timeInputLabel]: placeholder && type === "time" && placeholder && value === "",
100
+ });
101
+ const containerClasses = classnames(formFieldStyles.container, {
102
+ [formFieldStyles.inline]: inline,
103
+ });
104
+ const wrapperInlineStyle = {
105
+ ["--formField-maxLength"]: maxLength || max,
106
+ };
107
+ const [labelStyle, setLabelStyle] = React.useState({
108
+ paddingLeft: undefined,
109
+ paddingRight: undefined,
110
+ });
111
+ React.useEffect(() => {
112
+ var _a, _b;
113
+ setLabelStyle(getAffixPaddding({
114
+ value,
115
+ type,
116
+ prefixWidth: ((_a = prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0,
117
+ suffixWidth: ((_b = suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current) === null || _b === void 0 ? void 0 : _b.offsetWidth) || 0,
118
+ }));
119
+ }, [value]);
120
+ return {
121
+ inputStyle: formFieldStyles.input,
122
+ wrapperClasses,
123
+ containerClasses,
124
+ wrapperInlineStyle,
125
+ labelStyle,
126
+ setLabelStyle,
127
+ };
128
+ }
129
+ function getAffixPaddding({ value, type, prefixWidth, suffixWidth, }) {
130
+ const hasValue = value !== "";
131
+ const newPadding = {
132
+ paddingLeft: undefined,
133
+ paddingRight: undefined,
134
+ };
135
+ // Naively assume that if the the type is tel, it is the InputPhoneNumber
136
+ if (type === "tel")
137
+ return newPadding;
138
+ if (prefixWidth && !hasValue) {
139
+ newPadding.paddingLeft = offset(prefixWidth);
140
+ }
141
+ if (suffixWidth && !hasValue) {
142
+ newPadding.paddingRight = offset(suffixWidth);
143
+ }
144
+ function offset(width) {
145
+ return `calc(${width}px + var(--space-smallest)`;
146
+ }
147
+ return newPadding;
148
+ }
149
+
150
+ function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, clearable, onClear, readonly, toolbar, toolbarVisibility = "while-editing", showMiniLabel = true, wrapperRef, }) {
151
+ const prefixRef = React.useRef(null);
152
+ const suffixRef = React.useRef(null);
153
+ const { wrapperClasses, containerClasses, wrapperInlineStyle, labelStyle } = useFormFieldWrapperStyles({
154
+ align,
155
+ max,
156
+ maxLength,
157
+ prefixRef,
158
+ suffixRef,
159
+ placeholder,
160
+ value,
161
+ invalid,
162
+ error,
163
+ type,
164
+ disabled,
165
+ inline,
166
+ size,
167
+ showMiniLabel,
168
+ });
169
+ const { focused } = useFormFieldFocus.useFormFieldFocus({ wrapperRef });
170
+ const showClear = jobberHooks.useShowClear({
171
+ clearable,
172
+ multiline: type === "textarea",
173
+ focused,
174
+ hasValue: Boolean(value),
175
+ disabled,
176
+ readonly,
177
+ });
178
+ const { isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart } = useToolbar({
179
+ focused,
180
+ toolbar,
181
+ toolbarVisibility,
182
+ });
183
+ return (React.createElement("div", { className: containerClasses },
184
+ React.createElement("div", { className: wrapperClasses, style: wrapperInlineStyle, "data-testid": "Form-Field-Wrapper", ref: wrapperRef },
185
+ React.createElement(FormFieldInputHorizontalWrapper, null,
186
+ React.createElement(AffixIcon, Object.assign({}, prefix, { size: size })),
187
+ React.createElement(FormFieldInputWrapperStyles, null,
188
+ (showMiniLabel || !value) && (React.createElement(FormFieldLabel, { htmlFor: identifier, style: (prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) || (suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current)
189
+ ? labelStyle
190
+ : undefined }, placeholder)),
191
+ React.createElement(AffixLabel, Object.assign({}, prefix, { labelRef: prefixRef })),
192
+ React.createElement(FormFieldWrapperMain, null, children),
193
+ React.createElement(AffixLabel, Object.assign({}, suffix, { labelRef: suffixRef, variation: "suffix" }))),
194
+ React.createElement(ClearAction, { onClick: onClear, visible: showClear }),
195
+ React.createElement(AffixIcon, Object.assign({}, suffix, { variation: "suffix", size: size }))),
196
+ React.createElement(FormFieldWrapperToolbar, { toolbarVisibility: toolbarVisibility, isToolbarVisible: isToolbarVisible, toolbarAnimationEnd: toolbarAnimationEnd, toolbarAnimationStart: toolbarAnimationStart, toolbar: toolbar })),
197
+ React.createElement(FormFieldDescription, { visible: !!description && !inline, id: descriptionIdentifier, description: description }),
198
+ React.createElement(InputValidation.InputValidation, { message: error, visible: !!error && !inline })));
199
+ }
200
+ /**
201
+ * @internal Reach out to UX Foundations if using this component since it is possible it might change
202
+ */
203
+ function FormFieldInputHorizontalWrapper({ children, }) {
204
+ return React.createElement("div", { className: formFieldStyles.horizontalWrapper }, children);
205
+ }
206
+ /**
207
+ * @internal Reach out to UX Foundations if using this component since it is possible it might change
208
+ */
209
+ function FormFieldInputWrapperStyles({ children, }) {
210
+ return React.createElement("div", { className: formFieldStyles.inputWrapper }, children);
211
+ }
212
+ /**
213
+ * @internal Reach out to UX Foundations if using this component since it is possible it might change
214
+ */
215
+ function FormFieldWrapperMain({ children, tabIndex = -1, }) {
216
+ return (React.createElement("div", { className: formFieldStyles.childrenWrapper, tabIndex: tabIndex }, children));
217
+ }
218
+ function FormFieldLabel({ children, htmlFor, style, external = false, }) {
219
+ if (!children)
220
+ return null;
221
+ return (React.createElement("label", { className: external ? formFieldStyles.externalLabel : formFieldStyles.label, htmlFor: htmlFor, style: style }, children));
222
+ }
223
+ /**
224
+ * @internal Reach out to UX Foundations if using this component since it is possible it might change
225
+ */
226
+ function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart, toolbarVisibility, }) {
227
+ return (React.createElement(framerMotion.AnimatePresence, { initial: toolbarVisibility === "always" ? false : true }, isToolbarVisible && (React.createElement(framerMotion.motion.div, { key: "toolbar", initial: toolbarAnimationEnd, animate: toolbarAnimationStart, exit: toolbarAnimationEnd, transition: {
228
+ duration: design.tokens["timing-base"] / 1000,
229
+ ease: "easeInOut",
230
+ }, tabIndex: -1 },
231
+ React.createElement("div", { className: formFieldStyles.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
232
+ }
233
+
234
+ function FormFieldPostFix({ variation, visible = true, className, }) {
235
+ if (!visible)
236
+ return null;
237
+ return (React.createElement("span", { className: classnames(formFieldStyles.postfix, className) }, variation === "select" ? (React.createElement(Icon.Icon, { name: "arrowDown" })) : (React.createElement(Spinner.Spinner, { size: "small" }))));
238
+ }
239
+
240
+ exports.AffixIcon = AffixIcon;
241
+ exports.AffixLabel = AffixLabel;
242
+ exports.FormFieldInputHorizontalWrapper = FormFieldInputHorizontalWrapper;
243
+ exports.FormFieldInputWrapperStyles = FormFieldInputWrapperStyles;
244
+ exports.FormFieldLabel = FormFieldLabel;
245
+ exports.FormFieldPostFix = FormFieldPostFix;
246
+ exports.FormFieldWrapper = FormFieldWrapper;
247
+ exports.FormFieldWrapperMain = FormFieldWrapperMain;
248
+ exports.FormFieldWrapperToolbar = FormFieldWrapperToolbar;
249
+ exports.formFieldStyles = formFieldStyles;
250
+ exports.useFormFieldWrapperStyles = useFormFieldWrapperStyles;