@rainbow-oh/yee-c 0.8.18 → 0.8.19

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainbow-oh/yee-c",
3
- "version": "0.8.18",
3
+ "version": "0.8.19",
4
4
  "description": "yee basic components",
5
5
  "keywords": [
6
6
  "react",
@@ -76,7 +76,7 @@ const CheckboxGroup = (baseprops: CheckboxGroupProps) => {
76
76
  <Checkbox
77
77
  disabled={disabled}
78
78
  {...option}
79
- checked={mergedValue.includes(option.value)}
79
+ checked={mergedValue?.includes(option.value)}
80
80
  key={option.value || index}
81
81
  >
82
82
  {option.label}
@@ -12,7 +12,7 @@ import Grid from '../Grid';
12
12
  import FieldContext from './FieldContext';
13
13
  import FormContext from './FormContext';
14
14
  import type { FieldGroupProps, NamePath, ValidateMessage } from './interface';
15
- import { runValidator } from './utils/validate';
15
+ import { isEmpty, runValidator } from './utils/validate';
16
16
 
17
17
  const Group: React.FC<FieldGroupProps> = (props) => {
18
18
  const { label, required, rules, cols, children, style, className } = props;
@@ -54,9 +54,7 @@ const Group: React.FC<FieldGroupProps> = (props) => {
54
54
 
55
55
  // Required validation: error if any child field is empty
56
56
  if (required) {
57
- const hasEmpty = childNames.some(
58
- (name) => !values[name] && values[name] !== 0,
59
- );
57
+ const hasEmpty = childNames.some((name) => isEmpty(values[name]));
60
58
  if (hasEmpty) {
61
59
  errors.push({
62
60
  name: childNames,
@@ -88,12 +88,14 @@
88
88
  --yee-input-border-color: var(--yee-error-color);
89
89
  --yee-input-hover-border-color: var(--yee-error-color-hover);
90
90
  --yee-input-focus-bs-color: var(--yee-error-color-border);
91
+ --yee-checkbox-border-color: var(--yee-error-color);
91
92
  }
92
93
 
93
94
  &&-warning {
94
95
  --yee-input-border-color: var(--yee-warning-color);
95
96
  --yee-input-hover-border-color: var(--yee-warning-color-hover);
96
97
  --yee-input-focus-bs-color: var(--yee-warning-color-border);
98
+ --yee-checkbox-border-color: var(--yee-warning-color);
97
99
  }
98
100
  }
99
101
  }
@@ -1,7 +1,12 @@
1
1
  import type { Rule } from '../interface';
2
2
 
3
- function isEmpty(v: unknown) {
4
- return v === undefined || v === null || v === '' ? true : false;
3
+ export function isEmpty(value: unknown) {
4
+ return (
5
+ value === undefined ||
6
+ value === null ||
7
+ value === '' ||
8
+ (Array.isArray(value) && value.length === 0)
9
+ );
5
10
  }
6
11
 
7
12
  function verifyRuleOfMin(min: number, value: unknown) {
package/src/version.ts CHANGED
@@ -4,7 +4,7 @@ declare global {
4
4
  }
5
5
  }
6
6
 
7
- export const version = "0.8.18";
7
+ export const version = "0.8.19";
8
8
 
9
9
  if (typeof window !== 'undefined') {
10
10
  window.__yee_c_version__ = version;