@gopherium/godmin 0.29.1 → 0.31.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.
- package/README.md +4 -3
- package/dist/base.css +223 -13
- package/dist/bulk-run.d.ts +3 -3
- package/dist/bulk-run.js +41 -13
- package/dist/focus-back.d.ts +22 -0
- package/dist/focus-back.js +37 -13
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -3
- package/dist/list-chrome/es-ES.d.ts +1 -1
- package/dist/list-chrome/es-ES.js +7 -4
- package/dist/list-chrome/fr-FR.d.ts +1 -1
- package/dist/list-chrome/fr-FR.js +5 -1
- package/dist/list-empty.d.ts +14 -7
- package/dist/list-empty.js +14 -4
- package/dist/list-run.d.ts +8 -4
- package/dist/list-run.js +143 -6
- package/dist/page-breadcrumbs.d.ts +28 -0
- package/dist/page-breadcrumbs.js +18 -0
- package/dist/page-tabs.js +29 -26
- package/dist/page.d.ts +8 -3
- package/dist/page.js +48 -9
- package/dist/size-watch.d.ts +11 -0
- package/dist/size-watch.js +36 -0
- package/dist/wide-list.d.ts +7 -0
- package/dist/wide-list.js +33 -0
- package/docs/build-and-versioning.md +3 -3
- package/docs/design-system/accessibility.md +64 -16
- package/docs/design-system/custom-properties.md +9 -2
- package/docs/design-system/layout.md +5 -3
- package/docs/design-system/lists.md +234 -0
- package/docs/design-system/loading.md +2 -0
- package/docs/design-system/overview.md +6 -1
- package/docs/design-system/radius-and-elevation.md +3 -9
- package/docs/design-system/record-pages.md +197 -0
- package/docs/design-system/toasts.md +2 -3
- package/docs/design-system/typography.md +3 -3
- package/docs/framing-an-application.md +7 -5
- package/docs/lists.md +278 -72
- package/docs/loading-and-feedback.md +9 -11
- package/docs/overview.md +1 -1
- package/docs/screens.md +83 -36
- package/package.json +21 -21
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ those two lines do for you.
|
|
|
49
49
|
|
|
50
50
|
| Entry point | Contents |
|
|
51
51
|
| --- | --- |
|
|
52
|
-
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavigationScreen`, `MenuCount`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `Toaster`, `useToaster`, `RepeatRows`, `RowControls`, `useRowKeys`, `keyFromLabel`, `listChromeCatalogFor`, `LIST_CHROME_DOMAIN`, `ListEmpty`, `ConfirmBody`, `RenameBody`, `FormBody`, `FileButton`, `useServerPaging`, `pageWindow`, `paginationOf`, `runEach`, `bulkNotes`, `useListRun`, `useBulkRun`, `RunConfirm`, `useCloseWhileOpen`, `focusInDialog`, `useFocusBack`, `focusedTrigger`, `openOnTap`, `useUnsavedText`, `markLatest`, `viewNarrows`, `offeredView`, `offeredSize`, `sizedView`, `useMediaQuery`, `useTokenDocument`, the breakpoints `HUGE_BREAKPOINT`, `SIDEBAR_BREAKPOINT`, `EDGE_BREAKPOINT`, `DENSE_BREAKPOINT`, `SHEET_BREAKPOINT`, `TITLE_BREAKPOINT` and `SMALL_VIEWPORT`, `SUPPORTED_WPDS` |
|
|
52
|
+
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `PageBreadcrumbs`, `PageBreadcrumb`, `SectionTitle`, `InitialsAvatar`, `NavigationScreen`, `MenuCount`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `Toaster`, `useToaster`, `RepeatRows`, `RowControls`, `useRowKeys`, `keyFromLabel`, `listChromeCatalogFor`, `LIST_CHROME_DOMAIN`, `ListEmpty`, `ListNoResults`, `ConfirmBody`, `RenameBody`, `FormBody`, `FileButton`, `useServerPaging`, `pageWindow`, `paginationOf`, `runEach`, `bulkNotes`, `useListRun`, `useBulkRun`, `RunConfirm`, `useCloseWhileOpen`, `focusInDialog`, `useFocusBack`, `focusedTrigger`, `openOnTap`, `useUnsavedText`, `markLatest`, `viewNarrows`, `offeredView`, `offeredSize`, `sizedView`, `useMediaQuery`, `useTokenDocument`, the breakpoints `HUGE_BREAKPOINT`, `SIDEBAR_BREAKPOINT`, `EDGE_BREAKPOINT`, `DENSE_BREAKPOINT`, `SHEET_BREAKPOINT`, `TITLE_BREAKPOINT` and `SMALL_VIEWPORT`, `SUPPORTED_WPDS` |
|
|
53
53
|
| `@gopherium/godmin/base.css` | Cascade layer order, design tokens, host rules, frame and screen styles |
|
|
54
54
|
| `@gopherium/godmin/dates` | `startListDates`, `listDate`, the only entry that loads `@wordpress/date` |
|
|
55
55
|
| `@gopherium/godmin/dialogs` | `ConfirmDialog`, `FormDialog`, the only entry that loads `@wordpress/components`. Load `@wordpress/components/build-style/style.css` once in your app, as DataViews asks |
|
|
@@ -61,8 +61,9 @@ those two lines do for you.
|
|
|
61
61
|
## Translations
|
|
62
62
|
|
|
63
63
|
GodMin speaks a few words of its own: Back on a sidebar screen, the name of
|
|
64
|
-
the sidebar column and its phone drawer,
|
|
65
|
-
drawer's close button, which only a screen reader meets
|
|
64
|
+
the sidebar column and its phone drawer, the phone menu button and the
|
|
65
|
+
drawer's close button, which only a screen reader meets, and "No results
|
|
66
|
+
found" with the line under it, which `ListNoResults` shows. It
|
|
66
67
|
translates them in the WordPress `default` text domain, as `@wordpress/ui`
|
|
67
68
|
translates its own, so `@wordpress/i18n` is a required peer. Every app
|
|
68
69
|
already has it, since
|
package/dist/base.css
CHANGED
|
@@ -88,6 +88,55 @@ body {
|
|
|
88
88
|
line-height: var(--wpds-typography-line-height-sm);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/* Freezes the checkbox and title of a wide DataViews table on a list page wider than 782px, as Jetpack Forms does. */
|
|
92
|
+
@media (width > 782px) {
|
|
93
|
+
/* Sets where the frozen title starts, the width of the checkbox column. */
|
|
94
|
+
.godmin-page__list--wide:has(td .dataviews-title-field) .dataviews-view-table.has-bulk-actions {
|
|
95
|
+
--godmin-list-frozen-start: calc(var(--wpds-dimension-padding-2xl) + var(--wpds-dimension-size-sm));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Sizes the checkbox column to the width where the frozen title starts. */
|
|
99
|
+
.godmin-page__list--wide:has(td .dataviews-title-field) .dataviews-view-table.has-bulk-actions col.dataviews-view-table__col-checkbox.dataviews-view-table__col-checkbox {
|
|
100
|
+
inline-size: var(--godmin-list-frozen-start);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Freezes the checkbox column at the start edge, on the list background. */
|
|
104
|
+
.godmin-page__list--wide:has(td .dataviews-title-field) .dataviews-view-table.has-bulk-actions .dataviews-view-table__checkbox-column {
|
|
105
|
+
position: sticky;
|
|
106
|
+
inset-inline-start: 0;
|
|
107
|
+
background-color: var(--wp-dataviews-color-background, var(--wpds-color-background-surface-neutral-strong));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Freezes the title column after the checkbox column, on the list background. */
|
|
111
|
+
.godmin-page__list--wide:has(td .dataviews-title-field) .dataviews-view-table.has-bulk-actions .dataviews-view-table__checkbox-column + * {
|
|
112
|
+
position: sticky;
|
|
113
|
+
inset-inline-start: var(--godmin-list-frozen-start);
|
|
114
|
+
padding-inline-end: var(--wpds-dimension-padding-2xl);
|
|
115
|
+
min-inline-size: 280px;
|
|
116
|
+
background-color: var(--wp-dataviews-color-background, var(--wpds-color-background-surface-neutral-strong));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Draws the line at the end of a frozen title, as DataViews draws the line beside its pinned actions. */
|
|
120
|
+
.godmin-page__list--wide:has(td .dataviews-title-field) .dataviews-view-table.has-bulk-actions .dataviews-view-table__checkbox-column + *::after {
|
|
121
|
+
content: '';
|
|
122
|
+
position: absolute;
|
|
123
|
+
inset-block: 0;
|
|
124
|
+
inset-inline-end: 0;
|
|
125
|
+
inline-size: var(--wpds-border-width-xs);
|
|
126
|
+
background-color: var(--wpds-color-stroke-surface-neutral-weak);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Repeats the tint of a selected row on its frozen cells, which paint over the row. */
|
|
130
|
+
.godmin-page__list--wide:has(td .dataviews-title-field) .dataviews-view-table.has-bulk-actions .dataviews-view-table__row.is-selected > :is(.dataviews-view-table__checkbox-column, .dataviews-view-table__checkbox-column + *) {
|
|
131
|
+
background-color: var(--wpds-color-background-interactive-brand-weak-active);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Keeps the frozen header cells over the rest of their row as it scrolls under them. */
|
|
135
|
+
.godmin-page__list--wide:has(td .dataviews-title-field) .dataviews-view-table.has-bulk-actions thead .dataviews-view-table__row > :is(.dataviews-view-table__checkbox-column, .dataviews-view-table__checkbox-column + *) {
|
|
136
|
+
z-index: 2;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
91
140
|
@layer godmin {
|
|
92
141
|
body {
|
|
93
142
|
margin: 0;
|
|
@@ -641,7 +690,43 @@ body {
|
|
|
641
690
|
}
|
|
642
691
|
|
|
643
692
|
.godmin-page__head {
|
|
644
|
-
min-block-size: var(--wpds-dimension-size-
|
|
693
|
+
min-block-size: var(--wpds-dimension-size-md);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
.godmin-page__heading {
|
|
697
|
+
display: flex;
|
|
698
|
+
flex: 1 1 calc(var(--wpds-dimension-surface-width-xs) / 2);
|
|
699
|
+
flex-wrap: wrap;
|
|
700
|
+
align-items: center;
|
|
701
|
+
min-inline-size: 0;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.godmin-page__heading > :last-child {
|
|
705
|
+
flex: 1 1 calc(var(--wpds-dimension-surface-width-xs) / 2);
|
|
706
|
+
overflow: hidden;
|
|
707
|
+
text-overflow: ellipsis;
|
|
708
|
+
white-space: nowrap;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
.godmin-page__breadcrumbs {
|
|
712
|
+
flex: none;
|
|
713
|
+
max-inline-size: 100%;
|
|
714
|
+
overflow-wrap: anywhere;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
.godmin-page__breadcrumbs ul {
|
|
718
|
+
display: flex;
|
|
719
|
+
flex-wrap: wrap;
|
|
720
|
+
align-items: center;
|
|
721
|
+
margin: 0;
|
|
722
|
+
padding: 0;
|
|
723
|
+
list-style: none;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
.godmin-page__separator {
|
|
727
|
+
margin-inline: var(--wpds-dimension-gap-sm);
|
|
728
|
+
color: var(--wpds-color-stroke-surface-neutral);
|
|
729
|
+
user-select: none;
|
|
645
730
|
}
|
|
646
731
|
|
|
647
732
|
.godmin-page__subtitle {
|
|
@@ -649,23 +734,64 @@ body {
|
|
|
649
734
|
color: var(--wpds-color-foreground-content-neutral-weak);
|
|
650
735
|
}
|
|
651
736
|
|
|
737
|
+
.godmin-page:has(> .godmin-page__split) {
|
|
738
|
+
flex: 1 1 0;
|
|
739
|
+
min-block-size: 0;
|
|
740
|
+
}
|
|
741
|
+
|
|
652
742
|
.godmin-page__split {
|
|
743
|
+
--godmin-page-stacked: calc((2 * var(--wpds-dimension-surface-width-md) + var(--wpds-dimension-gap-xl) + 2 * var(--wpds-dimension-padding-xs) - 100cqi) * 999999);
|
|
744
|
+
container-type: inline-size;
|
|
653
745
|
display: flex;
|
|
746
|
+
flex: 1 1 auto;
|
|
654
747
|
flex-wrap: wrap;
|
|
748
|
+
align-content: flex-start;
|
|
655
749
|
align-items: flex-start;
|
|
656
|
-
gap: var(--wpds-dimension-gap-xl);
|
|
750
|
+
column-gap: calc(var(--wpds-dimension-gap-xl) - 2 * var(--wpds-dimension-padding-xs));
|
|
751
|
+
row-gap: calc(var(--wpds-dimension-gap-xl) - var(--godmin-canvas-gutter-block, 0px));
|
|
752
|
+
margin-inline: calc(-1 * var(--godmin-canvas-gutter, 0px));
|
|
753
|
+
margin-block-end: calc(-1 * var(--godmin-canvas-gutter-block, 0px));
|
|
754
|
+
padding-inline: calc(var(--godmin-canvas-gutter, 0px) - var(--wpds-dimension-padding-xs));
|
|
755
|
+
border-block-start: var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral-weak);
|
|
756
|
+
overflow: hidden auto;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
.godmin-page > .godmin-page__tabs + .godmin-page__split {
|
|
760
|
+
margin-block-start: calc(-1 * var(--wpds-dimension-gap-lg));
|
|
761
|
+
border-block-start: none;
|
|
657
762
|
}
|
|
658
763
|
|
|
659
764
|
.godmin-page__main {
|
|
660
|
-
flex: 1 1
|
|
765
|
+
flex: 1 1 0;
|
|
766
|
+
padding-block-start: var(--wpds-dimension-padding-lg);
|
|
661
767
|
}
|
|
662
768
|
|
|
663
769
|
.godmin-page__aside {
|
|
664
|
-
flex:
|
|
665
|
-
|
|
770
|
+
flex: 0 1 min(100%, max(var(--wpds-dimension-surface-width-md) + 2 * var(--wpds-dimension-padding-xs), var(--godmin-page-stacked)));
|
|
771
|
+
padding-block-start: clamp(0px, calc(var(--wpds-dimension-padding-lg) - var(--godmin-page-stacked)), var(--wpds-dimension-padding-lg));
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.godmin-page__main,
|
|
775
|
+
.godmin-page__aside {
|
|
776
|
+
box-sizing: border-box;
|
|
777
|
+
max-block-size: max(100%, var(--godmin-page-stacked));
|
|
778
|
+
padding-inline: var(--wpds-dimension-padding-xs);
|
|
779
|
+
padding-block-end: var(--godmin-canvas-gutter-block, 0px);
|
|
780
|
+
overflow: hidden auto;
|
|
666
781
|
overflow-wrap: anywhere;
|
|
667
782
|
}
|
|
668
783
|
|
|
784
|
+
.godmin-page__main > *,
|
|
785
|
+
.godmin-page__aside > * {
|
|
786
|
+
flex-shrink: 0;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
.godmin-page__main .godmin-table-scroll,
|
|
790
|
+
.godmin-page__aside .godmin-table-scroll {
|
|
791
|
+
position: relative;
|
|
792
|
+
overflow-x: auto;
|
|
793
|
+
}
|
|
794
|
+
|
|
669
795
|
.godmin-page__aside:empty {
|
|
670
796
|
display: none;
|
|
671
797
|
}
|
|
@@ -701,6 +827,11 @@ body {
|
|
|
701
827
|
margin-inline: calc(-1 * min(var(--wpds-dimension-padding-2xl), var(--godmin-canvas-gutter, 0px)));
|
|
702
828
|
}
|
|
703
829
|
|
|
830
|
+
.godmin-page__main .godmin-list,
|
|
831
|
+
.godmin-page__aside .godmin-list {
|
|
832
|
+
margin-inline: 0;
|
|
833
|
+
}
|
|
834
|
+
|
|
704
835
|
.godmin-page > .godmin-page__list > :not(.dataviews-wrapper, .godmin-table-scroll, .godmin-table) {
|
|
705
836
|
margin-inline: var(--wpds-dimension-padding-2xl);
|
|
706
837
|
}
|
|
@@ -718,6 +849,26 @@ body {
|
|
|
718
849
|
margin: 0;
|
|
719
850
|
}
|
|
720
851
|
|
|
852
|
+
/* Draws the WordPress region focus ring in place of the browser's inside a list region that holds the keyboard focus. */
|
|
853
|
+
.godmin-page__list[tabindex] {
|
|
854
|
+
position: relative;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
.godmin-page__list:focus-visible {
|
|
858
|
+
outline: none;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
.godmin-page__list:focus-visible::after {
|
|
862
|
+
content: '';
|
|
863
|
+
position: absolute;
|
|
864
|
+
inset: 0;
|
|
865
|
+
z-index: 2;
|
|
866
|
+
outline: calc(2 * var(--wpds-border-width-focus)) solid var(--wpds-color-stroke-focus);
|
|
867
|
+
outline-offset: calc(-2 * var(--wpds-border-width-focus));
|
|
868
|
+
box-shadow: inset 0 0 0 calc(2 * var(--wpds-border-width-focus) + var(--wpds-border-width-xs)) var(--wpds-color-background-surface-neutral-strong);
|
|
869
|
+
pointer-events: none;
|
|
870
|
+
}
|
|
871
|
+
|
|
721
872
|
.godmin-page__tabs {
|
|
722
873
|
margin-inline: calc(-1 * var(--godmin-canvas-gutter, 0px));
|
|
723
874
|
padding-inline: var(--godmin-canvas-gutter, 0px);
|
|
@@ -749,6 +900,10 @@ body {
|
|
|
749
900
|
overscroll-behavior-inline: none;
|
|
750
901
|
}
|
|
751
902
|
|
|
903
|
+
.godmin-page-tabs:not(.godmin-page-tabs--scrolling) {
|
|
904
|
+
overflow: visible;
|
|
905
|
+
}
|
|
906
|
+
|
|
752
907
|
.godmin-page-tabs:dir(rtl) {
|
|
753
908
|
--godmin-page-tabs-start: right;
|
|
754
909
|
--godmin-page-tabs-end: left;
|
|
@@ -772,6 +927,8 @@ body {
|
|
|
772
927
|
display: flex;
|
|
773
928
|
align-items: center;
|
|
774
929
|
position: relative;
|
|
930
|
+
z-index: 1;
|
|
931
|
+
cursor: var(--wpds-cursor-control);
|
|
775
932
|
block-size: 48px;
|
|
776
933
|
padding: 0;
|
|
777
934
|
scroll-margin: 24px;
|
|
@@ -784,35 +941,83 @@ body {
|
|
|
784
941
|
white-space: nowrap;
|
|
785
942
|
}
|
|
786
943
|
|
|
787
|
-
.godmin-page-tabs__tab
|
|
788
|
-
|
|
944
|
+
.godmin-page-tabs__tab--current {
|
|
945
|
+
cursor: default;
|
|
789
946
|
}
|
|
790
947
|
|
|
791
948
|
.godmin-page-tabs__tab:focus-visible {
|
|
792
949
|
outline: none;
|
|
793
950
|
}
|
|
794
951
|
|
|
952
|
+
.godmin-page-tabs__tab:not(.godmin-page-tabs__tab--current):is(:hover, :active),
|
|
953
|
+
.godmin-page-tabs__tab:focus-visible {
|
|
954
|
+
color: var(--wpds-color-foreground-interactive-neutral-active);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.godmin-page-tabs__tab::after,
|
|
795
958
|
.godmin-page-tabs__tab::before {
|
|
796
|
-
content: '';
|
|
797
959
|
position: absolute;
|
|
798
|
-
|
|
960
|
+
z-index: -1;
|
|
799
961
|
border-radius: var(--wpds-border-radius-sm);
|
|
800
|
-
outline: var(--wpds-border-width-focus) solid
|
|
962
|
+
outline: var(--wpds-border-width-focus) solid transparent;
|
|
801
963
|
opacity: 0;
|
|
802
964
|
pointer-events: none;
|
|
803
965
|
}
|
|
804
966
|
|
|
805
|
-
|
|
967
|
+
@media not (prefers-reduced-motion) {
|
|
968
|
+
.godmin-page-tabs__tab::after,
|
|
969
|
+
.godmin-page-tabs__tab::before {
|
|
970
|
+
transition: opacity 0.1s linear;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.godmin-page-tabs__tab::after {
|
|
975
|
+
content: '';
|
|
976
|
+
inset-block: calc(var(--wpds-dimension-padding-md) + var(--wpds-dimension-padding-xs));
|
|
977
|
+
inset-inline: 0;
|
|
978
|
+
outline-offset: var(--wpds-dimension-padding-xs);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
.godmin-page-tabs__tab:focus-visible::after {
|
|
982
|
+
outline-color: var(--wpds-color-stroke-focus);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
.godmin-page-tabs__tab:not(.godmin-page-tabs__tab--current):is(:hover, :active)::after,
|
|
986
|
+
.godmin-page-tabs__tab:focus-visible::after {
|
|
987
|
+
background-color: var(--wpds-color-background-interactive-neutral-weak-active);
|
|
988
|
+
box-shadow: 0 0 0 var(--wpds-dimension-padding-xs) var(--wpds-color-background-interactive-neutral-weak-active);
|
|
806
989
|
opacity: 1;
|
|
807
990
|
}
|
|
808
991
|
|
|
809
|
-
.godmin-page-tabs__tab
|
|
992
|
+
.godmin-page-tabs--scrolling .godmin-page-tabs__tab::before {
|
|
810
993
|
content: '';
|
|
994
|
+
z-index: 0;
|
|
995
|
+
inset-block: var(--wpds-dimension-padding-md);
|
|
996
|
+
inset-inline: round(up, var(--wpds-border-width-focus), 1px);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
.godmin-page-tabs--scrolling .godmin-page-tabs__tab:focus-visible::before {
|
|
1000
|
+
outline-color: var(--wpds-color-stroke-focus);
|
|
1001
|
+
opacity: 1;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
.godmin-page-tabs--scrolling .godmin-page-tabs__tab:focus-visible::after {
|
|
1005
|
+
outline-color: transparent;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.godmin-page-tabs__line {
|
|
811
1009
|
position: absolute;
|
|
812
1010
|
inset-inline: 0;
|
|
813
1011
|
inset-block-end: 0;
|
|
814
1012
|
block-size: var(--wpds-border-width-focus);
|
|
815
|
-
background: var(--wpds-color-
|
|
1013
|
+
background-color: var(--wpds-color-foreground-interactive-neutral);
|
|
1014
|
+
outline: 2px solid transparent;
|
|
1015
|
+
outline-offset: -1px;
|
|
1016
|
+
pointer-events: none;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
.godmin-page-tabs__tab:focus-visible .godmin-page-tabs__line {
|
|
1020
|
+
background-color: var(--wpds-color-foreground-interactive-neutral-active);
|
|
816
1021
|
}
|
|
817
1022
|
|
|
818
1023
|
.godmin-page:has(> .godmin-page__list) > .godmin-page__header {
|
|
@@ -878,12 +1083,17 @@ body {
|
|
|
878
1083
|
padding-block: 48px;
|
|
879
1084
|
}
|
|
880
1085
|
|
|
1086
|
+
.dataviews-wrapper .godmin-empty {
|
|
1087
|
+
padding-block: 0;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
881
1090
|
.godmin-table {
|
|
882
1091
|
width: 100%;
|
|
883
1092
|
border-collapse: collapse;
|
|
884
1093
|
font-size: var(--wpds-typography-font-size-md);
|
|
885
1094
|
line-height: var(--wpds-typography-line-height-sm);
|
|
886
1095
|
text-align: left;
|
|
1096
|
+
overflow-wrap: normal;
|
|
887
1097
|
}
|
|
888
1098
|
|
|
889
1099
|
.godmin-table th,
|
package/dist/bulk-run.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BulkWords } from './bulk.js';
|
|
2
2
|
import type { ListRun } from './list-run.js';
|
|
3
|
-
/** Runs one call over each item,
|
|
3
|
+
/** Runs one call over each item, reports what the run reached in the given words and then reloads the list. */
|
|
4
4
|
export type BulkRun<Item> = (items: Item[], call: (item: Item) => Promise<unknown>, words: BulkWords<Item>) => Promise<void>;
|
|
5
5
|
/**
|
|
6
|
-
* Returns the handler that runs
|
|
6
|
+
* Returns the handler that runs a call per item, marks the list reloading at the first that works, toasts at the last.
|
|
7
7
|
* @param list - What the list does around a run.
|
|
8
|
-
* @param refresh - Reloads the list, given the items the run acted on.
|
|
8
|
+
* @param refresh - Reloads the list once the last call ended, given the items the run acted on.
|
|
9
9
|
* @returns The run handler, the same while the list run and the refresh stay the same.
|
|
10
10
|
*/
|
|
11
11
|
export declare function useBulkRun<Item>(list: ListRun, refresh: (items: Item[]) => Promise<unknown>): BulkRun<Item>;
|
package/dist/bulk-run.js
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { bulkNotes, runEach } from './bulk.js';
|
|
4
4
|
import { useToaster } from './toaster.js';
|
|
5
|
+
/**
|
|
6
|
+
* Returns what marks a list reloading once in a run, and what ends that reload.
|
|
7
|
+
* @param list - What the list does around a run.
|
|
8
|
+
* @returns The mark and the end.
|
|
9
|
+
*/
|
|
10
|
+
function reloadOnce(list) {
|
|
11
|
+
let ended;
|
|
12
|
+
return {
|
|
13
|
+
mark: () => {
|
|
14
|
+
ended ??= list.onRefresh();
|
|
15
|
+
},
|
|
16
|
+
end: () => ended?.(),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns the call on one item that fails as the given call fails, and calls `worked` once it works.
|
|
21
|
+
* @param call - The action on one item.
|
|
22
|
+
* @param worked - What runs each time the call on an item works.
|
|
23
|
+
* @returns The call that reports each item it finished.
|
|
24
|
+
*/
|
|
25
|
+
function reporting(call, worked) {
|
|
26
|
+
return async (item) => {
|
|
27
|
+
const { failures } = await runEach([item], call);
|
|
28
|
+
if (failures.length > 0) {
|
|
29
|
+
throw failures[0].error;
|
|
30
|
+
}
|
|
31
|
+
worked();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
5
34
|
/**
|
|
6
35
|
* Returns the one message a bulk outcome shows: the failure words when an item failed, else the done words.
|
|
7
36
|
* @param items - The items the run was given.
|
|
@@ -14,29 +43,28 @@ function bulkToast(items, outcome, words) {
|
|
|
14
43
|
return notes.notice ?? notes.toast;
|
|
15
44
|
}
|
|
16
45
|
/**
|
|
17
|
-
* Returns the handler that runs
|
|
46
|
+
* Returns the handler that runs a call per item, marks the list reloading at the first that works, toasts at the last.
|
|
18
47
|
* @param list - What the list does around a run.
|
|
19
|
-
* @param refresh - Reloads the list, given the items the run acted on.
|
|
48
|
+
* @param refresh - Reloads the list once the last call ended, given the items the run acted on.
|
|
20
49
|
* @returns The run handler, the same while the list run and the refresh stay the same.
|
|
21
50
|
*/
|
|
22
51
|
export function useBulkRun(list, refresh) {
|
|
23
52
|
const toaster = useToaster();
|
|
24
53
|
return useCallback(async (items, call, words) => {
|
|
25
54
|
const settle = list.onStart();
|
|
26
|
-
const
|
|
55
|
+
const reload = reloadOnce(list);
|
|
56
|
+
const outcome = await runEach(items, reporting(call, reload.mark));
|
|
57
|
+
void Promise.resolve()
|
|
58
|
+
.then(() => refresh(items))
|
|
59
|
+
.then(reload.end, reload.end);
|
|
27
60
|
try {
|
|
28
|
-
|
|
61
|
+
const message = bulkToast(items, outcome, words);
|
|
62
|
+
if (message !== undefined) {
|
|
63
|
+
toaster.show(message);
|
|
64
|
+
}
|
|
29
65
|
}
|
|
30
66
|
finally {
|
|
31
|
-
|
|
32
|
-
const message = bulkToast(items, outcome, words);
|
|
33
|
-
if (message !== undefined) {
|
|
34
|
-
toaster.show(message);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
finally {
|
|
38
|
-
settle(outcome.done > 0);
|
|
39
|
-
}
|
|
67
|
+
settle(outcome.done > 0);
|
|
40
68
|
}
|
|
41
69
|
}, [list, refresh, toaster]);
|
|
42
70
|
}
|
package/dist/focus-back.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
+
/** Finds the card of a grid, the row of a phone list or the row of a table holding an item. */
|
|
3
|
+
export declare const HOLDERS = ".dataviews-view-grid__card, .dataviews-view-list__item-wrapper, .dataviews-view-table__row";
|
|
2
4
|
/** Finds each trigger a dialog on an item opens from, inside the card or the row holding the item. */
|
|
3
5
|
declare const TRIGGERS: {
|
|
4
6
|
title: string;
|
|
@@ -10,11 +12,31 @@ declare const TRIGGERS: {
|
|
|
10
12
|
type ItemTrigger = keyof typeof TRIGGERS;
|
|
11
13
|
/** The trigger a list dialog opened from: an item's title, media, phone row or actions menu, or the bulk bar. */
|
|
12
14
|
export type Trigger = ItemTrigger | 'bulk';
|
|
15
|
+
/** One request to put the focus back on the trigger a dialog opened from, a new one each time it is asked. */
|
|
16
|
+
export interface FocusBack {
|
|
17
|
+
/** The item the dialog acted on. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** The trigger the dialog opened from. */
|
|
20
|
+
trigger: Trigger;
|
|
21
|
+
}
|
|
13
22
|
/**
|
|
14
23
|
* Returns the trigger a click, a tap or a key opened a dialog from, read from the focus it left there.
|
|
15
24
|
* @returns The bulk bar, the media, the title or the phone row holding the focus, the actions menu otherwise.
|
|
16
25
|
*/
|
|
17
26
|
export declare function focusedTrigger(): Trigger;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the item a control sits on and the trigger it stands for.
|
|
29
|
+
* @param control - The control.
|
|
30
|
+
* @returns The item and the trigger, none for a control in no card or row, or in one the app marks with no id.
|
|
31
|
+
*/
|
|
32
|
+
export declare function itemAt(control: Element): FocusBack | null;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a trigger on an item, found wherever its card or row now sits.
|
|
35
|
+
* @param list - The list region.
|
|
36
|
+
* @param asked - The item and the trigger.
|
|
37
|
+
* @returns The trigger, else the item's actions menu, none for a bulk action or an item with neither in the list.
|
|
38
|
+
*/
|
|
39
|
+
export declare function triggerOnItem(list: HTMLElement, { id, trigger }: FocusBack): HTMLElement | null;
|
|
18
40
|
/**
|
|
19
41
|
* Returns the handler putting a focus the page lost back on the trigger a list dialog opened from, once drawn again.
|
|
20
42
|
* @param busy - Whether the list reads its items again, its cards and rows then out of reach of the focus.
|
package/dist/focus-back.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
/** Finds each cell an app marks with the id DataViews keys its item by, the title cell at least. */
|
|
4
4
|
const MARKED = '[data-item-id]';
|
|
5
5
|
/** Finds the card of a grid, the row of a phone list or the row of a table holding an item. */
|
|
6
|
-
const HOLDERS = '.dataviews-view-grid__card, .dataviews-view-list__item-wrapper, .dataviews-view-table__row';
|
|
6
|
+
export const HOLDERS = '.dataviews-view-grid__card, .dataviews-view-list__item-wrapper, .dataviews-view-table__row';
|
|
7
7
|
/** Finds each trigger a dialog on an item opens from, inside the card or the row holding the item. */
|
|
8
8
|
const TRIGGERS = {
|
|
9
9
|
title: '.dataviews-title-field[role="button"]',
|
|
@@ -14,16 +14,32 @@ const TRIGGERS = {
|
|
|
14
14
|
/** Finds the bar DataViews draws the actions on the ticked items in. */
|
|
15
15
|
const BULK_BAR = '.dataviews-bulk-actions-footer__container';
|
|
16
16
|
/**
|
|
17
|
-
* Returns the trigger a
|
|
18
|
-
* @
|
|
17
|
+
* Returns the trigger a control stands for.
|
|
18
|
+
* @param control - The control.
|
|
19
|
+
* @returns The bulk bar, the media, the title or the phone row holding the control, the actions menu otherwise.
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (focused.closest(BULK_BAR) !== null) {
|
|
21
|
+
function triggerAt(control) {
|
|
22
|
+
if (control.closest(BULK_BAR) !== null) {
|
|
23
23
|
return 'bulk';
|
|
24
24
|
}
|
|
25
25
|
const triggers = ['media', 'title', 'row'];
|
|
26
|
-
return triggers.find((trigger) =>
|
|
26
|
+
return triggers.find((trigger) => control.closest(TRIGGERS[trigger]) !== null) ?? 'actions';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns the trigger a click, a tap or a key opened a dialog from, read from the focus it left there.
|
|
30
|
+
* @returns The bulk bar, the media, the title or the phone row holding the focus, the actions menu otherwise.
|
|
31
|
+
*/
|
|
32
|
+
export function focusedTrigger() {
|
|
33
|
+
return triggerAt(document.activeElement);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns the item a control sits on and the trigger it stands for.
|
|
37
|
+
* @param control - The control.
|
|
38
|
+
* @returns The item and the trigger, none for a control in no card or row, or in one the app marks with no id.
|
|
39
|
+
*/
|
|
40
|
+
export function itemAt(control) {
|
|
41
|
+
const id = control.closest(HOLDERS)?.querySelector(MARKED)?.dataset.itemId;
|
|
42
|
+
return id === undefined ? null : { id, trigger: triggerAt(control) };
|
|
27
43
|
}
|
|
28
44
|
/**
|
|
29
45
|
* Returns the card or the row holding an item inside the list, found through the mark on its cells.
|
|
@@ -36,18 +52,26 @@ function holderOf(list, id) {
|
|
|
36
52
|
return marked?.closest(HOLDERS) ?? null;
|
|
37
53
|
}
|
|
38
54
|
/**
|
|
39
|
-
* Returns
|
|
55
|
+
* Returns a trigger on an item, found wherever its card or row now sits.
|
|
40
56
|
* @param list - The list region.
|
|
41
57
|
* @param asked - The item and the trigger.
|
|
42
|
-
* @returns The trigger, else the item's actions menu,
|
|
58
|
+
* @returns The trigger, else the item's actions menu, none for a bulk action or an item with neither in the list.
|
|
43
59
|
*/
|
|
44
|
-
function
|
|
60
|
+
export function triggerOnItem(list, { id, trigger }) {
|
|
45
61
|
const holder = holderOf(list, id);
|
|
46
62
|
if (trigger === 'bulk' || holder === null) {
|
|
47
|
-
return
|
|
63
|
+
return null;
|
|
48
64
|
}
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
return holder.querySelector(TRIGGERS[trigger]) ?? holder.querySelector(TRIGGERS.actions);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns the trigger a dialog on an item opened from, found wherever its card or row now sits.
|
|
69
|
+
* @param list - The list region.
|
|
70
|
+
* @param asked - The item and the trigger.
|
|
71
|
+
* @returns The trigger, else the item's actions menu, else the list, which a bulk action always gets.
|
|
72
|
+
*/
|
|
73
|
+
function triggerOf(list, asked) {
|
|
74
|
+
return triggerOnItem(list, asked) ?? list;
|
|
51
75
|
}
|
|
52
76
|
/** Stops nothing, for a focus put on the list region, which no layout of the list takes off the page. */
|
|
53
77
|
function stopNothing() { }
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export { keyFromLabel } from './keys.js';
|
|
|
22
22
|
export type { KeyOptions, KeyStyle } from './keys.js';
|
|
23
23
|
export { LIST_CHROME_DOMAIN, listChromeCatalogFor } from './list-chrome.js';
|
|
24
24
|
export type { ListChromeCatalog } from './list-chrome.js';
|
|
25
|
-
export { ListEmpty } from './list-empty.js';
|
|
25
|
+
export { ListEmpty, ListNoResults } from './list-empty.js';
|
|
26
26
|
export type { ListEmptyProps } from './list-empty.js';
|
|
27
27
|
export { focusInDialog, useListRun } from './list-run.js';
|
|
28
28
|
export type { ListRun, ListRunState, RunSettled } from './list-run.js';
|
|
@@ -38,6 +38,8 @@ export { openOnTap } from './open-on-tap.js';
|
|
|
38
38
|
export type { TapList } from './open-on-tap.js';
|
|
39
39
|
export { ErrorNotice, LoadMore, Page, PageTitle, SectionTitle } from './page.js';
|
|
40
40
|
export type { LoadMoreQuery, PageProps } from './page.js';
|
|
41
|
+
export { PageBreadcrumb, PageBreadcrumbs } from './page-breadcrumbs.js';
|
|
42
|
+
export type { PageBreadcrumbProps, PageBreadcrumbsProps } from './page-breadcrumbs.js';
|
|
41
43
|
export { PageTab, PageTabs } from './page-tabs.js';
|
|
42
44
|
export type { PageTabProps, PageTabsProps } from './page-tabs.js';
|
|
43
45
|
export { RenameBody } from './rename.js';
|
|
@@ -62,6 +64,6 @@ export type { GuardedField, OfferedView, ViewGuard } from './view-guard.js';
|
|
|
62
64
|
* The design system version window this build was tested against.
|
|
63
65
|
*/
|
|
64
66
|
export declare const SUPPORTED_WPDS: {
|
|
65
|
-
readonly '@wordpress/ui': ">=0.
|
|
66
|
-
readonly '@wordpress/theme': ">=
|
|
67
|
+
readonly '@wordpress/ui': ">=0.25.0 <0.26.0";
|
|
68
|
+
readonly '@wordpress/theme': ">=3.0.0 <4.0.0";
|
|
67
69
|
};
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { FormBody } from './form.js';
|
|
|
12
12
|
export { Frame } from './frame.js';
|
|
13
13
|
export { keyFromLabel } from './keys.js';
|
|
14
14
|
export { LIST_CHROME_DOMAIN, listChromeCatalogFor } from './list-chrome.js';
|
|
15
|
-
export { ListEmpty } from './list-empty.js';
|
|
15
|
+
export { ListEmpty, ListNoResults } from './list-empty.js';
|
|
16
16
|
export { focusInDialog, useListRun } from './list-run.js';
|
|
17
17
|
export { LoadingScreen } from './loading.js';
|
|
18
18
|
export { LogItem, LogList, LogTime } from './log-list.js';
|
|
@@ -20,6 +20,7 @@ export { MenuCount } from './menu-count.js';
|
|
|
20
20
|
export { NavigationScreen } from './navigation-screen.js';
|
|
21
21
|
export { openOnTap } from './open-on-tap.js';
|
|
22
22
|
export { ErrorNotice, LoadMore, Page, PageTitle, SectionTitle } from './page.js';
|
|
23
|
+
export { PageBreadcrumb, PageBreadcrumbs } from './page-breadcrumbs.js';
|
|
23
24
|
export { PageTab, PageTabs } from './page-tabs.js';
|
|
24
25
|
export { RenameBody } from './rename.js';
|
|
25
26
|
export { useRowKeys } from './row-keys.js';
|
|
@@ -35,6 +36,6 @@ export { offeredView, viewNarrows } from './view-guard.js';
|
|
|
35
36
|
* The design system version window this build was tested against.
|
|
36
37
|
*/
|
|
37
38
|
export const SUPPORTED_WPDS = {
|
|
38
|
-
'@wordpress/ui': '>=0.
|
|
39
|
-
'@wordpress/theme': '>=
|
|
39
|
+
'@wordpress/ui': '>=0.25.0 <0.26.0',
|
|
40
|
+
'@wordpress/theme': '>=3.0.0 <4.0.0',
|
|
40
41
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ListChromeCatalog } from '../list-chrome.js';
|
|
2
|
-
/** The Spanish list chrome, list dates and
|
|
2
|
+
/** The Spanish list chrome, list dates, sidebar and no results words, compiled from the es-ES.po source beside it. */
|
|
3
3
|
declare const catalog: ListChromeCatalog;
|
|
4
4
|
export default catalog;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
/** The Spanish list chrome, list dates and
|
|
2
|
+
/** The Spanish list chrome, list dates, sidebar and no results words, compiled from the es-ES.po source beside it. */
|
|
3
3
|
const catalog = {
|
|
4
4
|
'': { lang: 'es-ES', 'plural-forms': 'nplurals=2; plural=(n != 1);' },
|
|
5
|
-
'%1$
|
|
5
|
+
'%1$s of %2$s Item': ['%1$s de %2$s elemento', '%1$s de %2$s elementos'],
|
|
6
6
|
'%1$s, %2$s': ['%1$s, %2$s'],
|
|
7
7
|
'%1$s: %2$s': ['%1$s: %2$s'],
|
|
8
|
-
'%
|
|
9
|
-
'%
|
|
8
|
+
'%s Item': ['%s elemento', '%s elementos'],
|
|
9
|
+
'%s Item selected': ['%s elemento seleccionado', '%s elementos seleccionados'],
|
|
10
10
|
'%s, selected': ['%s, seleccionado'],
|
|
11
11
|
'%s: <groupName />': ['%s: <groupName />'],
|
|
12
12
|
'(no title)': ['(sin título)'],
|
|
@@ -197,6 +197,9 @@ const catalog = {
|
|
|
197
197
|
'Today, %s': ['Hoy, %s'],
|
|
198
198
|
'Today, %s, selected': ['Hoy, %s, seleccionado'],
|
|
199
199
|
True: ['Verdadero'],
|
|
200
|
+
"Try adjusting your search or filters to find what you're looking for.": [
|
|
201
|
+
'Prueba a ajustar tu búsqueda o tus filtros para encontrar lo que buscas.',
|
|
202
|
+
],
|
|
200
203
|
Tue: ['Mar'],
|
|
201
204
|
Tuesday: ['martes'],
|
|
202
205
|
'Unknown status for %1$s': ['Estado desconocido para %1$s'],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ListChromeCatalog } from '../list-chrome.js';
|
|
2
|
-
/** The French list dates, dialog
|
|
2
|
+
/** The French list dates, dialog, sidebar and no results words, compiled from the fr-FR.po source beside it. */
|
|
3
3
|
declare const catalog: ListChromeCatalog;
|
|
4
4
|
export default catalog;
|