@jobber/components 6.11.3 → 6.11.5
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/index.cjs +11 -2
- package/dist/Autocomplete/index.mjs +11 -2
- package/dist/Autocomplete-cjs.js +2 -2
- package/dist/Autocomplete-es.js +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -2
- package/dist/Chips/InternalChipDismissible/index.cjs +2 -2
- package/dist/Chips/InternalChipDismissible/index.mjs +2 -2
- package/dist/Chips/index.cjs +2 -2
- package/dist/Chips/index.mjs +2 -2
- package/dist/DataList/components/DataListSearch/index.cjs +10 -1
- package/dist/DataList/components/DataListSearch/index.mjs +10 -1
- package/dist/DataList/index.cjs +8 -1
- package/dist/DataList/index.mjs +8 -1
- package/dist/DataListSearch-cjs.js +2 -2
- package/dist/DataListSearch-es.js +1 -1
- package/dist/DatePicker/index.cjs +3 -2
- package/dist/DatePicker/index.mjs +3 -2
- package/dist/DatePicker-cjs.js +2 -781
- package/dist/DatePicker-es.js +3 -781
- package/dist/FormField/FormFieldTypes.d.ts +3 -3
- package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +3 -3
- package/dist/FormField-cjs.js +5 -2
- package/dist/FormField-es.js +3 -3
- package/dist/InputDate/index.cjs +16 -15
- package/dist/InputDate/index.mjs +16 -15
- package/dist/InputDate-cjs.js +3 -2
- package/dist/InputDate-es.js +2 -1
- package/dist/InputText/InputText.d.ts +10 -20
- package/dist/InputText/InputText.rebuilt.d.ts +3 -0
- package/dist/InputText/InputText.types.d.ts +78 -0
- package/dist/InputText/index.cjs +263 -8
- package/dist/InputText/index.d.ts +5 -1
- package/dist/InputText/index.mjs +266 -7
- package/dist/InputText/useInputTextActions.d.ts +16 -0
- package/dist/InputText/useInputTextFormField.d.ts +347 -0
- package/dist/InputText/useTextAreaResize.d.ts +14 -0
- package/dist/List/index.cjs +2 -2
- package/dist/List/index.mjs +2 -2
- package/dist/_baseEach-cjs.js +12 -12
- package/dist/_baseEach-es.js +2 -2
- package/dist/_baseFlatten-cjs.js +2 -2
- package/dist/_baseFlatten-es.js +1 -1
- package/dist/{_getAllKeys-cjs.js → _baseGet-cjs.js} +181 -181
- package/dist/{_getAllKeys-es.js → _baseGet-es.js} +183 -183
- package/dist/index.cjs +4 -3
- package/dist/index.mjs +3 -2
- package/dist/isTypedArray-es.js +1 -1
- package/dist/omit-cjs.js +783 -0
- package/dist/omit-es.js +781 -0
- package/dist/styles.css +0 -1
- package/dist/useScrollToActive-cjs.js +3 -3
- package/dist/useScrollToActive-es.js +1 -1
- package/package.json +2 -2
- package/dist/InputText-cjs.js +0 -129
- package/dist/InputText-es.js +0 -127
package/dist/styles.css
CHANGED
|
@@ -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
|
|
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 =
|
|
150
|
-
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 './
|
|
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.11.
|
|
3
|
+
"version": "6.11.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -488,5 +488,5 @@
|
|
|
488
488
|
"> 1%",
|
|
489
489
|
"IE 10"
|
|
490
490
|
],
|
|
491
|
-
"gitHead": "
|
|
491
|
+
"gitHead": "04861ef5053e267925889d2f6bbdd029c6a6301a"
|
|
492
492
|
}
|
package/dist/InputText-cjs.js
DELETED
|
@@ -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;
|
package/dist/InputText-es.js
DELETED
|
@@ -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 };
|