Skip to content

Commit

Permalink
style: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Sep 7, 2023
1 parent 69f691a commit dedd5b2
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 409 deletions.
118 changes: 61 additions & 57 deletions components/calendar/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,61 @@
import * as React from "react";
import { useDatePicker } from '@dhis2/multi-calendar-dates'
import { InputFieldProps } from "@dhis2-ui/input";

export type CalendarDir = "ltr" | "rtl";

type CalendarPickerParam = Parameters<typeof useDatePicker>[0]
type CalendarPickerOptions = CalendarPickerParam['options']

export interface CalendarProps {
/**
* the calendar to use such gregory, ethiopic, nepali - full supported list here: https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/calendars.ts
*/
calendar: CalendarPickerOptions['calendar'];
/**
* Called with signature `(null)` \|\| `({ dateCalendarString: string, dateCalendar: Temporal.ZonedDateTime })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd`
*/
onDateSelect: CalendarPickerParam['onDateSelect']
/**
* the size of a single cell in the table forming the calendar
*/
cellSize?: string;
/**
* the currently selected date using an iso-like format YYYY-MM-DD, in the calendar system provided (not iso8601)
*/
date?: string;
/**
* the direction of the library - internally the library will use rtl for rtl-languages but this can be overridden here for more control
*/
dir?: CalendarDir;
/**
* any valid locale - if none provided, the internal library will fallback to the user locale (more info here: https://github.com/dhis2/multi-calendar-dates/blob/main/src/hooks/internal/useResolvedLocaleOptions.ts#L15)
*/
locale?: string;
/**
* numbering system to use - full list here https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/numberingSystems.ts
*/
numberingSystem?: CalendarPickerOptions['numberingSystem'];
/**
* the timeZone to use
*/
timeZone?: CalendarPickerOptions['timeZone'];
/**
* the format to display for the week day, i.e. Monday (long), Mon (short), M (narrow)
*/
weekDayFormat?: CalendarPickerOptions['weekDayFormat'];
/**
* the width of the calendar component
*/
width?: string;
}

export const Calendar: React.FC<CalendarProps>;

export type CalendarInputProps = Omit<InputFieldProps, 'label' | 'type' | 'value' > & CalendarProps

export const CalendarInput: React.FC<CalendarInputProps>;
import * as React from 'react'
import { useDatePicker } from '@dhis2/multi-calendar-dates'
import { InputFieldProps } from '@dhis2-ui/input'

export type CalendarDir = 'ltr' | 'rtl'

type CalendarPickerParam = Parameters<typeof useDatePicker>[0]
type CalendarPickerOptions = CalendarPickerParam['options']

export interface CalendarProps {
/**
* the calendar to use such gregory, ethiopic, nepali - full supported list here: https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/calendars.ts
*/
calendar: CalendarPickerOptions['calendar']
/**
* Called with signature `(null)` \|\| `({ dateCalendarString: string, dateCalendar: Temporal.ZonedDateTime })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd`
*/
onDateSelect: CalendarPickerParam['onDateSelect']
/**
* the size of a single cell in the table forming the calendar
*/
cellSize?: string
/**
* the currently selected date using an iso-like format YYYY-MM-DD, in the calendar system provided (not iso8601)
*/
date?: string
/**
* the direction of the library - internally the library will use rtl for rtl-languages but this can be overridden here for more control
*/
dir?: CalendarDir
/**
* any valid locale - if none provided, the internal library will fallback to the user locale (more info here: https://github.com/dhis2/multi-calendar-dates/blob/main/src/hooks/internal/useResolvedLocaleOptions.ts#L15)
*/
locale?: string
/**
* numbering system to use - full list here https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/numberingSystems.ts
*/
numberingSystem?: CalendarPickerOptions['numberingSystem']
/**
* the timeZone to use
*/
timeZone?: CalendarPickerOptions['timeZone']
/**
* the format to display for the week day, i.e. Monday (long), Mon (short), M (narrow)
*/
weekDayFormat?: CalendarPickerOptions['weekDayFormat']
/**
* the width of the calendar component
*/
width?: string
}

export const Calendar: React.FC<CalendarProps>

export type CalendarInputProps = Omit<
InputFieldProps,
'label' | 'type' | 'value'
> &
CalendarProps

export const CalendarInput: React.FC<CalendarInputProps>
240 changes: 120 additions & 120 deletions components/checkbox/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
import * as React from 'react'

export interface EventPayload {
value?: string
name?: string
checked: boolean
}

type CheckboxEventHandler<Event extends React.SyntheticEvent> = (
arg0: EventPayload,
event: Event
) => void

type CheckboxFocusHandler = CheckboxEventHandler<
React.FocusEvent<HTMLInputElement>
>
type CheckboxChangeHandler = CheckboxEventHandler<
React.ChangeEvent<HTMLInputElement>
>
type CheckboxKeyHandler = CheckboxEventHandler<
React.KeyboardEvent<HTMLInputElement>
>

export interface CheckboxProps {
checked?: boolean
className?: string
dataTest?: string
dense?: boolean
disabled?: boolean
error?: boolean
indeterminate?: boolean
initialFocus?: boolean
label?: React.ReactNode
name?: string
tabIndex?: string
valid?: boolean
value?: string
warning?: boolean
onBlur?: CheckboxFocusHandler
/**
* Called with signature `(object, event)`
*/
onChange?: CheckboxChangeHandler
onFocus?: CheckboxFocusHandler
onKeyDown?: CheckboxKeyHandler
}

export class Checkbox extends React.Component<CheckboxProps, any> {
render(): JSX.Element
}

export interface CheckboxFieldProps {
checked?: boolean
className?: string
dataTest?: string
/**
* Smaller dimensions for information-dense layouts
*/
dense?: boolean
/**
* Disables the checkbox
*/
disabled?: boolean
/**
* Applies 'error' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `valid` props
*/
error?: boolean
/**
* Useful instructions for the user
*/
helpText?: string
initialFocus?: boolean
/**
* Labels the checkbox
*/
label?: React.ReactNode
/**
* Name associate with the checkbox. Passed in object as argument to event handlers
*/
name?: string
/**
* Adds an asterisk to indicate this field is required
*/
required?: boolean
tabIndex?: string
/**
* Applies 'valid' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `error` props
*/
valid?: boolean
/**
* Adds text below the checkbox to provide validation feedback. Acquires styles from `valid`, `warning` and `error` statuses
*/
validationText?: string
/**
* Value associated with the checkbox. Passed in object as argument to event handlers
*/
value?: string
/**
* Applies 'warning' styling to checkbox and validation text for feedback. Mutually exclusive with `valid` and `error` props
*/
warning?: boolean
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onBlur?: CheckboxFocusHandler
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onChange?: CheckboxChangeHandler
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onFocus?: CheckboxFocusHandler
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onKeyDown?: CheckboxKeyHandler
}

export const CheckboxField: React.FC<CheckboxFieldProps>
import * as React from 'react'

export interface EventPayload {
value?: string
name?: string
checked: boolean
}

type CheckboxEventHandler<Event extends React.SyntheticEvent> = (
arg0: EventPayload,
event: Event
) => void

type CheckboxFocusHandler = CheckboxEventHandler<
React.FocusEvent<HTMLInputElement>
>
type CheckboxChangeHandler = CheckboxEventHandler<
React.ChangeEvent<HTMLInputElement>
>
type CheckboxKeyHandler = CheckboxEventHandler<
React.KeyboardEvent<HTMLInputElement>
>

export interface CheckboxProps {
checked?: boolean
className?: string
dataTest?: string
dense?: boolean
disabled?: boolean
error?: boolean
indeterminate?: boolean
initialFocus?: boolean
label?: React.ReactNode
name?: string
tabIndex?: string
valid?: boolean
value?: string
warning?: boolean
onBlur?: CheckboxFocusHandler
/**
* Called with signature `(object, event)`
*/
onChange?: CheckboxChangeHandler
onFocus?: CheckboxFocusHandler
onKeyDown?: CheckboxKeyHandler
}

export class Checkbox extends React.Component<CheckboxProps, any> {
render(): JSX.Element
}

export interface CheckboxFieldProps {
checked?: boolean
className?: string
dataTest?: string
/**
* Smaller dimensions for information-dense layouts
*/
dense?: boolean
/**
* Disables the checkbox
*/
disabled?: boolean
/**
* Applies 'error' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `valid` props
*/
error?: boolean
/**
* Useful instructions for the user
*/
helpText?: string
initialFocus?: boolean
/**
* Labels the checkbox
*/
label?: React.ReactNode
/**
* Name associate with the checkbox. Passed in object as argument to event handlers
*/
name?: string
/**
* Adds an asterisk to indicate this field is required
*/
required?: boolean
tabIndex?: string
/**
* Applies 'valid' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `error` props
*/
valid?: boolean
/**
* Adds text below the checkbox to provide validation feedback. Acquires styles from `valid`, `warning` and `error` statuses
*/
validationText?: string
/**
* Value associated with the checkbox. Passed in object as argument to event handlers
*/
value?: string
/**
* Applies 'warning' styling to checkbox and validation text for feedback. Mutually exclusive with `valid` and `error` props
*/
warning?: boolean
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onBlur?: CheckboxFocusHandler
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onChange?: CheckboxChangeHandler
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onFocus?: CheckboxFocusHandler
/**
* Called with signature `({ name: string, value: string, checked: bool }, event)`
*/
onKeyDown?: CheckboxKeyHandler
}

export const CheckboxField: React.FC<CheckboxFieldProps>
Loading

0 comments on commit dedd5b2

Please sign in to comment.