@lanaco/lnc-react-ui 4.0.1 → 4.0.2
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/DropdownItem.cjs +12 -12
- package/dist/DropdownItem.js +10 -10
- package/package.json +1 -1
package/dist/DropdownItem.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),d=require("react"),
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),d=require("react"),l=require("./index-DXnSjbfJ.cjs"),G=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),C=require("./Icon.cjs"),s=require("./utils-hdRGTsQ7.cjs"),H=require("./emotion-element-5486c51c.browser.esm-QRQ5FSjv.cjs"),J=G.newStyled.div`
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
cursor: ${o=>o.disabled==!1?"pointer":"context-menu"};
|
|
4
4
|
width: 100%;
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
min-height: 2.25rem;
|
|
9
9
|
gap: 0.563rem;
|
|
10
10
|
padding: 0.563rem;
|
|
11
|
-
color: ${o=>
|
|
11
|
+
color: ${o=>s.getColorRgbaValue(o.theme,"MenuItem",o.color,o.isActive===!0?"active":"enabled","text")};
|
|
12
12
|
&:hover {
|
|
13
|
-
${o=>o.disabled===!1&&`background-color: ${
|
|
13
|
+
${o=>o.disabled===!1&&`background-color: ${s.getColorRgbaValue(o.theme,"MenuItem",o.color,"hover","background","backgroundOpacity")};`}
|
|
14
14
|
|
|
15
|
-
${o=>o.disabled===!1&&`color: ${
|
|
15
|
+
${o=>o.disabled===!1&&`color: ${s.getColorRgbaValue(o.theme,"MenuItem",o.color,"hover","text")};`}
|
|
16
16
|
& .drop-down-icon-lnc {
|
|
17
|
-
color: ${
|
|
17
|
+
${o=>o.disabled===!1&&`color: ${s.getColorRgbaValue(o.theme,"MenuItem",o.color,"hover","icon")};`}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
${o=>
|
|
20
|
+
${o=>s.getComponentTypographyCss(o.theme,"MenuItem",o.size,"enabled")};
|
|
21
21
|
& .drop-down-icon-lnc {
|
|
22
|
-
color: ${o=>o.isActive&&o.disabled==!1?
|
|
23
|
-
${o=>o.disabled===!0&&
|
|
22
|
+
color: ${o=>o.isActive&&o.disabled==!1?s.getColorRgbaValue(o.theme,"MenuItem",o.color,"focus","icon"):s.getColorRgbaValue(o.theme,"MenuItem",o.color,"enabled","icon")};
|
|
23
|
+
${o=>o.disabled===!0&&s.getDisabledStateCss(o.theme)};
|
|
24
24
|
background: transparent;
|
|
25
25
|
}
|
|
26
26
|
& .sub-menu-icon-lnc {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
transform: ${o=>o.showNested?"rotate(180deg)":"rotate(0)"};
|
|
29
29
|
transition: transform 0.25s ease;
|
|
30
30
|
}
|
|
31
|
-
${o=>o.isActive==!0&&o.disabled==!1&&`background-color: ${
|
|
32
|
-
color: ${
|
|
31
|
+
${o=>o.isActive==!0&&o.disabled==!1&&`background-color: ${s.getColorRgbaValue(o.theme,"MenuItem",o.color,"focus","background","backgroundOpacity")};
|
|
32
|
+
color: ${s.getColorRgbaValue(o.theme,"MenuItem",o.color,"focus","text")};
|
|
33
33
|
`}
|
|
34
34
|
outline: none;
|
|
35
|
-
${o=>o.disabled===!0&&
|
|
36
|
-
`,P=d.forwardRef((o,a)=>{const{__TYPE__:Q="MENU_ITEM",active:f=!1,icon:T,disabled:m=!1,isNested:u=!1,showNested:v,value:E,onFocus:M=()=>{},onBlur:N=()=>{},onClick:x=()=>{},onKeyDown:$=()=>{},onMouseEnter:W=()=>{},onMouseLeave:X=()=>{},toggleNested:r=()=>{},onItemSelected:w=()=>{},color:k,className:_="",style:R={},size:S="small",iconProps:A,children:y,...q}=o,D={theme:H.useTheme(),color:k,style:R,size:S},g=d.useRef(),[O,b]=d.useState(f);d.useEffect(()=>{b(f)},[f]);const V=e=>{m==!1&&(u&&r&&r(),w(e,E,y),x(e))},j=e=>{b(!0),M(e)},F=e=>{b(!1),N(e)},z=e=>{e.preventDefault(),e.key=="ArrowDown"?h(a?a.current:g.current):e.key=="ArrowUp"?p(a?a.current:g.current):e.key=="Enter"&&m==!1&&(u&&r&&r(),w(e,E,y)),$(e)},h=e=>{if(e!=null&&e.nextSibling){let n=B(e);if(n!=null&&n.node&&(n==null?void 0:n.type)=="item")n.node.focus();else if(n!=null&&n.node&&(n==null?void 0:n.type)=="nested"){let i=L(n.node);i&&i.focus()}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&h(e.parentElement)}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&h(e.parentElement)},p=e=>{if(e!=null&&e.previousSibling){let n=K(e);if(n!=null&&n.node&&(n==null?void 0:n.type)=="item")n.node.focus();else if(n!=null&&n.node&&(n==null?void 0:n.type)=="nested"){let i=U(n.node);i&&i.focus()}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&p(e.parentElement)}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&p(e.parentElement)},B=e=>{for(;e=e.nextSibling;){if(t(e,"menu-item-lnc"))return{node:e,type:"item"};if(t(e,"nested-item-lnc"))return{node:e,type:"nested"}}return null},K=e=>{for(;e=e.previousSibling;){if(t(e,"menu-item-lnc"))return{node:e,type:"item"};if(t(e,"nested-item-lnc"))return{node:e,type:"nested"}}return null},L=e=>{var n;return(n=Array.from(e.querySelectorAll(".menu-item-lnc")))==null?void 0:n[0]},U=e=>{var n;return(n=Array.from(e.querySelectorAll(".menu-item-lnc")))==null?void 0:n.pop()},t=(e,n)=>{var i=" "+e.className+" ",Y=" "+n+" ";return i.indexOf(Y)!=-1};return c.jsx(c.Fragment,{children:c.jsxs(J,{ref:a||g,className:"menu-item-lnc "+_,disabled:m,tabIndex:0,onKeyDown:z,onFocus:j,onBlur:F,onClick:V,isActive:O,showNested:v,...D,...q,children:[T&&c.jsx(C,{icon:T,className:"drop-down-icon-lnc",...A}),c.jsx("div",{className:"menu-item-text-lnc",children:y}),u&&c.jsx(C,{icon:"angle-down",className:"sub-menu-icon-lnc"})]})})});P.propTypes={active:
|
|
35
|
+
${o=>o.disabled===!0&&s.getDisabledStateCss(o.theme)};
|
|
36
|
+
`,P=d.forwardRef((o,a)=>{const{__TYPE__:Q="MENU_ITEM",active:f=!1,icon:T,disabled:m=!1,isNested:u=!1,showNested:v,value:E,onFocus:M=()=>{},onBlur:N=()=>{},onClick:x=()=>{},onKeyDown:$=()=>{},onMouseEnter:W=()=>{},onMouseLeave:X=()=>{},toggleNested:r=()=>{},onItemSelected:w=()=>{},color:k,className:_="",style:R={},size:S="small",iconProps:A,children:y,...q}=o,D={theme:H.useTheme(),color:k,style:R,size:S},g=d.useRef(),[O,b]=d.useState(f);d.useEffect(()=>{b(f)},[f]);const V=e=>{m==!1&&(u&&r&&r(),w(e,E,y),x(e))},j=e=>{b(!0),M(e)},F=e=>{b(!1),N(e)},z=e=>{e.preventDefault(),e.key=="ArrowDown"?h(a?a.current:g.current):e.key=="ArrowUp"?p(a?a.current:g.current):e.key=="Enter"&&m==!1&&(u&&r&&r(),w(e,E,y)),$(e)},h=e=>{if(e!=null&&e.nextSibling){let n=B(e);if(n!=null&&n.node&&(n==null?void 0:n.type)=="item")n.node.focus();else if(n!=null&&n.node&&(n==null?void 0:n.type)=="nested"){let i=L(n.node);i&&i.focus()}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&h(e.parentElement)}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&h(e.parentElement)},p=e=>{if(e!=null&&e.previousSibling){let n=K(e);if(n!=null&&n.node&&(n==null?void 0:n.type)=="item")n.node.focus();else if(n!=null&&n.node&&(n==null?void 0:n.type)=="nested"){let i=U(n.node);i&&i.focus()}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&p(e.parentElement)}else e!=null&&e.parentElement&&t(e.parentElement,"nested-item-lnc")&&p(e.parentElement)},B=e=>{for(;e=e.nextSibling;){if(t(e,"menu-item-lnc"))return{node:e,type:"item"};if(t(e,"nested-item-lnc"))return{node:e,type:"nested"}}return null},K=e=>{for(;e=e.previousSibling;){if(t(e,"menu-item-lnc"))return{node:e,type:"item"};if(t(e,"nested-item-lnc"))return{node:e,type:"nested"}}return null},L=e=>{var n;return(n=Array.from(e.querySelectorAll(".menu-item-lnc")))==null?void 0:n[0]},U=e=>{var n;return(n=Array.from(e.querySelectorAll(".menu-item-lnc")))==null?void 0:n.pop()},t=(e,n)=>{var i=" "+e.className+" ",Y=" "+n+" ";return i.indexOf(Y)!=-1};return c.jsx(c.Fragment,{children:c.jsxs(J,{ref:a||g,className:"menu-item-lnc "+_,disabled:m,tabIndex:0,onKeyDown:z,onFocus:j,onBlur:F,onClick:V,isActive:O,showNested:v,...D,...q,children:[T&&c.jsx(C,{icon:T,className:"drop-down-icon-lnc",...A}),c.jsx("div",{className:"menu-item-text-lnc",children:y}),u&&c.jsx(C,{icon:"angle-down",className:"sub-menu-icon-lnc"})]})})});P.propTypes={active:l.PropTypes.bool,icon:l.PropTypes.string,disabled:l.PropTypes.bool,isNested:l.PropTypes.bool,value:l.PropTypes.any,onBlur:l.PropTypes.func,onFocus:l.PropTypes.func,onClick:l.PropTypes.func,onKeyDown:l.PropTypes.func,onMouseEnter:l.PropTypes.func,onMouseLeave:l.PropTypes.func,className:l.PropTypes.string,style:l.PropTypes.object,color:l.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral","gray"]),iconProps:l.PropTypes.any,size:l.PropTypes.oneOf(["small","medium","large"]),__TYPE__:l.PropTypes.string};P.displayName="MENU_ITEM";module.exports=P;
|
package/dist/DropdownItem.js
CHANGED
|
@@ -40,13 +40,13 @@ const ne = Z.div`
|
|
|
40
40
|
"text"
|
|
41
41
|
)};`}
|
|
42
42
|
& .drop-down-icon-lnc {
|
|
43
|
-
|
|
43
|
+
${(n) => n.disabled === !1 && `color: ${s(
|
|
44
44
|
n.theme,
|
|
45
45
|
"MenuItem",
|
|
46
46
|
n.color,
|
|
47
47
|
"hover",
|
|
48
48
|
"icon"
|
|
49
|
-
)}
|
|
49
|
+
)};`}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
${(n) => I(n.theme, "MenuItem", n.size, "enabled")};
|
|
@@ -102,11 +102,11 @@ const ne = Z.div`
|
|
|
102
102
|
//----------------
|
|
103
103
|
onFocus: C = () => {
|
|
104
104
|
},
|
|
105
|
-
onBlur:
|
|
105
|
+
onBlur: _ = () => {
|
|
106
106
|
},
|
|
107
|
-
onClick:
|
|
107
|
+
onClick: x = () => {
|
|
108
108
|
},
|
|
109
|
-
onKeyDown:
|
|
109
|
+
onKeyDown: A = () => {
|
|
110
110
|
},
|
|
111
111
|
onMouseEnter: le = () => {
|
|
112
112
|
},
|
|
@@ -117,25 +117,25 @@ const ne = Z.div`
|
|
|
117
117
|
onItemSelected: v = () => {
|
|
118
118
|
},
|
|
119
119
|
//----------------
|
|
120
|
-
color:
|
|
120
|
+
color: p,
|
|
121
121
|
className: S = "",
|
|
122
122
|
style: O = {},
|
|
123
123
|
size: P = "small",
|
|
124
124
|
iconProps: D,
|
|
125
125
|
children: u,
|
|
126
126
|
...T
|
|
127
|
-
} = n, F = { theme: ee(), color:
|
|
127
|
+
} = n, F = { theme: ee(), color: p, style: O, size: P }, h = Q(), [R, b] = W(f);
|
|
128
128
|
X(() => {
|
|
129
129
|
b(f);
|
|
130
130
|
}, [f]);
|
|
131
131
|
const z = (e) => {
|
|
132
|
-
m == !1 && (r && c && c(), v(e, w, u),
|
|
132
|
+
m == !1 && (r && c && c(), v(e, w, u), x(e));
|
|
133
133
|
}, B = (e) => {
|
|
134
134
|
b(!0), C(e);
|
|
135
135
|
}, K = (e) => {
|
|
136
|
-
b(!1),
|
|
136
|
+
b(!1), _(e);
|
|
137
137
|
}, j = (e) => {
|
|
138
|
-
e.preventDefault(), e.key == "ArrowDown" ? g(a ? a.current : h.current) : e.key == "ArrowUp" ? y(a ? a.current : h.current) : e.key == "Enter" && m == !1 && (r && c && c(), v(e, w, u)),
|
|
138
|
+
e.preventDefault(), e.key == "ArrowDown" ? g(a ? a.current : h.current) : e.key == "ArrowUp" ? y(a ? a.current : h.current) : e.key == "Enter" && m == !1 && (r && c && c(), v(e, w, u)), A(e);
|
|
139
139
|
}, g = (e) => {
|
|
140
140
|
if (e != null && e.nextSibling) {
|
|
141
141
|
let o = L(e);
|