Skip to content

Commit 3570aac

Browse files
authored
v6: Chips & Badges updates, remove Badges example page (#42400)
* Rename chip-input to chips * More edits * Remove the badges example
1 parent 3f649e3 commit 3570aac

13 files changed

Lines changed: 51 additions & 197 deletions

File tree

js/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export { default as NavOverflow } from './src/nav-overflow.js'
1717
export { default as Drawer } from './src/drawer.js'
1818
export { default as Strength } from './src/strength.js'
1919
export { default as OtpInput } from './src/otp-input.js'
20-
export { default as ChipInput } from './src/chip-input.js'
20+
export { default as Chips } from './src/chips.js'
2121
export { default as Popover } from './src/popover.js'
2222
export { default as ScrollSpy } from './src/scrollspy.js'
2323
export { default as Tab } from './src/tab.js'
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* Bootstrap chip-input.js
3+
* Bootstrap chips.js
44
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
55
* --------------------------------------------------------------------------
66
*/
@@ -13,8 +13,8 @@ import SelectorEngine from './dom/selector-engine.js'
1313
* Constants
1414
*/
1515

16-
const NAME = 'chipInput'
17-
const DATA_KEY = 'bs.chip-input'
16+
const NAME = 'chips'
17+
const DATA_KEY = 'bs.chips'
1818
const EVENT_KEY = `.${DATA_KEY}`
1919
const DATA_API_KEY = '.data-api'
2020

@@ -23,7 +23,7 @@ const EVENT_REMOVE = `remove${EVENT_KEY}`
2323
const EVENT_CHANGE = `change${EVENT_KEY}`
2424
const EVENT_SELECT = `select${EVENT_KEY}`
2525

26-
const SELECTOR_DATA_CHIP_INPUT = '[data-bs-chip-input]'
26+
const SELECTOR_DATA_CHIPS = '[data-bs-chips]'
2727
const SELECTOR_GHOST_INPUT = '.form-ghost'
2828
const SELECTOR_CHIP = '.chip'
2929
const SELECTOR_CHIP_DISMISS = '.chip-dismiss'
@@ -58,7 +58,7 @@ const DefaultType = {
5858
* Class definition
5959
*/
6060

61-
class ChipInput extends BaseComponent {
61+
class Chips extends BaseComponent {
6262
constructor(element, config) {
6363
super(element, config)
6464

@@ -625,9 +625,9 @@ class ChipInput extends BaseComponent {
625625
*/
626626

627627
EventHandler.on(document, `DOMContentLoaded${EVENT_KEY}${DATA_API_KEY}`, () => {
628-
for (const element of SelectorEngine.find(SELECTOR_DATA_CHIP_INPUT)) {
629-
ChipInput.getOrCreateInstance(element)
628+
for (const element of SelectorEngine.find(SELECTOR_DATA_CHIPS)) {
629+
Chips.getOrCreateInstance(element)
630630
}
631631
})
632632

633-
export default ChipInput
633+
export default Chips

site/data/examples.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
description: 'Extend list groups with utilities and custom styles for any content.'
5656
- name: Dialogs
5757
description: 'Transform dialogs to serve any purpose, from feature tours to confirmations.'
58-
- name: Badges
59-
description: 'Make badges work with custom inner HTML and new looks.'
6058
- name: Breadcrumbs
6159
description: 'Integrate custom icons and create stepper components.'
6260
- name: Buttons

site/data/sidebar.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
- title: Form adorn
8989
meta:
9090
- added: 6.0.0
91-
- title: Chip input
91+
- title: Chips
9292
meta:
9393
- added: 6.0.0
9494
- title: Combobox

site/src/assets/examples/badges/badges.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

site/src/assets/examples/badges/index.astro

Lines changed: 0 additions & 146 deletions
This file was deleted.

site/src/content/docs/components/badge.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
---
22
title: Badges
3-
description: Documentation and examples for badges, our small count and labeling component.
3+
description: Small components for indicating status and counts, or labelling items.
44
toc: true
55
css_layer: components
66
---
77

88
import { getData } from '@libs/data'
99

10-
## Example
10+
## Examples
1111

12-
Badges scale to match the size of the immediate parent element by using relative font sizing and `em` units. Badges come in three variants: solid (default), subtle, and outline.
12+
Badges are tiny, static display components used for adding context to other elements. They can be used as part of navigation, buttons, and more to provide a counter or label. Badges scale to match the size of the immediate parent element by using relative font sizing and `em` units.
13+
14+
Badges come in three variants: solid (default), subtle, and outline.
1315

1416
<Example code={`<span class="badge theme-primary">New</span>
1517
<span class="badge badge-subtle theme-primary">New</span>

0 commit comments

Comments
 (0)