tguikit 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,95 @@
1
1
  import * as react from 'react';
2
- import { AllHTMLAttributes, Ref, ElementType, ReactNode, HTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, ButtonHTMLAttributes } from 'react';
2
+ import { HTMLAttributes, Ref, ReactNode, BlockquoteHTMLAttributes, AllHTMLAttributes, ElementType, InputHTMLAttributes, ImgHTMLAttributes, AnchorHTMLAttributes, ButtonHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
+
4
+ interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
5
+ ref?: Ref<HTMLDivElement>;
6
+ multiple?: boolean;
7
+ value?: string | string[];
8
+ defaultValue?: string | string[];
9
+ onChange?: (value: string[]) => void;
10
+ }
11
+ declare function Accordion({ ref, multiple, value: valueProp, defaultValue, onChange, className, children, ...rest }: AccordionProps): react.JSX.Element;
12
+ declare namespace Accordion {
13
+ var displayName: string;
14
+ }
15
+
16
+ interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
17
+ ref?: Ref<HTMLDivElement>;
18
+ value: string;
19
+ header: ReactNode;
20
+ }
21
+ declare function AccordionItem({ ref, value, header, className, children, ...rest }: AccordionItemProps): react.JSX.Element;
22
+ declare namespace AccordionItem {
23
+ var displayName: string;
24
+ }
25
+
26
+ type AvatarSize = 20 | 24 | 28 | 40 | 48 | 96;
27
+
28
+ interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
29
+ ref?: Ref<HTMLSpanElement>;
30
+ size?: AvatarSize;
31
+ src?: string;
32
+ alt?: string;
33
+ acronym?: string;
34
+ fallbackIcon?: ReactNode;
35
+ }
36
+ declare function Avatar({ ref, size, src, alt, acronym, fallbackIcon, className, children, ...rest }: AvatarProps): react.JSX.Element;
37
+ declare namespace Avatar {
38
+ var displayName: string;
39
+ }
40
+
41
+ interface AvatarStackProps extends HTMLAttributes<HTMLDivElement> {
42
+ ref?: Ref<HTMLDivElement>;
43
+ overlap?: number;
44
+ }
45
+ declare function AvatarStack({ ref, overlap, className, style, ...rest }: AvatarStackProps): react.JSX.Element;
46
+ declare namespace AvatarStack {
47
+ var displayName: string;
48
+ }
49
+
50
+ type BadgeType = 'number' | 'dot';
51
+ type BadgeMode = 'primary' | 'critical' | 'secondary' | 'gray' | 'white';
52
+
53
+ interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
54
+ ref?: Ref<HTMLSpanElement>;
55
+ type?: BadgeType;
56
+ mode?: BadgeMode;
57
+ large?: boolean;
58
+ children?: ReactNode;
59
+ }
60
+ declare function Badge({ ref, type, mode, large, className, children, ...rest }: BadgeProps): react.JSX.Element;
61
+ declare namespace Badge {
62
+ var displayName: string;
63
+ }
64
+
65
+ type BannerType = 'section' | 'image';
66
+
67
+ interface BannerProps extends HTMLAttributes<HTMLElement> {
68
+ ref?: Ref<HTMLElement>;
69
+ type?: BannerType;
70
+ before?: ReactNode;
71
+ callout?: ReactNode;
72
+ header?: ReactNode;
73
+ subheader?: ReactNode;
74
+ description?: ReactNode;
75
+ actions?: ReactNode;
76
+ background?: ReactNode;
77
+ onClose?: () => void;
78
+ closeLabel?: string;
79
+ }
80
+ declare function Banner({ ref, type, before, callout, header, subheader, description, actions, background, onClose, closeLabel, className, children, ...rest }: BannerProps): react.JSX.Element;
81
+ declare namespace Banner {
82
+ var displayName: string;
83
+ }
84
+
85
+ interface BlockquoteProps extends BlockquoteHTMLAttributes<HTMLQuoteElement> {
86
+ ref?: Ref<HTMLQuoteElement>;
87
+ author?: ReactNode;
88
+ }
89
+ declare function Blockquote({ ref, author, className, children, ...rest }: BlockquoteProps): react.JSX.Element;
90
+ declare namespace Blockquote {
91
+ var displayName: string;
92
+ }
3
93
 
4
94
  type TguiPlatform = 'ios' | 'base';
5
95
  type Appearance = 'light' | 'dark';
@@ -106,6 +196,35 @@ declare namespace Checkbox {
106
196
  var displayName: string;
107
197
  }
108
198
 
199
+ type ChipMode = 'elevated' | 'outline';
200
+
201
+ interface ChipProps extends Omit<AllHTMLAttributes<HTMLElement>, 'onClick'> {
202
+ ref?: Ref<HTMLElement>;
203
+ Component?: ElementType;
204
+ mode?: ChipMode;
205
+ before?: ReactNode;
206
+ after?: ReactNode;
207
+ onClick?: () => void;
208
+ onRemove?: () => void;
209
+ removeLabel?: string;
210
+ }
211
+ declare function Chip({ ref, Component, mode, before, after, onClick, onRemove, removeLabel, className, children, ...rest }: ChipProps): react.JSX.Element;
212
+ declare namespace Chip {
213
+ var displayName: string;
214
+ }
215
+
216
+ type CircularProgressSize = 's' | 'm' | 'l';
217
+
218
+ interface CircularProgressProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'size'> {
219
+ ref?: Ref<HTMLSpanElement>;
220
+ value?: number;
221
+ size?: CircularProgressSize;
222
+ }
223
+ declare function CircularProgress({ ref, value, size, className, ...rest }: CircularProgressProps): react.JSX.Element;
224
+ declare namespace CircularProgress {
225
+ var displayName: string;
226
+ }
227
+
109
228
  interface DividerProps extends HTMLAttributes<HTMLHRElement> {
110
229
  ref?: Ref<HTMLHRElement>;
111
230
  }
@@ -114,6 +233,15 @@ declare namespace Divider {
114
233
  var displayName: string;
115
234
  }
116
235
 
236
+ interface FixedLayoutProps extends HTMLAttributes<HTMLDivElement> {
237
+ ref?: Ref<HTMLDivElement>;
238
+ vertical?: 'top' | 'bottom';
239
+ }
240
+ declare function FixedLayout({ ref, vertical, className, ...rest }: FixedLayoutProps): react.JSX.Element;
241
+ declare namespace FixedLayout {
242
+ var displayName: string;
243
+ }
244
+
117
245
  interface HeadlineProps extends TypographyProps {
118
246
  ref?: Ref<HTMLElement>;
119
247
  }
@@ -122,6 +250,48 @@ declare namespace Headline {
122
250
  var displayName: string;
123
251
  }
124
252
 
253
+ interface HorizontalScrollProps extends HTMLAttributes<HTMLDivElement> {
254
+ ref?: Ref<HTMLDivElement>;
255
+ snap?: boolean;
256
+ fade?: boolean;
257
+ }
258
+ declare function HorizontalScroll({ ref, snap, fade, className, children, ...rest }: HorizontalScrollProps): react.JSX.Element;
259
+ declare namespace HorizontalScroll {
260
+ var displayName: string;
261
+ }
262
+
263
+ type IconButtonMode = 'bezeled' | 'plain' | 'gray' | 'outline';
264
+ type IconButtonSize = 's' | 'm' | 'l';
265
+
266
+ interface IconButtonProps extends Omit<AllHTMLAttributes<HTMLElement>, 'size'> {
267
+ ref?: Ref<HTMLElement>;
268
+ Component?: ElementType;
269
+ mode?: IconButtonMode;
270
+ size?: IconButtonSize;
271
+ circle?: boolean;
272
+ }
273
+ declare function IconButton({ ref, Component, mode, size, circle, type, className, children, ...rest }: IconButtonProps): react.JSX.Element;
274
+ declare namespace IconButton {
275
+ var displayName: string;
276
+ }
277
+
278
+ type Fit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
279
+ interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'width' | 'height'> {
280
+ ref?: Ref<HTMLImageElement>;
281
+ size?: number;
282
+ width?: number | string;
283
+ height?: number | string;
284
+ aspectRatio?: number | string;
285
+ fit?: Fit;
286
+ radius?: number | 'full';
287
+ bordered?: boolean;
288
+ fallback?: ReactNode;
289
+ }
290
+ declare function Image({ ref, size, width, height, aspectRatio, fit, radius, bordered, fallback, src, alt, className, style, onLoad, onError, ...rest }: ImageProps): react.JSX.Element;
291
+ declare namespace Image {
292
+ var displayName: string;
293
+ }
294
+
125
295
  type InputStatus = 'default' | 'error' | 'focused';
126
296
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
127
297
  ref?: Ref<HTMLInputElement>;
@@ -143,6 +313,14 @@ declare namespace LargeTitle {
143
313
  var displayName: string;
144
314
  }
145
315
 
316
+ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
317
+ ref?: Ref<HTMLAnchorElement>;
318
+ }
319
+ declare function Link({ ref, target, rel, className, children, ...rest }: LinkProps): react.JSX.Element;
320
+ declare namespace Link {
321
+ var displayName: string;
322
+ }
323
+
146
324
  interface ListProps extends HTMLAttributes<HTMLElement> {
147
325
  ref?: Ref<HTMLElement>;
148
326
  Component?: ElementType;
@@ -152,6 +330,26 @@ declare namespace List {
152
330
  var displayName: string;
153
331
  }
154
332
 
333
+ interface PinInputProps {
334
+ ref?: Ref<HTMLDivElement>;
335
+ length?: number;
336
+ value?: string;
337
+ defaultValue?: string;
338
+ onChange?: (value: string) => void;
339
+ onComplete?: (value: string) => void;
340
+ type?: 'numeric' | 'alphanumeric';
341
+ mask?: boolean;
342
+ disabled?: boolean;
343
+ invalid?: boolean;
344
+ name?: string;
345
+ 'aria-label'?: string;
346
+ className?: string;
347
+ }
348
+ declare function PinInput({ ref, length, value: valueProp, defaultValue, onChange, onComplete, type, mask, disabled, invalid, name, 'aria-label': ariaLabel, className, }: PinInputProps): react.JSX.Element;
349
+ declare namespace PinInput {
350
+ var displayName: string;
351
+ }
352
+
155
353
  interface PlaceholderProps extends HTMLAttributes<HTMLElement> {
156
354
  ref?: Ref<HTMLElement>;
157
355
  children?: ReactNode;
@@ -164,6 +362,50 @@ declare namespace Placeholder {
164
362
  var displayName: string;
165
363
  }
166
364
 
365
+ interface PortalProps {
366
+ children?: ReactNode;
367
+ container?: Element | DocumentFragment | null;
368
+ }
369
+ declare function Portal({ children, container }: PortalProps): react.ReactPortal | null;
370
+ declare namespace Portal {
371
+ var displayName: string;
372
+ }
373
+
374
+ interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
375
+ ref?: Ref<HTMLDivElement>;
376
+ value?: number;
377
+ }
378
+ declare function Progress({ ref, value, className, ...rest }: ProgressProps): react.JSX.Element;
379
+ declare namespace Progress {
380
+ var displayName: string;
381
+ }
382
+
383
+ interface RadioProps extends InputHTMLAttributes<HTMLInputElement> {
384
+ ref?: Ref<HTMLInputElement>;
385
+ }
386
+ declare function Radio({ ref, disabled, className, style, ...rest }: RadioProps): react.JSX.Element;
387
+ declare namespace Radio {
388
+ var displayName: string;
389
+ }
390
+
391
+ interface RatingProps {
392
+ ref?: Ref<HTMLDivElement>;
393
+ value?: number;
394
+ defaultValue?: number;
395
+ onChange?: (value: number) => void;
396
+ count?: number;
397
+ readOnly?: boolean;
398
+ disabled?: boolean;
399
+ icon?: ReactNode;
400
+ name?: string;
401
+ 'aria-label'?: string;
402
+ className?: string;
403
+ }
404
+ declare function Rating({ ref, value: valueProp, defaultValue, onChange, count, readOnly, disabled, icon, name, 'aria-label': ariaLabel, className, }: RatingProps): react.JSX.Element;
405
+ declare namespace Rating {
406
+ var displayName: string;
407
+ }
408
+
167
409
  interface SectionFooterProps extends HTMLAttributes<HTMLElement> {
168
410
  ref?: Ref<HTMLElement>;
169
411
  centered?: boolean;
@@ -194,6 +436,23 @@ declare namespace Section {
194
436
  var Footer: typeof SectionFooter;
195
437
  }
196
438
 
439
+ interface SegmentedControlProps extends HTMLAttributes<HTMLDivElement> {
440
+ ref?: Ref<HTMLDivElement>;
441
+ }
442
+ declare function SegmentedControl({ ref, className, children, onKeyDown, ...rest }: SegmentedControlProps): react.JSX.Element;
443
+ declare namespace SegmentedControl {
444
+ var displayName: string;
445
+ }
446
+
447
+ interface SegmentedControlItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
448
+ ref?: Ref<HTMLButtonElement>;
449
+ selected?: boolean;
450
+ }
451
+ declare function SegmentedControlItem({ ref, selected, className, ...rest }: SegmentedControlItemProps): react.JSX.Element;
452
+ declare namespace SegmentedControlItem {
453
+ var displayName: string;
454
+ }
455
+
197
456
  interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
198
457
  ref?: Ref<HTMLSelectElement>;
199
458
  header?: ReactNode;
@@ -204,6 +463,102 @@ declare namespace Select {
204
463
  var displayName: string;
205
464
  }
206
465
 
466
+ interface SheetProps {
467
+ ref?: Ref<HTMLDivElement>;
468
+ open: boolean;
469
+ onClose: () => void;
470
+ header?: ReactNode;
471
+ children?: ReactNode;
472
+ dismissable?: boolean;
473
+ closeLabel?: string;
474
+ className?: string;
475
+ container?: Element | DocumentFragment | null;
476
+ }
477
+ declare function Sheet({ ref, open, onClose, header, children, dismissable, closeLabel, className, container, }: SheetProps): react.JSX.Element | null;
478
+ declare namespace Sheet {
479
+ var displayName: string;
480
+ }
481
+
482
+ interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
483
+ ref?: Ref<HTMLDivElement>;
484
+ visible?: boolean;
485
+ children?: ReactNode;
486
+ }
487
+ declare function Skeleton({ ref, visible, className, children, ...rest }: SkeletonProps): react.JSX.Element;
488
+ declare namespace Skeleton {
489
+ var displayName: string;
490
+ }
491
+
492
+ interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange'> {
493
+ ref?: Ref<HTMLInputElement>;
494
+ value?: number;
495
+ defaultValue?: number;
496
+ onChange?: (value: number) => void;
497
+ min?: number;
498
+ max?: number;
499
+ step?: number;
500
+ before?: ReactNode;
501
+ after?: ReactNode;
502
+ }
503
+ declare function Slider({ ref, value: valueProp, defaultValue, onChange, min, max, step, before, after, disabled, className, ...rest }: SliderProps): react.JSX.Element;
504
+ declare namespace Slider {
505
+ var displayName: string;
506
+ }
507
+
508
+ interface SnackbarOptions {
509
+ message: ReactNode;
510
+ description?: ReactNode;
511
+ before?: ReactNode;
512
+ action?: {
513
+ label: string;
514
+ onClick: () => void;
515
+ };
516
+ duration?: number;
517
+ }
518
+ interface SnackbarApi {
519
+ show: (options: SnackbarOptions) => string;
520
+ dismiss: (id: string) => void;
521
+ }
522
+
523
+ interface SnackbarProviderProps {
524
+ children: ReactNode;
525
+ duration?: number;
526
+ max?: number;
527
+ }
528
+ declare function SnackbarProvider({ children, duration, max }: SnackbarProviderProps): react.JSX.Element;
529
+ declare namespace SnackbarProvider {
530
+ var displayName: string;
531
+ }
532
+
533
+ declare function useSnackbar(): SnackbarApi;
534
+
535
+ type SpinnerSize = 's' | 'm' | 'l';
536
+
537
+ interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
538
+ ref?: Ref<HTMLSpanElement>;
539
+ size?: SpinnerSize;
540
+ }
541
+ declare function Spinner({ ref, size, className, ...rest }: SpinnerProps): react.JSX.Element;
542
+ declare namespace Spinner {
543
+ var displayName: string;
544
+ }
545
+
546
+ interface SpoilerProps extends HTMLAttributes<HTMLSpanElement> {
547
+ ref?: Ref<HTMLSpanElement>;
548
+ revealed?: boolean;
549
+ defaultRevealed?: boolean;
550
+ onRevealedChange?: (revealed: boolean) => void;
551
+ revealOn?: 'click' | 'hover';
552
+ accentColor?: string;
553
+ density?: number;
554
+ fps?: number;
555
+ revealLabel?: string;
556
+ }
557
+ declare function Spoiler({ ref, revealed: revealedProp, defaultRevealed, onRevealedChange, revealOn, accentColor, density, fps, revealLabel, className, style, children, onClick, onKeyDown, onMouseEnter, onMouseLeave, ...rest }: SpoilerProps): react.JSX.Element;
558
+ declare namespace Spoiler {
559
+ var displayName: string;
560
+ }
561
+
207
562
  type SubheadlineLevel = '1' | '2';
208
563
 
209
564
  interface SubheadlineProps extends TypographyProps {
@@ -251,6 +606,19 @@ declare namespace Text {
251
606
  var displayName: string;
252
607
  }
253
608
 
609
+ type TextareaStatus = 'default' | 'error' | 'focused';
610
+ interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
611
+ ref?: Ref<HTMLTextAreaElement>;
612
+ header?: ReactNode;
613
+ status?: TextareaStatus;
614
+ autoGrow?: boolean;
615
+ maxRows?: number;
616
+ }
617
+ declare function Textarea({ ref, header, status, autoGrow, maxRows, rows, disabled, className, value, defaultValue, onFocus, onBlur, onChange, ...rest }: TextareaProps): react.JSX.Element;
618
+ declare namespace Textarea {
619
+ var displayName: string;
620
+ }
621
+
254
622
  interface TguiProviderProps extends HTMLAttributes<HTMLDivElement> {
255
623
  ref?: Ref<HTMLDivElement>;
256
624
  platform?: TguiPlatform;
@@ -275,5 +643,20 @@ declare namespace Title {
275
643
  var displayName: string;
276
644
  }
277
645
 
278
- export { Button, Caption, Card, CardCell, Cell, Checkbox, Divider, Headline, Input, LargeTitle, List, Placeholder, Section, SectionFooter, SectionHeader, Select, Subheadline, Switch, TabBar, TabBarItem, Tappable, Text, TguiProvider, Title, Typography, useTgui };
279
- export type { ButtonMode, ButtonProps, ButtonSize, CaptionProps, CardCellProps, CardProps, CardType, CellProps, CheckboxProps, DividerProps, HeadlineProps, InputProps, InputStatus, LargeTitleProps, ListProps, PlaceholderProps, SectionFooterProps, SectionHeaderProps, SectionProps, SelectProps, SubheadlineProps, SwitchProps, TabBarItemProps, TabBarProps, TappableProps, TextProps, TguiProviderProps, TitleProps, TypographyProps };
646
+ type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
647
+ interface TooltipProps {
648
+ ref?: Ref<HTMLSpanElement>;
649
+ children: ReactNode;
650
+ content: ReactNode;
651
+ placement?: TooltipPlacement;
652
+ open?: boolean;
653
+ onOpenChange?: (open: boolean) => void;
654
+ className?: string;
655
+ }
656
+ declare function Tooltip({ ref, children, content, placement, open: openProp, onOpenChange, className, }: TooltipProps): react.JSX.Element;
657
+ declare namespace Tooltip {
658
+ var displayName: string;
659
+ }
660
+
661
+ export { Accordion, AccordionItem, Avatar, AvatarStack, Badge, Banner, Blockquote, Button, Caption, Card, CardCell, Cell, Checkbox, Chip, CircularProgress, Divider, FixedLayout, Headline, HorizontalScroll, IconButton, Image, Input, LargeTitle, Link, List, PinInput, Placeholder, Portal, Progress, Radio, Rating, Section, SectionFooter, SectionHeader, SegmentedControl, SegmentedControlItem, Select, Sheet, Skeleton, Slider, SnackbarProvider, Spinner, Spoiler, Subheadline, Switch, TabBar, TabBarItem, Tappable, Text, Textarea, TguiProvider, Title, Tooltip, Typography, useSnackbar, useTgui };
662
+ export type { AccordionItemProps, AccordionProps, AvatarProps, AvatarSize, AvatarStackProps, BadgeMode, BadgeProps, BadgeType, BannerProps, BannerType, BlockquoteProps, ButtonMode, ButtonProps, ButtonSize, CaptionProps, CardCellProps, CardProps, CardType, CellProps, CheckboxProps, ChipMode, ChipProps, CircularProgressProps, CircularProgressSize, DividerProps, FixedLayoutProps, HeadlineProps, HorizontalScrollProps, IconButtonMode, IconButtonProps, IconButtonSize, ImageProps, InputProps, InputStatus, LargeTitleProps, LinkProps, ListProps, PinInputProps, PlaceholderProps, PortalProps, ProgressProps, RadioProps, RatingProps, SectionFooterProps, SectionHeaderProps, SectionProps, SegmentedControlItemProps, SegmentedControlProps, SelectProps, SheetProps, SkeletonProps, SliderProps, SnackbarApi, SnackbarOptions, SnackbarProviderProps, SpinnerProps, SpinnerSize, SpoilerProps, SubheadlineProps, SwitchProps, TabBarItemProps, TabBarProps, TappableProps, TextProps, TextareaProps, TextareaStatus, TguiProviderProps, TitleProps, TooltipPlacement, TooltipProps, TypographyProps };