@canlooks/can-ui 0.0.46 → 0.0.47

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.
@@ -28,6 +28,7 @@ function useStyle({ color }) {
28
28
  const c = (0, color_1.default)(colorValue);
29
29
  const selectedBg = c.alpha(.1).string();
30
30
  const selectedAndFocused = c.alpha(.15).string();
31
+ const selectedActive = c.alpha(.08).string();
31
32
  const focusedBg = gray(mode === 'light' ? .05 : .23);
32
33
  const disabledOrActive = gray(mode === 'light' ? .1 : .17);
33
34
  return (0, react_1.css) `
@@ -38,6 +39,7 @@ function useStyle({ color }) {
38
39
  cursor: pointer;
39
40
  color: ${text.primary};
40
41
  padding: ${exports.paddingHorizontal.medium}px 12px;
42
+ position: relative;
41
43
  -webkit-tap-highlight-color: transparent;
42
44
 
43
45
  &[data-size=small] {
@@ -52,8 +54,7 @@ function useStyle({ color }) {
52
54
 
53
55
  transition: background-color .25s ${easing.easeOut};
54
56
 
55
- &:hover,
56
- &[data-focused=true] {
57
+ &:hover, &[data-focused=true] {
57
58
  background-color: ${focusedBg};
58
59
  }
59
60
 
@@ -69,7 +70,7 @@ function useStyle({ color }) {
69
70
  &[data-selected=true] {
70
71
  background-color: ${selectedBg};
71
72
 
72
- &[data-focused=true] {
73
+ &:hover, &[data-focused=true] {
73
74
  background-color: ${selectedAndFocused};
74
75
  }
75
76
 
@@ -77,6 +78,10 @@ function useStyle({ color }) {
77
78
  font-weight: bold;
78
79
  color: ${colorValue};
79
80
  }
81
+
82
+ &:active {
83
+ background-color: ${selectedActive};
84
+ }
80
85
  }
81
86
 
82
87
  &[data-disabled=true] {
@@ -20,10 +20,6 @@ exports.Ripple = (0, react_1.memo)(({ ref, color = 'primary', ...props }) => {
20
20
  (0, react_1.useLayoutEffect)(() => {
21
21
  const wrapper = rippleRef.current?.parentElement;
22
22
  if (wrapper) {
23
- const { position } = getComputedStyle(wrapper);
24
- if (position === 'static') {
25
- wrapper.style.position = 'relative';
26
- }
27
23
  const pointerDown = (e) => {
28
24
  setRipples(o => [
29
25
  ...o,
@@ -23,6 +23,7 @@ export function useStyle({ color }) {
23
23
  const c = Color(colorValue);
24
24
  const selectedBg = c.alpha(.1).string();
25
25
  const selectedAndFocused = c.alpha(.15).string();
26
+ const selectedActive = c.alpha(.08).string();
26
27
  const focusedBg = gray(mode === 'light' ? .05 : .23);
27
28
  const disabledOrActive = gray(mode === 'light' ? .1 : .17);
28
29
  return css `
@@ -33,6 +34,7 @@ export function useStyle({ color }) {
33
34
  cursor: pointer;
34
35
  color: ${text.primary};
35
36
  padding: ${paddingHorizontal.medium}px 12px;
37
+ position: relative;
36
38
  -webkit-tap-highlight-color: transparent;
37
39
 
38
40
  &[data-size=small] {
@@ -47,8 +49,7 @@ export function useStyle({ color }) {
47
49
 
48
50
  transition: background-color .25s ${easing.easeOut};
49
51
 
50
- &:hover,
51
- &[data-focused=true] {
52
+ &:hover, &[data-focused=true] {
52
53
  background-color: ${focusedBg};
53
54
  }
54
55
 
@@ -64,7 +65,7 @@ export function useStyle({ color }) {
64
65
  &[data-selected=true] {
65
66
  background-color: ${selectedBg};
66
67
 
67
- &[data-focused=true] {
68
+ &:hover, &[data-focused=true] {
68
69
  background-color: ${selectedAndFocused};
69
70
  }
70
71
 
@@ -72,6 +73,10 @@ export function useStyle({ color }) {
72
73
  font-weight: bold;
73
74
  color: ${colorValue};
74
75
  }
76
+
77
+ &:active {
78
+ background-color: ${selectedActive};
79
+ }
75
80
  }
76
81
 
77
82
  &[data-disabled=true] {
@@ -17,10 +17,6 @@ export const Ripple = memo(({ ref, color = 'primary', ...props }) => {
17
17
  useLayoutEffect(() => {
18
18
  const wrapper = rippleRef.current?.parentElement;
19
19
  if (wrapper) {
20
- const { position } = getComputedStyle(wrapper);
21
- if (position === 'static') {
22
- wrapper.style.position = 'relative';
23
- }
24
20
  const pointerDown = (e) => {
25
21
  setRipples(o => [
26
22
  ...o,
@@ -1549,7 +1549,7 @@ Error generating stack: `+I.message+`
1549
1549
  &:not([data-open=true]) {
1550
1550
  pointer-events: none;
1551
1551
  }
1552
- `]}),c4e=300;function Hoe({container:a,forceRender:l,open:_,onMaskClick:m,singleLayer:b,onOpened:k,onClosed:w,maskProps:O,removeFocusOnOpen:j=!0,...$}){const[G,B]=Yh((Fe=!1)=>_?!0:l===!0||Fe,[_,l]),de=(typeof a=="function"?a():a)||document.body;we.useEffect(()=>{var Fe,Ue;if(_)return j&&((Ue=(Fe=document.activeElement)==null?void 0:Fe.blur)==null||Ue.call(Fe)),de.style.overflow="hidden",()=>{de.style.overflow=""}},[_]);const ie=Fe=>{var Ue;(Ue=O==null?void 0:O.onClick)==null||Ue.call(O,Fe),m==null||m(Fe)},fe=Fe=>{var Ue;(Ue=O==null?void 0:O.onEntered)==null||Ue.call(O,Fe),k==null||k()},$e=()=>{var Fe;(Fe=O==null?void 0:O.onExited)==null||Fe.call(O),w==null||w(),l===!1&&B(!1)};return G.current&&nI.createPortal(Vr("div",{...$,css:kBt,className:Fi(hDe.root,$.className),"data-open":_,"data-custom-container":de!==document.body,children:[Ie(D6e,{timeout:c4e,...O,in:_,className:Fi(hDe.mask,O==null?void 0:O.className),onClick:ie,onEntered:fe,onExited:$e}),$.children]}),de)}const dg=ks("menu-item",["content","checkbox","prefix","suffix","content","children","childrenWrap","arrow"]),Jse={small:2,medium:6,large:10};function EBt({color:a}){const l=bm(a);return B_(({spacing:_,mode:m,borderRadius:b,gray:k,easing:w,text:O})=>{const j=nl(l),$=j.alpha(.1).string(),G=j.alpha(.15).string(),B=k(m==="light"?.05:.23),de=k(m==="light"?.1:.17);return Xi`
1552
+ `]}),c4e=300;function Hoe({container:a,forceRender:l,open:_,onMaskClick:m,singleLayer:b,onOpened:k,onClosed:w,maskProps:O,removeFocusOnOpen:j=!0,...$}){const[G,B]=Yh((Fe=!1)=>_?!0:l===!0||Fe,[_,l]),de=(typeof a=="function"?a():a)||document.body;we.useEffect(()=>{var Fe,Ue;if(_)return j&&((Ue=(Fe=document.activeElement)==null?void 0:Fe.blur)==null||Ue.call(Fe)),de.style.overflow="hidden",()=>{de.style.overflow=""}},[_]);const ie=Fe=>{var Ue;(Ue=O==null?void 0:O.onClick)==null||Ue.call(O,Fe),m==null||m(Fe)},fe=Fe=>{var Ue;(Ue=O==null?void 0:O.onEntered)==null||Ue.call(O,Fe),k==null||k()},$e=()=>{var Fe;(Fe=O==null?void 0:O.onExited)==null||Fe.call(O),w==null||w(),l===!1&&B(!1)};return G.current&&nI.createPortal(Vr("div",{...$,css:kBt,className:Fi(hDe.root,$.className),"data-open":_,"data-custom-container":de!==document.body,children:[Ie(D6e,{timeout:c4e,...O,in:_,className:Fi(hDe.mask,O==null?void 0:O.className),onClick:ie,onEntered:fe,onExited:$e}),$.children]}),de)}const dg=ks("menu-item",["content","checkbox","prefix","suffix","content","children","childrenWrap","arrow"]),Jse={small:2,medium:6,large:10};function EBt({color:a}){const l=bm(a);return B_(({spacing:_,mode:m,borderRadius:b,gray:k,easing:w,text:O})=>{const j=nl(l),$=j.alpha(.1).string(),G=j.alpha(.15).string(),B=j.alpha(.08).string(),de=k(m==="light"?.05:.23),ie=k(m==="light"?.1:.17);return Xi`
1553
1553
  display: flex;
1554
1554
  align-items: center;
1555
1555
  gap: ${_[3]}px;
@@ -1557,6 +1557,7 @@ Error generating stack: `+I.message+`
1557
1557
  cursor: pointer;
1558
1558
  color: ${O.primary};
1559
1559
  padding: ${Jse.medium}px 12px;
1560
+ position: relative;
1560
1561
  -webkit-tap-highlight-color: transparent;
1561
1562
 
1562
1563
  &[data-size=small] {
@@ -1571,9 +1572,8 @@ Error generating stack: `+I.message+`
1571
1572
 
1572
1573
  transition: background-color .25s ${w.easeOut};
1573
1574
 
1574
- &:hover,
1575
- &[data-focused=true] {
1576
- background-color: ${B};
1575
+ &:hover, &[data-focused=true] {
1576
+ background-color: ${de};
1577
1577
  }
1578
1578
 
1579
1579
  &[data-emphasized=true] {
@@ -1582,13 +1582,13 @@ Error generating stack: `+I.message+`
1582
1582
 
1583
1583
  &:active {
1584
1584
  transition: background-color 0s;
1585
- background-color: ${de};
1585
+ background-color: ${ie};
1586
1586
  }
1587
1587
 
1588
1588
  &[data-selected=true] {
1589
1589
  background-color: ${$};
1590
1590
 
1591
- &[data-focused=true] {
1591
+ &:hover, &[data-focused=true] {
1592
1592
  background-color: ${G};
1593
1593
  }
1594
1594
 
@@ -1596,12 +1596,16 @@ Error generating stack: `+I.message+`
1596
1596
  font-weight: bold;
1597
1597
  color: ${l};
1598
1598
  }
1599
+
1600
+ &:active {
1601
+ background-color: ${B};
1602
+ }
1599
1603
  }
1600
1604
 
1601
1605
  &[data-disabled=true] {
1602
1606
  cursor: not-allowed;
1603
1607
  color: ${O.disabled};
1604
- background-color: ${de};
1608
+ background-color: ${ie};
1605
1609
  }
1606
1610
 
1607
1611
  .${dg.checkbox} {
@@ -6533,7 +6537,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6533
6537
  100% {
6534
6538
  scale: 1;
6535
6539
  }
6536
- `,aVt=({ref:a,color:l,rippleProps:_,children:m,...b})=>{const k=Ie(Act,{..._,ref:m?a:void 0});return m?we.cloneElement(m,{...b,ref:a},m.props.children,k):k},Act=we.memo(({ref:a,color:l="primary",..._})=>{const[m,b]=we.useState([]),k=we.useRef(null);we.useLayoutEffect(()=>{var j;const O=(j=k.current)==null?void 0:j.parentElement;if(O){const{position:$}=getComputedStyle(O);$==="static"&&(O.style.position="relative");const G=ie=>{b(fe=>[...fe,{key:U6e("touch-ripple"),r:Math.sqrt(O.clientWidth**2+O.clientHeight**2),left:ie.offsetX,top:ie.offsetY,leaving:!1}]),O.addEventListener("pointerup",B),O.addEventListener("pointerleave",B)},B=()=>{b(ie=>ie.map(fe=>({...fe,leaving:!0}))),de()};O.addEventListener("pointerdown",G);const de=()=>{O.removeEventListener("pointerup",B),O.removeEventListener("pointerleave",B)};return()=>{O.removeEventListener("pointerdown",G),de()}}},[]);const w=O=>{b(j=>j.filter($=>$.key!==O))};return Ie("div",{..._,ref:Pf(a,k),css:rVt({color:l||"primary"}),className:WDe.root,children:m.map(({key:O,r:j,left:$,top:G,leaving:B})=>Ie("div",{className:WDe.ripple,style:{width:j*2,left:$,top:G},"data-leaving":B,onTransitionEnd:()=>w(O)},O))})}),$v=ks("transfer",["panel","header","checkbox","info","title","count","list","buttons"]),sVt=Io(({spacing:a,background:l,divider:_,borderRadius:m,text:b})=>Xi`
6540
+ `,aVt=({ref:a,color:l,rippleProps:_,children:m,...b})=>{const k=Ie(Act,{..._,ref:m?a:void 0});return m?we.cloneElement(m,{...b,ref:a},m.props.children,k):k},Act=we.memo(({ref:a,color:l="primary",..._})=>{const[m,b]=we.useState([]),k=we.useRef(null);we.useLayoutEffect(()=>{var j;const O=(j=k.current)==null?void 0:j.parentElement;if(O){const $=de=>{b(ie=>[...ie,{key:U6e("touch-ripple"),r:Math.sqrt(O.clientWidth**2+O.clientHeight**2),left:de.offsetX,top:de.offsetY,leaving:!1}]),O.addEventListener("pointerup",G),O.addEventListener("pointerleave",G)},G=()=>{b(de=>de.map(ie=>({...ie,leaving:!0}))),B()};O.addEventListener("pointerdown",$);const B=()=>{O.removeEventListener("pointerup",G),O.removeEventListener("pointerleave",G)};return()=>{O.removeEventListener("pointerdown",$),B()}}},[]);const w=O=>{b(j=>j.filter($=>$.key!==O))};return Ie("div",{..._,ref:Pf(a,k),css:rVt({color:l||"primary"}),className:WDe.root,children:m.map(({key:O,r:j,left:$,top:G,leaving:B})=>Ie("div",{className:WDe.ripple,style:{width:j*2,left:$,top:G},"data-leaving":B,onTransitionEnd:()=>w(O)},O))})}),$v=ks("transfer",["panel","header","checkbox","info","title","count","list","buttons"]),sVt=Io(({spacing:a,background:l,divider:_,borderRadius:m,text:b})=>Xi`
6537
6541
  display: inline-flex;
6538
6542
  gap: ${a[3]}px;
6539
6543
 
@@ -7071,7 +7075,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7071
7075
  display: flex !important;
7072
7076
  }
7073
7077
  }
7074
- `})]),zVt="0.0.45";/*!
7078
+ `})]),zVt="0.0.46";/*!
7075
7079
  * Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
7076
7080
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
7077
7081
  * Copyright 2024 Fonticons, Inc.
@@ -5,7 +5,7 @@
5
5
  <link rel="shortcut icon" href="/logo.png">
6
6
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
7
  <title>Canlooks UI</title>
8
- <script type="module" crossorigin src="/assets/index-gntHdyKP.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DpTyMkMP.js"></script>
9
9
  </head>
10
10
  <body>
11
11
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",