@kvdbil/components 16.0.8 → 17.0.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.
- package/cjs/components/Accordion/index.js +8 -8
- package/cjs/components/Badge/index.js +5 -5
- package/cjs/components/Breadcrumbs/BreadcrumbsItem.js +5 -5
- package/cjs/components/Breadcrumbs/index.js +2 -2
- package/cjs/components/Button/index.js +14 -13
- package/cjs/components/Card/index.js +5 -5
- package/cjs/components/CheckBox/index.js +7 -7
- package/cjs/components/Chip/index.js +6 -6
- package/cjs/components/Dialog/index.js +1 -1
- package/cjs/components/ErrorMessage/index.js +2 -2
- package/cjs/components/Icon/index.js +4 -4
- package/cjs/components/Link/index.js +4 -6
- package/cjs/components/ListItem/index.js +3 -3
- package/cjs/components/MenuItem/index.js +1 -1
- package/cjs/components/Message/index.js +21 -10
- package/cjs/components/Modal/FocudTrap.js +3 -0
- package/cjs/components/Modal/index.js +23 -16
- package/cjs/components/OffCanvas/index.js +4 -4
- package/cjs/components/RadioButton/index.js +17 -17
- package/cjs/components/RegistrationPlate/index.js +3 -3
- package/cjs/components/Snackbar/index.js +23 -19
- package/cjs/components/Spinner/index.js +9 -9
- package/cjs/components/SpinnerThin/index.js +6 -7
- package/cjs/components/Stepper/index.js +10 -10
- package/cjs/components/StepperAccordion/index.js +18 -24
- package/cjs/components/Switcher/index.js +6 -6
- package/cjs/components/Table/index.js +9 -9
- package/cjs/components/Tabs/Tab.js +1 -2
- package/cjs/components/Tabs/Tabs.js +1 -1
- package/cjs/components/TextArea/index.js +12 -12
- package/cjs/components/Textfield/index.js +3 -3
- package/cjs/components/TimePicker/index.js +2 -2
- package/cjs/components/Toggle/index.js +6 -6
- package/cjs/components/ToggleArrow/index.js +2 -2
- package/cjs/components/ValuationRange/index.js +15 -15
- package/cjs/index.js +1 -1
- package/esm/components/Accordion/index.js +9 -9
- package/esm/components/Badge/index.js +7 -7
- package/esm/components/Breadcrumbs/BreadcrumbsItem.js +6 -6
- package/esm/components/Breadcrumbs/index.js +2 -2
- package/esm/components/Button/index.js +16 -15
- package/esm/components/Card/index.js +1 -1
- package/esm/components/CheckBox/index.js +7 -7
- package/esm/components/Chip/index.js +20 -20
- package/esm/components/Dialog/index.js +1 -1
- package/esm/components/ErrorMessage/index.js +2 -2
- package/esm/components/Icon/index.js +1 -1
- package/esm/components/Link/index.js +6 -8
- package/esm/components/ListItem/index.js +4 -4
- package/esm/components/MenuItem/index.js +2 -2
- package/esm/components/Message/index.js +21 -10
- package/esm/components/Modal/FocudTrap.js +3 -0
- package/esm/components/Modal/index.js +23 -16
- package/esm/components/OffCanvas/index.js +15 -11
- package/esm/components/RadioButton/index.js +12 -12
- package/esm/components/RegistrationPlate/index.js +4 -4
- package/esm/components/Snackbar/index.js +26 -22
- package/esm/components/Spinner/index.js +5 -5
- package/esm/components/SpinnerThin/index.js +9 -10
- package/esm/components/Stepper/index.js +30 -30
- package/esm/components/StepperAccordion/index.js +26 -32
- package/esm/components/Switcher/index.js +6 -6
- package/esm/components/Table/index.js +5 -5
- package/esm/components/Tabs/Tab.js +3 -4
- package/esm/components/Tabs/Tabs.js +1 -1
- package/esm/components/TextArea/index.js +16 -16
- package/esm/components/Textfield/index.js +16 -16
- package/esm/components/TimePicker/index.js +2 -2
- package/esm/components/Toggle/index.js +12 -12
- package/esm/components/ToggleArrow/index.js +3 -3
- package/esm/components/ValuationRange/index.js +15 -15
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/package.json.tmp +1 -1
- package/types/components/Badge/index.d.ts +2 -1
- package/types/components/Chip/index.d.ts +4 -4
- package/types/components/Modal/FocudTrap.d.ts +4 -0
- package/types/components/Spinner/index.d.ts +5 -2
- package/types/components/SpinnerThin/index.d.ts +6 -1
- package/types/components/Stepper/index.d.ts +8 -1
- package/types/components/StepperAccordion/index.d.ts +1 -1
- package/types/components/Switcher/index.d.ts +2 -1
- package/types/components/Table/index.d.ts +2 -1
- package/types/components/Toggle/index.d.ts +2 -1
- package/types/components/ValuationRange/index.d.ts +6 -1
- package/cjs/components/DayPicker/DayPickerNavBar.js +0 -25
- package/cjs/components/Icons/Arrow.js +0 -1
- package/cjs/components/Icons/CheckCircle.js +0 -1
- package/cjs/components/Icons/CheckIcon.js +0 -1
- package/cjs/components/Icons/Close.js +0 -1
- package/cjs/components/Icons/ErrorCircle.js +0 -1
- package/cjs/components/Icons/InfoCircle.js +0 -1
- package/esm/components/DayPicker/DayPickerNavBar.js +0 -25
- package/esm/components/Icons/Arrow.js +0 -1
- package/esm/components/Icons/CheckCircle.js +0 -1
- package/esm/components/Icons/CheckIcon.js +0 -1
- package/esm/components/Icons/Close.js +0 -1
- package/esm/components/Icons/ErrorCircle.js +0 -1
- package/esm/components/Icons/InfoCircle.js +0 -1
- package/types/components/DayPicker/DayPickerNavBar.d.ts +0 -9
- package/types/components/Icons/Arrow.d.ts +0 -5
- package/types/components/Icons/CheckCircle.d.ts +0 -5
- package/types/components/Icons/CheckIcon.d.ts +0 -5
- package/types/components/Icons/Close.d.ts +0 -5
- package/types/components/Icons/ErrorCircle.d.ts +0 -5
- package/types/components/Icons/InfoCircle.d.ts +0 -5
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as x}from"react/jsx-runtime";import{useEffect as $}from"react";import a,{css as o}from"styled-components";import{CSSTransition as y}from"react-transition-group";import{resolveColorWithNeutral as v,resetButtonStyle as b}from"../../utils/utils.js";import k from"../../icons/components/AlertIcon.js";import E from"../../icons/components/CheckCircleIcon.js";import B from"../../icons/components/CloseIcon.js";import C from"../../icons/components/InfoIcon.js";const S={top:o`
|
|
2
2
|
top: 0;
|
|
3
|
-
`,bottom:
|
|
3
|
+
`,bottom:o`
|
|
4
4
|
bottom: 0;
|
|
5
|
-
`},
|
|
5
|
+
`},z={right:o`
|
|
6
6
|
right: 0;
|
|
7
|
-
`,center:
|
|
7
|
+
`,center:o`
|
|
8
8
|
left: 50%;
|
|
9
9
|
transform: translate(-50%, 0);
|
|
10
|
-
`,left:
|
|
10
|
+
`,left:o`
|
|
11
11
|
left: 0;
|
|
12
|
-
`},c=200,
|
|
12
|
+
`},c=200,r="anim",N=a.div`
|
|
13
13
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
14
14
|
position: fixed;
|
|
15
15
|
display: flex;
|
|
@@ -27,28 +27,28 @@ import{jsx as t,jsxs as $}from"react/jsx-runtime";import{useEffect as y}from"rea
|
|
|
27
27
|
font-size: 0.875rem;
|
|
28
28
|
|
|
29
29
|
box-shadow: ${({theme:e})=>e.elevations.elevation8};
|
|
30
|
-
background-color: ${({theme:e,$color:
|
|
30
|
+
background-color: ${({theme:e,$color:i})=>i!=="none"?v(e,i).lighter:e.colors.background.light};
|
|
31
31
|
|
|
32
32
|
color: ${({theme:e})=>e.colors.text.dark};
|
|
33
33
|
|
|
34
|
-
${e=>
|
|
35
|
-
${e=>
|
|
34
|
+
${e=>S[e.origin.vertical||"bottom"]}
|
|
35
|
+
${e=>z[e.origin.horizontal||"left"]}
|
|
36
36
|
|
|
37
37
|
transition: opacity ${c}ms ease-in;
|
|
38
38
|
|
|
39
|
-
&.${
|
|
39
|
+
&.${r}-enter {
|
|
40
40
|
opacity: 0;
|
|
41
41
|
}
|
|
42
|
-
&.${
|
|
42
|
+
&.${r}-enter-active {
|
|
43
43
|
opacity: 1;
|
|
44
44
|
}
|
|
45
|
-
&.${
|
|
45
|
+
&.${r}-exit {
|
|
46
46
|
opacity: 1;
|
|
47
47
|
}
|
|
48
|
-
&.${
|
|
48
|
+
&.${r}-exit-active {
|
|
49
49
|
opacity: 0;
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,O=a.div`
|
|
52
52
|
display: inline-flex;
|
|
53
53
|
margin: -0.25rem 0;
|
|
54
54
|
margin-right: 0.75rem;
|
|
@@ -56,11 +56,12 @@ import{jsx as t,jsxs as $}from"react/jsx-runtime";import{useEffect as y}from"rea
|
|
|
56
56
|
${e=>e.type==="text"&&"margin-right: 0;"}
|
|
57
57
|
|
|
58
58
|
svg {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
fill: ${({theme:e})=>e.colors.text.dark};
|
|
59
|
+
font-size: 1.5rem;
|
|
60
|
+
color: ${({theme:e})=>e.colors.text.dark};
|
|
62
61
|
}
|
|
63
|
-
`,
|
|
62
|
+
`,w=a.button`
|
|
63
|
+
${b}
|
|
64
|
+
display: flex;
|
|
64
65
|
cursor: pointer;
|
|
65
66
|
|
|
66
67
|
/* Bigger click area */
|
|
@@ -71,9 +72,12 @@ import{jsx as t,jsxs as $}from"react/jsx-runtime";import{useEffect as y}from"rea
|
|
|
71
72
|
margin-left: 0.5rem;
|
|
72
73
|
|
|
73
74
|
svg {
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
font-size: 1.5rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:focus-visible {
|
|
79
|
+
outline: revert;
|
|
76
80
|
}
|
|
77
|
-
`,T=
|
|
81
|
+
`,T=a.span`
|
|
78
82
|
flex: 1;
|
|
79
|
-
`,W={error:t(k,{}),success:t(
|
|
83
|
+
`,W={error:t(k,{}),success:t(E,{}),info:t(C,{}),text:""},p=({message:e,color:i="none",type:n="info",action:l,isOpen:f,origin:g={},onClose:m=()=>{},onExited:d=()=>{},autoHideDuration:s=4e3,...h})=>($(()=>{const u=setTimeout(m,s);return()=>clearTimeout(u)},[s,m]),t(y,{in:f,timeout:c,mountOnEnter:!0,unmountOnExit:!0,onExited:d,classNames:r,children:x(N,{...h,$color:i,origin:g,role:n==="error"?"alert":void 0,"aria-live":n==="error"?"assertive":"polite",children:[t(O,{type:n,children:W[n]}),t(T,{children:e}),l&&l,t(w,{onClick:m,"aria-label":"Close",type:"button",children:t(B,{})})]})}));export{p as Snackbar,p as default};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import d,{keyframes as n}from"styled-components";import u from"../../theme.js";import{neutralColorSwap as f}from"../../utils/utils.js";const b=e=>{const r={slow:"2s",default:"1s",fast:"0.5s"};return r[e]||r.default},o=e=>{const r={smaller:1,small:2,regular:3,large:4};return typeof e=="number"?e:r[e]||r.regular},p=n`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
5
5
|
100% {
|
|
6
6
|
transform: rotate(360deg);
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
`,$=d.div`
|
|
9
9
|
display: inline-block;
|
|
10
10
|
border-radius: 50%;
|
|
11
|
-
border-top: ${({theme:e,color:r,customColor:
|
|
11
|
+
border-top: ${({theme:e,color:r,customColor:a,size:t})=>`${o(t)/10}em solid ${a??(r==="neutral"?f(e).mainAlt:e.colors?.[r]?.mainAlt)}`};
|
|
12
12
|
border-bottom: ${({size:e})=>`${o(e)/10}em solid rgba(0, 0, 0, 0.1);`};
|
|
13
13
|
border-right: ${({size:e})=>`${o(e)/10}em solid rgba(0, 0, 0, 0.1);`};
|
|
14
14
|
border-left: ${({size:e})=>`${o(e)/10}em solid rgba(0, 0, 0, 0.1);`};
|
|
15
15
|
width: ${({size:e})=>o(e)}em;
|
|
16
16
|
height: ${({size:e})=>o(e)}em;
|
|
17
|
-
animation: ${
|
|
17
|
+
animation: ${p} ${({speed:e})=>b(e)} infinite linear;
|
|
18
18
|
will-change: transform;
|
|
19
|
-
|
|
19
|
+
`,g=({size:e="regular",color:r="primary",speed:a="default",customColor:t,ariaLabel:i,useAria:l=!0,...s})=>m($,{...l?{role:"status","aria-live":"polite","aria-label":i??"loading","aria-busy":"true"}:void 0,...s,size:e,speed:a,color:r,customColor:t,theme:u});export{g as default};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as p,jsx as o}from"react/jsx-runtime";import s from"styled-components";import d from"../../icons/components/CheckmarkIcon.js";import $ from"../../icons/components/CloseIcon.js";import f from"../Spinner/index.js";import"../../theme.js";import"../../utils/utils.js";const c=s.div`
|
|
2
2
|
position: absolute;
|
|
3
|
-
`,h=
|
|
3
|
+
`,h=s(f)`
|
|
4
4
|
position: absolute;
|
|
5
5
|
|
|
6
|
-
${({size:i})
|
|
6
|
+
${({$size:i})=>`
|
|
7
7
|
width: ${i}rem;
|
|
8
8
|
height: ${i}rem;
|
|
9
9
|
margin-left: -${i/2}rem;
|
|
@@ -14,11 +14,11 @@ import{jsxs as l,jsx as e}from"react/jsx-runtime";import o from"styled-component
|
|
|
14
14
|
all 0.02s ease-in-out !important,
|
|
15
15
|
width transition 0s !important;
|
|
16
16
|
|
|
17
|
-
${({isLoading:i,theme:
|
|
17
|
+
${({$isLoading:i,theme:r})=>!i&&`
|
|
18
18
|
animation: none;
|
|
19
|
-
border: 1px solid ${
|
|
19
|
+
border: 1px solid ${r.colors.grayscaleToned.dark3};
|
|
20
20
|
`}
|
|
21
|
-
`,s
|
|
21
|
+
`,n=s.div`
|
|
22
22
|
position: absolute;
|
|
23
23
|
display: flex;
|
|
24
24
|
align-items: center;
|
|
@@ -26,13 +26,12 @@ import{jsxs as l,jsx as e}from"react/jsx-runtime";import o from"styled-component
|
|
|
26
26
|
left: 1px;
|
|
27
27
|
top: 1px;
|
|
28
28
|
|
|
29
|
-
${({size:i})=>`
|
|
29
|
+
${({$size:i})=>`
|
|
30
30
|
width: ${i}rem;
|
|
31
31
|
height: ${i}rem;
|
|
32
32
|
margin-left: -${i/2}rem;
|
|
33
33
|
font-size: ${i/2}rem;
|
|
34
34
|
`}
|
|
35
|
-
|
|
36
35
|
transition: opacity 500ms ease-in-out;
|
|
37
|
-
opacity: ${({isDone:i
|
|
38
|
-
`,
|
|
36
|
+
opacity: ${({$isDone:i,$isError:r})=>!i&&!r?"0":"1"};
|
|
37
|
+
`,l=({isLoading:i=!0,isDone:r=!1,isError:a=!1,size:e=3.5,ariaLabels:t={},...m})=>p(c,{"data-testid":"spinner-thin",role:"status","aria-live":"polite","aria-label":r?t?.isDone??"Completed":a?t?.isError??"Error":t?.isError??"Loading...","aria-busy":i,children:[o(n,{$size:e,$isDone:r,children:o(d,{})}),o(n,{$size:e,$isError:a,children:o($,{})}),o(h,{size:e,speed:"fast",color:"neutral",...m,$size:e,$isLoading:i,useAria:!1})]});export{l as SpinnerThin,l as default};
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as f}from"react/jsx-runtime";import{useRef as x}from"react";import t from"styled-components";import{TinyTitleRegular as H}from"../../typography/Heading/index.js";import b from"../../icons/components/CheckmarkIcon.js";import{generateNameHash as S}from"../../shared/helpers.js";import"../../shared/media-queries.js";const v=t.div`
|
|
2
2
|
display: flex;
|
|
3
|
-
flex-direction: ${({isHorizontal:
|
|
3
|
+
flex-direction: ${({isHorizontal:e})=>e?"row":"column"};
|
|
4
4
|
min-height: 4rem;
|
|
5
5
|
margin: 0 auto;
|
|
6
|
-
`,
|
|
6
|
+
`,w=t.div`
|
|
7
7
|
display: flex;
|
|
8
|
-
flex-direction: ${({isHorizontal:
|
|
8
|
+
flex-direction: ${({isHorizontal:e})=>e?"column":"row"};
|
|
9
9
|
column-gap: 0.75rem;
|
|
10
10
|
align-items: center;
|
|
11
|
-
padding: ${({isHorizontal:
|
|
11
|
+
padding: ${({isHorizontal:e})=>e?"0 0.5rem":"0.5rem 0"};
|
|
12
12
|
position: relative;
|
|
13
|
-
width: ${({isHorizontal:
|
|
13
|
+
width: ${({isHorizontal:e,stepsNumber:i})=>e?`calc(100% / ${i})`:"100%"};
|
|
14
14
|
|
|
15
15
|
&:not(:first-child) :before {
|
|
16
16
|
position: absolute;
|
|
17
17
|
content: '';
|
|
18
|
-
top: ${({isHorizontal:
|
|
19
|
-
left: ${({isHorizontal:
|
|
20
|
-
width: ${({isHorizontal:
|
|
21
|
-
height: ${({isHorizontal:
|
|
22
|
-
background: ${({theme:
|
|
18
|
+
top: ${({isHorizontal:e,$size:i})=>e?`calc(${i/2}rem + 1px)`:"0"};
|
|
19
|
+
left: ${({isHorizontal:e,$size:i})=>e?"0":`calc(${i/2}rem + 1px)`};
|
|
20
|
+
width: ${({isHorizontal:e,$size:i})=>e?`calc(50% - ${i/2}rem)`:"2px"};
|
|
21
|
+
height: ${({isHorizontal:e,$size:i})=>e?"2px":`calc(50% - ${i/2}rem)`};
|
|
22
|
+
background: ${({theme:e,$color:i,$colorShade:o})=>e.colors[i][o]};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&:not(:last-child) :after {
|
|
26
26
|
position: absolute;
|
|
27
27
|
content: '';
|
|
28
28
|
|
|
29
|
-
${({isHorizontal:
|
|
29
|
+
${({isHorizontal:e,$size:i})=>e&&`
|
|
30
30
|
top: calc(${i/2}rem + 1px);
|
|
31
31
|
`}
|
|
32
|
-
${({isHorizontal:
|
|
32
|
+
${({isHorizontal:e})=>!e&&`
|
|
33
33
|
bottom: 0;
|
|
34
34
|
`}
|
|
35
|
-
${({isHorizontal:
|
|
35
|
+
${({isHorizontal:e})=>e&&`
|
|
36
36
|
right: 0;
|
|
37
37
|
`}
|
|
38
|
-
${({isHorizontal:
|
|
38
|
+
${({isHorizontal:e,$size:i})=>!e&&`
|
|
39
39
|
left: calc(${i/2}rem + 1px);
|
|
40
40
|
`}
|
|
41
|
-
width: ${({isHorizontal:
|
|
42
|
-
height: ${({isHorizontal:
|
|
43
|
-
background: ${({theme:
|
|
41
|
+
width: ${({isHorizontal:e,$size:i})=>e?`calc(50% - ${i/2}rem)`:"2px"};
|
|
42
|
+
height: ${({isHorizontal:e,$size:i})=>e?"2px":`calc(50% - ${i/2}rem)`};
|
|
43
|
+
background: ${({theme:e,$color:i,$colorShade:o})=>e.colors[i][o]};
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,y=t.div``,k=t.div`
|
|
46
46
|
display: flex;
|
|
47
47
|
align-items: center;
|
|
48
48
|
justify-content: center;
|
|
49
|
-
width: ${({size:
|
|
50
|
-
height: ${({size:
|
|
49
|
+
width: ${({size:e})=>e}rem;
|
|
50
|
+
height: ${({size:e})=>e}rem;
|
|
51
51
|
border-radius: 50%;
|
|
52
52
|
border: 2px solid
|
|
53
|
-
${({theme:
|
|
54
|
-
color: ${({theme:
|
|
55
|
-
${({theme:
|
|
56
|
-
background-color: ${
|
|
53
|
+
${({theme:e,$color:i,$colorShade:o})=>e.colors[i][o]};
|
|
54
|
+
color: ${({theme:e,isFilled:i})=>i?e.colors.text.light:e.colors.text.dark};
|
|
55
|
+
${({theme:e,isFilled:i,$color:o,$colorShade:c})=>i&&`
|
|
56
|
+
background-color: ${e.colors[o][c]};
|
|
57
57
|
`}
|
|
58
|
-
`,
|
|
59
|
-
font-size: ${({size:
|
|
58
|
+
`,j=t(H)`
|
|
59
|
+
font-size: ${({size:e})=>`${e/2}rem`};
|
|
60
60
|
line-height: 1;
|
|
61
|
-
`,
|
|
62
|
-
font-size: ${({size:
|
|
63
|
-
`,
|
|
61
|
+
`,C=t(b)`
|
|
62
|
+
font-size: ${({size:e})=>`calc(${e/2}rem + 6px)`};
|
|
63
|
+
`,F=({children:e,orientation:i="vertical",variant:o="solid",color:c="primary",colorShade:p="mainAlt",size:n=2,activeStep:l,ariaLabels:s={},...m})=>{const h=e.length,d=i==="horizontal",z=x(S("stepper"));return a(v,{isHorizontal:d,...m,role:"list","aria-Label":s?.list??"Step progress",children:e.map((g,r)=>{const $=l&&r<l,u=$||o==="solid";return f(w,{$color:c,$colorShade:p,$size:n,stepsNumber:h,isHorizontal:d,role:"listitem","aria-disabled":$?"true":void 0,"aria-current":l===r?"step":void 0,"aria-Label":(l===void 0?`${s?.step??"Step %s"}`:(l===r&&`${s?.stepCurrent??"Current step, step %s"}`,$&&`${s?.stepDone??"Completed step, step %s"}`,`${s?.stepUpcoming??"Upcoming step, step %s"}`)).replaceAll("%s",String(r+1)),children:[a(y,{children:a(k,{$color:c,$colorShade:p,isFilled:u,size:n,role:"img",children:$?a(C,{size:n,"aria-hidden":"true"}):a(j,{as:"span",size:n,"aria-hidden":"true",children:r+1})})}),g]},`${z}-${r}`)})})};export{F as Stepper};
|
|
@@ -1,43 +1,38 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as u,jsx as t}from"react/jsx-runtime";import{useState as z,useRef as R,useCallback as B,useEffect as F}from"react";import a,{css as s}from"styled-components";import l from"../../theme.js";import{Title as I}from"../../typography/Heading/index.js";import{fadedColor as d,generateNameHash as K}from"../../shared/helpers.js";import{Collapse as O}from"react-collapse";import A from"../../icons/components/CheckmarkIcon.js";import H from"../../icons/components/ShowMoreIcon.js";import"../../shared/media-queries.js";const c="200ms",L=a.div`
|
|
2
2
|
.ReactCollapse--collapse {
|
|
3
|
-
transition: height ${
|
|
3
|
+
transition: height ${c} ease-in-out;
|
|
4
4
|
}
|
|
5
|
-
`,
|
|
6
|
-
margin-top: 0.25rem;
|
|
5
|
+
`,N=s`
|
|
7
6
|
transform: rotate(-180deg);
|
|
8
|
-
`,
|
|
7
|
+
`,T=a.div`
|
|
9
8
|
display: flex;
|
|
10
9
|
align-items: center;
|
|
11
10
|
height: 4rem;
|
|
12
11
|
|
|
13
|
-
color: ${
|
|
14
|
-
`,
|
|
12
|
+
color: ${e=>e.$isDisabled?l.colors.text.disabled:l.colors.text.dark};
|
|
13
|
+
`,U=a(I)`
|
|
15
14
|
margin: 0;
|
|
16
|
-
`,
|
|
15
|
+
`,_=a(H)`
|
|
16
|
+
font-size: 2rem;
|
|
17
17
|
margin-left: auto;
|
|
18
|
-
height: 1.25rem;
|
|
19
|
-
width: 1.25rem;
|
|
20
|
-
margin-top: -0.75rem;
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
transition: ${d};
|
|
19
|
+
transition: ${c};
|
|
25
20
|
transform: rotate(0deg);
|
|
26
21
|
transform-origin: center;
|
|
27
|
-
${
|
|
28
|
-
`,
|
|
22
|
+
${e=>e.isExpanded&&N};
|
|
23
|
+
`,q=(e,o)=>s`
|
|
29
24
|
color: white;
|
|
30
|
-
background-color: ${
|
|
31
|
-
`,
|
|
25
|
+
background-color: ${l.colors[e][o]};
|
|
26
|
+
`,G=(e,o,r)=>s`
|
|
32
27
|
fill: white;
|
|
33
|
-
border: 2px solid ${
|
|
28
|
+
border: 2px solid ${d(l.colors[o][r],.2)};
|
|
34
29
|
|
|
35
|
-
${
|
|
36
|
-
border: 2px solid ${
|
|
37
|
-
background-color: ${
|
|
30
|
+
${e&&`
|
|
31
|
+
border: 2px solid ${d(l.colors[o][r],0)};
|
|
32
|
+
background-color: ${d(l.colors[o][r],.5)};
|
|
38
33
|
`}
|
|
39
|
-
`,
|
|
40
|
-
font-family: ${({theme:
|
|
34
|
+
`,J=a.div`
|
|
35
|
+
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
41
36
|
display: flex;
|
|
42
37
|
align-items: center;
|
|
43
38
|
justify-content: center;
|
|
@@ -47,12 +42,11 @@ import{jsxs as m,jsx as s}from"react/jsx-runtime";import{useState as g,useCallba
|
|
|
47
42
|
width: 2rem;
|
|
48
43
|
height: 2rem;
|
|
49
44
|
border-radius: 2rem;
|
|
50
|
-
border: 2px solid ${
|
|
45
|
+
border: 2px solid ${e=>l.colors[e.$color][e.$colorShade]};
|
|
51
46
|
|
|
52
47
|
svg {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
width: 1rem;
|
|
48
|
+
height: 1.5rem;
|
|
49
|
+
width: 1.5rem;
|
|
56
50
|
|
|
57
51
|
/* Kvd.se compatible stuff */
|
|
58
52
|
margin: 0;
|
|
@@ -66,7 +60,7 @@ import{jsxs as m,jsx as s}from"react/jsx-runtime";import{useState as g,useCallba
|
|
|
66
60
|
margin-top: 0.1rem;
|
|
67
61
|
}
|
|
68
62
|
|
|
69
|
-
transition: background-color ${
|
|
70
|
-
${
|
|
71
|
-
${
|
|
72
|
-
`,
|
|
63
|
+
transition: background-color ${c};
|
|
64
|
+
${e=>e.isComplete&&q(e.$color,e.$colorShade)};
|
|
65
|
+
${e=>e.isDisabled&&G(e.isComplete,e.$color,e.$colorShade)};
|
|
66
|
+
`,x=({step:e,isExpanded:o,isDisabled:r,isComplete:m,onClick:y,color:C,colorShade:k,title:v,children:D,closedChildren:p,...S})=>{const[n,f]=z(o||!1),h=R(K("stepper")),$=B(()=>{r||f(i=>!i)},[r]);F(()=>{f(o||!1)},[r,o]);const w=e||e===0,E=i=>{r||(y||$)(i)},j=i=>{(i.key==="Enter"||i.key===" ")&&!r&&(i.preventDefault(),$())},g=`${h.current}-header`,b=`${h.current}-content`;return u(L,{children:[u(T,{...S,id:g,onClick:E,onKeyDown:j,$isDisabled:r||!1,role:"button",tabIndex:0,"aria-expanded":n,"aria-controls":b,children:[w&&t(J,{isComplete:m||!1,isDisabled:r||!1,$color:C||"primary",$colorShade:k||"main",children:m?t(A,{}):t("span",{children:e})}),t(U,{children:v}),t(_,{isExpanded:n})]}),t(O,{isOpened:n,children:t("div",{id:b,role:"region","aria-labelledby":g,children:D})}),p&&p]})};export{x as StepperAccordion,x as default};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as d}from"react/jsx-runtime";import i from"styled-components";import a from"../../theme.js";const p=i.button`
|
|
2
2
|
width: 46px;
|
|
3
3
|
height: 24px;
|
|
4
4
|
border-radius: 12px;
|
|
5
5
|
border: none;
|
|
6
6
|
padding: 2px;
|
|
7
|
-
background-color: ${({selected:o,disabled:e,$color:l,$colorShade:
|
|
7
|
+
background-color: ${({$selected:o,disabled:e,$color:l,$colorShade:r})=>e?a.colors.grayscaleToned.light4:o?a.colors[l][r]:a.colors.grayscaleToned.dark5};
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
|
-
justify-content: ${({selected:o})=>o?"flex-end":"flex-start"};
|
|
10
|
+
justify-content: ${({$selected:o})=>o?"flex-end":"flex-start"};
|
|
11
11
|
cursor: ${({disabled:o})=>o?"not-allowed":"pointer"};
|
|
12
12
|
opacity: ${({disabled:o})=>o?.6:1};
|
|
13
13
|
transition: all 0.3s ease;
|
|
14
|
-
`,
|
|
14
|
+
`,b=i.div`
|
|
15
15
|
width: 20px;
|
|
16
16
|
height: 20px;
|
|
17
17
|
border-radius: 50%;
|
|
18
|
-
background-color: ${({disabled:o})=>o?
|
|
18
|
+
background-color: ${({disabled:o})=>o?a.colors.grayscaleToned.light6:a.colors.common.white};
|
|
19
19
|
box-shadow:
|
|
20
20
|
0 2px 4px rgba(0, 0, 0, 0.1),
|
|
21
21
|
0 2px 4px rgba(0, 0, 0, 0.09),
|
|
22
22
|
0 1px 5px rgba(0, 0, 0, 0.15);
|
|
23
|
-
`,
|
|
23
|
+
`,s=({selected:o=!1,disabled:e=!1,onToggle:l,color:r="info",colorShade:c="mainAlt",ariaLabel:t,...n})=>d(p,{role:"switch","aria-checked":o,"aria-disabled":e,"aria-label":t??"Toggle",disabled:e,$selected:o,$color:r,$colorShade:c,onClick:()=>{!e&&l&&l(!o)},...n,children:d(b,{disabled:e})});export{s as Switcher,s as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l,jsxs as p}from"react/jsx-runtime";import{Children as d}from"react";import t from"styled-components";import{mq as s}from"../../shared/media-queries.js";import e from"../../theme.js";const h=t.div`
|
|
2
2
|
${s("mobileS","tablet")} {
|
|
3
3
|
display: block;
|
|
4
4
|
max-width: -moz-fit-content;
|
|
@@ -7,18 +7,18 @@ import{jsx as a,jsxs as p}from"react/jsx-runtime";import{Children as d}from"reac
|
|
|
7
7
|
overflow-x: auto;
|
|
8
8
|
white-space: nowrap;
|
|
9
9
|
}
|
|
10
|
-
`,g=
|
|
10
|
+
`,g=t.table`
|
|
11
11
|
border-collapse: collapse;
|
|
12
12
|
border: 1px solid ${e.colors.grayscaleToned.light3};
|
|
13
13
|
font-family: ${e.typography.fontBaseFamily};
|
|
14
14
|
text-align: left;
|
|
15
|
-
`,f=
|
|
15
|
+
`,f=t.thead``,y=t.th`
|
|
16
16
|
border: 1px solid ${e.colors.grayscaleToned.light3};
|
|
17
17
|
padding: 0.75rem;
|
|
18
18
|
vertical-align: top;
|
|
19
19
|
background-color: ${e.colors.background.gray};
|
|
20
|
-
`,b=
|
|
20
|
+
`,b=t.tbody``,c=t.tr``,n=t.td`
|
|
21
21
|
border: 1px solid ${e.colors.grayscaleToned.light3};
|
|
22
22
|
padding: 0.5rem 0.75rem;
|
|
23
23
|
vertical-align: top;
|
|
24
|
-
`,x=r=>
|
|
24
|
+
`,x=r=>l(c,{children:d.toArray(r.map((o,a)=>l(y,{scope:"col",children:o},a)))},"RowHead"),u=(r,o)=>o.length?r.map(a=>o?.map(i=>l(n,{children:a[i]},i))):r.map(a=>Object.entries(a).map(([i,m])=>l(n,{children:m},i))),w=r=>d.toArray(r.map((o,a)=>l(c,{children:d.toArray(o)},a))),$=({columns:r,data:o,ariaLabel:a})=>l(h,{children:p(g,{"aria-label":a,children:[r&&l(f,{children:x(r)}),o&&l(b,{children:w(u(o,r??[]))})]})});export{$ as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsx as c}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";import n from"styled-components";import{Button as v}from"../Button/index.js";import{forwardRef as b}from"react";import{hexToRGB as f}from"../../utils/utils.js";import"../../theme.js";import"../Spinner/index.js";import"../../typography/ButtonText/index.js";import"../Button/styles.js";const $=n.li`
|
|
2
2
|
list-style-type: none;
|
|
3
|
-
`,h=
|
|
3
|
+
`,h=n(v)`
|
|
4
4
|
&& {
|
|
5
5
|
margin-bottom: -3px;
|
|
6
6
|
padding: 0.875rem 1.375rem;
|
|
@@ -8,11 +8,10 @@ import{jsx as c}from"react/jsx-runtime";import d from"styled-components";import{
|
|
|
8
8
|
transition:
|
|
9
9
|
color 0.3s ease,
|
|
10
10
|
border 0.3s ease;
|
|
11
|
-
border-radius: unset;
|
|
12
11
|
|
|
13
12
|
:focus-visible {
|
|
14
13
|
${({theme:t,isActive:o,$activeColor:e,$activeColorShade:r})=>!o&&`background-color: ${f(t.colors[e][r],.1)};
|
|
15
14
|
`}
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
`,
|
|
17
|
+
`,d=b(({label:t,index:o=-1,isActive:e=!1,onClick:r,activeColor:a="secondary",activeColorShade:l="mainAlt",isDisabled:m=!1,onKeyUp:s},p)=>c($,{role:"presentation",children:c(h,{id:`tab-${o}`,role:"tab","aria-selected":e,"aria-controls":`tabpanel-${o}`,tabIndex:e?0:-1,isActive:e,onClick:i=>r&&r(i,o),$activeColor:a,$activeColorShade:l,isDisabled:m,variant:"flat",color:e?a:"neutral",colorShade:l,onKeyUp:i=>s&&s(i,o),ref:p,noRadius:!0,children:t})}));d.displayName="Tab";export{d as default};
|
|
@@ -25,4 +25,4 @@ import{jsx as n,jsxs as x}from"react/jsx-runtime";import{Children as W,useState
|
|
|
25
25
|
display: flex;
|
|
26
26
|
`,N=s.div`
|
|
27
27
|
padding: 0.5rem 0;
|
|
28
|
-
`,G=s.div``,g=({activeColor:o="secondary",activeColorShade:m="mainAlt",justify:p="end",activeIndex:u,initalActive:k,children:j=[],kbNavAutoOpen:h=!0,onTabClick:A,fullWidthBorder:$=!0,borderColor:D="light6",headline:b})=>{const l=W.map(j,e=>e),[d,c]=I(()=>k??l.findIndex(e=>!e.props.isDisabled)),v=S([]),w=!!l[d]?.props?.children,T=(e,r)=>{e.preventDefault(),c(r)};U(()=>{typeof u<"u"&&c(u)},[u]);const R=(e,r)=>{if(e.preventDefault(),(e.key==="Enter"||e.key===" ")&&!h&&c(r),e.key==="ArrowLeft"||e.key==="ArrowRight"){const t=h?d:r,i=e.key==="ArrowRight",a=i?t+1:0,B=i?l.length:t,C=l.slice(a,B);i||C.reverse();const y=C.findIndex(f=>!f.props.isDisabled);if(y!==-1){const f=i?t+(y+1):t-(y+1);h&&c(f),v.current[f].focus()}}};return n(O,{children:x(K,{isOpened:!0,children:[x(z,{fullWidthBorder:$,justify:b?"space-between":p,role:"tablist",borderColor:D,children:[b&&n(F,{children:b}),n(H,{children:l.map((e,r)=>{if(!e)return null;const t=d===r;return n(q,{label:e.props.label,isDisabled:e.props.isDisabled,index:r,
|
|
28
|
+
`,G=s.div``,g=({activeColor:o="secondary",activeColorShade:m="mainAlt",justify:p="end",activeIndex:u,initalActive:k,children:j=[],kbNavAutoOpen:h=!0,onTabClick:A,fullWidthBorder:$=!0,borderColor:D="light6",headline:b})=>{const l=W.map(j,e=>e),[d,c]=I(()=>k??l.findIndex(e=>!e.props.isDisabled)),v=S([]),w=!!l[d]?.props?.children,T=(e,r)=>{e.preventDefault(),c(r)};U(()=>{typeof u<"u"&&c(u)},[u]);const R=(e,r)=>{if(e.preventDefault(),(e.key==="Enter"||e.key===" ")&&!h&&c(r),e.key==="ArrowLeft"||e.key==="ArrowRight"){const t=h?d:r,i=e.key==="ArrowRight",a=i?t+1:0,B=i?l.length:t,C=l.slice(a,B);i||C.reverse();const y=C.findIndex(f=>!f.props.isDisabled);if(y!==-1){const f=i?t+(y+1):t-(y+1);h&&c(f),v.current[f].focus()}}};return n(O,{children:x(K,{isOpened:!0,children:[x(z,{fullWidthBorder:$,justify:b?"space-between":p,role:"tablist",borderColor:D,children:[b&&n(F,{children:b}),n(H,{children:l.map((e,r)=>{if(!e)return null;const t=d===r;return n(q,{label:e.props.label,isDisabled:e.props.isDisabled,index:r,isActive:d===r,activeColor:o,activeColorShade:m,onClick:(i,a)=>{!t&&!e.props.isDisabled&&(e.props.onClick?.(i,a),A?.(i,a),T(i,a))},onKeyUp:R,ref:i=>v.current[r]=i},r)})})]}),w&&n(N,{children:l.map((e,r)=>{const t=e.props.children&&d===r;return n(G,{id:`tabpanel-${r}`,role:"tabpanel","aria-labelledby":`tab-${r}`,"aria-hidden":t?"false":"true",children:t&&e.props.children},r)})})]})})};export{g as Tabs,g as default};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as h,jsx as i,Fragment as z}from"react/jsx-runtime";import{useState as B,useRef as E}from"react";import l,{css as b}from"styled-components";import r from"../../theme.js";import{Label as j}from"../FieldLabel.js";import{BodyTextStyle as N,CaptionStyle as S}from"../../typography/BodyText/index.js";import{generateNameHash as w}from"../../shared/helpers.js";import"../../shared/media-queries.js";const C=b`
|
|
2
2
|
border: 1px solid ${r.colors.grayscaleToned.light1};
|
|
3
3
|
color: ${r.colors.grayscaleToned.dark1};
|
|
4
4
|
fill: ${r.colors.grayscaleToned.light1};
|
|
5
|
-
`,
|
|
5
|
+
`,H=b`
|
|
6
6
|
border: 1px solid ${r.colors.error.dark};
|
|
7
|
-
`,
|
|
7
|
+
`,L=b`
|
|
8
8
|
color: ${r.colors.text.dark};
|
|
9
9
|
border: 1px solid ${r.colors.text.dark};
|
|
10
10
|
fill: ${r.colors.text.dark};
|
|
11
|
-
`,
|
|
11
|
+
`,R=l.div`
|
|
12
12
|
position: relative;
|
|
13
13
|
padding: 0;
|
|
14
14
|
display: inline-block;
|
|
15
|
-
`,
|
|
15
|
+
`,A=l.div`
|
|
16
16
|
display: inline-black;
|
|
17
17
|
|
|
18
18
|
color: ${r.colors.grayscaleToned.light1};
|
|
@@ -24,12 +24,12 @@ import{jsxs as i,jsx as l,Fragment as k}from"react/jsx-runtime";import{useState
|
|
|
24
24
|
|
|
25
25
|
padding: 0.7rem 0.75rem;
|
|
26
26
|
|
|
27
|
-
${({hasError:e,isFocused:a})=>!e&&a&&
|
|
28
|
-
${({disabled:e})=>e&&
|
|
29
|
-
${({hasError:e})=>e&&
|
|
27
|
+
${({hasError:e,isFocused:a})=>!e&&a&&L}
|
|
28
|
+
${({disabled:e})=>e&&C}
|
|
29
|
+
${({hasError:e})=>e&&H}
|
|
30
30
|
${({centered:e})=>e&&"text-align: center;"}
|
|
31
|
-
`,
|
|
32
|
-
${
|
|
31
|
+
`,D=l.textarea`
|
|
32
|
+
${N}
|
|
33
33
|
|
|
34
34
|
width: 100%;
|
|
35
35
|
cursor: text;
|
|
@@ -38,17 +38,17 @@ import{jsxs as i,jsx as l,Fragment as k}from"react/jsx-runtime";import{useState
|
|
|
38
38
|
background-color: transparent;
|
|
39
39
|
|
|
40
40
|
${({resize:e})=>!e&&"resize: none;"}
|
|
41
|
-
`,
|
|
41
|
+
`,I=l.div`
|
|
42
42
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
43
|
-
`,P=
|
|
44
|
-
${
|
|
43
|
+
`,P=l.div`
|
|
44
|
+
${S}
|
|
45
45
|
margin-top: 0.25rem;
|
|
46
46
|
|
|
47
47
|
${({centered:e})=>e&&"width: 100%; text-align: center;"}
|
|
48
|
-
`,
|
|
48
|
+
`,V=l.span`
|
|
49
49
|
display: block;
|
|
50
50
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
51
|
-
`,
|
|
51
|
+
`,W=l.span`
|
|
52
52
|
display: block;
|
|
53
53
|
color: ${({theme:e})=>e.colors.error.dark};
|
|
54
|
-
`,u=({placeholder:e="",isDisabled:a=!1,centered:
|
|
54
|
+
`,u=({placeholder:e="",isDisabled:a=!1,centered:m=!1,hasError:g=!1,className:y,helperText:t,label:d="",resize:k=!0,name:p,errors:s,...n})=>{const[$,f]=B(!1),v=!!n.value,o=`${E(w("textarea")).current}-${p}`,T=s?.map((x,c)=>`${o}-error-${c}`)??[],F=[t?`${o}-helper`:null,...T].filter(Boolean).join(" ");return h(R,{className:y,children:[h(A,{isFocused:$,disabled:a,centered:m,hasError:g,hasPlaceholder:!!e,children:[i(D,{...n,id:o,name:p,"aria-label":d?void 0:p,"aria-describedby":F||void 0,"aria-invalid":!!s?.length,resize:k,onFocus:()=>f(!0),onBlur:()=>f(!1),disabled:a,tabIndex:a?-1:0,theme:r,placeholder:d&&!$?"":e}),n.suffix&&i(I,{children:n.suffix})]}),d&&i(j,{htmlFor:o,isFocused:$,centered:m,hasError:g,hasValue:v,disabled:a,theme:r,children:h(z,{children:[d,i("span",{})]})}),(t||s)&&h(P,{centered:m,children:[t&&i(V,{id:`${o}-helper`,children:t}),s&&s.map((x,c)=>i(W,{id:`${o}-error-${c}`,role:"alert","aria-live":"assertive",children:x},`${o}-error-${c}`))]})]})};export{u as TextArea,u as default};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as c,jsx as t,Fragment as A}from"react/jsx-runtime";import{useState as R,useRef as H}from"react";import o,{css as $}from"styled-components";import{Label as P}from"../FieldLabel.js";import{BodyTextStyle as V,CaptionStyle as q}from"../../typography/BodyText/index.js";import{generateNameHash as y}from"../../shared/helpers.js";import"../../shared/media-queries.js";const C=$`
|
|
2
2
|
border: 1px solid ${({theme:e})=>e.colors.grayscaleToned.light2};
|
|
3
3
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
4
4
|
fill: ${({theme:e})=>e.colors.text.disabled};
|
|
5
|
-
`,
|
|
5
|
+
`,D=$`
|
|
6
6
|
border: 2px solid ${({theme:e})=>e.colors.error.dark};
|
|
7
|
-
`,
|
|
7
|
+
`,G=$`
|
|
8
8
|
border: 2px solid ${({theme:e})=>e.colors.grayscaleToned.dark5};
|
|
9
9
|
color: ${({theme:e})=>e.colors.text.dark};
|
|
10
10
|
fill: ${({theme:e})=>e.colors.text.dark};
|
|
11
|
-
`,
|
|
11
|
+
`,I=o.div`
|
|
12
12
|
position: relative;
|
|
13
13
|
padding: 0;
|
|
14
14
|
display: block;
|
|
15
|
-
`,
|
|
15
|
+
`,L=o.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
text-align: center;
|
|
18
18
|
align-items: center;
|
|
@@ -26,12 +26,12 @@ import{jsxs as i,jsx as l,Fragment as T}from"react/jsx-runtime";import{useState
|
|
|
26
26
|
|
|
27
27
|
padding: 0.75rem 0.6rem;
|
|
28
28
|
|
|
29
|
-
${({hasError:e,isFocused:
|
|
30
|
-
${({disabled:e})=>e&&
|
|
31
|
-
${({hasError:e})=>e&&
|
|
29
|
+
${({hasError:e,isFocused:a})=>!e&&a&&G}
|
|
30
|
+
${({disabled:e})=>e&&C}
|
|
31
|
+
${({hasError:e})=>e&&D}
|
|
32
32
|
${({centered:e})=>e&&"text-align: center;"}
|
|
33
|
-
`,
|
|
34
|
-
${
|
|
33
|
+
`,M=o.input`
|
|
34
|
+
${V}
|
|
35
35
|
width: 100%;
|
|
36
36
|
cursor: text;
|
|
37
37
|
outline: none;
|
|
@@ -42,7 +42,7 @@ import{jsxs as i,jsx as l,Fragment as T}from"react/jsx-runtime";import{useState
|
|
|
42
42
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
43
43
|
fill: ${({theme:e})=>e.colors.text.disabled};
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,O=o.span`
|
|
46
46
|
display: flex;
|
|
47
47
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
48
48
|
font-size: 1.25rem;
|
|
@@ -52,15 +52,15 @@ import{jsxs as i,jsx as l,Fragment as T}from"react/jsx-runtime";import{useState
|
|
|
52
52
|
width: 1.375rem;
|
|
53
53
|
height: 1.375rem;
|
|
54
54
|
}
|
|
55
|
-
`,
|
|
56
|
-
${
|
|
55
|
+
`,_=o.div`
|
|
56
|
+
${q}
|
|
57
57
|
margin-top: 0.25rem;
|
|
58
58
|
|
|
59
59
|
${({centered:e})=>e&&"width: 100%; text-align: center;"}
|
|
60
|
-
`,
|
|
60
|
+
`,J=o.span`
|
|
61
61
|
display: block;
|
|
62
62
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
63
|
-
`,
|
|
63
|
+
`,K=o.span`
|
|
64
64
|
display: block;
|
|
65
65
|
color: ${({theme:e})=>e.colors.error.dark};
|
|
66
|
-
`,
|
|
66
|
+
`,k=({placeholder:e="",isDisabled:a=!1,centered:h=!1,hasError:m=!1,className:v,helperText:s,label:d="",onBlur:F=()=>null,onFocus:T=()=>null,forwardRef:w,suffix:f,name:u=y("text-input"),errors:i,isAutoFocused:B=!1,...x})=>{const[p,g]=R(!1),E=!!x.value,b=i&&Array.isArray(i)&&i?.length>0,r=`${H(y("text-input")).current}-${u}`,j=i?.map((l,n)=>`${r}-error-${n}`)??[],N=[s?`${r}-helper`:null,...j].filter(Boolean).join(" "),S=l=>{g(!0),T(l)},z=l=>{g(!1),F(l)};return c(I,{className:v,children:[c(L,{isFocused:p,disabled:a,centered:h,hasError:m,hasPlaceholder:!!e,children:[t(M,{...x,id:r,name:u,"aria-labelledby":d?`${r}-label`:void 0,"aria-describedby":N||void 0,"aria-invalid":b||m,ref:w,onFocus:S,onBlur:z,disabled:a,placeholder:d&&!p?"":e,autoFocus:B}),f&&t(O,{children:f})]}),d&&t(P,{id:`${r}-label`,htmlFor:r,isFocused:p,centered:h,hasError:m,hasValue:E,disabled:a,children:c(A,{children:[d,t("span",{})]})}),(s||b)&&c(_,{centered:h,children:[s&&t(J,{id:`${r}-helper`,children:s}),b&&i.map((l,n)=>t(K,{id:`${r}-error-${n}`,role:"alert","aria-live":"assertive",children:l},`${r}-error-${n}`))]})]})};export{k as TextField,k as default};
|