-
Notifications
You must be signed in to change notification settings - Fork 829
/
index.d.ts
3486 lines (3219 loc) · 106 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// @ts-nocheck Disabling TS checking on this file while definitions are being ported over to src files
import * as React from 'react'
import { DownshiftProps } from 'downshift'
import { TransitionProps, TransitionStatus } from 'react-transition-group/Transition'
import { extractStyles as boxExtractStyles, BoxProps, BoxComponent, PolymorphicBoxProps } from 'ui-box'
/**
* Generated types that are used for composition in manually written types need to be imported to be resolved
*/
import type { PaneOwnProps } from './types'
export type {
BoxProps,
BoxOwnProps,
BoxComponent,
PolymorphicBoxProps,
EnhancerProps,
BoxCssProps,
CssProps
} from 'ui-box'
export { configureSafeHref } from 'ui-box'
/**
* Re-export generated types through this manually written typedef file until we can point to the generated index.d.ts file
*/
export type { PaneProps, PaneOwnProps } from './types'
/**
* Re-export generated types through this manually written typedef file until we can point to the generated index.d.ts file
*/
export { Pane } from './types'
// Re-exporting these utility types for testing + consumer usage if needed
export type Pick<T, Properties extends keyof T> = { [Key in Properties]: T[Key] }
export type Partial<T> = { [Key in keyof T]?: T[Key] }
export type PositionTypes =
| 'top'
| 'top-left'
| 'top-right'
| 'bottom'
| 'bottom-left'
| 'bottom-right'
| 'left'
| 'right'
export type IntentTypes = string
export type DefaultAppearance = 'default'
export type Small = 'small'
export type Medium = 'medium'
export type Large = 'large'
export type StandardSizes = Small | Medium | Large
export type AlertAppearance = DefaultAppearance | 'card'
export type ButtonAppearance = string
export type CodeAppearance = DefaultAppearance | 'minimal'
export type CheckboxAppearance = DefaultAppearance
export type IconButtonAppearance = DefaultAppearance | 'minimal' | 'primary'
export type TextInputAppearance = DefaultAppearance | 'primary'
export type TooltipAppearance = DefaultAppearance | 'card'
export type PositionState = 'exited' | 'entering' | 'entered' | 'exiting'
export type FontFamily = 'ui' | 'display' | 'mono'
export type Elevation = 0 | 1 | 2 | 3 | 4
export type FontSizeSmall = 300 | 400
export type HeadingSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
export type Size = number | string
export type Components =
| 'Alert'
| 'Avatar'
| 'Badge'
| 'Button'
| 'Card'
| 'Checkbox'
| 'Code'
| 'DialogBody'
| 'DialogFooter'
| 'DialogHeader'
| 'FileCard'
| 'FileUploader'
| 'Group'
| 'Heading'
| 'Icon'
| 'InlineAlert'
| 'Input'
| 'Label'
| 'Link'
| 'List'
| 'MenuItem'
| 'Option'
| 'Pane'
| 'Paragraph'
| 'Radio'
| 'Select'
| 'Spinner'
| 'Switch'
| 'Tab'
| 'Table'
| 'TableCell'
| 'TableHead'
| 'TableRow'
| 'TagInput'
| 'Text'
| 'TextDropdownButton'
| 'Tooltip'
type ButtonPseudoSelectors = '_active' | '_disabled' | '_focus' | '_focusAndActive' | '_hover' | '_disabled'
type CheckboxPseudoSelectors =
| '_base'
| '_disabled'
| '_hover'
| '_focus'
| '_active'
| '_checked'
| '_checkedActive'
| '_checkedDisabled'
| '_checkedHover'
type GroupPseudoSelectors = '_child' | '_firstChild' | '_middleChild' | '_lastChild' | '&:focus' | '&:active'
type FileCardPseudoSelectors = '_invalid'
type FileUploaderPseudoSelectors =
| '_focus'
| '_hover'
| '_hoverBrowseCopy'
| '_hoverOrDragCopy'
| '_disabled'
| '_dragHover'
| '_invalid'
type InputPseudoSelectors = '_placeholder' | '_disabled' | '_focus' | '_invalid'
type LinkPseudoSelectors = '_hover' | '_active' | '_focus'
type MenuItemPseudoSelectors = '_isSelectable' | '_disabled' | '_hover' | '_focus' | '_active' | '_current' | '&:before'
type OptionPseudoSelectors = '_active' | '_before' | '_disabled' | '_focus' | '_hover' | '_isSelectable' | '_selected'
type RadioPseudoSelectors =
| '_base'
| '_disabled'
| '_hover'
| '_focus'
| '_active'
| '_checked'
| '_checkedHover'
| '_checkedActive'
| '_checkedDisabled'
type SelectPseudoSelectors = '_disabled' | '_hover' | '_invalid' | '_focus' | '_active'
type SwitchPseudoSelectors =
| '_base'
| '_disabled'
| '_hover'
| '_focus'
| '_active'
| '_checked'
| '_checkedHover'
| '_checkedActive'
| '_checkedDisabled'
type TabPseudoSelectors = '_before' | '_hover' | '_current' | '_focus' | '_disabled'
type TableCellPseudoSelectors = '_focus'
type TableRowPseudoSelectors = '_isSelectable' | '_hover' | '_focus' | '_active' | '_current'
type TagInputPseudoSelectors = '_focused' | '_disabled'
type TextDropdownButtonPseudoSelectors = '_disabled' | '_focus'
type ComponentAppearances<C extends Components = Components> = C extends 'Button'
? DefaultThemeButtonAppearance
: C extends 'Input'
? DefaultThemeInputAppearance
: C extends 'Tooltip'
? DefaultThemeTooltipAppearance
: C extends 'Tab'
? DefaultThemeTabAppearance
: C extends
| 'Checkbox'
| 'Code'
| 'MenuItem'
| 'Radio'
| 'Select'
| 'Switch'
| 'Tab'
| 'TableCell'
| 'TableRow'
| 'TagInput'
? DefaultAppearance
: ''
type ComponentSizes<C extends Components = Components> = C extends 'Button'
? DefaultThemeButtonSize
: C extends 'Text'
? DefaultThemeTextSize
: C extends 'Heading'
? DefaultThemeHeadingSize
: C extends 'Input'
? DefaultThemeInputSize
: C extends 'Label'
? DefaultThemeLabelSize
: C extends 'Paragraph'
? DefaultThemeParagraphSize
: C extends 'Select'
? DefaultThemeSelectSize
: C extends 'Spinner'
? DefaultThemeSpinnerSize
: C extends 'TextDropdownButton'
? DefaultThemeTextDropdownButtonSize
: ''
type ComponentPseudoSelectors<C extends Components = Components> = C extends 'Button'
? ButtonPseudoSelectors
: C extends 'Checkbox'
? CheckboxPseudoSelectors
: C extends 'FileCard'
? FileCardPseudoSelectors
: C extends 'FileUploader'
? FileUploaderPseudoSelectors
: C extends 'Group'
? GroupPseudoSelectors
: C extends 'Input'
? InputPseudoSelectors
: C extends 'Link'
? LinkPseudoSelectors
: C extends 'MenuItem'
? MenuItemPseudoSelectors
: C extends 'Option'
? OptionPseudoSelectors
: C extends 'Radio'
? RadioPseudoSelectors
: C extends 'Select'
? SelectPseudoSelectors
: C extends 'Switch'
? SwitchPseudoSelectors
: C extends 'Tab'
? TabPseudoSelectors
: C extends 'TableCell'
? TableCellPseudoSelectors
: C extends 'TableRow'
? TableRowPseudoSelectors
: C extends 'TagInput'
? TagInputPseudoSelectors
: C extends 'TextDropdownButton'
? TextDropdownButtonPseudoSelectors
: ''
export type DefaultThemeButtonSize = StandardSizes
export type DefaultThemeTextSize = 300 | 400 | 500 | 600 | StandardSizes
export type DefaultThemeHeadingSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
export type DefaultThemeInputAppearance = DefaultAppearance | 'none'
export type DefaultThemeInputSize = StandardSizes
export type DefaultThemeLabelSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
export type DefaultThemeParagraphSize = 300 | 400 | 500 | 600 | StandardSizes
export type DefaultThemeSelectSize = StandardSizes
export type DefaultThemeSpinnerSize = StandardSizes
export type DefaultThemeTextDropdownButtonSize = StandardSizes
export type DefaultThemeTooltipAppearance = 'card' | DefaultAppearance
export type DefaultThemeTabAppearance = 'primary' | 'secondary'
export type DefaultThemeButtonAppearance = DefaultAppearance | 'minimal' | 'destructive' | 'primary'
export type DefaultThemeFill = 'neutral' | 'blue' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'purple'
export type DefaultThemeIntent = 'info' | 'success' | 'warning' | 'danger'
export type DefaultThemeColors =
| 'gray900'
| 'gray800'
| 'gray700'
| 'gray600'
| 'gray500'
| 'gray400'
| 'gray300'
| 'gray200'
| 'gray100'
| 'gray90'
| 'gray75'
| 'gray50'
| 'white'
| 'blue900'
| 'blue800'
| 'blue700'
| 'blue600'
| 'blue500'
| 'blue400'
| 'blue300'
| 'blue200'
| 'blue100'
| 'blue50'
| 'blue25'
| 'red700'
| 'red600'
| 'red500'
| 'red300'
| 'red100'
| 'red25'
| 'green900'
| 'green800'
| 'green700'
| 'green600'
| 'green500'
| 'green400'
| 'green300'
| 'green200'
| 'green100'
| 'green25'
| 'orange700'
| 'orange500'
| 'orange100'
| 'orange25'
| 'purple600'
| 'purple100'
| 'teal800'
| 'teal100'
| 'yellow800'
| 'yellow100'
| 'muted'
| 'default'
| 'dark'
| 'selected'
| 'tint1'
| 'tint2'
| 'overlay'
| 'yellowTint'
| 'greenTint'
| 'orangeTint'
| 'redTint'
| 'blueTint'
| 'purpleTint'
| 'tealTint'
type BaseHTMLElement<T extends Components = Components> = T extends 'Button' | 'IconButton' | 'TextDropdownButton'
? 'button'
: T extends 'Icon'
? 'svg'
: T extends 'Paragraph'
? 'p'
: T extends 'Link'
? 'a'
: T extends 'Text' | 'Tab'
? 'span'
: T extends 'Checkbox' | 'Input'
? 'input'
: T extends 'Label'
? 'label'
: 'div'
/** Allow these properties to be tokenizable (i.e. assignable as a string) */
type TokenizableProps = 'elevation' | 'fontWeight' | 'zIndex'
type PolymorphicBoxPropsOrTokens<T extends Components = Components> = Omit<
PolymorphicBoxProps<BaseHTMLElement<T>>,
TokenizableProps
> & { [key in TokenizableProps]?: string }
export type StyleProps<T extends Components = Components> = Omit<PolymorphicBoxPropsOrTokens<T>, 'selectors'> & {
selectors: Partial<{
[key in ComponentPseudoSelectors<T>]: PolymorphicBoxPropsOrTokens<T>
}>
}
export type ComponentStyle<T extends Components = Components> = {
baseStyle?: Partial<StyleProps<T>>
appearances?: { [appearance: string]: Partial<StyleProps<T>> }
sizes?: { [size: Size]: Partial<StyleProps<T>> }
}
export type ComponentStyles<T extends Components = Components> = {
[Component in T]: Partial<ComponentStyle<Component>>
}
export interface Theme<TComponents extends Components = Components> {
colors: { [color: string]: Color<string | string[] | { [group: string]: Color }> }
fills: { [fill: string]: Fill }
intents: { [intent: string]: Intent }
fontFamilies: FontFamilies
radii: string[]
shadows: string[] & { focusRing: string }
fontSizes: string[]
fontWeights: FontWeights
letterSpacings: LettingSpacings
lineHeights: string[]
zIndices: ZIndices
components: Partial<ComponentStyles<TComponents>>
}
export type Color<T extends string | string[] | { [group: string]: Color } = string> = T
export interface Fill {
backgroundColor: string
color: string
}
export interface Intent {
background: string
border: string
text: string
icon: string
}
export interface FontFamilies {
display: string
ui: string
mono: string
}
export interface FontWeights {
light: number
normal: number
semibold: number
bold: number
}
export interface LettingSpacings {
tightest: string
tighter: string
tight: string
normal: string
wide: string
}
export interface ZIndices {
focused: number
stack: number
positioner: number
overlay: number
toaster: number
}
export interface DefaultTheme extends Theme {
colors: { [color in DefaultThemeColors]: Color } & {
border: Color<{ default: string; muted: string }>
icon: Color<{
default: string
muted: string
disabled: string
selected: string
}>
text: Color<{ danger: string; success: string; info: string }>
}
fills: { [fill in DefaultThemeFill]: Fill }
intents: { [intent in DefaultThemeIntent]: Intent }
components: {
[Component in Components]: {
baseStyle: Partial<StyleProps<Component>>
appearances: Record<string & ComponentAppearances<Component>, Partial<StyleProps<Component>>>
sizes: Record<Size & ComponentSizes<Component>, Partial<StyleProps<Component>>>
}
}
}
export const defaultTheme: DefaultTheme
/**
* Basic error codes for why a file is rejected or in an errored state
*/
export enum FileRejectionReason {
FileTooLarge = 'FILE_TOO_LARGE',
InvalidFileType = 'INVALID_FILE_TYPE',
OverFileLimit = 'OVER_FILE_LIMIT',
Unknown = 'UNKNOWN'
}
/**
* Non-exhaustive list of common MimeTypes
*/
export enum MimeType {
css = 'text/css',
csv = 'text/csv',
doc = 'application/msword',
docx = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
gif = 'image/gif',
gz = 'application/gzip',
ico = 'image/vnd.microsoft.icon',
jpeg = 'image/jpeg',
js = 'text/javascript',
json = 'application/json',
mp3 = 'audio/mpeg',
mp4 = 'video/mp4',
mpeg = 'video/mpeg',
pdf = 'application/pdf',
png = 'image/png',
ppt = 'application/vnd.ms-powerpoint',
pptx = 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
rar = 'application/vnd.rar',
rtf = 'application/rtf',
svg = 'image/svg+xml',
tar = 'application/x-tar',
tiff = 'image/tiff',
txt = 'text/plain',
wav = 'audio/wav',
webp = 'image/webp',
xls = 'application/vnd.ms-excel',
xlsx = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
xml = 'application/xml',
zip = 'application/zip'
}
export enum Position {
TOP = 'top',
TOP_LEFT = 'top-left',
TOP_RIGHT = 'top-right',
BOTTOM = 'bottom',
BOTTOM_LEFT = 'bottom-left',
BOTTOM_RIGHT = 'bottom-right',
LEFT = 'left',
RIGHT = 'right'
}
type ForwardRefComponent<P = {}, T = any> = React.ForwardRefExoticComponent<
React.PropsWithoutRef<P> & React.RefAttributes<T>
>
export interface AlertOwnProps extends PaneOwnProps {
intent?: IntentTypes
title?: React.ReactNode
/**
* When true, show a icon on the left matching the type,
*/
hasIcon?: boolean
/**
* When true, show a remove icon button.
*/
isRemoveable?: boolean
/**
* Function called when the remove button is clicked.
*/
onRemove?: (event: React.MouseEvent<HTMLButtonElement> | React.TouchEvent<HTMLButtonElement>) => void
/**
* The appearance of the alert.
*/
appearance?: AlertAppearance
}
export type AlertProps = PolymorphicBoxProps<'div', AlertOwnProps>
export declare const Alert: BoxComponent<AlertOwnProps, 'div'>
interface OptionProps extends TableRowOwnProps {
height?: number | string
label?: string
icon?: string
disabled?: boolean
}
export interface AutocompleteItemProps extends OptionProps {
children?: JSX.Element | null
}
export declare const AutocompleteItem: ForwardRefComponent<AutocompleteItemProps>
// https://github.com/downshift-js/downshift
export interface AutocompleteProps extends Omit<DownshiftProps<any>, 'children'> {
title?: React.ReactNode
items: any[]
allowOtherValues?: boolean
renderItem?: (i: AutocompleteItemProps) => JSX.Element | null
itemsFilter?: (items: string[], input: string) => string[]
children: (props: {
toggle: () => void
getRef: React.Ref<any>
isShown: NonNullable<PopoverProps['isShown']>
getInputProps: <T>(options?: T) => T & {
onChange: (event: React.ChangeEvent) => void
onKeyDown: (event: React.KeyboardEvent) => void
onBlur: (event: React.FocusEvent) => void
id: string
value: string
'aria-autocomplete': 'list'
'aria-activedescendant'?: string
'aria-controls'?: string
'aria-labelledby': string
autoComplete: 'off'
}
openMenu: () => any
inputValue: string
}) => React.ReactNode
itemSize?: number
position?: PositionTypes
isFilterDisabled?: boolean
popoverMinWidth?: number
popoverMaxHeight?: number
selectedItem?: any
buttonProps?: ButtonOwnProps
onChange: (selectedItem: any) => void
}
export declare const Autocomplete: ForwardRefComponent<AutocompleteProps>
export interface AvatarOwnProps {
src?: string
size?: number
/**
* When provided, the first and last initial of the name will be used.
* For example: Foo Bar -> FB
*/
name?: string | null
hashValue?: string
color?: string
shape?: 'round' | 'square'
getInitials?: (name: string) => string
forceShowInitials?: boolean
sizeLimitOneCharacter?: number
}
export type AvatarProps = PolymorphicBoxProps<'div', AvatarOwnProps>
export declare const Avatar: BoxComponent<AvatarOwnProps>
export interface BadgeOwnProps extends StrongOwnProps {
/**
* The color used for the badge. When the value is `automatic`, use the hash function to determine the color.
*/
color?: 'neutral' | 'blue' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'purple'
/**
* Whether or not to apply hover/focus/active styles.
*/
isInteractive?: boolean
}
export type BadgeProps = PolymorphicBoxProps<'strong', BadgeOwnProps>
export declare const Badge: BoxComponent<BadgeOwnProps, 'strong'>
export interface ButtonOwnProps {
intent?: IntentTypes
appearance?: ButtonAppearance
/**
* When true, show a loading spinner before the children.
* This also disables the button.
*/
isLoading?: boolean
/**
* Forcefully set the active state of a button.
* Useful in conjuction with a Popover.
*/
isActive?: boolean
/**
* Sets an icon before the text. Can be any icon from Evergreen or a custom icon library.
*/
iconBefore?: React.ElementType | JSX.Element | null | false
/**
* Sets an icon after the text. Can be any icon from Evergreen or a custom icon library.
*/
iconAfter?: React.ElementType | JSX.Element | null | false
/**
* When true, the button is disabled.
* isLoading also sets the button to disabled.
*/
disabled?: boolean
/**
* Class name passed to the button.
*/
className?: string
/**
* Size of the button
*/
size?: 'small' | 'medium' | 'large'
}
export type ButtonProps = PolymorphicBoxProps<'button', ButtonOwnProps>
export declare const Button: BoxComponent<ButtonOwnProps, 'button'>
export type CardOwnProps = PaneOwnProps
export type CardProps = PolymorphicBoxProps<'div', CardOwnProps>
export declare const Card: BoxComponent<CardOwnProps, 'div'>
export interface CheckboxOwnProps {
/**
* The id attribute of the checkbox.
*/
id?: string
/**
* The id attribute of the radio.
*/
name?: string
/**
* Label of the checkbox.
*/
label?: React.ReactNode
/**
* The value attribute of the radio.
*/
value?: string
/**
* The checked attribute of the radio.
*/
checked?: boolean
/**
* State in addition to "checked" and "unchecked".
* When true, the radio displays a "minus" icon.
*/
indeterminate?: boolean
/**
* When true, the radio is disabled.
*/
disabled?: boolean
/**
* When true, the aria-invalid attribute is true.
* Used for accessibility.
*/
isInvalid?: boolean
/**
* The appearance of the checkbox.
* The default theme only comes with a default style.
*/
appearance?: CheckboxAppearance
/**
* Function called when state changes.
*/
onChange?(event: React.ChangeEvent<HTMLInputElement>): void
}
export type CheckboxProps = PolymorphicBoxProps<'input', CheckboxOwnProps>
export declare const Checkbox: BoxComponent<CheckboxOwnProps, 'input'>
export type CodeOwnProps = TextOwnProps & { appearance?: CodeAppearance }
export type CodeProps = PolymorphicBoxProps<'code', CodeOwnProps>
export declare const Code: BoxComponent<CodeOwnProps, 'code'>
export interface ComboboxOwnProps {
/**
* The options to show in the menu.
*/
items: AutocompleteProps['items']
/**
* The selected item when controlled.
*/
selectedItem?: AutocompleteProps['selectedItem']
/**
* Function called when value changes.
*/
onChange?: AutocompleteProps['onChange']
/**
* Properties forwarded to the autocomplete component. Use with caution.
*/
autocompleteProps?: Omit<AutocompleteProps, 'children' | 'items' | 'onChange'>
/**
* When true, open the autocomplete on focus.
*/
openOnFocus?: boolean
/**
* Default selected item when uncontrolled.
*/
initialSelectedItem?: any
/**
* The placeholder text when there is no value present.
*/
placeholder?: string
/**
* In case the array of items is not an array of strings,
* this function is used on each item to return the string that will be shown on the filter
*/
itemToString?: AutocompleteProps['itemToString']
/**
* Properties forwarded to the input. Use with caution.
*/
inputProps?: TextInputOwnProps
/**
* Properties forwarded to the button. Use with caution.
*/
buttonProps?: IconButtonOwnProps
/**
* Makes the input element disabled.
*/
disabled?: boolean
/**
* When true, show a loading spinner. This also disables the button.
*/
isLoading?: boolean
/**
* Size of the component
*/
size?: 'small' | 'medium' | 'large'
}
export type ComboboxProps = PolymorphicBoxProps<'div', ComboboxOwnProps>
export declare const Combobox: BoxComponent<ComboboxOwnProps>
export interface CornerDialogProps {
/**
* Children can be a string, node or a function accepting `({ close })`.
* When passing a string, <Paragraph /> is used to wrap the string.
*/
children?: React.ReactNode | (({ close }: { close: () => void }) => void)
/**
* The intent of the Dialog. Used for the button. Defaults to none.
*/
intent?: IntentTypes
/**
* When true, the dialog is shown. Defaults to false.
*/
isShown?: boolean
/**
* Title of the Dialog. The text for the title should use Title Case.
*/
title?: string | React.ReactNode
/**
* Function that will be called when the exit transition is complete.
*/
onCloseComplete?: () => void
/**
* Function that will be called when the enter transition is complete.
*/
onOpenComplete?: () => void
/**
* When true, the footer with the cancel and confirm button is shown.
* Defaults to true.
*/
hasFooter?: boolean
/**
* Function that will be called when the confirm button is clicked.
* This does not close the Dialog. A close function will be passed
* as a paramater you can use to close the dialog.
* If unspecified, this defaults to closing the Dialog.
*/
onConfirm?: (close: () => void) => void
/**
* Label of the confirm button. Default to 'Confirm'.
*/
confirmLabel?: string
/**
* When true, the cancel button is shown. Defaults to true.
*/
hasCancel?: boolean
/**
* When true, the close button is shown. Defaults to true.
*/
hasClose?: boolean
/**
* Function that will be called when the cancel button is clicked.
* This closes the Dialog by default.
*/
onCancel?: (close: () => void) => void
/**
* Label of the cancel button. Defaults to 'Cancel'.
*/
cancelLabel?: string
/**
* Width of the Dialog.
*/
width?: string | number
/**
* Props that are passed to the dialog container.
*/
containerProps?: React.ComponentProps<typeof Card>
/**
* Props that will set position of corner dialog
*/
position?: Exclude<PositionTypes, 'top' | 'bottom' | 'left' | 'right'>
}
export declare const CornerDialog: React.FC<CornerDialogProps>
export interface DialogProps
extends Pick<OverlayProps, 'isShown' | 'preventBodyScrolling' | 'shouldAutoFocus' | 'shouldCloseOnEscapePress'> {
/**
* Children can be a string, node or a function accepting `({ close })`.
* When passing a string, <Paragraph /> is used to wrap the string.
*/
children?: React.ReactNode | (({ close }: { close: () => void }) => void)
/**
* The intent of the Dialog. Used for the button.
* @default none
*/
intent?: IntentTypes
/**
* Title of the Dialog. Titles should use Title Case.
*/
title?: React.ReactNode
/**
* When true, the header with the title and close icon button is shown.
* @default true
*/
hasHeader?: boolean
/**
* You can override the default header with your own custom component.
*
* This is useful if you want to provide a custom header and footer, while
* also enabling your Dialog's content to scroll.
*
* Header can either be a React node or a function accepting `({ close })`.
*/
header?: React.ReactNode | (({ close }: { close: () => void }) => void)
/**
* When true, the footer with the cancel and confirm button is shown.
* @default true
*/
hasFooter?: boolean
/**
* You can override the default footer with your own custom component.
*
* This is useful if you want to provide a custom header and footer, while
* also enabling your Dialog's content to scroll.
*
* Footer can either be a React node or a function accepting `({ close })`.
*/
footer?: React.ReactNode | (({ close }: { close: () => void }) => void)
/**
* When true, the cancel button is shown.
* @default true
*/
hasCancel?: boolean
/**
* When true, the close button is shown.
* @default true
*/
hasClose?: boolean
/**
* Function that will be called when the exit transition is complete.
*/
onCloseComplete?: () => void
/**
* Function that will be called when the enter transition is complete.
*/
onOpenComplete?: () => void
/**
* Function that will be called when the confirm button is clicked.
* This does not close the Dialog. A close function will be passed
* as a parameter you can use to close the dialog.
* If unspecified, this defaults to closing the Dialog.
*/
onConfirm?: (close: () => void) => void
/**
* Label of the confirm button.
* @default Confirm
*/
confirmLabel?: string
/**
* When true, the confirm button is set to loading.
* @default false
*/
isConfirmLoading?: boolean
/**
* When true, the confirm button is set to disabled.
* @default false
*/
isConfirmDisabled?: boolean
/**
* Function that will be called when the cancel button is clicked.
* This closes the Dialog by default.
*/
onCancel?: (close: () => void) => void
/**
* Label of the cancel button.
* @default Cancel
*/
cancelLabel?: string
/**
* Boolean indicating if clicking the overlay should close the overlay.
* @default true
*/
shouldCloseOnOverlayClick?: boolean
/**
* Width of the Dialog.
*/
width?: string | number
/**
* The space above the dialog.
* This offset is also used at the bottom when there is not enough vertical
* space available on screen — and the dialog scrolls internally.
*/
topOffset?: string | number
/**
* The space on the left/right sides of the dialog when there isn't enough
* horizontal space available on screen.
*/
sideOffset?: string | number
/**
* The min height of the body content.
* Makes it less weird when only showing little content.
*/
minHeightContent?: string | number
/**
* Props that are passed to the dialog container.
*/
containerProps?: React.ComponentProps<typeof Pane>
/**
* Props that are passed to the content container.
*/
contentContainerProps?: React.ComponentProps<typeof Pane>
/**
* Props that are passed to the Overlay component.
*/
overlayProps?: React.ComponentProps<typeof Pane>
}
export declare const Dialog: React.FC<DialogProps>
export interface EmptyStateOwnProps {
/** the title of the empty state */
title: string
/** the icon used in the empty state */
icon: React.ReactNode
/** the background used for the icon circle */
iconBgColor: string