@coreui/coreui 5.6.1 → 5.7.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.
- package/README.md +3 -4
- package/dist/css/coreui-grid.css +1 -1
- package/dist/css/coreui-grid.css.map +1 -1
- package/dist/css/coreui-grid.min.css +1 -1
- package/dist/css/coreui-grid.min.css.map +1 -1
- package/dist/css/coreui-grid.rtl.css +1 -1
- package/dist/css/coreui-grid.rtl.css.map +1 -1
- package/dist/css/coreui-grid.rtl.min.css +1 -1
- package/dist/css/coreui-grid.rtl.min.css.map +1 -1
- package/dist/css/coreui-reboot.css +5 -3
- package/dist/css/coreui-reboot.css.map +1 -1
- package/dist/css/coreui-reboot.min.css +2 -2
- package/dist/css/coreui-reboot.min.css.map +1 -1
- package/dist/css/coreui-reboot.rtl.css +5 -3
- package/dist/css/coreui-reboot.rtl.css.map +1 -1
- package/dist/css/coreui-reboot.rtl.min.css +2 -2
- package/dist/css/coreui-reboot.rtl.min.css.map +1 -1
- package/dist/css/coreui-utilities.css +5 -3
- package/dist/css/coreui-utilities.css.map +1 -1
- package/dist/css/coreui-utilities.min.css +2 -2
- package/dist/css/coreui-utilities.min.css.map +1 -1
- package/dist/css/coreui-utilities.rtl.css +5 -3
- package/dist/css/coreui-utilities.rtl.css.map +1 -1
- package/dist/css/coreui-utilities.rtl.min.css +2 -2
- package/dist/css/coreui-utilities.rtl.min.css.map +1 -1
- package/dist/css/coreui.css +173 -67
- package/dist/css/coreui.css.map +1 -1
- package/dist/css/coreui.min.css +2 -2
- package/dist/css/coreui.min.css.map +1 -1
- package/dist/css/coreui.rtl.css +168 -65
- package/dist/css/coreui.rtl.css.map +1 -1
- package/dist/css/coreui.rtl.min.css +2 -2
- package/dist/css/coreui.rtl.min.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.css +173 -67
- package/dist/css/themes/bootstrap/bootstrap.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.min.css +2 -2
- package/dist/css/themes/bootstrap/bootstrap.min.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.rtl.css +168 -65
- package/dist/css/themes/bootstrap/bootstrap.rtl.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.rtl.min.css +2 -2
- package/dist/css/themes/bootstrap/bootstrap.rtl.min.css.map +1 -1
- package/dist/js/bootstrap.bundle.js +578 -259
- package/dist/js/bootstrap.bundle.js.map +1 -1
- package/dist/js/bootstrap.bundle.min.js +2 -2
- package/dist/js/bootstrap.bundle.min.js.map +1 -1
- package/dist/js/bootstrap.esm.js +578 -260
- package/dist/js/bootstrap.esm.js.map +1 -1
- package/dist/js/bootstrap.esm.min.js +2 -2
- package/dist/js/bootstrap.esm.min.js.map +1 -1
- package/dist/js/bootstrap.js +578 -259
- package/dist/js/bootstrap.js.map +1 -1
- package/dist/js/bootstrap.min.js +2 -2
- package/dist/js/bootstrap.min.js.map +1 -1
- package/dist/js/coreui.bundle.js +578 -259
- package/dist/js/coreui.bundle.js.map +1 -1
- package/dist/js/coreui.bundle.min.js +2 -2
- package/dist/js/coreui.bundle.min.js.map +1 -1
- package/dist/js/coreui.esm.js +578 -260
- package/dist/js/coreui.esm.js.map +1 -1
- package/dist/js/coreui.esm.min.js +2 -2
- package/dist/js/coreui.esm.min.js.map +1 -1
- package/dist/js/coreui.js +578 -259
- package/dist/js/coreui.js.map +1 -1
- package/dist/js/coreui.min.js +2 -2
- package/dist/js/coreui.min.js.map +1 -1
- package/js/dist/alert.js +1 -1
- package/js/dist/base-component.js +2 -2
- package/js/dist/base-component.js.map +1 -1
- package/js/dist/button.js +1 -1
- package/js/dist/carousel.js +1 -1
- package/js/dist/chip-input.js +1 -1
- package/js/dist/chip.js +1 -1
- package/js/dist/collapse.js +1 -1
- package/js/dist/dom/data.js +1 -1
- package/js/dist/dom/event-handler.js +1 -1
- package/js/dist/dom/manipulator.js +1 -1
- package/js/dist/dom/selector-engine.js +1 -1
- package/js/dist/dropdown.js +1 -1
- package/js/dist/modal.js +1 -1
- package/js/dist/navigation.js +2 -2
- package/js/dist/navigation.js.map +1 -1
- package/js/dist/offcanvas.js +1 -1
- package/js/dist/popover.js +1 -1
- package/js/dist/scrollspy.js +1 -1
- package/js/dist/search-button.js +336 -0
- package/js/dist/search-button.js.map +1 -0
- package/js/dist/sidebar.js +7 -10
- package/js/dist/sidebar.js.map +1 -1
- package/js/dist/tab.js +1 -1
- package/js/dist/toast.js +1 -1
- package/js/dist/tooltip.js +1 -1
- package/js/dist/util/backdrop.js +1 -1
- package/js/dist/util/component-functions.js +1 -1
- package/js/dist/util/config.js +1 -1
- package/js/dist/util/focustrap.js +1 -1
- package/js/dist/util/index.js +1 -1
- package/js/dist/util/sanitizer.js +1 -1
- package/js/dist/util/scrollbar.js +1 -1
- package/js/dist/util/swipe.js +1 -1
- package/js/dist/util/template-factory.js +1 -1
- package/js/index.esm.js +1 -0
- package/js/index.umd.js +2 -0
- package/js/src/base-component.js +1 -1
- package/js/src/navigation.js +1 -1
- package/js/src/search-button.js +409 -0
- package/js/src/sidebar.js +6 -10
- package/package.json +15 -14
- package/scss/_banner.scss +1 -1
- package/scss/_root.scss +3 -0
- package/scss/_search-button.scss +127 -0
- package/scss/_variables-dark.scss +2 -1
- package/scss/_variables.scss +12 -4
- package/scss/coreui.scss +1 -0
- package/scss/functions/_color-translucent.scss +33 -0
- package/scss/functions/_contrast-ratio.scss +3 -3
- package/scss/sidebar/_sidebar-narrow.scss +21 -13
- package/scss/sidebar/_sidebar-nav.scss +66 -44
- package/scss/sidebar/_sidebar.scss +1 -6
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI search-button.js
|
|
4
|
+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import BaseComponent from './base-component.js'
|
|
9
|
+
import EventHandler from './dom/event-handler.js'
|
|
10
|
+
import { defineJQueryPlugin } from './util/index.js'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Constants
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const NAME = 'search-button'
|
|
17
|
+
const DATA_KEY = 'coreui.search-button'
|
|
18
|
+
const EVENT_KEY = `.${DATA_KEY}`
|
|
19
|
+
const DATA_API_KEY = '.data-api'
|
|
20
|
+
|
|
21
|
+
const EVENT_BLUR_DATA_API = `blur${EVENT_KEY}${DATA_API_KEY}`
|
|
22
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
|
23
|
+
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`
|
|
24
|
+
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`
|
|
25
|
+
const EVENT_TRIGGER = `trigger${EVENT_KEY}`
|
|
26
|
+
|
|
27
|
+
const CLASS_NAME_SHORTCUT_KEYS = 'search-button-keys'
|
|
28
|
+
const CLASS_NAME_SHORTCUT_KEY = 'search-button-key'
|
|
29
|
+
const CLASS_NAME_ACTIVE = 'active'
|
|
30
|
+
|
|
31
|
+
const SELECTOR_DATA_TOGGLE = '[data-coreui-search-button]'
|
|
32
|
+
const SELECTOR_EDITABLE_TARGET = 'input, textarea, select, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]'
|
|
33
|
+
const SELECTOR_PLACEHOLDER = '.search-button-placeholder'
|
|
34
|
+
const SELECTOR_SHORTCUT_KEY = '.search-button-key'
|
|
35
|
+
const SELECTOR_SHORTCUT_KEYS = '.search-button-keys'
|
|
36
|
+
|
|
37
|
+
const Default = {
|
|
38
|
+
preventDefault: true,
|
|
39
|
+
shortcut: 'meta+/,ctrl+/'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const DefaultType = {
|
|
43
|
+
preventDefault: 'boolean',
|
|
44
|
+
shortcut: 'string'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const MODIFIER_KEYS = new Set(['alt', 'ctrl', 'meta', 'shift'])
|
|
48
|
+
|
|
49
|
+
const KEY_ALIASES = {
|
|
50
|
+
cmd: 'meta',
|
|
51
|
+
command: 'meta',
|
|
52
|
+
control: 'ctrl',
|
|
53
|
+
option: 'alt',
|
|
54
|
+
return: 'enter',
|
|
55
|
+
esc: 'escape',
|
|
56
|
+
spacebar: 'space',
|
|
57
|
+
' ': 'space'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const KEY_LABELS = {
|
|
61
|
+
alt: 'Alt',
|
|
62
|
+
ctrl: 'Ctrl',
|
|
63
|
+
meta: '⌘',
|
|
64
|
+
shift: 'Shift',
|
|
65
|
+
space: 'Space'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Class definition
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
class SearchButton extends BaseComponent {
|
|
73
|
+
constructor(element, config) {
|
|
74
|
+
super(element, config)
|
|
75
|
+
|
|
76
|
+
this._shortcutTriggered = false
|
|
77
|
+
this._shortcuts = this._parseShortcut(this._config.shortcut)
|
|
78
|
+
this._preferredShortcut = this._getPreferredShortcut(this._shortcuts)
|
|
79
|
+
this._syncShortcutKeys()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Getters
|
|
83
|
+
static get Default() {
|
|
84
|
+
return Default
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static get DefaultType() {
|
|
88
|
+
return DefaultType
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static get NAME() {
|
|
92
|
+
return NAME
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Public
|
|
96
|
+
trigger() {
|
|
97
|
+
this._triggerEvent('api')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Private
|
|
101
|
+
_triggerEvent(trigger) {
|
|
102
|
+
if (this._isDisabled()) {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
EventHandler.trigger(this._element, EVENT_TRIGGER, { trigger })
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
_handleShortcut(event) {
|
|
110
|
+
if (this._isDisabled() || event.defaultPrevented || event.repeat || this._shouldIgnoreShortcut(event)) {
|
|
111
|
+
return false
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const matchedShortcut = this._shortcuts.find(shortcut => this._matchesShortcut(shortcut, event))
|
|
115
|
+
|
|
116
|
+
if (!matchedShortcut) {
|
|
117
|
+
return false
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (this._config.preventDefault) {
|
|
121
|
+
event.preventDefault()
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
this._shortcutTriggered = true
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
this._element.click()
|
|
128
|
+
} finally {
|
|
129
|
+
this._shortcutTriggered = false
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return true
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
_isDisabled() {
|
|
136
|
+
return this._element.classList.contains('disabled') ||
|
|
137
|
+
this._element.getAttribute('aria-disabled') === 'true' ||
|
|
138
|
+
this._element.disabled
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_ensureShortcutKeys() {
|
|
142
|
+
const existingShortcutKeys = this._element.querySelector(SELECTOR_SHORTCUT_KEYS)
|
|
143
|
+
|
|
144
|
+
if (existingShortcutKeys) {
|
|
145
|
+
return existingShortcutKeys
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const shortcutKeys = document.createElement('span')
|
|
149
|
+
shortcutKeys.className = CLASS_NAME_SHORTCUT_KEYS
|
|
150
|
+
shortcutKeys.setAttribute('aria-hidden', 'true')
|
|
151
|
+
const placeholder = this._element.querySelector(SELECTOR_PLACEHOLDER)
|
|
152
|
+
|
|
153
|
+
if (placeholder) {
|
|
154
|
+
placeholder.after(shortcutKeys)
|
|
155
|
+
return shortcutKeys
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
this._element.append(shortcutKeys)
|
|
159
|
+
return shortcutKeys
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
_syncShortcutKeys() {
|
|
163
|
+
const shortcutKeys = this._ensureShortcutKeys()
|
|
164
|
+
const shortcutTokens = this._formatShortcutTokens(this._preferredShortcut?.shortcut || '')
|
|
165
|
+
.filter(Boolean)
|
|
166
|
+
|
|
167
|
+
shortcutKeys.replaceChildren()
|
|
168
|
+
|
|
169
|
+
for (const key of shortcutTokens) {
|
|
170
|
+
const shortcutKey = document.createElement('span')
|
|
171
|
+
shortcutKey.className = CLASS_NAME_SHORTCUT_KEY
|
|
172
|
+
shortcutKey.textContent = key
|
|
173
|
+
shortcutKey.dataset.coreuiSearchButtonKey = key
|
|
174
|
+
shortcutKeys.append(shortcutKey)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
_syncActiveKeys(event) {
|
|
179
|
+
const pressedKeys = this._getPressedKeys(event)
|
|
180
|
+
|
|
181
|
+
for (const shortcutKey of this._element.querySelectorAll(SELECTOR_SHORTCUT_KEY)) {
|
|
182
|
+
shortcutKey.classList.toggle(CLASS_NAME_ACTIVE, pressedKeys.has(shortcutKey.dataset.coreuiSearchButtonKey))
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
_clearActiveKeys() {
|
|
187
|
+
for (const shortcutKey of this._element.querySelectorAll(SELECTOR_SHORTCUT_KEY)) {
|
|
188
|
+
shortcutKey.classList.remove(CLASS_NAME_ACTIVE)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
_consumeShortcutTrigger() {
|
|
193
|
+
const shortcutTriggered = this._shortcutTriggered
|
|
194
|
+
this._shortcutTriggered = false
|
|
195
|
+
return shortcutTriggered
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
_shouldIgnoreShortcut(event) {
|
|
199
|
+
return this._isEditableTarget(event.target) && !event.ctrlKey && !event.metaKey
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
_isEditableTarget(target) {
|
|
203
|
+
if (!(target instanceof Element)) {
|
|
204
|
+
return false
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return target.matches(SELECTOR_EDITABLE_TARGET) || target.closest(SELECTOR_EDITABLE_TARGET)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
_normalizeKey(key) {
|
|
211
|
+
return KEY_ALIASES[key.toLowerCase()] || key.toLowerCase()
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
_parseShortcut(shortcut) {
|
|
215
|
+
return shortcut
|
|
216
|
+
.split(',')
|
|
217
|
+
.map(value => value.trim())
|
|
218
|
+
.filter(Boolean)
|
|
219
|
+
.map(value => {
|
|
220
|
+
const keys = value.split('+').map(part => this._normalizeKey(part.trim()))
|
|
221
|
+
const modifiers = {
|
|
222
|
+
alt: false,
|
|
223
|
+
ctrl: false,
|
|
224
|
+
meta: false,
|
|
225
|
+
shift: false
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let key = ''
|
|
229
|
+
|
|
230
|
+
for (const part of keys) {
|
|
231
|
+
if (MODIFIER_KEYS.has(part)) {
|
|
232
|
+
modifiers[part] = true
|
|
233
|
+
continue
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
key = part
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
key,
|
|
241
|
+
modifiers,
|
|
242
|
+
shortcut: value
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
_matchesShortcut(shortcut, event) {
|
|
248
|
+
if (!shortcut.key || this._normalizeKey(event.key) !== shortcut.key) {
|
|
249
|
+
return false
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return shortcut.modifiers.alt === event.altKey &&
|
|
253
|
+
shortcut.modifiers.ctrl === event.ctrlKey &&
|
|
254
|
+
shortcut.modifiers.meta === event.metaKey &&
|
|
255
|
+
shortcut.modifiers.shift === event.shiftKey
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
_formatShortcutTokens(shortcut) {
|
|
259
|
+
return shortcut
|
|
260
|
+
.split('+')
|
|
261
|
+
.map(part => this._normalizeKey(part.trim()))
|
|
262
|
+
.map(part => this._getKeyLabel(part))
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
_getPlatform() {
|
|
266
|
+
return window.navigator.userAgentData?.platform ||
|
|
267
|
+
window.navigator.platform ||
|
|
268
|
+
window.navigator.userAgent ||
|
|
269
|
+
''
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
_isMacOS() {
|
|
273
|
+
return /Mac|iPhone|iPad|iPod|macOS|Macintosh/.test(this._getPlatform())
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
_getPreferredShortcut(shortcuts) {
|
|
277
|
+
return shortcuts.find(shortcut => {
|
|
278
|
+
return this._isMacOS() ? shortcut.modifiers.meta : shortcut.modifiers.ctrl
|
|
279
|
+
}) || shortcuts[0] || null
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
_getPressedKeys(event) {
|
|
283
|
+
const pressedKeys = new Set()
|
|
284
|
+
|
|
285
|
+
if (event.altKey) {
|
|
286
|
+
pressedKeys.add(KEY_LABELS.alt)
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (event.ctrlKey) {
|
|
290
|
+
pressedKeys.add(KEY_LABELS.ctrl)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (event.metaKey) {
|
|
294
|
+
pressedKeys.add(KEY_LABELS.meta)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (event.shiftKey) {
|
|
298
|
+
pressedKeys.add(KEY_LABELS.shift)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const normalizedKey = this._normalizeKey(event.key)
|
|
302
|
+
const keyLabel = this._getKeyLabel(normalizedKey)
|
|
303
|
+
|
|
304
|
+
if (!MODIFIER_KEYS.has(normalizedKey) && event.type === 'keydown') {
|
|
305
|
+
pressedKeys.add(keyLabel)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return pressedKeys
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
_getKeyLabel(key) {
|
|
312
|
+
return KEY_LABELS[key] || (key.length === 1 ? key.toUpperCase() : `${key.charAt(0).toUpperCase()}${key.slice(1)}`)
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Static
|
|
316
|
+
static searchButtonInterface(element, config) {
|
|
317
|
+
const data = SearchButton.getOrCreateInstance(element, config)
|
|
318
|
+
|
|
319
|
+
if (typeof config === 'string') {
|
|
320
|
+
if (config.startsWith('_') || typeof data[config] !== 'function') {
|
|
321
|
+
throw new TypeError(`No method named "${config}"`)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
data[config]()
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
static jQueryInterface(config) {
|
|
329
|
+
return this.each(function () {
|
|
330
|
+
SearchButton.searchButtonInterface(this, config)
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
static _initializeDataApi() {
|
|
335
|
+
for (const button of document.querySelectorAll(SELECTOR_DATA_TOGGLE)) {
|
|
336
|
+
SearchButton.getOrCreateInstance(button)
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
static _handleDataApiClick(event) {
|
|
341
|
+
event.preventDefault()
|
|
342
|
+
|
|
343
|
+
const button = event.target.closest(SELECTOR_DATA_TOGGLE)
|
|
344
|
+
const data = SearchButton.getOrCreateInstance(button)
|
|
345
|
+
const shortcutTriggered = data._consumeShortcutTrigger()
|
|
346
|
+
|
|
347
|
+
if (shortcutTriggered) {
|
|
348
|
+
data._triggerEvent('shortcut')
|
|
349
|
+
return
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
data._triggerEvent('click')
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
static _handleDataApiKeydown(event) {
|
|
356
|
+
for (const button of document.querySelectorAll(SELECTOR_DATA_TOGGLE)) {
|
|
357
|
+
const data = SearchButton.getOrCreateInstance(button)
|
|
358
|
+
data._syncActiveKeys(event)
|
|
359
|
+
|
|
360
|
+
if (data._handleShortcut(event)) {
|
|
361
|
+
break
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
static _handleDataApiKeyup(event) {
|
|
367
|
+
for (const button of document.querySelectorAll(SELECTOR_DATA_TOGGLE)) {
|
|
368
|
+
SearchButton.getOrCreateInstance(button)._syncActiveKeys(event)
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
static _handleDataApiBlur() {
|
|
373
|
+
for (const button of document.querySelectorAll(SELECTOR_DATA_TOGGLE)) {
|
|
374
|
+
SearchButton.getOrCreateInstance(button)._clearActiveKeys()
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Data API implementation
|
|
381
|
+
*/
|
|
382
|
+
|
|
383
|
+
EventHandler.on(document, `DOMContentLoaded${EVENT_KEY}${DATA_API_KEY}`, () => {
|
|
384
|
+
SearchButton._initializeDataApi()
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
|
|
388
|
+
SearchButton._handleDataApiClick(event)
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, event => {
|
|
392
|
+
SearchButton._handleDataApiKeydown(event)
|
|
393
|
+
})
|
|
394
|
+
|
|
395
|
+
EventHandler.on(document, EVENT_KEYUP_DATA_API, event => {
|
|
396
|
+
SearchButton._handleDataApiKeyup(event)
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
EventHandler.on(window, EVENT_BLUR_DATA_API, () => {
|
|
400
|
+
SearchButton._handleDataApiBlur()
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* jQuery
|
|
405
|
+
*/
|
|
406
|
+
|
|
407
|
+
defineJQueryPlugin(SearchButton)
|
|
408
|
+
|
|
409
|
+
export default SearchButton
|
package/js/src/sidebar.js
CHANGED
|
@@ -155,14 +155,14 @@ class Sidebar extends BaseComponent {
|
|
|
155
155
|
|
|
156
156
|
narrow() {
|
|
157
157
|
if (!this._isMobile()) {
|
|
158
|
-
this.
|
|
158
|
+
this._element.classList.add(CLASS_NAME_SIDEBAR_NARROW)
|
|
159
159
|
this._narrow = true
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
unfoldable() {
|
|
164
164
|
if (!this._isMobile()) {
|
|
165
|
-
this.
|
|
165
|
+
this._element.classList.add(CLASS_NAME_SIDEBAR_NARROW_UNFOLDABLE)
|
|
166
166
|
this._unfoldable = true
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -234,21 +234,17 @@ class Sidebar extends BaseComponent {
|
|
|
234
234
|
)
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
|
|
238
|
-
this._element.classList.add(className)
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
_clickOutListener(event, sidebar) {
|
|
237
|
+
_clickOutListener(event) {
|
|
242
238
|
if (event.target.closest(SELECTOR_SIDEBAR) === null) {
|
|
243
239
|
event.preventDefault()
|
|
244
240
|
event.stopPropagation()
|
|
245
|
-
|
|
241
|
+
this.hide()
|
|
246
242
|
}
|
|
247
243
|
}
|
|
248
244
|
|
|
249
245
|
_addClickOutListener() {
|
|
250
246
|
EventHandler.on(document, EVENT_CLICK_DATA_API, event => {
|
|
251
|
-
this._clickOutListener(event
|
|
247
|
+
this._clickOutListener(event)
|
|
252
248
|
})
|
|
253
249
|
}
|
|
254
250
|
|
|
@@ -268,7 +264,7 @@ class Sidebar extends BaseComponent {
|
|
|
268
264
|
|
|
269
265
|
EventHandler.on(this._element, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
|
|
270
266
|
event.preventDefault()
|
|
271
|
-
const toggle = Manipulator.getDataAttribute(event.target, 'toggle')
|
|
267
|
+
const toggle = Manipulator.getDataAttribute(event.target.closest(SELECTOR_DATA_TOGGLE), 'toggle')
|
|
272
268
|
|
|
273
269
|
if (toggle === 'narrow') {
|
|
274
270
|
this.toggleNarrow()
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/coreui",
|
|
3
3
|
"description": "The most popular front-end framework for developing responsive, mobile-first projects on the web rewritten and maintained by the CoreUI Team",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.7.1",
|
|
5
5
|
"config": {
|
|
6
|
-
"version_short": "5.
|
|
6
|
+
"version_short": "5.7"
|
|
7
7
|
},
|
|
8
8
|
"keywords": [
|
|
9
9
|
"css",
|
|
@@ -102,9 +102,10 @@
|
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@babel/cli": "^7.28.6",
|
|
104
104
|
"@babel/core": "^7.29.0",
|
|
105
|
-
"@babel/preset-env": "^7.29.
|
|
106
|
-
"@
|
|
107
|
-
"@docsearch/
|
|
105
|
+
"@babel/preset-env": "^7.29.5",
|
|
106
|
+
"@coreui/internal-links": "^5.1.0",
|
|
107
|
+
"@docsearch/css": "^4.6.3",
|
|
108
|
+
"@docsearch/js": "^4.6.3",
|
|
108
109
|
"@eslint/markdown": "^7.5.1",
|
|
109
110
|
"@popperjs/core": "^2.11.8",
|
|
110
111
|
"@rollup/plugin-babel": "^7.0.0",
|
|
@@ -112,20 +113,20 @@
|
|
|
112
113
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
113
114
|
"@rollup/plugin-replace": "^6.0.3",
|
|
114
115
|
"@stackblitz/sdk": "^1.11.0",
|
|
115
|
-
"autoprefixer": "^10.
|
|
116
|
+
"autoprefixer": "^10.5.0",
|
|
116
117
|
"bootstrap": "^5.3.8",
|
|
117
|
-
"bundlewatch": "^0.4.
|
|
118
|
+
"bundlewatch": "^0.4.2",
|
|
118
119
|
"clean-css-cli": "^5.6.3",
|
|
119
120
|
"clipboard": "^2.0.11",
|
|
120
121
|
"cross-env": "^10.1.0",
|
|
121
|
-
"eslint": "^9.39.
|
|
122
|
+
"eslint": "^9.39.4",
|
|
122
123
|
"eslint-config-xo": "0.49.0",
|
|
123
124
|
"eslint-plugin-html": "^8.1.4",
|
|
124
125
|
"eslint-plugin-import": "^2.32.0",
|
|
125
126
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
126
|
-
"find-unused-sass-variables": "^6.
|
|
127
|
+
"find-unused-sass-variables": "^6.2.0",
|
|
127
128
|
"globals": "^16.5.0",
|
|
128
|
-
"globby": "^16.
|
|
129
|
+
"globby": "^16.2.0",
|
|
129
130
|
"hammer-simulator": "0.0.1",
|
|
130
131
|
"html-entities": "^2.6.0",
|
|
131
132
|
"hugo-bin": "^0.149.2",
|
|
@@ -144,18 +145,18 @@
|
|
|
144
145
|
"lockfile-lint": "^5.0.0",
|
|
145
146
|
"nodemon": "^3.1.14",
|
|
146
147
|
"npm-run-all": "^4.1.5",
|
|
147
|
-
"postcss": "^8.5.
|
|
148
|
+
"postcss": "^8.5.14",
|
|
148
149
|
"postcss-cli": "^11.0.1",
|
|
149
150
|
"postcss-combine-duplicated-selectors": "^10.0.3",
|
|
150
151
|
"rimraf": "^6.1.3",
|
|
151
|
-
"rollup": "^4.
|
|
152
|
+
"rollup": "^4.60.4",
|
|
152
153
|
"rollup-plugin-istanbul": "^5.0.0",
|
|
153
|
-
"sass-embedded": "^1.
|
|
154
|
+
"sass-embedded": "^1.99.0",
|
|
154
155
|
"sass-true": "^10.1.0",
|
|
155
156
|
"shelljs": "^0.10.0",
|
|
156
157
|
"stylelint": "^16.26.1",
|
|
157
158
|
"stylelint-config-twbs-bootstrap": "^16.1.0",
|
|
158
|
-
"terser": "5.
|
|
159
|
+
"terser": "5.47.1",
|
|
159
160
|
"vnu-jar": "25.12.31"
|
|
160
161
|
},
|
|
161
162
|
"files": [
|
package/scss/_banner.scss
CHANGED
package/scss/_root.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "sass:meta";
|
|
2
2
|
@use "functions/color" as *;
|
|
3
|
+
@use "functions/color-translucent" as *;
|
|
3
4
|
@use "functions/to-rgb" as *;
|
|
4
5
|
@use "mixins/color-mode" as *;
|
|
5
6
|
@use "vendor/rfs" as *;
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
--#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color)};
|
|
89
90
|
--#{$prefix}tertiary-bg: #{$body-tertiary-bg};
|
|
90
91
|
--#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg)};
|
|
92
|
+
--#{$prefix}tertiary-bg-translucent: #{color-translucent($body-tertiary-bg)};
|
|
91
93
|
|
|
92
94
|
--#{$prefix}body-color-dark: #{$body-color-dark};
|
|
93
95
|
--#{$prefix}body-color-rgb-dark: #{to-rgb($body-color-dark)};
|
|
@@ -191,6 +193,7 @@
|
|
|
191
193
|
--#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color-dark)};
|
|
192
194
|
--#{$prefix}tertiary-bg: #{$body-tertiary-bg-dark};
|
|
193
195
|
--#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg-dark)};
|
|
196
|
+
--#{$prefix}tertiary-bg-translucent: #{color-translucent($body-tertiary-bg-dark, .1, $body-bg-dark)};
|
|
194
197
|
|
|
195
198
|
--#{$prefix}high-emphasis: #{$high-emphasis-dark}; // Deprecated in v5.0.0
|
|
196
199
|
--#{$prefix}medium-emphasis: #{$medium-emphasis-dark}; // Deprecated in v5.0.0
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
@use "mixins/border-radius" as *;
|
|
3
|
+
@use "mixins/box-shadow" as *;
|
|
4
|
+
@use "mixins/transition" as *;
|
|
5
|
+
@use "vendor/rfs" as *;
|
|
6
|
+
|
|
7
|
+
// scss-docs-start search-button-variables
|
|
8
|
+
$search-button-height: $input-height !default;
|
|
9
|
+
$search-button-padding-x: $input-padding-x !default;
|
|
10
|
+
$search-button-font-family: $input-font-family !default;
|
|
11
|
+
$search-button-font-size: $input-font-size !default;
|
|
12
|
+
$search-button-font-weight: $input-font-weight !default;
|
|
13
|
+
$search-button-color: $input-placeholder-color !default;
|
|
14
|
+
$search-button-bg: $input-bg !default;
|
|
15
|
+
$search-button-border-width: $input-border-width !default;
|
|
16
|
+
$search-button-border-color: $input-border-color !default;
|
|
17
|
+
$search-button-border-radius: $input-border-radius !default;
|
|
18
|
+
$search-button-box-shadow: $input-box-shadow !default;
|
|
19
|
+
$search-button-transition: $input-transition !default;
|
|
20
|
+
|
|
21
|
+
$search-button-focus-color: $input-focus-color !default;
|
|
22
|
+
$search-button-focus-bg: $input-focus-bg !default;
|
|
23
|
+
$search-button-focus-border-color: $input-focus-border-color !default;
|
|
24
|
+
$search-button-focus-box-shadow: $input-focus-box-shadow !default;
|
|
25
|
+
|
|
26
|
+
$search-button-icon-size: 1.125rem !default;
|
|
27
|
+
|
|
28
|
+
$search-button-keys-gap: .25rem !default;
|
|
29
|
+
$search-button-key-width: 1.5rem !default;
|
|
30
|
+
$search-button-key-height: 1.5rem !default;
|
|
31
|
+
$search-button-key-padding-inline: .25rem !default;
|
|
32
|
+
$search-button-key-font-size: .75rem !default;
|
|
33
|
+
$search-button-key-bg: var(--#{$prefix}tertiary-bg) !default;
|
|
34
|
+
$search-button-key-border-radius: var(--#{$prefix}border-radius-sm) !default;
|
|
35
|
+
$search-button-key-active-bg: var(--#{$prefix}secondary-bg) !default;
|
|
36
|
+
|
|
37
|
+
$search-button-placeholder-margin-inline: .55rem 2rem !default;
|
|
38
|
+
// scss-docs-end search-button-variables
|
|
39
|
+
|
|
40
|
+
.search-button {
|
|
41
|
+
// scss-docs-start search-button-css-vars
|
|
42
|
+
--#{$prefix}search-button-height: #{$search-button-height};
|
|
43
|
+
--#{$prefix}search-button-padding-x: #{$search-button-padding-x};
|
|
44
|
+
--#{$prefix}search-button-font-family: #{$search-button-font-family};
|
|
45
|
+
--#{$prefix}search-button-font-size: #{$search-button-font-size};
|
|
46
|
+
--#{$prefix}search-button-font-weight: #{$search-button-font-weight};
|
|
47
|
+
--#{$prefix}search-button-color: #{$search-button-color};
|
|
48
|
+
--#{$prefix}search-button-bg: #{$search-button-bg};
|
|
49
|
+
--#{$prefix}search-button-border-width: #{$search-button-border-width};
|
|
50
|
+
--#{$prefix}search-button-border-color: #{$search-button-border-color};
|
|
51
|
+
--#{$prefix}search-button-border-radius: #{$search-button-border-radius};
|
|
52
|
+
--#{$prefix}search-button-box-shadow: #{$search-button-box-shadow};
|
|
53
|
+
--#{$prefix}search-button-transition: #{$search-button-transition};
|
|
54
|
+
--#{$prefix}search-button-focus-color: #{$search-button-focus-color};
|
|
55
|
+
--#{$prefix}search-button-focus-bg: #{$search-button-focus-bg};
|
|
56
|
+
--#{$prefix}search-button-focus-border-color: #{$search-button-focus-border-color};
|
|
57
|
+
--#{$prefix}search-button-focus-box-shadow: #{$search-button-focus-box-shadow};
|
|
58
|
+
--#{$prefix}search-button-icon-size: #{$search-button-icon-size};
|
|
59
|
+
--#{$prefix}search-button-keys-gap: #{$search-button-keys-gap};
|
|
60
|
+
--#{$prefix}search-button-key-width: #{$search-button-key-width};
|
|
61
|
+
--#{$prefix}search-button-key-height: #{$search-button-key-height};
|
|
62
|
+
--#{$prefix}search-button-key-padding-inline: #{$search-button-key-padding-inline};
|
|
63
|
+
--#{$prefix}search-button-key-font-size: #{$search-button-key-font-size};
|
|
64
|
+
--#{$prefix}search-button-key-bg: #{$search-button-key-bg};
|
|
65
|
+
--#{$prefix}search-button-key-border-radius: #{$search-button-key-border-radius};
|
|
66
|
+
--#{$prefix}search-button-key-active-bg: #{$search-button-key-active-bg};
|
|
67
|
+
--#{$prefix}search-button-placeholder-margin-inline: #{$search-button-placeholder-margin-inline};
|
|
68
|
+
// scss-docs-end search-button-css-vars
|
|
69
|
+
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
height: var(--#{$prefix}search-button-height);
|
|
73
|
+
padding-inline: var(--#{$prefix}search-button-padding-x);
|
|
74
|
+
font-family: var(--#{$prefix}search-button-font-family);
|
|
75
|
+
@include font-size(var(--#{$prefix}search-button-font-size));
|
|
76
|
+
font-weight: var(--#{$prefix}search-button-font-weight);
|
|
77
|
+
color: var(--#{$prefix}search-button-color);
|
|
78
|
+
background-color: var(--#{$prefix}search-button-bg);
|
|
79
|
+
border: var(--#{$prefix}search-button-border-width) solid var(--#{$prefix}search-button-border-color);
|
|
80
|
+
|
|
81
|
+
@include border-radius(var(--#{$prefix}search-button-border-radius), 0);
|
|
82
|
+
@include box-shadow(var(--#{$prefix}search-button-box-shadow));
|
|
83
|
+
@include transition(var(--#{$prefix}search-button-transition));
|
|
84
|
+
|
|
85
|
+
&:focus {
|
|
86
|
+
color: var(--#{$prefix}search-button-focus-color);
|
|
87
|
+
background-color: var(--#{$prefix}search-button-focus-bg);
|
|
88
|
+
border-color: var(--#{$prefix}search-button-focus-border-color);
|
|
89
|
+
outline: 0;
|
|
90
|
+
@if $enable-shadows {
|
|
91
|
+
@include box-shadow(var(--#{$prefix}search-button-box-shadow), var(--#{$prefix}search-button-focus-box-shadow));
|
|
92
|
+
} @else {
|
|
93
|
+
// Avoid using mixin so we can pass custom focus shadow properly
|
|
94
|
+
box-shadow: var(--#{$prefix}search-button-focus-box-shadow);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.search-button-icon {
|
|
100
|
+
width: var(--#{$prefix}search-button-icon-size);
|
|
101
|
+
height: var(--#{$prefix}search-button-icon-size);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.search-button-keys {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
gap: var(--#{$prefix}search-button-keys-gap);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.search-button-key {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
min-width: var(--#{$prefix}search-button-key-width);
|
|
114
|
+
height: var(--#{$prefix}search-button-key-height);
|
|
115
|
+
padding-inline: var(--#{$prefix}search-button-key-padding-inline);
|
|
116
|
+
font-size: var(--#{$prefix}search-button-key-font-size);
|
|
117
|
+
background-color: var(--#{$prefix}search-button-key-bg);
|
|
118
|
+
@include border-radius(var(--#{$prefix}search-button-key-border-radius));
|
|
119
|
+
|
|
120
|
+
&.active {
|
|
121
|
+
background-color: var(--#{$prefix}search-button-key-active-bg);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.search-button-placeholder {
|
|
126
|
+
margin-inline: var(--#{$prefix}search-button-placeholder-margin-inline);
|
|
127
|
+
}
|