rsuite 6.0.0-canary-2025031415 → 6.0.0-canary-20250315

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.
@@ -23,14 +23,16 @@ const NavbarMegaMenu = /*#__PURE__*/React.forwardRef((props, ref) => {
23
23
  withPrefix
24
24
  } = useStyles(classPrefix);
25
25
  const classes = merge(className, withPrefix());
26
- const renderMenu = useCallback((_ref, ref) => {
27
- let {
28
- onClose
29
- } = _ref;
26
+ const renderMenu = useCallback((menuProps, ref) => {
27
+ const {
28
+ onClose,
29
+ className
30
+ } = menuProps;
30
31
  return /*#__PURE__*/React.createElement(Popover, {
31
32
  ref: ref,
32
33
  full: true,
33
- arrow: false
34
+ arrow: false,
35
+ className: className
34
36
  }, typeof children === 'function' ? children({
35
37
  onClose
36
38
  }) : children);
@@ -2,9 +2,11 @@ import React from 'react';
2
2
  import { ButtonProps } from '../Button';
3
3
  import type { UploaderLocale } from '../locales';
4
4
  export interface UploadTriggerProps extends ButtonProps {
5
+ children?: React.ReactElement<any>;
6
+ className?: string;
7
+ disabled?: boolean;
5
8
  name?: string;
6
9
  multiple?: boolean;
7
- disabled?: boolean;
8
10
  readOnly?: boolean;
9
11
  draggable?: boolean;
10
12
  accept?: string;
@@ -3,7 +3,9 @@ import React, { useRef, useState, useImperativeHandle } from 'react';
3
3
  import Button from "../Button/index.js";
4
4
  import { useStyles, useEventCallback } from "../internals/hooks/index.js";
5
5
  import { forwardRef } from "../internals/utils/index.js";
6
+ import classNames from 'classnames';
6
7
  const UploadTrigger = forwardRef((props, ref) => {
8
+ var _children$props;
7
9
  const {
8
10
  as: Component = Button,
9
11
  name,
@@ -27,11 +29,10 @@ const UploadTrigger = forwardRef((props, ref) => {
27
29
  const [dragOver, setDragOver] = useState(false);
28
30
  const inputRef = useRef(null);
29
31
  const {
30
- merge,
31
32
  withPrefix,
32
33
  prefix
33
34
  } = useStyles(classPrefix);
34
- const classes = merge(className, withPrefix({
35
+ const classes = classNames(className, withPrefix({
35
36
  disabled,
36
37
  customize: children,
37
38
  'drag-over': dragOver
@@ -75,19 +76,25 @@ const UploadTrigger = forwardRef((props, ref) => {
75
76
  root: rootRef.current,
76
77
  clearInput: handleClearInput
77
78
  }));
79
+
80
+ // Prepare button props with event handlers conditionally applied
78
81
  const buttonProps = {
79
82
  ...rest,
80
83
  disabled,
81
- className: prefix('btn')
84
+ className: prefix('btn'),
85
+ // Only add event handlers if component is interactive
86
+ ...(!disabled && !readOnly && {
87
+ onClick: handleClick,
88
+ onDragEnter: handleDragEnter,
89
+ onDragLeave: handleDragLeave,
90
+ onDragOver: handleDragOver,
91
+ onDrop: handleDrop
92
+ })
82
93
  };
83
- if (!disabled && !readOnly) {
84
- buttonProps.onClick = handleClick;
85
- buttonProps.onDragEnter = handleDragEnter;
86
- buttonProps.onDragLeave = handleDragLeave;
87
- buttonProps.onDragOver = handleDragOver;
88
- buttonProps.onDrop = handleDrop;
89
- }
90
- const trigger = children ? (/*#__PURE__*/React.cloneElement(React.Children.only(children), buttonProps)) : /*#__PURE__*/React.createElement(Component, buttonProps, locale === null || locale === void 0 ? void 0 : locale.upload);
94
+ const trigger = children ? (/*#__PURE__*/React.cloneElement(children, {
95
+ ...buttonProps,
96
+ className: classNames((_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.className, prefix('btn'))
97
+ })) : /*#__PURE__*/React.createElement(Component, buttonProps, locale === null || locale === void 0 ? void 0 : locale.upload);
91
98
  return /*#__PURE__*/React.createElement("div", {
92
99
  ref: rootRef,
93
100
  className: classes
@@ -33,7 +33,7 @@ export interface UploaderProps extends WithAsProps, Omit<UploadTriggerProps, 'on
33
33
  /** Automatically upload files after selecting them */
34
34
  autoUpload?: boolean;
35
35
  /** Primary content */
36
- children?: React.ReactNode;
36
+ children?: React.ReactElement;
37
37
  /** List of uploaded files */
38
38
  defaultFileList?: FileType[];
39
39
  /** List of uploaded files (Controlled) */
@@ -3,9 +3,9 @@ import type { WithAsProps, Breakpoints, ColorScheme, Size } from '../types';
3
3
  export interface BoxProps extends WithAsProps {
4
4
  /** Override the 'as' prop when Box is used as a base component */
5
5
  componentAs?: WithAsProps['as'];
6
- /** Display element */
6
+ /** Breakpoint below which the component is hidden with `display: none` */
7
7
  visible?: Breakpoints;
8
- /** Hide element */
8
+ /** Breakpoint above which the component is hidden with `display: none` */
9
9
  hidden?: Breakpoints;
10
10
  /** Display property */
11
11
  display?: CSS['display'];
@@ -10,7 +10,6 @@ const Box = forwardRef((props, ref) => {
10
10
  classPrefix = 'box',
11
11
  className,
12
12
  children,
13
- componentAs,
14
13
  visible,
15
14
  hidden,
16
15
  style,
@@ -23,13 +22,12 @@ const Box = forwardRef((props, ref) => {
23
22
  withPrefix
24
23
  } = useStyles(classPrefix);
25
24
  const classes = merge(className, withPrefix({
26
- [`visible-${visible}`]: visible,
27
- [`hidden-${hidden}`]: hidden
25
+ [`visible-from-${visible}`]: visible,
26
+ [`hidden-from-${hidden}`]: hidden
28
27
  }));
29
28
  const boxCSSVars = getBoxCSSVariables(boxProps);
30
29
  const boxStyle = mergeStyles(style, boxCSSVars);
31
- const FinalComponent = componentAs || Component;
32
- return /*#__PURE__*/React.createElement(FinalComponent, _extends({
30
+ return /*#__PURE__*/React.createElement(Component, _extends({
33
31
  ref: ref,
34
32
  className: classes,
35
33
  style: boxStyle
@@ -95,98 +95,63 @@
95
95
  }
96
96
  }
97
97
 
98
- // Mobile first breakpoint mixins
99
- .make-visible(@breakpoint) {
100
- :where(.rs-box-visible-@{breakpoint}) {
98
+ // Responsive visibility classes
99
+ @media (max-width: (@screen-sm - 1)) {
100
+ :where(.rs-box-visible-from-xs) {
101
101
  display: none !important;
102
+ }
103
+ }
104
+
105
+ @media (min-width: @screen-sm) {
106
+ :where(.rs-box-hidden-from-xs) {
107
+ display: none !important;
108
+ }
109
+ }
110
+
111
+ @media (max-width: (@screen-md - 1)) {
112
+ :where(.rs-box-visible-from-sm) {
113
+ display: none !important;
114
+ }
115
+ }
116
+
117
+ @media (min-width: @screen-md) {
118
+ :where(.rs-box-hidden-from-sm) {
119
+ display: none !important;
120
+ }
121
+ }
102
122
 
103
- & when (@breakpoint = xs) {
104
- @media (max-width: (@screen-sm - 1)) {
105
- display: var(--rs-box-display, inherit) !important;
106
- }
107
- }
108
-
109
- & when (@breakpoint = sm) {
110
- @media (max-width: (@screen-md - 1)) {
111
- display: var(--rs-box-display, inherit) !important;
112
- }
113
- }
114
-
115
- & when (@breakpoint = md) {
116
- @media (max-width: (@screen-lg - 1)) {
117
- display: var(--rs-box-display, inherit) !important;
118
- }
119
- }
120
-
121
- & when (@breakpoint = lg) {
122
- @media (max-width: (@screen-xl - 1)) {
123
- display: var(--rs-box-display, inherit) !important;
124
- }
125
- }
126
-
127
- & when (@breakpoint = xl) {
128
- @media (max-width: (@screen-xxl - 1)) {
129
- display: var(--rs-box-display, inherit) !important;
130
- }
131
- }
132
-
133
- & when (@breakpoint = xxl) {
134
- display: var(--rs-box-display, inherit) !important;
135
- }
123
+ @media (max-width: (@screen-lg - 1)) {
124
+ :where(.rs-box-visible-from-md) {
125
+ display: none !important;
136
126
  }
137
127
  }
138
128
 
139
- .make-hidden(@breakpoint) {
140
- :where(.rs-box-hidden-@{breakpoint}) {
141
- display: var(--rs-box-display, inherit) !important;
142
-
143
- & when (@breakpoint = xs) {
144
- @media (max-width: (@screen-sm - 1)) {
145
- display: none !important;
146
- }
147
- }
148
-
149
- & when (@breakpoint = sm) {
150
- @media (max-width: (@screen-md - 1)) {
151
- display: none !important;
152
- }
153
- }
154
-
155
- & when (@breakpoint = md) {
156
- @media (max-width: (@screen-lg - 1)) {
157
- display: none !important;
158
- }
159
- }
160
-
161
- & when (@breakpoint = lg) {
162
- @media (max-width: (@screen-xl - 1)) {
163
- display: none !important;
164
- }
165
- }
166
-
167
- & when (@breakpoint = xl) {
168
- @media (max-width: (@screen-xxl - 1)) {
169
- display: none !important;
170
- }
171
- }
172
-
173
- & when (@breakpoint = xxl) {
174
- display: none !important;
175
- }
129
+ @media (min-width: @screen-lg) {
130
+ :where(.rs-box-hidden-from-md) {
131
+ display: none !important;
176
132
  }
177
133
  }
178
134
 
179
- // Generate breakpoint classes
180
- .make-visible(xs);
181
- .make-visible(sm);
182
- .make-visible(md);
183
- .make-visible(lg);
184
- .make-visible(xl);
185
- .make-visible(xxl);
186
-
187
- .make-hidden(xs);
188
- .make-hidden(sm);
189
- .make-hidden(md);
190
- .make-hidden(lg);
191
- .make-hidden(xl);
192
- .make-hidden(xxl);
135
+ @media (max-width: (@screen-xl - 1)) {
136
+ :where(.rs-box-visible-from-lg) {
137
+ display: none !important;
138
+ }
139
+ }
140
+
141
+ @media (min-width: @screen-xl) {
142
+ :where(.rs-box-hidden-from-lg) {
143
+ display: none !important;
144
+ }
145
+ }
146
+
147
+ @media (max-width: (@screen-xxl - 1)) {
148
+ :where(.rs-box-visible-from-xl) {
149
+ display: none !important;
150
+ }
151
+ }
152
+
153
+ @media (min-width: @screen-xxl) {
154
+ :where(.rs-box-hidden-from-xl) {
155
+ display: none !important;
156
+ }
157
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "6.0.0-canary-2025031415",
3
+ "version": "6.0.0-canary-20250315",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",