ab-ui-library 1.57.0 → 1.58.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.
@@ -1,11 +1,12 @@
1
1
  import { _ as _extends } from '../../extends-2419b4fb.js';
2
2
  import { _ as _asyncToGenerator, r as regenerator } from '../../index-afc5608a.js';
3
3
  import React from 'react';
4
- import { useForm } from 'react-hook-form';
4
+ import { appendErrors, useForm } from 'react-hook-form';
5
5
  import classNames from 'classnames';
6
6
  import { FormContext } from '../../context/types.js';
7
7
  import { Button } from '../Button/Button.js';
8
8
  import * as yup from 'yup';
9
+ import { validateFieldsNatively, toNestError } from '@hookform/resolvers';
9
10
  import '../../utils/helpers.js';
10
11
  import 'dayjs';
11
12
  import '../../defineProperty-9000dd50.js';
@@ -34,6 +35,8 @@ import '../../helperComponents/IconDynamicComponent/constants.js';
34
35
  import 'react-syntax-highlighter';
35
36
  import '../Button/consts.js';
36
37
 
38
+ var o=function(o,n,a){return void 0===n&&(n={}),void 0===a&&(a={}),function(s,i,c){try{return Promise.resolve(function(t,r){try{var u=(n.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(o["sync"===a.mode?"validateSync":"validate"](s,Object.assign({abortEarly:!1},n,{context:i}))).then(function(t){return c.shouldUseNativeValidation&&validateFieldsNatively({},c),{values:a.rawValues?s:t,errors:{}}}));}catch(e){return r(e)}return u&&u.then?u.then(void 0,r):u}(0,function(e){if(!e.inner)throw e;return {values:{},errors:toNestError((o=e,n=!c.shouldUseNativeValidation&&"all"===c.criteriaMode,(o.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var o=e[t.path].types,a=o&&o[t.type];e[t.path]=appendErrors(t.path,n,e,t.type,a?[].concat(a,t.message):t.message);}return e},{})),c)};var o,n;}))}catch(e){return Promise.reject(e)}}};
39
+
37
40
  var FormContainer = function FormContainer(props) {
38
41
  var children = props.children,
39
42
  _props$className = props.className,
@@ -53,7 +56,8 @@ var FormContainer = function FormContainer(props) {
53
56
  mode: mode,
54
57
  defaultValues: initialValues,
55
58
  shouldFocusError: shouldFocusError,
56
- shouldUnregister: shouldUnregister
59
+ shouldUnregister: shouldUnregister,
60
+ resolver: o(validationScheme)
57
61
  }),
58
62
  handleSubmit = _useForm.handleSubmit,
59
63
  register = _useForm.register,
@@ -34,3 +34,4 @@ import '../../helperComponents/IconDynamicComponent/constants.js';
34
34
  import 'react-syntax-highlighter';
35
35
  import '../Button/consts.js';
36
36
  import 'yup';
37
+ import '@hookform/resolvers';
@@ -9,7 +9,7 @@ import { useHideOnResize } from '../../../hooks/useHideOnResize.js';
9
9
  import { noop } from '../../../utils/helpers.js';
10
10
  import { useOnOutsideClick } from '../../../hooks/useOnOutsideClick.js';
11
11
  import '../../../hooks/useScreenSize.js';
12
- import { useGetHasBottomSpace, useGetHasTopSpace } from '../../../hooks/useGetHasBottomSpace.js';
12
+ import { useGetHasBottomSpace } from '../../../hooks/useGetHasBottomSpace.js';
13
13
  import 'react-hook-form';
14
14
  import { useRecalculateDropdownPosition } from '../../../hooks/useRecalculateDropdownPosition.js';
15
15
  import { Input } from '../../Input/Input.js';
@@ -285,10 +285,6 @@ var Select = function Select(props) {
285
285
  input: inputRef.current
286
286
  }),
287
287
  hasBottomSpace = _useGetHasBottomSpace.hasBottomSpace;
288
- var hasTopSpace = useGetHasTopSpace({
289
- element: dropdownRef,
290
- input: inputRef.current
291
- });
292
288
  useChangePositionsOnScroll({
293
289
  parentElement: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current,
294
290
  childElement: dropdownRef,
@@ -354,14 +350,14 @@ var Select = function Select(props) {
354
350
  style: _objectSpread({
355
351
  left: left,
356
352
  width: width
357
- }, hasBottomSpace || !hasTopSpace ? {
358
- top: bottom
353
+ }, hasBottomSpace ? {
354
+ top: bottom,
355
+ maxHeight: top - DROPDOWN_AND_INPUT_GAP
359
356
  } : {
360
- bottom: window.innerHeight - top + DROPDOWN_AND_INPUT_GAP
357
+ bottom: window.innerHeight - top + DROPDOWN_AND_INPUT_GAP,
358
+ maxHeight: window.innerHeight - bottom - DROPDOWN_AND_INPUT_GAP
361
359
  }),
362
- ref: function ref(_ref2) {
363
- setDropdownRef(_ref2);
364
- }
360
+ ref: setDropdownRef
365
361
  }, isLoading ? /*#__PURE__*/React.createElement(Loading, null) : /*#__PURE__*/React.createElement("div", {
366
362
  "data-id": "".concat(dataId, "-options-content"),
367
363
  ref: scrollRef,
package/index.js CHANGED
@@ -565,6 +565,7 @@ import './components/Select/SharedComponents/ButtonSelectWrapper/ButtonSelectWra
565
565
  import './components/Select/SharedComponents/ButtonSelectWrapper/Button/Button.js';
566
566
  import './components/DatePicker/types.js';
567
567
  import 'yup';
568
+ import '@hookform/resolvers';
568
569
  import '@hookform/error-message';
569
570
  import './components/FramedIcon/consts.js';
570
571
  import './hooks/useHideBodyScroll.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-ui-library",
3
- "version": "1.57.0",
3
+ "version": "1.58.0",
4
4
  "description": "UI library for AM",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -19,6 +19,7 @@
19
19
  "@dnd-kit/core": "^6.3.1",
20
20
  "@dnd-kit/sortable": "^10.0.0",
21
21
  "@hookform/error-message": "^2.0.1",
22
+ "@hookform/resolvers": "^2.9.11",
22
23
  "@tanstack/react-table": "^8.21.2",
23
24
  "classnames": "^2.3.2",
24
25
  "dayjs": "^1.11.10",