akeneo-design-system 4.0.84 → 4.0.85
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.
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var W=Object.defineProperty,F=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var m=(e,o,t)=>o in e?W(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,k=(e,o)=>{for(var t in o||(o={}))w.call(o,t)&&m(e,t,o[t]);if(g)for(var t of g(o))$.call(o,t)&&m(e,t,o[t]);return e},C=(e,o)=>F(e,H(o));var D=(e,o)=>{var t={};for(var n in e)w.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&g)for(var n of g(e))o.indexOf(n)<0&&$.call(e,n)&&(t[n]=e[n]);return t};var s=require("react/jsx-runtime"),c=require("react"),j=require("styled-components"),G=require("../../../icons/ArrowDownIcon.js"),J=require("../../../icons/ArrowUpIcon.js"),P=require("../../../icons/LockIcon.js"),Q=require("../../../shared/key.js"),l=require("../../../theme/theme.js"),S=require("../../../hooks/useShortcut.js");function q(e){return e&&e.__esModule?e:{default:e}}var X=q(c),p=q(j);const _=p.default.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
width: 100%;
|
|
6
|
-
`,
|
|
6
|
+
`,z=p.default.input`
|
|
7
7
|
width: 100%;
|
|
8
8
|
height: 40px;
|
|
9
|
-
border: 1px solid ${({$invalid:
|
|
9
|
+
border: 1px solid ${({$invalid:e})=>e?l.getColor("red",100):l.getColor("grey",80)};
|
|
10
10
|
border-radius: 2px;
|
|
11
|
-
background: ${({$readOnly:
|
|
12
|
-
color: ${({$readOnly:
|
|
13
|
-
font-size: ${
|
|
11
|
+
background: ${({$readOnly:e})=>e?l.getColor("grey",20):l.getColor("white")};
|
|
12
|
+
color: ${({$readOnly:e})=>e?l.getColor("grey",100):l.getColor("grey",140)};
|
|
13
|
+
font-size: ${l.getFontSize("default")};
|
|
14
14
|
line-height: 40px;
|
|
15
|
-
padding: 0 ${({$readOnly:
|
|
15
|
+
padding: 0 ${({$readOnly:e})=>e?"35px":"15px"} 0 15px;
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
outline-style: none;
|
|
18
18
|
appearance: textfield;
|
|
19
|
-
${({$readOnly:
|
|
19
|
+
${({$readOnly:e})=>e&&j.css`
|
|
20
20
|
overflow: hidden;
|
|
21
21
|
text-overflow: ellipsis;
|
|
22
22
|
`}
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
&:focus {
|
|
30
|
-
box-shadow: 0 0 0 2px ${
|
|
30
|
+
box-shadow: 0 0 0 2px ${l.getColor("blue",40)};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
&::placeholder {
|
|
34
34
|
opacity: 1;
|
|
35
|
-
color: ${
|
|
35
|
+
color: ${l.getColor("grey",100)};
|
|
36
36
|
}
|
|
37
|
-
`,
|
|
37
|
+
`,Y=p.default(z).attrs({as:"div",inert:""})`
|
|
38
38
|
&& {
|
|
39
39
|
position: absolute;
|
|
40
40
|
top: 0;
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
mix-blend-mode: multiply;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
${
|
|
54
|
+
${_}:focus-within & {
|
|
55
55
|
display: none;
|
|
56
56
|
}
|
|
57
|
-
`,
|
|
57
|
+
`,Z=p.default(P.LockIcon)`
|
|
58
58
|
position: absolute;
|
|
59
59
|
right: 0;
|
|
60
60
|
top: 0;
|
|
61
61
|
margin: 12px;
|
|
62
|
-
color: ${
|
|
63
|
-
`,
|
|
62
|
+
color: ${l.getColor("grey",100)};
|
|
63
|
+
`,V=p.default.div`
|
|
64
64
|
position: absolute;
|
|
65
65
|
right: 0;
|
|
66
66
|
top: 0;
|
|
@@ -70,5 +70,6 @@
|
|
|
70
70
|
height: 100%;
|
|
71
71
|
justify-content: center;
|
|
72
72
|
cursor: pointer;
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
user-select: none;
|
|
74
|
+
color: ${l.getColor("grey",100)};
|
|
75
|
+
`,R=X.default.forwardRef((O,i)=>{var b=O,{invalid:e,onChange:o,readOnly:t,step:n,value:d,emptyValue:h,onSubmit:x,withIncrementIcons:A=!0,highlightable:N=!1}=b,a=D(b,["invalid","onChange","readOnly","step","value","emptyValue","onSubmit","withIncrementIcons","highlightable"]);const K=c.useRef(null);i=i!=null?i:K;const[T,U]=c.useState(!1),B=r=>{r.currentTarget.blur()},E=c.useCallback(r=>{U(r.currentTarget.validity.badInput),!t&&o&&o(r.currentTarget.value)},[t,o]),L=()=>{!t&&(x==null||x())};S.useShortcut(Q.Key.Enter,L,i);const v=c.useCallback(r=>{if(!i||typeof i=="function"||!i.current||t||!o||n==="any")return!1;const u=i.current;return u.value===""&&h!==void 0&&(u.value=`${h}`),r==="up"?u.stepUp(n):u.stepDown(n),o(u.value),!0},[i,n,t,o,h]),f=()=>v("up"),I=()=>v("down"),M=r=>{var u;h!==void 0&&r.currentTarget.value===""&&(r.key==="ArrowUp"&&f()&&r.preventDefault(),r.key==="ArrowDown"&&I()&&r.preventDefault()),(u=a.onKeyDown)==null||u.call(a,r)},y=e||T&&d==="";return s.jsxs(_,{children:[s.jsx(z,C(k({ref:i,onChange:E,type:"number",readOnly:t,disabled:t,"aria-invalid":y,$invalid:y,$readOnly:t,autoComplete:"off",value:d,title:d,step:n},a),{onKeyDown:M,onWheel:B})),N&&s.jsx(Y,{"aria-hidden":!0,className:a.className,$readOnly:t,children:d}),t&&s.jsx(Z,{size:16}),!t&&A&&n!=="any"&&s.jsxs(V,{children:[s.jsx(J.ArrowUpIcon,{size:16,"data-testid":"increment-number-input",onClick:f}),s.jsx(G.ArrowDownIcon,{size:16,"data-testid":"decrement-number-input",onClick:I})]})]})});exports.NumberInput=R;
|
package/lib/index.d.ts
CHANGED
|
@@ -1144,6 +1144,7 @@ export declare type NumberInputProps = Override<Override<Omit<default_2.InputHTM
|
|
|
1144
1144
|
min?: number;
|
|
1145
1145
|
max?: number;
|
|
1146
1146
|
step?: number | 'any';
|
|
1147
|
+
emptyValue?: number;
|
|
1147
1148
|
invalid?: boolean;
|
|
1148
1149
|
onSubmit?: () => void;
|
|
1149
1150
|
withIncrementIcons?: boolean;
|