@ekzo-dev/bootstrap-addons 5.3.21 → 5.3.23
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 +61 -147
- package/package.json +4 -12
- package/src/forms/duration-input/README.md +153 -0
- package/src/forms/duration-input/duration-input.html +1 -1
- package/src/forms/duration-input/duration-input.scss +1 -1
- package/src/forms/duration-input/duration-input.stories.ts +84 -39
- package/src/forms/select-dropdown/README.md +324 -0
- package/src/forms/select-dropdown/select-dropdown.stories.ts +137 -0
- package/src/index.ts +0 -1
- package/src/forms/json-input/index.ts +0 -1
- package/src/forms/json-input/json-input.html +0 -15
- package/src/forms/json-input/json-input.scss +0 -17
- package/src/forms/json-input/json-input.stories.ts +0 -59
- package/src/forms/json-input/json-input.ts +0 -270
- package/src/forms/select-dropdown/select.stories.ts +0 -89
package/README.md
CHANGED
|
@@ -1,181 +1,95 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ekzo-dev/bootstrap-addons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Additional Bootstrap form components for Aurelia 2 applications.
|
|
4
4
|
|
|
5
|
-
This
|
|
5
|
+
This package extends [@ekzo-dev/bootstrap](https://github.com/ekzo-dev/aurelia-components/tree/main/packages-adapters/bootstrap) with advanced form components that provide enhanced functionality beyond the standard Bootstrap form controls.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
2. The local `dev-app/` folder, is the code for the dev app, just like a normal app bootstrapped by aurelia-cli.
|
|
9
|
-
3. You can use normal `au run` and `au test` in development just like developing an app.
|
|
10
|
-
4. You can use aurelia-testing to test your plugin, just like developing an app.
|
|
11
|
-
5. To ensure compatibility to other apps, always use `PLATFORM.moduleName()` wrapper in files inside `src/`. You don't need to use the wrapper in `dev-app/` folder as CLI built-in bundler supports module name without the wrapper.
|
|
7
|
+
## Installation
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## How to write an Aurelia plugin
|
|
16
|
-
|
|
17
|
-
For a full length tutorial, visit [Aurelia plugin guide](https://aurelia.io/docs/plugins/write-new-plugin).
|
|
18
|
-
|
|
19
|
-
Here is some basics. You can create new custom element, custom attribute, value converter or binding behavior manually, or use command `au generate` to help.
|
|
20
|
-
|
|
21
|
-
```shell
|
|
22
|
-
au generate element some-name
|
|
23
|
-
au generate attribute some-name
|
|
24
|
-
au generate value-converter some-name
|
|
25
|
-
au generate binding-behavior some-name
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ekzo-dev/bootstrap-addons
|
|
26
11
|
```
|
|
27
12
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
src/elements
|
|
32
|
-
src/attributes
|
|
33
|
-
src/value-converters
|
|
34
|
-
src/binding-behaviors
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Note the folder structure is only to help you organising the files, it's not a requirement of Aurelia. You can manually create new element (or other thing) anywhere in `src/`.
|
|
38
|
-
|
|
39
|
-
After you added some new file, you need to register it in `src/index.ts`. Like this:
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
config.globalResources([
|
|
43
|
-
// ...
|
|
44
|
-
PLATFORM.moduleName('./path/to/new-file-without-ext'),
|
|
45
|
-
]);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
The usage of `PLATFORM.moduleName` wrapper is mandatory. It's needed for your plugin to be consumed by any app using webpack, CLI built-in bundler, or jspm.
|
|
49
|
-
|
|
50
|
-
## Resource import within the dev app
|
|
51
|
-
|
|
52
|
-
In dev app, when you need to import something from the inner plugin (for example, importing a class for dependency injection), use special name `"resources"` to reference the inner plugin.
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
import {autoinject} from 'aurelia-framework';
|
|
56
|
-
// "resources" refers the inner plugin src/index.ts
|
|
57
|
-
import {MyService} from 'resources';
|
|
58
|
-
|
|
59
|
-
@autoinject()
|
|
60
|
-
export class App {
|
|
61
|
-
constructor(myService: MyService) {}
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Manage dependencies
|
|
66
|
-
|
|
67
|
-
By default, this plugin has no "dependencies" in package.json. Theoretically this plugin depends on at least `aurelia-pal` because `src/index.ts` imports it. It could also depends on more core Aurelia package like `aurelia-binding` or `aurelia-templating` if you build advanced components that reference them.
|
|
68
|
-
|
|
69
|
-
Ideally you need to carefully add those `aurelia-pal` (`aurelia-binding`...) to "dependencies" in package.json. But in practice you don't have to. Because every app that consumes this plugin will have full Aurelia core packages installed.
|
|
70
|
-
|
|
71
|
-
Furthermore, there are two benefits by leaving those dependencies out of plugin's package.json.
|
|
13
|
+
### Peer Dependencies
|
|
72
14
|
|
|
73
|
-
|
|
74
|
-
2. reduce the burden for npm/yarn when installing this plugin.
|
|
15
|
+
This package requires the following peer dependencies:
|
|
75
16
|
|
|
76
|
-
|
|
17
|
+
- `aurelia` ^2.0.0
|
|
18
|
+
- `bootstrap` ~5.3.7
|
|
19
|
+
- `@popperjs/core` ^2.11.8
|
|
20
|
+
- `vanilla-jsoneditor` ~3.11.0
|
|
21
|
+
- `immutable-json-patch` ^6.0.1
|
|
77
22
|
|
|
78
|
-
|
|
23
|
+
## Usage
|
|
79
24
|
|
|
80
|
-
|
|
25
|
+
Register the plugin in your Aurelia application:
|
|
81
26
|
|
|
82
|
-
|
|
27
|
+
```typescript
|
|
28
|
+
import Aurelia from 'aurelia';
|
|
29
|
+
import { BootstrapAddonsConfiguration } from '@ekzo-dev/bootstrap-addons';
|
|
83
30
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## Consume Plugin
|
|
89
|
-
|
|
90
|
-
By default, the `dist/` folder is not committed to git. (We have `/dist` in `.gitignore`). But that would not prevent you from consuming this plugin through direct git reference.
|
|
91
|
-
|
|
92
|
-
You can consume this plugin directly by:
|
|
93
|
-
|
|
94
|
-
```shell
|
|
95
|
-
npm i github:your_github_username/ui-utils
|
|
96
|
-
# or if you use bitbucket
|
|
97
|
-
npm i bitbucket:your_github_username/ui-utils
|
|
98
|
-
# or if you use gitlab
|
|
99
|
-
npm i gitlab:your_github_username/ui-utils
|
|
100
|
-
# or plain url
|
|
101
|
-
npm i https:/github.com/your_github_username/ui-utils.git
|
|
31
|
+
Aurelia
|
|
32
|
+
.register(BootstrapAddonsConfiguration)
|
|
33
|
+
.app(MyApp)
|
|
34
|
+
.start();
|
|
102
35
|
```
|
|
103
36
|
|
|
104
|
-
|
|
37
|
+
## Components
|
|
105
38
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
```
|
|
39
|
+
| Component | Description | Documentation |
|
|
40
|
+
|-----------|-------------|---------------|
|
|
41
|
+
| **Duration Input** | Form control for entering time durations in ISO 8601 format | [View docs](./src/forms/duration-input/README.md) |
|
|
42
|
+
| **Select Dropdown** | Enhanced select component with improved styling and functionality | [View docs](./src/forms/select-dropdown/README.md) |
|
|
111
43
|
|
|
112
|
-
|
|
44
|
+
## Quick Examples
|
|
113
45
|
|
|
114
|
-
|
|
46
|
+
### Duration Input
|
|
115
47
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
1. Remove `"private": true,` from package.json.
|
|
123
|
-
2. Pump up project version. This will run through `au test` (in "preversion" in package.json) first.
|
|
124
|
-
|
|
125
|
-
```shell
|
|
126
|
-
npm version patch # or minor or major
|
|
48
|
+
```html
|
|
49
|
+
<bs-duration-input
|
|
50
|
+
value.bind="duration"
|
|
51
|
+
label="Duration"
|
|
52
|
+
required.bind="true"
|
|
53
|
+
></bs-duration-input>
|
|
127
54
|
```
|
|
128
55
|
|
|
129
|
-
|
|
56
|
+
### Select Dropdown
|
|
130
57
|
|
|
131
|
-
```
|
|
132
|
-
|
|
58
|
+
```html
|
|
59
|
+
<bs-select-dropdown
|
|
60
|
+
value.bind="selectedValue"
|
|
61
|
+
options.bind="countries"
|
|
62
|
+
label="Country"
|
|
63
|
+
></bs-select-dropdown>
|
|
133
64
|
```
|
|
134
65
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
```shell
|
|
138
|
-
npm publish
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Automate changelog, git push, and npm publish
|
|
142
|
-
|
|
143
|
-
You can enable `npm version patch # or minor or major` to automatically update changelog, push commits and version tag to the git server, and publish to npm.
|
|
144
|
-
|
|
145
|
-
Here is one simple setup.
|
|
146
|
-
|
|
147
|
-
1. `npm i -D standard-changelog`. We use [`standard-changelog`](https://github.com/conventional-changelog/conventional-changelog) as a minimum example to support conventional changelog.
|
|
148
|
-
|
|
149
|
-
- Alternatively you can use high level [standard-version](https://github.com/conventional-changelog/standard-version).
|
|
150
|
-
|
|
151
|
-
2. Add two commands to `"scripts"` section of package.json.
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
"scripts": {
|
|
155
|
-
// ...
|
|
156
|
-
"version": "standard-changelog && git add CHANGELOG.md",
|
|
157
|
-
"postversion": "git push && git push --tags && npm publish"
|
|
158
|
-
},
|
|
159
|
-
```
|
|
66
|
+
## Dependencies
|
|
160
67
|
|
|
161
|
-
|
|
68
|
+
This package uses:
|
|
162
69
|
|
|
163
|
-
|
|
70
|
+
- **@ekzo-dev/bootstrap** - Core Bootstrap components for Aurelia 2
|
|
71
|
+
- **@ekzo-dev/toolkit** - Utility functions and helpers
|
|
72
|
+
- **@js-temporal/polyfill** - Temporal API polyfill for date/time handling
|
|
164
73
|
|
|
165
|
-
##
|
|
74
|
+
## Browser Support
|
|
166
75
|
|
|
167
|
-
|
|
76
|
+
This package supports all modern browsers that support ES2015+ and the following features:
|
|
168
77
|
|
|
169
|
-
|
|
78
|
+
- Custom Elements (Web Components)
|
|
79
|
+
- ES Modules
|
|
80
|
+
- Temporal API (polyfilled)
|
|
170
81
|
|
|
171
|
-
|
|
82
|
+
## Contributing
|
|
172
83
|
|
|
173
|
-
|
|
84
|
+
Contributions are welcome! Please read the [contributing guidelines](https://github.com/ekzo-dev/aurelia-components/blob/main/CONTRIBUTING.md) first.
|
|
174
85
|
|
|
175
|
-
|
|
86
|
+
## License
|
|
176
87
|
|
|
177
|
-
|
|
88
|
+
MIT © [Ekzo](https://github.com/ekzo-dev)
|
|
178
89
|
|
|
179
|
-
|
|
90
|
+
## Links
|
|
180
91
|
|
|
181
|
-
|
|
92
|
+
- [GitHub Repository](https://github.com/ekzo-dev/aurelia-components)
|
|
93
|
+
- [Issue Tracker](https://github.com/ekzo-dev/aurelia-components/issues)
|
|
94
|
+
- [Aurelia 2 Documentation](https://docs.aurelia.io)
|
|
95
|
+
- [Bootstrap 5 Documentation](https://getbootstrap.com/docs/5.3/)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekzo-dev/bootstrap-addons",
|
|
3
3
|
"description": "Aurelia Bootstrap additional component",
|
|
4
|
-
"version": "5.3.
|
|
4
|
+
"version": "5.3.23",
|
|
5
5
|
"homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,22 +9,14 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ekzo-dev/bootstrap": "~5.3.
|
|
13
|
-
"@ekzo-dev/vanilla-jsoneditor": "~3.11.0",
|
|
12
|
+
"@ekzo-dev/bootstrap": "~5.3.9",
|
|
14
13
|
"@ekzo-dev/toolkit": "^1.3.0",
|
|
15
|
-
"@
|
|
16
|
-
"@types/json-schema": "^7.0.14",
|
|
17
|
-
"@js-temporal/polyfill": "^0.5.1",
|
|
18
|
-
"ajv": "^8.17.1",
|
|
19
|
-
"ajv-formats": "^3.0.1",
|
|
20
|
-
"json-schema-library": "^11.0.0"
|
|
14
|
+
"@js-temporal/polyfill": "^0.5.1"
|
|
21
15
|
},
|
|
22
16
|
"peerDependencies": {
|
|
23
17
|
"aurelia": "^2.0.0-rc.0",
|
|
24
18
|
"bootstrap": "~5.3.7",
|
|
25
|
-
"@popperjs/core": "^2.11.8"
|
|
26
|
-
"vanilla-jsoneditor": "~3.11.0",
|
|
27
|
-
"immutable-json-patch": "^6.0.1"
|
|
19
|
+
"@popperjs/core": "^2.11.8"
|
|
28
20
|
},
|
|
29
21
|
"main": "src/index.ts",
|
|
30
22
|
"files": [
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Duration Input
|
|
2
|
+
|
|
3
|
+
A form control for entering time durations in ISO 8601 format.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Duration Input component allows users to input time durations using separate fields for days, hours, minutes, and seconds. The component automatically converts the input to ISO 8601 duration format (e.g., `P5DT1H` for 5 days and 1 hour).
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- ISO 8601 duration format support
|
|
12
|
+
- Separate inputs for days, hours, minutes, seconds
|
|
13
|
+
- Integration with Bootstrap form validation
|
|
14
|
+
- Floating label support
|
|
15
|
+
- Size variants (sm, lg)
|
|
16
|
+
- Full Bootstrap styling
|
|
17
|
+
- Inherits all BaseField functionality
|
|
18
|
+
|
|
19
|
+
## Basic Usage
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<bs-duration-input
|
|
23
|
+
value.bind="duration"
|
|
24
|
+
label="Duration"
|
|
25
|
+
></bs-duration-input>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
export class MyComponent {
|
|
30
|
+
duration = 'P5DT1H30M'; // 5 days, 1 hour, 30 minutes
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### With Validation
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<bs-duration-input
|
|
40
|
+
value.bind="duration"
|
|
41
|
+
label="Task Duration"
|
|
42
|
+
required.bind="true"
|
|
43
|
+
invalid-feedback="Please enter a duration"
|
|
44
|
+
></bs-duration-input>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### With Floating Label
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<bs-duration-input
|
|
51
|
+
value.bind="duration"
|
|
52
|
+
label="Duration"
|
|
53
|
+
floating-label.bind="true"
|
|
54
|
+
bs-size="lg"
|
|
55
|
+
></bs-duration-input>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Custom Validation
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<bs-duration-input
|
|
62
|
+
value.bind="duration"
|
|
63
|
+
label="Duration"
|
|
64
|
+
valid.bind="isValid"
|
|
65
|
+
valid-feedback="Duration is valid"
|
|
66
|
+
invalid-feedback="Duration must be at least 1 hour"
|
|
67
|
+
></bs-duration-input>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
export class MyComponent {
|
|
72
|
+
duration = '';
|
|
73
|
+
|
|
74
|
+
get isValid() {
|
|
75
|
+
if (!this.duration) return undefined;
|
|
76
|
+
// Check if duration is at least 1 hour
|
|
77
|
+
const match = this.duration.match(/PT(\d+)H/);
|
|
78
|
+
return match && parseInt(match[1]) >= 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Bindable Properties
|
|
84
|
+
|
|
85
|
+
| Property | Type | Default | Description |
|
|
86
|
+
|----------|------|---------|-------------|
|
|
87
|
+
| `value` | `string` | - | Two-way bound ISO 8601 duration string (e.g., `P5DT1H30M`) |
|
|
88
|
+
| `bsSize` | `'sm' \| 'lg'` | - | Bootstrap size variant |
|
|
89
|
+
| `floatingLabel` | `boolean` | `false` | Enable floating label style |
|
|
90
|
+
|
|
91
|
+
### Inherited from BaseField
|
|
92
|
+
|
|
93
|
+
| Property | Type | Default | Description |
|
|
94
|
+
|----------|------|---------|-------------|
|
|
95
|
+
| `name` | `string` | - | Input name attribute |
|
|
96
|
+
| `label` | `string` | - | Label text |
|
|
97
|
+
| `title` | `string` | - | Title attribute |
|
|
98
|
+
| `disabled` | `boolean` | `false` | Disable the input |
|
|
99
|
+
| `required` | `boolean` | `false` | Mark as required |
|
|
100
|
+
| `valid` | `boolean` | - | Validation state (undefined = not validated, true = valid, false = invalid) |
|
|
101
|
+
| `validFeedback` | `string` | - | Valid feedback message |
|
|
102
|
+
| `invalidFeedback` | `string` | - | Invalid feedback message |
|
|
103
|
+
| `form` | `string` | - | Associated form id |
|
|
104
|
+
| `text` | `string \| HTMLElement` | - | Helper text displayed below the input |
|
|
105
|
+
|
|
106
|
+
## ISO 8601 Duration Format
|
|
107
|
+
|
|
108
|
+
The component uses ISO 8601 duration format:
|
|
109
|
+
|
|
110
|
+
- `P` - Period designator (required)
|
|
111
|
+
- `nD` - Number of days
|
|
112
|
+
- `T` - Time designator (required if hours/minutes/seconds are present)
|
|
113
|
+
- `nH` - Number of hours
|
|
114
|
+
- `nM` - Number of minutes
|
|
115
|
+
- `nS` - Number of seconds
|
|
116
|
+
|
|
117
|
+
### Examples
|
|
118
|
+
|
|
119
|
+
- `P5D` - 5 days
|
|
120
|
+
- `PT2H` - 2 hours
|
|
121
|
+
- `PT30M` - 30 minutes
|
|
122
|
+
- `P1DT6H30M` - 1 day, 6 hours, 30 minutes
|
|
123
|
+
- `PT1H30M45S` - 1 hour, 30 minutes, 45 seconds
|
|
124
|
+
|
|
125
|
+
## Styling
|
|
126
|
+
|
|
127
|
+
The component uses standard Bootstrap form control classes and can be styled using Bootstrap utilities:
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<bs-duration-input
|
|
131
|
+
value.bind="duration"
|
|
132
|
+
label="Duration"
|
|
133
|
+
class="mb-3"
|
|
134
|
+
bs-size="sm"
|
|
135
|
+
></bs-duration-input>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Accessibility
|
|
139
|
+
|
|
140
|
+
The component follows accessibility best practices:
|
|
141
|
+
|
|
142
|
+
- Proper label association
|
|
143
|
+
- ARIA attributes for validation states
|
|
144
|
+
- Keyboard navigation support
|
|
145
|
+
- Screen reader friendly
|
|
146
|
+
|
|
147
|
+
## Browser Support
|
|
148
|
+
|
|
149
|
+
Requires browsers that support:
|
|
150
|
+
|
|
151
|
+
- ES2015+
|
|
152
|
+
- Custom Elements
|
|
153
|
+
- Temporal API (polyfilled)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template class="${floatingLabel ? 'form-floating' : ''}">
|
|
2
2
|
<label for.one-time="id" if.bind="label && !floatingLabel" class="form-label">${label}</label>
|
|
3
3
|
<fieldset class="${classes}" disabled.bind="disabled">
|
|
4
|
-
<input
|
|
4
|
+
<input id.one-time="id" value.bind="value" focus.trigger="focus()" ref="control" />
|
|
5
5
|
|
|
6
6
|
<input type="number" min="0" value.bind="duration.years" placeholder="--" />
|
|
7
7
|
<span>${labels.years}</span>
|
|
@@ -1,39 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import { BsButton } from '@ekzo-dev/bootstrap';
|
|
2
|
+
|
|
3
|
+
import { BsDurationInput } from '.';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Bootstrap Addons / Forms / Duration input',
|
|
7
|
+
component: BsDurationInput,
|
|
8
|
+
render: () => ({
|
|
9
|
+
template: `<bs-duration-input
|
|
10
|
+
value.bind='value'
|
|
11
|
+
bs-size.bind='bsSize'
|
|
12
|
+
floating-label.bind='floatingLabel'
|
|
13
|
+
name.bind='name'
|
|
14
|
+
label.bind='label'
|
|
15
|
+
title.bind='title'
|
|
16
|
+
disabled.bind='disabled'
|
|
17
|
+
required.bind='required'
|
|
18
|
+
valid.bind='valid'
|
|
19
|
+
valid-feedback.bind='validFeedback'
|
|
20
|
+
invalid-feedback.bind='invalidFeedback'
|
|
21
|
+
form.bind='form'
|
|
22
|
+
text.bind='text'
|
|
23
|
+
></bs-duration-input>`,
|
|
24
|
+
}),
|
|
25
|
+
argTypes: {
|
|
26
|
+
// BsDurationInput properties
|
|
27
|
+
value: { control: 'text' },
|
|
28
|
+
bsSize: {
|
|
29
|
+
control: 'select',
|
|
30
|
+
options: ['sm', 'lg'],
|
|
31
|
+
},
|
|
32
|
+
floatingLabel: { control: 'boolean' },
|
|
33
|
+
|
|
34
|
+
// BaseField properties
|
|
35
|
+
name: { control: 'text' },
|
|
36
|
+
label: { control: 'text' },
|
|
37
|
+
title: { control: 'text' },
|
|
38
|
+
disabled: { control: 'boolean' },
|
|
39
|
+
required: { control: 'boolean' },
|
|
40
|
+
valid: { control: 'boolean' },
|
|
41
|
+
validFeedback: { control: 'text' },
|
|
42
|
+
invalidFeedback: { control: 'text' },
|
|
43
|
+
form: { control: 'text' },
|
|
44
|
+
text: { control: 'text' },
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default meta;
|
|
49
|
+
|
|
50
|
+
export const Overview = {
|
|
51
|
+
args: {
|
|
52
|
+
value: 'P5DT1H',
|
|
53
|
+
label: 'Duration',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Validation = {
|
|
58
|
+
render: () => ({
|
|
59
|
+
template: `<form class='was-validated'>
|
|
60
|
+
<bs-duration-input
|
|
61
|
+
value.bind='value'
|
|
62
|
+
bs-size.bind='bsSize'
|
|
63
|
+
floating-label.bind='floatingLabel'
|
|
64
|
+
name.bind='name'
|
|
65
|
+
label.bind='label'
|
|
66
|
+
title.bind='title'
|
|
67
|
+
disabled.bind='disabled'
|
|
68
|
+
required.bind='required'
|
|
69
|
+
valid.bind='valid'
|
|
70
|
+
valid-feedback.bind='validFeedback'
|
|
71
|
+
invalid-feedback.bind='invalidFeedback'
|
|
72
|
+
form.bind='form'
|
|
73
|
+
text.bind='text'
|
|
74
|
+
></bs-duration-input>
|
|
75
|
+
<br>\${value}
|
|
76
|
+
<button bs-button>Validate</button>
|
|
77
|
+
</form>`,
|
|
78
|
+
components: [BsButton],
|
|
79
|
+
}),
|
|
80
|
+
args: {
|
|
81
|
+
label: 'Duration',
|
|
82
|
+
required: true,
|
|
83
|
+
},
|
|
84
|
+
};
|