colibri-ui 0.7.68 → 0.7.70

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.
@@ -4,13 +4,13 @@
4
4
  }
5
5
 
6
6
  .inner {
7
- place-items: stretch flex-start;
8
7
  box-sizing: border-box;
9
8
  display: flex;
10
9
  font-family: Roboto, Arial, sans-serif;
11
10
  -webkit-font-smoothing: antialiased;
12
11
  -moz-osx-font-smoothing: grayscale;
13
12
  min-width: 0;
13
+ place-items: stretch flex-start;
14
14
  transition-duration: 0.3s;
15
15
  transition-property: background, box-shadow, transform;
16
16
  transition-timing-function: ease;
package/Input/index.js CHANGED
@@ -21,15 +21,18 @@ var Input = /*#__PURE__*/React.forwardRef(function (_a, ref) {
21
21
  label = _a.label,
22
22
  hint = _a.hint,
23
23
  error = _a.error,
24
+ required = _a.required,
24
25
  onChange = _a.onChange,
26
+ inputRef = _a.inputRef,
25
27
  _b = _a.variant,
26
28
  variant = _b === void 0 ? "primary" : _b,
27
29
  _c = _a.size,
28
30
  size = _c === void 0 ? "m" : _c,
29
- props = tslib.__rest(_a, ["className", "startIcon", "endIcon", "label", "hint", "error", "onChange", "variant", "size"]);
31
+ props = tslib.__rest(_a, ["className", "startIcon", "endIcon", "label", "hint", "error", "required", "onChange", "inputRef", "variant", "size"]);
30
32
  return /*#__PURE__*/React__default.default.createElement(index.default, {
31
33
  className: classNames__default.default(className),
32
34
  label: label,
35
+ required: required,
33
36
  hint: hint,
34
37
  error: error
35
38
  }, /*#__PURE__*/React__default.default.createElement(index$1.default, {
@@ -41,6 +44,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_a, ref) {
41
44
  disabled: !!props.disabled,
42
45
  error: error
43
46
  }, /*#__PURE__*/React__default.default.createElement(index$2.default, tslib.__assign({
47
+ ref: inputRef,
44
48
  onChange: onChange,
45
49
  type: "text"
46
50
  }, props))));
@@ -1,4 +1,4 @@
1
- import type { ChangeEvent, InputHTMLAttributes, ReactNode } from "react";
1
+ import type { ChangeEvent, ForwardedRef, InputHTMLAttributes, ReactNode } from "react";
2
2
  import type { FormFieldProps } from "../base/FormField/index.props";
3
3
  import type { Size, Variant } from "../base/InputRoot/index.props";
4
4
  export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "size">, Omit<FormFieldProps, "children"> {
@@ -10,4 +10,6 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
10
10
  label?: ReactNode;
11
11
  hint?: ReactNode;
12
12
  error?: boolean;
13
+ required?: boolean;
14
+ inputRef?: ForwardedRef<HTMLInputElement>;
13
15
  }
@@ -21,7 +21,6 @@ interface Props {
21
21
  wrapped?: boolean;
22
22
  className?: string;
23
23
  disabled?: boolean;
24
- hasError?: boolean;
25
24
  }
26
25
  declare const RadioGroup: FC<Props>;
27
26
  export default RadioGroup;
@@ -25,14 +25,11 @@ var RadioGroup = /*#__PURE__*/React.memo(function (_a) {
25
25
  wrapped = _c === void 0 ? false : _c,
26
26
  className = _a.className,
27
27
  _d = _a.disabled,
28
- disabled = _d === void 0 ? false : _d,
29
- _e = _a.hasError,
30
- hasError = _e === void 0 ? false : _e;
28
+ disabled = _d === void 0 ? false : _d;
31
29
  return /*#__PURE__*/React__default.default.createElement("div", {
32
30
  className: clx(styles__default.default.group, {
33
31
  column: column,
34
- wrapped: wrapped,
35
- hasError: hasError
32
+ wrapped: wrapped
36
33
  }, className)
37
34
  }, options.map(function (option) {
38
35
  var id = option.id,
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, placeholder, disabled, fullWidth, onChange, }: SelectProps<T>) => React.JSX.Element;
3
+ declare const Select: <T extends string>({ options, value, zIndex, label, hint, error, required, placeholder, disabled, fullWidth, onChange, }: SelectProps<T>) => React.JSX.Element;
4
4
  export default Select;
package/Select/index.js CHANGED
@@ -26,6 +26,7 @@ var Select = function Select(_a) {
26
26
  label = _a.label,
27
27
  hint = _a.hint,
28
28
  error = _a.error,
29
+ required = _a.required,
29
30
  placeholder = _a.placeholder,
30
31
  disabled = _a.disabled,
31
32
  _c = _a.fullWidth,
@@ -56,6 +57,7 @@ var Select = function Select(_a) {
56
57
  className: clx(styles__default.default["form-field"], {
57
58
  "form-field_fullWidth": fullWidth ? 1 : 0
58
59
  }),
60
+ required: required,
59
61
  label: label,
60
62
  hint: hint,
61
63
  error: error
@@ -12,6 +12,7 @@ export interface SelectProps<T extends string> extends Omit<FormFieldProps, "chi
12
12
  disabled?: boolean;
13
13
  placeholder?: string;
14
14
  fullWidth?: boolean;
15
+ required?: boolean;
15
16
  }
16
17
  export type Coordinates = {
17
18
  top: number;
@@ -1,5 +1,11 @@
1
+ @charset "UTF-8";
1
2
  .container {
2
3
  display: flex;
3
4
  flex-direction: column;
4
5
  gap: 8px;
6
+ }
7
+
8
+ .label_required::after {
9
+ color: var(--typography-alert);
10
+ content: " *";
5
11
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var classNames = require('classnames');
6
+ var classNames = require('classnames/bind');
7
7
  var index = require('../../Typography/index.js');
8
8
  var styles = require('./FormField.module.css');
9
9
 
@@ -13,18 +13,23 @@ var React__default = /*#__PURE__*/_interopDefault(React);
13
13
  var classNames__default = /*#__PURE__*/_interopDefault(classNames);
14
14
  var styles__default = /*#__PURE__*/_interopDefault(styles);
15
15
 
16
+ var clx = classNames__default.default.bind(styles__default.default);
16
17
  var FormField = /*#__PURE__*/React.forwardRef(function (_a, ref) {
17
18
  var label = _a.label,
18
19
  hint = _a.hint,
19
20
  children = _a.children,
20
21
  error = _a.error,
22
+ required = _a.required,
21
23
  className = _a.className;
22
24
  return /*#__PURE__*/React__default.default.createElement("div", {
23
- className: classNames__default.default(styles__default.default.container, className),
25
+ className: clx(styles__default.default.container, className),
24
26
  ref: ref
25
- }, label && /*#__PURE__*/React__default.default.createElement(index.default, {
27
+ }, label && ( /*#__PURE__*/React__default.default.createElement(index.default, {
28
+ className: clx(styles__default.default.label, {
29
+ label_required: !!required
30
+ }),
26
31
  tag: "label"
27
- }, label), children, hint && ( /*#__PURE__*/React__default.default.createElement(index.default, {
32
+ }, label)), children, hint && ( /*#__PURE__*/React__default.default.createElement(index.default, {
28
33
  variant: error ? "alert" : "secondary",
29
34
  tag: "span"
30
35
  }, hint)));
@@ -3,6 +3,7 @@ export type FormFieldProps = {
3
3
  label?: ReactNode;
4
4
  hint?: ReactNode;
5
5
  error?: boolean;
6
+ required?: boolean;
6
7
  className?: string;
7
8
  children: ReactNode;
8
9
  };
@@ -4,13 +4,13 @@
4
4
  }
5
5
 
6
6
  .inner {
7
- place-items: stretch flex-start;
8
7
  box-sizing: border-box;
9
8
  display: flex;
10
9
  font-family: Roboto, Arial, sans-serif;
11
10
  -webkit-font-smoothing: antialiased;
12
11
  -moz-osx-font-smoothing: grayscale;
13
12
  min-width: 0;
13
+ place-items: stretch flex-start;
14
14
  transition-duration: 0.3s;
15
15
  transition-property: background, box-shadow, transform;
16
16
  transition-timing-function: ease;
@@ -12,15 +12,18 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
12
12
  label = _a.label,
13
13
  hint = _a.hint,
14
14
  error = _a.error,
15
+ required = _a.required,
15
16
  onChange = _a.onChange,
17
+ inputRef = _a.inputRef,
16
18
  _b = _a.variant,
17
19
  variant = _b === void 0 ? "primary" : _b,
18
20
  _c = _a.size,
19
21
  size = _c === void 0 ? "m" : _c,
20
- props = __rest(_a, ["className", "startIcon", "endIcon", "label", "hint", "error", "onChange", "variant", "size"]);
22
+ props = __rest(_a, ["className", "startIcon", "endIcon", "label", "hint", "error", "required", "onChange", "inputRef", "variant", "size"]);
21
23
  return /*#__PURE__*/React__default.createElement(FormField, {
22
24
  className: classNames(className),
23
25
  label: label,
26
+ required: required,
24
27
  hint: hint,
25
28
  error: error
26
29
  }, /*#__PURE__*/React__default.createElement(InputRoot, {
@@ -32,6 +35,7 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
32
35
  disabled: !!props.disabled,
33
36
  error: error
34
37
  }, /*#__PURE__*/React__default.createElement(BaseInput, __assign({
38
+ ref: inputRef,
35
39
  onChange: onChange,
36
40
  type: "text"
37
41
  }, props))));
@@ -1,4 +1,4 @@
1
- import type { ChangeEvent, InputHTMLAttributes, ReactNode } from "react";
1
+ import type { ChangeEvent, ForwardedRef, InputHTMLAttributes, ReactNode } from "react";
2
2
  import type { FormFieldProps } from "../base/FormField/index.props";
3
3
  import type { Size, Variant } from "../base/InputRoot/index.props";
4
4
  export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "size">, Omit<FormFieldProps, "children"> {
@@ -10,4 +10,6 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
10
10
  label?: ReactNode;
11
11
  hint?: ReactNode;
12
12
  error?: boolean;
13
+ required?: boolean;
14
+ inputRef?: ForwardedRef<HTMLInputElement>;
13
15
  }
@@ -21,7 +21,6 @@ interface Props {
21
21
  wrapped?: boolean;
22
22
  className?: string;
23
23
  disabled?: boolean;
24
- hasError?: boolean;
25
24
  }
26
25
  declare const RadioGroup: FC<Props>;
27
26
  export default RadioGroup;
@@ -15,14 +15,11 @@ var RadioGroup = /*#__PURE__*/memo(function (_a) {
15
15
  wrapped = _c === void 0 ? false : _c,
16
16
  className = _a.className,
17
17
  _d = _a.disabled,
18
- disabled = _d === void 0 ? false : _d,
19
- _e = _a.hasError,
20
- hasError = _e === void 0 ? false : _e;
18
+ disabled = _d === void 0 ? false : _d;
21
19
  return /*#__PURE__*/React__default.createElement("div", {
22
20
  className: clx(styles.group, {
23
21
  column: column,
24
- wrapped: wrapped,
25
- hasError: hasError
22
+ wrapped: wrapped
26
23
  }, className)
27
24
  }, options.map(function (option) {
28
25
  var id = option.id,
@@ -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, placeholder, disabled, fullWidth, onChange, }: SelectProps<T>) => React.JSX.Element;
3
+ declare const Select: <T extends string>({ options, value, zIndex, label, hint, error, required, placeholder, disabled, fullWidth, onChange, }: SelectProps<T>) => React.JSX.Element;
4
4
  export default Select;
@@ -16,6 +16,7 @@ var Select = function Select(_a) {
16
16
  label = _a.label,
17
17
  hint = _a.hint,
18
18
  error = _a.error,
19
+ required = _a.required,
19
20
  placeholder = _a.placeholder,
20
21
  disabled = _a.disabled,
21
22
  _c = _a.fullWidth,
@@ -46,6 +47,7 @@ var Select = function Select(_a) {
46
47
  className: clx(styles["form-field"], {
47
48
  "form-field_fullWidth": fullWidth ? 1 : 0
48
49
  }),
50
+ required: required,
49
51
  label: label,
50
52
  hint: hint,
51
53
  error: error
@@ -12,6 +12,7 @@ export interface SelectProps<T extends string> extends Omit<FormFieldProps, "chi
12
12
  disabled?: boolean;
13
13
  placeholder?: string;
14
14
  fullWidth?: boolean;
15
+ required?: boolean;
15
16
  }
16
17
  export type Coordinates = {
17
18
  top: number;
@@ -1,5 +1,11 @@
1
+ @charset "UTF-8";
1
2
  .container {
2
3
  display: flex;
3
4
  flex-direction: column;
4
5
  gap: 8px;
6
+ }
7
+
8
+ .label_required::after {
9
+ color: var(--typography-alert);
10
+ content: " *";
5
11
  }
@@ -1,20 +1,25 @@
1
1
  import React__default, { forwardRef } from 'react';
2
- import classNames from 'classnames';
2
+ import classNames from 'classnames/bind';
3
3
  import Typography from '../../Typography/index.js';
4
4
  import styles from './FormField.module.css';
5
5
 
6
+ var clx = classNames.bind(styles);
6
7
  var FormField = /*#__PURE__*/forwardRef(function (_a, ref) {
7
8
  var label = _a.label,
8
9
  hint = _a.hint,
9
10
  children = _a.children,
10
11
  error = _a.error,
12
+ required = _a.required,
11
13
  className = _a.className;
12
14
  return /*#__PURE__*/React__default.createElement("div", {
13
- className: classNames(styles.container, className),
15
+ className: clx(styles.container, className),
14
16
  ref: ref
15
- }, label && /*#__PURE__*/React__default.createElement(Typography, {
17
+ }, label && ( /*#__PURE__*/React__default.createElement(Typography, {
18
+ className: clx(styles.label, {
19
+ label_required: !!required
20
+ }),
16
21
  tag: "label"
17
- }, label), children, hint && ( /*#__PURE__*/React__default.createElement(Typography, {
22
+ }, label)), children, hint && ( /*#__PURE__*/React__default.createElement(Typography, {
18
23
  variant: error ? "alert" : "secondary",
19
24
  tag: "span"
20
25
  }, hint)));
@@ -3,6 +3,7 @@ export type FormFieldProps = {
3
3
  label?: ReactNode;
4
4
  hint?: ReactNode;
5
5
  error?: boolean;
6
+ required?: boolean;
6
7
  className?: string;
7
8
  children: ReactNode;
8
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.7.68",
3
+ "version": "0.7.70",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "scripts": {},