Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit b6aa009

Browse files
committed
fix typescript problems
1 parent 91beca3 commit b6aa009

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

docs/package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"eslint": "8.35.0",
1616
"eslint-config-next": "13.2.3",
1717
"jb-date-input": "^3.7.3",
18-
"jb-date-input-react": "^2.0.8",
18+
"jb-date-input-react": "^2.0.12",
1919
"next": "13.2.3",
2020
"react": "18.2.0",
2121
"react-dom": "18.2.0",

docs/src/components/samples/Samples.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ function Samples() {
5757
</svg>
5858
</div>
5959
</JBDateInput>
60-
{/* <JBDateInput label="with inner-box section">
60+
<JBDateInput label="with inner-box section">
6161
<jb-date-input-inbox-element slot="end-section">
6262
<div>after</div>
6363
</jb-date-input-inbox-element>
6464
<jb-date-input-inbox-element slot="start-section">
6565
<div>before</div>
6666
</jb-date-input-inbox-element>
67-
</JBDateInput> */}
67+
</JBDateInput>
6868
<FormalTheme label="more formal look">{}</FormalTheme>
6969

7070
</SamplesSectionWrapper>

lib/JBDateInput.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
import React, { useEffect, useRef, useState, useImperativeHandle, useCallback } from 'react';
1+
import React, { useEffect, useRef, useState, useImperativeHandle, useCallback, DOMAttributes } from 'react';
22
import PropTypes from 'prop-types';
33
// import {type} from 'jb-date-input';
44
import 'jb-date-input';
55
// eslint-disable-next-line no-duplicate-imports
6-
import { JBDateInputWebComponent, InputTypes, JBDateInputValidationItem } from 'jb-date-input';
6+
import { JBDateInputWebComponent, InputTypes, JBDateInputValidationItem, JBDDateInputInboxElementWebComponent } from 'jb-date-input';
77
import { useEvent } from '../../custom-hooks/UseEvent';
88

9+
type CustomEvents<K extends string> = { [key in K] : (event: CustomEvent) => void };
10+
11+
type CustomElement<T, K extends string> = Partial<T & DOMAttributes<T> & { children: any } & CustomEvents<`on${K}`>>;
912
declare global {
1013
// eslint-disable-next-line @typescript-eslint/no-namespace
1114
namespace JSX {
1215
interface IntrinsicElements {
1316
'jb-date-input': JBDateInputType,
14-
'jb-date-input-inbox-element':HTMLDivElement
17+
'jb-date-input-inbox-element':CustomElement<JBDDateInputInboxElementWebComponent,'Click'>
1518
}
1619
interface JBDateInputType extends React.DetailedHTMLProps<React.HTMLAttributes<JBDateInputWebComponent>, JBDateInputWebComponent> {
1720
class?:string,
@@ -39,7 +42,7 @@ export type JBDateInputProps = {
3942
required?: boolean,
4043
calendarDefaultDateView?:{ year:number, month: number, dateType:InputTypes},
4144
usePersianNumber?: boolean,
42-
children:React.ReactNode | string | HTMLElement | HTMLCollection | undefined | null,
45+
children:any,
4346
}
4447

4548
const JBDateInput = React.forwardRef((props: JBDateInputProps, ref) => {
@@ -168,7 +171,7 @@ JBDateInput.propTypes = {
168171
calendarDefaultDateView: PropTypes.shape({ year: PropTypes.number.isRequired, month: PropTypes.number.isRequired, dateType: PropTypes.oneOf<InputTypes>([InputTypes.gregorian, InputTypes.jalali]).isRequired }),
169172
// calendarDefaultDateView: PropTypes.object,
170173
usePersianNumber: PropTypes.bool,
171-
children:PropTypes.element
174+
// children:PropTypes.element
172175
};
173176

174177
export default JBDateInput;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"react component",
1919
"react"
2020
],
21-
"version": "2.0.8",
21+
"version": "2.0.12",
2222
"bugs": "https://github.com/javadbat/jb-date-input-react/issues",
2323
"license": "MIT",
2424
"files": [
@@ -36,6 +36,6 @@
3636
"url": "https://github.com/javadbat/jb-date-input-react"
3737
},
3838
"dependencies": {
39-
"jb-date-input": ">=3.7.3"
39+
"jb-date-input": ">=3.7.5"
4040
}
4141
}

0 commit comments

Comments
 (0)