@xqmsg/ui-core 0.16.5 → 0.16.6

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.16.5",
2
+ "version": "0.16.6",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Checkbox } from '@chakra-ui/react';
2
+ import { Checkbox, Text } from '@chakra-ui/react';
3
3
  import { SelectFieldProps } from '../InputTypes';
4
4
 
5
5
  export interface StackedCheckboxProps extends SelectFieldProps {
@@ -12,14 +12,22 @@ export interface StackedCheckboxProps extends SelectFieldProps {
12
12
  const StackedCheckbox = React.forwardRef<
13
13
  HTMLInputElement,
14
14
  StackedCheckboxProps
15
- >(({ value, label, defaultValue }, _ref) => {
15
+ >(({ value, label, onChange }, _ref) => {
16
+ if (value === null) return null;
17
+
16
18
  return (
17
19
  <Checkbox
18
20
  ref={_ref}
19
21
  value={String(value)}
20
- defaultChecked={Boolean(defaultValue)}
22
+ defaultChecked={Boolean(value)}
23
+ defaultValue={value}
24
+ onChange={e => {
25
+ if (onChange) return onChange(e.target.checked as any);
26
+ }}
21
27
  >
22
- {label}
28
+ <Text fontSize="13px" alignSelf="center">
29
+ {label}
30
+ </Text>
23
31
  </Checkbox>
24
32
  );
25
33
  });
@@ -166,7 +166,6 @@ export function Input<T extends FieldValues>({
166
166
  onChange={onChange}
167
167
  onBlur={onBlur}
168
168
  ref={ref}
169
- disabled={disabled}
170
169
  value={value}
171
170
  defaultValue={defaultValue}
172
171
  label={label as string}
@@ -244,9 +243,13 @@ export function Input<T extends FieldValues>({
244
243
  id={name}
245
244
  isInvalid={isInvalid}
246
245
  position="relative"
247
- py={label || helperText || isInvalid ? 6 : 0}
246
+ py={
247
+ (label || helperText || isInvalid) && inputType !== 'checkbox'
248
+ ? 6
249
+ : 0
250
+ }
248
251
  >
249
- {label && (
252
+ {label && inputType !== 'checkbox' && (
250
253
  <Label
251
254
  tooltipText={tooltipText}
252
255
  label={label}