Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 5a02542

Browse files
committed
fix(types): fix TypeScript definitions
1 parent 87eda0b commit 5a02542

File tree

5 files changed

+32
-71
lines changed

5 files changed

+32
-71
lines changed

β€Žpackages/shared/core/index.d.tsβ€Ž

Lines changed: 24 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
import * as React from 'react'
44

5-
export type DefaultColors = 'primary'
6-
| 'secondary'
7-
| 'success'
8-
| 'danger'
9-
| 'warning'
10-
| 'info'
11-
| 'light'
12-
| 'dark'
13-
14-
export type Sizes = "sm" | "md" | "lg"
5+
export type DefaultColors =
6+
| 'primary'
7+
| 'secondary'
8+
| 'success'
9+
| 'danger'
10+
| 'warning'
11+
| 'info'
12+
| 'light'
13+
| 'dark'
14+
15+
export type Sizes = 'sm' | 'md' | 'lg'
1516

1617
interface InputType {
1718
checked?: boolean
@@ -124,6 +125,7 @@ interface TogglerRenderProps {
124125
onToggle: (state?: boolean) => void
125126
toggled: boolean
126127
}
128+
127129
interface TogglerProps {
128130
children: (props: TogglerRenderProps) => React.ReactNode
129131
defaultToggled?: boolean
@@ -160,7 +162,7 @@ export interface BoxProps
160162
type Omit<T, K> = Pick<T, Exclude<keyof T, keyof K>>
161163

162164
export type OmitBoxProps<T> = Omit<T, BoxProps>
163-
type OmitFontProps<T> = Omit<T,FontProps>
165+
type OmitFontProps<T> = Omit<T, FontProps>
164166

165167
export const Box: React.FunctionComponent<BoxProps>
166168

@@ -198,7 +200,7 @@ export interface FormCheckProps extends BoxProps {
198200
export const FormCheck: React.FunctionComponent<FormCheckProps>
199201

200202
export const FormCheckLabel: React.FunctionComponent<
201-
BoxProps & React.HTMLProps<HTMLLabelElement>
203+
BoxProps & React.HTMLProps<HTMLLabelElement>
202204
>
203205

204206
export interface FormGroupProps extends BoxProps {
@@ -235,9 +237,9 @@ export const Label: React.FunctionComponent<LabelProps>
235237

236238
export interface RadioProps
237239
extends Omit<React.HTMLProps<HTMLInputElement>, BoxProps & { size: any }>,
238-
OmitFontProps<BoxProps> {
240+
OmitFontProps<BoxProps> {
239241
checked?: boolean
240-
disabled?:boolean
242+
disabled?: boolean
241243
size?: Sizes
242244
value?: string
243245
}
@@ -454,10 +456,6 @@ export interface ThemeType {
454456
inputPlaceholderText: (props: Object) => string
455457
inputTextColor: (props: Object) => string
456458

457-
controlFocusBorderColor: (props: Object) => string
458-
459-
controlFocusBoxShadow: (props: Object) => (color: string) => string
460-
461459
gridColumns: 12
462460
gridGutter: 8
463461

@@ -476,15 +474,15 @@ export interface ThemeType {
476474
alertBorderLevel: -9
477475
alertColorLevel: 6
478476

479-
alertVariant: (props: Object) => (baseColorTheme: Object) => AlertColorVariant
477+
alertVariant: (baseColorTheme: Object) => (props: Object) => AlertColorVariant
480478

481479
zIndexControl: 1
482480
zIndexInnerSwitch: 10
483481
zIndexModal: 1050
484482
zIndexModalBackdrop: 1071
485483

486484
transitionEnabled: true
487-
transition: (props: Object) => (value: string) => string
485+
transition: (value: string) => (props: Object) => string
488486

489487
safeTransitionProperties: [
490488
'color',
@@ -560,24 +558,17 @@ export interface ThemeType {
560558

561559
base: () => () => (props: Object) => string
562560

563-
controlFocus: (
564-
props: Object,
565-
) => (baseColor: string) => (props: Object) => string
561+
controlFocus: (baseColor: string) => (props: Object) => string
562+
baseFocus: (baseColor: string) => (props: Object) => string
566563

567-
btnVariant: (
568-
props: Object,
569-
) => (baseColor: string) => (props: Object) => string
564+
btnVariant: (baseColor: string) => (props: Object) => string
570565

571566
colorLevel: (
572-
props: Object,
573-
) => (
574567
color: (props: Object) => string | string,
575568
level: (props: Object) => string | string,
576-
) => string
569+
) => (props: Object) => string
577570

578-
colorYik: (
579-
props: Object,
580-
) => (color: (props: Object) => string | string) => string
571+
colorYik: (color: string) => (props: Object) => string
581572
}
582573

583574
export const theme: ThemeType
@@ -590,23 +581,11 @@ interface AlertColorVariant {
590581
}
591582
}
592583

593-
export const lazyTh: (name: string) => (props: Object) => string
594-
595584
export const th: (
596585
name: string,
597586
transform?: (res: any) => string,
598587
) => (props: Object) => string
599588

600-
export const mixin: (
601-
name: string,
602-
...args: Array<string>
603-
) => (props: Object) => string
604-
605-
export const prop: (
606-
name: string,
607-
themeFallback?: string,
608-
) => (props: Object) => string
609-
610589
export const calc: (
611590
value: string,
612591
fn: (num: string | number) => string,
@@ -616,19 +595,6 @@ export const unit: (unit: string) => (value: number | string) => string
616595

617596
export const px: ReturnType<typeof unit>
618597

619-
interface styleArg {
620-
prop: string
621-
cssProperty: string
622-
transform: Function
623-
variants: Array<string>
624-
}
625-
626-
export function style(arg: styleArg): (props: Object) => Object
627-
628-
export const composeStyles: (
629-
...funcs: Array<(props: Object) => string>
630-
) => ((props: Object) => Object)
631-
632598
export interface ModalProps extends BoxProps {
633599
children?: React.ReactNode
634600
onClose?: () => void
@@ -695,20 +661,7 @@ export const DEFAULT_BREAKPOINTS: {
695661
xl: 1200
696662
}
697663

698-
export const getBreakpoints: (props: Object) => Object
699-
700-
export const getBreakpointsEntries: (props: Object) => Array<Array<string>>
701-
702-
export const getNextBreakpoint: (name: string, props: Object) => null | string
703-
704-
export const getPreviousBreakpoint: (
705-
name: string,
706-
props: Object,
707-
) => null | string
708-
709-
export const getBreakpointMin: (name: string, props: Object) => null | number
710-
711-
export const getBreakpointMax: (name: string, props: Object) => null | number
664+
export const breakpoints: (props: Object) => Object
712665

713666
export const mediaMinWidth: (value: number | string) => string
714667

β€Žpackages/shared/core/theming/index.jsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export * from './heading'
88
export * from './input'
99
export * from './modal'
1010
export * from './responsive'
11+
export * from './space'
1112
export * from './transition'
1213
export * from './typography'
1314
export * from './zIndexes'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { thd } from '../utils/index'
2+
3+
export const spaces = thd('spaces', [0, 8, 16, 24, 32, 40, 48, 56, 64, 72])
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export { colors } from './color'
2+
export { fontSizes } from './typography'
3+
export { spaces } from './space'

β€Žpackages/shared/core/theming/typography.jsβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { modularScale } from 'polished'
22
import { thd } from '../utils/index'
33

4+
export const fontSizes = thd('fontSizes', [12, 14, 16, 20, 24, 32, 48, 64, 72])
5+
46
export const fontFamily = thd(
57
'fontFamily',
68
'-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif',

0 commit comments

Comments
Β (0)