@ctlyst.id/internal-ui 2.0.21 → 2.0.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,10 @@
1
- import type { CheckboxProps } from '@chakra-ui/react';
1
+ import type { BoxProps, CheckboxProps } from '@chakra-ui/react';
2
2
  import type { PropsWithChildren } from 'react';
3
3
  export interface CheckboxComponentProps extends CheckboxProps, PropsWithChildren {
4
4
  isError?: boolean;
5
5
  helpText?: string;
6
6
  errorText?: string;
7
+ boxProps?: BoxProps;
7
8
  }
8
- declare function CheckboxComponent({ isError, helpText, errorText, children, isDisabled, ...rest }: CheckboxComponentProps): JSX.Element;
9
- declare namespace CheckboxComponent {
10
- var defaultProps: {
11
- isError: boolean;
12
- helpText: string;
13
- errorText: string;
14
- };
15
- }
9
+ declare const CheckboxComponent: import("@chakra-ui/system/dist/system.types").ComponentWithAs<"input", CheckboxComponentProps>;
16
10
  export default CheckboxComponent;
@@ -390,19 +390,21 @@ CardCustom.defaultProps = {
390
390
  isRounded: true
391
391
  };
392
392
 
393
- function CheckboxComponent({
393
+ const CheckboxComponent = /*#__PURE__*/react.forwardRef(({
394
394
  isError = false,
395
395
  helpText = '',
396
396
  errorText = '',
397
+ boxProps,
397
398
  children,
398
399
  isDisabled,
399
400
  ...rest
400
- }) {
401
+ }, ref) => {
401
402
  const variant = isError ? 'errors' : 'unstyled';
402
- return /*#__PURE__*/React__default.createElement(react.Box, null, /*#__PURE__*/React__default.createElement(react.Box, {
403
+ return /*#__PURE__*/React__default.createElement(react.Box, Object.assign({}, boxProps), /*#__PURE__*/React__default.createElement(react.Box, {
403
404
  display: "flex"
404
405
  }, /*#__PURE__*/React__default.createElement(react.Checkbox, Object.assign({
405
- variant: variant
406
+ variant: variant,
407
+ ref: ref
406
408
  }, rest, {
407
409
  isDisabled: isDisabled
408
410
  }), children && /*#__PURE__*/React__default.createElement(react.Text, {
@@ -410,7 +412,7 @@ function CheckboxComponent({
410
412
  display: "block",
411
413
  textStyle: "text.sm",
412
414
  color: isDisabled ? 'black.medium' : 'black.high'
413
- }, children))), /*#__PURE__*/React__default.createElement(react.Box, {
415
+ }, children))), (isError || helpText) && /*#__PURE__*/React__default.createElement(react.Box, {
414
416
  mt: "5px",
415
417
  ml: "24px"
416
418
  }, isError ? /*#__PURE__*/React__default.createElement(react.Text, {
@@ -424,11 +426,12 @@ function CheckboxComponent({
424
426
  textStyle: "text.xs",
425
427
  color: "black.medium"
426
428
  }, helpText)));
427
- }
429
+ });
428
430
  CheckboxComponent.defaultProps = {
429
431
  isError: false,
430
432
  helpText: '',
431
- errorText: ''
433
+ errorText: '',
434
+ boxProps: {}
432
435
  };
433
436
 
434
437
  const Field = props => {