@wordpress/dataviews 14.1.1-next.v.202604091042.0 → 14.2.0

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.
Files changed (179) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/build/components/dataform-controls/array.cjs +2 -2
  3. package/build/components/dataform-controls/array.cjs.map +2 -2
  4. package/build/components/dataform-controls/date.cjs +16 -5
  5. package/build/components/dataform-controls/date.cjs.map +3 -3
  6. package/build/components/dataform-controls/datetime.cjs +6 -2
  7. package/build/components/dataform-controls/datetime.cjs.map +3 -3
  8. package/build/components/dataform-controls/utils/use-disabled-date-matchers.cjs +48 -0
  9. package/build/components/dataform-controls/utils/use-disabled-date-matchers.cjs.map +7 -0
  10. package/build/components/dataform-layouts/card/index.cjs.map +2 -2
  11. package/build/components/dataform-layouts/panel/summary-button.cjs +0 -1
  12. package/build/components/dataform-layouts/panel/summary-button.cjs.map +2 -2
  13. package/build/components/dataviews-context/index.cjs.map +1 -1
  14. package/build/components/dataviews-filters/search-widget.cjs +2 -7
  15. package/build/components/dataviews-filters/search-widget.cjs.map +2 -2
  16. package/build/components/dataviews-layouts/activity/activity-item.cjs +2 -3
  17. package/build/components/dataviews-layouts/activity/activity-item.cjs.map +2 -2
  18. package/build/components/dataviews-layouts/grid/composite-grid.cjs +2 -2
  19. package/build/components/dataviews-layouts/grid/composite-grid.cjs.map +2 -2
  20. package/build/components/dataviews-layouts/list/index.cjs +2 -2
  21. package/build/components/dataviews-layouts/list/index.cjs.map +2 -2
  22. package/build/components/dataviews-layouts/picker-grid/index.cjs +3 -6
  23. package/build/components/dataviews-layouts/picker-grid/index.cjs.map +2 -2
  24. package/build/components/dataviews-layouts/picker-table/index.cjs +15 -12
  25. package/build/components/dataviews-layouts/picker-table/index.cjs.map +2 -2
  26. package/build/components/dataviews-layouts/table/index.cjs +0 -1
  27. package/build/components/dataviews-layouts/table/index.cjs.map +2 -2
  28. package/build/dataviews/index.cjs +10 -8
  29. package/build/dataviews/index.cjs.map +2 -2
  30. package/build/dataviews-picker/index.cjs +16 -9
  31. package/build/dataviews-picker/index.cjs.map +2 -2
  32. package/build/field-types/date.cjs +4 -1
  33. package/build/field-types/date.cjs.map +2 -2
  34. package/build/field-types/datetime.cjs +4 -1
  35. package/build/field-types/datetime.cjs.map +2 -2
  36. package/build/field-types/utils/get-is-valid.cjs +29 -24
  37. package/build/field-types/utils/get-is-valid.cjs.map +2 -2
  38. package/build/field-types/utils/is-valid-date-boundary.cjs +64 -0
  39. package/build/field-types/utils/is-valid-date-boundary.cjs.map +7 -0
  40. package/build/types/dataviews.cjs.map +1 -1
  41. package/build/types/field-api.cjs.map +1 -1
  42. package/build-module/components/dataform-controls/array.mjs +2 -2
  43. package/build-module/components/dataform-controls/array.mjs.map +2 -2
  44. package/build-module/components/dataform-controls/date.mjs +16 -5
  45. package/build-module/components/dataform-controls/date.mjs.map +2 -2
  46. package/build-module/components/dataform-controls/datetime.mjs +6 -2
  47. package/build-module/components/dataform-controls/datetime.mjs.map +2 -2
  48. package/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs +27 -0
  49. package/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs.map +7 -0
  50. package/build-module/components/dataform-layouts/card/index.mjs.map +2 -2
  51. package/build-module/components/dataform-layouts/panel/summary-button.mjs +0 -1
  52. package/build-module/components/dataform-layouts/panel/summary-button.mjs.map +2 -2
  53. package/build-module/components/dataviews-context/index.mjs.map +1 -1
  54. package/build-module/components/dataviews-filters/search-widget.mjs +3 -13
  55. package/build-module/components/dataviews-filters/search-widget.mjs.map +2 -2
  56. package/build-module/components/dataviews-layouts/activity/activity-item.mjs +2 -3
  57. package/build-module/components/dataviews-layouts/activity/activity-item.mjs.map +2 -2
  58. package/build-module/components/dataviews-layouts/grid/composite-grid.mjs +2 -2
  59. package/build-module/components/dataviews-layouts/grid/composite-grid.mjs.map +2 -2
  60. package/build-module/components/dataviews-layouts/list/index.mjs +2 -3
  61. package/build-module/components/dataviews-layouts/list/index.mjs.map +2 -2
  62. package/build-module/components/dataviews-layouts/picker-grid/index.mjs +3 -6
  63. package/build-module/components/dataviews-layouts/picker-grid/index.mjs.map +2 -2
  64. package/build-module/components/dataviews-layouts/picker-table/index.mjs +15 -12
  65. package/build-module/components/dataviews-layouts/picker-table/index.mjs.map +2 -2
  66. package/build-module/components/dataviews-layouts/table/index.mjs +0 -1
  67. package/build-module/components/dataviews-layouts/table/index.mjs.map +2 -2
  68. package/build-module/dataviews/index.mjs +10 -8
  69. package/build-module/dataviews/index.mjs.map +2 -2
  70. package/build-module/dataviews-picker/index.mjs +16 -9
  71. package/build-module/dataviews-picker/index.mjs.map +2 -2
  72. package/build-module/field-types/date.mjs +4 -1
  73. package/build-module/field-types/date.mjs.map +2 -2
  74. package/build-module/field-types/datetime.mjs +4 -1
  75. package/build-module/field-types/datetime.mjs.map +2 -2
  76. package/build-module/field-types/utils/get-is-valid.mjs +29 -24
  77. package/build-module/field-types/utils/get-is-valid.mjs.map +2 -2
  78. package/build-module/field-types/utils/is-valid-date-boundary.mjs +38 -0
  79. package/build-module/field-types/utils/is-valid-date-boundary.mjs.map +7 -0
  80. package/build-style/style-rtl.css +12 -13
  81. package/build-style/style.css +12 -13
  82. package/build-types/components/dataform-controls/array.d.ts.map +1 -1
  83. package/build-types/components/dataform-controls/date.d.ts.map +1 -1
  84. package/build-types/components/dataform-controls/datetime.d.ts.map +1 -1
  85. package/build-types/components/dataform-controls/utils/use-disabled-date-matchers.d.ts +16 -0
  86. package/build-types/components/dataform-controls/utils/use-disabled-date-matchers.d.ts.map +1 -0
  87. package/build-types/components/dataform-layouts/card/index.d.ts.map +1 -1
  88. package/build-types/components/dataform-layouts/panel/summary-button.d.ts.map +1 -1
  89. package/build-types/components/dataviews-context/index.d.ts +2 -2
  90. package/build-types/components/dataviews-context/index.d.ts.map +1 -1
  91. package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
  92. package/build-types/components/dataviews-layouts/activity/activity-item.d.ts.map +1 -1
  93. package/build-types/components/dataviews-layouts/list/index.d.ts.map +1 -1
  94. package/build-types/components/dataviews-layouts/picker-grid/index.d.ts.map +1 -1
  95. package/build-types/components/dataviews-layouts/picker-table/index.d.ts.map +1 -1
  96. package/build-types/components/dataviews-layouts/table/index.d.ts.map +1 -1
  97. package/build-types/dataform/stories/index.story.d.ts.map +1 -1
  98. package/build-types/dataform/stories/layout-regular.d.ts.map +1 -1
  99. package/build-types/dataform/stories/validation.d.ts.map +1 -1
  100. package/build-types/dataviews/index.d.ts +1 -1
  101. package/build-types/dataviews/index.d.ts.map +1 -1
  102. package/build-types/dataviews/stories/free-composition.d.ts.map +1 -1
  103. package/build-types/dataviews/stories/index.story.d.ts.map +1 -1
  104. package/build-types/dataviews/stories/layout-activity.d.ts.map +1 -1
  105. package/build-types/dataviews/stories/layout-grid.d.ts.map +1 -1
  106. package/build-types/dataviews/stories/layout-list.d.ts.map +1 -1
  107. package/build-types/dataviews/stories/layout-table.d.ts.map +1 -1
  108. package/build-types/dataviews/stories/with-card.d.ts.map +1 -1
  109. package/build-types/dataviews-picker/index.d.ts +3 -2
  110. package/build-types/dataviews-picker/index.d.ts.map +1 -1
  111. package/build-types/dataviews-picker/stories/index.story.d.ts.map +1 -1
  112. package/build-types/field-types/date.d.ts +3 -0
  113. package/build-types/field-types/date.d.ts.map +1 -1
  114. package/build-types/field-types/datetime.d.ts +3 -0
  115. package/build-types/field-types/datetime.d.ts.map +1 -1
  116. package/build-types/field-types/utils/get-is-valid.d.ts.map +1 -1
  117. package/build-types/field-types/utils/is-valid-date-boundary.d.ts +7 -0
  118. package/build-types/field-types/utils/is-valid-date-boundary.d.ts.map +1 -0
  119. package/build-types/types/dataviews.d.ts +8 -0
  120. package/build-types/types/dataviews.d.ts.map +1 -1
  121. package/build-types/types/field-api.d.ts +11 -9
  122. package/build-types/types/field-api.d.ts.map +1 -1
  123. package/build-wp/index.js +1173 -1017
  124. package/package.json +16 -16
  125. package/src/components/dataform-controls/array.tsx +3 -2
  126. package/src/components/dataform-controls/date.tsx +17 -2
  127. package/src/components/dataform-controls/datetime.tsx +15 -1
  128. package/src/components/dataform-controls/utils/use-disabled-date-matchers.ts +48 -0
  129. package/src/components/dataform-layouts/card/index.tsx +0 -3
  130. package/src/components/dataform-layouts/panel/style.scss +4 -5
  131. package/src/components/dataform-layouts/panel/summary-button.tsx +0 -1
  132. package/src/components/dataviews-context/index.ts +2 -2
  133. package/src/components/dataviews-filters/search-widget.tsx +4 -14
  134. package/src/components/dataviews-filters/style.scss +2 -2
  135. package/src/components/dataviews-layouts/activity/activity-item.tsx +2 -3
  136. package/src/components/dataviews-layouts/activity/style.scss +1 -1
  137. package/src/components/dataviews-layouts/grid/composite-grid.tsx +3 -3
  138. package/src/components/dataviews-layouts/grid/style.scss +1 -1
  139. package/src/components/dataviews-layouts/list/index.tsx +2 -3
  140. package/src/components/dataviews-layouts/list/style.scss +1 -1
  141. package/src/components/dataviews-layouts/picker-grid/index.tsx +5 -9
  142. package/src/components/dataviews-layouts/picker-grid/style.scss +1 -1
  143. package/src/components/dataviews-layouts/picker-table/index.tsx +9 -7
  144. package/src/components/dataviews-layouts/picker-table/style.scss +1 -1
  145. package/src/components/dataviews-layouts/table/index.tsx +0 -2
  146. package/src/dataform/stories/content.story.tsx +1 -1
  147. package/src/dataform/stories/data-adapter.tsx +6 -6
  148. package/src/dataform/stories/layout-card.tsx +8 -8
  149. package/src/dataform/stories/layout-details.tsx +5 -5
  150. package/src/dataform/stories/layout-panel.tsx +9 -9
  151. package/src/dataform/stories/layout-regular.tsx +16 -9
  152. package/src/dataform/stories/layout-row.tsx +9 -9
  153. package/src/dataform/stories/validation.tsx +25 -10
  154. package/src/dataviews/index.tsx +11 -7
  155. package/src/dataviews/stories/empty.tsx +6 -6
  156. package/src/dataviews/stories/fixtures.tsx +2 -2
  157. package/src/dataviews/stories/free-composition.tsx +10 -13
  158. package/src/dataviews/stories/infinite-scroll.tsx +4 -4
  159. package/src/dataviews/stories/layout-activity.tsx +7 -9
  160. package/src/dataviews/stories/layout-custom.tsx +1 -1
  161. package/src/dataviews/stories/layout-grid.tsx +5 -7
  162. package/src/dataviews/stories/layout-list.tsx +6 -8
  163. package/src/dataviews/stories/layout-table.tsx +5 -7
  164. package/src/dataviews/stories/minimal-ui.tsx +1 -1
  165. package/src/dataviews/stories/with-card.tsx +4 -7
  166. package/src/dataviews/style.scss +1 -1
  167. package/src/dataviews/test/dataviews.tsx +73 -6
  168. package/src/dataviews-picker/index.tsx +17 -7
  169. package/src/dataviews-picker/stories/index.story.tsx +1 -5
  170. package/src/dataviews-picker/test/dataviews-picker.tsx +79 -2
  171. package/src/field-types/date.tsx +3 -0
  172. package/src/field-types/datetime.tsx +3 -0
  173. package/src/field-types/stories/index.story.tsx +1 -1
  174. package/src/field-types/test/normalize-fields.ts +44 -0
  175. package/src/field-types/utils/get-is-valid.ts +44 -31
  176. package/src/field-types/utils/is-valid-date-boundary.ts +80 -0
  177. package/src/hooks/test/use-form-validity.ts +479 -0
  178. package/src/types/dataviews.ts +9 -0
  179. package/src/types/field-api.ts +11 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dataviews",
3
- "version": "14.1.1-next.v.202604091042.0+668146787",
3
+ "version": "14.2.0",
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",
@@ -53,20 +53,20 @@
53
53
  "sideEffects": false,
54
54
  "dependencies": {
55
55
  "@ariakit/react": "^0.4.21",
56
- "@wordpress/base-styles": "^6.19.1-next.v.202604091042.0+668146787",
57
- "@wordpress/components": "^32.5.2-next.v.202604091042.0+668146787",
58
- "@wordpress/compose": "^7.43.1-next.v.202604091042.0+668146787",
59
- "@wordpress/data": "^10.43.1-next.v.202604091042.0+668146787",
60
- "@wordpress/date": "^5.43.1-next.v.202604091042.0+668146787",
61
- "@wordpress/deprecated": "^4.43.1-next.v.202604091042.0+668146787",
62
- "@wordpress/element": "^6.44.1-next.v.202604091042.0+668146787",
63
- "@wordpress/i18n": "^6.17.1-next.v.202604091042.0+668146787",
64
- "@wordpress/icons": "^12.1.1-next.v.202604091042.0+668146787",
65
- "@wordpress/keycodes": "^4.43.1-next.v.202604091042.0+668146787",
66
- "@wordpress/primitives": "^4.43.1-next.v.202604091042.0+668146787",
67
- "@wordpress/private-apis": "^1.43.1-next.v.202604091042.0+668146787",
68
- "@wordpress/ui": "^0.11.1-next.v.202604091042.0+668146787",
69
- "@wordpress/warning": "^3.43.1-next.v.202604091042.0+668146787",
56
+ "@wordpress/base-styles": "^7.0.0",
57
+ "@wordpress/components": "^33.0.0",
58
+ "@wordpress/compose": "^7.45.0",
59
+ "@wordpress/data": "^10.45.0",
60
+ "@wordpress/date": "^5.45.0",
61
+ "@wordpress/deprecated": "^4.45.0",
62
+ "@wordpress/element": "^6.45.0",
63
+ "@wordpress/i18n": "^6.18.0",
64
+ "@wordpress/icons": "^13.0.0",
65
+ "@wordpress/keycodes": "^4.45.0",
66
+ "@wordpress/primitives": "^4.45.0",
67
+ "@wordpress/private-apis": "^1.45.0",
68
+ "@wordpress/ui": "^0.12.0",
69
+ "@wordpress/warning": "^3.45.0",
70
70
  "clsx": "^2.1.1",
71
71
  "colord": "^2.7.0",
72
72
  "date-fns": "^4.1.0",
@@ -92,5 +92,5 @@
92
92
  "scripts": {
93
93
  "build:wp": "node build.cjs"
94
94
  },
95
- "gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
95
+ "gitHead": "8c229eaed0e88c9827e2da3d73a78f9ddd77714b"
96
96
  }
@@ -22,7 +22,8 @@ export default function ArrayControl< Item >( {
22
22
  markWhenOptional,
23
23
  validity,
24
24
  }: DataFormControlProps< Item > ) {
25
- const { label, placeholder, getValue, setValue, isValid } = field;
25
+ const { label, placeholder, description, getValue, setValue, isValid } =
26
+ field;
26
27
  const value = getValue( { item: data } );
27
28
  const disabled = field.isDisabled( { item: data, field } );
28
29
 
@@ -88,7 +89,7 @@ export default function ArrayControl< Item >( {
88
89
  return true;
89
90
  } }
90
91
  __experimentalExpandOnFocus={ elements && elements.length > 0 }
91
- __experimentalShowHowTo={ ! field.isValid?.elements }
92
+ help={ description ?? ( field.isValid?.elements ? '' : undefined ) }
92
93
  displayTransform={ ( token: any ) => {
93
94
  // For existing tokens (element objects), display their label
94
95
  if ( typeof token === 'object' && 'label' in token ) {
@@ -38,6 +38,7 @@ import { Stack } from '@wordpress/ui';
38
38
  * Internal dependencies
39
39
  */
40
40
  import RelativeDateControl from './utils/relative-date-control';
41
+ import useDisabledDateMatchers from './utils/use-disabled-date-matchers';
41
42
  import {
42
43
  OPERATOR_IN_THE_PAST,
43
44
  OPERATOR_OVER,
@@ -318,6 +319,9 @@ function CalendarDateControl< Item >( {
318
319
  const [ isTouched, setIsTouched ] = useState( false );
319
320
  const validityTargetRef = useRef< HTMLInputElement >( null );
320
321
 
322
+ const { minConstraint, maxConstraint, disabledMatchers } =
323
+ useDisabledDateMatchers( isValid, parseDate );
324
+
321
325
  const onChangeCallback = useCallback(
322
326
  ( newValue: string | undefined ) =>
323
327
  onChange( setValue( { item: data, value: newValue } ) ),
@@ -440,6 +444,8 @@ function CalendarDateControl< Item >( {
440
444
  onChange={ handleManualDateChange }
441
445
  required={ !! field.isValid?.required }
442
446
  disabled={ disabled }
447
+ min={ minConstraint }
448
+ max={ maxConstraint }
443
449
  />
444
450
 
445
451
  { /* Calendar widget */ }
@@ -453,7 +459,8 @@ function CalendarDateControl< Item >( {
453
459
  onMonthChange={ setCalendarMonth }
454
460
  timeZone={ timezoneString || undefined }
455
461
  weekStartsOn={ weekStartsOn }
456
- disabled={ disabled }
462
+ disabled={ disabled || disabledMatchers }
463
+ disableNavigation={ disabled }
457
464
  />
458
465
  </Stack>
459
466
  </BaseControl>
@@ -475,6 +482,7 @@ function CalendarDateRangeControl< Item >( {
475
482
  description,
476
483
  getValue,
477
484
  setValue,
485
+ isValid,
478
486
  format: fieldFormat,
479
487
  } = field;
480
488
  const disabled = field.isDisabled( { item: data, field } );
@@ -492,6 +500,9 @@ function CalendarDateRangeControl< Item >( {
492
500
  ( fieldFormat as FormatDate ).weekStartsOn ??
493
501
  getSettings().l10n.startOfWeek;
494
502
 
503
+ const { minConstraint, maxConstraint, disabledMatchers } =
504
+ useDisabledDateMatchers( isValid, parseDate );
505
+
495
506
  const onChangeCallback = useCallback(
496
507
  ( newValue: DateRange ) => {
497
508
  onChange(
@@ -673,6 +684,8 @@ function CalendarDateRangeControl< Item >( {
673
684
  }
674
685
  required={ !! field.isValid?.required }
675
686
  disabled={ disabled }
687
+ min={ minConstraint }
688
+ max={ maxConstraint }
676
689
  />
677
690
  <InputControl
678
691
  __next40pxDefaultSize
@@ -686,6 +699,8 @@ function CalendarDateRangeControl< Item >( {
686
699
  }
687
700
  required={ !! field.isValid?.required }
688
701
  disabled={ disabled }
702
+ min={ minConstraint }
703
+ max={ maxConstraint }
689
704
  />
690
705
  </Stack>
691
706
 
@@ -697,7 +712,7 @@ function CalendarDateRangeControl< Item >( {
697
712
  onMonthChange={ setCalendarMonth }
698
713
  timeZone={ timezone.string || undefined }
699
714
  weekStartsOn={ weekStartsOn }
700
- disabled={ disabled }
715
+ disabled={ disabled || disabledMatchers }
701
716
  />
702
717
  </Stack>
703
718
  </BaseControl>
@@ -16,6 +16,7 @@ import { Stack } from '@wordpress/ui';
16
16
  import type { DataFormControlProps, FormatDatetime } from '../../types';
17
17
  import { OPERATOR_IN_THE_PAST, OPERATOR_OVER } from '../../constants';
18
18
  import RelativeDateControl from './utils/relative-date-control';
19
+ import useDisabledDateMatchers from './utils/use-disabled-date-matchers';
19
20
  import getCustomValidity from './utils/get-custom-validity';
20
21
  import parseDateTime from '../../field-types/utils/parse-date-time';
21
22
  import { unlock } from '../../lock-unlock';
@@ -55,6 +56,9 @@ function CalendarDateTimeControl< Item >( {
55
56
  useRef< ReturnType< typeof setTimeout > >( undefined );
56
57
  const previousFocusRef = useRef< Element | null >( null );
57
58
 
59
+ const { minConstraint, maxConstraint, disabledMatchers } =
60
+ useDisabledDateMatchers( isValid, parseDateTime );
61
+
58
62
  const onChangeCallback = useCallback(
59
63
  ( newValue: string | undefined ) =>
60
64
  onChange( setValue( { item: data, value: newValue } ) ),
@@ -181,6 +185,16 @@ function CalendarDateTimeControl< Item >( {
181
185
  value={ formatDateTime( value ) }
182
186
  onChange={ handleManualDateTimeChange }
183
187
  disabled={ disabled }
188
+ min={
189
+ minConstraint
190
+ ? formatDateTime( minConstraint )
191
+ : undefined
192
+ }
193
+ max={
194
+ maxConstraint
195
+ ? formatDateTime( maxConstraint )
196
+ : undefined
197
+ }
184
198
  />
185
199
  { /* Calendar widget */ }
186
200
  { ! compact && (
@@ -196,7 +210,7 @@ function CalendarDateTimeControl< Item >( {
196
210
  onMonthChange={ setCalendarMonth }
197
211
  timeZone={ timezoneString || undefined }
198
212
  weekStartsOn={ weekStartsOn }
199
- disabled={ disabled }
213
+ disabled={ disabled || disabledMatchers }
200
214
  />
201
215
  ) }
202
216
  </Stack>
@@ -0,0 +1,48 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useMemo } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import type { NormalizedRules } from '../../../types';
10
+
11
+ type DateMatcher = { before: Date } | { after: Date };
12
+
13
+ export default function useDisabledDateMatchers< Item >(
14
+ isValid: NormalizedRules< Item >,
15
+ parseDateFn: ( dateString?: string ) => Date | null
16
+ ): {
17
+ minConstraint: string | undefined;
18
+ maxConstraint: string | undefined;
19
+ disabledMatchers: DateMatcher[] | undefined;
20
+ } {
21
+ const minConstraint =
22
+ typeof isValid.min?.constraint === 'string'
23
+ ? isValid.min.constraint
24
+ : undefined;
25
+ const maxConstraint =
26
+ typeof isValid.max?.constraint === 'string'
27
+ ? isValid.max.constraint
28
+ : undefined;
29
+
30
+ const disabledMatchers = useMemo( () => {
31
+ const matchers: DateMatcher[] = [];
32
+ if ( minConstraint ) {
33
+ const minDate = parseDateFn( minConstraint );
34
+ if ( minDate ) {
35
+ matchers.push( { before: minDate } );
36
+ }
37
+ }
38
+ if ( maxConstraint ) {
39
+ const maxDate = parseDateFn( maxConstraint );
40
+ if ( maxDate ) {
41
+ matchers.push( { after: maxDate } );
42
+ }
43
+ }
44
+ return matchers.length > 0 ? matchers : undefined;
45
+ }, [ minConstraint, maxConstraint, parseDateFn ] );
46
+
47
+ return { minConstraint, maxConstraint, disabledMatchers };
48
+ }
@@ -9,9 +9,6 @@ import {
9
9
  useRef,
10
10
  useState,
11
11
  } from '@wordpress/element';
12
- // TODO: enable in the ESlint rule once we complete
13
- // https://github.com/WordPress/gutenberg/issues/76135.
14
- // eslint-disable-next-line @wordpress/use-recommended-components
15
12
  import { Card, CollapsibleCard, Stack } from '@wordpress/ui';
16
13
 
17
14
  /**
@@ -8,7 +8,7 @@
8
8
  display: flex;
9
9
  width: 100%;
10
10
  min-height: $grid-unit-30;
11
- cursor: pointer;
11
+ cursor: var(--wpds-cursor-control);
12
12
  align-items: flex-start;
13
13
  border-radius: $radius-small;
14
14
  isolation: isolate;
@@ -44,7 +44,7 @@
44
44
 
45
45
  .dataforms-layouts-panel__field-control {
46
46
  color: $gray-700;
47
- font-weight: var(--wpds-font-weight-regular);
47
+ font-weight: var(--wpds-typography-font-weight-regular);
48
48
  }
49
49
  }
50
50
  }
@@ -92,7 +92,6 @@
92
92
  line-height: $grid-unit-05 * 5;
93
93
  hyphens: auto;
94
94
  color: $gray-700;
95
- text-transform: capitalize;
96
95
 
97
96
  .components-base-control__label {
98
97
  display: inline;
@@ -123,12 +122,12 @@
123
122
  flex-grow: 1;
124
123
  min-width: 0;
125
124
  min-height: $grid-unit-30;
126
- line-height: var(--wpds-font-line-height-md);
125
+ line-height: var(--wpds-typography-line-height-md);
127
126
  display: flex;
128
127
  align-items: center;
129
128
  overflow: hidden;
130
129
  word-break: break-word;
131
- font-weight: var(--wpds-font-weight-medium);
130
+ font-weight: var(--wpds-typography-font-weight-medium);
132
131
 
133
132
  > * {
134
133
  min-width: 0;
@@ -157,7 +157,6 @@ export default function SummaryButton< Item >( {
157
157
  <Button
158
158
  className="dataforms-layouts-panel__field-trigger-icon"
159
159
  label={ ariaLabel }
160
- showTooltip={ false }
161
160
  icon={ pencil }
162
161
  size="small"
163
162
  aria-expanded={ ariaExpanded }
@@ -15,7 +15,7 @@ import type {
15
15
  View,
16
16
  Action,
17
17
  NormalizedField,
18
- SupportedLayouts,
18
+ NormalizedSupportedLayouts,
19
19
  NormalizedFilter,
20
20
  } from '../../types';
21
21
  import type { SetSelection } from '../../types/private';
@@ -50,7 +50,7 @@ type DataViewsContextType< Item > = {
50
50
  resizeObserverRef:
51
51
  | ( ( element?: HTMLDivElement | null ) => void )
52
52
  | React.RefObject< HTMLDivElement >;
53
- defaultLayouts: SupportedLayouts;
53
+ defaultLayouts: NormalizedSupportedLayouts;
54
54
  filters: NormalizedFilter[];
55
55
  isShowingFilter: boolean;
56
56
  setIsShowingFilter: ( value: boolean ) => void;
@@ -12,13 +12,9 @@ import clsx from 'clsx';
12
12
  import { useInstanceId } from '@wordpress/compose';
13
13
  import { __, sprintf } from '@wordpress/i18n';
14
14
  import { useState, useMemo, useDeferredValue } from '@wordpress/element';
15
- import {
16
- VisuallyHidden,
17
- Icon,
18
- Composite,
19
- Spinner,
20
- } from '@wordpress/components';
15
+ import { Icon, Composite, Spinner } from '@wordpress/components';
21
16
  import { search, check } from '@wordpress/icons';
17
+ import { VisuallyHidden } from '@wordpress/ui';
22
18
 
23
19
  /**
24
20
  * Internal dependencies
@@ -267,15 +263,9 @@ function ComboboxList( { view, filter, onChangeView }: SearchWidgetProps ) {
267
263
  setValue={ setSearchValue }
268
264
  >
269
265
  <div className="dataviews-filters__search-widget-filter-combobox__wrapper">
270
- <Ariakit.ComboboxLabel
271
- render={
272
- <VisuallyHidden>
273
- { __( 'Search items' ) }
274
- </VisuallyHidden>
275
- }
276
- >
266
+ <VisuallyHidden render={ <Ariakit.ComboboxLabel /> }>
277
267
  { __( 'Search items' ) }
278
- </Ariakit.ComboboxLabel>
268
+ </VisuallyHidden>
279
269
  <Ariakit.Combobox
280
270
  autoSelect="always"
281
271
  placeholder={ __( 'Search' ) }
@@ -76,7 +76,7 @@
76
76
  .dataviews-filters__summary-chip {
77
77
  border-radius: $grid-unit-20;
78
78
  border: $border-width solid transparent;
79
- cursor: pointer;
79
+ cursor: var(--wpds-cursor-control);
80
80
  padding: $grid-unit-05 $grid-unit-15;
81
81
  min-height: $grid-unit-40;
82
82
  background: $gray-100;
@@ -137,7 +137,7 @@
137
137
  align-items: center;
138
138
  justify-content: center;
139
139
  background: transparent;
140
- cursor: pointer;
140
+ cursor: var(--wpds-cursor-control);
141
141
 
142
142
  svg {
143
143
  fill: $gray-700;
@@ -6,11 +6,10 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { VisuallyHidden } from '@wordpress/components';
10
9
  import { useRef, useContext, useMemo } from '@wordpress/element';
11
10
  import { useRegistry } from '@wordpress/data';
12
11
  import { useViewportMatch } from '@wordpress/compose';
13
- import { Stack } from '@wordpress/ui';
12
+ import { Stack, VisuallyHidden } from '@wordpress/ui';
14
13
 
15
14
  /**
16
15
  * Internal dependencies
@@ -162,8 +161,8 @@ function ActivityItem< Item >(
162
161
  className="dataviews-view-activity__item-field"
163
162
  >
164
163
  <VisuallyHidden
165
- as="span"
166
164
  className="dataviews-view-activity__item-field-label"
165
+ render={ <span /> }
167
166
  >
168
167
  { field.label }
169
168
  </VisuallyHidden>
@@ -35,7 +35,7 @@
35
35
  overflow: hidden;
36
36
 
37
37
  &--clickable {
38
- cursor: pointer;
38
+ cursor: var(--wpds-cursor-control);
39
39
 
40
40
  &:focus-visible {
41
41
  outline: var(--wp-admin-border-width-focus) solid var(--wp-admin-theme-color);
@@ -43,7 +43,7 @@ import type {
43
43
  } from '../../../types';
44
44
  import type { SetSelection } from '../../../types/private';
45
45
  import { ItemClickWrapper } from '../utils/item-click-wrapper';
46
- const { Badge } = unlock( componentsPrivateApis );
46
+ const { Badge: WCBadge } = unlock( componentsPrivateApis );
47
47
  import { useGridColumns } from './preview-size-picker';
48
48
  import { GridItems } from '../utils/grid-items';
49
49
  import {
@@ -273,7 +273,7 @@ const GridItem = forwardRef< HTMLDivElement, GridItemProps< any > >(
273
273
  >
274
274
  { badgeFields.map( ( field ) => {
275
275
  return (
276
- <Badge
276
+ <WCBadge
277
277
  key={ field.id }
278
278
  className="dataviews-view-grid__field-value"
279
279
  >
@@ -281,7 +281,7 @@ const GridItem = forwardRef< HTMLDivElement, GridItemProps< any > >(
281
281
  item={ item }
282
282
  field={ field }
283
283
  />
284
- </Badge>
284
+ </WCBadge>
285
285
  );
286
286
  } ) }
287
287
  </Stack>
@@ -250,7 +250,7 @@
250
250
  }
251
251
 
252
252
  .dataviews-view-grid__media--clickable {
253
- cursor: pointer;
253
+ cursor: var(--wpds-cursor-control);
254
254
  }
255
255
 
256
256
  .dataviews-view-grid__group-header {
@@ -11,7 +11,6 @@ import {
11
11
  Button,
12
12
  privateApis as componentsPrivateApis,
13
13
  Spinner,
14
- VisuallyHidden,
15
14
  Composite,
16
15
  } from '@wordpress/components';
17
16
  import {
@@ -25,7 +24,7 @@ import {
25
24
  import { __, sprintf } from '@wordpress/i18n';
26
25
  import { moreVertical } from '@wordpress/icons';
27
26
  import { useRegistry } from '@wordpress/data';
28
- import { Stack } from '@wordpress/ui';
27
+ import { Stack, VisuallyHidden } from '@wordpress/ui';
29
28
 
30
29
  /**
31
30
  * Internal dependencies
@@ -355,8 +354,8 @@ function ListItem< Item >( {
355
354
  className="dataviews-view-list__field"
356
355
  >
357
356
  <VisuallyHidden
358
- as="span"
359
357
  className="dataviews-view-list__field-label"
358
+ render={ <span /> }
360
359
  >
361
360
  { field.label }
362
361
  </VisuallyHidden>
@@ -115,7 +115,7 @@ div.dataviews-view-list {
115
115
  border: none;
116
116
  background: none;
117
117
  padding: 0;
118
- cursor: pointer;
118
+ cursor: var(--wpds-cursor-control);
119
119
 
120
120
  &:focus-visible {
121
121
  outline: none;
@@ -33,7 +33,7 @@ import type {
33
33
  } from '../../../types';
34
34
  import type { SetSelection } from '../../../types/private';
35
35
  import { GridItems } from '../utils/grid-items';
36
- const { Badge } = unlock( componentsPrivateApis );
36
+ const { Badge: WCBadge } = unlock( componentsPrivateApis );
37
37
  import getDataByGroup from '../utils/get-data-by-group';
38
38
  import { useGridColumns } from '../grid/preview-size-picker';
39
39
  import {
@@ -78,14 +78,10 @@ function GridItem< Item >( {
78
78
  }: GridItemProps< Item > ) {
79
79
  const { showTitle = true, showMedia = true, showDescription = true } = view;
80
80
  const id = getItemId( item );
81
- const elementRef = useRef< HTMLElement | null >( null );
81
+ const elementRef = useRef< HTMLButtonElement >( null );
82
82
 
83
83
  const isSelected = selection.includes( id );
84
84
 
85
- const setElementRef = ( element: HTMLElement | null ) => {
86
- elementRef.current = element;
87
- };
88
-
89
85
  useIntersectionObserver( elementRef, posinset );
90
86
 
91
87
  const renderedMediaField = mediaField?.render ? (
@@ -102,7 +98,7 @@ function GridItem< Item >( {
102
98
 
103
99
  return (
104
100
  <Composite.Item
105
- ref={ setElementRef }
101
+ ref={ elementRef }
106
102
  aria-label={
107
103
  titleField
108
104
  ? titleField.getValue( { item } ) || __( '(no title)' )
@@ -179,7 +175,7 @@ function GridItem< Item >( {
179
175
  >
180
176
  { badgeFields.map( ( field ) => {
181
177
  return (
182
- <Badge
178
+ <WCBadge
183
179
  key={ field.id }
184
180
  className="dataviews-view-picker-grid__field-value"
185
181
  >
@@ -187,7 +183,7 @@ function GridItem< Item >( {
187
183
  item={ item }
188
184
  field={ field }
189
185
  />
190
- </Badge>
186
+ </WCBadge>
191
187
  );
192
188
  } ) }
193
189
  </Stack>
@@ -174,7 +174,7 @@
174
174
  }
175
175
 
176
176
  .dataviews-view-picker-grid__media--clickable {
177
- cursor: pointer;
177
+ cursor: var(--wpds-cursor-control);
178
178
  }
179
179
 
180
180
  .dataviews-view-picker-grid-group__header {
@@ -100,11 +100,7 @@ function TableRow< Item >( {
100
100
  const isSelected = selection.includes( id );
101
101
 
102
102
  const [ isHovered, setIsHovered ] = useState( false );
103
- const elementRef = useRef< HTMLElement | null >( null );
104
-
105
- const setElementRef = ( element: HTMLElement | null ) => {
106
- elementRef.current = element;
107
- };
103
+ const elementRef = useRef< HTMLButtonElement >( null );
108
104
 
109
105
  useIntersectionObserver( elementRef, posinset );
110
106
  const {
@@ -129,7 +125,7 @@ function TableRow< Item >( {
129
125
  return (
130
126
  <Composite.Item
131
127
  key={ id }
132
- ref={ setElementRef }
128
+ ref={ elementRef }
133
129
  render={ ( { children, ...props } ) => (
134
130
  <tr
135
131
  className={ clsx( 'dataviews-view-table__row', {
@@ -162,6 +158,7 @@ function TableRow< Item >( {
162
158
  >
163
159
  <td
164
160
  className="dataviews-view-table__checkbox-column"
161
+ // eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role
165
162
  role="presentation"
166
163
  >
167
164
  <div className="dataviews-view-table__cell-content-wrapper">
@@ -179,7 +176,10 @@ function TableRow< Item >( {
179
176
  </td>
180
177
 
181
178
  { hasPrimaryColumn && (
182
- <td role="presentation">
179
+ <td
180
+ // eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role
181
+ role="presentation"
182
+ >
183
183
  <ColumnPrimary
184
184
  item={ item }
185
185
  titleField={ showTitle ? titleField : undefined }
@@ -204,6 +204,7 @@ function TableRow< Item >( {
204
204
  maxWidth,
205
205
  minWidth,
206
206
  } }
207
+ // eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role
207
208
  role="presentation"
208
209
  >
209
210
  <TableColumnField
@@ -414,6 +415,7 @@ function ViewPickerTable< Item >( {
414
415
  1
415
416
  }
416
417
  className="dataviews-view-table__group-header-cell"
418
+ // eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role
417
419
  role="presentation"
418
420
  >
419
421
  { view.groupBy?.showLabel === false
@@ -36,7 +36,7 @@
36
36
 
37
37
  // When used in picker context, ensure row selection works as expected
38
38
  .dataviews-view-table__row {
39
- cursor: pointer;
39
+ cursor: var(--wpds-cursor-control);
40
40
 
41
41
  &.is-selected {
42
42
  // Ensure selected rows are visually distinct
@@ -267,7 +267,6 @@ function TableRow< Item >( {
267
267
  // itself (to toggle row selection) without erroneously
268
268
  // intercepting click events from ItemActions.
269
269
 
270
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
271
270
  <td
272
271
  className={ clsx( 'dataviews-view-table__actions-column', {
273
272
  'dataviews-view-table__actions-column--sticky': true,
@@ -278,7 +277,6 @@ function TableRow< Item >( {
278
277
  >
279
278
  <ItemActions item={ item } actions={ actions } />
280
279
  </td>
281
- /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
282
280
  ) }
283
281
  </tr>
284
282
  );
@@ -297,7 +297,7 @@ export const HighLevelHelpText: Story = {
297
297
  fields: [
298
298
  {
299
299
  id: 'accountForm',
300
- label: 'Account Information',
300
+ label: 'Account information',
301
301
  description:
302
302
  'We collect this information to create your account and provide personalized services. Your data will be kept secure and used only for account management and service improvements.',
303
303
  children: [ 'name', 'email', 'phone' ],