@faststore/components 3.0.24 → 3.0.38

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,25 +1,10 @@
1
1
  import React from 'react';
2
- export interface CheckboxFieldProps {
3
- /**
4
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
5
- */
6
- testId?: string;
7
- /**
8
- * ID to identify input and corresponding label.
9
- */
10
- id: string;
2
+ import { CheckboxProps } from '../../atoms/Checkbox';
3
+ export interface CheckboxFieldProps extends CheckboxProps {
11
4
  /**
12
5
  * The text displayed to identify the input checkbox.
13
6
  */
14
7
  label: string;
15
- /**
16
- * The value to identify the input checkbox.
17
- */
18
- value?: string;
19
- /**
20
- * Identify checkbox in the same group.
21
- */
22
- name?: string;
23
8
  }
24
9
  declare const CheckboxField: React.ForwardRefExoticComponent<CheckboxFieldProps & React.RefAttributes<HTMLDivElement>>;
25
10
  export default CheckboxField;
@@ -4,9 +4,9 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const Checkbox_1 = tslib_1.__importDefault(require("../../atoms/Checkbox"));
6
6
  const Label_1 = tslib_1.__importDefault(require("../../atoms/Label"));
7
- const CheckboxField = (0, react_1.forwardRef)(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, ...otherProps }, ref) {
7
+ const CheckboxField = (0, react_1.forwardRef)(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, checked, ...otherProps }, ref) {
8
8
  return (react_1.default.createElement("div", { ref: ref, "data-fs-checkbox-field": true, "data-testid": testId },
9
- react_1.default.createElement(Checkbox_1.default, { id: id, value: value ?? label, name: name, ...otherProps }),
9
+ react_1.default.createElement(Checkbox_1.default, { id: id, value: value ?? label, name: name, defaultChecked: checked, ...otherProps }),
10
10
  react_1.default.createElement(Label_1.default, { htmlFor: id }, label)));
11
11
  });
12
12
  exports.default = CheckboxField;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":";;;AAAA,uDAAyC;AACzC,4EAA2C;AAC3C,sEAAqC;AAyBrC,MAAM,aAAa,GAAG,IAAA,kBAAU,EAC9B,SAAS,aAAa,CACpB,EAAE,MAAM,GAAG,mBAAmB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,EACvE,GAAG;IAEH,OAAO,CACL,uCAAK,GAAG,EAAE,GAAG,iDAAsC,MAAM;QACvD,8BAAC,kBAAQ,IAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,IAAI,KAAK,EAAE,IAAI,EAAE,IAAI,KAAM,UAAU,GAAI;QACvE,8BAAC,eAAK,IAAC,OAAO,EAAE,EAAE,IAAG,KAAK,CAAS,CAC/B,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,kBAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":";;;AAAA,uDAAyC;AACzC,4EAA8D;AAC9D,sEAAqC;AASrC,MAAM,aAAa,GAAG,IAAA,kBAAU,EAC9B,SAAS,aAAa,CACpB,EACE,MAAM,GAAG,mBAAmB,EAC5B,EAAE,EACF,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO,EACP,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,uCAAK,GAAG,EAAE,GAAG,iDAAsC,MAAM;QACvD,8BAAC,kBAAQ,IACP,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,IAAI,KAAK,EACrB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,OAAO,KACnB,UAAU,GACd;QACF,8BAAC,eAAK,IAAC,OAAO,EAAE,EAAE,IAAG,KAAK,CAAS,CAC/B,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,kBAAe,aAAa,CAAA"}
@@ -1,25 +1,10 @@
1
1
  import React from 'react';
2
- export interface CheckboxFieldProps {
3
- /**
4
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
5
- */
6
- testId?: string;
7
- /**
8
- * ID to identify input and corresponding label.
9
- */
10
- id: string;
2
+ import { CheckboxProps } from '../../atoms/Checkbox';
3
+ export interface CheckboxFieldProps extends CheckboxProps {
11
4
  /**
12
5
  * The text displayed to identify the input checkbox.
13
6
  */
14
7
  label: string;
15
- /**
16
- * The value to identify the input checkbox.
17
- */
18
- value?: string;
19
- /**
20
- * Identify checkbox in the same group.
21
- */
22
- name?: string;
23
8
  }
24
9
  declare const CheckboxField: React.ForwardRefExoticComponent<CheckboxFieldProps & React.RefAttributes<HTMLDivElement>>;
25
10
  export default CheckboxField;
@@ -1,9 +1,9 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import Checkbox from '../../atoms/Checkbox';
3
3
  import Label from '../../atoms/Label';
4
- const CheckboxField = forwardRef(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, ...otherProps }, ref) {
4
+ const CheckboxField = forwardRef(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, checked, ...otherProps }, ref) {
5
5
  return (React.createElement("div", { ref: ref, "data-fs-checkbox-field": true, "data-testid": testId },
6
- React.createElement(Checkbox, { id: id, value: value ?? label, name: name, ...otherProps }),
6
+ React.createElement(Checkbox, { id: id, value: value ?? label, name: name, defaultChecked: checked, ...otherProps }),
7
7
  React.createElement(Label, { htmlFor: id }, label)));
8
8
  });
9
9
  export default CheckboxField;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,QAAQ,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,MAAM,mBAAmB,CAAA;AAyBrC,MAAM,aAAa,GAAG,UAAU,CAC9B,SAAS,aAAa,CACpB,EAAE,MAAM,GAAG,mBAAmB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,EACvE,GAAG;IAEH,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,iDAAsC,MAAM;QACvD,oBAAC,QAAQ,IAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,IAAI,KAAK,EAAE,IAAI,EAAE,IAAI,KAAM,UAAU,GAAI;QACvE,oBAAC,KAAK,IAAC,OAAO,EAAE,EAAE,IAAG,KAAK,CAAS,CAC/B,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,QAA2B,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,MAAM,mBAAmB,CAAA;AASrC,MAAM,aAAa,GAAG,UAAU,CAC9B,SAAS,aAAa,CACpB,EACE,MAAM,GAAG,mBAAmB,EAC5B,EAAE,EACF,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO,EACP,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,iDAAsC,MAAM;QACvD,oBAAC,QAAQ,IACP,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,IAAI,KAAK,EACrB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,OAAO,KACnB,UAAU,GACd;QACF,oBAAC,KAAK,IAAC,OAAO,EAAE,EAAE,IAAG,KAAK,CAAS,CAC/B,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,aAAa,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/components",
3
- "version": "3.0.24",
3
+ "version": "3.0.38",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "typings": "dist/esm/index.d.ts",
@@ -17,7 +17,8 @@
17
17
  "scripts": {
18
18
  "dev": "tsc --watch",
19
19
  "build": "tsc --module commonjs --outDir dist/cjs & tsc --module esnext --outDir dist/esm",
20
- "lint": "eslint src/**/*.{ts,tsx}"
20
+ "lint": "eslint src/**/*.{ts,tsx}",
21
+ "test": "jest"
21
22
  },
22
23
  "repository": {
23
24
  "type": "git",
@@ -36,13 +37,17 @@
36
37
  "devDependencies": {
37
38
  "@faststore/eslint-config": "^3.0.24",
38
39
  "@faststore/shared": "^3.0.24",
40
+ "@testing-library/react": "^14.3.0",
39
41
  "@types/react": "^18.2.42",
40
42
  "@types/react-dom": "^18.2.17",
41
43
  "eslint": "7.32.0",
44
+ "jest": "^29.7.0",
45
+ "jest-environment-jsdom": "^29.7.0",
46
+ "ts-jest": "^29.1.2",
42
47
  "typescript": "^4.8.4"
43
48
  },
44
49
  "volta": {
45
50
  "extends": "../../package.json"
46
51
  },
47
- "gitHead": "1cbf5056e2fd6d1b3e85268f585709c59ec9f63f"
52
+ "gitHead": "ea1f9b69ed525c7f4ff5fac3a7ecf974786b3d4e"
48
53
  }
@@ -1,38 +1,36 @@
1
1
  import React, { forwardRef } from 'react'
2
- import Checkbox from '../../atoms/Checkbox'
2
+ import Checkbox, { CheckboxProps } from '../../atoms/Checkbox'
3
3
  import Label from '../../atoms/Label'
4
4
 
5
- export interface CheckboxFieldProps {
6
- /**
7
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
8
- */
9
- testId?: string
10
- /**
11
- * ID to identify input and corresponding label.
12
- */
13
- id: string
5
+ export interface CheckboxFieldProps extends CheckboxProps {
14
6
  /**
15
7
  * The text displayed to identify the input checkbox.
16
8
  */
17
9
  label: string
18
- /**
19
- * The value to identify the input checkbox.
20
- */
21
- value?: string
22
- /**
23
- * Identify checkbox in the same group.
24
- */
25
- name?: string
26
10
  }
27
11
 
28
12
  const CheckboxField = forwardRef<HTMLDivElement, CheckboxFieldProps>(
29
13
  function CheckboxField(
30
- { testId = 'fs-checkbox-field', id, label, value, name, ...otherProps },
14
+ {
15
+ testId = 'fs-checkbox-field',
16
+ id,
17
+ label,
18
+ value,
19
+ name,
20
+ checked,
21
+ ...otherProps
22
+ },
31
23
  ref
32
24
  ) {
33
25
  return (
34
26
  <div ref={ref} data-fs-checkbox-field data-testid={testId}>
35
- <Checkbox id={id} value={value ?? label} name={name} {...otherProps} />
27
+ <Checkbox
28
+ id={id}
29
+ value={value ?? label}
30
+ name={name}
31
+ defaultChecked={checked}
32
+ {...otherProps}
33
+ />
36
34
  <Label htmlFor={id}>{label}</Label>
37
35
  </div>
38
36
  )