blacklight-frontend 8.11.0 → 9.0.0-beta2
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 +30 -8
- package/app/assets/builds/blacklight.css +452 -0
- package/app/assets/javascripts/blacklight/blacklight.esm.js +6 -76
- package/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- package/app/assets/javascripts/blacklight/blacklight.js +6 -76
- package/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- package/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -4
- package/app/assets/stylesheets/blacklight/_blacklight_base.scss +1 -3
- package/app/assets/stylesheets/blacklight/_bookmark.scss +44 -41
- package/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +0 -25
- package/app/assets/stylesheets/blacklight/_constraints.scss +15 -24
- package/app/assets/stylesheets/blacklight/_controls.scss +2 -18
- package/app/assets/stylesheets/blacklight/_facets.scss +17 -84
- package/app/assets/stylesheets/blacklight/_group.scss +2 -5
- package/app/assets/stylesheets/blacklight/_header.scss +8 -11
- package/app/assets/stylesheets/blacklight/_icons.scss +0 -8
- package/app/assets/stylesheets/blacklight/_modal.scss +1 -1
- package/app/assets/stylesheets/blacklight/_pagination.scss +0 -4
- package/app/assets/stylesheets/blacklight/_search_form.scss +0 -1
- package/app/assets/stylesheets/blacklight/_search_history.scss +0 -8
- package/app/assets/stylesheets/blacklight/_search_results.scss +1 -15
- package/app/assets/stylesheets/blacklight/blacklight_defaults.scss +9 -14
- package/app/assets/stylesheets/blacklight/build.scss +4 -0
- package/app/javascript/{blacklight → blacklight-frontend}/bookmark_toggle.js +1 -1
- package/app/javascript/{blacklight → blacklight-frontend}/checkbox_submit.js +3 -0
- package/app/javascript/{blacklight → blacklight-frontend}/core.js +2 -10
- package/app/javascript/{blacklight → blacklight-frontend}/facet_suggest.js +1 -3
- package/app/javascript/blacklight-frontend/index.js +16 -0
- package/app/javascript/{blacklight → blacklight-frontend}/modal.js +1 -5
- package/package.json +15 -5
- package/app/assets/stylesheets/blacklight/_autocomplete.scss +0 -25
- package/app/assets/stylesheets/blacklight/_mixins.scss +0 -20
- package/app/javascript/blacklight/index.js +0 -18
- package/app/javascript/blacklight/modalForm.js +0 -60
- /package/app/javascript/{blacklight → blacklight-frontend}/button_focus.js +0 -0
- /package/app/javascript/{blacklight → blacklight-frontend}/debounce.js +0 -0
- /package/app/javascript/{blacklight → blacklight-frontend}/search_context.js +0 -0
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// The email and sms forms are displayed inside a modal. When the form is submitted,
|
|
2
|
-
// this script closes the modal and puts the output on the main part of the page.
|
|
3
|
-
// By default it is rendering catalog/sms_success and catalog/email_succcess.
|
|
4
|
-
// These templates deliver a payload of the format used by turbo-streams.
|
|
5
|
-
// See https://turbo.hotwired.dev/handbook/streams
|
|
6
|
-
// That format allows a downstream application to override the template to define
|
|
7
|
-
// multiple customizable areas of the page to get updated.
|
|
8
|
-
export default class {
|
|
9
|
-
constructor(errorHandler, badRequestHandler, hideModal) {
|
|
10
|
-
this.errorHandler = errorHandler
|
|
11
|
-
this.badRequestHandler = badRequestHandler
|
|
12
|
-
this.hideModal = hideModal
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get triggerFormSelector() {
|
|
16
|
-
return 'form[data-blacklight-modal~=trigger]'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
bind() {
|
|
20
|
-
document.addEventListener('submit', (e) => {
|
|
21
|
-
if (e.target.matches(this.triggerFormSelector))
|
|
22
|
-
this.onSubmit(e)
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// This is like a light-weight version of turbo that only supports append presently.
|
|
27
|
-
updateTurboStream(data) {
|
|
28
|
-
this.hideModal()
|
|
29
|
-
const domparser = new DOMParser();
|
|
30
|
-
const dom = domparser.parseFromString(data, "text/html")
|
|
31
|
-
dom.querySelectorAll("turbo-stream[action='append']").forEach((node) => {
|
|
32
|
-
const target = node.getAttribute('target')
|
|
33
|
-
const element = document.getElementById(target)
|
|
34
|
-
if (element)
|
|
35
|
-
element.append(node.querySelector('template').content.cloneNode(true))
|
|
36
|
-
else
|
|
37
|
-
console.error(`Unable to find an element on the page with and ID of "${target}""`)
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onSubmit(e) {
|
|
42
|
-
e.preventDefault();
|
|
43
|
-
const form = e.target
|
|
44
|
-
fetch(form.action, {
|
|
45
|
-
body: new FormData(form),
|
|
46
|
-
headers: { "X-Requested-With": "XMLHttpRequest" }, // Ensures rails will return true when checking request.xhr?
|
|
47
|
-
method: form.method,
|
|
48
|
-
})
|
|
49
|
-
.then(response => {
|
|
50
|
-
if (response.status === 422) {
|
|
51
|
-
return response.text().then(content => this.badRequestHandler(content) )
|
|
52
|
-
}
|
|
53
|
-
if (!response.ok) {
|
|
54
|
-
throw new TypeError("Request failed");
|
|
55
|
-
}
|
|
56
|
-
response.text().then(content => this.updateTurboStream(content))
|
|
57
|
-
})
|
|
58
|
-
.catch(error => this.errorHandler(error))
|
|
59
|
-
}
|
|
60
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|