@jobber/components 6.103.6 → 6.104.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/Autocomplete/Autocomplete.types.d.ts +9 -51
  2. package/dist/Autocomplete/index.cjs +10 -20
  3. package/dist/Autocomplete/index.mjs +10 -20
  4. package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +1 -1
  5. package/dist/Autocomplete/useAutocomplete.d.ts +2 -2
  6. package/dist/Checkbox/Checkbox.rebuilt.d.ts +1 -2
  7. package/dist/Checkbox/Checkbox.types.d.ts +3 -34
  8. package/dist/Checkbox/index.cjs +9 -2
  9. package/dist/Checkbox/index.mjs +9 -2
  10. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
  11. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
  12. package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
  13. package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
  14. package/dist/Chips/index.cjs +2 -2
  15. package/dist/Chips/index.mjs +2 -2
  16. package/dist/DataList/components/DataListHeader/index.cjs +1 -0
  17. package/dist/DataList/components/DataListHeader/index.mjs +1 -0
  18. package/dist/DataList/components/DataListItem/index.cjs +1 -0
  19. package/dist/DataList/components/DataListItem/index.mjs +1 -0
  20. package/dist/DataList/components/DataListItems/index.cjs +1 -0
  21. package/dist/DataList/components/DataListItems/index.mjs +1 -0
  22. package/dist/DataList/components/DataListLayout/index.cjs +1 -0
  23. package/dist/DataList/components/DataListLayout/index.mjs +1 -0
  24. package/dist/DataList/components/DataListSearch/index.cjs +2 -12
  25. package/dist/DataList/components/DataListSearch/index.mjs +2 -12
  26. package/dist/DataList/index.cjs +1 -8
  27. package/dist/DataList/index.mjs +1 -8
  28. package/dist/DataTable/index.cjs +3 -2
  29. package/dist/DataTable/index.mjs +3 -2
  30. package/dist/DatePicker/index.cjs +2 -2
  31. package/dist/DatePicker/index.mjs +2 -2
  32. package/dist/FormField/FormFieldTypes.d.ts +0 -2
  33. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +7 -2
  34. package/dist/FormField-cjs.js +0 -1
  35. package/dist/FormField-es.js +1 -1
  36. package/dist/InputDate/InputDate.types.d.ts +12 -7
  37. package/dist/InputDate/index.cjs +6 -9
  38. package/dist/InputDate/index.mjs +6 -9
  39. package/dist/InputDate/useInputDateActivatorActions.d.ts +4 -8
  40. package/dist/InputEmail/InputEmail.types.d.ts +10 -20
  41. package/dist/InputEmail/hooks/useInputEmailActions.d.ts +4 -3
  42. package/dist/InputEmail/index.cjs +18 -49
  43. package/dist/InputEmail/index.mjs +18 -49
  44. package/dist/InputFile-cjs.js +5 -2
  45. package/dist/InputFile-es.js +5 -2
  46. package/dist/InputNumber/InputNumber.rebuilt.types.d.ts +7 -15
  47. package/dist/InputNumber/index.cjs +6 -4
  48. package/dist/InputNumber/index.mjs +6 -4
  49. package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +12 -28
  50. package/dist/InputPhoneNumber/hooks/useInputPhoneActions.d.ts +1 -1
  51. package/dist/InputPhoneNumber/index.cjs +20 -34
  52. package/dist/InputPhoneNumber/index.mjs +20 -34
  53. package/dist/InputText/InputText.types.d.ts +31 -25
  54. package/dist/InputText/index.cjs +41 -62
  55. package/dist/InputText/index.mjs +42 -63
  56. package/dist/InputText/useInputTextActions.d.ts +4 -3
  57. package/dist/InputTime/InputTime.rebuilt.d.ts +1 -1
  58. package/dist/InputTime/InputTime.types.d.ts +13 -4
  59. package/dist/InputTime/hooks/useInputTimeActions.d.ts +16 -0
  60. package/dist/InputTime/index.cjs +66 -30
  61. package/dist/InputTime/index.mjs +69 -33
  62. package/dist/List/index.cjs +2 -2
  63. package/dist/List/index.mjs +2 -2
  64. package/dist/MultiSelect/index.cjs +1 -0
  65. package/dist/MultiSelect/index.mjs +1 -0
  66. package/dist/RecurringSelect/index.cjs +3 -2
  67. package/dist/RecurringSelect/index.mjs +3 -2
  68. package/dist/Select/Select.types.d.ts +7 -3
  69. package/dist/Select/hooks/useSelectActions.d.ts +5 -5
  70. package/dist/Select/index.cjs +27 -41
  71. package/dist/Select/index.mjs +29 -43
  72. package/dist/Tabs-es.js +1 -1
  73. package/dist/_baseEach-cjs.js +12 -12
  74. package/dist/_baseEach-es.js +1 -1
  75. package/dist/_baseFlatten-cjs.js +2 -2
  76. package/dist/_baseFlatten-es.js +1 -1
  77. package/dist/{_baseGet-cjs.js → _getAllKeys-cjs.js} +181 -181
  78. package/dist/{_baseGet-es.js → _getAllKeys-es.js} +182 -182
  79. package/dist/debounce-es.js +1 -1
  80. package/dist/filterDataAttributes-cjs.js +26 -0
  81. package/dist/filterDataAttributes-es.js +24 -0
  82. package/dist/index.cjs +3 -2
  83. package/dist/index.mjs +3 -2
  84. package/dist/omit-cjs.js +14 -14
  85. package/dist/omit-es.js +1 -1
  86. package/dist/sharedHelpers/filterDataAttributes.d.ts +17 -0
  87. package/dist/sharedHelpers/types.d.ts +205 -0
  88. package/dist/useScrollToActive-cjs.js +3 -3
  89. package/dist/useScrollToActive-es.js +2 -2
  90. package/package.json +2 -2
  91. package/dist/InputEmail/hooks/useInputEmailFormField.d.ts +0 -32
  92. package/dist/InputPhoneNumber/hooks/useInputPhoneFormField.d.ts +0 -71
  93. package/dist/InputText/useInputTextFormField.d.ts +0 -366
  94. package/dist/Select/hooks/useSelectFormField.d.ts +0 -34
@@ -1,11 +1,12 @@
1
- import React__default, { useState, useCallback, useEffect, useRef, useId } from 'react';
1
+ import React__default, { useState, useCallback, useEffect, useId, useRef } from 'react';
2
2
  import { _ as __rest } from '../tslib.es6-es.js';
3
- import { d as debounce } from '../debounce-es.js';
4
- import { j as useFormFieldWrapperStyles, f as FormFieldWrapper, k as FormField } from '../FormField-es.js';
3
+ import { a as debounce } from '../debounce-es.js';
4
+ import { j as useFormFieldWrapperStyles, f as FormFieldWrapper, m as mergeRefs, k as FormField } from '../FormField-es.js';
5
5
  import 'classnames';
6
6
  import '@jobber/design';
7
7
  import 'react-hook-form';
8
8
  import '../Button-es.js';
9
+ import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
9
10
  import { o as omit } from '../omit-es.js';
10
11
  import '@jobber/hooks';
11
12
  import 'framer-motion';
@@ -19,7 +20,7 @@ import '../useFormFieldFocus-es.js';
19
20
  import '../InputValidation-es.js';
20
21
  import '../Spinner-es.js';
21
22
  import 'react-router-dom';
22
- import '../_baseGet-es.js';
23
+ import '../_getAllKeys-es.js';
23
24
  import '../isTypedArray-es.js';
24
25
  import '../identity-es.js';
25
26
  import '../_getTag-es.js';
@@ -202,23 +203,7 @@ function timeStringToDate(timeString, baseDate) {
202
203
  }
203
204
  }
204
205
 
205
- function InputTimeRebuilt(_a) {
206
- var _b, _c;
207
- var { value, onChange } = _a, params = __rest(_a, ["value", "onChange"]);
208
- const ref = (_b = params.inputRef) !== null && _b !== void 0 ? _b : useRef(null);
209
- const { setTypedTime } = useTimePredict({
210
- value,
211
- handleChange,
212
- });
213
- const { inputStyle } = useFormFieldWrapperStyles(params);
214
- const wrapperRef = React__default.useRef(null);
215
- const id = getId(params);
216
- return (React__default.createElement(FormFieldWrapper, { disabled: params.disabled, size: params.size, align: params.align, inline: params.inline, name: params.name, error: params.error || "", identifier: id, descriptionIdentifier: `descriptionUUID--${id}`, invalid: Boolean(params.invalid), description: params.description, clearable: (_c = params.clearable) !== null && _c !== void 0 ? _c : "never", onClear: handleClear, type: "time", readonly: params.readonly, placeholder: params.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
217
- React__default.createElement("input", { ref: ref, type: "time", name: params.name, className: inputStyle, onBlur: handleBlur, id: id, disabled: params.disabled, readOnly: params.readonly, onChange: handleChangeEvent, onFocus: handleFocus, "data-testid": "ATL-InputTime-input", onKeyUp: e => {
218
- if (params.disabled || params.readonly)
219
- return;
220
- !isNaN(parseInt(e.key, 10)) && setTypedTime(prev => prev + e.key);
221
- }, value: dateToTimeString(value) })));
206
+ function useInputTimeActions({ onChange, value, inputRef, onFocus, onBlur, onKeyDown, }) {
222
207
  function handleChangeEvent(event) {
223
208
  handleChange(event.target.value);
224
209
  }
@@ -226,28 +211,79 @@ function InputTimeRebuilt(_a) {
226
211
  onChange === null || onChange === void 0 ? void 0 : onChange(timeStringToDate(newValue, value));
227
212
  }
228
213
  function handleBlur(event) {
229
- var _a;
230
- (_a = params.onBlur) === null || _a === void 0 ? void 0 : _a.call(params, event);
231
- if (ref.current) {
232
- if (!ref.current.checkValidity()) {
233
- ref.current.value = "";
214
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
215
+ if (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) {
216
+ if (!inputRef.current.checkValidity()) {
217
+ inputRef.current.value = "";
234
218
  }
235
219
  }
236
220
  }
237
221
  function handleClear() {
238
222
  var _a;
239
- handleBlur();
223
+ // Clear the value and refocus without triggering blur event
240
224
  onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
241
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
225
+ (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
242
226
  }
243
227
  function handleFocus(event) {
244
- var _a;
245
- (_a = params.onFocus) === null || _a === void 0 ? void 0 : _a.call(params, event);
228
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
246
229
  }
247
- function getId(props) {
248
- const generatedId = useId();
249
- return props.id || generatedId;
230
+ function handleKeyDown(event) {
231
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
232
+ }
233
+ return {
234
+ handleChangeEvent,
235
+ handleChange,
236
+ handleBlur,
237
+ handleClear,
238
+ handleFocus,
239
+ handleKeyDown,
240
+ };
241
+ }
242
+
243
+ function InputTimeRebuilt(_a) {
244
+ var _b;
245
+ var { value, onChange, readOnly, autoComplete, inputRef } = _a, props = __rest(_a, ["value", "onChange", "readOnly", "autoComplete", "inputRef"]);
246
+ const { internalRef, mergedRef, wrapperRef } = useInputTimeRefs(inputRef);
247
+ const generatedId = useId();
248
+ const id = props.id || generatedId;
249
+ const { inputStyle } = useFormFieldWrapperStyles(props);
250
+ const { handleChangeEvent, handleChange, handleBlur, handleClear, handleFocus, handleKeyDown, } = useInputTimeActions({
251
+ onChange,
252
+ value,
253
+ readOnly,
254
+ disabled: props.disabled,
255
+ inputRef: internalRef,
256
+ onFocus: props.onFocus,
257
+ onBlur: props.onBlur,
258
+ onKeyDown: props.onKeyDown,
259
+ });
260
+ const { setTypedTime } = useTimePredict({
261
+ value,
262
+ handleChange,
263
+ });
264
+ // Kept outside the useInputTimeActions hook to avoid circular dependency via setTypedTime and handleChange
265
+ function handleKeyUp(event) {
266
+ var _a;
267
+ (_a = props.onKeyUp) === null || _a === void 0 ? void 0 : _a.call(props, event);
268
+ if (props.disabled || readOnly)
269
+ return;
270
+ !isNaN(parseInt(event.key, 10)) && setTypedTime(prev => prev + event.key);
250
271
  }
272
+ const dataAttrs = filterDataAttributes(props);
273
+ const descriptionIdentifier = `descriptionUUID--${id}`;
274
+ const descriptionVisible = props.description && !props.inline;
275
+ const isInvalid = Boolean(props.error || props.invalid);
276
+ return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: props.name, error: props.error || "", identifier: id, descriptionIdentifier: descriptionIdentifier, invalid: props.invalid, description: props.description, clearable: (_b = props.clearable) !== null && _b !== void 0 ? _b : "never", onClear: handleClear, type: "time", readonly: readOnly, placeholder: props.placeholder, value: dateToTimeString(value), wrapperRef: wrapperRef },
277
+ React__default.createElement("input", Object.assign({ ref: mergedRef, type: "time", name: props.name, className: inputStyle, id: id, disabled: props.disabled, readOnly: readOnly, autoComplete: autoComplete, autoFocus: props.autoFocus, max: props.max, min: props.min, value: dateToTimeString(value), onChange: handleChangeEvent, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, "data-testid": "ATL-InputTime-input", "aria-label": props["aria-label"], "aria-describedby": descriptionVisible ? descriptionIdentifier : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"] }, dataAttrs))));
278
+ }
279
+ function useInputTimeRefs(inputRef) {
280
+ const internalRef = useRef(null);
281
+ const mergedRef = mergeRefs([
282
+ internalRef,
283
+ inputRef,
284
+ ]);
285
+ const wrapperRef = React__default.useRef(null);
286
+ return { internalRef, mergedRef, wrapperRef };
251
287
  }
252
288
 
253
289
  function InputTime$1(_a) {
@@ -8,9 +8,9 @@ require('../identity-cjs.js');
8
8
  require('../isTypedArray-cjs.js');
9
9
  require('../isObjectLike-cjs.js');
10
10
  require('../_commonjsHelpers-cjs.js');
11
- require('../_baseGet-cjs.js');
12
- require('../_getTag-cjs.js');
11
+ require('../_getAllKeys-cjs.js');
13
12
  require('../isSymbol-cjs.js');
13
+ require('../_getTag-cjs.js');
14
14
  require('../_baseFor-cjs.js');
15
15
  require('../_baseAssignValue-cjs.js');
16
16
  require('../Typography-cjs.js');
@@ -6,9 +6,9 @@ import '../identity-es.js';
6
6
  import '../isTypedArray-es.js';
7
7
  import '../isObjectLike-es.js';
8
8
  import '../_commonjsHelpers-es.js';
9
- import '../_baseGet-es.js';
10
- import '../_getTag-es.js';
9
+ import '../_getAllKeys-es.js';
11
10
  import '../isSymbol-es.js';
11
+ import '../_getTag-es.js';
12
12
  import '../_baseFor-es.js';
13
13
  import '../_baseAssignValue-es.js';
14
14
  import '../Typography-es.js';
@@ -10,6 +10,7 @@ require('../Icon-cjs.js');
10
10
  require('@jobber/design');
11
11
  require('../Text-cjs.js');
12
12
  require('../Typography-cjs.js');
13
+ require('../filterDataAttributes-cjs.js');
13
14
 
14
15
 
15
16
 
@@ -8,3 +8,4 @@ import '../Icon-es.js';
8
8
  import '@jobber/design';
9
9
  import '../Text-es.js';
10
10
  import '../Typography-es.js';
11
+ import '../filterDataAttributes-es.js';
@@ -9,12 +9,12 @@ require('classnames');
9
9
  require('../Select/index.cjs');
10
10
  require('../omit-cjs.js');
11
11
  require('../_commonjsHelpers-cjs.js');
12
- require('../_baseGet-cjs.js');
12
+ require('../_getAllKeys-cjs.js');
13
13
  require('../isTypedArray-cjs.js');
14
14
  require('../isObjectLike-cjs.js');
15
+ require('../isSymbol-cjs.js');
15
16
  require('../identity-cjs.js');
16
17
  require('../_getTag-cjs.js');
17
- require('../isSymbol-cjs.js');
18
18
  require('../keysIn-cjs.js');
19
19
  require('../_baseAssignValue-cjs.js');
20
20
  require('../_baseFlatten-cjs.js');
@@ -31,6 +31,7 @@ require('../useFormFieldFocus-cjs.js');
31
31
  require('../InputValidation-cjs.js');
32
32
  require('../Spinner-cjs.js');
33
33
  require('react-hook-form');
34
+ require('../filterDataAttributes-cjs.js');
34
35
  require('../InputNumber/index.cjs');
35
36
  require('../Tree-cjs.js');
36
37
  require('react-dom');
@@ -7,12 +7,12 @@ import 'classnames';
7
7
  import '../Select/index.mjs';
8
8
  import '../omit-es.js';
9
9
  import '../_commonjsHelpers-es.js';
10
- import '../_baseGet-es.js';
10
+ import '../_getAllKeys-es.js';
11
11
  import '../isTypedArray-es.js';
12
12
  import '../isObjectLike-es.js';
13
+ import '../isSymbol-es.js';
13
14
  import '../identity-es.js';
14
15
  import '../_getTag-es.js';
15
- import '../isSymbol-es.js';
16
16
  import '../keysIn-es.js';
17
17
  import '../_baseAssignValue-es.js';
18
18
  import '../_baseFlatten-es.js';
@@ -29,6 +29,7 @@ import '../useFormFieldFocus-es.js';
29
29
  import '../InputValidation-es.js';
30
30
  import '../Spinner-es.js';
31
31
  import 'react-hook-form';
32
+ import '../filterDataAttributes-es.js';
32
33
  import '../InputNumber/index.mjs';
33
34
  import '../Tree-es.js';
34
35
  import 'react-dom';
@@ -1,4 +1,5 @@
1
1
  import type { CommonFormFieldProps, FormFieldProps } from "../FormField";
2
+ import type { FocusEvents, HTMLInputBaseProps, RebuiltInputCommonProps } from "../sharedHelpers/types";
2
3
  export interface SelectLegacyProps extends Pick<CommonFormFieldProps, "id" | "align" | "description" | "disabled" | "invalid" | "inline" | "name" | "onValidation" | "placeholder" | "size" | "value" | "onChange">, Pick<FormFieldProps, "autofocus" | "onEnter" | "onBlur" | "onFocus" | "inputRef" | "wrapperRef" | "validations" | "children" | "prefix" | "suffix" | "defaultValue" | "version"> {
3
4
  /**
4
5
  * Changes the width to roughly the same size as the maximum character length
@@ -8,12 +9,15 @@ export interface SelectLegacyProps extends Pick<CommonFormFieldProps, "id" | "al
8
9
  /**
9
10
  * Rebuilt version of the Select component without React Hook Form dependency.
10
11
  */
11
- export interface SelectRebuiltProps extends Omit<SelectLegacyProps, "defaultValue" | "version" | "onChange" | "value" | "validations" | "onValidation"> {
12
+ export interface SelectRebuiltProps extends Omit<HTMLInputBaseProps, "readOnly">, FocusEvents<HTMLSelectElement>, Omit<RebuiltInputCommonProps, "clearable" | "prefix" | "suffix" | "align">, Pick<SelectLegacyProps, "prefix" | "suffix" | "align" | "children"> {
12
13
  defaultValue?: never;
13
14
  readonly value?: string | number;
14
15
  onChange?(newValue?: string | number): void;
15
- version: 2;
16
- error?: string;
16
+ readonly inputRef?: FormFieldProps["inputRef"];
17
+ /**
18
+ * @deprecated Use `onKeyDown` or `onKeyUp` instead.
19
+ */
20
+ readonly onEnter?: FormFieldProps["onEnter"];
17
21
  /**
18
22
  * Opt-in to the customizable select UI (Chromium 123+).
19
23
  * When true, the component will apply the custom select styles
@@ -1,15 +1,15 @@
1
- import type { ChangeEvent } from "react";
1
+ import type { ChangeEvent, FocusEvent } from "react";
2
2
  interface UseSelectActionsProps {
3
3
  readonly onChange?: (newValue: string | number, event?: ChangeEvent<HTMLSelectElement>) => void;
4
- readonly onBlur?: () => void;
5
- readonly onFocus?: () => void;
4
+ readonly onBlur?: (event: FocusEvent<HTMLSelectElement>) => void;
5
+ readonly onFocus?: (event: FocusEvent<HTMLSelectElement>) => void;
6
6
  }
7
7
  /**
8
8
  * Hook with actions on the Select component.
9
9
  */
10
10
  export declare function useSelectActions({ onChange, onBlur, onFocus, }: UseSelectActionsProps): {
11
11
  handleChange: (event: ChangeEvent<HTMLSelectElement>) => void;
12
- handleBlur: () => void;
13
- handleFocus: () => void;
12
+ handleBlur: (event: FocusEvent<HTMLSelectElement>) => void;
13
+ handleFocus: (event: FocusEvent<HTMLSelectElement>) => void;
14
14
  };
15
15
  export {};
@@ -10,13 +10,14 @@ require('@jobber/hooks');
10
10
  require('framer-motion');
11
11
  require('@jobber/design');
12
12
  require('../Button-cjs.js');
13
+ var filterDataAttributes = require('../filterDataAttributes-cjs.js');
13
14
  require('../_commonjsHelpers-cjs.js');
14
- require('../_baseGet-cjs.js');
15
+ require('../_getAllKeys-cjs.js');
15
16
  require('../isTypedArray-cjs.js');
16
17
  require('../isObjectLike-cjs.js');
18
+ require('../isSymbol-cjs.js');
17
19
  require('../identity-cjs.js');
18
20
  require('../_getTag-cjs.js');
19
- require('../isSymbol-cjs.js');
20
21
  require('../keysIn-cjs.js');
21
22
  require('../_baseAssignValue-cjs.js');
22
23
  require('../_baseFlatten-cjs.js');
@@ -42,11 +43,11 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
42
43
  const newValue = event.currentTarget.value;
43
44
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
44
45
  }
45
- function handleBlur() {
46
- onBlur === null || onBlur === void 0 ? void 0 : onBlur();
46
+ function handleBlur(event) {
47
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
47
48
  }
48
- function handleFocus() {
49
- onFocus === null || onFocus === void 0 ? void 0 : onFocus();
49
+ function handleFocus(event) {
50
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
50
51
  }
51
52
  return {
52
53
  handleChange,
@@ -55,27 +56,16 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
55
56
  };
56
57
  }
57
58
 
58
- /**
59
- * Hook for managing the props of a Select component.
60
- * Extracted from FormField's useAtlantisFormField.
61
- */
62
- function useSelectFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, }) {
63
- const descriptionIdentifier = `descriptionUUID--${id}`;
64
- const fieldProps = Object.assign({ id,
65
- name,
66
- disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value }, (description &&
67
- !inline && { "aria-describedby": descriptionIdentifier }));
68
- return { fieldProps, descriptionIdentifier };
69
- }
70
-
71
59
  var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
72
60
 
73
61
  function SelectRebuilt(props) {
74
- var _a, _b;
75
- const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : React.useRef(null);
76
- const wrapperRef = React.useRef(null);
62
+ var _a;
63
+ const { mergedRef, wrapperRef } = useSelectRefs(props.inputRef);
77
64
  const { inputStyle } = FormField.useFormFieldWrapperStyles(Object.assign({}, omit.omit(props, ["version"])));
78
- const id = useSelectId(props);
65
+ const dataAttrs = filterDataAttributes.filterDataAttributes(props);
66
+ const generatedId = React.useId();
67
+ const id = props.id || generatedId;
68
+ const descriptionIdentifier = `descriptionUUID--${id}`;
79
69
  const { name } = FormField.useAtlantisFormFieldName({
80
70
  nameProp: props.name,
81
71
  id: id,
@@ -85,27 +75,23 @@ function SelectRebuilt(props) {
85
75
  onBlur: props.onBlur,
86
76
  onFocus: props.onFocus,
87
77
  });
88
- const inputProps = omit.omit(props, [
89
- "onChange",
90
- "onBlur",
91
- "onFocus",
92
- "size",
93
- "placeholder",
94
- "version",
95
- ]);
96
- const { fieldProps, descriptionIdentifier } = useSelectFormField(Object.assign(Object.assign({}, inputProps), { id,
97
- name,
98
- handleChange,
99
- handleBlur,
100
- handleFocus }));
101
- return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: (_b = props.error) !== null && _b !== void 0 ? _b : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never", maxLength: props.maxLength },
78
+ const descriptionVisible = props.description && !props.inline;
79
+ const isInvalid = Boolean(props.error || props.invalid);
80
+ return (React.createElement(FormField.FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never" },
102
81
  React.createElement(React.Fragment, null,
103
- React.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }), props.children),
82
+ React.createElement("select", Object.assign({ id: id, name: name, disabled: props.disabled, autoFocus: props.autoFocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value: props.value, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
83
+ ? descriptionIdentifier
84
+ : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], ref: mergedRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }, dataAttrs), props.children),
104
85
  React.createElement(FormField.FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
105
86
  }
106
- function useSelectId(props) {
107
- const generatedId = React.useId();
108
- return props.id || generatedId;
87
+ function useSelectRefs(inputRef) {
88
+ const internalRef = React.useRef(null);
89
+ const mergedRef = FormField.mergeRefs([
90
+ internalRef,
91
+ inputRef,
92
+ ]);
93
+ const wrapperRef = React.useRef(null);
94
+ return { mergedRef, wrapperRef };
109
95
  }
110
96
 
111
97
  function SelectOption({ children, disabled, value }) {
@@ -1,6 +1,6 @@
1
- import React__default, { useRef, useId } from 'react';
1
+ import React__default, { useId, useRef } from 'react';
2
2
  import { o as omit } from '../omit-es.js';
3
- import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix } from '../FormField-es.js';
3
+ import { k as FormField, j as useFormFieldWrapperStyles, b as useAtlantisFormFieldName, f as FormFieldWrapper, l as FormFieldPostFix, m as mergeRefs } from '../FormField-es.js';
4
4
  import classnames from 'classnames';
5
5
  import '../tslib.es6-es.js';
6
6
  import 'react-hook-form';
@@ -8,13 +8,14 @@ import '@jobber/hooks';
8
8
  import 'framer-motion';
9
9
  import '@jobber/design';
10
10
  import '../Button-es.js';
11
+ import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
11
12
  import '../_commonjsHelpers-es.js';
12
- import '../_baseGet-es.js';
13
+ import '../_getAllKeys-es.js';
13
14
  import '../isTypedArray-es.js';
14
15
  import '../isObjectLike-es.js';
16
+ import '../isSymbol-es.js';
15
17
  import '../identity-es.js';
16
18
  import '../_getTag-es.js';
17
- import '../isSymbol-es.js';
18
19
  import '../keysIn-es.js';
19
20
  import '../_baseAssignValue-es.js';
20
21
  import '../_baseFlatten-es.js';
@@ -40,11 +41,11 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
40
41
  const newValue = event.currentTarget.value;
41
42
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue, event);
42
43
  }
43
- function handleBlur() {
44
- onBlur === null || onBlur === void 0 ? void 0 : onBlur();
44
+ function handleBlur(event) {
45
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
45
46
  }
46
- function handleFocus() {
47
- onFocus === null || onFocus === void 0 ? void 0 : onFocus();
47
+ function handleFocus(event) {
48
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
48
49
  }
49
50
  return {
50
51
  handleChange,
@@ -53,27 +54,16 @@ function useSelectActions({ onChange, onBlur, onFocus, }) {
53
54
  };
54
55
  }
55
56
 
56
- /**
57
- * Hook for managing the props of a Select component.
58
- * Extracted from FormField's useAtlantisFormField.
59
- */
60
- function useSelectFormField({ id, name, disabled, autofocus, description, inline, value, handleChange, handleBlur, handleFocus, }) {
61
- const descriptionIdentifier = `descriptionUUID--${id}`;
62
- const fieldProps = Object.assign({ id,
63
- name,
64
- disabled, autoFocus: autofocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value }, (description &&
65
- !inline && { "aria-describedby": descriptionIdentifier }));
66
- return { fieldProps, descriptionIdentifier };
67
- }
68
-
69
57
  var styles = {"select":"-hmXAsAfH9U-","selectPostfix":"_5ST4c1fXDYU-","spinning":"oOACJmrVDf0-"};
70
58
 
71
59
  function SelectRebuilt(props) {
72
- var _a, _b;
73
- const selectRef = (_a = props.inputRef) !== null && _a !== void 0 ? _a : useRef(null);
74
- const wrapperRef = useRef(null);
60
+ var _a;
61
+ const { mergedRef, wrapperRef } = useSelectRefs(props.inputRef);
75
62
  const { inputStyle } = useFormFieldWrapperStyles(Object.assign({}, omit(props, ["version"])));
76
- const id = useSelectId(props);
63
+ const dataAttrs = filterDataAttributes(props);
64
+ const generatedId = useId();
65
+ const id = props.id || generatedId;
66
+ const descriptionIdentifier = `descriptionUUID--${id}`;
77
67
  const { name } = useAtlantisFormFieldName({
78
68
  nameProp: props.name,
79
69
  id: id,
@@ -83,27 +73,23 @@ function SelectRebuilt(props) {
83
73
  onBlur: props.onBlur,
84
74
  onFocus: props.onFocus,
85
75
  });
86
- const inputProps = omit(props, [
87
- "onChange",
88
- "onBlur",
89
- "onFocus",
90
- "size",
91
- "placeholder",
92
- "version",
93
- ]);
94
- const { fieldProps, descriptionIdentifier } = useSelectFormField(Object.assign(Object.assign({}, inputProps), { id,
95
- name,
96
- handleChange,
97
- handleBlur,
98
- handleFocus }));
99
- return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, autofocus: props.autofocus, name: name, wrapperRef: wrapperRef, error: (_b = props.error) !== null && _b !== void 0 ? _b : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never", maxLength: props.maxLength },
76
+ const descriptionVisible = props.description && !props.inline;
77
+ const isInvalid = Boolean(props.error || props.invalid);
78
+ return (React__default.createElement(FormFieldWrapper, { disabled: props.disabled, size: props.size, align: props.align, inline: props.inline, name: name, wrapperRef: wrapperRef, error: (_a = props.error) !== null && _a !== void 0 ? _a : "", invalid: props.invalid, identifier: id, descriptionIdentifier: descriptionIdentifier, description: props.description, type: "select", placeholder: props.placeholder, value: props.value, prefix: props.prefix, suffix: props.suffix, clearable: "never" },
100
79
  React__default.createElement(React__default.Fragment, null,
101
- React__default.createElement("select", Object.assign({}, fieldProps, { ref: selectRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }), props.children),
80
+ React__default.createElement("select", Object.assign({ id: id, name: name, disabled: props.disabled, autoFocus: props.autoFocus, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value: props.value, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
81
+ ? descriptionIdentifier
82
+ : props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], ref: mergedRef, className: classnames(inputStyle, props.UNSAFE_experimentalStyles && styles.select) }, dataAttrs), props.children),
102
83
  React__default.createElement(FormFieldPostFix, { variation: "select", className: styles.selectPostfix }))));
103
84
  }
104
- function useSelectId(props) {
105
- const generatedId = useId();
106
- return props.id || generatedId;
85
+ function useSelectRefs(inputRef) {
86
+ const internalRef = useRef(null);
87
+ const mergedRef = mergeRefs([
88
+ internalRef,
89
+ inputRef,
90
+ ]);
91
+ const wrapperRef = useRef(null);
92
+ return { mergedRef, wrapperRef };
107
93
  }
108
94
 
109
95
  function SelectOption({ children, disabled, value }) {
package/dist/Tabs-es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React__default, { useState, useRef, useCallback, useEffect } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
4
- import { a as debounce_1 } from './debounce-es.js';
4
+ import { d as debounce_1 } from './debounce-es.js';
5
5
  import { a as isObject_1 } from './isObjectLike-es.js';
6
6
  import { T as Typography } from './Typography-es.js';
7
7
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  var identity$1 = require('./identity-cjs.js');
4
4
  var isObjectLike$1 = require('./isObjectLike-cjs.js');
5
- var _baseGet = require('./_baseGet-cjs.js');
5
+ var _getAllKeys = require('./_getAllKeys-cjs.js');
6
6
  var _getTag = require('./_getTag-cjs.js');
7
7
  var isTypedArray$1 = require('./isTypedArray-cjs.js');
8
8
  var _commonjsHelpers = require('./_commonjsHelpers-cjs.js');
@@ -351,7 +351,7 @@ function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack)
351
351
 
352
352
  var _equalByTag = equalByTag$1;
353
353
 
354
- var getAllKeys = _baseGet._getAllKeys;
354
+ var getAllKeys = _getAllKeys._getAllKeys;
355
355
 
356
356
  /** Used to compose bitmasks for value comparisons. */
357
357
  var COMPARE_PARTIAL_FLAG$3 = 1;
@@ -635,7 +635,7 @@ function isStrictComparable$2(value) {
635
635
  var _isStrictComparable = isStrictComparable$2;
636
636
 
637
637
  var isStrictComparable$1 = _isStrictComparable,
638
- keys$1 = _baseGet.keys_1;
638
+ keys$1 = _getAllKeys.keys_1;
639
639
 
640
640
  /**
641
641
  * Gets the property names, values, and compare flags of `object`.
@@ -704,7 +704,7 @@ function baseMatches$1(source) {
704
704
 
705
705
  var _baseMatches = baseMatches$1;
706
706
 
707
- var baseGet$1 = _baseGet._baseGet;
707
+ var baseGet$1 = _getAllKeys._baseGet;
708
708
 
709
709
  /**
710
710
  * Gets the value at `path` of `object`. If the resolved value is
@@ -755,12 +755,12 @@ function baseHasIn$1(object, key) {
755
755
 
756
756
  var _baseHasIn = baseHasIn$1;
757
757
 
758
- var castPath = _baseGet._castPath,
758
+ var castPath = _getAllKeys._castPath,
759
759
  isArguments = isTypedArray$1.isArguments_1,
760
760
  isArray$1 = isTypedArray$1.isArray_1,
761
761
  isIndex = identity$1._isIndex,
762
762
  isLength = isTypedArray$1.isLength_1,
763
- toKey$2 = _baseGet._toKey;
763
+ toKey$2 = _getAllKeys._toKey;
764
764
 
765
765
  /**
766
766
  * Checks if `path` exists on `object`.
@@ -833,10 +833,10 @@ var hasIn_1 = hasIn$1;
833
833
  var baseIsEqual = _baseIsEqual,
834
834
  get = get_1,
835
835
  hasIn = hasIn_1,
836
- isKey$1 = _baseGet._isKey,
836
+ isKey$1 = _getAllKeys._isKey,
837
837
  isStrictComparable = _isStrictComparable,
838
838
  matchesStrictComparable = _matchesStrictComparable,
839
- toKey$1 = _baseGet._toKey;
839
+ toKey$1 = _getAllKeys._toKey;
840
840
 
841
841
  /** Used to compose bitmasks for value comparisons. */
842
842
  var COMPARE_PARTIAL_FLAG = 1,
@@ -880,7 +880,7 @@ function baseProperty$1(key) {
880
880
 
881
881
  var _baseProperty = baseProperty$1;
882
882
 
883
- var baseGet = _baseGet._baseGet;
883
+ var baseGet = _getAllKeys._baseGet;
884
884
 
885
885
  /**
886
886
  * A specialized version of `baseProperty` which supports deep paths.
@@ -899,8 +899,8 @@ var _basePropertyDeep = basePropertyDeep$1;
899
899
 
900
900
  var baseProperty = _baseProperty,
901
901
  basePropertyDeep = _basePropertyDeep,
902
- isKey = _baseGet._isKey,
903
- toKey = _baseGet._toKey;
902
+ isKey = _getAllKeys._isKey,
903
+ toKey = _getAllKeys._toKey;
904
904
 
905
905
  /**
906
906
  * Creates a function that returns the value at `path` of a given object.
@@ -963,7 +963,7 @@ function baseIteratee(value) {
963
963
  var _baseIteratee = baseIteratee;
964
964
 
965
965
  var baseFor = _baseFor._baseFor,
966
- keys = _baseGet.keys_1;
966
+ keys = _getAllKeys.keys_1;
967
967
 
968
968
  /**
969
969
  * The base implementation of `_.forOwn` without support for iteratee shorthands.
@@ -1,6 +1,6 @@
1
1
  import { g as _MapCache, d as _Uint8Array, e as eq_1, c as _Stack, a as _isIndex, i as identity_1 } from './identity-es.js';
2
2
  import { b as _Symbol, i as isObjectLike_1, a as isObject_1 } from './isObjectLike-es.js';
3
- import { e as _getAllKeys, k as keys_1, b as _baseGet, f as _castPath, g as _toKey, h as _isKey } from './_baseGet-es.js';
3
+ import { e as _getAllKeys, k as keys_1, b as _baseGet, f as _castPath, g as _toKey, h as _isKey } from './_getAllKeys-es.js';
4
4
  import { a as _getTag } from './_getTag-es.js';
5
5
  import { c as isBufferExports, d as isTypedArray_1, a as isArray_1, i as isArguments_1, m as isLength_1, b as isArrayLike_1 } from './isTypedArray-es.js';
6
6
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var _baseGet = require('./_baseGet-cjs.js');
3
+ var _getAllKeys = require('./_getAllKeys-cjs.js');
4
4
  var isObjectLike = require('./isObjectLike-cjs.js');
5
5
  var isTypedArray = require('./isTypedArray-cjs.js');
6
6
 
@@ -25,7 +25,7 @@ function isFlattenable$1(value) {
25
25
 
26
26
  var _isFlattenable = isFlattenable$1;
27
27
 
28
- var arrayPush = _baseGet._arrayPush,
28
+ var arrayPush = _getAllKeys._arrayPush,
29
29
  isFlattenable = _isFlattenable;
30
30
 
31
31
  /**
@@ -1,4 +1,4 @@
1
- import { _ as _arrayPush } from './_baseGet-es.js';
1
+ import { _ as _arrayPush } from './_getAllKeys-es.js';
2
2
  import { b as _Symbol } from './isObjectLike-es.js';
3
3
  import { i as isArguments_1, a as isArray_1 } from './isTypedArray-es.js';
4
4