@rescui/dropdown 0.7.20 → 0.7.21-RUI-247-Make-packets-react-19-ready-f91b52ef.16
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/lib/dropdown.js +16 -6
- package/lib/dropdown.p.module.css.js +15 -0
- package/lib/index.css +29 -29
- package/lib/use-dropdown-state.js +1 -0
- package/lib/use-scrollable-container.js +1 -0
- package/package.json +11 -11
- package/lib/index.p.module.css.js +0 -15
package/lib/dropdown.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useState, useEffect, useImperativeHandle, useContext, useCallback } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import cn from 'classnames';
|
|
4
5
|
import { usePopper } from 'react-popper';
|
|
@@ -8,7 +9,7 @@ import FocusLock from 'react-focus-lock';
|
|
|
8
9
|
import ReactDOM from 'react-dom';
|
|
9
10
|
import { useDropdownState, DROPDOWN_STATES } from './use-dropdown-state.js';
|
|
10
11
|
import { useScrollableContainer } from './use-scrollable-container.js';
|
|
11
|
-
import styles from './
|
|
12
|
+
import styles from './dropdown.p.module.css.js';
|
|
12
13
|
import { applyMaxSize, sameWidthModifier } from './custom-modifiers.js';
|
|
13
14
|
import { extractThemeFromCss, extractPrimaryColors } from './css-vars-utils.js';
|
|
14
15
|
|
|
@@ -51,9 +52,9 @@ function getPopperOptions(_ref) {
|
|
|
51
52
|
const Portal = _ref2 => {
|
|
52
53
|
let {
|
|
53
54
|
children,
|
|
54
|
-
target = document.body
|
|
55
|
+
target = typeof window !== 'undefined' ? document.body : undefined
|
|
55
56
|
} = _ref2;
|
|
56
|
-
return /*#__PURE__*/ReactDOM.createPortal(children, target);
|
|
57
|
+
return target ? /*#__PURE__*/ReactDOM.createPortal(children, target) : null;
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
function useOnOutsideClick(_ref3) {
|
|
@@ -121,7 +122,7 @@ const DropdownRender = (_ref5, externalRef) => {
|
|
|
121
122
|
children,
|
|
122
123
|
trigger,
|
|
123
124
|
theme: themeFromProps,
|
|
124
|
-
isOpen = false,
|
|
125
|
+
isOpen: isOpenFromProps = false,
|
|
125
126
|
placement = 'bottom-start',
|
|
126
127
|
mode = 'classic',
|
|
127
128
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -142,7 +143,16 @@ const DropdownRender = (_ref5, externalRef) => {
|
|
|
142
143
|
const {
|
|
143
144
|
setContentEl,
|
|
144
145
|
scrollableStyles
|
|
145
|
-
} = useScrollableContainer();
|
|
146
|
+
} = useScrollableContainer(); // We set isOpen this way to avoid hydration issue due to
|
|
147
|
+
// the Portal to document.body which does not exist on the server.
|
|
148
|
+
// So even if isOpen prop is used, the tooltip will not render on the server, and
|
|
149
|
+
// it's the same on the first client render, so there is no hydration issue.
|
|
150
|
+
|
|
151
|
+
const [isFirstRender, setIsFirstRender] = useState(true);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
setIsFirstRender(false);
|
|
154
|
+
}, []);
|
|
155
|
+
const isOpen = isFirstRender && !renderInTrigger ? false : isOpenFromProps;
|
|
146
156
|
useOnOutsideClick({
|
|
147
157
|
isEnabled: isOpen,
|
|
148
158
|
onOutsideClick: onRequestClose,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
"themeLight": "_themeLight_1wxie6_60",
|
|
3
|
+
"themeDark": "_themeDark_1wxie6_63",
|
|
4
|
+
"dropdown": "_dropdown_1wxie6_67",
|
|
5
|
+
"triggerWrapper": "_triggerWrapper_1wxie6_74",
|
|
6
|
+
"contentWrapper": "_contentWrapper_1wxie6_78",
|
|
7
|
+
"fadeInBottomToTop": "_fadeInBottomToTop_1wxie6_1",
|
|
8
|
+
"fadeInTopToBottom": "_fadeInTopToBottom_1wxie6_1",
|
|
9
|
+
"fadeInLeftToRight": "_fadeInLeftToRight_1wxie6_1",
|
|
10
|
+
"fadeInRightToLeft": "_fadeInRightToLeft_1wxie6_1",
|
|
11
|
+
"wrapperHidden": "_wrapperHidden_1wxie6_109",
|
|
12
|
+
"modeClassic": "_modeClassic_1wxie6_129",
|
|
13
|
+
"modeRock": "_modeRock_1wxie6_133"
|
|
14
|
+
};
|
|
15
|
+
export { styles as default };
|
package/lib/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@keyframes
|
|
1
|
+
@keyframes _fadeInTopToBottom_1wxie6_1{
|
|
2
2
|
0%{
|
|
3
3
|
opacity:0;
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
transform:none;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
@keyframes
|
|
13
|
+
@keyframes _fadeInBottomToTop_1wxie6_1{
|
|
14
14
|
0%{
|
|
15
15
|
opacity:0;
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
transform:none;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
@keyframes
|
|
25
|
+
@keyframes _fadeInLeftToRight_1wxie6_1{
|
|
26
26
|
0%{
|
|
27
27
|
opacity:0;
|
|
28
28
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
transform:none;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
@keyframes
|
|
37
|
+
@keyframes _fadeInRightToLeft_1wxie6_1{
|
|
38
38
|
0%{
|
|
39
39
|
opacity:0;
|
|
40
40
|
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
transform:none;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
.
|
|
49
|
+
._themeLight_1wxie6_60{
|
|
50
50
|
--rs-theme-dark:0;
|
|
51
51
|
}
|
|
52
|
-
.
|
|
52
|
+
._themeDark_1wxie6_63{
|
|
53
53
|
--rs-theme-dark:1;
|
|
54
54
|
}
|
|
55
|
-
.
|
|
55
|
+
._dropdown_1wxie6_67{
|
|
56
56
|
--_rs-theme-dark:var(
|
|
57
57
|
--_rs-internal-force-theme-dark-consult-rescui-before-using,
|
|
58
58
|
var(--rs-theme-dark, 0)
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
--_rs-theme-light-coefficient:calc(1 - var(--_rs-theme-dark-coefficient));
|
|
63
63
|
}
|
|
64
64
|
@supports (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
65
|
-
.
|
|
65
|
+
._dropdown_1wxie6_67{
|
|
66
66
|
--_rs-color-primary:color-mix(in srgb, var(--rs-color-primary-light-theme, #6B57FF) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dark-theme, #8473FF) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
67
67
|
--_rs-color-primary-dim:color-mix(in srgb, var(--rs-color-primary-dim-light-theme, #8979ff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dim-dark-theme, #6f61d2) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
68
68
|
--_rs-color-primary-fog:color-mix(in srgb, var(--rs-color-primary-fog-light-theme, #e1ddff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-fog-dark-theme, #2e2b49) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
@supports not (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
74
|
-
.
|
|
74
|
+
._dropdown_1wxie6_67{
|
|
75
75
|
--_rs-color-primary:rgb(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255);
|
|
76
76
|
--_rs-color-primary-dim:rgb(calc(var(--_rs-theme-light-coefficient, 1)*137 + var(--_rs-theme-dark-coefficient, 0)*111), calc(var(--_rs-theme-light-coefficient, 1)*121 + var(--_rs-theme-dark-coefficient, 0)*97), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*210));
|
|
77
77
|
--_rs-color-primary-fog:rgb(calc(var(--_rs-theme-light-coefficient, 1)*225 + var(--_rs-theme-dark-coefficient, 0)*46), calc(var(--_rs-theme-light-coefficient, 1)*221 + var(--_rs-theme-dark-coefficient, 0)*43), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*73));
|
|
@@ -79,14 +79,14 @@
|
|
|
79
79
|
--_rs-color-primary-t-fog:rgba(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255, calc(var(--_rs-theme-light-coefficient, 1)*0.2 + var(--_rs-theme-dark-coefficient, 0)*0.3));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
.
|
|
82
|
+
._dropdown_1wxie6_67 {
|
|
83
83
|
display:flex;
|
|
84
84
|
flex-direction:column;
|
|
85
85
|
}
|
|
86
|
-
.
|
|
86
|
+
._triggerWrapper_1wxie6_74{
|
|
87
87
|
display:inline-block;
|
|
88
88
|
}
|
|
89
|
-
.
|
|
89
|
+
._contentWrapper_1wxie6_78{
|
|
90
90
|
position:relative;
|
|
91
91
|
|
|
92
92
|
display:block;
|
|
@@ -100,40 +100,40 @@
|
|
|
100
100
|
|
|
101
101
|
transition:opacity linear 200ms, transform linear 200ms;
|
|
102
102
|
}
|
|
103
|
-
[data-popper-placement^="top" ] .
|
|
104
|
-
animation:
|
|
103
|
+
[data-popper-placement^="top" ] ._contentWrapper_1wxie6_78{
|
|
104
|
+
animation:_fadeInBottomToTop_1wxie6_1 ease 200ms;
|
|
105
105
|
}
|
|
106
|
-
[data-popper-placement^="bottom" ] .
|
|
107
|
-
animation:
|
|
106
|
+
[data-popper-placement^="bottom" ] ._contentWrapper_1wxie6_78{
|
|
107
|
+
animation:_fadeInTopToBottom_1wxie6_1 ease 200ms;
|
|
108
108
|
}
|
|
109
|
-
[data-popper-placement^="right"] .
|
|
110
|
-
animation:
|
|
109
|
+
[data-popper-placement^="right"] ._contentWrapper_1wxie6_78{
|
|
110
|
+
animation:_fadeInLeftToRight_1wxie6_1 ease 200ms;
|
|
111
111
|
}
|
|
112
|
-
[data-popper-placement^="left"] .
|
|
113
|
-
animation:
|
|
112
|
+
[data-popper-placement^="left"] ._contentWrapper_1wxie6_78{
|
|
113
|
+
animation:_fadeInRightToLeft_1wxie6_1 ease 200ms;
|
|
114
114
|
}
|
|
115
|
-
.
|
|
115
|
+
._wrapperHidden_1wxie6_109{
|
|
116
116
|
opacity:0;
|
|
117
117
|
}
|
|
118
|
-
[data-popper-placement^="top" ] .
|
|
118
|
+
[data-popper-placement^="top" ] ._wrapperHidden_1wxie6_109{
|
|
119
119
|
transform:translateY(10px);
|
|
120
120
|
}
|
|
121
|
-
[data-popper-placement^="bottom" ] .
|
|
121
|
+
[data-popper-placement^="bottom" ] ._wrapperHidden_1wxie6_109{
|
|
122
122
|
transform:translateY(-10px);
|
|
123
123
|
}
|
|
124
|
-
[data-popper-placement^="right"] .
|
|
124
|
+
[data-popper-placement^="right"] ._wrapperHidden_1wxie6_109{
|
|
125
125
|
transform:translateX(-10px);
|
|
126
126
|
}
|
|
127
|
-
[data-popper-placement^="left"] .
|
|
127
|
+
[data-popper-placement^="left"] ._wrapperHidden_1wxie6_109{
|
|
128
128
|
transform:translateX(10px);
|
|
129
129
|
}
|
|
130
|
-
.
|
|
130
|
+
._modeClassic_1wxie6_129 ._contentWrapper_1wxie6_78{
|
|
131
131
|
background-color:rgb(calc(255 - var(--_rs-theme-dark-coefficient, 0)*207), calc(255 - var(--_rs-theme-dark-coefficient, 0)*207), calc(255 - var(--_rs-theme-dark-coefficient, 0)*204));
|
|
132
132
|
}
|
|
133
|
-
.
|
|
133
|
+
._modeRock_1wxie6_133 ._contentWrapper_1wxie6_78{
|
|
134
134
|
background-color:rgb(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
135
135
|
}
|
|
136
|
-
.
|
|
136
|
+
._modeRock_1wxie6_133{
|
|
137
137
|
--rs-parent-color-primary-light-theme:var(--rs-color-primary-light-theme);
|
|
138
138
|
--rs-parent-color-primary-dim-light-theme:var(--rs-color-primary-dim-light-theme);
|
|
139
139
|
--rs-parent-color-primary-fog-light-theme:var(--rs-color-primary-fog-light-theme);
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
--rs-parent-color-primary-t-dim-dark-theme:var(--rs-color-primary-t-dim-dark-theme);
|
|
147
147
|
--rs-parent-color-primary-t-fog-dark-theme:var(--rs-color-primary-t-fog-dark-theme);
|
|
148
148
|
}
|
|
149
|
-
.
|
|
149
|
+
._modeRock_1wxie6_133 > *{
|
|
150
150
|
--rs-color-primary-dark-theme:var(--rs-parent-color-primary-light-theme);
|
|
151
151
|
--rs-color-primary-dim-dark-theme:var(--rs-parent-color-primary-dim-light-theme);
|
|
152
152
|
--rs-color-primary-fog-dark-theme:var(--rs-parent-color-primary-fog-light-theme);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/dropdown",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.21-RUI-247-Make-packets-react-19-ready-f91b52ef.16+f91b52ef",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
19
|
-
"@popperjs/core": "^2.
|
|
19
|
+
"@popperjs/core": "^2.11.8",
|
|
20
20
|
"classnames": "^2.2.6",
|
|
21
21
|
"popper-max-size-modifier": "^0.2.0",
|
|
22
22
|
"react-focus-lock": "^2.8.1",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@rescui/ui-contexts": "^0.5.0",
|
|
27
|
-
"prop-types": "^15
|
|
28
|
-
"react": ">=16.8.0 <
|
|
29
|
-
"react-dom": ">=16.8.0 <
|
|
27
|
+
"prop-types": "^15",
|
|
28
|
+
"react": ">=16.8.0 <20",
|
|
29
|
+
"react-dom": ">=16.8.0 <20"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@rescui/colors": "
|
|
33
|
-
"@rescui/icons": "
|
|
34
|
-
"@rescui/scripts": "
|
|
35
|
-
"@rescui/typography": "
|
|
36
|
-
"@rescui/visual-regression": "
|
|
32
|
+
"@rescui/colors": "0.2.10-RUI-247-Make-packets-react-19-ready-f91b52ef.16+f91b52ef",
|
|
33
|
+
"@rescui/icons": "1.2.1-RUI-247-Make-packets-react-19-ready-f91b52ef.16+f91b52ef",
|
|
34
|
+
"@rescui/scripts": "0.5.0",
|
|
35
|
+
"@rescui/typography": "0.23.3-RUI-247-Make-packets-react-19-ready-f91b52ef.16+f91b52ef",
|
|
36
|
+
"@rescui/visual-regression": "0.1.2"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "rescui-scripts build"
|
|
40
40
|
},
|
|
41
41
|
"nx": {},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "f91b52ef45b5e50ebcb7063345703b37fb950f5c"
|
|
43
43
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var styles = {
|
|
2
|
-
"themeLight": "_themeLight_1wmjs6z_60",
|
|
3
|
-
"themeDark": "_themeDark_1wmjs6z_63",
|
|
4
|
-
"dropdown": "_dropdown_1wmjs6z_67",
|
|
5
|
-
"triggerWrapper": "_triggerWrapper_1wmjs6z_74",
|
|
6
|
-
"contentWrapper": "_contentWrapper_1wmjs6z_78",
|
|
7
|
-
"fadeInBottomToTop": "_fadeInBottomToTop_1wmjs6z_1",
|
|
8
|
-
"fadeInTopToBottom": "_fadeInTopToBottom_1wmjs6z_1",
|
|
9
|
-
"fadeInLeftToRight": "_fadeInLeftToRight_1wmjs6z_1",
|
|
10
|
-
"fadeInRightToLeft": "_fadeInRightToLeft_1wmjs6z_1",
|
|
11
|
-
"wrapperHidden": "_wrapperHidden_1wmjs6z_109",
|
|
12
|
-
"modeClassic": "_modeClassic_1wmjs6z_129",
|
|
13
|
-
"modeRock": "_modeRock_1wmjs6z_133"
|
|
14
|
-
};
|
|
15
|
-
export { styles as default };
|