@jobber/components 6.120.2 → 6.120.3-JOB-145568-e19b446.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Autocomplete/Autocomplete.d.ts +2 -3
- package/dist/Autocomplete/Autocomplete.types.d.ts +4 -9
- package/dist/Autocomplete/index.cjs +11 -9
- package/dist/Autocomplete/index.d.ts +3 -4
- package/dist/Autocomplete/index.mjs +8 -6
- package/dist/DataList/components/DataListSearch/index.cjs +2 -2
- package/dist/DataList/components/DataListSearch/index.mjs +2 -2
- package/dist/DataList/index.cjs +2 -2
- package/dist/DataList/index.mjs +2 -2
- package/dist/DataListSearch-cjs.js +12 -6
- package/dist/DataListSearch-es.js +11 -5
- package/dist/DataTable/index.cjs +1 -0
- package/dist/DataTable/index.mjs +1 -0
- package/dist/FormField/index.cjs +14 -13
- package/dist/FormField/index.mjs +5 -4
- package/dist/FormField-cjs.js +8 -281
- package/dist/FormField-es.js +3 -263
- package/dist/InputDate/index.cjs +3 -2
- package/dist/InputDate/index.mjs +4 -3
- package/dist/InputEmail/index.cjs +7 -6
- package/dist/InputEmail/index.mjs +4 -3
- package/dist/InputNumber/index.cjs +1 -0
- package/dist/InputNumber/index.mjs +2 -1
- package/dist/InputPassword/index.cjs +1 -0
- package/dist/InputPassword/index.mjs +1 -0
- package/dist/InputPassword-es.js +1 -1
- package/dist/InputPhoneNumber/index.cjs +6 -5
- package/dist/InputPhoneNumber/index.mjs +2 -1
- package/dist/InputText/InputText.d.ts +2 -70
- package/dist/InputText/InputText.types.d.ts +6 -30
- package/dist/InputText/index.cjs +11 -266
- package/dist/InputText/index.d.ts +2 -5
- package/dist/InputText/index.mjs +10 -269
- package/dist/InputText/useInputTextActions.d.ts +2 -2
- package/dist/InputText-cjs.js +196 -0
- package/dist/InputText-es.js +194 -0
- package/dist/InputTime/index.cjs +5 -4
- package/dist/InputTime/index.mjs +2 -1
- package/dist/RecurringSelect/index.cjs +1 -0
- package/dist/RecurringSelect/index.mjs +1 -0
- package/dist/Select/index.cjs +8 -7
- package/dist/Select/index.mjs +4 -3
- package/dist/index.cjs +13 -12
- package/dist/index.mjs +3 -2
- package/dist/mergeRefs-cjs.js +279 -0
- package/dist/mergeRefs-es.js +265 -0
- package/dist/styles.css +7 -7
- package/package.json +2 -2
- 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
|
-
|
|
5
|
-
declare
|
|
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, version, ...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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties, Key, Ref, RefObject } from "react";
|
|
2
2
|
import type { AriaInputProps, FocusEvents, HTMLInputBaseProps, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
3
3
|
import type { FormFieldProps } from "../FormField";
|
|
4
|
-
import type {
|
|
4
|
+
import type { InputTextProps } from "../InputText";
|
|
5
5
|
/**
|
|
6
6
|
* ARIA attributes for Autocomplete with managed/orchestrated behavior.
|
|
7
7
|
* Certain ARIA attributes are controlled internally by Autocomplete's
|
|
@@ -92,10 +92,6 @@ export interface AutocompleteLegacyProps<GenericOption extends AnyOption = AnyOp
|
|
|
92
92
|
* @param newInputText
|
|
93
93
|
*/
|
|
94
94
|
readonly getOptions: (newInputText: string) => Array<GenericGetOptionsValue | GenericOption> | Promise<Array<GenericGetOptionsValue | GenericOption>>;
|
|
95
|
-
/**
|
|
96
|
-
* Validations to run on the input.
|
|
97
|
-
*/
|
|
98
|
-
readonly validations?: FormFieldProps["validations"];
|
|
99
95
|
}
|
|
100
96
|
export type AutocompleteProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> = AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>;
|
|
101
97
|
export type CustomOptionsMenuType<GenericOption extends AnyOption = AnyOption> = (props: CustomOptionsMenuProp<GenericOption>) => React.ReactElement;
|
|
@@ -110,7 +106,7 @@ export interface MenuProps<GenericOption extends AnyOption = AnyOption, GenericO
|
|
|
110
106
|
/**
|
|
111
107
|
* Ref to the TextInput element.
|
|
112
108
|
*/
|
|
113
|
-
readonly inputRef: RefObject<
|
|
109
|
+
readonly inputRef: RefObject<HTMLInputElement | null>;
|
|
114
110
|
onOptionSelect(chosenOption?: GenericOptionValue): void;
|
|
115
111
|
readonly customRenderMenu?: (props: CustomOptionsMenuProp<GenericOption, GenericOptionValue>) => React.ReactElement;
|
|
116
112
|
}
|
|
@@ -137,9 +133,8 @@ export interface CustomOptionsMenuProp<GenericOption extends AnyOption = AnyOpti
|
|
|
137
133
|
readonly inputFocused: boolean;
|
|
138
134
|
/**
|
|
139
135
|
* Ref to the TextInput element.
|
|
140
|
-
* v1 provides InputTextRef; v2 provides a DOM element ref.
|
|
141
136
|
*/
|
|
142
|
-
readonly inputRef: RefObject<
|
|
137
|
+
readonly inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
143
138
|
/**
|
|
144
139
|
* Component that wraps the menu content. Used for handling keyboard scroll behavior.
|
|
145
140
|
*/
|
|
@@ -349,7 +344,7 @@ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extend
|
|
|
349
344
|
*/
|
|
350
345
|
readonly customRenderInput?: (props: {
|
|
351
346
|
inputRef: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
352
|
-
inputProps:
|
|
347
|
+
inputProps: InputTextProps;
|
|
353
348
|
}) => React.ReactNode;
|
|
354
349
|
/**
|
|
355
350
|
* **Use at your own risk:** Custom class names for specific elements. This should only be used as a
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
var
|
|
15
|
+
var InputText = require('../InputText-cjs.js');
|
|
16
|
+
var mergeRefs = require('../mergeRefs-cjs.js');
|
|
17
17
|
var tslib_es6 = require('../tslib.es6-cjs.js');
|
|
18
18
|
require('react-hook-form');
|
|
19
19
|
require('../Button-cjs.js');
|
|
@@ -1180,7 +1180,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
|
1180
1180
|
? `${listboxId}-item-${activeIndex}`
|
|
1181
1181
|
: undefined,
|
|
1182
1182
|
};
|
|
1183
|
-
const inputProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
1183
|
+
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,
|
|
1184
1184
|
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);
|
|
1185
1185
|
const chipAreaRef = React.useCallback((node) => {
|
|
1186
1186
|
if (!node)
|
|
@@ -1208,7 +1208,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
1210
|
}, [setReferenceElement, props.multiple]);
|
|
1211
|
-
const mergedInputRef = React.useMemo(() =>
|
|
1211
|
+
const mergedInputRef = React.useMemo(() => mergeRefs.mergeRefs([
|
|
1212
1212
|
referenceInputRef,
|
|
1213
1213
|
internalInputRef,
|
|
1214
1214
|
forwardedRef,
|
|
@@ -1253,7 +1253,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
|
1253
1253
|
: 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));
|
|
1254
1254
|
}
|
|
1255
1255
|
return (React.createElement("div", { "data-testid": "ATL-AutocompleteRebuilt" },
|
|
1256
|
-
React.createElement(
|
|
1256
|
+
React.createElement(InputText.InputText, Object.assign({ ref: mergedInputRef }, inputProps)),
|
|
1257
1257
|
floatingMenu));
|
|
1258
1258
|
}
|
|
1259
1259
|
function SelectionChip({ value, active, disabled, getOptionLabel, customRenderValue, canDismiss, onDismiss, unsafeClassName, unsafeStyle, }) {
|
|
@@ -1298,7 +1298,7 @@ function MultipleSelectionLayout({ selectedValues, inputValue, disabled, error,
|
|
|
1298
1298
|
}, []);
|
|
1299
1299
|
return (React.createElement("div", { "data-testid": "ATL-AutocompleteRebuilt", onFocus: handleFocusIn, onBlur: handleFocusOut },
|
|
1300
1300
|
React.createElement("div", { className: styles$1.multiSelectField, "data-testid": "ATL-AutocompleteRebuilt-multiSelectContainer" },
|
|
1301
|
-
React.createElement(
|
|
1301
|
+
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: () => {
|
|
1302
1302
|
var _a;
|
|
1303
1303
|
clearAll();
|
|
1304
1304
|
(_a = internalInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -1566,7 +1566,9 @@ function CustomMenu({ options, selectedOption, onOptionSelect, customRenderMenu,
|
|
|
1566
1566
|
// eslint-disable-next-line max-statements
|
|
1567
1567
|
function AutocompleteInternal(_a, ref) {
|
|
1568
1568
|
var _b;
|
|
1569
|
-
var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus,
|
|
1569
|
+
var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, customRenderMenu,
|
|
1570
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Exclude this from inputProps
|
|
1571
|
+
version } = _a, inputProps = tslib_es6.__rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "customRenderMenu", "version"]);
|
|
1570
1572
|
const initialOptionsMemo = React.useMemo(() => mapToOptions(initialOptions), [initialOptions]);
|
|
1571
1573
|
const [options, setOptions] = React.useState(initialOptionsMemo);
|
|
1572
1574
|
const [inputFocused, setInputFocused] = React.useState(false);
|
|
@@ -1582,7 +1584,7 @@ function AutocompleteInternal(_a, ref) {
|
|
|
1582
1584
|
updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
|
|
1583
1585
|
}, [value]);
|
|
1584
1586
|
return (React.createElement("div", { className: styles.autocomplete, ref: setAutocompleteRef },
|
|
1585
|
-
React.createElement(
|
|
1587
|
+
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)),
|
|
1586
1588
|
React.createElement(Menu, { attachTo: autocompleteRef, inputRef: inputRef, inputFocused: inputFocused, options: options, customRenderMenu: customRenderMenu, selectedOption: value, onOptionSelect: handleMenuChange })));
|
|
1587
1589
|
function updateInput(newText) {
|
|
1588
1590
|
setInputText(newText);
|
|
@@ -1650,7 +1652,7 @@ function AutocompleteShim(props, ref) {
|
|
|
1650
1652
|
if (isNewAutocompleteProps(props)) {
|
|
1651
1653
|
return (React.createElement(AutocompleteRebuilt, Object.assign({}, props, { ref: ref })));
|
|
1652
1654
|
}
|
|
1653
|
-
return React.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref }));
|
|
1655
|
+
return (React.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref })));
|
|
1654
1656
|
}
|
|
1655
1657
|
const AutocompleteForwarded = React.forwardRef(AutocompleteShim);
|
|
1656
1658
|
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<
|
|
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<
|
|
21
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
23
22
|
menu?: never;
|
|
24
23
|
}): ReturnType<typeof AutocompleteShim>;
|
|
25
24
|
(props: AutocompleteLegacyProps & {
|
|
26
25
|
version?: 1;
|
|
27
|
-
ref?: React.Ref<
|
|
26
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
28
27
|
menu?: never;
|
|
29
28
|
}): ReturnType<typeof AutocompleteShim>;
|
|
30
29
|
};
|
|
@@ -10,8 +10,8 @@ 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
|
|
14
|
-
import {
|
|
13
|
+
import { I as InputText } from '../InputText-es.js';
|
|
14
|
+
import { m as mergeRefs, c as FormFieldWrapper } from '../mergeRefs-es.js';
|
|
15
15
|
import { _ as __rest, a as __awaiter } from '../tslib.es6-es.js';
|
|
16
16
|
import 'react-hook-form';
|
|
17
17
|
import '../Button-es.js';
|
|
@@ -1178,7 +1178,7 @@ function AutocompleteRebuiltInternal(props, forwardedRef) {
|
|
|
1178
1178
|
? `${listboxId}-item-${activeIndex}`
|
|
1179
1179
|
: undefined,
|
|
1180
1180
|
};
|
|
1181
|
-
const inputProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
1181
|
+
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,
|
|
1182
1182
|
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);
|
|
1183
1183
|
const chipAreaRef = useCallback((node) => {
|
|
1184
1184
|
if (!node)
|
|
@@ -1564,7 +1564,9 @@ function CustomMenu({ options, selectedOption, onOptionSelect, customRenderMenu,
|
|
|
1564
1564
|
// eslint-disable-next-line max-statements
|
|
1565
1565
|
function AutocompleteInternal(_a, ref) {
|
|
1566
1566
|
var _b;
|
|
1567
|
-
var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus,
|
|
1567
|
+
var { initialOptions = [], value, allowFreeForm = true, size = undefined, debounce: debounceRate = 300, onChange, getOptions, placeholder, onBlur, onFocus, customRenderMenu,
|
|
1568
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Exclude this from inputProps
|
|
1569
|
+
version } = _a, inputProps = __rest(_a, ["initialOptions", "value", "allowFreeForm", "size", "debounce", "onChange", "getOptions", "placeholder", "onBlur", "onFocus", "customRenderMenu", "version"]);
|
|
1568
1570
|
const initialOptionsMemo = useMemo(() => mapToOptions(initialOptions), [initialOptions]);
|
|
1569
1571
|
const [options, setOptions] = useState(initialOptionsMemo);
|
|
1570
1572
|
const [inputFocused, setInputFocused] = useState(false);
|
|
@@ -1580,7 +1582,7 @@ function AutocompleteInternal(_a, ref) {
|
|
|
1580
1582
|
updateInput((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
|
|
1581
1583
|
}, [value]);
|
|
1582
1584
|
return (React__default.createElement("div", { className: styles.autocomplete, ref: setAutocompleteRef },
|
|
1583
|
-
React__default.createElement(InputText, Object.assign({ ref: mergeRefs([ref, inputRef]),
|
|
1585
|
+
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)),
|
|
1584
1586
|
React__default.createElement(Menu, { attachTo: autocompleteRef, inputRef: inputRef, inputFocused: inputFocused, options: options, customRenderMenu: customRenderMenu, selectedOption: value, onOptionSelect: handleMenuChange })));
|
|
1585
1587
|
function updateInput(newText) {
|
|
1586
1588
|
setInputText(newText);
|
|
@@ -1648,7 +1650,7 @@ function AutocompleteShim(props, ref) {
|
|
|
1648
1650
|
if (isNewAutocompleteProps(props)) {
|
|
1649
1651
|
return (React__default.createElement(AutocompleteRebuilt, Object.assign({}, props, { ref: ref })));
|
|
1650
1652
|
}
|
|
1651
|
-
return React__default.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref }));
|
|
1653
|
+
return (React__default.createElement(Autocomplete$1, Object.assign({}, props, { ref: ref })));
|
|
1652
1654
|
}
|
|
1653
1655
|
const AutocompleteForwarded = forwardRef(AutocompleteShim);
|
|
1654
1656
|
AutocompleteForwarded.displayName = "Autocomplete";
|
|
@@ -5,8 +5,8 @@ require('react');
|
|
|
5
5
|
require('classnames');
|
|
6
6
|
require('@jobber/design');
|
|
7
7
|
require('@jobber/hooks');
|
|
8
|
-
require('../../../InputText
|
|
9
|
-
require('../../../
|
|
8
|
+
require('../../../InputText-cjs.js');
|
|
9
|
+
require('../../../mergeRefs-cjs.js');
|
|
10
10
|
require('framer-motion');
|
|
11
11
|
require('../../../Button-cjs.js');
|
|
12
12
|
require('react-router-dom');
|
|
@@ -3,8 +3,8 @@ import 'react';
|
|
|
3
3
|
import 'classnames';
|
|
4
4
|
import '@jobber/design';
|
|
5
5
|
import '@jobber/hooks';
|
|
6
|
-
import '../../../InputText
|
|
7
|
-
import '../../../
|
|
6
|
+
import '../../../InputText-es.js';
|
|
7
|
+
import '../../../mergeRefs-es.js';
|
|
8
8
|
import 'framer-motion';
|
|
9
9
|
import '../../../Button-es.js';
|
|
10
10
|
import 'react-router-dom';
|
package/dist/DataList/index.cjs
CHANGED
|
@@ -79,8 +79,8 @@ 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
|
|
83
|
-
require('../
|
|
82
|
+
require('../InputText-cjs.js');
|
|
83
|
+
require('../mergeRefs-cjs.js');
|
|
84
84
|
require('../useFormFieldFocus-cjs.js');
|
|
85
85
|
require('../InputValidation-cjs.js');
|
|
86
86
|
require('../DataListEmptyState-cjs.js');
|
package/dist/DataList/index.mjs
CHANGED
|
@@ -77,8 +77,8 @@ 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
|
|
81
|
-
import '../
|
|
80
|
+
import '../InputText-es.js';
|
|
81
|
+
import '../mergeRefs-es.js';
|
|
82
82
|
import '../useFormFieldFocus-es.js';
|
|
83
83
|
import '../InputValidation-es.js';
|
|
84
84
|
import '../DataListEmptyState-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
|
|
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(
|
|
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,
|
|
43
|
-
? searchComponent.props.onSearch
|
|
44
|
-
:
|
|
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
|
|
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,
|
|
41
|
-
? searchComponent.props.onSearch
|
|
42
|
-
:
|
|
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 };
|
package/dist/DataTable/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ require('../_baseAssignValue-cjs.js');
|
|
|
24
24
|
require('../_baseFlatten-cjs.js');
|
|
25
25
|
require('../_setToString-cjs.js');
|
|
26
26
|
require('../FormField-cjs.js');
|
|
27
|
+
require('../mergeRefs-cjs.js');
|
|
27
28
|
require('framer-motion');
|
|
28
29
|
require('@jobber/design');
|
|
29
30
|
require('../Button-cjs.js');
|
package/dist/DataTable/index.mjs
CHANGED
package/dist/FormField/index.cjs
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var FormField = require('../FormField-cjs.js');
|
|
4
|
+
var mergeRefs = require('../mergeRefs-cjs.js');
|
|
4
5
|
require('react');
|
|
6
|
+
require('classnames');
|
|
7
|
+
require('../tslib.es6-cjs.js');
|
|
8
|
+
require('react-hook-form');
|
|
5
9
|
require('@jobber/hooks');
|
|
6
10
|
require('framer-motion');
|
|
7
11
|
require('@jobber/design');
|
|
8
|
-
require('classnames');
|
|
9
12
|
require('../Button-cjs.js');
|
|
10
13
|
require('react-router-dom');
|
|
11
|
-
require('../tslib.es6-cjs.js');
|
|
12
14
|
require('../Icon-cjs.js');
|
|
13
15
|
require('../Typography-cjs.js');
|
|
14
16
|
require('../Text-cjs.js');
|
|
15
17
|
require('../useFormFieldFocus-cjs.js');
|
|
16
18
|
require('../InputValidation-cjs.js');
|
|
17
19
|
require('../Spinner-cjs.js');
|
|
18
|
-
require('react-hook-form');
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
exports.AffixIcon = FormField.AffixIcon;
|
|
23
|
-
exports.AffixLabel = FormField.AffixLabel;
|
|
24
23
|
exports.FormField = FormField.FormField;
|
|
25
|
-
exports.FormFieldInputHorizontalWrapper = FormField.FormFieldInputHorizontalWrapper;
|
|
26
|
-
exports.FormFieldInputWrapperStyles = FormField.FormFieldInputWrapperStyles;
|
|
27
|
-
exports.FormFieldLabel = FormField.FormFieldLabel;
|
|
28
|
-
exports.FormFieldWrapper = FormField.FormFieldWrapper;
|
|
29
|
-
exports.FormFieldWrapperMain = FormField.FormFieldWrapperMain;
|
|
30
|
-
exports.FormFieldWrapperToolbar = FormField.FormFieldWrapperToolbar;
|
|
31
24
|
exports.useAtlantisFormField = FormField.useAtlantisFormField;
|
|
32
25
|
exports.useAtlantisFormFieldActions = FormField.useAtlantisFormFieldActions;
|
|
33
|
-
exports.useAtlantisFormFieldName = FormField.useAtlantisFormFieldName;
|
|
34
26
|
exports.useAtlantisReactHookForm = FormField.useAtlantisReactHookForm;
|
|
35
|
-
exports.
|
|
27
|
+
exports.AffixIcon = mergeRefs.AffixIcon;
|
|
28
|
+
exports.AffixLabel = mergeRefs.AffixLabel;
|
|
29
|
+
exports.FormFieldInputHorizontalWrapper = mergeRefs.FormFieldInputHorizontalWrapper;
|
|
30
|
+
exports.FormFieldInputWrapperStyles = mergeRefs.FormFieldInputWrapperStyles;
|
|
31
|
+
exports.FormFieldLabel = mergeRefs.FormFieldLabel;
|
|
32
|
+
exports.FormFieldWrapper = mergeRefs.FormFieldWrapper;
|
|
33
|
+
exports.FormFieldWrapperMain = mergeRefs.FormFieldWrapperMain;
|
|
34
|
+
exports.FormFieldWrapperToolbar = mergeRefs.FormFieldWrapperToolbar;
|
|
35
|
+
exports.useAtlantisFormFieldName = mergeRefs.useAtlantisFormFieldName;
|
|
36
|
+
exports.useFormFieldWrapperStyles = mergeRefs.useFormFieldWrapperStyles;
|
package/dist/FormField/index.mjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { F as FormField, u as useAtlantisFormField, a as useAtlantisFormFieldActions, b as useAtlantisReactHookForm } from '../FormField-es.js';
|
|
2
|
+
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 useAtlantisFormFieldName, g as useFormFieldWrapperStyles } from '../mergeRefs-es.js';
|
|
2
3
|
import 'react';
|
|
4
|
+
import 'classnames';
|
|
5
|
+
import '../tslib.es6-es.js';
|
|
6
|
+
import 'react-hook-form';
|
|
3
7
|
import '@jobber/hooks';
|
|
4
8
|
import 'framer-motion';
|
|
5
9
|
import '@jobber/design';
|
|
6
|
-
import 'classnames';
|
|
7
10
|
import '../Button-es.js';
|
|
8
11
|
import 'react-router-dom';
|
|
9
|
-
import '../tslib.es6-es.js';
|
|
10
12
|
import '../Icon-es.js';
|
|
11
13
|
import '../Typography-es.js';
|
|
12
14
|
import '../Text-es.js';
|
|
13
15
|
import '../useFormFieldFocus-es.js';
|
|
14
16
|
import '../InputValidation-es.js';
|
|
15
17
|
import '../Spinner-es.js';
|
|
16
|
-
import 'react-hook-form';
|