@table-bro/native 0.0.0-stage → 1.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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/THIRD_PARTY_NOTICES.md +69 -0
  4. package/dist/table-bro.native.d.ts +213 -0
  5. package/dist/table-bro.native.esm.js +114 -0
  6. package/dist/table-bro.native.esm.js.map +1 -0
  7. package/dist/table-bro.native.min.css +1 -0
  8. package/dist/table-bro.native.umd.js +114 -0
  9. package/dist/table-bro.native.umd.js.map +1 -0
  10. package/package.json +75 -4
  11. package/styles/_table-bro.api.scss +3 -0
  12. package/styles/_table-bro.native.api.scss +5 -0
  13. package/styles/mixins/_text-ellipsis.scss +5 -0
  14. package/styles/mixins/_visually-hidden.scss +14 -0
  15. package/styles/skin/shared/_variables.scss +94 -0
  16. package/styles/skin/shared/mixins/_custom-properties.scss +39 -0
  17. package/styles/skin/shared/mixins/_progress-bar.scss +27 -0
  18. package/styles/skin/shared/mixins/_shared.scss +79 -0
  19. package/styles/skin/shared/mixins/_skin-colors.scss +64 -0
  20. package/styles/skin/shared/mixins/_slide-toggle.scss +5 -0
  21. package/styles/skin/shared/mixins/_sort-header.scss +11 -0
  22. package/styles/skin/shared/mixins/_toolbar.scss +61 -0
  23. package/styles/skin/shared/table-bro/_details.scss +11 -0
  24. package/styles/skin/shared/table-bro/_filter-drawer.scss +62 -0
  25. package/styles/skin/shared/table-bro/_shadows.scss +19 -0
  26. package/styles/skin/shared/table-bro/_state.scss +38 -0
  27. package/styles/skin/shared/table-bro/_table.scss +70 -0
  28. package/styles/skin/shared/table-bro/_text-ellipsis.scss +14 -0
  29. package/styles/skin/vanilla-js/native/_themes.scss +45 -0
  30. package/styles/skin/vanilla-js/native/_variables.scss +54 -0
  31. package/styles/skin/vanilla-js/native/components/bootstrap-based/_paginator.scss +50 -0
  32. package/styles/skin/vanilla-js/native/components/bootstrap-based/_toolbar.scss +107 -0
  33. package/styles/skin/vanilla-js/native/table-bro/_button.scss +36 -0
  34. package/styles/skin/vanilla-js/native/table-bro/_filter-drawer.scss +10 -0
  35. package/styles/skin/vanilla-js/native/table-bro/_progress-bar.scss +45 -0
  36. package/styles/skin/vanilla-js/native/table-bro/_table.scss +16 -0
  37. package/styles/skin/vanilla-js/native/table-bro/_toolbar-search.scss +17 -0
  38. package/styles/skin/vanilla-js/native/table-bro/_toolbar.scss +31 -0
  39. package/styles/skin/vanilla-js/shared/_bootstrap-adapter.scss +9 -0
  40. package/styles/skin/vanilla-js/shared/_skin.scss +76 -0
  41. package/styles/skin/vanilla-js/shared/components/bootstrap-based/_button.scss +9 -0
  42. package/styles/skin/vanilla-js/shared/components/material-based/_paginator.scss +62 -0
  43. package/styles/skin/vanilla-js/shared/components/material-based/_sort-header.scss +149 -0
  44. package/styles/skin/vanilla-js/shared/components/material-based/_table.scss +11 -0
  45. package/styles/skin/vanilla-js/shared/table-bro/_filter-drawer.scss +13 -0
  46. package/styles/skin/vanilla-js/shared/table-bro/_paginator.scss +5 -0
  47. package/styles/skin/vanilla-js/shared/table-bro/_toolbar-search.scss +31 -0
  48. package/styles/skin/vanilla-js/shared/table-bro/_toolbar.scss +39 -0
  49. package/styles/skin/vanilla-js/shared/vendor-extensions/material-based/_paginator.scss +12 -0
  50. package/styles/table-bro.native.scss +43 -0
@@ -0,0 +1,31 @@
1
+ @use "table-bro-selector-map" as *;
2
+ @use "../themes" as *;
3
+ @use "../../shared/table-bro/toolbar" as *;
4
+
5
+ $bro-nav-link-padding: 0.5rem;
6
+
7
+ @mixin styles {
8
+ @include toolbar-main-content($bro-nav-link-padding);
9
+
10
+ .bro-navbar {
11
+ border-bottom: 1px solid $bro-border-color;
12
+ }
13
+
14
+ // The visually hidden end of the title of a link lies in the middle of the link: the native outline of WebKit takes
15
+ // in its box, which at the end of the text reached above the link and drew a step of the outline in its corner
16
+ .bro-nav-link {
17
+ position: relative;
18
+
19
+ > #{$bro-visually-hidden} {
20
+ top: 50%;
21
+ left: 50%;
22
+ }
23
+ }
24
+
25
+ .bro-dark-theme &:not(.bro-light-theme),
26
+ &.bro-dark-theme {
27
+ .bro-navbar {
28
+ border-bottom: 1px solid $bro-border-color-dark;
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,9 @@
1
+ // Bootstrap 5 has no Sass modules, so this adapter is the only file that imports it.
2
+ // The skins take its functions, variables and mixins with @use, and Bootstrap 6 will change only this file.
3
+ @import "bootstrap/scss/functions";
4
+ @import "bootstrap/scss/variables";
5
+ @import "bootstrap/scss/variables-dark";
6
+
7
+ @import "bootstrap/scss/mixins/caret";
8
+ @import "bootstrap/scss/mixins/gradients";
9
+ @import "bootstrap/scss/mixins/transition";
@@ -0,0 +1,76 @@
1
+ // The CSS that the vanilla skins bs and nv share, in the order of their entry points: the shared parts, the parts of the
2
+ // skin, which @content gives, then the shadow container and the sizes and timings for the table script
3
+ @use "sass:meta";
4
+ @use "../../shared/variables" as *;
5
+
6
+ /* Mixins */
7
+ @use "../../shared/mixins/custom-properties" as *;
8
+ @use "../../shared/mixins/shared" as *;
9
+
10
+ @use "../../shared/table-bro/details" as shared-details;
11
+ @use "../../shared/table-bro/filter-drawer" as shared-filter-drawer;
12
+ @use "../../shared/table-bro/shadows" as shared-shadows;
13
+ @use "../../shared/table-bro/state" as shared-state;
14
+ @use "../../shared/table-bro/table" as shared-table;
15
+ @use "../../shared/table-bro/text-ellipsis" as shared-text-ellipsis;
16
+ @use "./components/bootstrap-based/button" as bootstrap-based-button;
17
+ @use "./components/material-based/table" as material-based-table;
18
+ @use "./vendor-extensions/material-based/paginator" as material-based-paginator-extension;
19
+ @use "./table-bro/paginator" as vanilla-paginator;
20
+ @use "./table-bro/toolbar" as vanilla-toolbar;
21
+
22
+ // @param $tags - the element of the tags of the skin in a cell
23
+ // @param $tag - a tag in it
24
+ @mixin styles($tags, $tag) {
25
+ #{$bro-skin} {
26
+ @include shared-details.styles;
27
+ @include shared-filter-drawer.styles;
28
+ @include shared-shadows.styles;
29
+ @include shared-state.styles;
30
+ @include shared-table.styles;
31
+ @include shared-text-ellipsis.styles;
32
+
33
+ // The tags of the skin in a cell
34
+ @include bro-cell-items($tags, $tag);
35
+ }
36
+
37
+
38
+ /* Shared VanillaJS components */
39
+ @include meta.load-css("./components/material-based/paginator");
40
+ @include meta.load-css("./components/material-based/sort-header");
41
+
42
+ #{$bro-skin} {
43
+ @include bootstrap-based-button.styles;
44
+ @include material-based-table.styles;
45
+
46
+ @include material-based-paginator-extension.styles;
47
+ }
48
+
49
+
50
+ /* Shared Table-bro extensions */
51
+ #{$bro-skin} {
52
+ @include vanilla-paginator.styles;
53
+ }
54
+ @include vanilla-toolbar.styles;
55
+ @include meta.load-css("./table-bro/toolbar-search");
56
+
57
+
58
+ @content;
59
+
60
+
61
+ #{$bro-skin} {
62
+ @include bro-table-shadow-container();
63
+ }
64
+
65
+
66
+ /* The sizes and timings for the table script; :where() lets a plain table-bro selector override them */
67
+ :where(#{$bro-skin}) {
68
+ @include bro-skin-custom-properties();
69
+ }
70
+
71
+ /* A prerendered table (data-bro-prerender of prerenderTableBro) takes them in the critical CSS of its page too, as
72
+ Beasties writes it: it drops a selector of :where() alone, which nothing is left of without the pseudo-class */
73
+ table-bro:where([data-bro-prerender]#{$bro-skin}) {
74
+ @include bro-skin-custom-properties();
75
+ }
76
+ }
@@ -0,0 +1,9 @@
1
+ @use "../../bootstrap-adapter" as *;
2
+
3
+ @mixin styles {
4
+ .bro-button-toggle {
5
+ display: inline-block;
6
+
7
+ @include caret();
8
+ }
9
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+
9
+ $padding: 0 8px;
10
+ $page-size-margin-right: 8px;
11
+
12
+ $items-per-page-label-margin: 0 4px;
13
+
14
+ $range-label-margin: 0 32px 0 24px;
15
+
16
+ .bro-paginator {
17
+ display: block;
18
+ }
19
+
20
+ // Note: this wrapper element is only used to get the flexbox vertical centering to work
21
+ // with the `min-height` on IE11. It can be removed if we drop support for IE.
22
+ .bro-paginator-outer-container {
23
+ display: flex;
24
+ }
25
+
26
+ .bro-paginator-inner-container {
27
+ display: flex;
28
+
29
+ width: 100%;
30
+ padding: $padding;
31
+
32
+ flex-wrap: wrap;
33
+ align-items: center;
34
+ justify-content: flex-end;
35
+ }
36
+
37
+ .bro-paginator-page-size {
38
+ display: flex;
39
+
40
+ margin-right: $page-size-margin-right;
41
+
42
+ align-items: baseline;
43
+
44
+ [dir='rtl'] & {
45
+ margin-right: 0;
46
+ margin-left: $page-size-margin-right;
47
+ }
48
+ }
49
+
50
+ .bro-paginator-page-size-label {
51
+ margin: $items-per-page-label-margin;
52
+ }
53
+
54
+ .bro-paginator-range-label {
55
+ margin: $range-label-margin;
56
+ }
57
+
58
+ .bro-paginator-range-actions {
59
+ display: flex;
60
+
61
+ align-items: center;
62
+ }
@@ -0,0 +1,149 @@
1
+ @use "../../../../shared/mixins/shared" as *;
2
+ @use "../../../../shared/mixins/sort-header" as *;
3
+
4
+ /**
5
+ * @license
6
+ * Copyright Google LLC All Rights Reserved.
7
+ *
8
+ * Use of this source code is governed by an MIT-style license that can be
9
+ * found in the LICENSE file at https://angular.dev/license
10
+ */
11
+
12
+ // The box of the pseudo-element of the header below
13
+ .bro-sort-header {
14
+ position: relative;
15
+ }
16
+
17
+ // The header is as wide as its title and arrow, as a button, so its focus ring keeps to them: the native outline of the
18
+ // browser in the skin nv, the focus ring of Bootstrap in the skin bs
19
+ .bro-sort-header-container {
20
+ display: flex;
21
+
22
+ // The native outline of Safari takes in the boxes of the content, and the arrow, turned by its transform, gave it a
23
+ // step below the arrow: a header that clips its content has the outline of its own box. The arrow stays within
24
+ // the header, and the pseudo-element below is positioned by .bro-sort-header outside it, so the clip leaves both whole
25
+ overflow: hidden;
26
+
27
+ width: fit-content;
28
+ max-width: 100%;
29
+
30
+ align-items: center;
31
+
32
+ letter-spacing: normal;
33
+
34
+ cursor: pointer;
35
+
36
+ // A click on the whole width of the column sorts it, also beside the title
37
+ &::after {
38
+ content: "";
39
+
40
+ position: absolute;
41
+
42
+ inset: 0;
43
+ }
44
+ }
45
+
46
+ // The icon that the configs of the bs and nv skins give the arrow (icon-html): a class, not a style attribute, which a
47
+ // strict Content Security Policy blocks
48
+ .bro-sort-header-arrow .bro-button-icon {
49
+ display: inline-block;
50
+
51
+ line-height: 1;
52
+ vertical-align: top;
53
+ }
54
+
55
+ .bro-sort-header-content {
56
+ @include sort-header-content();
57
+
58
+ @include table-width-transition();
59
+ }
60
+
61
+ .bro-sort-header-position-before {
62
+ flex-direction: row-reverse;
63
+
64
+ // The arrow before the title keeps them at the end of the header
65
+ margin-inline-start: auto;
66
+ }
67
+
68
+ @keyframes _bro-sort-header-recently-cleared-ascending {
69
+ from {
70
+ opacity: 1;
71
+ transform: translateY(0);
72
+ }
73
+
74
+ to {
75
+ opacity: 0;
76
+ transform: translateY(-25%);
77
+ }
78
+ }
79
+
80
+ .bro-sort-header-arrow {
81
+ $timing: 225ms cubic-bezier(0.4, 0, 0.2, 1);
82
+ position: relative;
83
+
84
+ overflow: visible;
85
+
86
+ width: 16px;
87
+ height: 16px;
88
+
89
+ opacity: 0;
90
+
91
+ transition: transform $timing, opacity $timing;
92
+
93
+ // A header without a title sorts nothing and is no control: no arrow
94
+ .bro-sort-header-container:not([role="button"]) & {
95
+ visibility: hidden;
96
+ }
97
+
98
+ .bro-sort-header:hover & {
99
+ opacity: 0.54;
100
+ }
101
+
102
+ .bro-sort-header .bro-sort-header-sorted & {
103
+ opacity: 1;
104
+ }
105
+
106
+ .bro-sort-header-descending & {
107
+ transform: rotate(180deg);
108
+ }
109
+
110
+ .bro-sort-header-recently-cleared-ascending & {
111
+ transform: translateY(-25%);
112
+
113
+ transition: none; // Without this the animation looks glitchy on Safari.
114
+ animation: _bro-sort-header-recently-cleared-ascending $timing forwards;
115
+ }
116
+
117
+ // Without motion the arrow takes its end state at once
118
+ @media (prefers-reduced-motion: reduce) {
119
+ .bro-sort-header & {
120
+ transition-duration: 0ms;
121
+ animation-duration: 0ms;
122
+ }
123
+ }
124
+
125
+ svg {
126
+ position: absolute;
127
+ top: 50%;
128
+ left: 50%;
129
+
130
+ width: 16px;
131
+ height: 16px;
132
+ margin: -8px 0 0 -8px;
133
+
134
+ // Without this transform the element twitches at the end of the transition on Safari.
135
+ transform: translateZ(0);
136
+
137
+ fill: currentColor;
138
+ }
139
+
140
+ &,
141
+ [dir='rtl'] .bro-sort-header-position-before & {
142
+ margin: 0 0 0 6px;
143
+ }
144
+
145
+ .bro-sort-header-position-before &,
146
+ [dir='rtl'] & {
147
+ margin: 0 6px 0 0;
148
+ }
149
+ }
@@ -0,0 +1,11 @@
1
+ @mixin styles {
2
+ @at-root table-bro#{&} table {
3
+ tr.bro-header-row {
4
+ height: var(--bro-header-height);
5
+ }
6
+
7
+ tr.bro-row {
8
+ height: var(--bro-row-height);
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ @use "toolbar-search" as *;
2
+
3
+ // The header of the filter drawer of the vanilla skins: its close button looks as the buttons of the toolbar search
4
+ @mixin filter-drawer-header-content($nav-link-padding) {
5
+ .bro-filter-drawer-header .bro-toolbar-content {
6
+ @include toolbar-content-buttons($nav-link-padding);
7
+ }
8
+
9
+ // The title of the filter drawer keeps from the left edge the space that the close button keeps from the right one
10
+ .bro-filter-drawer-header .bro-filter-drawer-title {
11
+ padding-left: $nav-link-padding;
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ @use "../../../shared/mixins/toolbar" as *;
2
+
3
+ @mixin styles {
4
+ @include skin_paginator('.bro-paginator');
5
+ }
@@ -0,0 +1,31 @@
1
+ // The buttons of a toolbar content: the toolbar search and the header of the filter drawer (filter-drawer.scss) look the same
2
+ @mixin toolbar-content-buttons($nav-link-padding) {
3
+ > bro-button {
4
+ display: flex;
5
+
6
+ a {
7
+ box-sizing: content-box;
8
+ width: 1rem;
9
+ padding: 0.75rem;
10
+ }
11
+
12
+ &:first-child a {
13
+ padding-left: $nav-link-padding;
14
+ }
15
+
16
+ // The icon of the last button keeps to the right edge, as the icon of the first one keeps to the left edge:
17
+ // a text icon of the nv skin is narrower than its box
18
+ &:last-child a {
19
+ padding-right: $nav-link-padding;
20
+
21
+ text-align: right;
22
+ }
23
+ }
24
+ }
25
+
26
+ // The buttons of the toolbar search
27
+ @mixin toolbar-search-content($nav-link-padding) {
28
+ .bro-toolbar-search .bro-toolbar-content {
29
+ @include toolbar-content-buttons($nav-link-padding);
30
+ }
31
+ }
@@ -0,0 +1,39 @@
1
+ @use "../../../shared/variables" as *;
2
+ @use "../../../shared/mixins/toolbar" as *;
3
+
4
+ @mixin toolbar-links($toolbar-link-selector, $link-color) {
5
+ #{$toolbar-link-selector} {
6
+ color: $link-color;
7
+
8
+ &:hover,
9
+ &:focus {
10
+ color: $link-color;
11
+ }
12
+ }
13
+ }
14
+
15
+ @mixin toolbar-main-content($nav-link-padding) {
16
+ .bro-toolbar-content {
17
+ .bro-toolbar-title-space {
18
+ display: inline-block;
19
+
20
+ width: calc($nav-link-padding + 1rem + 0.75rem);
21
+ }
22
+ }
23
+
24
+ // The space between the title and the buttons, which keep their width: classes, not a style attribute, which a strict
25
+ // Content Security Policy blocks
26
+ .bro-toolbar-space {
27
+ flex: 1 1 auto;
28
+ }
29
+
30
+ .bro-toolbar-buttons {
31
+ flex-grow: 0;
32
+ }
33
+ }
34
+
35
+ @mixin styles {
36
+ #{$bro-skin} {
37
+ @include skin_toolbar('.bro-toolbar');
38
+ }
39
+ }
@@ -0,0 +1,12 @@
1
+ @use "../../../../shared/variables" as *;
2
+
3
+ @mixin styles {
4
+ // The background of the paginator lies on this element, so it takes the corners of the paginator
5
+ .bro-paginator-outer-container {
6
+ border-radius: inherit;
7
+ }
8
+
9
+ .bro-paginator-inner-container {
10
+ height: $bro-paginator-height;
11
+ }
12
+ }
@@ -0,0 +1,43 @@
1
+ // The native skin: @use prints its CSS. The variables and mixins of the skin without the CSS: table-bro.native.api
2
+ @forward "./table-bro.native.api";
3
+ @use "./skin/vanilla-js/native/variables" as *;
4
+ @use "sass:meta";
5
+
6
+ @use "./skin/vanilla-js/shared/skin" as shared-skin;
7
+ @use "./skin/vanilla-js/native/themes" as native-themes;
8
+ @use "./skin/vanilla-js/native/components/bootstrap-based/paginator" as native-bootstrap-based-paginator;
9
+ @use "./skin/vanilla-js/native/table-bro/filter-drawer" as native-filter-drawer;
10
+ @use "./skin/vanilla-js/native/table-bro/button" as native-button;
11
+ @use "./skin/vanilla-js/native/table-bro/progress-bar" as native-progress-bar;
12
+ @use "./skin/vanilla-js/native/table-bro/table" as native-table;
13
+ @use "./skin/vanilla-js/native/table-bro/toolbar" as native-toolbar;
14
+ @use "./skin/vanilla-js/native/table-bro/toolbar-search" as native-toolbar-search;
15
+
16
+
17
+ /* Shared */
18
+ @include shared-skin.styles('bro-nv-tags', 'mark') {
19
+ // The space after each tag of the skin
20
+ #{$bro-skin} bro-nv-tags > mark {
21
+ margin-right: 0.375rem;
22
+ }
23
+
24
+
25
+ /* Native components */
26
+ @include native-themes.styles;
27
+
28
+ @include native-bootstrap-based-paginator.styles;
29
+ @include meta.load-css("./skin/vanilla-js/native/components/bootstrap-based/toolbar");
30
+
31
+
32
+ /* Table-bro extensions */
33
+ #{$bro-skin} {
34
+ @include native-button.styles;
35
+ @include native-progress-bar.styles;
36
+ @include native-table.styles;
37
+ @include native-toolbar.styles;
38
+ @include native-toolbar-search.styles;
39
+
40
+ // The header of the filter drawer looks as the toolbar search, its rules follow it
41
+ @include native-filter-drawer.styles;
42
+ }
43
+ }