@rcarls/rc-webcomponents 0.3.2 → 0.4.1

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/src/react.d.ts CHANGED
@@ -69,9 +69,7 @@ export type RCListboxActionChangeDetail<Action extends string = string> = RCSele
69
69
  action: Action;
70
70
  };
71
71
 
72
- export type RCListboxChangeDetail =
73
- | RCListboxSelectChangeDetail
74
- | RCListboxActionChangeDetail;
72
+ export type RCListboxChangeDetail = RCListboxSelectChangeDetail | RCListboxActionChangeDetail;
75
73
 
76
74
  export type RCComboboxCreateDetail = {
77
75
  text: string;
@@ -86,6 +84,18 @@ export type RCDialogCloseDetail = {
86
84
  returnValue: string;
87
85
  };
88
86
 
87
+ /** Detail shape for `rc-bottom-sheet-snap`. */
88
+ export type RCBottomSheetSnapDetail = {
89
+ /** Index into the resolved snap-point list selected as the target. */
90
+ index: number;
91
+
92
+ /** Target height, in pixels. */
93
+ height: number;
94
+
95
+ /** Whether the snap came from a drag release or a `snapTo()` call. */
96
+ trigger: 'drag' | 'api';
97
+ };
98
+
89
99
  export type RCMenuActivateDetail = {
90
100
  item: HTMLElement;
91
101
  value: string;
@@ -193,8 +203,108 @@ export type RCTextareaSelectDetail = {
193
203
  selectionEnd: number;
194
204
  };
195
205
 
206
+ export type RCSwitchChangeDetail = {
207
+ checked: boolean;
208
+ };
209
+
210
+ export type RCSegmentedButtonChangeDetail = {
211
+ value: string;
212
+ };
213
+
214
+ export type RCChipVariant = 'assist' | 'filter' | 'input' | 'suggestion';
215
+
216
+ export type RCChipChangeDetail = {
217
+ selected: boolean;
218
+ };
219
+
220
+ export type RCChipRemoveDetail = {
221
+ chip: HTMLElement;
222
+ };
223
+
224
+ export type RCButtonToggleDetail = {
225
+ selected: boolean;
226
+ };
227
+
228
+ export type RCSnackbarQueuePolicy = 'queue' | 'replace';
229
+ export type RCSnackbarCloseReason = 'action' | 'api' | 'timeout' | 'replace' | 'clear';
230
+
231
+ export type RCSnackbarShowOptions = {
232
+ message: string;
233
+ actionLabel?: string;
234
+ duration?: number;
235
+ };
236
+
237
+ export type RCSnackbarActionDetail = {
238
+ message: string;
239
+ };
240
+
241
+ export type RCSnackbarCloseDetail = {
242
+ reason: RCSnackbarCloseReason;
243
+ message: string;
244
+ };
245
+
196
246
  // ── Ref types ────────────────────────────────────────────────────────────────
197
247
 
248
+ /** Public API surface of `<rc-button>`. */
249
+ export type RCButtonRef = HTMLElement & {
250
+ disabled: boolean;
251
+ pending: boolean;
252
+ progress: boolean;
253
+ progressValue: number | undefined;
254
+ toggle: boolean;
255
+ selected: boolean;
256
+ defaultSelected: boolean;
257
+ iconOnly: boolean;
258
+ fullWidth: boolean;
259
+ };
260
+
261
+ /** Public API surface of `<rc-card>`. */
262
+ export type RCCardRef = HTMLElement & {
263
+ selected: boolean;
264
+ disabled: boolean;
265
+ interactive: boolean;
266
+ actionTarget: string;
267
+ };
268
+
269
+ /** Public API surface of `<rc-switch>`. */
270
+ export type RCSwitchRef = HTMLElement & {
271
+ checked: boolean;
272
+ defaultChecked: boolean;
273
+ disabled: boolean;
274
+ icons: boolean;
275
+ showOnlySelectedIcon: boolean;
276
+ };
277
+
278
+ /** Public API surface of `<rc-segmented-button>`. */
279
+ export type RCSegmentedButtonRef = HTMLElement & {
280
+ value: string;
281
+ defaultValue: string;
282
+ disabled: boolean;
283
+ orientation: 'horizontal' | 'vertical';
284
+ };
285
+
286
+ /** Public API surface of `<rc-chip>`. */
287
+ export type RCChipRef = HTMLElement & {
288
+ variant: RCChipVariant;
289
+ selected: boolean;
290
+ defaultSelected: boolean;
291
+ disabled: boolean;
292
+ readonly: boolean;
293
+ removable: boolean;
294
+ };
295
+
296
+ /** Public API surface of `<rc-snackbar>`. */
297
+ export type RCSnackbarRef = HTMLElement & {
298
+ open: boolean;
299
+ message: string;
300
+ actionLabel: string;
301
+ duration: number;
302
+ queuePolicy: RCSnackbarQueuePolicy;
303
+ show(message: string | RCSnackbarShowOptions): void;
304
+ close(reason?: RCSnackbarCloseReason): void;
305
+ clear(): void;
306
+ };
307
+
198
308
  /** Public API surface of `<rc-disclosure>`. */
199
309
  export type RCDisclosureRef = HTMLElement & {
200
310
  open: boolean;
@@ -249,6 +359,17 @@ export type RCComboboxRef = RCSelectRef & {
249
359
  };
250
360
 
251
361
  /** Public API surface of `<rc-dialog>`. */
362
+ export type RCDialogResizeOrigin =
363
+ | ''
364
+ | 'top'
365
+ | 'right'
366
+ | 'bottom'
367
+ | 'left'
368
+ | 'top-left'
369
+ | 'top-right'
370
+ | 'bottom-left'
371
+ | 'bottom-right';
372
+
252
373
  export type RCDialogRef = HTMLElement & {
253
374
  open: boolean | undefined;
254
375
  defaultOpen: boolean;
@@ -257,6 +378,8 @@ export type RCDialogRef = HTMLElement & {
257
378
  moveBounds: 'viewport' | 'parent';
258
379
  moveStep: number;
259
380
  resize: 'none' | 'both' | 'horizontal' | 'vertical';
381
+ resizeOrigin: RCDialogResizeOrigin;
382
+ resizeHandle: string;
260
383
  resizeThreshold: number;
261
384
  resizeStep: number;
262
385
  closedBy: 'any' | 'closerequest' | 'none' | '';
@@ -268,6 +391,14 @@ export type RCDialogRef = HTMLElement & {
268
391
  requestClose(returnValue?: string): void;
269
392
  };
270
393
 
394
+ /** Public API surface of `<rc-bottom-sheet>`. */
395
+ export type RCBottomSheetRef = RCDialogRef & {
396
+ snapPoints: string;
397
+ swipeDismiss: boolean;
398
+ swipeVelocity: number;
399
+ snapTo(index: number, behavior?: 'animated' | 'instant'): void;
400
+ };
401
+
271
402
  /** Public API surface of `<rc-menu>`. */
272
403
  export type RCMenuRef = HTMLElement & {
273
404
  label: string;
@@ -295,6 +426,34 @@ export type RCMenuButtonRef = HTMLElement & {
295
426
  placement: RCMenuButtonPlacement;
296
427
  };
297
428
 
429
+ /** Public API surface of `<rc-fab-menu>`. */
430
+ export type RCFabMenuRef = RCMenuButtonRef & {
431
+ position: 'bottom-end' | 'bottom-start' | 'top-end' | 'top-start';
432
+ };
433
+
434
+ export type RCFabMenuToggleDetail = {
435
+ open: boolean;
436
+ };
437
+
438
+ /** Public API surface of `<rc-navigation-bar>`. */
439
+ export type RCNavigationBarRef = HTMLElement & {
440
+ activeSelector: string;
441
+ indicatorTarget: string;
442
+ };
443
+
444
+ /** Public API surface of `<rc-navigation-rail>`. */
445
+ export type RCNavigationRailRef = RCNavigationBarRef & {
446
+ expanded: boolean;
447
+ defaultExpanded: boolean;
448
+ expand(): void;
449
+ collapse(): void;
450
+ toggleExpanded(): void;
451
+ };
452
+
453
+ export type RCNavigationRailToggleDetail = {
454
+ expanded: boolean;
455
+ };
456
+
298
457
  /** Public API surface of `<rc-menubar>`. */
299
458
  export type RCMenubarRef = HTMLElement & {
300
459
  label: string;
@@ -311,11 +470,17 @@ export type RCToolbarRef = HTMLElement & {
311
470
  export type RCSplitterRef = HTMLElement & {
312
471
  label: string;
313
472
  orientation: 'horizontal' | 'vertical';
314
- mode: 'length' | 'percent';
473
+ mode: 'length' | 'percent' | 'fixed';
315
474
  step: number;
475
+ min: number;
476
+ max: number | undefined;
316
477
  value: number;
317
478
  defaultValue: number | undefined;
318
479
  fixed: boolean;
480
+ collapsible: boolean;
481
+ snapPoints: string;
482
+ swipeVelocity: number;
483
+ snapTo(index: number, behavior?: 'animated' | 'instant'): void;
319
484
  };
320
485
 
321
486
  /** Public API surface of `<rc-slider>`. */
@@ -420,11 +585,17 @@ export type RCAppBarRef = HTMLElement & {
420
585
 
421
586
  /** Public API surface of `<rc-search-bar>`. */
422
587
  export type RCSearchBarRef = HTMLElement & {
588
+ variant: 'bar' | 'view';
589
+ open: boolean;
590
+ defaultOpen: boolean;
423
591
  value: string;
424
592
  defaultValue: string | undefined;
425
593
  debounce: number;
426
594
  clearLabel: string;
427
595
  placeholder: string | undefined;
596
+ showView(): void;
597
+ closeView(): void;
598
+ toggleView(): void;
428
599
  };
429
600
 
430
601
  // ── React JSX declarations ───────────────────────────────────────────────────
@@ -432,16 +603,76 @@ export type RCSearchBarRef = HTMLElement & {
432
603
  declare module 'react' {
433
604
  namespace JSX {
434
605
  interface IntrinsicElements {
435
- 'rc-disclosure': React.DetailedHTMLProps<React.HTMLAttributes<RCDisclosureRef>, RCDisclosureRef> & {
606
+ 'rc-disclosure': React.DetailedHTMLProps<
607
+ React.HTMLAttributes<RCDisclosureRef>,
608
+ RCDisclosureRef
609
+ > & {
436
610
  open?: boolean;
437
611
  fragment?: boolean;
438
612
  };
439
613
 
440
- 'rc-accordion': React.DetailedHTMLProps<React.HTMLAttributes<RCAccordionRef>, RCAccordionRef> & {
614
+ 'rc-accordion': React.DetailedHTMLProps<
615
+ React.HTMLAttributes<RCAccordionRef>,
616
+ RCAccordionRef
617
+ > & {
441
618
  name?: string;
442
619
  multiple?: boolean;
443
620
  };
444
621
 
622
+ 'rc-button': React.DetailedHTMLProps<React.HTMLAttributes<RCButtonRef>, RCButtonRef> & {
623
+ disabled?: boolean;
624
+ pending?: boolean;
625
+ progress?: boolean;
626
+ 'progress-value'?: number | string;
627
+ toggle?: boolean;
628
+ selected?: boolean;
629
+ 'default-selected'?: boolean;
630
+ 'icon-only'?: boolean;
631
+ 'full-width'?: boolean;
632
+ };
633
+
634
+ 'rc-card': React.DetailedHTMLProps<React.HTMLAttributes<RCCardRef>, RCCardRef> & {
635
+ selected?: boolean;
636
+ disabled?: boolean;
637
+ interactive?: boolean;
638
+ 'action-target'?: string;
639
+ };
640
+
641
+ 'rc-switch': React.DetailedHTMLProps<React.HTMLAttributes<RCSwitchRef>, RCSwitchRef> & {
642
+ checked?: boolean;
643
+ 'default-checked'?: boolean;
644
+ disabled?: boolean;
645
+ icons?: boolean;
646
+ 'show-only-selected-icon'?: boolean;
647
+ };
648
+
649
+ 'rc-segmented-button': React.DetailedHTMLProps<
650
+ React.HTMLAttributes<RCSegmentedButtonRef>,
651
+ RCSegmentedButtonRef
652
+ > & {
653
+ value?: string;
654
+ 'default-value'?: string;
655
+ disabled?: boolean;
656
+ orientation?: 'horizontal' | 'vertical';
657
+ };
658
+
659
+ 'rc-chip': React.DetailedHTMLProps<React.HTMLAttributes<RCChipRef>, RCChipRef> & {
660
+ variant?: RCChipVariant;
661
+ selected?: boolean;
662
+ 'default-selected'?: boolean;
663
+ disabled?: boolean;
664
+ readonly?: boolean;
665
+ removable?: boolean;
666
+ };
667
+
668
+ 'rc-snackbar': React.DetailedHTMLProps<React.HTMLAttributes<RCSnackbarRef>, RCSnackbarRef> & {
669
+ open?: boolean;
670
+ message?: string;
671
+ 'action-label'?: string;
672
+ duration?: number | string;
673
+ 'queue-policy'?: RCSnackbarQueuePolicy;
674
+ };
675
+
445
676
  'rc-listbox': React.DetailedHTMLProps<React.HTMLAttributes<RCListboxRef>, RCListboxRef> & {
446
677
  multiple?: boolean;
447
678
  checkmark?: boolean;
@@ -483,23 +714,70 @@ declare module 'react' {
483
714
  'move-bounds'?: 'viewport' | 'parent';
484
715
  'move-step'?: number | string;
485
716
  resize?: 'none' | 'both' | 'horizontal' | 'vertical';
717
+ 'resize-origin'?: RCDialogResizeOrigin;
718
+ 'resize-handle'?: string;
486
719
  'resize-threshold'?: number | string;
487
720
  'resize-step'?: number | string;
488
721
  'closed-by'?: 'any' | 'closerequest' | 'none';
489
722
  'light-dismiss'?: boolean;
490
723
  };
491
724
 
725
+ 'rc-bottom-sheet': React.DetailedHTMLProps<
726
+ React.HTMLAttributes<RCBottomSheetRef>,
727
+ RCBottomSheetRef
728
+ > & {
729
+ open?: boolean;
730
+ 'default-open'?: boolean;
731
+ 'light-dismiss'?: boolean;
732
+ resize?: 'none' | 'both' | 'horizontal' | 'vertical';
733
+ 'resize-origin'?: RCDialogResizeOrigin;
734
+ 'resize-handle'?: string;
735
+ 'resize-threshold'?: number | string;
736
+ 'resize-step'?: number | string;
737
+ 'snap-points'?: string;
738
+ 'swipe-dismiss'?: boolean;
739
+ 'swipe-velocity'?: number | string;
740
+ };
741
+
492
742
  'rc-menu': React.DetailedHTMLProps<React.HTMLAttributes<RCMenuRef>, RCMenuRef> & {
493
743
  label?: string;
494
744
  };
495
745
 
496
- 'rc-menu-button': React.DetailedHTMLProps<React.HTMLAttributes<RCMenuButtonRef>, RCMenuButtonRef> & {
746
+ 'rc-menu-button': React.DetailedHTMLProps<
747
+ React.HTMLAttributes<RCMenuButtonRef>,
748
+ RCMenuButtonRef
749
+ > & {
497
750
  open?: boolean;
498
751
  'default-open'?: boolean;
499
752
  orientation?: 'horizontal' | 'vertical';
500
753
  placement?: RCMenuButtonPlacement;
501
754
  };
502
755
 
756
+ 'rc-fab-menu': React.DetailedHTMLProps<React.HTMLAttributes<RCFabMenuRef>, RCFabMenuRef> & {
757
+ open?: boolean;
758
+ 'default-open'?: boolean;
759
+ placement?: RCMenuButtonPlacement;
760
+ position?: 'bottom-end' | 'bottom-start' | 'top-end' | 'top-start';
761
+ };
762
+
763
+ 'rc-navigation-bar': React.DetailedHTMLProps<
764
+ React.HTMLAttributes<RCNavigationBarRef>,
765
+ RCNavigationBarRef
766
+ > & {
767
+ 'active-selector'?: string;
768
+ 'indicator-target'?: string;
769
+ };
770
+
771
+ 'rc-navigation-rail': React.DetailedHTMLProps<
772
+ React.HTMLAttributes<RCNavigationRailRef>,
773
+ RCNavigationRailRef
774
+ > & {
775
+ expanded?: boolean;
776
+ 'default-expanded'?: boolean;
777
+ 'active-selector'?: string;
778
+ 'indicator-target'?: string;
779
+ };
780
+
503
781
  'rc-menubar': React.DetailedHTMLProps<React.HTMLAttributes<RCMenubarRef>, RCMenubarRef> & {
504
782
  label?: string;
505
783
  orientation?: 'horizontal' | 'vertical';
@@ -523,7 +801,10 @@ declare module 'react' {
523
801
  orientation?: 'horizontal' | 'vertical';
524
802
  };
525
803
 
526
- 'rc-range-slider': React.DetailedHTMLProps<React.HTMLAttributes<RCRangeSliderRef>, RCRangeSliderRef> & {
804
+ 'rc-range-slider': React.DetailedHTMLProps<
805
+ React.HTMLAttributes<RCRangeSliderRef>,
806
+ RCRangeSliderRef
807
+ > & {
527
808
  min?: number | string;
528
809
  max?: number | string;
529
810
  step?: number | string;
@@ -538,7 +819,10 @@ declare module 'react' {
538
819
  orientation?: 'horizontal' | 'vertical';
539
820
  };
540
821
 
541
- 'rc-transfer-list': React.DetailedHTMLProps<React.HTMLAttributes<RCTransferListRef>, RCTransferListRef> & {
822
+ 'rc-transfer-list': React.DetailedHTMLProps<
823
+ React.HTMLAttributes<RCTransferListRef>,
824
+ RCTransferListRef
825
+ > & {
542
826
  multiple?: boolean;
543
827
  compact?: boolean;
544
828
  'available-label'?: string;
@@ -551,18 +835,29 @@ declare module 'react' {
551
835
  'rc-splitter': React.DetailedHTMLProps<React.HTMLAttributes<RCSplitterRef>, RCSplitterRef> & {
552
836
  label?: string;
553
837
  orientation?: 'horizontal' | 'vertical';
554
- mode?: 'length' | 'percent';
838
+ mode?: 'length' | 'percent' | 'fixed';
555
839
  step?: number | string;
840
+ min?: number | string;
841
+ max?: number | string;
556
842
  value?: number | string;
557
843
  'default-value'?: number | string;
558
844
  fixed?: boolean;
845
+ collapsible?: boolean;
846
+ 'snap-points'?: string;
847
+ 'swipe-velocity'?: number | string;
559
848
  };
560
849
 
561
- 'rc-editor-toolbar': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
850
+ 'rc-editor-toolbar': React.DetailedHTMLProps<
851
+ React.HTMLAttributes<HTMLElement>,
852
+ HTMLElement
853
+ > & {
562
854
  label?: string;
563
855
  };
564
856
 
565
- 'rc-markdown-editor': React.DetailedHTMLProps<React.HTMLAttributes<RCMarkdownEditorRef>, RCMarkdownEditorRef> & {
857
+ 'rc-markdown-editor': React.DetailedHTMLProps<
858
+ React.HTMLAttributes<RCMarkdownEditorRef>,
859
+ RCMarkdownEditorRef
860
+ > & {
566
861
  value?: string;
567
862
  'default-value'?: string;
568
863
  toolbar?: boolean;
@@ -584,7 +879,13 @@ declare module 'react' {
584
879
  scrollTarget?: Element | Document | Window | string | null;
585
880
  };
586
881
 
587
- 'rc-search-bar': React.DetailedHTMLProps<React.HTMLAttributes<RCSearchBarRef>, RCSearchBarRef> & {
882
+ 'rc-search-bar': React.DetailedHTMLProps<
883
+ React.HTMLAttributes<RCSearchBarRef>,
884
+ RCSearchBarRef
885
+ > & {
886
+ variant?: 'bar' | 'view';
887
+ open?: boolean;
888
+ 'default-open'?: boolean;
588
889
  debounce?: number | string;
589
890
  'clear-label'?: string;
590
891
  placeholder?: string;
@@ -592,7 +893,10 @@ declare module 'react' {
592
893
  value?: string;
593
894
  };
594
895
 
595
- 'rc-virtual-canvas': React.DetailedHTMLProps<React.HTMLAttributes<RCVirtualCanvasRef>, RCVirtualCanvasRef> & {
896
+ 'rc-virtual-canvas': React.DetailedHTMLProps<
897
+ React.HTMLAttributes<RCVirtualCanvasRef>,
898
+ RCVirtualCanvasRef
899
+ > & {
596
900
  'content-width'?: number | string;
597
901
  'content-height'?: number | string;
598
902
  'auto-resize-canvas'?: boolean;