blacklight-frontend 8.3.0 → 8.6.1

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.
@@ -1,6 +1,14 @@
1
1
  .sidenav {
2
- --bl-facets-smallish-padding: .25rem;
3
- --bl-facets-smallish-border: var(--bs-border-width) solid var(--bs-border-color);
2
+ --bl-facet-active-bg: #{$facet-active-bg};
3
+ --bl-facet-active-item-color: #{$facet-active-item-color};
4
+ --bl-facet-margin-bottom: #{$spacer};
5
+ --bl-facet-remove-color: var(--bs-secondary-color);
6
+
7
+ --bl-facet-limit-body-padding: #{$spacer};
8
+
9
+ --bl-facets-smallish-padding: 0.25rem;
10
+ --bl-facets-smallish-border: var(--bs-border-width) solid
11
+ var(--bs-border-color);
4
12
  --bl-facets-smallish-margin-bottom: #{$spacer};
5
13
  --bl-facets-smallish-border-radius: #{$border-radius};
6
14
 
@@ -39,14 +47,12 @@
39
47
  $next: breakpoint-next($breakpoint, $grid-breakpoints);
40
48
  $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
41
49
 
42
-
43
50
  &#{$infix} {
44
51
  @include media-breakpoint-down($next) {
45
52
  border: var(--bl-facets-smallish-border);
46
53
  padding: var(--bl-facets-smallish-padding);
47
54
  margin-bottom: var(--bl-facets-smallish-margin-bottom);
48
55
  border-radius: var(--bl-facets-smallish-border-radius);
49
-
50
56
  }
51
57
  @include media-breakpoint-up($next) {
52
58
  // scss-lint:disable ImportantRule
@@ -101,18 +107,18 @@
101
107
  }
102
108
 
103
109
  .facet-limit {
104
- margin-bottom: $spacer;
110
+ margin-bottom: var(--bl-facet-margin-bottom);
105
111
 
106
112
  .card-body {
107
- padding: $spacer;
113
+ padding: var(--bl-facet-limit-body-padding);
108
114
  }
109
115
  }
110
116
 
111
117
  .facet-limit-active {
112
- border-color: $facet-active-border !important;
118
+ border-color: $facet-active-border;
113
119
 
114
120
  .card-header {
115
- background-color: $facet-active-bg !important;
121
+ background-color: var(--bl-facet-active-bg);
116
122
 
117
123
  .btn {
118
124
  @if function-exists(color-contrast) {
@@ -143,38 +149,32 @@
143
149
  }
144
150
 
145
151
  .selected {
146
- color: $facet-active-item-color !important;
152
+ color: var(--bl-facet-active-item-color);
147
153
  }
148
154
  }
149
155
 
150
156
  .remove {
151
- color: $text-muted;
157
+ color: var(--bl-facet-remove-color);
152
158
  font-weight: bold;
153
- padding-left: $spacer * .5;
159
+ padding-left: $spacer * 0.5;
154
160
  text-decoration: none;
155
161
 
156
162
  &:hover {
157
- color: theme-color("danger");
163
+ color: $danger;
158
164
  text-decoration: none;
159
165
  }
160
166
  }
161
167
 
162
- @mixin hyphens-auto {
163
- overflow-wrap: break-word;
164
- -webkit-hyphens: auto;
165
- -o-hyphens: auto;
166
- hyphens: auto;
167
- }
168
-
169
168
  .facet-label {
169
+ hyphens: auto;
170
+ overflow-wrap: break-word;
171
+ padding-left: 15px;
170
172
  padding-right: 1em;
171
173
  text-indent: -15px;
172
- padding-left: 15px;
173
- @include hyphens-auto;
174
174
  }
175
175
 
176
176
  .facet-count {
177
- margin-left: auto
177
+ margin-left: auto;
178
178
  }
179
179
 
180
180
  .facet-checkbox {
@@ -200,7 +200,7 @@
200
200
  }
201
201
 
202
202
  /* This prevents the contained stretch link from covering the panel body */
203
- position: relative
203
+ position: relative;
204
204
  }
205
205
 
206
206
  /* Sidenav
@@ -212,15 +212,9 @@
212
212
  }
213
213
  }
214
214
 
215
- /* style for pivot facet's nested list */
216
-
217
- .facet-values {
218
- @extend .list-unstyled;
219
- }
220
-
221
215
  .pivot-facet {
222
216
  &.show {
223
- @extend .d-flex;
217
+ display: flex;
224
218
  }
225
219
  }
226
220
 
@@ -230,16 +224,16 @@ $facet-toggle-width: 1em !default;
230
224
  $facet-toggle-height: $facet-toggle-width !default;
231
225
 
232
226
  .facet-toggle-handle {
233
- @extend .my-0;
234
- @extend .py-0;
235
- @extend .px-2;
227
+ margin-block: 0;
228
+ padding-block: 0;
229
+ padding-inline: 0.5rem;
236
230
 
237
231
  // keep the icon span centered in the button, but shift to the left for equal spacing inside row
238
- margin-left: -1 * $btn-padding-x;
232
+ margin-inline-start: -1 * $btn-padding-x;
239
233
 
240
234
  .pivot-facet & {
241
235
  // shift pivot values a little more aggressively for better compact display
242
- margin-left: -2 * $btn-padding-x;
236
+ margin-inline-start: -2 * $btn-padding-x;
243
237
  }
244
238
 
245
239
  &.collapsed {
@@ -268,10 +262,12 @@ $facet-toggle-height: $facet-toggle-width !default;
268
262
  }
269
263
 
270
264
  .show .icon {
271
- background: transparent escape-svg($facet-toggle-show-icon) center / $facet-toggle-width auto no-repeat;
265
+ background: transparent escape-svg($facet-toggle-show-icon) center /
266
+ $facet-toggle-width auto no-repeat;
272
267
  }
273
268
 
274
269
  .hide .icon {
275
- background: transparent escape-svg($facet-toggle-hide-icon) center / $facet-toggle-width auto no-repeat;
270
+ background: transparent escape-svg($facet-toggle-hide-icon) center /
271
+ $facet-toggle-width auto no-repeat;
276
272
  }
277
273
  }
@@ -2,14 +2,8 @@
2
2
  Header bar at top (Bootstrap nav-bar)
3
3
  */
4
4
 
5
- .topbar > .container {
6
- @media (max-width: breakpoint-max(xs)) {
7
- margin-left: 0;
8
- margin-right: 0;
9
- }
10
- }
11
-
12
- .navbar-logo { /* The main logo image for the Blacklight instance */
5
+ .navbar-logo {
6
+ /* The main logo image for the Blacklight instance */
13
7
  @if $logo-image {
14
8
  background: transparent $logo-image no-repeat top left;
15
9
  background-size: $logo-width $logo-height;
@@ -36,32 +30,5 @@
36
30
  .search-query-form {
37
31
  @extend .col-md-12;
38
32
  @extend .col-lg-8;
39
- padding-left: 0;
40
- }
41
- }
42
-
43
- #skip-link {
44
- position: absolute;
45
- top: 5px;
46
- left: 10px;
47
- z-index: 1;
48
-
49
- .element-invisible {
50
- position: absolute !important;
51
- clip: rect(1px, 1px, 1px, 1px);
52
- overflow: hidden;
53
- height: 1px;
54
- }
55
-
56
- .element-invisible.element-focusable:active,
57
- .element-invisible.element-focusable:focus {
58
- position: static !important;
59
- clip: auto;
60
- overflow: visible;
61
- height: auto;
62
- }
63
-
64
- a:focus {
65
- background-color: $white;
66
33
  }
67
34
  }
@@ -6,6 +6,7 @@
6
6
  }
7
7
  }
8
8
 
9
- .remove-icon {
10
- font-family: $remove-icon-font-family;
9
+ .remove .bi {
10
+ height: 1em;
11
+ width: 1em;
11
12
  }
@@ -1 +1,4 @@
1
1
  /* Generic layout stuff */
2
+ main {
3
+ padding-block: var(--bl-main-padding-y);
4
+ }
@@ -1,8 +1,8 @@
1
1
  // define a visually-hidden class that applies to a given breakpoint and below
2
2
  // https://getbootstrap.com/docs/5.3/helpers/visually-hidden/
3
3
  @if mixin-exists(visually-hidden) {
4
- @each $infix, $breakpoint in $grid-breakpoints {
5
- .visually-hidden-#{$infix} {
4
+ @each $breakpoint in map-keys($grid-breakpoints) {
5
+ .visually-hidden-#{$breakpoint} {
6
6
  @include media-breakpoint-down($breakpoint) {
7
7
  @include visually-hidden;
8
8
  }
@@ -10,8 +10,8 @@
10
10
  }
11
11
  } @else if mixin-exists(sr-only) {
12
12
  // Bootstrap 4 version
13
- @each $infix, $breakpoint in $grid-breakpoints {
14
- .visually-hidden-#{$infix} {
13
+ @each $breakpoint in map-keys($grid-breakpoints) {
14
+ .visually-hidden-#{$breakpoint} {
15
15
  @include media-breakpoint-down($breakpoint) {
16
16
  @include sr-only;
17
17
  }
@@ -1,6 +1,6 @@
1
1
  // bootstrap does flex-grow: 1 by default which makes the
2
2
  // text input roughly the same size as the select in many cases
3
- .input-group>.search-q {
3
+ .input-group > .search-q {
4
4
  flex-grow: 4;
5
5
  }
6
6
 
@@ -10,20 +10,15 @@
10
10
  flex-grow: 4;
11
11
  padding: 0;
12
12
  position: relative;
13
-
13
+
14
14
  .search-q {
15
15
  border: 0;
16
16
  height: 100%;
17
17
  width: 100%;
18
18
  }
19
-
19
+
20
20
  ul {
21
- @extend .dropdown-menu;
22
21
  display: block;
23
-
24
- li {
25
- @extend .dropdown-item;
26
- }
27
22
  }
28
23
  }
29
24
 
@@ -1,8 +1,9 @@
1
1
  /* Search History */
2
2
  .search-history {
3
+ --bl-history-filter-name-color: var(--bs-secondary-color);
3
4
 
4
5
  td {
5
- padding: $spacer
6
+ padding: $spacer;
6
7
  }
7
8
 
8
9
  .constraints-container {
@@ -10,12 +11,11 @@
10
11
  }
11
12
 
12
13
  .constraint {
13
- @extend .px-4;
14
+ padding-inline-end: $spacer;
14
15
  display: block;
15
- text-indent: -1 * map-get($spacers, 3);
16
16
  }
17
17
 
18
- .filter-name, .filter-separator {
19
- @extend .text-muted;
18
+ .filter-name {
19
+ color: var(--bl-history-filter-name-color);
20
20
  }
21
21
  }
@@ -1,10 +1,13 @@
1
1
  // the search results on the index view of the catalog
2
2
  .documents-list {
3
+ --bl-results-document-margin-top: #{$spacer};
4
+ --bl-results-document-padding-top: #{$spacer};
5
+
3
6
  .document {
4
7
  display: flex;
5
8
  border-bottom: 1px dotted $table-border-color;
6
- margin-top: $spacer;
7
- padding-top: $spacer;
9
+ margin-top: var(--bl-results-document-margin-top);
10
+ padding-top: var(--bl-results-document-padding-top);
8
11
 
9
12
  .document-title-heading {
10
13
  @extend h5;
@@ -1,17 +1,23 @@
1
1
  /* Warning! If you want to change these, just copy them into your own theme css. But you want to remove the !default, which only will set them if not already set. */
2
2
 
3
- $logo-image: image_url('blacklight/logo.png') !default;
3
+ $logo-image: image_url("blacklight/logo.png") !default;
4
4
  $logo-width: 150px !default;
5
5
  $logo-height: 50px !default;
6
6
 
7
- /* label (field names) */
8
- $field_name_color: $text-muted !default;
9
-
10
- // the default bootstrap font-family list includes "Segoe UI Emoji", which, on windows
11
- // renders our remove icon as an emoji-sized x instead of what we see on all other platforms...
12
- // so, for now (until we replace it with an SVG icon or something), we get to override bootstrap:
13
- $remove-icon-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif !default;
14
-
15
7
  $facet-active-border: $success !default;
16
8
  $facet-active-bg: $success !default;
17
- $facet-active-item-color: $success !default;
9
+ $facet-active-item-color: $success !default;
10
+
11
+ /* for compatability with BS < 5.3 */
12
+ $body-secondary-color: rgba($body-color, 0.75) !default;
13
+
14
+ :root {
15
+ --bs-secondary-color: #{$body-secondary-color}; /* for compatability with BS < 5.3 */
16
+
17
+ --bl-main-padding-y: 0.5rem;
18
+
19
+ --bl-constraint-remove-hover-bg: #bb2d3b;
20
+ --bl-constraint-remove-hover-border-color: #bb2d3b;
21
+
22
+ --bl-field-name-color: var(--bs-secondary-color);
23
+ }
@@ -37,7 +37,9 @@ export default class CheckboxSubmit {
37
37
  this.labelTarget.removeAttribute('disabled')
38
38
  this.checkboxTarget.removeAttribute('disabled')
39
39
  this.updateStateFor(!this.checked)
40
- document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count
40
+ this.bookmarksCounter().forEach(counter => {
41
+ counter.innerHTML = json.bookmarks.count;
42
+ });
41
43
  }).catch((error) => {
42
44
  this.handleError(error)
43
45
  })
@@ -63,6 +65,10 @@ export default class CheckboxSubmit {
63
65
  return this.form.querySelector('[data-checkboxsubmit-target="span"]')
64
66
  }
65
67
 
68
+ bookmarksCounter() {
69
+ return document.querySelectorAll('[data-role="bookmark-counter"]')
70
+ }
71
+
66
72
  handleError() {
67
73
  alert("Unable to save the bookmark at this time.")
68
74
  }
@@ -1,4 +1,4 @@
1
- const Blacklight = function() {
1
+ const Core = function() {
2
2
  const buffer = new Array;
3
3
  return {
4
4
  onLoad: function(func) {
@@ -34,13 +34,13 @@ const Blacklight = function() {
34
34
 
35
35
  // turbolinks triggers page:load events on page transition
36
36
  // If app isn't using turbolinks, this event will never be triggered, no prob.
37
- Blacklight.listeners().forEach(function(listener) {
37
+ Core.listeners().forEach(function(listener) {
38
38
  document.addEventListener(listener, function() {
39
- Blacklight.activate()
39
+ Core.activate()
40
40
  })
41
41
  })
42
42
 
43
- Blacklight.onLoad(function () {
43
+ Core.onLoad(function () {
44
44
  const elem = document.querySelector('.no-js');
45
45
 
46
46
  // The "no-js" class may already have been removed because this function is
@@ -52,4 +52,4 @@ Blacklight.onLoad(function () {
52
52
  })
53
53
 
54
54
 
55
- export default Blacklight
55
+ export default Core
@@ -91,7 +91,7 @@ const Modal = (() => {
91
91
  <pre>${this.url}\n${error}</pre>
92
92
  </div>`
93
93
 
94
- document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents
94
+ modal.target().querySelector('.modal-content').innerHTML = contents
95
95
 
96
96
  modal.show();
97
97
  }
@@ -112,7 +112,14 @@ const Modal = (() => {
112
112
  elements.forEach((el) => frag.appendChild(el))
113
113
  modal.activateScripts(frag)
114
114
 
115
- document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(frag)
115
+ modal.target().querySelector('.modal-content').replaceChildren(frag)
116
+
117
+ // send custom event with the modal dialog div as the target
118
+ var e = new CustomEvent('loaded.blacklight.blacklight-modal', { bubbles: true, cancelable: true });
119
+ modal.target().dispatchEvent(e)
120
+
121
+ // if they did preventDefault, don't show the dialog
122
+ if (e.defaultPrevented) return;
116
123
 
117
124
  modal.show();
118
125
  };
@@ -154,19 +161,31 @@ const Modal = (() => {
154
161
  };
155
162
 
156
163
  modal.hide = function (el) {
157
- const dom = document.querySelector(modal.modalSelector)
164
+ const dom = modal.target();
158
165
 
159
166
  if (!dom.open) return
167
+
168
+ var e = new CustomEvent('hide.blacklight.blacklight-modal', { bubbles: true, cancelable: true });
169
+ dom.dispatchEvent(e)
170
+
160
171
  dom.close()
161
172
  }
162
173
 
163
174
  modal.show = function(el) {
164
- const dom = document.querySelector(modal.modalSelector)
175
+ const dom = modal.target();
165
176
 
166
177
  if (dom.open) return
178
+
179
+ var e = new CustomEvent('show.blacklight.blacklight-modal', { bubbles: true, cancelable: true });
180
+ dom.dispatchEvent(e)
181
+
167
182
  dom.showModal()
168
183
  }
169
184
 
185
+ modal.target = function() {
186
+ return document.querySelector(modal.modalSelector);
187
+ }
188
+
170
189
  modal.setupModal()
171
190
 
172
191
  return modal;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "blacklight-frontend",
3
- "version": "8.3.0",
3
+ "version": "8.6.1",
4
4
  "description": "The frontend code and styles for Blacklight",
5
5
  "main": "app/assets/javascripts/blacklight",
6
+ "type": "module",
6
7
  "module": "app/assets/javascripts/blacklight/blacklight.esm.js",
7
8
  "scripts": {
8
9
  "prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
@@ -22,7 +23,7 @@
22
23
  },
23
24
  "homepage": "https://github.com/projectblacklight/blacklight#readme",
24
25
  "devDependencies": {
25
- "rollup": "^2.60.0",
26
+ "rollup": "^4.24.0",
26
27
  "rollup-plugin-includepaths": "^0.2.4"
27
28
  },
28
29
  "browserslist": [