rsuite 6.0.0-canary-20250620 → 6.0.0-canary-20250622
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/Accordion/styles/index.css +0 -78
- package/AutoComplete/styles/index.css +1 -79
- package/Avatar/styles/index.css +0 -78
- package/AvatarGroup/styles/index.css +0 -78
- package/Badge/styles/index.css +0 -78
- package/Box/styles/index.css +0 -78
- package/Breadcrumb/styles/index.css +0 -78
- package/Button/styles/index.css +0 -78
- package/ButtonGroup/styles/index.css +0 -78
- package/ButtonToolbar/styles/index.css +0 -82
- package/Calendar/styles/index.css +0 -78
- package/Card/styles/index.css +0 -78
- package/CardGroup/styles/index.css +0 -78
- package/Carousel/styles/index.css +0 -78
- package/CascadeTree/styles/index.css +0 -78
- package/Cascader/styles/index.css +1 -79
- package/Center/styles/index.css +0 -78
- package/CheckPicker/styles/index.css +1 -79
- package/CheckTree/styles/index.css +1 -79
- package/CheckTreePicker/styles/index.css +1 -79
- package/Checkbox/styles/index.css +0 -78
- package/CheckboxGroup/styles/index.css +0 -78
- package/Container/styles/index.css +0 -78
- package/Content/styles/index.css +0 -78
- package/DateInput/styles/index.css +0 -78
- package/DatePicker/styles/index.css +1 -79
- package/DateRangeInput/styles/index.css +0 -78
- package/DateRangePicker/styles/index.css +1 -79
- package/Divider/styles/index.css +0 -78
- package/Drawer/styles/index.css +0 -78
- package/Dropdown/styles/index.css +0 -78
- package/FlexboxGrid/styles/index.css +0 -78
- package/Footer/styles/index.css +0 -78
- package/Form/styles/index.css +0 -78
- package/FormControl/styles/index.css +0 -78
- package/FormControlLabel/styles/index.css +0 -78
- package/FormErrorMessage/styles/index.css +0 -78
- package/FormGroup/styles/index.css +0 -78
- package/FormHelpText/styles/index.css +0 -78
- package/FormStack/styles/index.css +0 -78
- package/Grid/styles/index.css +0 -78
- package/Header/styles/index.css +0 -78
- package/Heading/styles/index.css +0 -78
- package/HeadingGroup/styles/index.css +0 -78
- package/Highlight/styles/index.css +0 -78
- package/IconButton/styles/index.css +0 -78
- package/Image/styles/index.css +0 -78
- package/InlineEdit/styles/index.css +0 -78
- package/Input/styles/index.css +0 -78
- package/InputGroup/styles/index.css +1 -79
- package/InputNumber/styles/index.css +1 -79
- package/InputPicker/styles/index.css +1 -79
- package/Kbd/styles/index.css +0 -78
- package/Link/styles/index.css +0 -78
- package/List/styles/index.css +0 -78
- package/Loader/styles/index.css +0 -78
- package/Menu/styles/index.css +0 -78
- package/Message/styles/index.css +0 -78
- package/Modal/styles/index.css +0 -78
- package/MultiCascadeTree/styles/index.css +1 -79
- package/MultiCascader/styles/index.css +1 -79
- package/Nav/styles/index.css +0 -78
- package/Navbar/styles/index.css +0 -78
- package/Notification/styles/index.css +0 -78
- package/NumberInput/styles/index.css +1 -79
- package/Pagination/styles/index.css +1 -79
- package/Panel/styles/index.css +0 -78
- package/PanelGroup/styles/index.css +0 -78
- package/PasswordInput/styles/index.css +1 -79
- package/PasswordStrengthMeter/styles/index.css +0 -78
- package/PinInput/styles/index.css +0 -78
- package/Placeholder/styles/index.css +0 -78
- package/Popover/styles/index.css +0 -78
- package/Progress/styles/index.css +0 -78
- package/ProgressCircle/styles/index.css +0 -78
- package/Radio/styles/index.css +0 -78
- package/RadioGroup/styles/index.css +0 -78
- package/RadioTile/styles/index.css +0 -78
- package/RangeSlider/styles/index.css +0 -78
- package/Rate/styles/index.css +0 -78
- package/SegmentedControl/package.json +7 -0
- package/SegmentedControl/styles/index.css +159 -0
- package/SelectPicker/styles/index.css +1 -79
- package/Sidebar/styles/index.css +0 -78
- package/Sidenav/styles/index.css +0 -78
- package/Slider/styles/index.css +0 -78
- package/Stack/styles/index.css +0 -78
- package/Stat/styles/index.css +0 -78
- package/StatGroup/styles/index.css +0 -78
- package/Steps/styles/index.css +0 -78
- package/Table/styles/index.css +0 -78
- package/Tabs/styles/index.css +0 -78
- package/Tag/styles/index.css +0 -78
- package/TagGroup/styles/index.css +0 -78
- package/TagInput/styles/index.css +1 -79
- package/TagPicker/styles/index.css +1 -79
- package/Text/styles/index.css +0 -78
- package/Textarea/styles/index.css +0 -78
- package/TimePicker/styles/index.css +1 -79
- package/TimeRangePicker/styles/index.css +1 -79
- package/Timeline/styles/index.css +0 -78
- package/Toggle/styles/index.css +0 -78
- package/Tooltip/styles/index.css +0 -78
- package/Tree/styles/index.css +1 -79
- package/TreePicker/styles/index.css +1 -79
- package/Uploader/styles/index.css +0 -78
- package/cjs/ButtonToolbar/ButtonToolbar.js +2 -0
- package/cjs/Grid/utils/styles.d.ts +1 -1
- package/cjs/InputPicker/utils.d.ts +1 -1
- package/cjs/Nav/Nav.d.ts +2 -3
- package/cjs/RadioGroup/RadioGroup.d.ts +4 -1
- package/cjs/SegmentedControl/Indicator.d.ts +10 -0
- package/cjs/SegmentedControl/Indicator.js +22 -0
- package/cjs/SegmentedControl/SegmentedControl.d.ts +27 -0
- package/cjs/SegmentedControl/SegmentedControl.js +87 -0
- package/cjs/SegmentedControl/SegmentedItem.d.ts +16 -0
- package/cjs/SegmentedControl/SegmentedItem.js +44 -0
- package/cjs/SegmentedControl/hooks/useIndicatorPosition.d.ts +17 -0
- package/cjs/SegmentedControl/hooks/useIndicatorPosition.js +55 -0
- package/cjs/SegmentedControl/index.d.ts +4 -0
- package/cjs/SegmentedControl/index.js +11 -0
- package/cjs/Slider/ProgressBar.js +1 -1
- package/cjs/Stack/Stack.js +20 -5
- package/cjs/Stack/utils.d.ts +9 -0
- package/cjs/Stack/utils.js +38 -0
- package/cjs/Tabs/Tabs.d.ts +4 -2
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +6 -0
- package/cjs/internals/Box/Box.d.ts +27 -27
- package/cjs/internals/Box/Box.js +13 -8
- package/cjs/internals/Box/utils.d.ts +4 -1
- package/cjs/internals/Box/utils.js +154 -13
- package/cjs/internals/Provider/types.d.ts +2 -0
- package/cjs/internals/constants/index.js +2 -2
- package/cjs/internals/hooks/useElementResize.d.ts +2 -1
- package/cjs/internals/hooks/useElementResize.js +50 -7
- package/cjs/internals/hooks/useStyled.d.ts +60 -0
- package/cjs/internals/hooks/useStyled.js +257 -0
- package/cjs/internals/utils/colours.js +1 -1
- package/cjs/internals/utils/style-sheet/css.d.ts +1 -1
- package/cjs/internals/utils/style-sheet/css.js +1 -1
- package/cjs/internals/utils/style-sheet/index.d.ts +1 -0
- package/cjs/internals/utils/style-sheet/index.js +6 -0
- package/cjs/internals/utils/style-sheet/style-manager.d.ts +50 -0
- package/cjs/internals/utils/style-sheet/style-manager.js +97 -0
- package/dist/rsuite-no-reset.css +200 -101
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite.css +200 -101
- package/dist/rsuite.js +172 -14
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/ButtonToolbar/ButtonToolbar.js +2 -0
- package/esm/Grid/utils/styles.d.ts +1 -1
- package/esm/InputPicker/utils.d.ts +1 -1
- package/esm/Nav/Nav.d.ts +2 -3
- package/esm/RadioGroup/RadioGroup.d.ts +4 -1
- package/esm/SegmentedControl/Indicator.d.ts +10 -0
- package/esm/SegmentedControl/Indicator.js +17 -0
- package/esm/SegmentedControl/SegmentedControl.d.ts +27 -0
- package/esm/SegmentedControl/SegmentedControl.js +81 -0
- package/esm/SegmentedControl/SegmentedItem.d.ts +16 -0
- package/esm/SegmentedControl/SegmentedItem.js +39 -0
- package/esm/SegmentedControl/hooks/useIndicatorPosition.d.ts +17 -0
- package/esm/SegmentedControl/hooks/useIndicatorPosition.js +50 -0
- package/esm/SegmentedControl/index.d.ts +4 -0
- package/esm/SegmentedControl/index.js +8 -0
- package/esm/Slider/ProgressBar.js +1 -1
- package/esm/Stack/Stack.js +21 -6
- package/esm/Stack/utils.d.ts +9 -0
- package/esm/Stack/utils.js +35 -0
- package/esm/Tabs/Tabs.d.ts +4 -2
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/internals/Box/Box.d.ts +27 -27
- package/esm/internals/Box/Box.js +9 -4
- package/esm/internals/Box/utils.d.ts +4 -1
- package/esm/internals/Box/utils.js +153 -13
- package/esm/internals/Provider/types.d.ts +2 -0
- package/esm/internals/constants/index.js +2 -2
- package/esm/internals/hooks/useElementResize.d.ts +2 -1
- package/esm/internals/hooks/useElementResize.js +50 -7
- package/esm/internals/hooks/useStyled.d.ts +60 -0
- package/esm/internals/hooks/useStyled.js +251 -0
- package/esm/internals/utils/colours.js +1 -1
- package/esm/internals/utils/style-sheet/css.d.ts +1 -1
- package/esm/internals/utils/style-sheet/css.js +1 -1
- package/esm/internals/utils/style-sheet/index.d.ts +1 -0
- package/esm/internals/utils/style-sheet/index.js +2 -1
- package/esm/internals/utils/style-sheet/style-manager.d.ts +50 -0
- package/esm/internals/utils/style-sheet/style-manager.js +93 -0
- package/package.json +1 -1
|
@@ -523,84 +523,6 @@ body{
|
|
|
523
523
|
--rs-zindex-modal:1050;
|
|
524
524
|
--rs-zindex-drawer:1050;
|
|
525
525
|
}
|
|
526
|
-
[data-rs=box][style*="--rs-box-p"]{
|
|
527
|
-
padding:var(--rs-box-p);
|
|
528
|
-
}
|
|
529
|
-
[data-rs=box][style*="--rs-box-pt"]{
|
|
530
|
-
padding-top:var(--rs-box-pt);
|
|
531
|
-
}
|
|
532
|
-
[data-rs=box][style*="--rs-box-pb"]{
|
|
533
|
-
padding-bottom:var(--rs-box-pb);
|
|
534
|
-
}
|
|
535
|
-
[data-rs=box][style*="--rs-box-pl"]{
|
|
536
|
-
padding-left:var(--rs-box-pl);
|
|
537
|
-
}
|
|
538
|
-
[data-rs=box][style*="--rs-box-pr"]{
|
|
539
|
-
padding-right:var(--rs-box-pr);
|
|
540
|
-
}
|
|
541
|
-
[data-rs=box][style*="--rs-box-px"]{
|
|
542
|
-
padding-inline:var(--rs-box-px);
|
|
543
|
-
}
|
|
544
|
-
[data-rs=box][style*="--rs-box-py"]{
|
|
545
|
-
padding-block:var(--rs-box-py);
|
|
546
|
-
}
|
|
547
|
-
[data-rs=box][style*="--rs-box-m"]{
|
|
548
|
-
margin:var(--rs-box-m);
|
|
549
|
-
}
|
|
550
|
-
[data-rs=box][style*="--rs-box-mt"]{
|
|
551
|
-
margin-top:var(--rs-box-mt);
|
|
552
|
-
}
|
|
553
|
-
[data-rs=box][style*="--rs-box-mb"]{
|
|
554
|
-
margin-bottom:var(--rs-box-mb);
|
|
555
|
-
}
|
|
556
|
-
[data-rs=box][style*="--rs-box-ml"]{
|
|
557
|
-
margin-left:var(--rs-box-ml);
|
|
558
|
-
}
|
|
559
|
-
[data-rs=box][style*="--rs-box-mr"]{
|
|
560
|
-
margin-right:var(--rs-box-mr);
|
|
561
|
-
}
|
|
562
|
-
[data-rs=box][style*="--rs-box-mx"]{
|
|
563
|
-
margin-inline:var(--rs-box-mx);
|
|
564
|
-
}
|
|
565
|
-
[data-rs=box][style*="--rs-box-my"]{
|
|
566
|
-
margin-block:var(--rs-box-my);
|
|
567
|
-
}
|
|
568
|
-
[data-rs=box][style*="--rs-box-w"]{
|
|
569
|
-
width:var(--rs-box-w);
|
|
570
|
-
}
|
|
571
|
-
[data-rs=box][style*="--rs-box-h"]{
|
|
572
|
-
height:var(--rs-box-h);
|
|
573
|
-
}
|
|
574
|
-
[data-rs=box][style*="--rs-box-maxw"]{
|
|
575
|
-
max-width:var(--rs-box-maxw);
|
|
576
|
-
}
|
|
577
|
-
[data-rs=box][style*="--rs-box-maxh"]{
|
|
578
|
-
max-height:var(--rs-box-maxh);
|
|
579
|
-
}
|
|
580
|
-
[data-rs=box][style*="--rs-box-minw"]{
|
|
581
|
-
min-width:var(--rs-box-minw);
|
|
582
|
-
}
|
|
583
|
-
[data-rs=box][style*="--rs-box-minh"]{
|
|
584
|
-
min-height:var(--rs-box-minh);
|
|
585
|
-
}
|
|
586
|
-
[data-rs=box][style*="--rs-box-c"]{
|
|
587
|
-
color:var(--rs-box-c);
|
|
588
|
-
}
|
|
589
|
-
[data-rs=box][style*="--rs-box-bd"]{
|
|
590
|
-
border:var(--rs-box-bd);
|
|
591
|
-
}
|
|
592
|
-
[data-rs=box][style*="--rs-box-rounded"]{
|
|
593
|
-
border-radius:var(--rs-box-rounded);
|
|
594
|
-
}
|
|
595
|
-
[data-rs=box][style*="--rs-box-shadow"]{
|
|
596
|
-
box-shadow:var(--rs-box-shadow);
|
|
597
|
-
}
|
|
598
|
-
[data-rs=box][style*="--rs-box-bg"]{
|
|
599
|
-
background:var(--rs-box-bg);
|
|
600
|
-
}
|
|
601
|
-
[data-rs=box][style*="--rs-box-display"]{
|
|
602
|
-
display:var(--rs-box-display);
|
|
603
|
-
}
|
|
604
526
|
|
|
605
527
|
@media (max-width: calc(576px - 1px)){
|
|
606
528
|
[data-visible-from=xs]{
|
|
@@ -1012,7 +934,7 @@ body{
|
|
|
1012
934
|
--rs-input-group-font-size-sm:var(--rs-font-size-sm);
|
|
1013
935
|
--rs-input-group-font-size-md:var(--rs-font-size-sm);
|
|
1014
936
|
--rs-input-group-font-size-lg:var(--rs-font-size-md);
|
|
1015
|
-
--rs-input-group-width:
|
|
937
|
+
--rs-input-group-width:100%;
|
|
1016
938
|
position:relative;
|
|
1017
939
|
display:flex;
|
|
1018
940
|
border-radius:var(--rs-input-group-border-radius);
|
|
@@ -400,84 +400,6 @@ body{
|
|
|
400
400
|
--rs-ripple-bg:rgb(0 0 0 / 20%);
|
|
401
401
|
--rs-loader-default-size:1.125rem;
|
|
402
402
|
}
|
|
403
|
-
[data-rs=box][style*="--rs-box-p"]{
|
|
404
|
-
padding:var(--rs-box-p);
|
|
405
|
-
}
|
|
406
|
-
[data-rs=box][style*="--rs-box-pt"]{
|
|
407
|
-
padding-top:var(--rs-box-pt);
|
|
408
|
-
}
|
|
409
|
-
[data-rs=box][style*="--rs-box-pb"]{
|
|
410
|
-
padding-bottom:var(--rs-box-pb);
|
|
411
|
-
}
|
|
412
|
-
[data-rs=box][style*="--rs-box-pl"]{
|
|
413
|
-
padding-left:var(--rs-box-pl);
|
|
414
|
-
}
|
|
415
|
-
[data-rs=box][style*="--rs-box-pr"]{
|
|
416
|
-
padding-right:var(--rs-box-pr);
|
|
417
|
-
}
|
|
418
|
-
[data-rs=box][style*="--rs-box-px"]{
|
|
419
|
-
padding-inline:var(--rs-box-px);
|
|
420
|
-
}
|
|
421
|
-
[data-rs=box][style*="--rs-box-py"]{
|
|
422
|
-
padding-block:var(--rs-box-py);
|
|
423
|
-
}
|
|
424
|
-
[data-rs=box][style*="--rs-box-m"]{
|
|
425
|
-
margin:var(--rs-box-m);
|
|
426
|
-
}
|
|
427
|
-
[data-rs=box][style*="--rs-box-mt"]{
|
|
428
|
-
margin-top:var(--rs-box-mt);
|
|
429
|
-
}
|
|
430
|
-
[data-rs=box][style*="--rs-box-mb"]{
|
|
431
|
-
margin-bottom:var(--rs-box-mb);
|
|
432
|
-
}
|
|
433
|
-
[data-rs=box][style*="--rs-box-ml"]{
|
|
434
|
-
margin-left:var(--rs-box-ml);
|
|
435
|
-
}
|
|
436
|
-
[data-rs=box][style*="--rs-box-mr"]{
|
|
437
|
-
margin-right:var(--rs-box-mr);
|
|
438
|
-
}
|
|
439
|
-
[data-rs=box][style*="--rs-box-mx"]{
|
|
440
|
-
margin-inline:var(--rs-box-mx);
|
|
441
|
-
}
|
|
442
|
-
[data-rs=box][style*="--rs-box-my"]{
|
|
443
|
-
margin-block:var(--rs-box-my);
|
|
444
|
-
}
|
|
445
|
-
[data-rs=box][style*="--rs-box-w"]{
|
|
446
|
-
width:var(--rs-box-w);
|
|
447
|
-
}
|
|
448
|
-
[data-rs=box][style*="--rs-box-h"]{
|
|
449
|
-
height:var(--rs-box-h);
|
|
450
|
-
}
|
|
451
|
-
[data-rs=box][style*="--rs-box-maxw"]{
|
|
452
|
-
max-width:var(--rs-box-maxw);
|
|
453
|
-
}
|
|
454
|
-
[data-rs=box][style*="--rs-box-maxh"]{
|
|
455
|
-
max-height:var(--rs-box-maxh);
|
|
456
|
-
}
|
|
457
|
-
[data-rs=box][style*="--rs-box-minw"]{
|
|
458
|
-
min-width:var(--rs-box-minw);
|
|
459
|
-
}
|
|
460
|
-
[data-rs=box][style*="--rs-box-minh"]{
|
|
461
|
-
min-height:var(--rs-box-minh);
|
|
462
|
-
}
|
|
463
|
-
[data-rs=box][style*="--rs-box-c"]{
|
|
464
|
-
color:var(--rs-box-c);
|
|
465
|
-
}
|
|
466
|
-
[data-rs=box][style*="--rs-box-bd"]{
|
|
467
|
-
border:var(--rs-box-bd);
|
|
468
|
-
}
|
|
469
|
-
[data-rs=box][style*="--rs-box-rounded"]{
|
|
470
|
-
border-radius:var(--rs-box-rounded);
|
|
471
|
-
}
|
|
472
|
-
[data-rs=box][style*="--rs-box-shadow"]{
|
|
473
|
-
box-shadow:var(--rs-box-shadow);
|
|
474
|
-
}
|
|
475
|
-
[data-rs=box][style*="--rs-box-bg"]{
|
|
476
|
-
background:var(--rs-box-bg);
|
|
477
|
-
}
|
|
478
|
-
[data-rs=box][style*="--rs-box-display"]{
|
|
479
|
-
display:var(--rs-box-display);
|
|
480
|
-
}
|
|
481
403
|
|
|
482
404
|
@media (max-width: calc(576px - 1px)){
|
|
483
405
|
[data-visible-from=xs]{
|
|
@@ -30,6 +30,8 @@ const ButtonToolbar = (0, _utils.forwardRef)((props, ref) => {
|
|
|
30
30
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
31
31
|
const classes = merge(className, withPrefix());
|
|
32
32
|
return /*#__PURE__*/_react.default.createElement(_Stack.default, (0, _extends2.default)({
|
|
33
|
+
wrap: true,
|
|
34
|
+
spacing: 8,
|
|
33
35
|
as: as,
|
|
34
36
|
role: role,
|
|
35
37
|
ref: ref,
|
|
@@ -3,4 +3,4 @@ import type { GutterType } from '../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Generates CSS variable styles for grid gutters, supporting both single values and arrays [horizontal, vertical]
|
|
5
5
|
*/
|
|
6
|
-
export declare const getResponsiveGutterStyles: (gutter?: GutterType | ResponsiveValue<GutterType>) => Record<string, string>;
|
|
6
|
+
export declare const getResponsiveGutterStyles: (gutter?: GutterType | ResponsiveValue<GutterType>) => Record<string, string | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const convertSize: (size?: string) => "
|
|
1
|
+
export declare const convertSize: (size?: string) => "sm" | "md" | "lg";
|
package/cjs/Nav/Nav.d.ts
CHANGED
|
@@ -4,11 +4,10 @@ import type { HTMLPropsWithoutSelect } from '../internals/types';
|
|
|
4
4
|
export interface NavProps<T = any> extends BoxProps, HTMLPropsWithoutSelect {
|
|
5
5
|
/**
|
|
6
6
|
* The appearance style of the Nav component.
|
|
7
|
-
*
|
|
7
|
+
* - 'pills' appearance is deprecated. Use `SegmentedControl` component instead.
|
|
8
8
|
* @default 'default'
|
|
9
|
-
* @version 'pills' is supported in version 5.68.0
|
|
10
9
|
*/
|
|
11
|
-
appearance?: 'default' | 'subtle' | 'tabs'
|
|
10
|
+
appearance?: 'default' | 'subtle' | 'tabs';
|
|
12
11
|
/**
|
|
13
12
|
* Whether the Nav component is reversed.
|
|
14
13
|
*/
|
|
@@ -14,7 +14,10 @@ export interface RadioContextProps {
|
|
|
14
14
|
]>;
|
|
15
15
|
}
|
|
16
16
|
export interface RadioGroupProps<T = string | number> extends BoxProps, FormControlBaseProps<T> {
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* A radio group can have different appearances
|
|
19
|
+
* @deprecated Use `<SegmentedControl indicator="underline" />` instead
|
|
20
|
+
*/
|
|
18
21
|
appearance?: 'default' | 'picker';
|
|
19
22
|
/** Name to use for form */
|
|
20
23
|
name?: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IndicatorProps {
|
|
3
|
+
style: React.CSSProperties;
|
|
4
|
+
classPrefix: string;
|
|
5
|
+
}
|
|
6
|
+
declare const Indicator: {
|
|
7
|
+
({ style, classPrefix }: IndicatorProps): React.JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export default Indicator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _hooks = require("../internals/hooks");
|
|
9
|
+
const Indicator = ({
|
|
10
|
+
style,
|
|
11
|
+
classPrefix
|
|
12
|
+
}) => {
|
|
13
|
+
const {
|
|
14
|
+
prefix
|
|
15
|
+
} = (0, _hooks.useStyles)(classPrefix);
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
+
className: prefix('indicator'),
|
|
18
|
+
style: style
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Indicator.displayName = 'Indicator';
|
|
22
|
+
var _default = exports.default = Indicator;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BoxProps } from '../internals/Box';
|
|
3
|
+
import type { FormControlBaseProps, Size } from '../internals/types';
|
|
4
|
+
export interface SegmentedItemDataType {
|
|
5
|
+
/** The label of the item */
|
|
6
|
+
label: React.ReactNode;
|
|
7
|
+
/** The value of the item */
|
|
8
|
+
value: string | number;
|
|
9
|
+
}
|
|
10
|
+
export interface SegmentedControlProps<T = string | number | null> extends BoxProps, Omit<FormControlBaseProps<T>, 'readOnly' | 'plaintext'> {
|
|
11
|
+
/** The indicator style of the segmented control */
|
|
12
|
+
indicator?: 'pill' | 'underline';
|
|
13
|
+
/** Name to use for form */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** Data of segmented items */
|
|
16
|
+
data?: SegmentedItemDataType[];
|
|
17
|
+
/** Display block style, fit the width of the container */
|
|
18
|
+
block?: boolean;
|
|
19
|
+
/** A segmented control can have different sizes */
|
|
20
|
+
size?: Size;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The `SegmentedControl` component is used to offer multiple exclusive options.
|
|
24
|
+
* @see https://rsuitejs.com/components/segmented-control
|
|
25
|
+
*/
|
|
26
|
+
declare const SegmentedControl: import("../internals/types").InternalRefForwardingComponent<"div", SegmentedControlProps<string | number | null>, never> & Record<string, never>;
|
|
27
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Box = _interopRequireDefault(require("../internals/Box"));
|
|
10
|
+
var _SegmentedItem = _interopRequireDefault(require("./SegmentedItem"));
|
|
11
|
+
var _Indicator = _interopRequireDefault(require("./Indicator"));
|
|
12
|
+
var _utils = require("../internals/utils");
|
|
13
|
+
var _hooks = require("../internals/hooks");
|
|
14
|
+
var _useIndicatorPosition = _interopRequireDefault(require("./hooks/useIndicatorPosition"));
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
/**
|
|
17
|
+
* The `SegmentedControl` component is used to offer multiple exclusive options.
|
|
18
|
+
* @see https://rsuitejs.com/components/segmented-control
|
|
19
|
+
*/
|
|
20
|
+
const SegmentedControl = (0, _utils.forwardRef)((props, ref) => {
|
|
21
|
+
const {
|
|
22
|
+
propsWithDefaults
|
|
23
|
+
} = (0, _hooks.useCustom)('SegmentedControl', props);
|
|
24
|
+
const {
|
|
25
|
+
as,
|
|
26
|
+
className,
|
|
27
|
+
classPrefix = 'segmented-control',
|
|
28
|
+
value: valueProp,
|
|
29
|
+
defaultValue,
|
|
30
|
+
indicator = 'pill',
|
|
31
|
+
size = 'md',
|
|
32
|
+
block = false,
|
|
33
|
+
name,
|
|
34
|
+
disabled,
|
|
35
|
+
data,
|
|
36
|
+
onChange,
|
|
37
|
+
...rest
|
|
38
|
+
} = propsWithDefaults;
|
|
39
|
+
const {
|
|
40
|
+
merge,
|
|
41
|
+
withPrefix
|
|
42
|
+
} = (0, _hooks.useStyles)(classPrefix);
|
|
43
|
+
const classes = merge(className, withPrefix());
|
|
44
|
+
const [value, setValue] = (0, _hooks.useControlled)(valueProp, defaultValue);
|
|
45
|
+
const id = (0, _hooks.useUniqueId)('segmented', name);
|
|
46
|
+
|
|
47
|
+
// Ref for container element
|
|
48
|
+
const containerRef = (0, _react.useRef)(null);
|
|
49
|
+
|
|
50
|
+
// Get the active item index
|
|
51
|
+
const activeIndex = data === null || data === void 0 ? void 0 : data.findIndex(item => item.value === value);
|
|
52
|
+
const {
|
|
53
|
+
style: indicatorStyle
|
|
54
|
+
} = (0, _useIndicatorPosition.default)({
|
|
55
|
+
containerRef,
|
|
56
|
+
activeIndex,
|
|
57
|
+
indicator,
|
|
58
|
+
data
|
|
59
|
+
});
|
|
60
|
+
const handleChange = (0, _hooks.useEventCallback)((nextValue, event) => {
|
|
61
|
+
setValue(nextValue);
|
|
62
|
+
onChange === null || onChange === void 0 || onChange(nextValue !== null && nextValue !== void 0 ? nextValue : '', event);
|
|
63
|
+
});
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_Box.default, (0, _extends2.default)({
|
|
65
|
+
as: as,
|
|
66
|
+
role: "radiogroup",
|
|
67
|
+
ref: (0, _utils.mergeRefs)(ref, containerRef),
|
|
68
|
+
className: classes,
|
|
69
|
+
"data-size": size,
|
|
70
|
+
"data-block": block || undefined,
|
|
71
|
+
"data-indicator": indicator
|
|
72
|
+
}, rest), data === null || data === void 0 ? void 0 : data.map((item, index) => /*#__PURE__*/_react.default.createElement(_SegmentedItem.default, {
|
|
73
|
+
key: index,
|
|
74
|
+
item: item,
|
|
75
|
+
index: index,
|
|
76
|
+
name: id,
|
|
77
|
+
active: value === item.value,
|
|
78
|
+
disabled: disabled,
|
|
79
|
+
classPrefix: classPrefix,
|
|
80
|
+
onChange: handleChange
|
|
81
|
+
})), activeIndex !== -1 && /*#__PURE__*/_react.default.createElement(_Indicator.default, {
|
|
82
|
+
style: indicatorStyle,
|
|
83
|
+
classPrefix: classPrefix
|
|
84
|
+
}));
|
|
85
|
+
});
|
|
86
|
+
SegmentedControl.displayName = 'SegmentedControl';
|
|
87
|
+
var _default = exports.default = SegmentedControl;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SegmentedItemDataType } from './SegmentedControl';
|
|
3
|
+
export interface SegmentedItemProps {
|
|
4
|
+
item: SegmentedItemDataType;
|
|
5
|
+
index: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
active: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
classPrefix: string;
|
|
10
|
+
onChange: (value: string | number, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const SegmentedItem: {
|
|
13
|
+
({ item, index, name, active, disabled, classPrefix, onChange }: SegmentedItemProps): React.JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
export default SegmentedItem;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _hooks = require("../internals/hooks");
|
|
9
|
+
const SegmentedItem = ({
|
|
10
|
+
item,
|
|
11
|
+
index,
|
|
12
|
+
name,
|
|
13
|
+
active,
|
|
14
|
+
disabled,
|
|
15
|
+
classPrefix,
|
|
16
|
+
onChange
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
prefix
|
|
20
|
+
} = (0, _hooks.useStyles)(classPrefix);
|
|
21
|
+
const handleChange = event => {
|
|
22
|
+
if (disabled) return;
|
|
23
|
+
onChange(item.value, event);
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement("label", {
|
|
26
|
+
className: prefix('item'),
|
|
27
|
+
"data-value": item.value,
|
|
28
|
+
"data-index": index,
|
|
29
|
+
"data-active": active || undefined,
|
|
30
|
+
"data-disabled": disabled || undefined
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
32
|
+
type: "radio",
|
|
33
|
+
name: name,
|
|
34
|
+
value: String(item.value),
|
|
35
|
+
checked: active,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
onChange: handleChange,
|
|
38
|
+
className: prefix('radio')
|
|
39
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
40
|
+
className: prefix('label')
|
|
41
|
+
}, item.label));
|
|
42
|
+
};
|
|
43
|
+
SegmentedItem.displayName = 'SegmentedItem';
|
|
44
|
+
var _default = exports.default = SegmentedItem;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
interface UseIndicatorPositionProps {
|
|
3
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
4
|
+
activeIndex?: number;
|
|
5
|
+
indicator: 'pill' | 'underline';
|
|
6
|
+
data?: Array<{
|
|
7
|
+
value: string | number;
|
|
8
|
+
}>;
|
|
9
|
+
block?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Custom hook to calculate and update the indicator position
|
|
13
|
+
*/
|
|
14
|
+
declare const useIndicatorPosition: ({ containerRef, activeIndex, indicator, data }: UseIndicatorPositionProps) => {
|
|
15
|
+
style: import("react").CSSProperties;
|
|
16
|
+
};
|
|
17
|
+
export default useIndicatorPosition;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
9
|
+
var _hooks = require("../../internals/hooks");
|
|
10
|
+
/**
|
|
11
|
+
* Updates the indicator position based on the active item
|
|
12
|
+
*/
|
|
13
|
+
const updateIndicatorPosition = (container, activeIndex, indicator) => {
|
|
14
|
+
if (activeIndex === -1) return {};
|
|
15
|
+
const activeItem = container.querySelector(`[data-index="${activeIndex}"]`);
|
|
16
|
+
if (!activeItem) return {};
|
|
17
|
+
const containerStyle = window.getComputedStyle(container);
|
|
18
|
+
const paddingLeft = parseFloat(containerStyle.paddingLeft) || 0;
|
|
19
|
+
return {
|
|
20
|
+
transform: `translateX(${activeItem.offsetLeft - paddingLeft}px)`,
|
|
21
|
+
width: activeItem.offsetWidth,
|
|
22
|
+
height: indicator === 'underline' ? 2 : activeItem.offsetHeight
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Custom hook to calculate and update the indicator position
|
|
28
|
+
*/
|
|
29
|
+
const useIndicatorPosition = ({
|
|
30
|
+
containerRef,
|
|
31
|
+
activeIndex,
|
|
32
|
+
indicator,
|
|
33
|
+
data
|
|
34
|
+
}) => {
|
|
35
|
+
const [indicatorStyle, setIndicatorStyle] = (0, _react.useState)({});
|
|
36
|
+
const updatePosition = (0, _react.useCallback)(() => {
|
|
37
|
+
if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const newStyle = updateIndicatorPosition(containerRef.current, activeIndex, indicator);
|
|
41
|
+
setIndicatorStyle(prev => (0, _isEqual.default)(prev, newStyle) ? prev : newStyle);
|
|
42
|
+
}, [containerRef, activeIndex, indicator]);
|
|
43
|
+
|
|
44
|
+
// Update position when active item or data changes
|
|
45
|
+
(0, _react.useEffect)(() => {
|
|
46
|
+
updatePosition();
|
|
47
|
+
}, [updatePosition, data]);
|
|
48
|
+
|
|
49
|
+
// Set up resize observer
|
|
50
|
+
(0, _hooks.useElementResize)(containerRef, updatePosition);
|
|
51
|
+
return {
|
|
52
|
+
style: indicatorStyle
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var _default = exports.default = useIndicatorPosition;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _SegmentedControl = _interopRequireDefault(require("./SegmentedControl"));
|
|
8
|
+
exports.SegmentedControl = _SegmentedControl.default;
|
|
9
|
+
// export types
|
|
10
|
+
// export components
|
|
11
|
+
var _default = exports.default = _SegmentedControl.default;
|
|
@@ -25,7 +25,7 @@ const ProgressBar = (0, _utils.forwardRef)((props, ref) => {
|
|
|
25
25
|
withPrefix
|
|
26
26
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
27
27
|
const sizeKey = vertical ? 'height' : 'width';
|
|
28
|
-
const startKey = vertical ? 'bottom' : '
|
|
28
|
+
const startKey = vertical ? 'bottom' : 'insetInlineStart';
|
|
29
29
|
const styles = (0, _utils.mergeStyles)(style, {
|
|
30
30
|
[startKey]: `${start}%`,
|
|
31
31
|
[sizeKey]: `${end - start}%`
|
package/cjs/Stack/Stack.js
CHANGED
|
@@ -8,8 +8,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _StackItem = _interopRequireDefault(require("./StackItem"));
|
|
10
10
|
var _Box = _interopRequireDefault(require("../internals/Box"));
|
|
11
|
+
var _useStyled = require("../internals/hooks/useStyled");
|
|
11
12
|
var _utils = require("../internals/utils");
|
|
12
13
|
var _hooks = require("../internals/hooks");
|
|
14
|
+
var _utils2 = require("./utils");
|
|
13
15
|
const Subcomponents = {
|
|
14
16
|
Item: _StackItem.default
|
|
15
17
|
};
|
|
@@ -43,20 +45,33 @@ const Stack = (0, _utils.forwardRef)((props, ref) => {
|
|
|
43
45
|
const {
|
|
44
46
|
withPrefix,
|
|
45
47
|
merge,
|
|
46
|
-
cssVar,
|
|
47
48
|
responsive
|
|
48
49
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
49
|
-
const
|
|
50
|
+
const baseClasses = merge(className, withPrefix({
|
|
50
51
|
wrap
|
|
51
52
|
}), ...responsive(direction));
|
|
52
|
-
|
|
53
|
+
|
|
54
|
+
// Generate CSS variables for Stack
|
|
55
|
+
const cssVars = (0, _utils2.generateStackCssVars)({
|
|
56
|
+
spacing,
|
|
57
|
+
align,
|
|
58
|
+
justify
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Use the useStyled hook to manage CSS variables
|
|
62
|
+
const styled = (0, _useStyled.useStyled)({
|
|
63
|
+
cssVars,
|
|
64
|
+
className: baseClasses,
|
|
65
|
+
style,
|
|
66
|
+
prefix: classPrefix
|
|
67
|
+
});
|
|
53
68
|
const filteredChildren = _react.default.Children.toArray(children);
|
|
54
69
|
const childCount = filteredChildren.length;
|
|
55
70
|
return /*#__PURE__*/_react.default.createElement(_Box.default, (0, _extends2.default)({
|
|
56
71
|
as: as,
|
|
57
72
|
ref: ref,
|
|
58
|
-
className:
|
|
59
|
-
style:
|
|
73
|
+
className: styled.className,
|
|
74
|
+
style: styled.style
|
|
60
75
|
}, rest), filteredChildren.map((child, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
61
76
|
key: index
|
|
62
77
|
}, child, index < childCount - 1 && divider)));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Generate CSS variables for Stack component
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateStackCssVars({ spacing, align, justify }: {
|
|
6
|
+
spacing?: number | string | (number | string)[];
|
|
7
|
+
align?: CSSProperties['alignItems'];
|
|
8
|
+
justify?: CSSProperties['justifyContent'];
|
|
9
|
+
}): Record<string, string | number | undefined>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.generateStackCssVars = generateStackCssVars;
|
|
6
|
+
var _utils = require("../internals/utils");
|
|
7
|
+
/**
|
|
8
|
+
* Generate CSS variables for Stack component
|
|
9
|
+
*/
|
|
10
|
+
function generateStackCssVars({
|
|
11
|
+
spacing,
|
|
12
|
+
align,
|
|
13
|
+
justify
|
|
14
|
+
}) {
|
|
15
|
+
const cssVars = {};
|
|
16
|
+
const prefix = `--rs-stack-`;
|
|
17
|
+
|
|
18
|
+
// Add spacing CSS variable
|
|
19
|
+
if (spacing !== undefined) {
|
|
20
|
+
// Handle array or single value for spacing
|
|
21
|
+
if (Array.isArray(spacing)) {
|
|
22
|
+
cssVars[`${prefix}spacing`] = spacing.map(s => (0, _utils.getCssValue)(s)).join(' ');
|
|
23
|
+
} else {
|
|
24
|
+
cssVars[`${prefix}spacing`] = (0, _utils.getCssValue)(spacing);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Add align CSS variable
|
|
29
|
+
if (align !== undefined) {
|
|
30
|
+
cssVars[`${prefix}align`] = align;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Add justify CSS variable
|
|
34
|
+
if (justify !== undefined) {
|
|
35
|
+
cssVars[`${prefix}justify`] = justify;
|
|
36
|
+
}
|
|
37
|
+
return cssVars;
|
|
38
|
+
}
|
package/cjs/Tabs/Tabs.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ import { BoxProps } from '../internals/Box';
|
|
|
6
6
|
export interface TabsProps extends BoxProps {
|
|
7
7
|
/**
|
|
8
8
|
* The appearance of the tabs.
|
|
9
|
+
* - 'pills' appearance is deprecated. Use `SegmentedControl` component instead.
|
|
10
|
+
*
|
|
9
11
|
* @default 'tabs'
|
|
10
|
-
*
|
|
12
|
+
*
|
|
11
13
|
*/
|
|
12
|
-
appearance?: 'tabs' | 'subtle'
|
|
14
|
+
appearance?: 'tabs' | 'subtle';
|
|
13
15
|
/**
|
|
14
16
|
* The key of the active tab.
|
|
15
17
|
*/
|
package/cjs/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export * from './RadioGroup';
|
|
|
57
57
|
export * from './RadioTile';
|
|
58
58
|
export * from './RadioTileGroup';
|
|
59
59
|
export * from './SelectPicker';
|
|
60
|
+
export * from './SegmentedControl';
|
|
60
61
|
export * from './CheckPicker';
|
|
61
62
|
export * from './InputPicker';
|
|
62
63
|
export * from './TagPicker';
|