@jobber/components 6.10.2 → 6.11.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 (55) hide show
  1. package/dist/Autocomplete/index.cjs +11 -2
  2. package/dist/Autocomplete/index.mjs +11 -2
  3. package/dist/Autocomplete-cjs.js +2 -2
  4. package/dist/Autocomplete-es.js +1 -1
  5. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
  6. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
  7. package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
  8. package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
  9. package/dist/Chips/index.cjs +2 -2
  10. package/dist/Chips/index.mjs +2 -2
  11. package/dist/DataList/components/DataListSearch/index.cjs +10 -1
  12. package/dist/DataList/components/DataListSearch/index.mjs +10 -1
  13. package/dist/DataList/index.cjs +8 -1
  14. package/dist/DataList/index.mjs +8 -1
  15. package/dist/DataListSearch-cjs.js +2 -2
  16. package/dist/DataListSearch-es.js +1 -1
  17. package/dist/DatePicker/index.cjs +3 -2
  18. package/dist/DatePicker/index.mjs +3 -2
  19. package/dist/DatePicker-cjs.js +2 -781
  20. package/dist/DatePicker-es.js +3 -781
  21. package/dist/FormField/FormFieldTypes.d.ts +3 -3
  22. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +3 -3
  23. package/dist/FormField-cjs.js +5 -2
  24. package/dist/FormField-es.js +3 -3
  25. package/dist/InputDate/index.cjs +16 -15
  26. package/dist/InputDate/index.mjs +16 -15
  27. package/dist/InputDate-cjs.js +3 -2
  28. package/dist/InputDate-es.js +2 -1
  29. package/dist/InputText/InputText.d.ts +10 -20
  30. package/dist/InputText/InputText.rebuilt.d.ts +3 -0
  31. package/dist/InputText/InputText.types.d.ts +71 -0
  32. package/dist/InputText/index.cjs +263 -8
  33. package/dist/InputText/index.d.ts +5 -1
  34. package/dist/InputText/index.mjs +266 -7
  35. package/dist/InputText/useInputTextActions.d.ts +16 -0
  36. package/dist/InputText/useInputTextFormField.d.ts +347 -0
  37. package/dist/InputText/useTextAreaResize.d.ts +14 -0
  38. package/dist/List/index.cjs +2 -2
  39. package/dist/List/index.mjs +2 -2
  40. package/dist/_baseEach-cjs.js +12 -12
  41. package/dist/_baseEach-es.js +2 -2
  42. package/dist/_baseFlatten-cjs.js +2 -2
  43. package/dist/_baseFlatten-es.js +1 -1
  44. package/dist/{_getAllKeys-cjs.js → _baseGet-cjs.js} +181 -181
  45. package/dist/{_getAllKeys-es.js → _baseGet-es.js} +183 -183
  46. package/dist/index.cjs +4 -3
  47. package/dist/index.mjs +3 -2
  48. package/dist/isTypedArray-es.js +1 -1
  49. package/dist/omit-cjs.js +783 -0
  50. package/dist/omit-es.js +781 -0
  51. package/dist/useScrollToActive-cjs.js +3 -3
  52. package/dist/useScrollToActive-es.js +1 -1
  53. package/package.json +2 -2
  54. package/dist/InputText-cjs.js +0 -129
  55. package/dist/InputText-es.js +0 -127
@@ -3,7 +3,7 @@
3
3
  var React = require('react');
4
4
  var _commonjsHelpers = require('./_commonjsHelpers-cjs.js');
5
5
  var _baseFlatten = require('./_baseFlatten-cjs.js');
6
- var _getAllKeys = require('./_getAllKeys-cjs.js');
6
+ var _baseGet = require('./_baseGet-cjs.js');
7
7
  var _baseEach = require('./_baseEach-cjs.js');
8
8
  var isTypedArray = require('./isTypedArray-cjs.js');
9
9
  var isSymbol$1 = require('./isSymbol-cjs.js');
@@ -146,8 +146,8 @@ function compareMultiple$1(object, other, orders) {
146
146
 
147
147
  var _compareMultiple = compareMultiple$1;
148
148
 
149
- var arrayMap = _getAllKeys._arrayMap,
150
- baseGet = _getAllKeys._baseGet,
149
+ var arrayMap = _baseGet._arrayMap,
150
+ baseGet = _baseGet._baseGet,
151
151
  baseIteratee = _baseEach._baseIteratee,
152
152
  baseMap = _baseMap,
153
153
  baseSortBy = _baseSortBy,
@@ -1,7 +1,7 @@
1
1
  import React, { useRef, useId, useState, useEffect } from 'react';
2
2
  import { g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
3
3
  import { _ as _baseFlatten } from './_baseFlatten-es.js';
4
- import { a as _arrayMap, b as _baseGet } from './_getAllKeys-es.js';
4
+ import { a as _arrayMap, b as _baseGet } from './_baseGet-es.js';
5
5
  import { _ as _baseEach, a as _baseIteratee } from './_baseEach-es.js';
6
6
  import { b as isArrayLike_1, k as _baseUnary, a as isArray_1 } from './isTypedArray-es.js';
7
7
  import { i as isSymbol_1 } from './isSymbol-es.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.10.2",
3
+ "version": "6.11.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -487,5 +487,5 @@
487
487
  "> 1%",
488
488
  "IE 10"
489
489
  ],
490
- "gitHead": "6a37cbc30b363891e52735ac997d4007f255c7b9"
490
+ "gitHead": "14532ccfa9b237d61f1c550e7f2d07aefb062c98"
491
491
  }
@@ -1,129 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var useSafeLayoutEffect = require('./useSafeLayoutEffect-cjs.js');
5
- var FormField = require('./FormField-cjs.js');
6
- require('./tslib.es6-cjs.js');
7
- require('react-hook-form');
8
- require('framer-motion');
9
- require('@jobber/design');
10
- require('classnames');
11
- require('react-router-dom');
12
-
13
- function InputTextInternal(props, ref) {
14
- const inputRef = React.useRef(null);
15
- const actionsRef = React.useRef(null);
16
- const wrapperRef = React.useRef(null);
17
- const rowRange = getRowRange();
18
- React.useImperativeHandle(ref, () => ({
19
- insert: (text) => {
20
- insertText(text);
21
- },
22
- blur: () => {
23
- const input = inputRef.current;
24
- if (input) {
25
- input.blur();
26
- }
27
- },
28
- focus: () => {
29
- const input = inputRef.current;
30
- if (input) {
31
- input.focus();
32
- }
33
- },
34
- scrollIntoView: arg => {
35
- const input = inputRef.current;
36
- if (input) {
37
- input.scrollIntoView(arg);
38
- }
39
- },
40
- }));
41
- const resize = useAutoResize(inputRef, wrapperRef, rowRange, props.value);
42
- return (React.createElement(FormField.FormField, Object.assign({}, props, { type: props.multiline ? "textarea" : "text", inputRef: inputRef, actionsRef: actionsRef, wrapperRef: wrapperRef, onChange: handleChange, rows: rowRange.min })));
43
- function handleChange(newValue) {
44
- props.onChange && props.onChange(newValue);
45
- if (inputRef &&
46
- inputRef.current instanceof HTMLTextAreaElement &&
47
- wrapperRef &&
48
- (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current) instanceof HTMLDivElement) {
49
- resize(inputRef.current, wrapperRef.current);
50
- }
51
- }
52
- function getRowRange() {
53
- if (props.rows === undefined) {
54
- return { min: 3, max: 3 };
55
- }
56
- else if (typeof props.rows === "object") {
57
- return { min: props.rows.min, max: props.rows.max };
58
- }
59
- else {
60
- return { min: props.rows, max: props.rows };
61
- }
62
- }
63
- function insertText(text) {
64
- var _a;
65
- const input = inputRef.current;
66
- if (input) {
67
- insertAtCursor(input, text);
68
- const newValue = input.value;
69
- (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(newValue);
70
- props.onChange && props.onChange(newValue);
71
- }
72
- }
73
- }
74
- const InputText = React.forwardRef(InputTextInternal);
75
- function insertAtCursor(input, newText) {
76
- const start = input.selectionStart || 0;
77
- const end = input.selectionEnd || 0;
78
- const text = input.value;
79
- const before = text.substring(0, start);
80
- const after = text.substring(end, text.length);
81
- input.value = before + newText + after;
82
- input.selectionStart = input.selectionEnd = start + newText.length;
83
- input.focus();
84
- }
85
- function useAutoResize(inputRef, wrapperRef, rowRange, value) {
86
- useSafeLayoutEffect.useSafeLayoutEffect_1(() => {
87
- if (inputRef &&
88
- inputRef.current instanceof HTMLTextAreaElement &&
89
- wrapperRef &&
90
- wrapperRef.current instanceof HTMLDivElement) {
91
- resize(inputRef.current, wrapperRef.current);
92
- }
93
- }, [inputRef.current, wrapperRef.current]);
94
- // When the consumer passes a new controlled value, we need to recheck the size.
95
- // The timeout ensures the DOM has a enough time to render the new text before
96
- // we access the height.
97
- useSafeLayoutEffect.useSafeLayoutEffect_1(() => {
98
- setTimeout(() => {
99
- if (inputRef &&
100
- inputRef.current instanceof HTMLTextAreaElement &&
101
- wrapperRef &&
102
- wrapperRef.current instanceof HTMLDivElement) {
103
- resize(inputRef.current, wrapperRef.current);
104
- }
105
- }, 0);
106
- }, [value]);
107
- function resize(textArea, wrapper) {
108
- if (rowRange.min === rowRange.max)
109
- return;
110
- textArea.style.flexBasis = "auto";
111
- wrapper.style.height = "auto";
112
- textArea.style.flexBasis = textAreaHeight(textArea) + "px";
113
- }
114
- function textAreaHeight(textArea) {
115
- const { lineHeight, borderBottomWidth, borderTopWidth, paddingBottom, paddingTop, } = window.getComputedStyle(textArea);
116
- const maxHeight = rowRange.max * parseFloat(lineHeight) +
117
- parseFloat(borderTopWidth) +
118
- parseFloat(borderBottomWidth) +
119
- parseFloat(paddingTop) +
120
- parseFloat(paddingBottom);
121
- const scrollHeight = textArea.scrollHeight +
122
- parseFloat(borderTopWidth) +
123
- parseFloat(borderBottomWidth);
124
- return Math.min(scrollHeight, maxHeight);
125
- }
126
- return resize;
127
- }
128
-
129
- exports.InputText = InputText;
@@ -1,127 +0,0 @@
1
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
2
- import { u as useSafeLayoutEffect_1 } from './useSafeLayoutEffect-es.js';
3
- import { e as FormField } from './FormField-es.js';
4
- import './tslib.es6-es.js';
5
- import 'react-hook-form';
6
- import 'framer-motion';
7
- import '@jobber/design';
8
- import 'classnames';
9
- import 'react-router-dom';
10
-
11
- function InputTextInternal(props, ref) {
12
- const inputRef = useRef(null);
13
- const actionsRef = useRef(null);
14
- const wrapperRef = useRef(null);
15
- const rowRange = getRowRange();
16
- useImperativeHandle(ref, () => ({
17
- insert: (text) => {
18
- insertText(text);
19
- },
20
- blur: () => {
21
- const input = inputRef.current;
22
- if (input) {
23
- input.blur();
24
- }
25
- },
26
- focus: () => {
27
- const input = inputRef.current;
28
- if (input) {
29
- input.focus();
30
- }
31
- },
32
- scrollIntoView: arg => {
33
- const input = inputRef.current;
34
- if (input) {
35
- input.scrollIntoView(arg);
36
- }
37
- },
38
- }));
39
- const resize = useAutoResize(inputRef, wrapperRef, rowRange, props.value);
40
- return (React.createElement(FormField, Object.assign({}, props, { type: props.multiline ? "textarea" : "text", inputRef: inputRef, actionsRef: actionsRef, wrapperRef: wrapperRef, onChange: handleChange, rows: rowRange.min })));
41
- function handleChange(newValue) {
42
- props.onChange && props.onChange(newValue);
43
- if (inputRef &&
44
- inputRef.current instanceof HTMLTextAreaElement &&
45
- wrapperRef &&
46
- (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current) instanceof HTMLDivElement) {
47
- resize(inputRef.current, wrapperRef.current);
48
- }
49
- }
50
- function getRowRange() {
51
- if (props.rows === undefined) {
52
- return { min: 3, max: 3 };
53
- }
54
- else if (typeof props.rows === "object") {
55
- return { min: props.rows.min, max: props.rows.max };
56
- }
57
- else {
58
- return { min: props.rows, max: props.rows };
59
- }
60
- }
61
- function insertText(text) {
62
- var _a;
63
- const input = inputRef.current;
64
- if (input) {
65
- insertAtCursor(input, text);
66
- const newValue = input.value;
67
- (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(newValue);
68
- props.onChange && props.onChange(newValue);
69
- }
70
- }
71
- }
72
- const InputText = forwardRef(InputTextInternal);
73
- function insertAtCursor(input, newText) {
74
- const start = input.selectionStart || 0;
75
- const end = input.selectionEnd || 0;
76
- const text = input.value;
77
- const before = text.substring(0, start);
78
- const after = text.substring(end, text.length);
79
- input.value = before + newText + after;
80
- input.selectionStart = input.selectionEnd = start + newText.length;
81
- input.focus();
82
- }
83
- function useAutoResize(inputRef, wrapperRef, rowRange, value) {
84
- useSafeLayoutEffect_1(() => {
85
- if (inputRef &&
86
- inputRef.current instanceof HTMLTextAreaElement &&
87
- wrapperRef &&
88
- wrapperRef.current instanceof HTMLDivElement) {
89
- resize(inputRef.current, wrapperRef.current);
90
- }
91
- }, [inputRef.current, wrapperRef.current]);
92
- // When the consumer passes a new controlled value, we need to recheck the size.
93
- // The timeout ensures the DOM has a enough time to render the new text before
94
- // we access the height.
95
- useSafeLayoutEffect_1(() => {
96
- setTimeout(() => {
97
- if (inputRef &&
98
- inputRef.current instanceof HTMLTextAreaElement &&
99
- wrapperRef &&
100
- wrapperRef.current instanceof HTMLDivElement) {
101
- resize(inputRef.current, wrapperRef.current);
102
- }
103
- }, 0);
104
- }, [value]);
105
- function resize(textArea, wrapper) {
106
- if (rowRange.min === rowRange.max)
107
- return;
108
- textArea.style.flexBasis = "auto";
109
- wrapper.style.height = "auto";
110
- textArea.style.flexBasis = textAreaHeight(textArea) + "px";
111
- }
112
- function textAreaHeight(textArea) {
113
- const { lineHeight, borderBottomWidth, borderTopWidth, paddingBottom, paddingTop, } = window.getComputedStyle(textArea);
114
- const maxHeight = rowRange.max * parseFloat(lineHeight) +
115
- parseFloat(borderTopWidth) +
116
- parseFloat(borderBottomWidth) +
117
- parseFloat(paddingTop) +
118
- parseFloat(paddingBottom);
119
- const scrollHeight = textArea.scrollHeight +
120
- parseFloat(borderTopWidth) +
121
- parseFloat(borderBottomWidth);
122
- return Math.min(scrollHeight, maxHeight);
123
- }
124
- return resize;
125
- }
126
-
127
- export { InputText as I };