@televet/kibble-ui 1.10.2 → 1.11.0

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.
@@ -0,0 +1,7 @@
1
+ import { CheckboxProps as CCheckboxProps } from '@chakra-ui/react';
2
+ import { CheckboxSize, CheckboxVariant } from './checkbox.types';
3
+ export interface CheckboxProps extends CCheckboxProps {
4
+ size?: CheckboxSize;
5
+ variant?: CheckboxVariant;
6
+ }
7
+ export declare const Checkbox: ({ children, size, variant, isIndeterminate, ...rest }: CheckboxProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { ComponentStyleConfig } from '@chakra-ui/react';
2
+ export declare const CheckboxConfig: ComponentStyleConfig;
@@ -0,0 +1,2 @@
1
+ export declare type CheckboxSize = 'sm' | 'md' | 'lg';
2
+ export declare type CheckboxVariant = 'square' | 'round';
@@ -0,0 +1,15 @@
1
+ import { CheckboxGroupProps as CCheckboxGroupProps, SystemProps } from '@chakra-ui/react';
2
+ import { WithFormControlProps } from 'components/Forms/FormControl/formControl.component';
3
+ import React from 'react';
4
+ import { FlexDirection } from 'shared/types';
5
+ import { CheckboxProps } from '../../checkbox.component';
6
+ import { CheckboxSize } from '../../checkbox.types';
7
+ export interface CheckboxGroupProps extends WithFormControlProps, CCheckboxGroupProps {
8
+ size?: CheckboxSize;
9
+ checkboxes: CheckboxProps[];
10
+ direction?: FlexDirection;
11
+ spacing?: SystemProps['margin'];
12
+ $isFieldInline?: boolean;
13
+ }
14
+ declare const WrappedCheckboxGroup: React.FC<CheckboxGroupProps & WithFormControlProps>;
15
+ export { WrappedCheckboxGroup as CheckboxGroup };
@@ -0,0 +1,5 @@
1
+ export { CheckboxGroup as CCheckboxGroup, useCheckbox, useCheckboxGroup } from '@chakra-ui/react';
2
+ export * from './components/CheckboxGroup/checkboxGroup.component';
3
+ export * from './checkbox.component';
4
+ export * from './checkbox.config';
5
+ export * from './checkbox.types';
@@ -1,12 +1,13 @@
1
1
  import { RadioGroupProps as CRadioGroupProps, SystemProps } from '@chakra-ui/react';
2
2
  import { WithFormControlProps } from 'components/Forms/FormControl/formControl.component';
3
3
  import React from 'react';
4
+ import { FlexDirection } from 'shared/types';
4
5
  import { RadioProps } from '../../radio.component';
5
- import { RadioGroupDirection, RadioSize } from '../../radio.types';
6
+ import { RadioSize } from '../../radio.types';
6
7
  export interface RadioGroupProps extends WithFormControlProps, CRadioGroupProps {
7
8
  size?: RadioSize;
8
9
  radios: RadioProps[];
9
- direction?: RadioGroupDirection;
10
+ direction?: FlexDirection;
10
11
  spacing?: SystemProps['margin'];
11
12
  $isFieldInline?: boolean;
12
13
  }
@@ -1,4 +1,4 @@
1
- export { RadioGroup as CRadioGroup, useRadioGroup, useRadioGroupContext } from '@chakra-ui/react';
1
+ export { RadioGroup as CRadioGroup, useRadio, useRadioGroup } from '@chakra-ui/react';
2
2
  export * from './components/RadioGroup/radioGroup.component';
3
3
  export * from './radio.component';
4
4
  export * from './radio.config';
@@ -1,2 +1 @@
1
1
  export declare type RadioSize = 'sm' | 'md' | 'lg';
2
- export declare type RadioGroupDirection = 'row' | 'column';
@@ -1,4 +1,5 @@
1
1
  export * from './Button';
2
+ export * from './Checkbox';
2
3
  export * from './Textarea';
3
4
  export * from './TextInput';
4
5
  export * from './Radio';
package/build/index.js CHANGED
@@ -3599,6 +3599,166 @@ function withFormControl(Component) {
3599
3599
  return WithFormControl;
3600
3600
  }
3601
3601
 
3602
+ var Checkbox = function (_a) {
3603
+ var children = _a.children, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.variant, variant = _c === void 0 ? 'square' : _c, isIndeterminate = _a.isIndeterminate, rest = __rest(_a, ["children", "size", "variant", "isIndeterminate"]);
3604
+ var iconName = isIndeterminate && variant === 'square' ? 'minus' : 'checkmark';
3605
+ return (React__default["default"].createElement(react.Checkbox, __assign({}, rest, { size: size, icon: React__default["default"].createElement(Icon, { name: iconName, size: size }), variant: variant, alignItems: "flex-start" }), children));
3606
+ };
3607
+
3608
+ var CheckboxGroup = function (_a) {
3609
+ var checkboxes = _a.checkboxes, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.direction, direction = _c === void 0 ? 'row' : _c, spacing = _a.spacing, rest = __rest(_a, ["checkboxes", "size", "direction", "spacing"]);
3610
+ rest.$isFieldInline; var domProps = __rest(rest, ["$isFieldInline"]);
3611
+ return (React__default["default"].createElement(react.CheckboxGroup, __assign({}, domProps),
3612
+ React__default["default"].createElement(react.Stack, { direction: direction, spacing: spacing }, checkboxes.map(function (checkbox, index) { return (React__default["default"].createElement(Checkbox, __assign({ key: index }, checkbox, { size: size }))); }))));
3613
+ };
3614
+ CheckboxGroup.displayName = 'CheckboxGroup';
3615
+ var WrappedCheckboxGroup = withFormControl(CheckboxGroup);
3616
+
3617
+ var CheckboxConfig = {
3618
+ baseStyle: {
3619
+ label: {
3620
+ color: adaptiveColors.text.light.default,
3621
+ marginLeft: 2,
3622
+ },
3623
+ },
3624
+ sizes: {
3625
+ sm: {
3626
+ control: {
3627
+ height: 3,
3628
+ width: 3,
3629
+ mt: 1,
3630
+ },
3631
+ label: {
3632
+ fontSize: fontSizes.sm,
3633
+ },
3634
+ },
3635
+ md: {
3636
+ control: {
3637
+ height: 4,
3638
+ width: 4,
3639
+ mt: 1,
3640
+ },
3641
+ label: {
3642
+ fontSize: fontSizes.md,
3643
+ },
3644
+ },
3645
+ lg: {
3646
+ control: {
3647
+ height: 5,
3648
+ width: 5,
3649
+ mt: '3px',
3650
+ },
3651
+ label: {
3652
+ fontSize: fontSizes.lg,
3653
+ marginLeft: 3,
3654
+ },
3655
+ },
3656
+ },
3657
+ variants: {
3658
+ square: {
3659
+ control: {
3660
+ bg: colors.white,
3661
+ border: borders['1px'],
3662
+ borderColor: colors.border.light.medium,
3663
+ borderRadius: radii.sm,
3664
+ color: colors.white,
3665
+ _hover: {
3666
+ borderColor: colors.border.light.heavy,
3667
+ _disabled: {
3668
+ borderColor: colors.gray[200],
3669
+ },
3670
+ },
3671
+ _checked: {
3672
+ bg: colors.teal['600'],
3673
+ borderColor: colors.teal['600'],
3674
+ color: colors.white,
3675
+ _hover: {
3676
+ bg: colors.teal['700'],
3677
+ borderColor: colors.teal['700'],
3678
+ },
3679
+ _disabled: {
3680
+ bg: colors.teal[600],
3681
+ borderColor: colors.teal[600],
3682
+ color: colors.white,
3683
+ _hover: {
3684
+ bg: colors.teal[600],
3685
+ borderColor: colors.teal[600],
3686
+ },
3687
+ },
3688
+ },
3689
+ _disabled: {
3690
+ bg: colors.gray[200],
3691
+ borderColor: colors.gray[200],
3692
+ color: colors.gray[200],
3693
+ opacity: 0.4,
3694
+ },
3695
+ _invalid: {
3696
+ borderColor: colors.border.light.error,
3697
+ _hover: {
3698
+ borderColor: colors.border.light.error,
3699
+ },
3700
+ _checked: {
3701
+ borderColor: colors.teal[600],
3702
+ _hover: {
3703
+ borderColor: colors.teal[700],
3704
+ },
3705
+ },
3706
+ _disabled: {
3707
+ color: colors.white,
3708
+ _hover: {
3709
+ borderColor: colors.teal[600],
3710
+ },
3711
+ },
3712
+ },
3713
+ },
3714
+ },
3715
+ round: {
3716
+ control: {
3717
+ bg: colors.background.grayDark,
3718
+ border: borders['1px'],
3719
+ borderColor: colors.transparent,
3720
+ borderRadius: radii.full,
3721
+ color: colors.transparent,
3722
+ _hover: {
3723
+ bg: colors.gray['400'],
3724
+ _disabled: {
3725
+ bg: colors.background.grayDark,
3726
+ },
3727
+ },
3728
+ _checked: {
3729
+ bg: colors.status.success,
3730
+ borderColor: colors.transparent,
3731
+ color: colors.white,
3732
+ _hover: {
3733
+ bg: colors.green['500'],
3734
+ borderColor: colors.transparent,
3735
+ },
3736
+ _disabled: {
3737
+ bg: colors.status.success,
3738
+ borderColor: colors.transparent,
3739
+ color: colors.white,
3740
+ _hover: {
3741
+ bg: colors.status.success,
3742
+ },
3743
+ },
3744
+ _invalid: {
3745
+ borderColor: colors.transparent,
3746
+ },
3747
+ },
3748
+ _disabled: {
3749
+ bg: colors.background.grayDark,
3750
+ borderColor: colors.transparent,
3751
+ color: colors.transparent,
3752
+ opacity: 0.4,
3753
+ },
3754
+ _invalid: {
3755
+ borderColor: colors.border.light.error,
3756
+ },
3757
+ },
3758
+ },
3759
+ },
3760
+ };
3761
+
3602
3762
  var Textarea = function (props) {
3603
3763
  return React__default["default"].createElement(react.Textarea, __assign({ background: colors.background.light }, props));
3604
3764
  };
@@ -3688,7 +3848,7 @@ var TextInputConfig = __assign({}, FormControlConfig);
3688
3848
 
3689
3849
  var Radio = function (_a) {
3690
3850
  var children = _a.children, _b = _a.size, size = _b === void 0 ? 'md' : _b, rest = __rest(_a, ["children", "size"]);
3691
- return (React__default["default"].createElement(react.Radio, __assign({}, rest, { size: size }), children));
3851
+ return (React__default["default"].createElement(react.Radio, __assign({}, rest, { size: size, alignItems: "flex-start" }), children));
3692
3852
  };
3693
3853
 
3694
3854
  var RadioGroup = function (_a) {
@@ -3763,8 +3923,9 @@ var RadioConfig = {
3763
3923
  fontSize: fontSizes.sm,
3764
3924
  },
3765
3925
  control: {
3766
- height: '12px',
3767
- width: '12px',
3926
+ height: 3,
3927
+ width: 3,
3928
+ mt: 1,
3768
3929
  },
3769
3930
  },
3770
3931
  md: {
@@ -3772,8 +3933,9 @@ var RadioConfig = {
3772
3933
  fontSize: fontSizes.md,
3773
3934
  },
3774
3935
  control: {
3775
- height: '16px',
3776
- width: '16px',
3936
+ height: 4,
3937
+ width: 4,
3938
+ mt: 1,
3777
3939
  },
3778
3940
  },
3779
3941
  lg: {
@@ -3782,8 +3944,9 @@ var RadioConfig = {
3782
3944
  marginLeft: 3,
3783
3945
  },
3784
3946
  control: {
3785
- height: '20px',
3786
- width: '20px',
3947
+ height: 5,
3948
+ width: 5,
3949
+ mt: '3px',
3787
3950
  },
3788
3951
  },
3789
3952
  },
@@ -6692,6 +6855,7 @@ var theme = react.extendTheme({
6692
6855
  Tag: TagConfig,
6693
6856
  Tabs: TabsConfig,
6694
6857
  Radio: RadioConfig,
6858
+ Checkbox: CheckboxConfig,
6695
6859
  },
6696
6860
  });
6697
6861
 
@@ -9303,6 +9467,10 @@ Object.defineProperty(exports, 'Box', {
9303
9467
  enumerable: true,
9304
9468
  get: function () { return react.Box; }
9305
9469
  });
9470
+ Object.defineProperty(exports, 'CCheckboxGroup', {
9471
+ enumerable: true,
9472
+ get: function () { return react.CheckboxGroup; }
9473
+ });
9306
9474
  Object.defineProperty(exports, 'CRadioGroup', {
9307
9475
  enumerable: true,
9308
9476
  get: function () { return react.RadioGroup; }
@@ -9471,17 +9639,25 @@ Object.defineProperty(exports, 'WrapItem', {
9471
9639
  enumerable: true,
9472
9640
  get: function () { return react.WrapItem; }
9473
9641
  });
9642
+ Object.defineProperty(exports, 'useCheckbox', {
9643
+ enumerable: true,
9644
+ get: function () { return react.useCheckbox; }
9645
+ });
9646
+ Object.defineProperty(exports, 'useCheckboxGroup', {
9647
+ enumerable: true,
9648
+ get: function () { return react.useCheckboxGroup; }
9649
+ });
9474
9650
  Object.defineProperty(exports, 'useDisclosure', {
9475
9651
  enumerable: true,
9476
9652
  get: function () { return react.useDisclosure; }
9477
9653
  });
9478
- Object.defineProperty(exports, 'useRadioGroup', {
9654
+ Object.defineProperty(exports, 'useRadio', {
9479
9655
  enumerable: true,
9480
- get: function () { return react.useRadioGroup; }
9656
+ get: function () { return react.useRadio; }
9481
9657
  });
9482
- Object.defineProperty(exports, 'useRadioGroupContext', {
9658
+ Object.defineProperty(exports, 'useRadioGroup', {
9483
9659
  enumerable: true,
9484
- get: function () { return react.useRadioGroupContext; }
9660
+ get: function () { return react.useRadioGroup; }
9485
9661
  });
9486
9662
  exports.Avatar = Avatar;
9487
9663
  exports.AvatarConfig = AvatarConfig;
@@ -9491,6 +9667,9 @@ exports.BetaModal = modal_component;
9491
9667
  exports.Button = Button;
9492
9668
  exports.ButtonSizeConfig = ButtonSizeConfig;
9493
9669
  exports.ButtonVariantConfig = ButtonVariantConfig;
9670
+ exports.Checkbox = Checkbox;
9671
+ exports.CheckboxConfig = CheckboxConfig;
9672
+ exports.CheckboxGroup = WrappedCheckboxGroup;
9494
9673
  exports.DrawerConfig = DrawerConfig;
9495
9674
  exports.Heading = Heading;
9496
9675
  exports.HeadingConfig = HeadingConfig;