Skip to content

Commit

Permalink
Update USWDS typings to incorporate corrections (#416)
Browse files Browse the repository at this point in the history
* Update USWDS typings to incorporate corrections

* Use export all syntax
  • Loading branch information
aduth authored Mar 6, 2024
1 parent 362a4d3 commit 07728c7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 81 deletions.
68 changes: 1 addition & 67 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1 @@
import {
accordion as baseAccordion,
banner as baseBanner,
characterCount as baseCharacterCount,
comboBox as baseComboBox,
datePicker as baseDatePicker,
dateRangePicker as baseDateRangePicker,
fileInput as baseFileInput,
footer as baseFooter,
inPageNavigation as baseInPageNavigation,
inputMask as baseInputMask,
languageSelector as baseLanguageSelector,
modal as baseModal,
navigation as baseNavigation,
password as basePassword,
search as baseSearch,
skipnav as baseSkipnav,
timePicker as baseTimePicker,
table as baseTable,
tooltip as baseTooltip,
validator as baseValidator,
} from '@uswds/uswds';

type ComponentLifecycle = (target?: HTMLElement) => any;

interface BaseComponent {
on: ComponentLifecycle;
off: ComponentLifecycle;
}

interface Button extends BaseComponent {}

interface Range extends BaseComponent {
updateCallout(targetRange: HTMLInputElement): void;
}

type Tooltip = typeof baseTooltip &
BaseComponent & {
show(
tooltipBody: HTMLElement,
tooltipTrigger: Element,
position: 'top' | 'right' | 'left' | 'bottom',
): void;
};

export const accordion: typeof baseAccordion & BaseComponent;
export const banner: typeof baseBanner & BaseComponent;
export const button: Button;
export const characterCount: typeof baseCharacterCount & BaseComponent;
export const comboBox: typeof baseComboBox & BaseComponent;
export const datePicker: typeof baseDatePicker & BaseComponent;
export const dateRangePicker: typeof baseDateRangePicker & BaseComponent;
export const fileInput: typeof baseFileInput & BaseComponent;
export const footer: typeof baseFooter & BaseComponent;
export const inPageNavigation: typeof baseInPageNavigation & BaseComponent;
export const inputMask: typeof baseInputMask & BaseComponent;
export const languageSelector: typeof baseLanguageSelector & BaseComponent;
export const modal: typeof baseModal & BaseComponent;
export const navigation: typeof baseNavigation & BaseComponent;
export const password: typeof basePassword & BaseComponent;
export const range: Range;
export const search: typeof baseSearch & BaseComponent;
export const skipnav: typeof baseSkipnav & BaseComponent;
export const timePicker: typeof baseTimePicker & BaseComponent;
export const table: typeof baseTable & BaseComponent;
export const tooltip: Tooltip;
export const validator: typeof baseValidator & BaseComponent;
export * from '@uswds/uswds/js';
14 changes: 7 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
},
"homepage": "https://github.com/18F/identity-design-system#readme",
"dependencies": {
"@types/uswds__uswds": "^3.3.3",
"@types/uswds__uswds": "^3.7.0",
"@uswds/uswds": "^3.7.1"
},
"devDependencies": {
Expand Down
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
"moduleResolution": "node",
"module": "ESNext",
"target": "ESNext",
"baseUrl": ".",
"paths": {
"*": ["typings/*"]
}
"baseUrl": "."
},
"exclude": ["build", "dist", "packages"]
}
2 changes: 0 additions & 2 deletions typings/uswds__uswds.d.ts

This file was deleted.

0 comments on commit 07728c7

Please sign in to comment.