@wordpress/dataviews 0.5.4 → 0.5.5
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/build/single-selection-checkbox.js +5 -2
- package/build/single-selection-checkbox.js.map +1 -1
- package/build-module/single-selection-checkbox.js +5 -2
- package/build-module/single-selection-checkbox.js.map +1 -1
- package/build-style/style-rtl.css +8 -1
- package/build-style/style.css +8 -1
- package/package.json +4 -4
- package/src/single-selection-checkbox.js +6 -2
- package/src/style.scss +1 -1
|
@@ -35,10 +35,13 @@ function SingleSelectionCheckbox({
|
|
|
35
35
|
return (0, _react.createElement)(_components.CheckboxControl, {
|
|
36
36
|
className: "dataviews-view-table-selection-checkbox",
|
|
37
37
|
__nextHasNoMarginBottom: true,
|
|
38
|
-
checked: isSelected,
|
|
39
38
|
label: selectionLabel,
|
|
40
|
-
disabled: disabled,
|
|
39
|
+
"aria-disabled": disabled,
|
|
40
|
+
checked: isSelected,
|
|
41
41
|
onChange: () => {
|
|
42
|
+
if (disabled) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
42
45
|
if (!isSelected) {
|
|
43
46
|
onSelectionChange(data.filter(_item => {
|
|
44
47
|
const itemId = getItemId?.(_item);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","SingleSelectionCheckbox","selection","onSelectionChange","item","data","getItemId","primaryField","disabled","id","isSelected","includes","selectionLabel","getValue","sprintf","__","_react","createElement","CheckboxControl","className","__nextHasNoMarginBottom","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","SingleSelectionCheckbox","selection","onSelectionChange","item","data","getItemId","primaryField","disabled","id","isSelected","includes","selectionLabel","getValue","sprintf","__","_react","createElement","CheckboxControl","className","__nextHasNoMarginBottom","label","checked","onChange","filter","_item","itemId"],"sources":["@wordpress/dataviews/src/single-selection-checkbox.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\n\nexport default function SingleSelectionCheckbox( {\n\tselection,\n\tonSelectionChange,\n\titem,\n\tdata,\n\tgetItemId,\n\tprimaryField,\n\tdisabled,\n} ) {\n\tconst id = getItemId( item );\n\tconst isSelected = selection.includes( id );\n\tlet selectionLabel;\n\tif ( primaryField?.getValue && item ) {\n\t\t// eslint-disable-next-line @wordpress/valid-sprintf\n\t\tselectionLabel = sprintf(\n\t\t\t/* translators: %s: item title. */\n\t\t\tisSelected ? __( 'Deselect item: %s' ) : __( 'Select item: %s' ),\n\t\t\tprimaryField.getValue( { item } )\n\t\t);\n\t} else {\n\t\tselectionLabel = isSelected\n\t\t\t? __( 'Select a new item' )\n\t\t\t: __( 'Deselect item' );\n\t}\n\treturn (\n\t\t<CheckboxControl\n\t\t\tclassName=\"dataviews-view-table-selection-checkbox\"\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ selectionLabel }\n\t\t\taria-disabled={ disabled }\n\t\t\tchecked={ isSelected }\n\t\t\tonChange={ () => {\n\t\t\t\tif ( disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\tonSelectionChange(\n\t\t\t\t\t\tdata.filter( ( _item ) => {\n\t\t\t\t\t\t\tconst itemId = getItemId?.( _item );\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\titemId === id || selection.includes( itemId )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tonSelectionChange(\n\t\t\t\t\t\tdata.filter( ( _item ) => {\n\t\t\t\t\t\t\tconst itemId = getItemId?.( _item );\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\titemId !== id && selection.includes( itemId )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;A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CAAC,MAAM;QACNvB,iBAAiB,CAChBE,IAAI,CAACmB,MAAM,CAAIC,KAAK,IAAM;UACzB,MAAMC,MAAM,GAAGpB,SAAS,GAAImB,KAAM,CAAC;UACnC,OACCC,MAAM,KAAKjB,EAAE,IAAIP,SAAS,CAACS,QAAQ,CAAEe,MAAO,CAAC;QAE/C,CAAE,CACH,CAAC;MACF;IACD;EAAG,CACH,CAAC;AAEJ"}
|
|
@@ -28,10 +28,13 @@ export default function SingleSelectionCheckbox({
|
|
|
28
28
|
return createElement(CheckboxControl, {
|
|
29
29
|
className: "dataviews-view-table-selection-checkbox",
|
|
30
30
|
__nextHasNoMarginBottom: true,
|
|
31
|
-
checked: isSelected,
|
|
32
31
|
label: selectionLabel,
|
|
33
|
-
disabled: disabled,
|
|
32
|
+
"aria-disabled": disabled,
|
|
33
|
+
checked: isSelected,
|
|
34
34
|
onChange: () => {
|
|
35
|
+
if (disabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
35
38
|
if (!isSelected) {
|
|
36
39
|
onSelectionChange(data.filter(_item => {
|
|
37
40
|
const itemId = getItemId?.(_item);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","CheckboxControl","SingleSelectionCheckbox","selection","onSelectionChange","item","data","getItemId","primaryField","disabled","id","isSelected","includes","selectionLabel","getValue","createElement","className","__nextHasNoMarginBottom","
|
|
1
|
+
{"version":3,"names":["__","sprintf","CheckboxControl","SingleSelectionCheckbox","selection","onSelectionChange","item","data","getItemId","primaryField","disabled","id","isSelected","includes","selectionLabel","getValue","createElement","className","__nextHasNoMarginBottom","label","checked","onChange","filter","_item","itemId"],"sources":["@wordpress/dataviews/src/single-selection-checkbox.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\n\nexport default function SingleSelectionCheckbox( {\n\tselection,\n\tonSelectionChange,\n\titem,\n\tdata,\n\tgetItemId,\n\tprimaryField,\n\tdisabled,\n} ) {\n\tconst id = getItemId( item );\n\tconst isSelected = selection.includes( id );\n\tlet selectionLabel;\n\tif ( primaryField?.getValue && item ) {\n\t\t// eslint-disable-next-line @wordpress/valid-sprintf\n\t\tselectionLabel = sprintf(\n\t\t\t/* translators: %s: item title. */\n\t\t\tisSelected ? __( 'Deselect item: %s' ) : __( 'Select item: %s' ),\n\t\t\tprimaryField.getValue( { item } )\n\t\t);\n\t} else {\n\t\tselectionLabel = isSelected\n\t\t\t? __( 'Select a new item' )\n\t\t\t: __( 'Deselect item' );\n\t}\n\treturn (\n\t\t<CheckboxControl\n\t\t\tclassName=\"dataviews-view-table-selection-checkbox\"\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ selectionLabel }\n\t\t\taria-disabled={ disabled }\n\t\t\tchecked={ isSelected }\n\t\t\tonChange={ () => {\n\t\t\t\tif ( disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\tonSelectionChange(\n\t\t\t\t\t\tdata.filter( ( _item ) => {\n\t\t\t\t\t\t\tconst itemId = getItemId?.( _item );\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\titemId === id || selection.includes( itemId )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tonSelectionChange(\n\t\t\t\t\t\tdata.filter( ( _item ) => {\n\t\t\t\t\t\t\tconst itemId = getItemId?.( _item );\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\titemId !== id && selection.includes( itemId )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,eAAe,SAAS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IAAIP,SAAS,CAACS,QAAQ,CAAEW,MAAO,CAAC;QAE/C,CAAE,CACH,CAAC;MACF;IACD;EAAG,CACH,CAAC;AAEJ"}
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
|
+
--wp-bound-block-color: #9747ff;
|
|
99
100
|
}
|
|
100
101
|
@media (min-resolution: 192dpi) {
|
|
101
102
|
:root {
|
|
@@ -294,7 +295,6 @@
|
|
|
294
295
|
color: #1e1e1e;
|
|
295
296
|
text-overflow: ellipsis;
|
|
296
297
|
white-space: nowrap;
|
|
297
|
-
overflow: hidden;
|
|
298
298
|
display: block;
|
|
299
299
|
width: 100%;
|
|
300
300
|
}
|
|
@@ -314,6 +314,13 @@
|
|
|
314
314
|
.dataviews-view-table__primary-field a:hover {
|
|
315
315
|
color: #1e1e1e;
|
|
316
316
|
}
|
|
317
|
+
.dataviews-view-list__primary-field a:focus,
|
|
318
|
+
.dataviews-view-grid__primary-field a:focus,
|
|
319
|
+
.dataviews-view-table__primary-field a:focus {
|
|
320
|
+
color: var(--wp-admin-theme-color--rgb);
|
|
321
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color, #007cba);
|
|
322
|
+
border-radius: 2px;
|
|
323
|
+
}
|
|
317
324
|
.dataviews-view-list__primary-field button.components-button.is-link,
|
|
318
325
|
.dataviews-view-grid__primary-field button.components-button.is-link,
|
|
319
326
|
.dataviews-view-table__primary-field button.components-button.is-link {
|
package/build-style/style.css
CHANGED
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
--wp-admin-border-width-focus: 2px;
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
|
+
--wp-bound-block-color: #9747ff;
|
|
99
100
|
}
|
|
100
101
|
@media (min-resolution: 192dpi) {
|
|
101
102
|
:root {
|
|
@@ -294,7 +295,6 @@
|
|
|
294
295
|
color: #1e1e1e;
|
|
295
296
|
text-overflow: ellipsis;
|
|
296
297
|
white-space: nowrap;
|
|
297
|
-
overflow: hidden;
|
|
298
298
|
display: block;
|
|
299
299
|
width: 100%;
|
|
300
300
|
}
|
|
@@ -314,6 +314,13 @@
|
|
|
314
314
|
.dataviews-view-table__primary-field a:hover {
|
|
315
315
|
color: #1e1e1e;
|
|
316
316
|
}
|
|
317
|
+
.dataviews-view-list__primary-field a:focus,
|
|
318
|
+
.dataviews-view-grid__primary-field a:focus,
|
|
319
|
+
.dataviews-view-table__primary-field a:focus {
|
|
320
|
+
color: var(--wp-admin-theme-color--rgb);
|
|
321
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color, #007cba);
|
|
322
|
+
border-radius: 2px;
|
|
323
|
+
}
|
|
317
324
|
.dataviews-view-list__primary-field button.components-button.is-link,
|
|
318
325
|
.dataviews-view-grid__primary-field button.components-button.is-link,
|
|
319
326
|
.dataviews-view-table__primary-field button.components-button.is-link {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/dataviews",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"@ariakit/react": "^0.3.12",
|
|
31
31
|
"@babel/runtime": "^7.16.0",
|
|
32
32
|
"@wordpress/a11y": "^3.51.1",
|
|
33
|
-
"@wordpress/components": "^26.0.
|
|
33
|
+
"@wordpress/components": "^26.0.4",
|
|
34
34
|
"@wordpress/compose": "^6.28.1",
|
|
35
35
|
"@wordpress/element": "^5.28.1",
|
|
36
36
|
"@wordpress/i18n": "^4.51.1",
|
|
37
|
-
"@wordpress/icons": "^9.42.
|
|
37
|
+
"@wordpress/icons": "^9.42.3",
|
|
38
38
|
"@wordpress/keycodes": "^3.51.1",
|
|
39
39
|
"@wordpress/primitives": "^3.49.1",
|
|
40
40
|
"@wordpress/private-apis": "^0.33.1",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "4927ea437069f9aed12f696df294a79bd8e12fd5"
|
|
51
51
|
}
|
|
@@ -32,10 +32,14 @@ export default function SingleSelectionCheckbox( {
|
|
|
32
32
|
<CheckboxControl
|
|
33
33
|
className="dataviews-view-table-selection-checkbox"
|
|
34
34
|
__nextHasNoMarginBottom
|
|
35
|
-
checked={ isSelected }
|
|
36
35
|
label={ selectionLabel }
|
|
37
|
-
disabled={ disabled }
|
|
36
|
+
aria-disabled={ disabled }
|
|
37
|
+
checked={ isSelected }
|
|
38
38
|
onChange={ () => {
|
|
39
|
+
if ( disabled ) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
if ( ! isSelected ) {
|
|
40
44
|
onSelectionChange(
|
|
41
45
|
data.filter( ( _item ) => {
|
package/src/style.scss
CHANGED
|
@@ -219,7 +219,6 @@
|
|
|
219
219
|
color: $gray-900;
|
|
220
220
|
text-overflow: ellipsis;
|
|
221
221
|
white-space: nowrap;
|
|
222
|
-
overflow: hidden;
|
|
223
222
|
display: block;
|
|
224
223
|
width: 100%;
|
|
225
224
|
|
|
@@ -235,6 +234,7 @@
|
|
|
235
234
|
&:hover {
|
|
236
235
|
color: $gray-900;
|
|
237
236
|
}
|
|
237
|
+
@include link-reset();
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
button.components-button.is-link {
|