@kvdbil/components 17.2.2 → 17.3.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.
Files changed (37) hide show
  1. package/cjs/components/Accordion/index.js +3 -3
  2. package/cjs/components/Breadcrumbs/index.js +2 -2
  3. package/cjs/components/CheckBox/index.js +20 -17
  4. package/cjs/components/EditRow/index.js +2 -2
  5. package/cjs/components/Modal/index.js +17 -21
  6. package/cjs/components/RadioButton/index.js +4 -4
  7. package/cjs/components/Stepper/index.js +6 -6
  8. package/cjs/components/StepperAccordion/index.js +17 -17
  9. package/cjs/components/TextArea/index.js +8 -8
  10. package/cjs/components/Textfield/index.js +11 -11
  11. package/cjs/hooks/useNameAndId.js +1 -0
  12. package/cjs/index.js +1 -1
  13. package/cjs/shared/helpers.js +1 -1
  14. package/cjs/utils/utils.js +4 -0
  15. package/esm/components/Accordion/index.js +9 -9
  16. package/esm/components/Breadcrumbs/index.js +2 -2
  17. package/esm/components/CheckBox/index.js +21 -18
  18. package/esm/components/EditRow/index.js +1 -1
  19. package/esm/components/Modal/index.js +14 -18
  20. package/esm/components/RadioButton/index.js +19 -19
  21. package/esm/components/Stepper/index.js +6 -6
  22. package/esm/components/StepperAccordion/index.js +15 -15
  23. package/esm/components/TextArea/index.js +14 -14
  24. package/esm/components/Textfield/index.js +11 -11
  25. package/esm/hooks/useNameAndId.js +1 -0
  26. package/esm/index.js +1 -1
  27. package/esm/shared/helpers.js +1 -1
  28. package/esm/utils/utils.js +4 -0
  29. package/package.json +1 -1
  30. package/package.json.tmp +1 -1
  31. package/types/components/CheckBox/index.d.ts +1 -1
  32. package/types/components/RadioButton/index.d.ts +1 -1
  33. package/types/components/TextArea/index.d.ts +1 -1
  34. package/types/components/Textfield/index.d.ts +1 -1
  35. package/types/hooks/useNameAndId.d.ts +4 -0
  36. package/types/index.d.ts +2 -0
  37. package/types/shared/helpers.d.ts +1 -1
@@ -6,4 +6,8 @@
6
6
  font-family: inherit;
7
7
  outline: none;
8
8
  padding: 0;
9
+
10
+ &:focus-visible {
11
+ outline: revert;
12
+ }
9
13
  `,r=e=>({darker:e.colors.grayscaleNeutral.dark1,dark:e.colors.grayscaleNeutral.dark1,mainAlt:e.colors.grayscaleToned.dark1,main:e.colors.grayscaleToned.dark1,light:e.colors.grayscaleToned.light1,lighter:e.colors.grayscaleToned.light2,lighter2:e.colors.grayscaleToned.light3,lighter3:e.colors.grayscaleToned.light4}),t=["darker","dark","mainAlt","main","light","lighter","lighter2","lighter3"];exports.getDarkerShade=e=>{const r=t.indexOf(e);return r>0?t[r-1]:e},exports.getLighterShade=e=>{const r=t.indexOf(e);return r>=0&&r<t.length-1?t[r+1]:e},exports.getLuminosity=e=>{let r=0,t=0,a=0;return 4===e.length?(r=parseInt("0x"+e[1]+e[1]),t=parseInt("0x"+e[2]+e[2]),a=parseInt("0x"+e[3]+e[3])):7===e.length&&(r=parseInt("0x"+e[1]+e[2]),t=parseInt("0x"+e[3]+e[4]),a=parseInt("0x"+e[5]+e[6])),(Math.max(Number(r/255),Number(t/255),Number(a/255))+Math.min(Number(r/255),Number(t/255),Number(a/255)))/2*100},exports.hexToRGB=(e,r=1)=>`rgba(${parseInt(e.slice(1,3),16)}, ${parseInt(e.slice(3,5),16)}, ${parseInt(e.slice(5,7),16)}, ${r})`,exports.neutralColorSwap=r,exports.resetButtonStyle=e,exports.resolveColorWithNeutral=(e,t)=>"neutral"===t?r(e):e.colors[t];
@@ -1,20 +1,20 @@
1
- import{jsx as r,jsxs as c}from"react/jsx-runtime";import{useState as u,useRef as $}from"react";import i from"styled-components";import{UnmountClosed as x}from"react-collapse";import{mq as b}from"../../shared/media-queries.js";import w from"../../icons/components/ArrowDownIcon.js";import{generateNameHash as k}from"../../shared/helpers.js";const v=i.div`
1
+ import{jsx as i,jsxs as d}from"react/jsx-runtime";import{useState as $}from"react";import r from"styled-components";import{UnmountClosed as u}from"react-collapse";import{mq as x}from"../../shared/media-queries.js";import b from"../../icons/components/ArrowDownIcon.js";import{useNameAndId as w}from"../../hooks/useNameAndId.js";import"../../shared/helpers.js";const k=r.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  .ReactCollapse--collapse {
5
5
  transition: height 300ms;
6
6
  }
7
- `,O=i.ul`
7
+ `,O=r.ul`
8
8
  margin: 0;
9
9
  padding: 0;
10
10
  list-style: none;
11
- `,B=i.div`
11
+ `,v=r.div`
12
12
  display: flex;
13
13
  flex-direction: row;
14
14
  justify-content: space-between;
15
15
  cursor: pointer;
16
16
  margin: 0.5rem 0;
17
- `,N=i.div`
17
+ `,B=r.div`
18
18
  display: flex;
19
19
  justify-content: center;
20
20
  align-items: center;
@@ -22,30 +22,30 @@ import{jsx as r,jsxs as c}from"react/jsx-runtime";import{useState as u,useRef as
22
22
  color: ${({theme:e})=>e.colors.text.dark};
23
23
  transition: 200ms ease-in-out;
24
24
  transform: ${({isOpen:e})=>`rotate(${e?"180deg":"0deg"})`};
25
- `,T=i.li`
25
+ `,I=r.li`
26
26
  border-top: ${({theme:e})=>`1px solid ${e.colors.grayscaleToned.light2}`};
27
27
  padding: ${({isOpen:e})=>e?"0.5rem 0 1rem 0":"0.5rem 0"};
28
28
 
29
29
  &:last-child {
30
30
  border-bottom: ${({theme:e})=>`1px solid ${e.colors.grayscaleToned.light2}`};
31
31
  }
32
- `,j=i.span`
32
+ `,N=r.span`
33
33
  color: ${({theme:e})=>e.colors.text.dark};
34
34
  font-family: ${({theme:e})=>e.typography.fontBaseFamily};
35
35
  font-size: 0.9375rem;
36
36
  font-weight: ${({theme:e})=>e.typography.fontBaseBoldWeight};
37
- `,C=i.div`
37
+ `,T=r.div`
38
38
  font-family: ${({theme:e})=>e.typography.fontBaseFamily};
39
39
  color: ${({theme:e})=>e.colors.text.dark};
40
40
  font-size: 0.9375rem;
41
41
  font-weight: ${({theme:e})=>e.typography.fontBaseRegularWeight};
42
42
  line-height: 1.3;
43
43
  transition: 200ms ease-in-out;
44
- ${b("tablet")} {
44
+ ${x("tablet")} {
45
45
  padding: 0;
46
46
  }
47
47
  & > * {
48
48
  margin-top: 0;
49
49
  margin-bottom: 0;
50
50
  }
51
- `,d=({items:e,...p})=>{const[h,f]=u({}),a=$(k("accordion")),s=o=>{f(t=>({...t,[o]:!t[o]}))},g=o=>()=>{s(o)},y=o=>t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),s(o))};return r(v,{...p,children:r(O,{className:"accordionList",children:e.map((o,t)=>{const n=!!h[t],l=`${a.current}-${t}-header`,m=`${a.current}-${t}-content`;return c(T,{isOpen:n,className:"accordionItem",children:[c(B,{id:l,onClick:g(t),onKeyDown:y(t),className:"accordionItemTitle",role:"button",tabIndex:0,"aria-expanded":n,"aria-controls":m,children:[r(j,{as:"span",children:o.title}),r(N,{isOpen:n,children:r(w,{})})]}),r(x,{isOpened:n,children:r(C,{id:m,"aria-labelledby":l,role:"region",className:"wysiwyg",dangerouslySetInnerHTML:{__html:o.text}})},t)]},o.title)})})})};export{d as Accordion,d as default};
51
+ `,c=({items:e,...p})=>{const[h,f]=$({}),{id:a}=w("accordion"),s=o=>{f(t=>({...t,[o]:!t[o]}))},g=o=>()=>{s(o)},y=o=>t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),s(o))};return i(k,{...p,children:i(O,{className:"accordionList",children:e.map((o,t)=>{const n=!!h[t],l=`${a}-${t}-header`,m=`${a}-${t}-content`;return d(I,{isOpen:n,className:"accordionItem",children:[d(v,{id:l,onClick:g(t),onKeyDown:y(t),className:"accordionItemTitle",role:"button",tabIndex:0,"aria-expanded":n,"aria-controls":m,children:[i(N,{as:"span",children:o.title}),i(B,{isOpen:n,children:i(b,{})})]}),i(u,{isOpened:n,children:i(T,{id:m,"aria-labelledby":l,role:"region",className:"wysiwyg",dangerouslySetInnerHTML:{__html:o.text}})},t)]},o.title)})})})};export{c as Accordion,c as default};
@@ -1,7 +1,7 @@
1
- import{jsx as r}from"react/jsx-runtime";import{useRef as m}from"react";import l from"styled-components";import s from"./BreadcrumbsItem.js";import p from"../../icons/components/NextIcon.js";import{generateNameHash as d}from"../../shared/helpers.js";import"../../typography/BodyText/index.js";import"../../shared/media-queries.js";const c=l.ol`
1
+ import{jsx as r}from"react/jsx-runtime";import m from"styled-components";import p from"./BreadcrumbsItem.js";import l from"../../icons/components/NextIcon.js";import{useNameAndId as d}from"../../hooks/useNameAndId.js";import"../../typography/BodyText/index.js";import"../../shared/media-queries.js";import"react";import"../../shared/helpers.js";const s=m.ol`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  padding: 0;
5
5
  white-space: nowrap;
6
6
  overflow: hidden;
7
- `,f=({links:e,separator:o=r(p,{}),onlyLastTruncated:n=!1})=>{const t=m(d("breadcrumb"));return r("nav",{"aria-label":"Breadcrumb",id:t.current,children:r(c,{children:e.map((i,a)=>r(s,{link:i,separator:o,isLast:a===e.length-1,onlyLastTruncated:n},`${t.current}-${a}`))})})};export{f as default};
7
+ `,c=({links:a,separator:e=r(l,{}),onlyLastTruncated:i=!1})=>{const{id:o}=d("breadcrumb");return r("nav",{"aria-label":"Breadcrumb",id:o,children:r(s,{children:a.map((n,t)=>r(p,{link:n,separator:e,isLast:t===a.length-1,onlyLastTruncated:i},`${o}-${t}`))})})};export{c as default};
@@ -1,4 +1,4 @@
1
- import{jsxs as m,jsx as s}from"react/jsx-runtime";import a,{css as r}from"styled-components";import g from"../../icons/components/CheckmarkIcon.js";import{generateNameHash as $}from"../../shared/helpers.js";import i from"../../theme.js";import{BodyText as f}from"../../typography/BodyText/index.js";import{BackgroundStyles as u}from"../IconButton.js";import"../../shared/media-queries.js";import"../../utils/utils.js";const k=r`
1
+ import{jsxs as u,jsx as s}from"react/jsx-runtime";import a,{css as r}from"styled-components";import f from"../../icons/components/CheckmarkIcon.js";import i from"../../theme.js";import{BodyText as $}from"../../typography/BodyText/index.js";import{BackgroundStyles as k}from"../IconButton.js";import{useNameAndId as v}from"../../hooks/useNameAndId.js";import"../../shared/media-queries.js";import"../../utils/utils.js";import"react";import"../../shared/helpers.js";const y=r`
2
2
  width: 24px;
3
3
  height: 24px;
4
4
 
@@ -6,7 +6,7 @@ import{jsxs as m,jsx as s}from"react/jsx-runtime";import a,{css as r}from"styled
6
6
  width: 15px;
7
7
  height: 15px;
8
8
  }
9
- `,v=r`
9
+ `,z=r`
10
10
  width: 32px;
11
11
  height: 32px;
12
12
 
@@ -14,10 +14,10 @@ import{jsxs as m,jsx as s}from"react/jsx-runtime";import a,{css as r}from"styled
14
14
  width: 22px;
15
15
  height: 22px;
16
16
  }
17
- `,p={regular:k,large:v},y=r`
17
+ `,b={regular:y,large:z},D=r`
18
18
  cursor: default;
19
19
  border: 2px solid ${i.colors.grayscaleToned.light2};
20
- `,z=(e,o)=>r`
20
+ `,S=(e,o)=>r`
21
21
  svg {
22
22
  opacity: 1;
23
23
  }
@@ -27,17 +27,17 @@ import{jsxs as m,jsx as s}from"react/jsx-runtime";import a,{css as r}from"styled
27
27
 
28
28
  background: ${i.colors[e][o]};
29
29
  border: 2px solid ${i.colors[e][o]};
30
- `,D=r`
30
+ `,w=r`
31
31
  background: ${i.colors.grayscaleToned.light2};
32
32
  z-index: 1;
33
- `,S=r`
33
+ `,C=r`
34
34
  border: 2px solid ${i.colors.error.dark};
35
- `,w=a.div`
35
+ `,T=a.div`
36
36
  display: flex;
37
37
  align-items: flex-start;
38
38
  box-sizing: border-box;
39
39
  position: relative;
40
- `,C=a.input.attrs({type:"checkbox"})`
40
+ `,j=a.input.attrs({type:"checkbox"})`
41
41
  position: absolute;
42
42
  appearance: none;
43
43
  width: 100%;
@@ -47,14 +47,17 @@ import{jsxs as m,jsx as s}from"react/jsx-runtime";import a,{css as r}from"styled
47
47
  outline: none;
48
48
  cursor: pointer;
49
49
  z-index: 1;
50
- ${e=>p[e.boxSize]};
50
+ ${e=>b[e.boxSize]};
51
51
 
52
52
  &:hover,
53
53
  &:focus {
54
54
  transition: background-color 400ms;
55
- ${u}
55
+ ${k}
56
56
  }
57
- `,T=a.span`
57
+ &:focus-visible {
58
+ outline: revert;
59
+ }
60
+ `,B=a.span`
58
61
  box-sizing: border-box;
59
62
  cursor: pointer;
60
63
  display: flex;
@@ -65,21 +68,21 @@ import{jsxs as m,jsx as s}from"react/jsx-runtime";import a,{css as r}from"styled
65
68
 
66
69
  border: 2px solid ${i.colors.grayscaleToned.dark5};
67
70
 
68
- ${e=>p[e.size]};
71
+ ${e=>b[e.size]};
69
72
 
70
73
  svg {
71
74
  opacity: 0;
72
75
  color: ${({theme:e})=>e.colors.common.white};
73
76
  }
74
77
 
75
- ${e=>e.isChecked&&z(e.$color,e.$colorShade)};
76
- ${e=>e.isDisabled&&y};
77
- ${e=>e.hasError&&S};
78
- ${e=>e.isChecked&&e.isDisabled&&D};
79
- `,j=a(f)`
78
+ ${e=>e.isChecked&&S(e.$color,e.$colorShade)};
79
+ ${e=>e.isDisabled&&D};
80
+ ${e=>e.hasError&&C};
81
+ ${e=>e.isChecked&&e.isDisabled&&w};
82
+ `,E=a($)`
80
83
  flex: 1;
81
84
  cursor: ${({isDisabled:e})=>e?"default":"pointer"};
82
85
  user-select: none;
83
86
  color: ${({theme:e,isDisabled:o})=>o?e.colors.text.disabled:e.colors.text.dark};
84
87
  margin-left: 0.5rem;
85
- `,x=({name:e=$("check-box"),isDisabled:o=!1,size:d="regular",checked:l=!1,color:c="secondary",colorShade:n="mainAlt",hasError:h=!1,label:t,...b})=>m(w,{children:[s(C,{...b,type:"checkbox",checked:l,"data-validate":"checked",name:e,id:e,$color:c,$colorShade:n,disabled:o,isDisabled:o,boxSize:d,"aria-label":t?void 0:e,"aria-checked":l,"aria-invalid":h||void 0}),s(T,{size:d,$color:c,$colorShade:n,isChecked:l,isDisabled:o,hasError:h,children:s(g,{})}),t&&s(j,{as:"label",htmlFor:e,isDisabled:o,children:t})]});export{x as CheckBox,x as default};
88
+ `,m=({name:e,isDisabled:o=!1,size:d="regular",checked:l=!1,color:c="secondary",colorShade:n="mainAlt",hasError:h=!1,label:t,...g})=>{const{name:p,id:x}=v("check-box",e);return u(T,{children:[s(j,{...g,type:"checkbox",checked:l,"data-validate":"checked",name:p,id:x,$color:c,$colorShade:n,disabled:o,isDisabled:o,boxSize:d,"aria-label":t?void 0:p,"aria-checked":l,"aria-invalid":h||void 0}),s(B,{size:d,$color:c,$colorShade:n,isChecked:l,isDisabled:o,hasError:h,children:s(f,{})}),t&&s(E,{as:"label",htmlFor:x,isDisabled:o,children:t})]})};export{m as CheckBox,m as default};
@@ -1,4 +1,4 @@
1
- import{jsxs as m,Fragment as Q,jsx as t}from"react/jsx-runtime";import{useState as s,useEffect as R}from"react";import i from"styled-components";import v from"../../theme.js";import{BodyLink as U,BodyText as V}from"../../typography/BodyText/index.js";import{Button as f}from"../Button/index.js";import{Chip as W}from"../Chip/index.js";import{TextField as X}from"../Textfield/index.js";import"../../shared/media-queries.js";import"../Spinner/index.js";import"../../utils/utils.js";import"../../typography/ButtonText/index.js";import"../Button/styles.js";import"../../icons/components/CloseIcon.js";import"../Chip/styles.js";import"../FieldLabel.js";import"../../shared/helpers.js";const Y=i.div`
1
+ import{jsxs as m,Fragment as Q,jsx as t}from"react/jsx-runtime";import{useState as s,useEffect as R}from"react";import i from"styled-components";import v from"../../theme.js";import{BodyLink as U,BodyText as V}from"../../typography/BodyText/index.js";import{Button as f}from"../Button/index.js";import{Chip as W}from"../Chip/index.js";import{TextField as X}from"../Textfield/index.js";import"../../shared/media-queries.js";import"../Spinner/index.js";import"../../utils/utils.js";import"../../typography/ButtonText/index.js";import"../Button/styles.js";import"../../icons/components/CloseIcon.js";import"../Chip/styles.js";import"../FieldLabel.js";import"../../hooks/useNameAndId.js";import"../../shared/helpers.js";const Y=i.div`
2
2
  display: flex;
3
3
  border-bottom: 1px solid ${v.colors.grayscaleToned.light5};
4
4
  `,Z=i.form`
@@ -1,4 +1,4 @@
1
- import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect as b}from"react";import{createPortal as y}from"react-dom";import{CSSTransition as v}from"react-transition-group";import e,{css as k,createGlobalStyle as d}from"styled-components";import T from"../../icons/components/CloseIcon.js";import{resetButtonStyle as E}from"../../utils/utils.js";import{FocusTrap as C}from"../FocusTrap.js";const s=k`
1
+ import{jsx as t,jsxs as n,Fragment as b}from"react/jsx-runtime";import{useEffect as g}from"react";import{createPortal as y}from"react-dom";import{CSSTransition as v}from"react-transition-group";import e,{css as k,createGlobalStyle as d}from"styled-components";import T from"../../icons/components/CloseIcon.js";import{resetButtonStyle as E}from"../../utils/utils.js";import{FocusTrap as C}from"../FocusTrap.js";const s=k`
2
2
  .backgroundTransition-enter {
3
3
  opacity: 0;
4
4
  }
@@ -24,16 +24,20 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
24
24
  top: 0;
25
25
  left: 0;
26
26
  z-index: 200;
27
+ `,j=e.div`
28
+ width: 100%;
29
+ height: 100%;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
27
33
  `,P=e.div`
28
34
  z-index: -1;
29
35
  position: absolute;
30
36
  width: 100%;
31
37
  height: 100%;
32
38
  background-color: rgba(34, 34, 34, 0.3);
33
- `,$=e.div`
39
+ `,z=e.div`
34
40
  position: relative;
35
- max-width: 512px;
36
- max-height: 90vh;
37
41
  overflow-y: auto;
38
42
 
39
43
  padding: 1rem;
@@ -45,17 +49,9 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
45
49
  0px 11px 15px rgba(0, 0, 0, 0.15);
46
50
 
47
51
  margin: 1rem;
48
- margin-top: 50vh;
49
- transform: translateY(-50%);
50
- margin-left: 1rem;
51
- margin-right: 1rem;
52
-
53
- @media (min-width: 500px) {
54
- margin-left: auto;
55
- margin-right: auto;
56
- min-width: 355px;
57
- }
58
- `,j=e.button`
52
+ width: 80vw;
53
+ max-width: 512px;
54
+ `,F=e.button`
59
55
  ${E}
60
56
  display: flex;
61
57
  justify-self: flex-end;
@@ -71,7 +67,7 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
71
67
  svg {
72
68
  font-size: 1.5rem;
73
69
  }
74
- `,z=d`
70
+ `,O=d`
75
71
  body {
76
72
  overflow: hidden;
77
73
 
@@ -79,6 +75,6 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
79
75
  padding-right: 15px !important;
80
76
  `}
81
77
  }
82
- `,F=d`
78
+ `,L=d`
83
79
  ${s}
84
- `,l=({children:c,isOpen:o,contentStyles:p,withPortal:m=!1,withCloseIcon:u=!0,onClose:i,focusTrapProps:g={},...h})=>{b(()=>{const a=x=>{x.key==="Escape"&&o&&i()};return o&&window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[i,o]);const f=!!(typeof window<"u"&&window.document&&window.document.createElement),n=t(v,{in:o,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition",children:r(w,{children:[t(F,{}),r(S,{...h,children:[t(P,{"data-testid":"background",onClick:i}),t(C,{pause:!o,...g,children:r($,{style:p,role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[u&&t(j,{onClick:i,"data-testid":"close",type:"button","aria-label":"Close dialog",children:t(T,{})}),c]})}),t(z,{})]})]})});return m&&f?y(n,document.body):n};export{l as Modal,l as default};
80
+ `,c=({children:l,isOpen:o,contentStyles:p,withPortal:u=!1,withCloseIcon:m=!0,onClose:i,focusTrapProps:f={},...w})=>{g(()=>{const a=x=>{x.key==="Escape"&&o&&i()};return o&&window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[i,o]);const h=!!(typeof window<"u"&&window.document&&window.document.createElement),r=t(v,{in:o,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition",children:n(b,{children:[t(L,{}),n(S,{...w,children:[t(P,{"data-testid":"background",onClick:i}),t(C,{pause:!o,...f,children:t(j,{children:n(z,{style:p,role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[m&&t(F,{onClick:i,"data-testid":"close",type:"button","aria-label":"Close dialog",children:t(T,{})}),l]})})}),t(O,{})]})]})});return u&&h?y(r,document.body):r};export{c as Modal,c as default};
@@ -1,4 +1,4 @@
1
- import{jsxs as b,jsx as c}from"react/jsx-runtime";import i,{css as s}from"styled-components";import{generateNameHash as g}from"../../shared/helpers.js";import e from"../../theme.js";import{BodyText as $}from"../../typography/BodyText/index.js";import{BackgroundStyles as x}from"../IconButton.js";import"../../shared/media-queries.js";import"../../utils/utils.js";const f=s`
1
+ import{jsxs as m,jsx as c}from"react/jsx-runtime";import i,{css as a}from"styled-components";import e from"../../theme.js";import{BodyText as x}from"../../typography/BodyText/index.js";import{BackgroundStyles as f}from"../IconButton.js";import{useNameAndId as k}from"../../hooks/useNameAndId.js";import"../../shared/media-queries.js";import"../../utils/utils.js";import"react";import"../../shared/helpers.js";const y=a`
2
2
  .circle {
3
3
  &--outer {
4
4
  height: 24px;
@@ -11,7 +11,7 @@ import{jsxs as b,jsx as c}from"react/jsx-runtime";import i,{css as s}from"styled
11
11
  transform: scale(0.6);
12
12
  }
13
13
  }
14
- `,k=s`
14
+ `,D=a`
15
15
  .circle {
16
16
  &--outer {
17
17
  height: 32px;
@@ -24,7 +24,7 @@ import{jsxs as b,jsx as c}from"react/jsx-runtime";import i,{css as s}from"styled
24
24
  transform: scale(0.6);
25
25
  }
26
26
  }
27
- `,p={regular:f,large:k},y=s`
27
+ `,u={regular:y,large:D},z=a`
28
28
  cursor: default;
29
29
 
30
30
  .circle {
@@ -36,14 +36,14 @@ import{jsxs as b,jsx as c}from"react/jsx-runtime";import i,{css as s}from"styled
36
36
  border: 2px solid ${e.colors.grayscaleToned.light2};
37
37
  }
38
38
  }
39
- `,D=s`
39
+ `,v=a`
40
40
  .circle {
41
41
  &--inner {
42
42
  opacity: 1;
43
43
  background-color: ${e.colors.grayscaleToned.light2};
44
44
  }
45
45
  }
46
- `,z=(r,o,a)=>s`
46
+ `,S=(r,o,s)=>a`
47
47
  .circle {
48
48
  &--inner {
49
49
  opacity: 1;
@@ -52,48 +52,48 @@ import{jsxs as b,jsx as c}from"react/jsx-runtime";import i,{css as s}from"styled
52
52
 
53
53
  &--outer {
54
54
  border: 2px solid
55
- ${a?e.colors.error.dark:e.colors[r][o]};
55
+ ${s?e.colors.error.dark:e.colors[r][o]};
56
56
  }
57
57
  }
58
- `,v=i.div`
58
+ `,E=i.div`
59
59
  display: flex;
60
60
  align-items: flex-start;
61
61
  box-sizing: border-box;
62
- `,S=i.span`
62
+ `,N=i.span`
63
63
  cursor: pointer;
64
64
  display: flex;
65
65
  position: relative;
66
66
  align-items: center;
67
67
  justify-content: center;
68
68
 
69
- ${r=>p[r.size]};
69
+ ${r=>u[r.size]};
70
70
 
71
- ${r=>!r.isDisabled&&r.isChecked&&z(r.$color,r.$colorShade,r.$hasError)};
72
- ${r=>r.isDisabled&&y};
71
+ ${r=>!r.isDisabled&&r.isChecked&&S(r.$color,r.$colorShade,r.$hasError)};
72
+ ${r=>r.isDisabled&&z};
73
73
 
74
- ${r=>r.isChecked&&r.isDisabled&&D};
74
+ ${r=>r.isChecked&&r.isDisabled&&v};
75
75
 
76
76
  &:hover,
77
77
  &:focus {
78
78
  border-radius: 50%;
79
79
  transition: background-color 400ms;
80
- ${x}
80
+ ${f}
81
81
  }
82
- `,E=i.input`
82
+ `,T=i.input`
83
83
  position: absolute;
84
84
  opacity: 0;
85
85
  margin: 0;
86
86
  ${r=>!r.isDisabled&&"cursor: pointer;"}
87
87
  z-index: 1;
88
- ${r=>p[r.$size]};
89
- `,N=i.span`
88
+ ${r=>u[r.$size]};
89
+ `,w=i.span`
90
90
  display: flex;
91
91
  box-sizing: border-box;
92
92
  border-radius: 50%;
93
93
 
94
94
  border: 2px solid
95
95
  ${r=>r.$hasError?e.colors.error.dark:e.colors.grayscaleToned.dark5};
96
- `,T=i.span`
96
+ `,B=i.span`
97
97
  box-sizing: border-box;
98
98
  opacity: 0;
99
99
  margin: auto;
@@ -102,9 +102,9 @@ import{jsxs as b,jsx as c}from"react/jsx-runtime";import i,{css as s}from"styled
102
102
  position: absolute;
103
103
  top: 0;
104
104
  left: 0;
105
- `,w=i($)`
105
+ `,C=i(x)`
106
106
  cursor: ${({isDisabled:r})=>r?"default":"pointer"};
107
107
  user-select: none;
108
108
  color: ${({theme:r,isDisabled:o})=>o?r.colors.text.disabled:r.colors.text.dark};
109
109
  margin-left: 0.5rem;
110
- `,m=({name:r=g("radio-button"),size:o="regular",checked:a=!1,isDisabled:l=!1,color:n="secondary",colorShade:h="mainAlt",label:d,hasError:t,...u})=>b(v,{children:[b(S,{size:o,$color:n,$colorShade:h,isChecked:a,isDisabled:l,$hasError:t,children:[c(E,{"data-validate":"checked",checked:a,type:"radio",name:r,id:r,disabled:l,"aria-label":d?void 0:r,"aria-checked":a,"aria-invalid":t||void 0,className:"circle circle--outer",$size:o,isDisabled:l,$color:n,$colorShade:h,...u}),c(N,{className:"circle circle--outer",$hasError:t,children:c(T,{className:"circle circle--inner"})})]}),d&&c(w,{as:"label",htmlFor:r,isDisabled:l,children:d})]});export{m as RadioButton,m as default};
110
+ `,g=({name:r,size:o="regular",checked:s=!1,isDisabled:l=!1,color:n="secondary",colorShade:h="mainAlt",label:t,hasError:d,...$})=>{const{name:b,id:p}=k("radio-button",r);return m(E,{children:[m(N,{size:o,$color:n,$colorShade:h,isChecked:s,isDisabled:l,$hasError:d,children:[c(T,{"data-validate":"checked",checked:s,type:"radio",name:b,id:p,disabled:l,"aria-label":t?void 0:b,"aria-checked":s,"aria-invalid":d||void 0,className:"circle circle--outer",$size:o,isDisabled:l,$color:n,$colorShade:h,...$}),c(w,{className:"circle circle--outer",$hasError:d,children:c(B,{className:"circle circle--inner"})})]}),t&&c(C,{as:"label",htmlFor:p,isDisabled:l,children:t})]})};export{g as RadioButton,g as default};
@@ -1,9 +1,9 @@
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`
1
+ import{jsx as a,jsxs as x}from"react/jsx-runtime";import t from"styled-components";import{TinyTitleRegular as f}from"../../typography/Heading/index.js";import H from"../../icons/components/CheckmarkIcon.js";import{useNameAndId as b}from"../../hooks/useNameAndId.js";import"../../shared/media-queries.js";import"react";import"../../shared/helpers.js";const S=t.div`
2
2
  display: flex;
3
3
  flex-direction: ${({isHorizontal:e})=>e?"row":"column"};
4
4
  min-height: 4rem;
5
5
  margin: 0 auto;
6
- `,w=t.div`
6
+ `,v=t.div`
7
7
  display: flex;
8
8
  flex-direction: ${({isHorizontal:e})=>e?"column":"row"};
9
9
  column-gap: 0.75rem;
@@ -42,7 +42,7 @@ import{jsx as a,jsxs as f}from"react/jsx-runtime";import{useRef as x}from"react"
42
42
  height: ${({isHorizontal:e,$size:i})=>e?"2px":`calc(50% - ${i/2}rem)`};
43
43
  background: ${({theme:e,$color:i,$colorShade:o})=>e.colors[i][o]};
44
44
  }
45
- `,y=t.div``,k=t.div`
45
+ `,w=t.div``,y=t.div`
46
46
  display: flex;
47
47
  align-items: center;
48
48
  justify-content: center;
@@ -55,9 +55,9 @@ import{jsx as a,jsxs as f}from"react/jsx-runtime";import{useRef as x}from"react"
55
55
  ${({theme:e,isFilled:i,$color:o,$colorShade:c})=>i&&`
56
56
  background-color: ${e.colors[o][c]};
57
57
  `}
58
- `,j=t(H)`
58
+ `,k=t(f)`
59
59
  font-size: ${({size:e})=>`${e/2}rem`};
60
60
  line-height: 1;
61
- `,C=t(b)`
61
+ `,j=t(H)`
62
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};
63
+ `,A=({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",{id:z}=b("stepper");return a(S,{isHorizontal:d,...m,role:"list","aria-Label":s?.list??"Step progress",children:e.map((u,r)=>{const $=l&&r<l,g=$||o==="solid";return x(v,{$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(w,{children:a(y,{$color:c,$colorShade:p,isFilled:g,size:n,role:"img",children:$?a(j,{size:n,"aria-hidden":"true"}):a(k,{as:"span",size:n,"aria-hidden":"true",children:r+1})})}),u]},`${z}-${r}`)})})};export{A as Stepper};
@@ -1,18 +1,18 @@
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`
1
+ import{jsxs as u,jsx as t}from"react/jsx-runtime";import{useState as z,useCallback as I,useEffect as K}from"react";import s,{css as n}from"styled-components";import l from"../../theme.js";import{Title as A}from"../../typography/Heading/index.js";import{fadedColor as d}from"../../shared/helpers.js";import{Collapse as B}from"react-collapse";import F from"../../icons/components/CheckmarkIcon.js";import O from"../../icons/components/ShowMoreIcon.js";import{useNameAndId as T}from"../../hooks/useNameAndId.js";import"../../shared/media-queries.js";const c="200ms",L=s.div`
2
2
  .ReactCollapse--collapse {
3
3
  transition: height ${c} ease-in-out;
4
4
  }
5
- `,N=s`
5
+ `,N=n`
6
6
  transform: rotate(-180deg);
7
- `,T=a.div`
7
+ `,R=s.div`
8
8
  display: flex;
9
9
  align-items: center;
10
10
  height: 4rem;
11
11
 
12
12
  color: ${e=>e.$isDisabled?l.colors.text.disabled:l.colors.text.dark};
13
- `,U=a(I)`
13
+ `,_=s(A)`
14
14
  margin: 0;
15
- `,_=a(H)`
15
+ `,q=s(O)`
16
16
  font-size: 2rem;
17
17
  margin-left: auto;
18
18
 
@@ -20,18 +20,18 @@ import{jsxs as u,jsx as t}from"react/jsx-runtime";import{useState as z,useRef as
20
20
  transform: rotate(0deg);
21
21
  transform-origin: center;
22
22
  ${e=>e.isExpanded&&N};
23
- `,q=(e,o)=>s`
23
+ `,G=(e,r)=>n`
24
24
  color: white;
25
- background-color: ${l.colors[e][o]};
26
- `,G=(e,o,r)=>s`
25
+ background-color: ${l.colors[e][r]};
26
+ `,H=(e,r,o)=>n`
27
27
  fill: white;
28
- border: 2px solid ${d(l.colors[o][r],.2)};
28
+ border: 2px solid ${d(l.colors[r][o],.2)};
29
29
 
30
30
  ${e&&`
31
- border: 2px solid ${d(l.colors[o][r],0)};
32
- background-color: ${d(l.colors[o][r],.5)};
31
+ border: 2px solid ${d(l.colors[r][o],0)};
32
+ background-color: ${d(l.colors[r][o],.5)};
33
33
  `}
34
- `,J=a.div`
34
+ `,J=s.div`
35
35
  font-family: ${({theme:e})=>e.typography.fontBaseFamily};
36
36
  display: flex;
37
37
  align-items: center;
@@ -61,6 +61,6 @@ import{jsxs as u,jsx as t}from"react/jsx-runtime";import{useState as z,useRef as
61
61
  }
62
62
 
63
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};
64
+ ${e=>e.isComplete&&G(e.$color,e.$colorShade)};
65
+ ${e=>e.isDisabled&&H(e.isComplete,e.$color,e.$colorShade)};
66
+ `,x=({step:e,isExpanded:r,isDisabled:o,isComplete:m,onClick:y,color:C,colorShade:k,title:v,children:D,closedChildren:p,...S})=>{const[a,f]=z(r||!1),{id:h}=T("stepper"),$=I(()=>{o||f(i=>!i)},[o]);K(()=>{f(r||!1)},[o,r]);const w=e||e===0,E=i=>{o||(y||$)(i)},j=i=>{(i.key==="Enter"||i.key===" ")&&!o&&(i.preventDefault(),$())},g=`${h}-header`,b=`${h}-content`;return u(L,{children:[u(R,{...S,id:g,onClick:E,onKeyDown:j,$isDisabled:o||!1,role:"button",tabIndex:0,"aria-expanded":a,"aria-controls":b,children:[w&&t(J,{isComplete:m||!1,isDisabled:o||!1,$color:C||"primary",$colorShade:k||"main",children:m?t(F,{}):t("span",{children:e})}),t(_,{children:v}),t(q,{isExpanded:a})]}),t(B,{isOpened:a,children:t("div",{id:b,role:"region","aria-labelledby":g,children:D})}),p&&p]})};export{x as StepperAccordion,x as default};
@@ -1,18 +1,18 @@
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`
1
+ import{jsxs as h,jsx as i,Fragment as B}from"react/jsx-runtime";import{useState as E}from"react";import l,{css as $}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{useNameAndId as w}from"../../hooks/useNameAndId.js";import"../../shared/media-queries.js";import"../../shared/helpers.js";const A=$`
2
2
  border: 1px solid ${r.colors.grayscaleToned.light1};
3
3
  color: ${r.colors.grayscaleToned.dark1};
4
4
  fill: ${r.colors.grayscaleToned.light1};
5
- `,H=b`
5
+ `,I=$`
6
6
  border: 1px solid ${r.colors.error.dark};
7
- `,L=b`
7
+ `,C=$`
8
8
  color: ${r.colors.text.dark};
9
9
  border: 1px solid ${r.colors.text.dark};
10
10
  fill: ${r.colors.text.dark};
11
- `,R=l.div`
11
+ `,L=l.div`
12
12
  position: relative;
13
13
  padding: 0;
14
14
  display: inline-block;
15
- `,A=l.div`
15
+ `,D=l.div`
16
16
  display: inline-black;
17
17
 
18
18
  color: ${r.colors.grayscaleToned.light1};
@@ -24,11 +24,11 @@ import{jsxs as h,jsx as i,Fragment as z}from"react/jsx-runtime";import{useState
24
24
 
25
25
  padding: 0.7rem 0.75rem;
26
26
 
27
- ${({hasError:e,isFocused:a})=>!e&&a&&L}
28
- ${({disabled:e})=>e&&C}
29
- ${({hasError:e})=>e&&H}
27
+ ${({hasError:e,isFocused:a})=>!e&&a&&C}
28
+ ${({disabled:e})=>e&&A}
29
+ ${({hasError:e})=>e&&I}
30
30
  ${({centered:e})=>e&&"text-align: center;"}
31
- `,D=l.textarea`
31
+ `,H=l.textarea`
32
32
  ${N}
33
33
 
34
34
  width: 100%;
@@ -38,17 +38,17 @@ import{jsxs as h,jsx as i,Fragment as z}from"react/jsx-runtime";import{useState
38
38
  background-color: transparent;
39
39
 
40
40
  ${({resize:e})=>!e&&"resize: none;"}
41
- `,I=l.div`
42
- font-family: ${({theme:e})=>e.typography.fontBaseFamily};
43
41
  `,P=l.div`
42
+ font-family: ${({theme:e})=>e.typography.fontBaseFamily};
43
+ `,V=l.div`
44
44
  ${S}
45
45
  margin-top: 0.25rem;
46
46
 
47
47
  ${({centered:e})=>e&&"width: 100%; text-align: center;"}
48
- `,V=l.span`
48
+ `,W=l.span`
49
49
  display: block;
50
50
  color: ${({theme:e})=>e.colors.text.disabled};
51
- `,W=l.span`
51
+ `,q=l.span`
52
52
  display: block;
53
53
  color: ${({theme:e})=>e.colors.error.dark};
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};
54
+ `,u=({placeholder:e="",isDisabled:a=!1,centered:m=!1,hasError:b=!1,className:y,helperText:t,label:d="",resize:k=!0,name:v,errors:s,...n})=>{const[p,g]=E(!1),T=!!n.value,{name:x,id:o}=w("textarea",v),F=s?.map((f,c)=>`${o}-error-${c}`)??[],z=[t?`${o}-helper`:null,...F].filter(Boolean).join(" ");return h(L,{className:y,children:[h(D,{isFocused:p,disabled:a,centered:m,hasError:b,hasPlaceholder:!!e,children:[i(H,{...n,id:o,name:x,"aria-label":d?void 0:x,"aria-describedby":z||void 0,"aria-invalid":!!s?.length,resize:k,onFocus:()=>g(!0),onBlur:()=>g(!1),disabled:a,tabIndex:a?-1:0,theme:r,placeholder:d&&!p?"":e}),n.suffix&&i(P,{children:n.suffix})]}),d&&i(j,{htmlFor:o,isFocused:p,centered:m,hasError:b,hasValue:T,disabled:a,theme:r,children:h(B,{children:[d,i("span",{})]})}),(t||s)&&h(V,{centered:m,children:[t&&i(W,{id:`${o}-helper`,children:t}),s&&s.map((f,c)=>i(q,{id:`${o}-error-${c}`,role:"alert","aria-live":"assertive",children:f},`${o}-error-${c}`))]})]})};export{u as TextArea,u as default};
@@ -1,18 +1,18 @@
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=$`
1
+ import{jsxs as c,jsx as t,Fragment as z}from"react/jsx-runtime";import{useState as I}from"react";import o,{css as $}from"styled-components";import{Label as R}from"../FieldLabel.js";import{BodyTextStyle as V,CaptionStyle as q}from"../../typography/BodyText/index.js";import{useNameAndId as C}from"../../hooks/useNameAndId.js";import"../../shared/media-queries.js";import"../../shared/helpers.js";const D=$`
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
- `,D=$`
6
- border: 2px solid ${({theme:e})=>e.colors.error.dark};
7
5
  `,G=$`
6
+ border: 2px solid ${({theme:e})=>e.colors.error.dark};
7
+ `,H=$`
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
- `,I=o.div`
11
+ `,L=o.div`
12
12
  position: relative;
13
13
  padding: 0;
14
14
  display: block;
15
- `,L=o.div`
15
+ `,M=o.div`
16
16
  display: flex;
17
17
  text-align: center;
18
18
  align-items: center;
@@ -26,11 +26,11 @@ import{jsxs as c,jsx as t,Fragment as A}from"react/jsx-runtime";import{useState
26
26
 
27
27
  padding: 0.75rem 0.6rem;
28
28
 
29
- ${({hasError:e,isFocused:a})=>!e&&a&&G}
30
- ${({disabled:e})=>e&&C}
31
- ${({hasError:e})=>e&&D}
29
+ ${({hasError:e,isFocused:a})=>!e&&a&&H}
30
+ ${({disabled:e})=>e&&D}
31
+ ${({hasError:e})=>e&&G}
32
32
  ${({centered:e})=>e&&"text-align: center;"}
33
- `,M=o.input`
33
+ `,O=o.input`
34
34
  ${V}
35
35
  width: 100%;
36
36
  cursor: text;
@@ -42,7 +42,7 @@ import{jsxs as c,jsx as t,Fragment as A}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
- `,O=o.span`
45
+ `,P=o.span`
46
46
  display: flex;
47
47
  font-family: ${({theme:e})=>e.typography.fontBaseFamily};
48
48
  font-size: 1.25rem;
@@ -63,4 +63,4 @@ import{jsxs as c,jsx as t,Fragment as A}from"react/jsx-runtime";import{useState
63
63
  `,K=o.span`
64
64
  display: block;
65
65
  color: ${({theme:e})=>e.colors.error.dark};
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};
66
+ `,g=({placeholder:e="",isDisabled:a=!1,centered:m=!1,hasError:h=!1,className:y,helperText:s,label:d="",onBlur:k=()=>null,onFocus:v=()=>null,forwardRef:F,suffix:f,name:B,errors:i,isAutoFocused:T=!1,...u})=>{const[p,x]=I(!1),w=!!u.value,b=i&&Array.isArray(i)&&i?.length>0,{name:E,id:r}=C("text-input",B),j=i?.map((l,n)=>`${r}-error-${n}`)??[],A=[s?`${r}-helper`:null,...j].filter(Boolean).join(" "),N=l=>{x(!0),v(l)},S=l=>{x(!1),k(l)};return c(L,{className:y,children:[c(M,{isFocused:p,disabled:a,centered:m,hasError:h,hasPlaceholder:!!e,children:[t(O,{...u,id:r,name:E,"aria-labelledby":d?`${r}-label`:void 0,"aria-describedby":A||void 0,"aria-invalid":b||h,ref:F,onFocus:N,onBlur:S,disabled:a,placeholder:d&&!p?"":e,autoFocus:T}),f&&t(P,{children:f})]}),d&&t(R,{id:`${r}-label`,htmlFor:r,isFocused:p,centered:m,hasError:h,hasValue:w,disabled:a,children:c(z,{children:[d,t("span",{})]})}),(s||b)&&c(_,{centered:m,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{g as TextField,g as default};
@@ -0,0 +1 @@
1
+ import{useRef as r}from"react";import{generateNameHash as t}from"../shared/helpers.js";const u=(n,o)=>{const e=r(o??t(n)),m=r(`${e.current}-${t()}`);return{name:e.current,id:m.current}};export{u as useNameAndId};