@jobber/components 8.2.0 → 8.3.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 (38) hide show
  1. package/dist/Autocomplete/Autocomplete.d.ts +2 -3
  2. package/dist/Autocomplete/Autocomplete.types.d.ts +4 -9
  3. package/dist/Autocomplete/index.cjs +7 -8
  4. package/dist/Autocomplete/index.d.ts +3 -4
  5. package/dist/Autocomplete/index.mjs +6 -7
  6. package/dist/DataList/components/DataListSearch/index.cjs +1 -2
  7. package/dist/DataList/components/DataListSearch/index.mjs +1 -2
  8. package/dist/DataList/index.cjs +1 -2
  9. package/dist/DataList/index.mjs +1 -2
  10. package/dist/DataListSearch-cjs.js +12 -6
  11. package/dist/DataListSearch-es.js +11 -5
  12. package/dist/InputDate/index.cjs +1 -2
  13. package/dist/InputDate/index.mjs +1 -2
  14. package/dist/InputDate-cjs.js +2 -2
  15. package/dist/InputDate-es.js +2 -2
  16. package/dist/InputText/InputText.d.ts +2 -70
  17. package/dist/InputText/InputText.types.d.ts +2 -30
  18. package/dist/InputText/index.cjs +12 -268
  19. package/dist/InputText/index.d.ts +2 -5
  20. package/dist/InputText/index.mjs +11 -271
  21. package/dist/InputText/useInputTextActions.d.ts +2 -2
  22. package/dist/InputText-cjs.js +199 -0
  23. package/dist/InputText-es.js +197 -0
  24. package/dist/docs/Autocomplete/AutocompleteV1.md +1 -2
  25. package/dist/docs/Autocomplete/AutocompleteV2.md +1 -1
  26. package/dist/docs/Banner/Banner.md +2 -2
  27. package/dist/docs/Box/Box.md +2 -2
  28. package/dist/docs/Glimmer/Glimmer.md +1 -1
  29. package/dist/docs/Icon/Icon.md +1 -1
  30. package/dist/docs/InputText/InputText.md +152 -106
  31. package/dist/docs/Menu/Menu.md +1 -1
  32. package/dist/docs/Modal/Modal.md +1 -1
  33. package/dist/docs/Stack/Stack.md +1 -1
  34. package/dist/docs/usage-guidelines/usage-guidelines.md +0 -2
  35. package/dist/index.cjs +2 -2
  36. package/dist/index.mjs +1 -1
  37. package/package.json +2 -2
  38. package/dist/InputText/InputText.rebuilt.d.ts +0 -3
@@ -1,7 +1,6 @@
1
1
  import type { Ref, RefAttributes } from "react";
2
2
  import React from "react";
3
3
  import { type AnyOption, type AutocompleteLegacyProps, type Option } from "./Autocomplete.types";
4
- import type { InputTextRef } from "../InputText";
5
- declare function AutocompleteInternal<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>({ initialOptions, value, allowFreeForm, size, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, validations, customRenderMenu, ...inputProps }: AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>, ref: Ref<InputTextRef>): React.JSX.Element;
6
- export declare const Autocomplete: <GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>(props: AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue> & RefAttributes<InputTextRef>) => ReturnType<typeof AutocompleteInternal>;
4
+ declare function AutocompleteInternal<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>({ initialOptions, value, allowFreeForm, size, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, customRenderMenu, ...inputProps }: AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>, ref: Ref<HTMLInputElement>): React.JSX.Element;
5
+ export declare const Autocomplete: <GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>(props: AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue> & RefAttributes<HTMLInputElement>) => ReturnType<typeof AutocompleteInternal>;
7
6
  export {};
@@ -3,7 +3,7 @@ import type { UseAutocompleteListNavReturn } from "./hooks/useAutocompleteListNa
3
3
  import type { createInteractionPointerDownHandler } from "./utils/interactionUtils";
4
4
  import type { AriaInputProps, FocusEvents, HTMLInputBaseProps, RebuiltInputCommonProps } from "../sharedHelpers/types";
5
5
  import type { FormFieldProps } from "../FormField";
6
- import type { InputTextRebuiltProps, InputTextRef } from "../InputText";
6
+ import type { InputTextProps } from "../InputText";
7
7
  /**
8
8
  * ARIA attributes for Autocomplete with managed/orchestrated behavior.
9
9
  * Certain ARIA attributes are controlled internally by Autocomplete's
@@ -94,10 +94,6 @@ export interface AutocompleteLegacyProps<GenericOption extends AnyOption = AnyOp
94
94
  * @param newInputText
95
95
  */
96
96
  readonly getOptions: (newInputText: string) => Array<GenericGetOptionsValue | GenericOption> | Promise<Array<GenericGetOptionsValue | GenericOption>>;
97
- /**
98
- * Validations to run on the input.
99
- */
100
- readonly validations?: FormFieldProps["validations"];
101
97
  }
102
98
  export type AutocompleteProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> = AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>;
103
99
  export type CustomOptionsMenuType<GenericOption extends AnyOption = AnyOption> = (props: CustomOptionsMenuProp<GenericOption>) => React.ReactElement;
@@ -112,7 +108,7 @@ export interface MenuProps<GenericOption extends AnyOption = AnyOption, GenericO
112
108
  /**
113
109
  * Ref to the TextInput element.
114
110
  */
115
- readonly inputRef: RefObject<InputTextRef | null>;
111
+ readonly inputRef: RefObject<HTMLInputElement | null>;
116
112
  onOptionSelect(chosenOption?: GenericOptionValue): void;
117
113
  readonly customRenderMenu?: (props: CustomOptionsMenuProp<GenericOption, GenericOptionValue>) => React.ReactElement;
118
114
  }
@@ -139,9 +135,8 @@ export interface CustomOptionsMenuProp<GenericOption extends AnyOption = AnyOpti
139
135
  readonly inputFocused: boolean;
140
136
  /**
141
137
  * Ref to the TextInput element.
142
- * v1 provides InputTextRef; v2 provides a DOM element ref.
143
138
  */
144
- readonly inputRef: RefObject<InputTextRef | HTMLInputElement | HTMLTextAreaElement | null>;
139
+ readonly inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
145
140
  /**
146
141
  * Component that wraps the menu content. Used for handling keyboard scroll behavior.
147
142
  */
@@ -351,7 +346,7 @@ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extend
351
346
  */
352
347
  readonly customRenderInput?: (props: {
353
348
  inputRef: Ref<HTMLInputElement | HTMLTextAreaElement>;
354
- inputProps: InputTextRebuiltProps;
349
+ inputProps: InputTextProps;
355
350
  }) => React.ReactNode;
356
351
  /**
357
352
  * **Use at your own risk:** Custom class names for specific elements. This should only be used as a
@@ -12,7 +12,7 @@ var Text = require('../Text-cjs.js');
12
12
  var Typography = require('../Typography-cjs.js');
13
13
  var Icon = require('../Icon-cjs.js');
14
14
  var Glimmer = require('../Glimmer-cjs.js');
15
- var InputText_index = require('../InputText/index.cjs');
15
+ var InputText = require('../InputText-cjs.js');
16
16
  var FormFieldWrapper = require('../FormFieldWrapper-cjs.js');
17
17
  var tslib_es6 = require('../tslib.es6-cjs.js');
18
18
  require('react-hook-form');
@@ -24,14 +24,13 @@ require('../index.esm-cjs.js');
24
24
  require('react/jsx-runtime');
25
25
  require('react-dom');
26
26
  require('../Content-cjs.js');
27
- require('../FormField-cjs.js');
28
27
  require('../FormFieldPostFix-cjs.js');
29
28
  require('../Spinner-cjs.js');
30
29
  require('../useAtlantisFormFieldName-cjs.js');
31
30
  require('framer-motion');
32
- require('react-router-dom');
33
31
  require('../useFormFieldFocus-cjs.js');
34
32
  require('../InputValidation-cjs.js');
33
+ require('react-router-dom');
35
34
 
36
35
  const AUTOCOMPLETE_MAX_HEIGHT$1 = 300;
37
36
  /** Stable empty array for cleared/empty selection state. Reuse to avoid reference churn. */
@@ -1186,7 +1185,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
1186
1185
  ? `${listboxId}-item-${activeIndex}`
1187
1186
  : undefined,
1188
1187
  };
1189
- const inputProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
1188
+ const inputProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
1190
1189
  disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, clearable: props.clearable, autoComplete: "off", autoFocus: props.autoFocus, description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), ariaProps), dataAttrs);
1191
1190
  const chipAreaRef = React.useCallback((node) => {
1192
1191
  if (!node)
@@ -1259,7 +1258,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
1259
1258
  : composedReferenceProps, inputAriaProps: ariaProps, inputDataAttrs: dataAttrs, limitVisibleSelections: props.limitVisibleSelections, limitSelectionText: props.limitSelectionText, unsafeClassName: (_p = props.UNSAFE_className) === null || _p === void 0 ? void 0 : _p.selection, unsafeStyle: (_q = props.UNSAFE_styles) === null || _q === void 0 ? void 0 : _q.selection }, floatingMenu));
1260
1259
  }
1261
1260
  return (React.createElement("div", { "data-testid": "ATL-AutocompleteRebuilt" },
1262
- React.createElement(InputText_index.InputText, Object.assign({ ref: mergedInputRef }, inputProps)),
1261
+ React.createElement(InputText.InputText, Object.assign({ ref: mergedInputRef }, inputProps)),
1263
1262
  floatingMenu));
1264
1263
  }
1265
1264
  function SelectionChip({ value, active, disabled, getOptionLabel, customRenderValue, canDismiss, onDismiss, unsafeClassName, unsafeStyle, }) {
@@ -1572,7 +1571,7 @@ function CustomMenu({ options, selectedOption, onOptionSelect, customRenderMenu,
1572
1571
  // eslint-disable-next-line max-statements
1573
1572
  function AutocompleteInternal(_a, ref) {
1574
1573
  var _b;
1575
- var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, validations, customRenderMenu } = _a, inputProps = tslib_es6.__rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "validations", "customRenderMenu"]);
1574
+ var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, customRenderMenu } = _a, inputProps = tslib_es6.__rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "customRenderMenu"]);
1576
1575
  const initialOptionsMemo = React.useMemo(() => mapToOptions(initialOptions), [initialOptions]);
1577
1576
  const [options, setOptions] = React.useState(initialOptionsMemo);
1578
1577
  const [inputFocused, setInputFocused] = React.useState(false);
@@ -1588,7 +1587,7 @@ function AutocompleteInternal(_a, ref) {
1588
1587
  updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
1589
1588
  }, [value]);
1590
1589
  return (React.createElement("div", { className: styles.autocomplete, ref: setAutocompleteRef },
1591
- React.createElement(InputText_index.InputText, Object.assign({ ref: mergeRefs.mergeRefs([ref, inputRef]), autocomplete: false, size: size, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur, validations: validations }, inputProps)),
1590
+ React.createElement(InputText.InputText, Object.assign({ ref: mergeRefs.mergeRefs([ref, inputRef]), autoComplete: "off", size: size, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur }, inputProps)),
1592
1591
  React.createElement(Menu, { attachTo: autocompleteRef, inputRef: inputRef, inputFocused: inputFocused, options: options, customRenderMenu: customRenderMenu, selectedOption: value, onOptionSelect: handleMenuChange })));
1593
1592
  function updateInput(newText) {
1594
1593
  setInputText(newText);
@@ -1656,7 +1655,7 @@ function AutocompleteShim(props, ref) {
1656
1655
  if (isNewAutocompleteProps(props)) {
1657
1656
  return (React.createElement(AutocompleteRebuilt, Object.assign({}, props, { ref: ref })));
1658
1657
  }
1659
- return React.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref }));
1658
+ return (React.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref })));
1660
1659
  }
1661
1660
  const AutocompleteForwarded = React.forwardRef(AutocompleteShim);
1662
1661
  AutocompleteForwarded.displayName = "Autocomplete";
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import type { AnyOption, AutocompleteLegacyProps, AutocompleteRebuiltProps, ExtraProps, Option, OptionLike } from "./Autocomplete.types";
3
- import type { InputTextRef } from "../InputText";
4
3
  export type { OptionLike } from "./Autocomplete.types";
5
4
  export { type MenuOptionProps, BaseMenuOption, type BaseMenuOptionProps, MenuOption, BaseMenuGroupOption, type BaseMenuGroupOptionProps, } from "./Option";
6
5
  export { type AnyOption, type AutocompleteProps, type BaseOption, type CustomOptionsMenuProp, type GroupOption, type OptionCollection, type Option, type MenuItem, type MenuSection, type MenuOptions, type MenuHeader, type MenuFooter, type MenuAction, type ExtraProps, defineMenu, } from "./Autocomplete.types";
@@ -9,7 +8,7 @@ export { useRepositionMenu } from "./useRepositionMenu";
9
8
  export { BaseAutocompleteMenuWrapper, useAutocompleteMenu, } from "./Menu/MenuWrapper";
10
9
  export { isOptionSelected, isOptionGroup } from "./Autocomplete.utils";
11
10
  type AutocompleteShimProps = AutocompleteLegacyProps | AutocompleteRebuiltProps<OptionLike, boolean, ExtraProps, ExtraProps>;
12
- declare function AutocompleteShim(props: AutocompleteShimProps, ref: React.Ref<InputTextRef | HTMLInputElement | HTMLTextAreaElement>): React.JSX.Element;
11
+ declare function AutocompleteShim(props: AutocompleteShimProps, ref: React.Ref<HTMLInputElement | HTMLTextAreaElement>): React.JSX.Element;
13
12
  export declare const Autocomplete: {
14
13
  <T extends OptionLike = OptionLike, Multiple extends boolean = false, S extends object = ExtraProps, A extends object = ExtraProps>(props: AutocompleteRebuiltProps<T, Multiple, S, A> & {
15
14
  version: 2;
@@ -19,12 +18,12 @@ export declare const Autocomplete: {
19
18
  }): ReturnType<typeof AutocompleteShim>;
20
19
  <GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>(props: AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue> & {
21
20
  version?: 1;
22
- ref?: React.Ref<InputTextRef>;
21
+ ref?: React.Ref<HTMLInputElement | HTMLTextAreaElement | null>;
23
22
  menu?: never;
24
23
  }): ReturnType<typeof AutocompleteShim>;
25
24
  (props: AutocompleteLegacyProps & {
26
25
  version?: 1;
27
- ref?: React.Ref<InputTextRef>;
26
+ ref?: React.Ref<HTMLInputElement | HTMLTextAreaElement | null>;
28
27
  menu?: never;
29
28
  }): ReturnType<typeof AutocompleteShim>;
30
29
  };
@@ -10,7 +10,7 @@ import { T as Text } from '../Text-es.js';
10
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
- import { InputText } from '../InputText/index.mjs';
13
+ import { I as InputText } from '../InputText-es.js';
14
14
  import { c as FormFieldWrapper } from '../FormFieldWrapper-es.js';
15
15
  import { _ as __rest, a as __awaiter } from '../tslib.es6-es.js';
16
16
  import 'react-hook-form';
@@ -22,14 +22,13 @@ import '../index.esm-es.js';
22
22
  import 'react/jsx-runtime';
23
23
  import 'react-dom';
24
24
  import '../Content-es.js';
25
- import '../FormField-es.js';
26
25
  import '../FormFieldPostFix-es.js';
27
26
  import '../Spinner-es.js';
28
27
  import '../useAtlantisFormFieldName-es.js';
29
28
  import 'framer-motion';
30
- import 'react-router-dom';
31
29
  import '../useFormFieldFocus-es.js';
32
30
  import '../InputValidation-es.js';
31
+ import 'react-router-dom';
33
32
 
34
33
  const AUTOCOMPLETE_MAX_HEIGHT$1 = 300;
35
34
  /** Stable empty array for cleared/empty selection state. Reuse to avoid reference churn. */
@@ -1184,7 +1183,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
1184
1183
  ? `${listboxId}-item-${activeIndex}`
1185
1184
  : undefined,
1186
1185
  };
1187
- const inputProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ version: 2, value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
1186
+ const inputProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ value: inputValue, onChange: props.readOnly ? undefined : onInputChangeFromUser }, (props.readOnly ? { onFocus: onInputFocus, onBlur: onInputBlur } : {})), { placeholder,
1188
1187
  disabled, readOnly: props.readOnly, error: error !== null && error !== void 0 ? error : undefined, name: props.name, invalid, clearable: props.clearable, autoComplete: "off", autoFocus: props.autoFocus, description, size: sizeProp ? sizeProp : undefined, prefix: props.prefix, suffix: props.suffix }), (props.readOnly ? {} : composedReferenceProps)), ariaProps), dataAttrs);
1189
1188
  const chipAreaRef = useCallback((node) => {
1190
1189
  if (!node)
@@ -1570,7 +1569,7 @@ function CustomMenu({ options, selectedOption, onOptionSelect, customRenderMenu,
1570
1569
  // eslint-disable-next-line max-statements
1571
1570
  function AutocompleteInternal(_a, ref) {
1572
1571
  var _b;
1573
- var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, validations, customRenderMenu } = _a, inputProps = __rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "validations", "customRenderMenu"]);
1572
+ var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, customRenderMenu } = _a, inputProps = __rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "customRenderMenu"]);
1574
1573
  const initialOptionsMemo = useMemo(() => mapToOptions(initialOptions), [initialOptions]);
1575
1574
  const [options, setOptions] = useState(initialOptionsMemo);
1576
1575
  const [inputFocused, setInputFocused] = useState(false);
@@ -1586,7 +1585,7 @@ function AutocompleteInternal(_a, ref) {
1586
1585
  updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
1587
1586
  }, [value]);
1588
1587
  return (React__default.createElement("div", { className: styles.autocomplete, ref: setAutocompleteRef },
1589
- React__default.createElement(InputText, Object.assign({ ref: mergeRefs([ref, inputRef]), autocomplete: false, size: size, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur, validations: validations }, inputProps)),
1588
+ React__default.createElement(InputText, Object.assign({ ref: mergeRefs([ref, inputRef]), autoComplete: "off", size: size, value: inputText, onChange: handleInputChange, placeholder: placeholder, onFocus: handleInputFocus, onBlur: handleInputBlur }, inputProps)),
1590
1589
  React__default.createElement(Menu, { attachTo: autocompleteRef, inputRef: inputRef, inputFocused: inputFocused, options: options, customRenderMenu: customRenderMenu, selectedOption: value, onOptionSelect: handleMenuChange })));
1591
1590
  function updateInput(newText) {
1592
1591
  setInputText(newText);
@@ -1654,7 +1653,7 @@ function AutocompleteShim(props, ref) {
1654
1653
  if (isNewAutocompleteProps(props)) {
1655
1654
  return (React__default.createElement(AutocompleteRebuilt, Object.assign({}, props, { ref: ref })));
1656
1655
  }
1657
- return React__default.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref }));
1656
+ return (React__default.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref })));
1658
1657
  }
1659
1658
  const AutocompleteForwarded = forwardRef(AutocompleteShim);
1660
1659
  AutocompleteForwarded.displayName = "Autocomplete";
@@ -5,8 +5,7 @@ require('react');
5
5
  require('classnames');
6
6
  require('@jobber/design');
7
7
  require('@jobber/hooks');
8
- require('../../../InputText/index.cjs');
9
- require('../../../FormField-cjs.js');
8
+ require('../../../InputText-cjs.js');
10
9
  require('../../../FormFieldWrapper-cjs.js');
11
10
  require('framer-motion');
12
11
  require('../../../Button-cjs.js');
@@ -3,8 +3,7 @@ import 'react';
3
3
  import 'classnames';
4
4
  import '@jobber/design';
5
5
  import '@jobber/hooks';
6
- import '../../../InputText/index.mjs';
7
- import '../../../FormField-es.js';
6
+ import '../../../InputText-es.js';
8
7
  import '../../../FormFieldWrapper-es.js';
9
8
  import 'framer-motion';
10
9
  import '../../../Button-es.js';
@@ -79,8 +79,7 @@ require('../ComboboxActivator-cjs.js');
79
79
  require('../DataListOverflowFade-cjs.js');
80
80
  require('../DataListStickyHeader-cjs.js');
81
81
  require('../DataListSearch-cjs.js');
82
- require('../InputText/index.cjs');
83
- require('../FormField-cjs.js');
82
+ require('../InputText-cjs.js');
84
83
  require('../FormFieldWrapper-cjs.js');
85
84
  require('../useFormFieldFocus-cjs.js');
86
85
  require('../InputValidation-cjs.js');
@@ -77,8 +77,7 @@ import '../ComboboxActivator-es.js';
77
77
  import '../DataListOverflowFade-es.js';
78
78
  import '../DataListStickyHeader-es.js';
79
79
  import '../DataListSearch-es.js';
80
- import '../InputText/index.mjs';
81
- import '../FormField-es.js';
80
+ import '../InputText-es.js';
82
81
  import '../FormFieldWrapper-es.js';
83
82
  import '../useFormFieldFocus-es.js';
84
83
  import '../InputValidation-es.js';
@@ -4,7 +4,7 @@ var React = require('react');
4
4
  var classnames = require('classnames');
5
5
  var design = require('@jobber/design');
6
6
  var jobberHooks = require('@jobber/hooks');
7
- var InputText_index = require('./InputText/index.cjs');
7
+ var InputText = require('./InputText-cjs.js');
8
8
  var DataListContext = require('./DataListContext-cjs.js');
9
9
  var DataList_const = require('./DataList.const-cjs.js');
10
10
  var Button = require('./Button-cjs.js');
@@ -24,24 +24,26 @@ function DataListSearch(_) {
24
24
  function InternalDataListSearch() {
25
25
  const inputRef = React.useRef(null);
26
26
  const [visible, setVisible] = React.useState(false);
27
+ const [internalValue, setInternalValue] = React.useState("");
27
28
  const { searchComponent, filterComponent, sorting, title } = DataListContext.useDataListContext();
28
29
  const debouncedSearch = jobberHooks.useDebounce((value) => { var _a; return (_a = searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props) === null || _a === void 0 ? void 0 : _a.onSearch(value); }, DataList_const.SEARCH_DEBOUNCE_DELAY);
29
30
  if (!searchComponent)
30
31
  return null;
31
32
  const { placeholder, initialValue, value: controlledValue, } = searchComponent.props;
33
+ const isControlled = controlledValue !== undefined;
32
34
  return (React.createElement("div", { className: classnames(styles.wrapper, {
33
35
  [styles.withNoFilters]: !filterComponent && !sorting,
34
36
  }) },
35
37
  React.createElement("div", { "data-testid": DATA_LIST_SEARCH_TEST_ID, className: classnames(styles.searchInput, {
36
38
  [styles.searchInputVisible]: visible,
37
39
  }) },
38
- React.createElement(InputText_index.InputText
40
+ React.createElement(InputText.InputText
39
41
  // If the initial value changes, reset the input.
40
42
  , {
41
43
  // If the initial value changes, reset the input.
42
- key: initialValue, defaultValue: initialValue, value: controlledValue, ref: inputRef, placeholder: getPlaceholder(), onChange: controlledValue !== undefined
43
- ? searchComponent.props.onSearch
44
- : debouncedSearch, prefix: { icon: "search" }, clearable: "always" })),
44
+ key: initialValue, value: isControlled ? controlledValue : internalValue, ref: inputRef, placeholder: getPlaceholder(), onChange: isControlled
45
+ ? (val) => searchComponent.props.onSearch(val)
46
+ : handleUncontrolledChange, prefix: { icon: "search" }, clearable: "always" })),
45
47
  React.createElement("div", { className: styles.searchButton },
46
48
  React.createElement(AnimatedSwitcher.AnimatedSwitcher, { switched: visible, initialChild: React.createElement(Button.Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch }), switchTo: React.createElement(Button.Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch }) }))));
47
49
  function getPlaceholder() {
@@ -55,9 +57,13 @@ function InternalDataListSearch() {
55
57
  const visibility = !visible;
56
58
  setVisible(visibility);
57
59
  if (visibility && inputRef.current) {
58
- setTimeout(inputRef.current.focus, design.tokens["timing-quick"]);
60
+ setTimeout(() => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, design.tokens["timing-quick"]);
59
61
  }
60
62
  }
63
+ function handleUncontrolledChange(val) {
64
+ setInternalValue(val);
65
+ debouncedSearch(val);
66
+ }
61
67
  }
62
68
 
63
69
  exports.DATA_LIST_SEARCH_TEST_ID = DATA_LIST_SEARCH_TEST_ID;
@@ -2,7 +2,7 @@ import React__default, { useRef, useState } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { tokens } from '@jobber/design';
4
4
  import { useDebounce } from '@jobber/hooks';
5
- import { InputText } from './InputText/index.mjs';
5
+ import { I as InputText } from './InputText-es.js';
6
6
  import { u as useDataListContext } from './DataListContext-es.js';
7
7
  import { S as SEARCH_DEBOUNCE_DELAY } from './DataList.const-es.js';
8
8
  import { B as Button } from './Button-es.js';
@@ -22,11 +22,13 @@ function DataListSearch(_) {
22
22
  function InternalDataListSearch() {
23
23
  const inputRef = useRef(null);
24
24
  const [visible, setVisible] = useState(false);
25
+ const [internalValue, setInternalValue] = useState("");
25
26
  const { searchComponent, filterComponent, sorting, title } = useDataListContext();
26
27
  const debouncedSearch = useDebounce((value) => { var _a; return (_a = searchComponent === null || searchComponent === void 0 ? void 0 : searchComponent.props) === null || _a === void 0 ? void 0 : _a.onSearch(value); }, SEARCH_DEBOUNCE_DELAY);
27
28
  if (!searchComponent)
28
29
  return null;
29
30
  const { placeholder, initialValue, value: controlledValue, } = searchComponent.props;
31
+ const isControlled = controlledValue !== undefined;
30
32
  return (React__default.createElement("div", { className: classnames(styles.wrapper, {
31
33
  [styles.withNoFilters]: !filterComponent && !sorting,
32
34
  }) },
@@ -37,9 +39,9 @@ function InternalDataListSearch() {
37
39
  // If the initial value changes, reset the input.
38
40
  , {
39
41
  // If the initial value changes, reset the input.
40
- key: initialValue, defaultValue: initialValue, value: controlledValue, ref: inputRef, placeholder: getPlaceholder(), onChange: controlledValue !== undefined
41
- ? searchComponent.props.onSearch
42
- : debouncedSearch, prefix: { icon: "search" }, clearable: "always" })),
42
+ key: initialValue, value: isControlled ? controlledValue : internalValue, ref: inputRef, placeholder: getPlaceholder(), onChange: isControlled
43
+ ? (val) => searchComponent.props.onSearch(val)
44
+ : handleUncontrolledChange, prefix: { icon: "search" }, clearable: "always" })),
43
45
  React__default.createElement("div", { className: styles.searchButton },
44
46
  React__default.createElement(AnimatedSwitcher, { switched: visible, initialChild: React__default.createElement(Button, { variation: "subtle", icon: "search", ariaLabel: "Search", onClick: toggleSearch }), switchTo: React__default.createElement(Button, { variation: "subtle", icon: "remove", ariaLabel: "Close search bar", onClick: toggleSearch }) }))));
45
47
  function getPlaceholder() {
@@ -53,9 +55,13 @@ function InternalDataListSearch() {
53
55
  const visibility = !visible;
54
56
  setVisible(visibility);
55
57
  if (visibility && inputRef.current) {
56
- setTimeout(inputRef.current.focus, tokens["timing-quick"]);
58
+ setTimeout(() => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, tokens["timing-quick"]);
57
59
  }
58
60
  }
61
+ function handleUncontrolledChange(val) {
62
+ setInternalValue(val);
63
+ debouncedSearch(val);
64
+ }
59
65
  }
60
66
 
61
67
  export { DATA_LIST_SEARCH_TEST_ID as D, InternalDataListSearch as I, DataListSearch as a };
@@ -30,8 +30,7 @@ require('../_baseAssignValue-cjs.js');
30
30
  require('../_baseFlatten-cjs.js');
31
31
  require('../_setToString-cjs.js');
32
32
  require('../AtlantisContext-cjs.js');
33
- require('../InputText/index.cjs');
34
- require('../FormField-cjs.js');
33
+ require('../InputText-cjs.js');
35
34
  require('../FormFieldWrapper-cjs.js');
36
35
  require('framer-motion');
37
36
  require('../Text-cjs.js');
@@ -28,8 +28,7 @@ import '../_baseAssignValue-es.js';
28
28
  import '../_baseFlatten-es.js';
29
29
  import '../_setToString-es.js';
30
30
  import '../AtlantisContext-es.js';
31
- import '../InputText/index.mjs';
32
- import '../FormField-es.js';
31
+ import '../InputText-es.js';
33
32
  import '../FormFieldWrapper-es.js';
34
33
  import 'framer-motion';
35
34
  import '../Text-es.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  var React = require('react');
4
4
  var DatePicker = require('./DatePicker-cjs.js');
5
- var InputText_index = require('./InputText/index.cjs');
5
+ var InputText = require('./InputText-cjs.js');
6
6
 
7
7
  function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
8
8
  const [isFocused, setIsFocused] = React.useState(false);
@@ -82,7 +82,7 @@ const InputDate = React.forwardRef((props, forwardedRef) => {
82
82
  return (
83
83
  // 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
84
84
  React.createElement("div", { onClick: onClick },
85
- 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, autoComplete: props.autoComplete, 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, required: props.required, name: props.name, version: 2, value: showEmptyValueLabel ? props.emptyValueLabel || "" : value || "", ref: forwardedRef, suffix: suffix, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: event => {
85
+ React.createElement(InputText.InputText, { "aria-describedby": activatorProps.ariaDescribedBy, "aria-labelledby": activatorProps.ariaLabelledBy, "aria-required": activatorProps.ariaRequired === "true" ? true : false, autoFocus: props.autoFocus, id: activatorProps.id, autoComplete: props.autoComplete, 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, required: props.required, name: props.name, value: showEmptyValueLabel ? props.emptyValueLabel || "" : value || "", ref: forwardedRef, suffix: suffix, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: event => {
86
86
  var _a, _b;
87
87
  if (props.showIcon === false && event.key === "ArrowDown") {
88
88
  (_a = activatorProps.onClick) === null || _a === void 0 ? void 0 : _a.call(activatorProps);
@@ -1,6 +1,6 @@
1
1
  import React__default, { useState, forwardRef, useRef } from 'react';
2
2
  import { D as DatePicker } from './DatePicker-es.js';
3
- import { InputText } from './InputText/index.mjs';
3
+ import { I as InputText } from './InputText-es.js';
4
4
 
5
5
  function useInputDateActivatorActions({ onChange, onBlur, onFocus, }) {
6
6
  const [isFocused, setIsFocused] = useState(false);
@@ -80,7 +80,7 @@ const InputDate = forwardRef((props, forwardedRef) => {
80
80
  return (
81
81
  // 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
82
82
  React__default.createElement("div", { onClick: onClick },
83
- 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, autoComplete: props.autoComplete, 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, required: props.required, name: props.name, version: 2, value: showEmptyValueLabel ? props.emptyValueLabel || "" : value || "", ref: forwardedRef, suffix: suffix, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: event => {
83
+ 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, autoComplete: props.autoComplete, 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, required: props.required, name: props.name, value: showEmptyValueLabel ? props.emptyValueLabel || "" : value || "", ref: forwardedRef, suffix: suffix, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: event => {
84
84
  var _a, _b;
85
85
  if (props.showIcon === false && event.key === "ArrowDown") {
86
86
  (_a = activatorProps.onClick) === null || _a === void 0 ? void 0 : _a.call(activatorProps);
@@ -1,71 +1,3 @@
1
1
  import React from "react";
2
- import type { InputTextRef } from "./InputText.types";
3
- export declare const InputText: React.ForwardRefExoticComponent<({
4
- readonly multiline: true;
5
- readonly rows?: (number | import("./InputText.types").RowRange) | undefined;
6
- readonly id?: string | undefined;
7
- readonly align?: ("center" | "right") | undefined;
8
- readonly description?: React.ReactNode;
9
- readonly disabled?: boolean | undefined;
10
- readonly showMiniLabel?: boolean | undefined;
11
- readonly invalid?: boolean | undefined;
12
- readonly inline?: boolean | undefined;
13
- loading?: boolean | undefined;
14
- readonly name?: string | undefined;
15
- onChange?: ((newValue: string | number | boolean | Date, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void) | undefined;
16
- onValidation?: ((message: string) => void) | undefined;
17
- readonly placeholder?: string | undefined;
18
- readonly size?: ("small" | "large") | undefined;
19
- readonly value?: (string | number | Date) | undefined;
20
- readonly clearable?: import("@jobber/hooks").Clearable | undefined;
21
- version?: 1 | undefined;
22
- onFocus?: ((event?: React.FocusEvent) => void) | undefined;
23
- onBlur?: ((event?: React.FocusEvent) => void) | undefined;
24
- readonly toolbar?: React.ReactNode;
25
- readonly defaultValue?: (string | Date) | undefined;
26
- readonly prefix?: import("..").Affix | undefined;
27
- readonly maxLength?: number | undefined;
28
- readonly autofocus?: boolean | undefined;
29
- readonly autocomplete?: (boolean | import("..").AutocompleteTypes) | undefined;
30
- inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null> | undefined;
31
- readonly keyboard?: ("numeric" | "decimal") | undefined;
32
- readonly suffix?: import("ts-xor").XOR<import("..").Affix, import("..").Suffix> | undefined;
33
- onEnter?: ((event: React.KeyboardEvent) => void) | undefined;
34
- readonly readonly?: boolean | undefined;
35
- readonly validations?: import("react-hook-form").RegisterOptions | undefined;
36
- readonly toolbarVisibility?: ("always" | "while-editing") | undefined;
37
- } | {
38
- rows?: undefined;
39
- multiline?: boolean | undefined;
40
- readonly id?: string | undefined;
41
- readonly align?: ("center" | "right") | undefined;
42
- readonly description?: React.ReactNode;
43
- readonly disabled?: boolean | undefined;
44
- readonly showMiniLabel?: boolean | undefined;
45
- readonly invalid?: boolean | undefined;
46
- readonly inline?: boolean | undefined;
47
- loading?: boolean | undefined;
48
- readonly name?: string | undefined;
49
- onChange?: ((newValue: string | number | boolean | Date, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void) | undefined;
50
- onValidation?: ((message: string) => void) | undefined;
51
- readonly placeholder?: string | undefined;
52
- readonly size?: ("small" | "large") | undefined;
53
- readonly value?: (string | number | Date) | undefined;
54
- readonly clearable?: import("@jobber/hooks").Clearable | undefined;
55
- version?: 1 | undefined;
56
- onFocus?: ((event?: React.FocusEvent) => void) | undefined;
57
- onBlur?: ((event?: React.FocusEvent) => void) | undefined;
58
- readonly toolbar?: React.ReactNode;
59
- readonly defaultValue?: (string | Date) | undefined;
60
- readonly prefix?: import("..").Affix | undefined;
61
- readonly maxLength?: number | undefined;
62
- readonly autofocus?: boolean | undefined;
63
- readonly autocomplete?: (boolean | import("..").AutocompleteTypes) | undefined;
64
- inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null> | undefined;
65
- readonly keyboard?: ("numeric" | "decimal") | undefined;
66
- readonly suffix?: import("ts-xor").XOR<import("..").Affix, import("..").Suffix> | undefined;
67
- onEnter?: ((event: React.KeyboardEvent) => void) | undefined;
68
- readonly readonly?: boolean | undefined;
69
- readonly validations?: import("react-hook-form").RegisterOptions | undefined;
70
- readonly toolbarVisibility?: ("always" | "while-editing") | undefined;
71
- }) & React.RefAttributes<InputTextRef>>;
2
+ import type { InputTextProps } from "./InputText.types";
3
+ export declare const InputText: React.ForwardRefExoticComponent<InputTextProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
@@ -1,5 +1,4 @@
1
- import type { XOR } from "ts-xor";
2
- import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
1
+ import type { FormFieldProps } from "../FormField";
3
2
  import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
4
3
  export interface RowRange {
5
4
  min: number;
@@ -16,12 +15,11 @@ interface InputLengthConstraint {
16
15
  */
17
16
  readonly maxLength?: number;
18
17
  }
19
- export type InputTextVersion = 1 | 2 | undefined;
20
18
  /**
21
19
  * Experimental version 2 of the InputText component.
22
20
  * Do not use unless you have talked with Atlantis first.
23
21
  */
24
- export interface InputTextRebuiltProps extends HTMLInputBaseProps, MouseEvents<HTMLInputElement | HTMLTextAreaElement>, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, RebuiltInputCommonProps, InputLengthConstraint {
22
+ export interface InputTextProps extends HTMLInputBaseProps, MouseEvents<HTMLInputElement | HTMLTextAreaElement>, FocusEvents<HTMLInputElement | HTMLTextAreaElement>, KeyboardEvents<HTMLInputElement | HTMLTextAreaElement>, Omit<RebuiltInputCommonProps, "version">, InputLengthConstraint {
25
23
  /**
26
24
  * When false, the placeholder text only serves as a standard placeholder and
27
25
  * disappears when the user types, instead of floating above the value as a
@@ -61,30 +59,4 @@ export interface InputTextRebuiltProps extends HTMLInputBaseProps, MouseEvents<H
61
59
  */
62
60
  readonly onEnter?: FormFieldProps["onEnter"];
63
61
  }
64
- interface BaseProps extends CommonFormFieldProps, Pick<FormFieldProps, "autofocus" | "maxLength" | "readonly" | "autocomplete" | "keyboard" | "onEnter" | "onFocus" | "onBlur" | "onChange" | "inputRef" | "validations" | "defaultValue" | "prefix" | "suffix" | "toolbar" | "toolbarVisibility" | "version"> {
65
- multiline?: boolean;
66
- }
67
- export interface InputTextRef {
68
- insert(text: string): void;
69
- blur(): void;
70
- focus(): void;
71
- scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
72
- }
73
- interface MultilineProps extends BaseProps {
74
- /**
75
- * Use this when you're expecting a long answer.
76
- */
77
- readonly multiline: true;
78
- /**
79
- * Specifies the visible height of a long answer form field. Can be in the
80
- * form of a single number to set a static height, or an object with a min
81
- * and max keys indicating the minimum number of visible rows, and the
82
- * maximum number of visible rows.
83
- */
84
- readonly rows?: number | RowRange;
85
- }
86
- /**
87
- * @deprecated Use the v2 InputText component instead (version={2}).
88
- */
89
- export type InputTextLegacyProps = XOR<BaseProps, MultilineProps>;
90
62
  export {};