colibri-ui 0.7.30 → 0.7.32

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,13 @@
1
- import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
2
- import { Control, FakeCheckbox, Text, Label } from './styles.js';
1
+ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
2
+ import Typography from '../Typography/index.js';
3
+ import { Label, Wrapper, Control, FakeCheckbox, Text, Root } from './styles.js';
3
4
 
4
5
  var Checkbox = function Checkbox(_a) {
5
6
  var id = _a.id,
6
7
  name = _a.name,
7
8
  value = _a.value,
8
9
  label = _a.label,
10
+ hint = _a.hint,
9
11
  checked = _a.checked,
10
12
  onChange = _a.onChange,
11
13
  onFocus = _a.onFocus,
@@ -15,29 +17,35 @@ var Checkbox = function Checkbox(_a) {
15
17
  className = _a.className,
16
18
  disabled = _a.disabled,
17
19
  isError = _a.isError;
18
- var control = jsxs(Fragment, {
19
- children: [jsx(Control, {
20
- className: className,
21
- type: "checkbox",
22
- id: id,
23
- variant: variant,
24
- name: name,
25
- value: value,
26
- checked: checked,
27
- onChange: onChange,
28
- onFocus: onFocus,
29
- onBlur: onBlur,
30
- disabled: disabled
31
- }), jsx(FakeCheckbox, {
32
- variant: variant,
33
- checked: checked,
34
- isError: isError
35
- }), jsx(Text, {
36
- children: label
37
- })]
20
+ var control = jsx(Label, {
21
+ children: jsxs(Wrapper, {
22
+ children: [jsx(Control, {
23
+ className: className,
24
+ type: "checkbox",
25
+ id: id,
26
+ variant: variant,
27
+ name: name,
28
+ value: value,
29
+ checked: checked,
30
+ onChange: onChange,
31
+ onFocus: onFocus,
32
+ onBlur: onBlur,
33
+ disabled: disabled
34
+ }), jsx(FakeCheckbox, {
35
+ variant: variant,
36
+ checked: checked,
37
+ isError: isError
38
+ }), jsx(Text, {
39
+ children: label
40
+ })]
41
+ })
38
42
  });
39
- return jsx(Label, {
40
- children: control
43
+ return jsxs(Root, {
44
+ children: [control, hint && jsx(Typography, {
45
+ variant: isError ? "alert" : "secondary",
46
+ tag: "span",
47
+ children: hint
48
+ })]
41
49
  });
42
50
  };
43
51
 
@@ -23,6 +23,7 @@ export interface CheckboxProps {
23
23
  name?: string;
24
24
  value?: string | number;
25
25
  label?: ReactNode;
26
+ hint?: ReactNode;
26
27
  checked?: boolean;
27
28
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
28
29
  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
@@ -1,5 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import type { CheckboxVariant } from "./index.props";
3
+ export declare const Root: import("@emotion/styled").StyledComponent<{
4
+ theme?: import("@emotion/react").Theme | undefined;
5
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
6
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
7
+ export declare const Wrapper: import("@emotion/styled").StyledComponent<{
8
+ theme?: import("@emotion/react").Theme | undefined;
9
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
10
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
3
11
  export declare const Label: import("@emotion/styled").StyledComponent<{
4
12
  theme?: import("@emotion/react").Theme | undefined;
5
13
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;