Skip to content

Commit 53a0d75

Browse files
committed
Rename project to native-datepicker
1 parent 4f21242 commit 53a0d75

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# boring-datepicker
1+
# native-datepicker
22

33
> Styleable datepicker utilizing the native `<input type="date">`
44
@@ -28,8 +28,8 @@ Not supported (datepicker is hidden):
2828
### Vanilla JS
2929

3030
```js
31-
const BoringDatepicker = require('boring-datepicker');
32-
const picker = new BoringDatepicker({
31+
const NativeDatepicker = require('native-datepicker');
32+
const picker = new NativeDatepicker({
3333
onChange: (newValue) => {
3434
console.log(newValue);
3535
},
@@ -42,11 +42,11 @@ See [API](#api).
4242
### React
4343

4444
```jsx
45-
const BoringDatepicker = require('boring-datepicker/src/react');
45+
const NativeDatepicker = require('native-datepicker/src/react');
4646
const SomeComponent = () => {
4747
const [date, setDate] = useState('2020-11-01');
4848
return (
49-
<BoringDatepicker value={date} onChange={(newValue) => setDate(newValue)} />
49+
<NativeDatepicker value={date} onChange={(newValue) => setDate(newValue)} />
5050
);
5151
};
5252
```
@@ -55,7 +55,7 @@ See [React API](#react-api).
5555

5656
## API
5757

58-
### `class BoringDatepicker`
58+
### `class NativeDatepicker`
5959

6060
#### `constructor(options)`
6161

@@ -91,26 +91,26 @@ Set the value of the datepicker.
9191
- `"2020-11-01 13:15:00"`
9292
- `"2020-11-01T13:15:00"`
9393

94-
Upon changes, BoringDatepicker will replace the date-portion of the string and return the result.
94+
Upon changes, NativeDatepicker will replace the date-portion of the string and return the result.
9595

9696
#### `element`
9797

9898
Contains a reference to the datepicker element.
9999

100100
## React API
101101

102-
### `BoringDatepicker` component
102+
### `NativeDatepicker` component
103103

104104
Props:
105105

106106
```jsx
107-
<BoringDatepicker
107+
<NativeDatepicker
108108
value={date}
109109
onChange={(newValue) => {}}
110110
className="customClassName"
111111
>
112112
{optionalChildren}
113-
</BoringDatepicker>
113+
</NativeDatepicker>
114114
```
115115

116116
#### `props.value`
@@ -140,8 +140,8 @@ Custom className for the created element.
140140
Example with `className="CustomClass"`:
141141

142142
```html
143-
<span class="BoringDatepicker CustomClass">
144-
<input class="BoringDatepicker__input" type="date" />
143+
<span class="NativeDatepicker CustomClass">
144+
<input class="NativeDatepicker__input" type="date" />
145145
</span>
146146
```
147147

@@ -152,9 +152,9 @@ If `children` are given, they are inserted into the resulting DOM. This can be u
152152
Example:
153153

154154
```html
155-
<span class="BoringDatepicker">
155+
<span class="NativeDatepicker">
156156
<!-- Children will be inserted here -->
157-
<input class="BoringDatepicker__input" type="date" />
157+
<input class="NativeDatepicker__input" type="date" />
158158
</span>
159159
```
160160

@@ -163,22 +163,22 @@ Example:
163163
The following DOM is created for each datepicker:
164164

165165
```html
166-
<span class="BoringDatepicker">
167-
<input class="BoringDatepicker__input" type="date" />
166+
<span class="NativeDatepicker">
167+
<input class="NativeDatepicker__input" type="date" />
168168
</span>
169169
```
170170

171171
The recommended way to style the datepicker is to apply styles (e.g. width/height and a background-image) to the topmost element. Example:
172172

173173
```css
174-
.BoringDatepicker {
174+
.NativeDatepicker {
175175
width: 16px;
176176
height: 16px;
177177
background: transparent url(...) no-repeat center center;
178178
}
179179
```
180180

181-
Note: under normal circumstances you should not add any styles to `.BoringDatepicker__input`!
181+
Note: under normal circumstances you should not add any styles to `.NativeDatepicker__input`!
182182

183183
## Development
184184

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "boring-datepicker",
2+
"name": "native-datepicker",
33
"version": "1.0.1",
44
"main": "src/index.js",
5-
"repository": "https://github.com/codeclown/boring-datepicker",
5+
"repository": "https://github.com/codeclown/native-datepicker",
66
"author": "Martti Laine <[email protected]>",
77
"license": "ISC"
88
}

src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const classNames = {
2-
wrapper: 'BoringDatepicker',
3-
input: 'BoringDatepicker__input',
2+
wrapper: 'NativeDatepicker',
3+
input: 'NativeDatepicker__input',
44
};
55

66
const dateRegex = /\d{4}-\d{2}-\d{2}/;
77

8-
class BoringDatepicker {
8+
class NativeDatepicker {
99
constructor(options) {
1010
this.options = Object.assign(
1111
{
@@ -66,9 +66,9 @@ class BoringDatepicker {
6666
}
6767

6868
addStylesheet() {
69-
if (!this.options.win.document.querySelector('style#boringDatepicker')) {
69+
if (!this.options.win.document.querySelector('style#nativeDatepicker')) {
7070
const style = this.options.win.document.createElement('style');
71-
style.id = 'boringDatepicker';
71+
style.id = 'nativeDatepicker';
7272
style.textContent = `
7373
.${classNames.wrapper} {
7474
display: inline-block;
@@ -107,4 +107,4 @@ class BoringDatepicker {
107107
}
108108
}
109109

110-
module.exports = BoringDatepicker;
110+
module.exports = NativeDatepicker;

src/react.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { createElement: h, useRef, useEffect, useState } = require('react');
2-
const BoringDatepickerClass = require('./index');
2+
const NativeDatepickerClass = require('./index');
33

4-
const BoringDatepicker = ({
4+
const NativeDatepicker = ({
55
value = '',
66
onChange = () => {},
77
className = '',
@@ -11,7 +11,7 @@ const BoringDatepicker = ({
1111
const [datepicker, setDatepicker] = useState();
1212
useEffect(() => {
1313
if (spanRef.current) {
14-
const picker = new BoringDatepickerClass({
14+
const picker = new NativeDatepickerClass({
1515
existingElement: spanRef.current,
1616
onChange,
1717
});
@@ -34,4 +34,4 @@ const BoringDatepicker = ({
3434
);
3535
};
3636

37-
module.exports = BoringDatepicker;
37+
module.exports = NativeDatepicker;

0 commit comments

Comments
 (0)