tguikit 0.2.0 → 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,27 @@
1
1
  import * as react from 'react';
2
- import { HTMLAttributes, Ref, ReactNode, AllHTMLAttributes, ElementType, InputHTMLAttributes, SelectHTMLAttributes, ButtonHTMLAttributes, TextareaHTMLAttributes } 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
+ }
3
25
 
4
26
  type AvatarSize = 20 | 24 | 28 | 40 | 48 | 96;
5
27
 
@@ -16,6 +38,15 @@ declare namespace Avatar {
16
38
  var displayName: string;
17
39
  }
18
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
+
19
50
  type BadgeType = 'number' | 'dot';
20
51
  type BadgeMode = 'primary' | 'critical' | 'secondary' | 'gray' | 'white';
21
52
 
@@ -31,6 +62,35 @@ declare namespace Badge {
31
62
  var displayName: string;
32
63
  }
33
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
+ }
93
+
34
94
  type TguiPlatform = 'ios' | 'base';
35
95
  type Appearance = 'light' | 'dark';
36
96
  interface TguiContextValue {
@@ -136,6 +196,23 @@ declare namespace Checkbox {
136
196
  var displayName: string;
137
197
  }
138
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
+
139
216
  type CircularProgressSize = 's' | 'm' | 'l';
140
217
 
141
218
  interface CircularProgressProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'size'> {
@@ -156,6 +233,15 @@ declare namespace Divider {
156
233
  var displayName: string;
157
234
  }
158
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
+
159
245
  interface HeadlineProps extends TypographyProps {
160
246
  ref?: Ref<HTMLElement>;
161
247
  }
@@ -164,6 +250,16 @@ declare namespace Headline {
164
250
  var displayName: string;
165
251
  }
166
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
+
167
263
  type IconButtonMode = 'bezeled' | 'plain' | 'gray' | 'outline';
168
264
  type IconButtonSize = 's' | 'm' | 'l';
169
265
 
@@ -179,6 +275,23 @@ declare namespace IconButton {
179
275
  var displayName: string;
180
276
  }
181
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
+
182
295
  type InputStatus = 'default' | 'error' | 'focused';
183
296
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
184
297
  ref?: Ref<HTMLInputElement>;
@@ -200,6 +313,14 @@ declare namespace LargeTitle {
200
313
  var displayName: string;
201
314
  }
202
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
+
203
324
  interface ListProps extends HTMLAttributes<HTMLElement> {
204
325
  ref?: Ref<HTMLElement>;
205
326
  Component?: ElementType;
@@ -209,6 +330,26 @@ declare namespace List {
209
330
  var displayName: string;
210
331
  }
211
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
+
212
353
  interface PlaceholderProps extends HTMLAttributes<HTMLElement> {
213
354
  ref?: Ref<HTMLElement>;
214
355
  children?: ReactNode;
@@ -221,6 +362,15 @@ declare namespace Placeholder {
221
362
  var displayName: string;
222
363
  }
223
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
+
224
374
  interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
225
375
  ref?: Ref<HTMLDivElement>;
226
376
  value?: number;
@@ -238,6 +388,24 @@ declare namespace Radio {
238
388
  var displayName: string;
239
389
  }
240
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
+
241
409
  interface SectionFooterProps extends HTMLAttributes<HTMLElement> {
242
410
  ref?: Ref<HTMLElement>;
243
411
  centered?: boolean;
@@ -268,6 +436,23 @@ declare namespace Section {
268
436
  var Footer: typeof SectionFooter;
269
437
  }
270
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
+
271
456
  interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
272
457
  ref?: Ref<HTMLSelectElement>;
273
458
  header?: ReactNode;
@@ -278,6 +463,22 @@ declare namespace Select {
278
463
  var displayName: string;
279
464
  }
280
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
+
281
482
  interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
282
483
  ref?: Ref<HTMLDivElement>;
283
484
  visible?: boolean;
@@ -288,6 +489,49 @@ declare namespace Skeleton {
288
489
  var displayName: string;
289
490
  }
290
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
+
291
535
  type SpinnerSize = 's' | 'm' | 'l';
292
536
 
293
537
  interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
@@ -299,6 +543,22 @@ declare namespace Spinner {
299
543
  var displayName: string;
300
544
  }
301
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
+
302
562
  type SubheadlineLevel = '1' | '2';
303
563
 
304
564
  interface SubheadlineProps extends TypographyProps {
@@ -383,5 +643,20 @@ declare namespace Title {
383
643
  var displayName: string;
384
644
  }
385
645
 
386
- export { Avatar, Badge, Button, Caption, Card, CardCell, Cell, Checkbox, CircularProgress, Divider, Headline, IconButton, Input, LargeTitle, List, Placeholder, Progress, Radio, Section, SectionFooter, SectionHeader, Select, Skeleton, Spinner, Subheadline, Switch, TabBar, TabBarItem, Tappable, Text, Textarea, TguiProvider, Title, Typography, useTgui };
387
- export type { AvatarProps, AvatarSize, BadgeMode, BadgeProps, BadgeType, ButtonMode, ButtonProps, ButtonSize, CaptionProps, CardCellProps, CardProps, CardType, CellProps, CheckboxProps, CircularProgressProps, CircularProgressSize, DividerProps, HeadlineProps, IconButtonMode, IconButtonProps, IconButtonSize, InputProps, InputStatus, LargeTitleProps, ListProps, PlaceholderProps, ProgressProps, RadioProps, SectionFooterProps, SectionHeaderProps, SectionProps, SelectProps, SkeletonProps, SpinnerProps, SpinnerSize, SubheadlineProps, SwitchProps, TabBarItemProps, TabBarProps, TappableProps, TextProps, TextareaProps, TextareaStatus, 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 };