release 2.1.0 (#451)

* feat: optimize fonts rendering on windows (#385)

* feat(styles): set Inter to highest font

* docs(fonts): add guide for fonts rendering on windows

* test: udpate snapshots

* chore: release v2.1.0-canary.0

* feat(table): add update row action to Table (#378)

* feat: add update to Table's actions. add test and doc

fix(table): fix comments

* feat(table): improve type for table actions

chore: update docs

chore: remove unused types

chore(table): improve docs

Co-authored-by: William Castandet <williamcastandet@williams-air.home>
Co-authored-by: unix <unix.bio@gmail.com>

* refactor(use-theme): move use-theme to the top directory (#397)

* refactor(use-theme): move use-theme to the top directory

* chore(jest): ignore use-theme of forwarding

* chore: release v2.1.0-canary.1

* feat(select): add clearable option to select multiple with test and english doc (#396)

* docs: add clearable option to select multiple with test and english doc

* fix: fix types for onClear

* fix: fix import path for use-theme

add more test for coverage

* docs(select): add chinese document

Co-authored-by: unix <unix.bio@gmail.com>

* chore: release v2.1.0-canary.2

* fix(tabs): scrollable (#404)

docs(tabs): scroll behavior

* feat(textarea): resize prop (#416)

* feat: add resize prop to textarea

* docs: add resize prop for textarea

* docs(textarea): improve docs and attributes for cn

* test(textarea): update snapshots

Co-authored-by: unix <unix.bio@gmail.com>

* fix(types): replace path aliases in type files (#432)

* fix(types): replace path aliases in type files

* chore(lint): upgrade eslint and optimize code style

* chore: fix type error for context handler

* test: update snapshots

* fix: use ttsc to identify aliases in type paths

* feat(hooks): add a tool hooks for react context (#439)

* feat(hooks): add a tool hooks for react context

* chore: move use-context-state to internal tools

style: fix lint warning

* chore: simplify the structure of the catalog

* refactor(themes): refactor theme module to keep multiple themes (#440)

* refactor(themes): refactor theme module to keep multiple themes

* chore: migrate APIs to be compatible with new theme system

* test: update snapshots

* chore: migrate the path of the theme module

* feat(themes): append static methods of themes

* chore: hide custom theme when no custom content in the context

* chore: manually add flush to preload styles in html

* docs(themes): update to fit the new theme system

* chore: release v2.1.0-canary.3 (#450)

* docs: add link to GH discussions

* chore: upgrade deps

* chore: update code style for prettier

* chore: release v2.1.0-canary.3

* chore(deps): upgrade babel

* chore: replace enzyme adapter with community repo to fit react.17

* test: updatee snapshots for auto typesetting

* test(config): ignore unexported parts of the tools

Co-authored-by: William <wcastand@gmail.com>
Co-authored-by: William Castandet <williamcastandet@williams-air.home>
Co-authored-by: Vaibhav Acharya <vaibhavacharya111@gmail.com>
Co-authored-by: Paul van Dyk <39598117+PaulPCIO@users.noreply.github.com>
This commit is contained in:
witt
2021-02-14 15:58:52 +08:00
committed by GitHub
parent 08f1be1b9f
commit 6da0509316
265 changed files with 11534 additions and 10645 deletions

View File

@@ -2,24 +2,24 @@
exports[`Checkbox Group should render correctly 1`] = `
initialize {
"0": Object {
"0": Node {
"attribs": Object {
"class": "group ",
},
"children": Array [
Object {
Node {
"attribs": Object {
"class": "",
},
"children": Array [
Object {
Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -43,10 +43,10 @@ initialize {
],
"name": "svg",
"namespace": "http://www.w3.org/2000/svg",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -65,19 +65,19 @@ initialize {
],
"name": "style",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -87,10 +87,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -179,10 +179,10 @@ initialize {
"xmlns": "",
},
},
Object {
Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -201,19 +201,19 @@ initialize {
],
"name": "style",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -223,10 +223,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -296,14 +296,14 @@ initialize {
},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -346,19 +346,19 @@ initialize {
"x-attribsNamespace": Object {},
"x-attribsPrefix": Object {},
},
Object {
Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -368,10 +368,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -431,10 +431,10 @@ initialize {
},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -455,14 +455,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -513,12 +513,12 @@ initialize {
"type": undefined,
},
},
Object {
Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -528,10 +528,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -581,7 +581,7 @@ initialize {
"x-attribsPrefix": Object {},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"type": "checkbox",
},
@@ -590,10 +590,10 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -614,14 +614,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -680,10 +680,10 @@ initialize {
"class": undefined,
},
},
Object {
Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -727,12 +727,12 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -744,7 +744,7 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"type": "checkbox",
},
@@ -753,10 +753,10 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -777,14 +777,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -850,10 +850,10 @@ initialize {
],
"name": "label",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
.group :global(label) {
margin-right: calc(.875rem * 2);
@@ -885,10 +885,10 @@ initialize {
"class": undefined,
},
},
Object {
Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
.group :global(label) {
margin-right: calc(.875rem * 2);
@@ -905,19 +905,19 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"class": "",
},
"children": Array [
Object {
Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -941,10 +941,10 @@ initialize {
],
"name": "svg",
"namespace": "http://www.w3.org/2000/svg",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -963,19 +963,19 @@ initialize {
],
"name": "style",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -985,10 +985,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -1077,10 +1077,10 @@ initialize {
"xmlns": "",
},
},
Object {
Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -1099,19 +1099,19 @@ initialize {
],
"name": "style",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -1121,10 +1121,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -1194,14 +1194,14 @@ initialize {
},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -1244,19 +1244,19 @@ initialize {
"x-attribsNamespace": Object {},
"x-attribsPrefix": Object {},
},
Object {
Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -1266,10 +1266,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -1329,10 +1329,10 @@ initialize {
},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -1353,14 +1353,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -1411,12 +1411,12 @@ initialize {
"type": undefined,
},
},
Object {
Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -1426,10 +1426,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -1479,7 +1479,7 @@ initialize {
"x-attribsPrefix": Object {},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"type": "checkbox",
},
@@ -1488,10 +1488,10 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -1512,14 +1512,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -1578,10 +1578,10 @@ initialize {
"class": undefined,
},
},
Object {
Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -1625,12 +1625,12 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -1642,7 +1642,7 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"type": "checkbox",
},
@@ -1651,10 +1651,10 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -1675,14 +1675,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -1767,22 +1767,17 @@ initialize {
"name": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": null,
"prev": null,
"root": Object {
"attribs": Object {},
"parent": Node {
"children": Array [
[Circular],
],
"name": "root",
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": null,
"prev": null,
"type": "root",
"x-attribsNamespace": Object {},
"x-attribsPrefix": Object {},
},
"prev": null,
"type": "tag",
"x-attribsNamespace": Object {
"class": undefined,
@@ -1795,8 +1790,6 @@ initialize {
"length": 1,
"options": Object {
"decodeEntities": true,
"normalizeWhitespace": false,
"withDomLvl1": true,
"xml": false,
},
}

View File

@@ -2,19 +2,19 @@
exports[`Checkbox should render correctly 1`] = `
initialize {
"0": Object {
"0": Node {
"attribs": Object {
"class": "",
},
"children": Array [
Object {
Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -38,10 +38,10 @@ initialize {
],
"name": "svg",
"namespace": "http://www.w3.org/2000/svg",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -60,19 +60,19 @@ initialize {
],
"name": "style",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -82,10 +82,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -174,10 +174,10 @@ initialize {
"xmlns": "",
},
},
Object {
Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -196,19 +196,19 @@ initialize {
],
"name": "style",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -218,10 +218,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -291,14 +291,14 @@ initialize {
},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -341,19 +341,19 @@ initialize {
"x-attribsNamespace": Object {},
"x-attribsPrefix": Object {},
},
Object {
Node {
"attribs": Object {
"type": "checkbox",
},
"children": Array [],
"name": "input",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -363,10 +363,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -426,10 +426,10 @@ initialize {
},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -450,14 +450,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -508,12 +508,12 @@ initialize {
"type": undefined,
},
},
Object {
Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -523,10 +523,10 @@ initialize {
],
"name": "span",
"namespace": "http://www.w3.org/1999/xhtml",
"next": Object {
"next": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -576,7 +576,7 @@ initialize {
"x-attribsPrefix": Object {},
},
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"type": "checkbox",
},
@@ -585,10 +585,10 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -609,14 +609,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -675,10 +675,10 @@ initialize {
"class": undefined,
},
},
Object {
Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
label {
--checkbox-size: .875rem;
@@ -722,12 +722,12 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"class": "text",
},
"children": Array [
Object {
Node {
"data": "Sydney",
"next": null,
"parent": [Circular],
@@ -739,7 +739,7 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"type": "checkbox",
},
@@ -748,10 +748,10 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {},
"children": Array [
Object {
Node {
"data": "
svg {
display: inline-flex;
@@ -772,14 +772,14 @@ initialize {
"namespace": "http://www.w3.org/1999/xhtml",
"next": [Circular],
"parent": [Circular],
"prev": Object {
"prev": Node {
"attribs": Object {
"fill": "none",
"viewBox": "0 0 12 12",
"xmlns": "http://www.w3.org/2000/svg",
},
"children": Array [
Object {
Node {
"attribs": Object {
"d": "M8.5 0.5H3.5C1.84315 0.5 0.5 1.84315 0.5 3.5V8.5C0.5 10.1569 1.84315 11.5 3.5 11.5H8.5C10.1569 11.5 11.5 10.1569 11.5 8.5V3.5C11.5 1.84315 10.1569 0.5 8.5 0.5Z",
"stroke": "#666",
@@ -846,22 +846,17 @@ initialize {
"name": "label",
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": null,
"prev": null,
"root": Object {
"attribs": Object {},
"parent": Node {
"children": Array [
[Circular],
],
"name": "root",
"namespace": "http://www.w3.org/1999/xhtml",
"next": null,
"parent": null,
"prev": null,
"type": "root",
"x-attribsNamespace": Object {},
"x-attribsPrefix": Object {},
},
"prev": null,
"type": "tag",
"x-attribsNamespace": Object {
"class": undefined,
@@ -874,8 +869,6 @@ initialize {
"length": 1,
"options": Object {
"decodeEntities": true,
"normalizeWhitespace": false,
"withDomLvl1": true,
"xml": false,
},
}

View File

@@ -89,7 +89,9 @@ describe('Checkbox Group', () => {
it('should throw error when value missing', () => {
let errorMessage = ''
const Group = Checkbox.Group as any
const errorSpy = jest.spyOn(console, 'error').mockImplementation(msg => (errorMessage = msg))
const errorSpy = jest
.spyOn(console, 'error')
.mockImplementation(msg => (errorMessage = msg))
mount(
<Group>
<Checkbox value="sydney">Sydney</Checkbox>
@@ -103,7 +105,9 @@ describe('Checkbox Group', () => {
it('should throw error when set check prop in group', () => {
let errorMessage = ''
const errorSpy = jest.spyOn(console, 'error').mockImplementation(msg => (errorMessage = msg))
const errorSpy = jest
.spyOn(console, 'error')
.mockImplementation(msg => (errorMessage = msg))
mount(
<Checkbox.Group value={[]}>
<Checkbox value="sydney" checked>

View File

@@ -15,4 +15,5 @@ const defaultContext = {
export const CheckboxContext = React.createContext<CheckboxConfig>(defaultContext)
export const useCheckbox = (): CheckboxConfig => React.useContext<CheckboxConfig>(CheckboxContext)
export const useCheckbox = (): CheckboxConfig =>
React.useContext<CheckboxConfig>(CheckboxContext)

View File

@@ -1,5 +1,5 @@
import React, { useMemo } from 'react'
import useTheme from '../styles/use-theme'
import useTheme from '../use-theme'
interface Props {
disabled?: boolean

View File

@@ -53,7 +53,10 @@ const Checkbox: React.FC<CheckboxProps> = ({
const isDisabled = inGroup ? disabledAll || disabled : disabled
if (inGroup && checked) {
useWarning('Remove props "checked" when [Checkbox] component is in the group.', 'Checkbox')
useWarning(
'Remove props "checked" when [Checkbox] component is in the group.',
'Checkbox',
)
}
if (inGroup) {
useEffect(() => {