bootstrap-input-spinner 5.0.2 → 5.0.3
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 +12 -13
- package/index.html +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,9 +17,9 @@ A Bootstrap 5 extension to create input spinner elements for number input. Zero
|
|
|
17
17
|
|
|
18
18
|
### Older version, Bootstrap 4 compatible
|
|
19
19
|
|
|
20
|
-
> The current is compatible with **Bootstrap 5
|
|
21
|
-
> <a href="https://github.com/shaack/bootstrap-input-spinner/tree/bootstrap4-compatible">bootstrap4-compatible</a
|
|
22
|
-
> npm package versions 3.x are Bootstrap 5 compatible
|
|
20
|
+
> The current version is compatible with **Bootstrap 5**. A Bootstrap 4 compatible version lives on the
|
|
21
|
+
> <a href="https://github.com/shaack/bootstrap-input-spinner/tree/bootstrap4-compatible">bootstrap4-compatible</a> branch.
|
|
22
|
+
> npm package versions 3.x, 4.x and 5.x are Bootstrap 5 compatible; 2.x is Bootstrap 4 compatible.
|
|
23
23
|
|
|
24
24
|
- [Bootstrap 4 compatible npm package](https://www.npmjs.com/package/bootstrap-input-spinner/v/2.1.2)
|
|
25
25
|
|
|
@@ -31,10 +31,9 @@ The Bootstrap InputSpinner
|
|
|
31
31
|
- automatically changes the value when **holding a button**,
|
|
32
32
|
- has **internationalized** number formatting,
|
|
33
33
|
- allows setting a **prefix** or a **suffix** text in the input,
|
|
34
|
-
- handles **`val()`** like the native element,
|
|
35
34
|
- **dynamically handles** changing **attribute values** like `disabled` or `class`,
|
|
36
|
-
- supports **templates** and **custom editors**,
|
|
37
|
-
- dispatches **`change`** and **`input`** **events on value change** like the native element and
|
|
35
|
+
- supports **templates** and **custom editors**,
|
|
36
|
+
- dispatches **`change`** and **`input`** **events on value change** like the native element, and
|
|
38
37
|
- works **without extra css**, only Bootstrap 5 is needed.
|
|
39
38
|
|
|
40
39
|
## Quickstart
|
|
@@ -51,7 +50,7 @@ npm install bootstrap-input-spinner@2.2.0
|
|
|
51
50
|
```
|
|
52
51
|
|
|
53
52
|
|
|
54
|
-
Or just download the GitHub repository and
|
|
53
|
+
Or just download the GitHub repository and import `src/InputSpinner.js` as an ES module.
|
|
55
54
|
|
|
56
55
|
### HTML
|
|
57
56
|
|
|
@@ -114,7 +113,7 @@ new InputSpinner(element, config)
|
|
|
114
113
|
The default configuration is
|
|
115
114
|
|
|
116
115
|
```javascript
|
|
117
|
-
|
|
116
|
+
const props = {
|
|
118
117
|
decrementButton: "<strong>−</strong>", // button text
|
|
119
118
|
incrementButton: "<strong>+</strong>", // ..
|
|
120
119
|
groupClass: "", // css class of the resulting input-group
|
|
@@ -147,8 +146,8 @@ Additional css class for the `input-group` of the rendered Bootstrap input.
|
|
|
147
146
|
##### buttonsClass
|
|
148
147
|
|
|
149
148
|
The css class of the buttons. Use it to style the increment and decrement buttons as
|
|
150
|
-
described [
|
|
151
|
-
|
|
149
|
+
described [in the Bootstrap 5 button docs](https://getbootstrap.com/docs/5.3/components/buttons/). For example
|
|
150
|
+
`buttonsClass: "btn-primary"` or `"btn-success"`.
|
|
152
151
|
|
|
153
152
|
##### buttonsWidth
|
|
154
153
|
|
|
@@ -196,11 +195,11 @@ new InputSpinner(element, {editor: TimeEditor})
|
|
|
196
195
|
An Editor must implement two functions: `parse(customFormat)` to turn the input string into a number, and
|
|
197
196
|
`render(number)` to format the number back for display.
|
|
198
197
|
|
|
199
|
-
The simplest custom Editor is the `RawEditor`,
|
|
200
|
-
|
|
198
|
+
The simplest custom Editor is the `RawEditor`, which renders and parses the value without any changes, like a native
|
|
199
|
+
number input. It looks like this:
|
|
201
200
|
|
|
202
201
|
```javascript
|
|
203
|
-
|
|
202
|
+
export const RawEditor = function (props, element) {
|
|
204
203
|
this.parse = function (customFormat) {
|
|
205
204
|
// parse nothing
|
|
206
205
|
return customFormat
|
package/index.html
CHANGED
|
@@ -464,6 +464,7 @@ new InputSpinner(document.getElementById("timeEditor"), {editor: TimeEditor})</c
|
|
|
464
464
|
</div>
|
|
465
465
|
<p>If you find bugs or have suggestions, you may write an
|
|
466
466
|
<a href="https://github.com/shaack/bootstrap-input-spinner/issues">issue</a>.</p>
|
|
467
|
+
<p>Run the <a href="./test/">unit tests</a> in your browser.</p>
|
|
467
468
|
<br/><br/>
|
|
468
469
|
</section>
|
|
469
470
|
<script type="module">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bootstrap-input-spinner",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "A Bootstrap 5 plugin to create input spinner elements for number input.",
|
|
5
5
|
"browser": "./src/InputSpinner.js",
|
|
6
6
|
"type": "module",
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
"homepage": "https://shaack.com/en/open-source-components",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"prismjs": "^1.30.0",
|
|
34
|
-
"teevi": "^2.
|
|
34
|
+
"teevi": "^2.4.1"
|
|
35
35
|
}
|
|
36
36
|
}
|