Skip to content

Commit fbc416b

Browse files
committed
Drop support for BS4
1 parent af49319 commit fbc416b

File tree

10 files changed

+63
-65
lines changed

10 files changed

+63
-65
lines changed

.storybook/preview-head.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
<!-- <link
2-
rel="stylesheet"
3-
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
4-
integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn"
5-
crossorigin="anonymous" /> -->
6-
71
<link
8-
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
2+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
93
rel="stylesheet"
10-
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
4+
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
115
crossorigin="anonymous" />

.storybook/preview.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import '../styles/Typeahead.scss';
2-
import '../styles/Typeahead.bs5.scss';
32

43
export const parameters = {
54
actions: { argTypesRegex: '^on[A-Z].*' },

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ yarn add react-bootstrap-typeahead
2525
Include the module in your project:
2626

2727
```jsx
28-
import { Typeahead } from 'react-bootstrap-typeahead'; // ES2015
29-
var Typeahead = require('react-bootstrap-typeahead').Typeahead; // CommonJS
28+
import { Typeahead } from 'react-bootstrap-typeahead';
3029
```
3130

3231
#### UMD Build
@@ -62,9 +61,6 @@ or
6261
/>
6362
```
6463

65-
### Bootstrap 5
66-
In an effort to support Bootstrap 5, this package also contains a CSS file named `Typeahead.bs5.css` that should be included alongside the base CSS file above.
67-
6864
## Examples
6965

7066
Try the [live examples](http://ericgio.github.io/react-bootstrap-typeahead/), which also include code samples. If you'd like to modify the examples, clone the repository and run `npm install` and `npm start` to build the example file. You can then open the HTML file locally in your browser.

docs/Upgrading.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ The following HOCs were deprecated in a previous version and have been removed:
1717
- `withItem` (use `useItem`)
1818
- `withToken` (use `useToken`)
1919

20+
### Drop support for Bootstrap 4
21+
Bootstrap 5 is now over 3 years old. BS4 should still mostly work, but you may need to add some custom CSS in a few cases.
22+
2023
## v6.0 Breaking Changes
2124

2225
### `"small"` and `"large"` are no longer valid `size` values

example/src/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import PublicMethodsSection from './sections/PublicMethodsSection';
1212
import RenderingSection from './sections/RenderingSection';
1313

1414
import '../../styles/Typeahead.scss';
15-
import '../../styles/Typeahead.bs5.scss';
1615

1716
const container = document.getElementById('root');
1817
const root = createRoot(container!);

src/components/ClearButton/ClearButton.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ export const Large = Template.bind({});
1919
Large.args = {
2020
size: 'lg',
2121
};
22+
23+
export const Small = Template.bind({});
24+
Small.args = {
25+
size: 'sm',
26+
};

src/components/ClearButton/ClearButton.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ export interface ClearButtonProps
2222

2323
/**
2424
* ClearButton
25-
*
26-
* http://getbootstrap.com/css/#helper-classes-close
2725
*/
2826
const ClearButton = ({
2927
className,

src/components/ClearButton/__snapshots__/ClearButton.test.tsx.snap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,23 @@ exports[`<ClearButton> Large story renders snapshot 1`] = `
3939
</span>
4040
</button>
4141
`;
42+
43+
exports[`<ClearButton> Small story renders snapshot 1`] = `
44+
<button
45+
aria-label="Clear"
46+
class="close btn-close rbt-close rbt-close-sm"
47+
type="button"
48+
>
49+
<span
50+
aria-hidden="true"
51+
class="rbt-close-content"
52+
>
53+
×
54+
</span>
55+
<span
56+
class="sr-only visually-hidden"
57+
>
58+
Clear
59+
</span>
60+
</button>
61+
`;

styles/Typeahead.bs5.scss

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

styles/Typeahead.scss

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,20 @@ $rbt-placeholder-color: #6c757d !default;
114114
* Close Button
115115
*/
116116
.rbt-close {
117+
font-size: 1rem;
117118
z-index: 1;
118119

120+
&-sm {
121+
font-size: 0.75rem;
122+
}
123+
119124
&-lg {
120125
font-size: 1.5rem;
121126
}
127+
128+
&-content {
129+
display: none;
130+
}
122131
}
123132

124133
/**
@@ -205,14 +214,13 @@ $rbt-token-active-color: $rbt-color-white !default;
205214
position: absolute;
206215
right: 0;
207216
top: 0;
208-
width: 2rem;
217+
width: 2.5rem;
209218

210219
&-lg {
211220
width: 3rem;
212221
}
213222

214223
& .rbt-close {
215-
margin-top: -0.25rem;
216224
pointer-events: auto; /* Override pointer-events: none; above */
217225
}
218226
}
@@ -258,3 +266,25 @@ $rbt-token-active-color: $rbt-color-white !default;
258266
border-bottom-right-radius: 0;
259267
}
260268
}
269+
270+
.rbt .form-floating {
271+
flex: 1;
272+
}
273+
274+
.form-floating > .rbt-input-multi {
275+
&:not(:placeholder-shown) ~ label {
276+
opacity: inherit;
277+
transform: inherit;
278+
}
279+
280+
// Hide the placeholder
281+
.rbt-input-main::placeholder {
282+
color: transparent;
283+
}
284+
285+
// Shrink the label when multi-selector is focused or there are selections.
286+
&.focus ~ label {
287+
opacity: 0.65;
288+
transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
289+
}
290+
}

0 commit comments

Comments
 (0)