Skip to content

Commit

Permalink
chore: add types
Browse files Browse the repository at this point in the history
Co-authored-by: Andrea Stagi <[email protected]>
  • Loading branch information
elgorditosalsero and astagi authored Jan 26, 2023
1 parent edb2571 commit eb4c5fb
Show file tree
Hide file tree
Showing 43 changed files with 1,073 additions and 6 deletions.
18 changes: 14 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"extends": ["eslint:recommended", "prettier"],
"plugins": ["prettier"],
"ignorePatterns": ["*.min.js"],
"extends": [
"eslint:recommended",
"prettier"
],
"plugins": [
"prettier"
],
"ignorePatterns": [
"*.min.js",
"*.d.ts"
],
"rules": {
"prettier/prettier": ["error"]
"prettier/prettier": [
"error"
]
},
"parserOptions": {
"ecmaVersion": "latest",
Expand Down
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"web"
],
"module": "dist/bootstrap-italia.esm.js",
"types": "./types/decs.d.ts",
"types": "./types/index.d.ts",
"sideEffects": [
"*.css",
"*.scss",
Expand Down Expand Up @@ -61,6 +61,7 @@
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-legacy": "^2.2.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@types/bootstrap": "^5.2.6",
"browser-sync": "^2.27.9",
"browserslist-config-design-italia": "^1.1.0",
"concurrently": "^7.0.0",
Expand Down
1 change: 0 additions & 1 deletion types/decs.d.ts

This file was deleted.

80 changes: 80 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { Alert } from './plugins/alert'
import { Accordion } from './plugins/accordion'
import { BackToTop } from './plugins/backToTop'
import { Button } from './plugins/button'
import { Carousel } from './plugins/carousel'
import { CarouselBI } from './plugins/carousel-bi'
import { Collapse } from './plugins/collapse'
import { Cookiebar } from './plugins/cookiebar'
import { Dimmer } from './plugins/dimmer'
import { Dropdown } from './plugins/dropdown'
import { Form } from './plugins/form'
import { FormValidate, ValidatorSelectAutocomplete } from './plugins/form-validate'
import { Forward } from './plugins/forward'
import { HeaderSticky } from './plugins/header-sticky'
import { HistoryBack } from './plugins/history-back'
import { Input } from './plugins/input'
import { InputLabel } from './plugins/input-label'
import { InputNumber } from './plugins/input-number'
import { InputPassword } from './plugins/input-password'
import { InputSearch } from './plugins/input-search-autocomplete'
import { List } from './plugins/list'
import { Masonry } from './plugins/masonry'
import { Modal } from './plugins/modal'
import { NavBarCollapsible } from './plugins/navbar-collapsible'
import { NavScroll } from './plugins/navscroll'
import { Notification } from './plugins/notification'
import { Offcanvas } from './plugins/offcanvas'
import { Popover } from './plugins/popover'
import { ProgressDonut } from './plugins/progress-donut'
import { ScrollSpy } from './plugins/scrollspy'
import { SelectAutocomplete } from './plugins/select-autocomplete'
import { Sticky } from './plugins/sticky'
import { Tab } from './plugins/tab'
import { Toast } from './plugins/toast'
import { Tooltip } from './plugins/tooltip'
import { TrackFocus } from './plugins/track-focus'
import { Transfer } from './plugins/transfer'
import { UploadDragDrop } from './plugins/upload-dragdrop'

export {
Alert,
Accordion,
BackToTop,
Button,
Carousel,
CarouselBI,
Collapse,
Cookiebar,
Dimmer,
Dropdown,
Form,
FormValidate,
ValidatorSelectAutocomplete,
Forward,
HeaderSticky,
HistoryBack,
Input,
InputLabel,
InputNumber,
InputPassword,
InputSearch,
List,
Masonry,
Modal,
NavBarCollapsible,
NavScroll,
Notification,
Offcanvas,
Popover,
ProgressDonut,
ScrollSpy,
SelectAutocomplete,
Sticky,
Tab,
Toast,
Tooltip,
TrackFocus,
Transfer,
UploadDragDrop,
}
25 changes: 25 additions & 0 deletions types/plugins/accordion.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'

type KeyName = 'ArrowDown' | 'ArrowUp' | 'Home' | 'End'

declare class Accordion extends BaseComponent {
static get NAME(): string

constructor(element: HTMLElement)

handleKeyDown(keyName: KeyName, target: HTMLElement, evt: Event): void

_bindEvents(): void

_getHeadButtons(): any

_focusNext(target: HTMLElement): void

_focusPrev(target: HTMLElement): void

_focusFirst(target: HTMLElement): void

_focusLast(target: HTMLElement): void
}

export { Accordion }
5 changes: 5 additions & 0 deletions types/plugins/alert.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Alert as BSAlert } from 'bootstrap'

declare class Alert extends BSAlert {}

export { Alert }
33 changes: 33 additions & 0 deletions types/plugins/backToTop.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'

declare class BackToTop extends BaseComponent {
static get NAME(): string

constructor(element: HTMLElement, config: any)

_config: any
_scrollCb: {
id: any
_callback: any
dispose(): void
_execute(data: any): void
}
_isAnim: boolean
_prevScrollBehavior: string

show(): void

hide(): void

toggleShow(): void

scrollToTop(): void

dispose(): void

_getConfig(config: any): any

_bindEvents(): void
}

export { BackToTop }
5 changes: 5 additions & 0 deletions types/plugins/button.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Button as BSButton } from 'bootstrap'

declare class Button extends BSButton {}

export { Button }
43 changes: 43 additions & 0 deletions types/plugins/carousel-bi.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import Splide from '@splidejs/splide'

declare class CarouselBI extends BaseComponent {
static get NAME(): string

constructor(element: HTMLElement)

_config: {
slideFocus: boolean
i18n: {
prev: string
next: string
first: string
last: string
slideX: string
pageX: string
play: string
pause: string
}
}
_splide: Splide

dispose(): void

_init(): void

_getConfig(): {
slideFocus: boolean
i18n: {
prev: string
next: string
first: string
last: string
slideX: string
pageX: string
play: string
pause: string
}
}
}

export { CarouselBI }
5 changes: 5 additions & 0 deletions types/plugins/carousel.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Carousel as BSCarousel } from 'bootstrap'

declare class Carousel extends BSCarousel {}

export { Carousel }
5 changes: 5 additions & 0 deletions types/plugins/collapse.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Collapse as BSCollapse } from 'bootstrap'

declare class Collapse extends BSCollapse {}

export { Collapse }
47 changes: 47 additions & 0 deletions types/plugins/cookiebar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'

/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
declare class Cookiebar extends BaseComponent {
static get NAME(): string

static get VERSION(): string

static clearCookie(): void

static _handleAccept(cookiebarInstance: any): (event: any) => void

static _handleConsent(cookiebarInstance: any): (event: any) => void

static _getCookieEU(): string

constructor(element: HTMLElement)

_isShown: boolean
_isTransitioning: boolean

show(): void

hide(): void

accept(element: HTMLElement): void

_isAnimated(): boolean

_showElement(): void

_hideElement(): void

_setCookieEU(): void

_getRootElement(element: HTMLElement): any

_triggerCloseEvent(element: HTMLElement): any

_removeElement(element: HTMLElement): void
}

export { Cookiebar }
22 changes: 22 additions & 0 deletions types/plugins/dimmer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'

declare class Dimmer extends BaseComponent {
static get NAME(): string

constructor(element: HTMLElement)

_isShown: boolean
_isTransitioning: boolean

show(): void

hide(): void

_isAnimated(): boolean

_showElement(): void

_hideElement(): void
}

export { Dimmer }
5 changes: 5 additions & 0 deletions types/plugins/dropdown.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Dropdown as BSDropdown } from 'bootstrap'

declare class Dropdown extends BSDropdown {}

export { Dropdown }
Loading

0 comments on commit eb4c5fb

Please sign in to comment.