@invoicebox/ui 0.1.0-alpha.207 → 0.1.0-alpha.209

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.
@@ -11,7 +11,7 @@ export type TGroup = {
11
11
  id: string;
12
12
  entity?: unknown;
13
13
  };
14
- export type TProps<TValue> = Pick<TInputProps, 'label' | 'hasError' | 'placeholder' | 'name' | 'size'> & {
14
+ export type TProps<TValue> = Pick<TInputProps, 'label' | 'hasError' | 'placeholder' | 'name' | 'size' | 'onBlur'> & {
15
15
  value: TValue | null;
16
16
  onChange: (value: TValue | null) => void;
17
17
  options: TOption<TValue>[];
@@ -26,4 +26,4 @@ export type TProps<TValue> = Pick<TInputProps, 'label' | 'hasError' | 'placehold
26
26
  emptyOptionsLabel?: string;
27
27
  isLoading?: boolean;
28
28
  };
29
- export declare const Select: <TValue extends string | number>({ label, hasError, placeholder, name, value, onChange, options, groups, isResetButtonEnabled, size, renderOption, dropdownHeader, isDrawerOptions, renderGroup, scrollbarMaxHeight, scrollbarHeader, emptyOptionsLabel, isLoading, }: TProps<TValue>) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const Select: <TValue extends string | number>({ label, hasError, placeholder, name, value, onChange, options, groups, isResetButtonEnabled, size, renderOption, dropdownHeader, isDrawerOptions, renderGroup, scrollbarMaxHeight, scrollbarHeader, emptyOptionsLabel, isLoading, onBlur, }: TProps<TValue>) => import("react/jsx-runtime").JSX.Element;
@@ -49,9 +49,12 @@ var Select = exports.Select = function Select(_ref) {
49
49
  scrollbarMaxHeight = _ref$scrollbarMaxHeig === void 0 ? MAX_LIST_HEIGHT : _ref$scrollbarMaxHeig,
50
50
  scrollbarHeader = _ref.scrollbarHeader,
51
51
  emptyOptionsLabel = _ref.emptyOptionsLabel,
52
- isLoading = _ref.isLoading;
52
+ isLoading = _ref.isLoading,
53
+ onBlur = _ref.onBlur;
53
54
  var palette = (0, _palette.useComponentPalette)('select');
54
- var _useInputFocus = (0, _useInputFocus2.useInputFocus)(),
55
+ var _useInputFocus = (0, _useInputFocus2.useInputFocus)({
56
+ onBlur: onBlur
57
+ }),
55
58
  inFocus = _useInputFocus.inFocus,
56
59
  focusHandler = _useInputFocus.handleFocus,
57
60
  blurHandler = _useInputFocus.handleBlur;
@@ -1,7 +1,7 @@
1
1
  import { TCreateErrorFunc } from './types';
2
2
  export declare class Validate {
3
3
  static bic(value: string, createError: TCreateErrorFunc): any;
4
- static website(value: string, createError: TCreateErrorFunc): any;
4
+ static website(value: string, createError: TCreateErrorFunc, isOnlyHttpsFormat?: boolean): any;
5
5
  static vatNumber(value: string, countryId: string, createError: TCreateErrorFunc): any;
6
6
  static taxRegistrationReasonCode(value: string, createError: TCreateErrorFunc): any;
7
7
  static settlementAccount(value: string, bic: string, createError: TCreateErrorFunc): any;
@@ -32,11 +32,15 @@ var Validate = exports.Validate = /*#__PURE__*/function () {
32
32
  }
33
33
  }, {
34
34
  key: "website",
35
- value: function website(value, createError) {
35
+ value: function website(value, createError, isOnlyHttpsFormat) {
36
36
  if (value === '') {
37
37
  return true;
38
38
  }
39
- if (value.match(/^(http[s\u017F]?:\/\/)?(www\.)?([\x2D0-9A-Za-z\u017F\u0401\u0410-\u044F\u0451\u1C80-\u1C83\u1C85\u1C86\u212A]+\.[A-Za-z\u017F\u0401\u0410-\u044F\u0451\u1C80-\u1C83\u1C85\u1C86\u212A]{2,})(\/(?:(?![\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uD800-\uDFFF\uFEFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])*)?$/i)) {
39
+ var basePattern = "(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)*[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](?::\\d{1,5})?(?:/[\\w\\-.~!$&'()*+,;=:@%/?#]*)?";
40
+ var prefix = isOnlyHttpsFormat ? '^https://' : '^(https://)?';
41
+ var pattern = "".concat(prefix).concat(basePattern, "$");
42
+ var regex = new RegExp(pattern, 'iu');
43
+ if (value.match(regex)) {
40
44
  return true;
41
45
  }
42
46
  return createError('Некорректный адрес');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invoicebox/ui",
3
- "version": "0.1.0-alpha.207",
3
+ "version": "0.1.0-alpha.209",
4
4
  "description": "Invoicebox UI",
5
5
  "license": "Apache License 2.0",
6
6
  "scripts": {