colibri-ui 0.7.103 → 0.7.105

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/Select/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { SelectProps } from "./index.props";
3
- declare const Select: <T extends string>({ options, value, zIndex, label, hint, error, required, placeholder, disabled, size, fullWidth, className, onChange, }: SelectProps<T>) => React.JSX.Element;
3
+ declare const Select: <T extends string>({ options, value, name, zIndex, label, hint, error, required, placeholder, disabled, size, fullWidth, className, onChange, }: SelectProps<T>) => React.JSX.Element;
4
4
  export default Select;
package/Select/index.js CHANGED
@@ -22,6 +22,7 @@ var Select = function Select(_a) {
22
22
  var _b = _a.options,
23
23
  options = _b === void 0 ? [] : _b,
24
24
  value = _a.value,
25
+ name = _a.name,
25
26
  zIndex = _a.zIndex,
26
27
  label = _a.label,
27
28
  hint = _a.hint,
@@ -94,6 +95,7 @@ var Select = function Select(_a) {
94
95
  className: clx(styles__default.default.placeholder)
95
96
  }, placeholder))), /*#__PURE__*/React__default.default.createElement("input", {
96
97
  type: "hidden",
98
+ name: name,
97
99
  tabIndex: -1,
98
100
  value: value || ""
99
101
  }))));
@@ -17,6 +17,7 @@ export interface SelectProps<T extends string> extends Omit<FormFieldProps, "chi
17
17
  required?: boolean;
18
18
  size?: Size;
19
19
  className?: string;
20
+ name?: string;
20
21
  }
21
22
  export type Coordinates = {
22
23
  top: number;
@@ -3,6 +3,7 @@ import type { FC } from "react";
3
3
  interface TimeSelectProps extends Omit<SelectProps<string>, 'options'> {
4
4
  interval?: 5 | 10 | 15 | 30;
5
5
  currentDate?: Date | null;
6
+ name?: string;
6
7
  }
7
8
  declare const TimeSelect: FC<TimeSelectProps>;
8
9
  export default TimeSelect;
@@ -14,24 +14,32 @@ var React__default = /*#__PURE__*/_interopDefault(React);
14
14
 
15
15
  var TimeSelect = function TimeSelect(_a) {
16
16
  var value = _a.value,
17
+ name = _a.name,
17
18
  currentDate = _a.currentDate,
18
19
  label = _a.label,
19
20
  _b = _a.interval,
20
21
  interval = _b === void 0 ? 15 : _b,
21
22
  onChange = _a.onChange,
22
- props = tslib.__rest(_a, ["value", "currentDate", "label", "interval", "onChange"]);
23
- var options = React.useMemo(function () {
23
+ props = tslib.__rest(_a, ["value", "name", "currentDate", "label", "interval", "onChange"]);
24
+ var baseOptions = React.useMemo(function () {
24
25
  return helpers.generateSuggest(interval).map(function (item) {
25
26
  return {
26
27
  value: item.time,
27
28
  label: /*#__PURE__*/React__default.default.createElement(index.default, {
28
29
  time: item.time
29
- }),
30
- disabled: !!currentDate && helpers.checkIsBeforeNow(item.time, currentDate)
30
+ })
31
31
  };
32
32
  });
33
33
  }, [interval]);
34
+ var options = React.useMemo(function () {
35
+ return baseOptions.map(function (option) {
36
+ return tslib.__assign(tslib.__assign({}, option), {
37
+ disabled: !!currentDate && helpers.checkIsBeforeNow(option.value, currentDate)
38
+ });
39
+ });
40
+ }, [baseOptions, currentDate]);
34
41
  return /*#__PURE__*/React__default.default.createElement(index$1.default, tslib.__assign({}, props, {
42
+ name: name,
35
43
  value: value,
36
44
  label: label,
37
45
  options: options,
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { SelectProps } from "./index.props";
3
- declare const Select: <T extends string>({ options, value, zIndex, label, hint, error, required, placeholder, disabled, size, fullWidth, className, onChange, }: SelectProps<T>) => React.JSX.Element;
3
+ declare const Select: <T extends string>({ options, value, name, zIndex, label, hint, error, required, placeholder, disabled, size, fullWidth, className, onChange, }: SelectProps<T>) => React.JSX.Element;
4
4
  export default Select;
@@ -12,6 +12,7 @@ var Select = function Select(_a) {
12
12
  var _b = _a.options,
13
13
  options = _b === void 0 ? [] : _b,
14
14
  value = _a.value,
15
+ name = _a.name,
15
16
  zIndex = _a.zIndex,
16
17
  label = _a.label,
17
18
  hint = _a.hint,
@@ -84,6 +85,7 @@ var Select = function Select(_a) {
84
85
  className: clx(styles.placeholder)
85
86
  }, placeholder))), /*#__PURE__*/React__default.createElement("input", {
86
87
  type: "hidden",
88
+ name: name,
87
89
  tabIndex: -1,
88
90
  value: value || ""
89
91
  }))));
@@ -17,6 +17,7 @@ export interface SelectProps<T extends string> extends Omit<FormFieldProps, "chi
17
17
  required?: boolean;
18
18
  size?: Size;
19
19
  className?: string;
20
+ name?: string;
20
21
  }
21
22
  export type Coordinates = {
22
23
  top: number;
@@ -3,6 +3,7 @@ import type { FC } from "react";
3
3
  interface TimeSelectProps extends Omit<SelectProps<string>, 'options'> {
4
4
  interval?: 5 | 10 | 15 | 30;
5
5
  currentDate?: Date | null;
6
+ name?: string;
6
7
  }
7
8
  declare const TimeSelect: FC<TimeSelectProps>;
8
9
  export default TimeSelect;
@@ -6,24 +6,32 @@ import OptionLabel from './Label/index.js';
6
6
 
7
7
  var TimeSelect = function TimeSelect(_a) {
8
8
  var value = _a.value,
9
+ name = _a.name,
9
10
  currentDate = _a.currentDate,
10
11
  label = _a.label,
11
12
  _b = _a.interval,
12
13
  interval = _b === void 0 ? 15 : _b,
13
14
  onChange = _a.onChange,
14
- props = __rest(_a, ["value", "currentDate", "label", "interval", "onChange"]);
15
- var options = useMemo(function () {
15
+ props = __rest(_a, ["value", "name", "currentDate", "label", "interval", "onChange"]);
16
+ var baseOptions = useMemo(function () {
16
17
  return generateSuggest(interval).map(function (item) {
17
18
  return {
18
19
  value: item.time,
19
20
  label: /*#__PURE__*/React__default.createElement(OptionLabel, {
20
21
  time: item.time
21
- }),
22
- disabled: !!currentDate && checkIsBeforeNow(item.time, currentDate)
22
+ })
23
23
  };
24
24
  });
25
25
  }, [interval]);
26
+ var options = useMemo(function () {
27
+ return baseOptions.map(function (option) {
28
+ return __assign(__assign({}, option), {
29
+ disabled: !!currentDate && checkIsBeforeNow(option.value, currentDate)
30
+ });
31
+ });
32
+ }, [baseOptions, currentDate]);
26
33
  return /*#__PURE__*/React__default.createElement(Select, __assign({}, props, {
34
+ name: name,
27
35
  value: value,
28
36
  label: label,
29
37
  options: options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.7.103",
3
+ "version": "0.7.105",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "scripts": {},