@kvdbil/components 17.7.0 → 17.8.0
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.
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
background-color 0.3s ease,
|
|
21
21
|
border 0.3s ease;
|
|
22
22
|
box-sizing: border-box;
|
|
23
|
+
width: ${({fullWidth:e})=>e?"100%":"auto"};
|
|
23
24
|
|
|
24
25
|
${e=>!e.isDisabled&&e.isClickable&&` &:hover {\n border-color: ${i.getHoverBorderColor(e)};\n background-color: ${i.getHoverBackgroundColor(e)};\n color: ${i.getHoverColor(e)};\n } &:active {\n background-color: ${i.getActiveBackgroundColor(e)};\n border-color: ${i.getActiveBorderColor(e)};\n color: ${i.getActiveColor(e)};\n }`}
|
|
25
26
|
`,s=l.default.span`
|
|
@@ -63,4 +64,4 @@
|
|
|
63
64
|
&:hover:before {
|
|
64
65
|
opacity: 1;
|
|
65
66
|
}
|
|
66
|
-
`,g=({color:r="primary",children:i,component:t,isDisabled:l,onClick:a,size:g="regular",prefix:u,onDelete:p,variant:b="solid",role:x,...f})=>{const
|
|
67
|
+
`,g=({color:r="primary",children:i,component:t,isDisabled:l,onClick:a,size:g="regular",prefix:u,onDelete:p,variant:b="solid",role:x,...f})=>{const h=!(!a||l),v=!(!p||l),m=!!u,y=e=>{e.stopPropagation(),p?.(e)};return e.jsx(n,{...f,role:x??(h?"button":void 0),onClick:h?a:void 0,tabIndex:h?0:void 0,as:t??(h?"button":"div"),color:r,isDisabled:l,size:g,isClickable:h,isDeletable:v,variant:b,hasPrefix:m,"aria-disabled":l,children:e.jsxs(s,{children:[u&&e.jsx(d,{className:"prefix",children:u}),i,p&&e.jsx(c,{role:"button","aria-label":"Remove","aria-disabled":l,onClick:v?y:void 0,color:r,variant:b,isClickable:h,isDisabled:l,isDeletable:!0,size:"regular",tabIndex:v?0:void 0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&v&&(e.preventDefault(),y(e))},children:e.jsx(o.default,{})})]})})};exports.Chip=g,exports.default=g;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsx as l,jsxs as
|
|
1
|
+
import{jsx as l,jsxs as $}from"react/jsx-runtime";import a from"styled-components";import k from"../../icons/components/CloseIcon.js";import{getFontSize as C,getCursorType as b,getBackgroundColor as D,getColor as z,getBorderColor as B,getHoverBorderColor as w,getHoverBackgroundColor as H,getHoverColor as j,getActiveBackgroundColor as m,getActiveBorderColor as A,getActiveColor as W,getSufixHoverBackgroundColor as F}from"./styles.js";import"../../utils/utils.js";const I={small:"2px 16px",regular:"3px 16px",large:"7px 16px"},P=a.div`
|
|
2
2
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
3
|
-
font-size: ${({size:e})
|
|
3
|
+
font-size: ${({size:e})=>C(e)};
|
|
4
4
|
font-weight: ${({theme:e})=>e.typography.fontBaseBoldWeight};
|
|
5
5
|
line-height: 1.25;
|
|
6
6
|
letter-spacing: 0.1px;
|
|
@@ -14,29 +14,30 @@ import{jsx as l,jsxs as k}from"react/jsx-runtime";import a from"styled-component
|
|
|
14
14
|
border-style: solid;
|
|
15
15
|
border-color: ${B};
|
|
16
16
|
border-radius: 1.293rem;
|
|
17
|
-
padding: ${({size:e,isDeletable:n})=>n?"0 0.5rem 0 1rem":
|
|
17
|
+
padding: ${({size:e,isDeletable:n})=>n?"0 0.5rem 0 1rem":I[e]};
|
|
18
18
|
transition:
|
|
19
19
|
color 0.3s ease,
|
|
20
20
|
background-color 0.3s ease,
|
|
21
21
|
border 0.3s ease;
|
|
22
22
|
box-sizing: border-box;
|
|
23
|
+
width: ${({fullWidth:e})=>e?"100%":"auto"};
|
|
23
24
|
|
|
24
25
|
${e=>!e.isDisabled&&e.isClickable&&` &:hover {
|
|
25
|
-
border-color: ${
|
|
26
|
-
background-color: ${
|
|
27
|
-
color: ${
|
|
26
|
+
border-color: ${w(e)};
|
|
27
|
+
background-color: ${H(e)};
|
|
28
|
+
color: ${j(e)};
|
|
28
29
|
} &:active {
|
|
29
30
|
background-color: ${m(e)};
|
|
30
31
|
border-color: ${A(e)};
|
|
31
|
-
color: ${
|
|
32
|
+
color: ${W(e)};
|
|
32
33
|
}`}
|
|
33
|
-
`,
|
|
34
|
+
`,S=a.span`
|
|
34
35
|
display: flex;
|
|
35
36
|
align-items: center;
|
|
36
37
|
justify-content: center;
|
|
37
38
|
text-align: center;
|
|
38
39
|
line-height: 1.5;
|
|
39
|
-
`,
|
|
40
|
+
`,T=a.span`
|
|
40
41
|
margin-right: 0.625rem;
|
|
41
42
|
display: flex;
|
|
42
43
|
align-items: center;
|
|
@@ -59,7 +60,7 @@ import{jsx as l,jsxs as k}from"react/jsx-runtime";import a from"styled-component
|
|
|
59
60
|
width: 80%;
|
|
60
61
|
border-radius: 50%;
|
|
61
62
|
z-index: -1;
|
|
62
|
-
background-color: ${
|
|
63
|
+
background-color: ${F};
|
|
63
64
|
opacity: 0;
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -71,4 +72,4 @@ import{jsx as l,jsxs as k}from"react/jsx-runtime";import a from"styled-component
|
|
|
71
72
|
&:hover:before {
|
|
72
73
|
opacity: 1;
|
|
73
74
|
}
|
|
74
|
-
`,u=({color:e="primary",children:n,component:
|
|
75
|
+
`,u=({color:e="primary",children:n,component:h,isDisabled:r,onClick:d,size:f="regular",prefix:s,onDelete:c,variant:g="solid",role:x,...v})=>{const i=!!(d&&!r),t=!!(c&&!r),y=!!s,p=o=>{o.stopPropagation(),c?.(o)};return l(P,{...v,role:x??(i?"button":void 0),onClick:i?d:void 0,tabIndex:i?0:void 0,as:h??(i?"button":"div"),color:e,isDisabled:r,size:f,isClickable:i,isDeletable:t,variant:g,hasPrefix:y,"aria-disabled":r,children:$(S,{children:[s&&l(T,{className:"prefix",children:s}),n,c&&l(E,{role:"button","aria-label":"Remove","aria-disabled":r,onClick:t?p:void 0,color:e,variant:g,isClickable:i,isDisabled:r,isDeletable:!0,size:"regular",tabIndex:t?0:void 0,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&t&&(o.preventDefault(),p(o))},children:l(k,{})})]})})};export{u as Chip,u as default};
|
package/package.json
CHANGED
package/package.json.tmp
CHANGED
|
@@ -26,6 +26,7 @@ export interface ItemProps {
|
|
|
26
26
|
theme: DefaultTheme;
|
|
27
27
|
tabIndex?: number;
|
|
28
28
|
onClick?: (e: MouseEvent) => void;
|
|
29
|
+
fullWidth?: boolean;
|
|
29
30
|
}
|
|
30
31
|
export declare const Chip: ({ color, children, component, isDisabled, onClick, size, prefix, onDelete, variant, role, ...props }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
export default Chip;
|