@charcoal-ui/react 2.0.0-alpha.2 → 2.0.0-alpha.20

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 (34) hide show
  1. package/dist/components/Icon/index.d.ts +12 -0
  2. package/dist/components/Icon/index.d.ts.map +1 -0
  3. package/dist/components/Icon/index.story.d.ts +24 -0
  4. package/dist/components/Icon/index.story.d.ts.map +1 -0
  5. package/dist/components/Modal/ModalPlumbing.d.ts +5 -0
  6. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -0
  7. package/dist/components/Modal/index.d.ts +16 -0
  8. package/dist/components/Modal/index.d.ts.map +1 -0
  9. package/dist/components/Modal/index.story.d.ts +33 -0
  10. package/dist/components/Modal/index.story.d.ts.map +1 -0
  11. package/dist/components/TextField/index.d.ts +3 -3
  12. package/dist/components/TextField/index.d.ts.map +1 -1
  13. package/dist/components/TextField/index.story.d.ts +1 -0
  14. package/dist/components/TextField/index.story.d.ts.map +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.modern.js +35 -31
  20. package/dist/index.modern.js.map +1 -1
  21. package/dist/index.module.js +1 -1
  22. package/dist/index.module.js.map +1 -1
  23. package/package.json +9 -6
  24. package/src/components/FieldLabel/index.tsx +1 -1
  25. package/src/components/Icon/index.story.tsx +29 -0
  26. package/src/components/Icon/index.tsx +33 -0
  27. package/src/components/Modal/ModalPlumbing.tsx +47 -0
  28. package/src/components/Modal/index.story.tsx +195 -0
  29. package/src/components/Modal/index.tsx +226 -0
  30. package/src/components/TextField/index.story.tsx +29 -8
  31. package/src/components/TextField/index.tsx +48 -30
  32. package/src/components/a11y.test.tsx +11 -0
  33. package/src/index.ts +1 -0
  34. package/src/styled.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[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U,EACV,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,OAAO,IAAI,MAAM,EACjB,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,GACpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1,4 +1,4 @@
1
- import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRef as o,useState as i,useEffect as l}from"react";import s,{css as c}from"styled-components";import d from"@charcoal-ui/styled";import{disabledSelector as u,px as p}from"@charcoal-ui/utils";import f from"warning";import{useSwitch as h}from"@react-aria/switch";import{useToggleState as g}from"react-stately";import{useTextField as b}from"@react-aria/textfield";import{useVisuallyHidden as m}from"@react-aria/visually-hidden";function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v.apply(this,arguments)}function x(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(a[r]=e[r]);return a}const y=["to","children"],w={Link:e.forwardRef(function(t,r){let{to:n,children:a}=t,o=x(t,y);/*#__PURE__*/return e.createElement("a",v({href:n,ref:r},o),a)})},E=e.createContext(w);function $({children:t,components:r}){/*#__PURE__*/return e.createElement(E.Provider,{value:v({},w,r)},t)}function k(){return t(E)}const C=d(s);let R,P,S,z=e=>e;const L=["onClick","disabled"],N=e.forwardRef(function(t,r){const{Link:n}=k();if("to"in t){const{onClick:a,disabled:o=!1}=t,i=x(t,L);/*#__PURE__*/return e.createElement(q,v({},i,{as:o?void 0:n,onClick:o?void 0:a,"aria-disabled":o,ref:r}))}/*#__PURE__*/return e.createElement(T,v({},t,{ref:r}))}),O=c(R||(R=z`
1
+ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRef as i,useState as o,useEffect as l}from"react";import s,{css as c}from"styled-components";import{createTheme as d}from"@charcoal-ui/styled";import{disabledSelector as u,px as p}from"@charcoal-ui/utils";import f from"warning";import{useSwitch as h}from"@react-aria/switch";import{useToggleState as g}from"react-stately";import{useTextField as b}from"@react-aria/textfield";import{useVisuallyHidden as m}from"@react-aria/visually-hidden";import"@charcoal-ui/icons";function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v.apply(this,arguments)}function x(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(a[r]=e[r]);return a}const y=["to","children"],w={Link:e.forwardRef(function(t,r){let{to:n,children:a}=t,i=x(t,y);/*#__PURE__*/return e.createElement("a",v({href:n,ref:r},i),a)})},E=e.createContext(w);function $({children:t,components:r}){/*#__PURE__*/return e.createElement(E.Provider,{value:v({},w,r)},t)}function k(){return t(E)}const C=d(s);let R,P,S,z=e=>e;const L=["onClick","disabled"],N=e.forwardRef(function(t,r){const{Link:n}=k();if("to"in t){const{onClick:a,disabled:i=!1}=t,o=x(t,L);/*#__PURE__*/return e.createElement(q,v({},o,{as:i?void 0:n,onClick:i?void 0:a,"aria-disabled":i,ref:r}))}/*#__PURE__*/return e.createElement(T,v({},t,{ref:r}))}),O=c(R||(R=z`
2
2
  /* Clickable style */
3
3
  cursor: pointer;
4
4
 
@@ -53,7 +53,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
53
53
  }
54
54
 
55
55
  ${0}
56
- `),O);let D;const M=["children","variant","size","fixed","disabled"],H=e.forwardRef(function(t,r){let{children:n,variant:a="Default",size:o="M",fixed:i=!1,disabled:l=!1}=t,s=x(t,M);/*#__PURE__*/return e.createElement(j,v({},s,{disabled:l,variant:a,size:o,fixed:i,ref:r}),n)}),j=s(N).withConfig({shouldForwardProp:e=>"fixed"!==e}).attrs(function(e){return v({},e,function(e){switch(e){case"Overlay":return{font:"text5",background:"surface4"};case"Default":return{font:"text2",background:"surface3"};case"Primary":return{font:"text5",background:"brand"};case"Navigation":return{font:"text5",background:"surface6"};case"Danger":return{font:"text5",background:"assertive"};default:return function(e){throw new Error(0===arguments.length?"unreachable":`unreachable (${JSON.stringify(e)})`)}(e)}}(e.variant),function(e){switch(e){case"S":return{height:32,padding:16};case"M":return{height:40,padding:24}}}(e.size))})(D||(D=(e=>e)`
56
+ `),O);let D;const M=["children","variant","size","fixed","disabled"],H=e.forwardRef(function(t,r){let{children:n,variant:a="Default",size:i="M",fixed:o=!1,disabled:l=!1}=t,s=x(t,M);/*#__PURE__*/return e.createElement(G,v({},s,{disabled:l,variant:a,size:i,fixed:o,ref:r}),n)}),G=s(N).withConfig({shouldForwardProp:e=>"fixed"!==e}).attrs(function(e){return v({},e,function(e){switch(e){case"Overlay":return{font:"text5",background:"surface4"};case"Default":return{font:"text2",background:"surface3"};case"Primary":return{font:"text5",background:"brand"};case"Navigation":return{font:"text5",background:"surface6"};case"Danger":return{font:"text5",background:"assertive"};default:return function(e){throw new Error(0===arguments.length?"unreachable":`unreachable (${JSON.stringify(e)})`)}(e)}}(e.variant),function(e){switch(e){case"S":return{height:32,padding:16};case"M":return{height:40,padding:24}}}(e.size))})(D||(D=(e=>e)`
57
57
  width: ${0};
58
58
  display: inline-grid;
59
59
  align-items: center;
@@ -66,7 +66,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
66
66
 
67
67
  /* よく考えたらheight=32って定義が存在しないな... */
68
68
  height: ${0}px;
69
- `),e=>e.fixed?"stretch":"min-content",e=>C(t=>[t.font[e.font].hover.press,t.bg[e.background].hover.press,t.typography(14).bold.preserveHalfLeading,t.padding.horizontal(e.padding),t.disabled,t.borderRadius("oval"),t.outline.default.focus]),e=>e.height);let F;const G=["variant","size","icon"],I=e.forwardRef(function(t,r){let{variant:n="Default",size:a="M",icon:o}=t,i=x(t,G);return function(e,t){let r;switch(e){case"XS":r="16";break;case"S":case"M":r="24"}const n=/^[0-9]*/.exec(t);if(null==n)throw new Error("Invalid icon name");const[a]=n;a!==r&&console.warn(`IconButton with size "${e}" expect icon size "${r}, but got "${a}"`)}(a,o),/*#__PURE__*/e.createElement(X,v({},i,{ref:r,variant:n,size:a}),/*#__PURE__*/e.createElement("pixiv-icon",{name:o}))}),X=s(N).attrs(function(e){return v({},e,function(e){switch(e){case"Default":return{font:"text3",background:"transparent"};case"Overlay":return{font:"text5",background:"surface4"}}}(e.variant),function(e){switch(e){case"XS":return{width:20,height:20};case"S":return{width:32,height:32};case"M":return{width:40,height:40}}}(e.size))})(F||(F=(e=>e)`
69
+ `),e=>e.fixed?"stretch":"min-content",e=>C(t=>[t.font[e.font].hover.press,t.bg[e.background].hover.press,t.typography(14).bold.preserveHalfLeading,t.padding.horizontal(e.padding),t.disabled,t.borderRadius("oval"),t.outline.default.focus]),e=>e.height);let j;const F=["variant","size","icon"],I=e.forwardRef(function(t,r){let{variant:n="Default",size:a="M",icon:i}=t,o=x(t,F);return function(e,t){let r;switch(e){case"XS":r="16";break;case"S":case"M":r="24"}const n=/^[0-9]*/.exec(t);if(null==n)throw new Error("Invalid icon name");const[a]=n;a!==r&&console.warn(`IconButton with size "${e}" expect icon size "${r}, but got "${a}"`)}(a,i),/*#__PURE__*/e.createElement(B,v({},o,{ref:r,variant:n,size:a}),/*#__PURE__*/e.createElement("pixiv-icon",{name:i}))}),B=s(N).attrs(function(e){return v({},e,function(e){switch(e){case"Default":return{font:"text3",background:"transparent"};case"Overlay":return{font:"text5",background:"surface4"}}}(e.variant),function(e){switch(e){case"XS":return{width:20,height:20};case"S":return{width:32,height:32};case"M":return{width:40,height:40}}}(e.size))})(j||(j=(e=>e)`
70
70
  user-select: none;
71
71
 
72
72
  width: ${0}px;
@@ -76,7 +76,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
76
76
  justify-content: center;
77
77
 
78
78
  ${0}
79
- `),e=>e.width,e=>e.height,({font:e,background:t})=>C(r=>[r.font[e],r.bg[t].hover.press,r.disabled,r.borderRadius("oval"),r.outline.default.focus]));let A,B,Y,J,K=e=>e;function Q({value:n,forceChecked:a=!1,disabled:o=!1,children:i}){const{name:l,selected:s,disabled:c,readonly:d,hasError:u,onChange:p}=t(_);f(void 0!==l,'"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?');const h=n===s,g=o||c,b=d&&!h,m=r(e=>{p(e.currentTarget.value)},[p]);/*#__PURE__*/return e.createElement(U,{"aria-disabled":g||b},/*#__PURE__*/e.createElement(V,{name:l,value:n,checked:a||h,hasError:u,onChange:m,disabled:g||b}),null!=i&&/*#__PURE__*/e.createElement(W,null,i))}const U=s.label(A||(A=K`
79
+ `),e=>e.width,e=>e.height,({font:e,background:t})=>C(r=>[r.font[e],r.bg[t].hover.press,r.disabled,r.borderRadius("oval"),r.outline.default.focus]));let X,A,Y,J,K=e=>e;function Q({value:n,forceChecked:a=!1,disabled:i=!1,children:o}){const{name:l,selected:s,disabled:c,readonly:d,hasError:u,onChange:p}=t(_);f(void 0!==l,'"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?');const h=n===s,g=i||c,b=d&&!h,m=r(e=>{p(e.currentTarget.value)},[p]);/*#__PURE__*/return e.createElement(U,{"aria-disabled":g||b},/*#__PURE__*/e.createElement(V,{name:l,value:n,checked:a||h,hasError:u,onChange:m,disabled:g||b}),null!=o&&/*#__PURE__*/e.createElement(W,null,o))}const U=s.label(X||(X=K`
80
80
  display: grid;
81
81
  grid-template-columns: auto 1fr;
82
82
  grid-gap: ${0};
@@ -84,7 +84,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
84
84
  cursor: pointer;
85
85
 
86
86
  ${0}
87
- `),({theme:e})=>p(e.spacing[4]),C(e=>[e.disabled])),V=s.input.attrs({type:"radio"})(B||(B=K`
87
+ `),({theme:e})=>p(e.spacing[4]),C(e=>[e.disabled])),V=s.input.attrs({type:"radio"})(A||(A=K`
88
88
  /** Make prior to browser default style */
89
89
  &[type='radio'] {
90
90
  appearance: none;
@@ -126,7 +126,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
126
126
  display: grid;
127
127
  grid-template-columns: 1fr;
128
128
  grid-gap: ${0};
129
- `),({theme:e})=>p(e.spacing[8])),_=e.createContext({name:void 0,selected:void 0,disabled:!1,readonly:!1,hasError:!1,onChange(){throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?")}});function ee({className:t,value:n,label:a,name:o,onChange:i,disabled:l,readonly:s,hasError:c,children:d}){const u=r(e=>{i(e)},[i]);/*#__PURE__*/return e.createElement(_.Provider,{value:{name:o,selected:n,disabled:null!=l&&l,readonly:null!=s&&s,hasError:null!=c&&c,onChange:u}},/*#__PURE__*/e.createElement(Z,{role:"radiogroup","aria-orientation":"vertical","aria-label":a,"aria-invalid":c,className:t},d))}const te=n({name:void 0,selected:[],disabled:!1,readonly:!1,hasError:!1,onChange(){throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<SelectGroup />` ?")}});let re,ne,ae,oe,ie,le=e=>e;function se({value:n,forceChecked:a=!1,disabled:o=!1,onChange:i,variant:l="default",children:s}){const{name:c,selected:d,disabled:u,readonly:p,hasError:h,onChange:g}=t(te);f(void 0!==c,'"name" is not Provided for <Select>. Perhaps you forgot to wrap with <SelectGroup> ?');const b=d.includes(n)||a,m=o||u||p,v=r(e=>{e.currentTarget instanceof HTMLInputElement&&(i&&i({value:n,selected:e.currentTarget.checked}),g({value:n,selected:e.currentTarget.checked}))},[i,g,n]);/*#__PURE__*/return e.createElement(ce,{"aria-disabled":m},/*#__PURE__*/e.createElement(ue,{name:c,value:n,hasError:h,checked:b,disabled:m,onChange:v,overlay:"overlay"===l,"aria-invalid":h}),/*#__PURE__*/e.createElement(pe,{overlay:"overlay"===l,hasError:h,"aria-hidden":!0},/*#__PURE__*/e.createElement("pixiv-icon",{name:"24/Check","unsafe-non-guideline-scale":16/24})),Boolean(s)&&/*#__PURE__*/e.createElement(de,null,s))}const ce=s.label(re||(re=le`
129
+ `),({theme:e})=>p(e.spacing[8])),_=e.createContext({name:void 0,selected:void 0,disabled:!1,readonly:!1,hasError:!1,onChange(){throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?")}});function ee({className:t,value:n,label:a,name:i,onChange:o,disabled:l,readonly:s,hasError:c,children:d}){const u=r(e=>{o(e)},[o]);/*#__PURE__*/return e.createElement(_.Provider,{value:{name:i,selected:n,disabled:null!=l&&l,readonly:null!=s&&s,hasError:null!=c&&c,onChange:u}},/*#__PURE__*/e.createElement(Z,{role:"radiogroup","aria-orientation":"vertical","aria-label":a,"aria-invalid":c,className:t},d))}const te=n({name:void 0,selected:[],disabled:!1,readonly:!1,hasError:!1,onChange(){throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<SelectGroup />` ?")}});let re,ne,ae,ie,oe,le=e=>e;function se({value:n,forceChecked:a=!1,disabled:i=!1,onChange:o,variant:l="default",children:s}){const{name:c,selected:d,disabled:u,readonly:p,hasError:h,onChange:g}=t(te);f(void 0!==c,'"name" is not Provided for <Select>. Perhaps you forgot to wrap with <SelectGroup> ?');const b=d.includes(n)||a,m=i||u||p,v=r(e=>{e.currentTarget instanceof HTMLInputElement&&(o&&o({value:n,selected:e.currentTarget.checked}),g({value:n,selected:e.currentTarget.checked}))},[o,g,n]);/*#__PURE__*/return e.createElement(ce,{"aria-disabled":m},/*#__PURE__*/e.createElement(ue,{name:c,value:n,hasError:h,checked:b,disabled:m,onChange:v,overlay:"overlay"===l,"aria-invalid":h}),/*#__PURE__*/e.createElement(pe,{overlay:"overlay"===l,hasError:h,"aria-hidden":!0},/*#__PURE__*/e.createElement("pixiv-icon",{name:"24/Check","unsafe-non-guideline-scale":16/24})),Boolean(s)&&/*#__PURE__*/e.createElement(de,null,s))}const ce=s.label(re||(re=le`
130
130
  display: grid;
131
131
  grid-template-columns: auto 1fr;
132
132
  align-items: center;
@@ -155,7 +155,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
155
155
 
156
156
  ${0};
157
157
  }
158
- `),C(e=>e.bg.brand.hover.press),({hasError:e,overlay:t})=>C(r=>[r.bg.text3.hover.press,r.borderRadius("oval"),e&&!t&&r.outline.assertive,t&&r.bg.surface4])),pe=s.div(oe||(oe=le`
158
+ `),C(e=>e.bg.brand.hover.press),({hasError:e,overlay:t})=>C(r=>[r.bg.text3.hover.press,r.borderRadius("oval"),e&&!t&&r.outline.assertive,t&&r.bg.surface4])),pe=s.div(ie||(ie=le`
159
159
  position: absolute;
160
160
  top: -2px;
161
161
  left: -2px;
@@ -167,11 +167,11 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
167
167
  ${0}
168
168
 
169
169
  ${0}
170
- `),({hasError:e,overlay:t})=>C(r=>[r.width.px(24),r.height.px(24),r.borderRadius("oval"),r.font.text5,e&&t&&r.outline.assertive]),({overlay:e})=>e&&c(ie||(ie=le`
170
+ `),({hasError:e,overlay:t})=>C(r=>[r.width.px(24),r.height.px(24),r.borderRadius("oval"),r.font.text5,e&&t&&r.outline.assertive]),({overlay:e})=>e&&c(oe||(oe=le`
171
171
  border-color: ${0};
172
172
  border-width: 2px;
173
173
  border-style: solid;
174
- `),({theme:e})=>e.color.text5));function fe({className:t,name:n,ariaLabel:a,selected:o,onChange:i,disabled:l=!1,readonly:s=!1,hasError:c=!1,children:d}){const u=r(e=>{const t=o.indexOf(e.value);e.selected?t<0&&i([...o,e.value]):t>=0&&i([...o.slice(0,t),...o.slice(t+1)])},[i,o]);/*#__PURE__*/return e.createElement(te.Provider,{value:{name:n,selected:Array.from(new Set(o)),disabled:l,readonly:s,hasError:c,onChange:u}},/*#__PURE__*/e.createElement("div",{className:t,"aria-label":a,"data-testid":"SelectGroup"},d))}let he,ge,be,me=e=>e;const ve=["className","type"];function xe(t){const{disabled:r,className:n}=t,i=a(()=>v({},t,{"aria-label":"children"in t?void 0:t.label,isDisabled:t.disabled,isSelected:t.checked}),[t]),l=g(i),s=o(null),c=x(h(i,l,s).inputProps,ve);/*#__PURE__*/return e.createElement(ye,{className:n,"aria-disabled":r},/*#__PURE__*/e.createElement(Ee,v({},c,{ref:s})),"children"in t?/*#__PURE__*/e.createElement(we,null,t.children):void 0)}const ye=s.label(he||(he=me`
174
+ `),({theme:e})=>e.color.text5));function fe({className:t,name:n,ariaLabel:a,selected:i,onChange:o,disabled:l=!1,readonly:s=!1,hasError:c=!1,children:d}){const u=r(e=>{const t=i.indexOf(e.value);e.selected?t<0&&o([...i,e.value]):t>=0&&o([...i.slice(0,t),...i.slice(t+1)])},[o,i]);/*#__PURE__*/return e.createElement(te.Provider,{value:{name:n,selected:Array.from(new Set(i)),disabled:l,readonly:s,hasError:c,onChange:u}},/*#__PURE__*/e.createElement("div",{className:t,"aria-label":a,"data-testid":"SelectGroup"},d))}let he,ge,be,me=e=>e;const ve=["className","type"];function xe(t){const{disabled:r,className:n}=t,o=a(()=>v({},t,{"aria-label":"children"in t?void 0:t.label,isDisabled:t.disabled,isSelected:t.checked}),[t]),l=g(o),s=i(null),c=x(h(o,l,s).inputProps,ve);/*#__PURE__*/return e.createElement(ye,{className:n,"aria-disabled":r},/*#__PURE__*/e.createElement(Ee,v({},c,{ref:s})),"children"in t?/*#__PURE__*/e.createElement(we,null,t.children):void 0)}const ye=s.label(he||(he=me`
175
175
  display: inline-grid;
176
176
  grid-template-columns: auto 1fr;
177
177
  gap: ${0};
@@ -218,7 +218,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
218
218
  }
219
219
  }
220
220
  }
221
- `),C(e=>[e.borderRadius(16),e.height.px(16),e.bg.text4.hover.press,e.outline.default.focus]),C(e=>[e.bg.text5.hover.press,e.borderRadius("oval")]),C(e=>e.bg.brand.hover.press));let $e,ke,Ce,Re,Pe=e=>e;const Se=["style","className","label","required","requiredText","subLabel"],ze=e.forwardRef(function(t,r){let{style:n,className:a,label:o,required:i=!1,requiredText:l,subLabel:s}=t,c=x(t,Se);/*#__PURE__*/return e.createElement(qe,{style:n,className:a},/*#__PURE__*/e.createElement(Ne,v({ref:r},c),o),i&&/*#__PURE__*/e.createElement(Oe,null,l),/*#__PURE__*/e.createElement(Te,null,/*#__PURE__*/e.createElement("span",null,s)))}),Le=d(s),Ne=s.label($e||($e=Pe`
221
+ `),C(e=>[e.borderRadius(16),e.height.px(16),e.bg.text4.hover.press,e.outline.default.focus]),C(e=>[e.bg.text5.hover.press,e.borderRadius("oval")]),C(e=>e.bg.brand.hover.press));let $e,ke,Ce,Re,Pe=e=>e;const Se=["style","className","label","required","requiredText","subLabel"],ze=e.forwardRef(function(t,r){let{style:n,className:a,label:i,required:o=!1,requiredText:l,subLabel:s}=t,c=x(t,Se);/*#__PURE__*/return e.createElement(qe,{style:n,className:a},/*#__PURE__*/e.createElement(Ne,v({ref:r},c),i),o&&/*#__PURE__*/e.createElement(Oe,null,l),/*#__PURE__*/e.createElement(Te,null,/*#__PURE__*/e.createElement("span",null,s)))}),Le=d(s),Ne=s.label($e||($e=Pe`
222
222
  ${0}
223
223
  `),Le(e=>[e.typography(14).bold,e.font.text1])),Oe=s.span(ke||(ke=Pe`
224
224
  ${0}
@@ -235,23 +235,23 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
235
235
  > ${0} {
236
236
  ${0}
237
237
  }
238
- `),Oe,Le(e=>e.margin.left(4)),Te,Le(e=>e.margin.left("auto")));let De,Me,He,je,Fe,Ge,Ie,Xe,Ae,Be,Ye,Je,Ke,Qe,Ue=e=>e;const Ve=["onChange"],We=["onChange"],Ze=d(s);function _e(...e){return t=>{for(const r of e)"function"==typeof r?r(t):null!==r&&(r.current=t)}}function et(e){return Array.from(e).length}const tt=e.forwardRef(function(t,r){/*#__PURE__*/return e.createElement(void 0!==t.multiline&&t.multiline?nt:rt,v({ref:r},t))}),rt=e.forwardRef(function(t,n){var a;let{onChange:s}=t,c=x(t,Ve);const{className:d,showLabel:u=!1,showCount:p=!1,label:f,requiredText:h,subLabel:g,disabled:y=!1,required:w,invalid:E=!1,assistiveText:$,maxLength:k,prefix:C="",suffix:R=""}=c,{visuallyHiddenProps:P}=m(),S=o(null),z=o(null),L=o(null),[N,O]=i(et(null!=(a=c.value)?a:"")),[T,q]=i(0),[D,M]=i(0),H=void 0===c.value,j=r(e=>{const t=et(e);void 0!==k&&t>k||(H&&O(t),null==s||s(e))},[k,H,s]);l(()=>{var e;O(et(null!=(e=c.value)?e:""))},[c.value]);const{inputProps:F,labelProps:G,descriptionProps:I,errorMessageProps:X}=b(v({inputElementType:"input",isDisabled:y,isRequired:w,validationState:E?"invalid":"valid",description:!E&&$,errorMessage:E&&$,onChange:j},c),S);return l(()=>{const e=new ResizeObserver(e=>{q(e[0].contentRect.width)}),t=new ResizeObserver(e=>{M(e[0].contentRect.width)});return null!==z.current&&e.observe(z.current),null!==L.current&&t.observe(L.current),()=>{t.disconnect(),e.disconnect()}},[]),/*#__PURE__*/e.createElement(at,{className:d,isDisabled:y},/*#__PURE__*/e.createElement(ot,v({label:f,requiredText:h,required:w,subLabel:g},G,u?{}:P)),/*#__PURE__*/e.createElement(it,null,/*#__PURE__*/e.createElement(lt,{ref:z},/*#__PURE__*/e.createElement(ct,null,C)),/*#__PURE__*/e.createElement(dt,v({ref:_e(n,S),invalid:E,extraLeftPadding:T,extraRightPadding:D},F)),/*#__PURE__*/e.createElement(st,{ref:L},/*#__PURE__*/e.createElement(ct,null,R),p&&k&&/*#__PURE__*/e.createElement(ft,null,N,"/",k))),null!=$&&0!==$.length&&/*#__PURE__*/e.createElement(gt,v({invalid:E},E?X:I),$))}),nt=e.forwardRef(function(t,n){var a;let{onChange:s}=t,c=x(t,We);const{className:d,showCount:u=!1,showLabel:p=!1,label:f,requiredText:h,subLabel:g,disabled:y=!1,required:w,invalid:E=!1,assistiveText:$,maxLength:k,autoHeight:C=!1,rows:R=4}=c,{visuallyHiddenProps:P}=m(),S=o(null),z=o(null),[L,N]=i(et(null!=(a=c.value)?a:"")),[O,T]=i(R),q=r(e=>{var t,r;const n=null!=(t=null==(r=`${e.value}\n`.match(/\n/g))?void 0:r.length)?t:1;R<=n&&T(n)},[R]),D=void 0===c.value,M=r(e=>{const t=et(e);void 0!==k&&t>k||(D&&N(t),C&&null!==S.current&&q(S.current),null==s||s(e))},[C,k,D,s,q]);l(()=>{var e;N(et(null!=(e=c.value)?e:""))},[c.value]);const{inputProps:H,labelProps:j,descriptionProps:F,errorMessageProps:G}=b(v({inputElementType:"textarea",isDisabled:y,isRequired:w,validationState:E?"invalid":"valid",description:!E&&$,errorMessage:E&&$,onChange:M},c),z);return l(()=>{C&&null!==S.current&&q(S.current)},[C,q]),/*#__PURE__*/e.createElement(at,{className:d,isDisabled:y},/*#__PURE__*/e.createElement(ot,v({label:f,requiredText:h,required:w,subLabel:g},j,p?P:{})),/*#__PURE__*/e.createElement(ut,{rows:O},/*#__PURE__*/e.createElement(pt,v({ref:_e(S,n,z),invalid:E,rows:O},H)),u&&/*#__PURE__*/e.createElement(ht,null,L)),null!=$&&0!==$.length&&/*#__PURE__*/e.createElement(gt,v({invalid:E},E?G:F),$))}),at=s.div(De||(De=Ue`
238
+ `),Oe,Le(e=>e.margin.left(4)),Te,Le(e=>e.margin.left("auto")));let De,Me,He,Ge,je,Fe,Ie,Be,Xe,Ae,Ye,Je,Ke,Qe,Ue=e=>e;const Ve=["onChange"],We=["onChange"],Ze=d(s);function _e(...e){return t=>{for(const r of e)"function"==typeof r?r(t):null!==r&&(r.current=t)}}function et(e){return Array.from(e).length}const tt=e.forwardRef(function(t,r){/*#__PURE__*/return e.createElement(void 0!==t.multiline&&t.multiline?nt:rt,v({ref:r},t))}),rt=e.forwardRef(function(t,n){var a;let{onChange:s}=t,c=x(t,Ve);const{className:d,showLabel:u=!1,showCount:p=!1,label:f,requiredText:h,subLabel:g,disabled:y=!1,required:w,invalid:E=!1,assistiveText:$,maxLength:k,prefix:C=null,suffix:R=null}=c,{visuallyHiddenProps:P}=m(),S=i(null),z=i(null),L=i(null),[N,O]=o(et(null!=(a=c.value)?a:"")),[T,q]=o(0),[D,M]=o(0),H=void 0===c.value,G=r(e=>{const t=et(e);void 0!==k&&t>k||(H&&O(t),null==s||s(e))},[k,H,s]);l(()=>{var e;O(et(null!=(e=c.value)?e:""))},[c.value]);const{inputProps:j,labelProps:F,descriptionProps:I,errorMessageProps:B}=b(v({inputElementType:"input",isDisabled:y,isRequired:w,validationState:E?"invalid":"valid",description:!E&&$,errorMessage:E&&$,onChange:G},c),S);return l(()=>{const e=new ResizeObserver(e=>{q(e[0].contentRect.width)}),t=new ResizeObserver(e=>{M(e[0].contentRect.width)});return null!==z.current&&e.observe(z.current),null!==L.current&&t.observe(L.current),()=>{t.disconnect(),e.disconnect()}},[]),/*#__PURE__*/e.createElement(at,{className:d,isDisabled:y},/*#__PURE__*/e.createElement(it,v({label:f,requiredText:h,required:w,subLabel:g},F,u?{}:P)),/*#__PURE__*/e.createElement(ot,null,/*#__PURE__*/e.createElement(lt,{ref:z},/*#__PURE__*/e.createElement(ct,null,C)),/*#__PURE__*/e.createElement(dt,v({ref:_e(n,S),invalid:E,extraLeftPadding:T,extraRightPadding:D},j)),/*#__PURE__*/e.createElement(st,{ref:L},/*#__PURE__*/e.createElement(ct,null,R),p&&/*#__PURE__*/e.createElement(ft,null,void 0!==k?`${N}/${k}`:N))),null!=$&&0!==$.length&&/*#__PURE__*/e.createElement(gt,v({invalid:E},E?B:I),$))}),nt=e.forwardRef(function(t,n){var a;let{onChange:s}=t,c=x(t,We);const{className:d,showCount:u=!1,showLabel:p=!1,label:f,requiredText:h,subLabel:g,disabled:y=!1,required:w,invalid:E=!1,assistiveText:$,maxLength:k,autoHeight:C=!1,rows:R=4}=c,{visuallyHiddenProps:P}=m(),S=i(null),z=i(null),[L,N]=o(et(null!=(a=c.value)?a:"")),[O,T]=o(R),q=r(e=>{var t,r;const n=null!=(t=null==(r=`${e.value}\n`.match(/\n/g))?void 0:r.length)?t:1;R<=n&&T(n)},[R]),D=void 0===c.value,M=r(e=>{const t=et(e);void 0!==k&&t>k||(D&&N(t),C&&null!==S.current&&q(S.current),null==s||s(e))},[C,k,D,s,q]);l(()=>{var e;N(et(null!=(e=c.value)?e:""))},[c.value]);const{inputProps:H,labelProps:G,descriptionProps:j,errorMessageProps:F}=b(v({inputElementType:"textarea",isDisabled:y,isRequired:w,validationState:E?"invalid":"valid",description:!E&&$,errorMessage:E&&$,onChange:M},c),z);return l(()=>{C&&null!==S.current&&q(S.current)},[C,q]),/*#__PURE__*/e.createElement(at,{className:d,isDisabled:y},/*#__PURE__*/e.createElement(it,v({label:f,requiredText:h,required:w,subLabel:g},G,p?{}:P)),/*#__PURE__*/e.createElement(ut,{invalid:E,rows:u?O+1:O},/*#__PURE__*/e.createElement(pt,v({ref:_e(S,n,z),rows:O,noBottomPadding:u},H)),u&&/*#__PURE__*/e.createElement(ht,null,void 0!==k?`${L}/${k}`:L)),null!=$&&0!==$.length&&/*#__PURE__*/e.createElement(gt,v({invalid:E},E?F:j),$))}),at=s.div(De||(De=Ue`
239
239
  display: flex;
240
240
  flex-direction: column;
241
241
 
242
242
  ${0}
243
- `),e=>e.isDisabled&&{opacity:e.theme.elementEffect.disabled.opacity}),ot=s(ze)(Me||(Me=Ue`
243
+ `),e=>e.isDisabled&&{opacity:e.theme.elementEffect.disabled.opacity}),it=s(ze)(Me||(Me=Ue`
244
244
  ${0}
245
- `),Ze(e=>e.margin.bottom(8))),it=s.div(He||(He=Ue`
245
+ `),Ze(e=>e.margin.bottom(8))),ot=s.div(He||(He=Ue`
246
246
  height: 40px;
247
247
  display: grid;
248
248
  position: relative;
249
- `)),lt=s.span(je||(je=Ue`
249
+ `)),lt=s.span(Ge||(Ge=Ue`
250
250
  position: absolute;
251
251
  top: 50%;
252
252
  left: 8px;
253
253
  transform: translateY(-50%);
254
- `)),st=s.span(Fe||(Fe=Ue`
254
+ `)),st=s.span(je||(je=Ue`
255
255
  position: absolute;
256
256
  top: 50%;
257
257
  right: 8px;
@@ -259,7 +259,7 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
259
259
 
260
260
  display: flex;
261
261
  gap: 8px;
262
- `)),ct=s.span(Ge||(Ge=Ue`
262
+ `)),ct=s.span(Fe||(Fe=Ue`
263
263
  user-select: none;
264
264
 
265
265
  ${0}
@@ -276,8 +276,6 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
276
276
  height: calc(100% / 0.875);
277
277
  font-size: calc(14px / 0.875);
278
278
  line-height: calc(22px / 0.875);
279
- padding-top: calc(9px / 0.875);
280
- padding-bottom: calc(9px / 0.875);
281
279
  padding-left: calc((8px + ${0}px) / 0.875);
282
280
  padding-right: calc((8px + ${0}px) / 0.875);
283
281
  border-radius: calc(4px / 0.875);
@@ -290,19 +288,26 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
290
288
  &::placeholder {
291
289
  ${0}
292
290
  }
293
- `),e=>e.extraLeftPadding,e=>e.extraRightPadding,e=>Ze(t=>[t.bg.surface3.hover,t.outline.default.focus,e.invalid&&t.outline.assertive,t.font.text2]),Ze(e=>e.font.text3)),ut=s.div(Xe||(Xe=Ue`
294
- display: grid;
291
+ `),e=>e.extraLeftPadding,e=>e.extraRightPadding,e=>Ze(t=>[t.bg.surface3.hover,t.outline.default.focus,e.invalid&&t.outline.assertive,t.font.text2]),Ze(e=>e.font.text3)),ut=s.div(Be||(Be=Ue`
295
292
  position: relative;
293
+ overflow: hidden;
294
+ padding: 0 8px;
295
+
296
+ ${0}
297
+
298
+ &:focus-within {
299
+ ${0}
300
+ }
296
301
 
297
302
  ${0};
298
- `),({rows:e})=>c(Ae||(Ae=Ue`
299
- max-height: calc(22px * ${0} + 18px);
300
- `),e)),pt=s.textarea(Be||(Be=Ue`
303
+ `),e=>Ze(t=>[t.bg.surface3.hover,e.invalid&&t.outline.assertive,t.font.text2,t.borderRadius(4)]),e=>Ze(t=>e.invalid?t.outline.assertive:t.outline.default),({rows:e})=>c(Xe||(Xe=Ue`
304
+ height: calc(22px * ${0} + 18px);
305
+ `),e)),pt=s.textarea(Ae||(Ae=Ue`
301
306
  border: none;
302
- box-sizing: border-box;
303
307
  outline: none;
304
308
  resize: none;
305
309
  font-family: inherit;
310
+ color: inherit;
306
311
 
307
312
  /* Prevent zooming for iOS Safari */
308
313
  transform-origin: top left;
@@ -310,15 +315,14 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
310
315
  width: calc(100% / 0.875);
311
316
  font-size: calc(14px / 0.875);
312
317
  line-height: calc(22px / 0.875);
313
- padding: calc(9px / 0.875) calc(8px / 0.875);
314
- border-radius: calc(4px / 0.875);
318
+ padding: calc(9px / 0.875) 0 ${0};
315
319
 
316
320
  ${0};
317
321
 
318
322
  /* Display box-shadow for iOS Safari */
319
323
  appearance: none;
320
324
 
321
- ${0}
325
+ background: none;
322
326
 
323
327
  &::placeholder {
324
328
  ${0}
@@ -331,9 +335,9 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
331
335
  /* Hide scrollbar for IE, Edge and Firefox */
332
336
  -ms-overflow-style: none; /* IE and Edge */
333
337
  scrollbar-width: none; /* Firefox */
334
- `),({rows:e})=>c(Ye||(Ye=Ue`
335
- height: calc(22px / 0.875 * ${0} + 18px / 0.875);
336
- `),e),e=>Ze(t=>[t.bg.surface3.hover,t.outline.default.focus,e.invalid&&t.outline.assertive,t.font.text2]),Ze(e=>e.font.text3)),ft=s.span(Je||(Je=Ue`
338
+ `),e=>e.noBottomPadding?0:"",({rows:e=1})=>c(Ye||(Ye=Ue`
339
+ height: calc(22px / 0.875 * ${0});
340
+ `),e),Ze(e=>e.font.text3)),ft=s.span(Je||(Je=Ue`
337
341
  ${0}
338
342
  `),Ze(e=>[e.typography(14).preserveHalfLeading,e.font.text3])),ht=s.span(Ke||(Ke=Ue`
339
343
  position: absolute;
@@ -343,5 +347,5 @@ import e,{useContext as t,useCallback as r,createContext as n,useMemo as a,useRe
343
347
  ${0}
344
348
  `),Ze(e=>[e.typography(14).preserveHalfLeading,e.font.text3])),gt=s.p(Qe||(Qe=Ue`
345
349
  ${0}
346
- `),e=>Ze(t=>[t.typography(14),t.margin.top(8),t.margin.bottom(0),t.font[e.invalid?"assertive":"text1"]]));export{H as Button,N as Clickable,$ as ComponentAbstraction,I as IconButton,Q as Radio,ee as RadioGroup,se as Select,fe as SelectGroup,xe as Switch,tt as TextField,k as useComponentAbstraction};
350
+ `),e=>Ze(t=>[t.typography(14),t.margin.top(8),t.margin.bottom(0),t.font[e.invalid?"assertive":"text1"]])),bt=["name","scale","unsafeNonGuidelineScale","className"],mt=e.forwardRef(function(t,r){let{name:n,scale:a,unsafeNonGuidelineScale:i,className:o}=t,l=x(t,bt);/*#__PURE__*/return e.createElement("pixiv-icon",v({ref:r,name:n,scale:a,"unsafe-non-guideline-scale":i,class:o},l))});export{H as Button,N as Clickable,$ as ComponentAbstraction,mt as Icon,I as IconButton,Q as Radio,ee as RadioGroup,se as Select,fe as SelectGroup,xe as Switch,tt as TextField,k as useComponentAbstraction};
347
351
  //# sourceMappingURL=index.modern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/core/ComponentAbstraction.tsx","../src/styled.ts","../src/components/Clickable/index.tsx","../src/components/Button/index.tsx","../src/_lib/index.ts","../src/components/IconButton/index.tsx","../src/components/Radio/index.tsx","../src/components/Select/context.ts","../src/components/Select/index.tsx","../src/components/Switch/index.tsx","../src/components/FieldLabel/index.tsx","../src/components/TextField/index.tsx"],"sourcesContent":["import React, { useContext } from 'react'\n\nexport type LinkProps = {\n /**\n * リンクのURL\n */\n to: string\n} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>\n\nexport const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function DefaultLink({ to, children, ...rest }, ref) {\n return (\n <a href={to} ref={ref} {...rest}>\n {children}\n </a>\n )\n }\n)\n\ninterface Components {\n Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>\n}\n\nconst DefaultValue: Components = {\n Link: DefaultLink,\n}\n\nconst ComponentAbstractionContext = React.createContext(DefaultValue)\n\ninterface Props {\n children: React.ReactNode\n components: Partial<Components>\n}\n\nexport default function ComponentAbstraction({ children, components }: Props) {\n return (\n <ComponentAbstractionContext.Provider\n value={{ ...DefaultValue, ...components }}\n >\n {children}\n </ComponentAbstractionContext.Provider>\n )\n}\n\nexport function useComponentAbstraction() {\n return useContext(ComponentAbstractionContext)\n}\n","import styled from 'styled-components'\nimport createTheme from '@charcoal-ui/styled'\nexport const theme = createTheme(styled)\n","import React from 'react'\nimport styled, { css } from 'styled-components'\nimport {\n LinkProps,\n useComponentAbstraction,\n} from '../../core/ComponentAbstraction'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\ninterface BaseProps {\n /**\n * クリックの無効化\n */\n disabled?: boolean\n}\n\ninterface LinkBaseProps {\n /**\n * リンクのURL。指定するとbuttonタグではなくaタグとして描画される\n */\n to: string\n}\n\nexport type ClickableProps =\n | (BaseProps & Omit<React.ComponentPropsWithoutRef<'button'>, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit<LinkProps, 'to'>)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef<ClickableElement, ClickableProps>(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n if ('to' in props) {\n const { onClick, disabled = false, ...rest } = props\n return (\n <A<typeof Link>\n {...rest}\n as={disabled ? undefined : Link}\n onClick={disabled ? undefined : onClick}\n aria-disabled={disabled}\n ref={ref}\n />\n )\n } else {\n return <Button {...props} ref={ref} />\n }\n }\n)\nexport default Clickable\n\nconst clickableCss = css`\n /* Clickable style */\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst Button = styled.button`\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ${clickableCss}\n`\n\nconst A = styled.span`\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ${clickableCss}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { unreachable } from '../../_lib'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\ntype Size = 'S' | 'M'\n\ninterface StyledProps {\n /**\n * ボタンのスタイル\n */\n variant: Variant\n /**\n * ボタンのサイズ\n */\n size: Size\n /**\n * 幅を最大まで広げて描画\n */\n fixed: boolean\n}\n\nexport type ButtonProps = Partial<StyledProps> & ClickableProps\n\nconst Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(\n {\n children,\n variant = 'Default',\n size = 'M',\n fixed = false,\n disabled = false,\n ...rest\n },\n ref\n) {\n return (\n <StyledButton\n {...rest}\n disabled={disabled}\n variant={variant}\n size={size}\n fixed={fixed}\n ref={ref}\n >\n {children}\n </StyledButton>\n )\n})\nexport default Button\n\nconst StyledButton = styled(Clickable)\n .withConfig<StyledProps>({\n shouldForwardProp(prop) {\n // fixed は <button> 要素に渡ってはいけない\n return prop !== 'fixed'\n },\n })\n .attrs<StyledProps, ReturnType<typeof styledProps>>(styledProps)`\n width: ${(p) => (p.fixed ? 'stretch' : 'min-content')};\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ${(p) =>\n theme((o) => [\n o.font[p.font].hover.press,\n o.bg[p.background].hover.press,\n o.typography(14).bold.preserveHalfLeading,\n o.padding.horizontal(p.padding),\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ${(p) => p.height}px;\n`\n\nfunction styledProps(props: StyledProps) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n case 'Default':\n return { font: 'text2', background: 'surface3' } as const\n case 'Primary':\n return { font: 'text5', background: 'brand' } as const\n case 'Navigation':\n return { font: 'text5', background: 'surface6' } as const\n case 'Danger':\n return { font: 'text5', background: 'assertive' } as const\n default:\n return unreachable(variant)\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'S':\n return {\n height: 32,\n padding: 16,\n } as const\n case 'M':\n return {\n height: 40,\n padding: 24,\n } as const\n }\n}\n","/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\n\ntype Variant = 'Default' | 'Overlay'\ntype Size = 'XS' | 'S' | 'M'\n\ninterface StyledProps {\n readonly variant?: Variant\n readonly size?: Size\n readonly icon: keyof KnownIconType\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = React.forwardRef<ClickableElement, IconButtonProps>(\n function IconButtonInner(\n { variant = 'Default', size = 'M', icon, ...rest }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n <StyledIconButton {...rest} ref={ref} variant={variant} size={size}>\n <pixiv-icon name={icon} />\n </StyledIconButton>\n )\n }\n)\n\nexport default IconButton\n\nconst StyledIconButton = styled(Clickable).attrs<\n Required<StyledProps>,\n ReturnType<typeof styledProps>\n>(styledProps)`\n user-select: none;\n\n width: ${(p) => p.width}px;\n height: ${(p) => p.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ font, background }) =>\n theme((o) => [\n o.font[font],\n o.bg[background].hover.press,\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n`\n\nfunction styledProps(props: Required<StyledProps>) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Default':\n return { font: 'text3', background: 'transparent' } as const\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'XS':\n return {\n width: 20,\n height: 20,\n }\n case 'S':\n return {\n width: 32,\n height: 32,\n }\n case 'M':\n return {\n width: 40,\n height: 40,\n }\n }\n}\n\n/**\n * validates matches of size and icon\n */\nfunction validateIconSize(size: Size, icon: keyof KnownIconType) {\n let requiredIconSize: string\n switch (size) {\n case 'XS':\n requiredIconSize = '16'\n break\n case 'S':\n case 'M':\n requiredIconSize = '24'\n break\n }\n // アイコン名は サイズ/名前\n const result = /^\\d*/u.exec(icon)\n if (result == null) {\n throw new Error('Invalid icon name')\n }\n const [iconSize] = result\n if (iconSize !== requiredIconSize) {\n // eslint-disable-next-line no-console\n console.warn(\n `IconButton with size \"${size}\" expect icon size \"${requiredIconSize}, but got \"${iconSize}\"`\n )\n }\n}\n","import React, { useCallback, useContext } from 'react'\nimport styled from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { px } from '@charcoal-ui/utils'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n}>\n\nexport default function Radio({\n value,\n forceChecked = false,\n disabled = false,\n children,\n}: RadioProps) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n hasError,\n onChange,\n } = useContext(RadioGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.value)\n },\n [onChange]\n )\n\n return (\n <RadioRoot aria-disabled={isDisabled || isReadonly}>\n <RadioInput\n name={name}\n value={value}\n checked={forceChecked || isSelected}\n hasError={hasError}\n onChange={handleChange}\n disabled={isDisabled || isReadonly}\n />\n {children != null && <RadioLabel>{children}</RadioLabel>}\n </RadioRoot>\n )\n}\n\nconst RadioRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[4])};\n align-items: center;\n cursor: pointer;\n\n ${theme((o) => [o.disabled])}\n`\n\nexport const RadioInput = styled.input.attrs({ type: 'radio' })<{\n hasError?: boolean\n}>`\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ${({ hasError = false }) =>\n theme((o) => [\n o.borderRadius('oval'),\n o.bg.text5.hover.press,\n hasError && o.outline.assertive,\n ])};\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text4};\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n }\n\n ${theme((o) => o.outline.default.focus)}\n }\n`\n\nconst RadioLabel = styled.div`\n ${theme((o) => [o.typography(14)])}\n`\n\nexport type RadioGroupProps = React.PropsWithChildren<{\n className?: string\n value?: string\n label: string\n name: string\n onChange(next: string): void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\n// TODO: use (or polyfill) flex gap\nconst StyledRadioGroup = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[8])};\n`\n\ninterface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: (next: string) => void\n}\n\nconst RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?'\n )\n },\n})\n\nexport function RadioGroup({\n className,\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n hasError,\n children,\n}: RadioGroupProps) {\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange]\n )\n\n return (\n <RadioGroupContext.Provider\n value={{\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n hasError: hasError ?? false,\n onChange: handleChange,\n }}\n >\n <StyledRadioGroup\n role=\"radiogroup\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-invalid={hasError}\n className={className}\n >\n {children}\n </StyledRadioGroup>\n </RadioGroupContext.Provider>\n )\n}\n","import { createContext } from 'react'\n\ntype SelectGroupContext = {\n name: string\n selected: string[]\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: ({ value, selected }: { value: string; selected: boolean }) => void\n}\n\nexport const SelectGroupContext = createContext<SelectGroupContext>({\n name: undefined as never,\n selected: [],\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<SelectGroup />` ?'\n )\n },\n})\n","import React, { ChangeEvent, useCallback, useContext } from 'react'\nimport styled, { css } from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nimport { SelectGroupContext } from './context'\n\nexport type SelectProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n variant?: 'default' | 'overlay'\n onChange?: (payload: { value: string; selected: boolean }) => void\n}>\n\nexport default function Select({\n value,\n forceChecked = false,\n disabled = false,\n onChange,\n variant = 'default',\n children,\n}: SelectProps) {\n const {\n name,\n selected,\n disabled: parentDisabled,\n readonly,\n hasError,\n onChange: parentOnChange,\n } = useContext(SelectGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Select>. Perhaps you forgot to wrap with <SelectGroup> ?`\n )\n\n const isSelected = selected.includes(value) || forceChecked\n const isDisabled = disabled || parentDisabled || readonly\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!(event.currentTarget instanceof HTMLInputElement)) {\n return\n }\n if (onChange) onChange({ value, selected: event.currentTarget.checked })\n parentOnChange({ value, selected: event.currentTarget.checked })\n },\n [onChange, parentOnChange, value]\n )\n\n return (\n <SelectRoot aria-disabled={isDisabled}>\n <SelectInput\n {...{\n name,\n value,\n hasError,\n }}\n checked={isSelected}\n disabled={isDisabled}\n onChange={handleChange}\n overlay={variant === 'overlay'}\n aria-invalid={hasError}\n />\n <SelectInputOverlay\n overlay={variant === 'overlay'}\n hasError={hasError}\n aria-hidden={true}\n >\n <pixiv-icon name=\"24/Check\" unsafe-non-guideline-scale={16 / 24} />\n </SelectInputOverlay>\n {Boolean(children) && <SelectLabel>{children}</SelectLabel>}\n </SelectRoot>\n )\n}\n\nconst SelectRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n ${disabledSelector} {\n cursor: default;\n }\n gap: ${({ theme }) => px(theme.spacing[4])};\n ${theme((o) => o.disabled)}\n`\n\nconst SelectLabel = styled.div`\n display: flex;\n align-items: center;\n ${theme((o) => [o.typography(14), o.font.text1])}\n`\n\nconst SelectInput = styled.input.attrs({ type: 'checkbox' })<{\n hasError: boolean\n overlay: boolean\n}>`\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n }\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.bg.text3.hover.press,\n o.borderRadius('oval'),\n hasError && !overlay && o.outline.assertive,\n overlay && o.bg.surface4,\n ])};\n }\n`\n\nconst SelectInputOverlay = styled.div<{ overlay: boolean; hasError: boolean }>`\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.width.px(24),\n o.height.px(24),\n o.borderRadius('oval'),\n o.font.text5,\n hasError && overlay && o.outline.assertive,\n ])}\n\n ${({ overlay }) =>\n overlay &&\n css`\n border-color: ${({ theme }) => theme.color.text5};\n border-width: 2px;\n border-style: solid;\n `}\n`\n\nexport type SelectGroupProps = React.PropsWithChildren<{\n className?: string\n name: string\n ariaLabel: string\n selected: string[]\n onChange: (selected: string[]) => void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\nexport function SelectGroup({\n className,\n name,\n ariaLabel,\n selected,\n onChange,\n disabled = false,\n readonly = false,\n hasError = false,\n children,\n}: SelectGroupProps) {\n const handleChange = useCallback(\n (payload: { value: string; selected: boolean }) => {\n const index = selected.indexOf(payload.value)\n\n if (payload.selected) {\n if (index < 0) {\n onChange([...selected, payload.value])\n }\n } else {\n if (index >= 0) {\n onChange([...selected.slice(0, index), ...selected.slice(index + 1)])\n }\n }\n },\n [onChange, selected]\n )\n\n return (\n <SelectGroupContext.Provider\n value={{\n name,\n selected: Array.from(new Set(selected)),\n disabled,\n readonly,\n hasError,\n onChange: handleChange,\n }}\n >\n <div\n className={className}\n aria-label={ariaLabel}\n data-testid=\"SelectGroup\"\n >\n {children}\n </div>\n </SelectGroupContext.Provider>\n )\n}\n","import { useSwitch } from '@react-aria/switch'\nimport type { AriaSwitchProps } from '@react-types/switch'\nimport React, { useRef, useMemo } from 'react'\nimport { useToggleState } from 'react-stately'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nexport type SwitchProps = {\n name: string\n className?: string\n value?: string\n checked?: boolean\n disabled?: boolean\n onChange(checked: boolean): void\n} & (\n | // children か label は片方が必須\n {\n children: React.ReactNode\n }\n | {\n label: string\n }\n)\n\nexport default function SwitchCheckbox(props: SwitchProps) {\n const { disabled, className } = props\n\n const ariaSwitchProps: AriaSwitchProps = useMemo(\n () => ({\n ...props,\n\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n isSelected: props.checked,\n }),\n [props]\n )\n\n const state = useToggleState(ariaSwitchProps)\n const ref = useRef<HTMLInputElement>(null)\n const {\n inputProps: { className: _className, type: _type, ...rest },\n } = useSwitch(ariaSwitchProps, state, ref)\n\n return (\n <Label className={className} aria-disabled={disabled}>\n <SwitchInput {...rest} ref={ref} />\n {'children' in props ? (\n // eslint-disable-next-line react/destructuring-assignment\n <LabelInner>{props.children}</LabelInner>\n ) : undefined}\n </Label>\n )\n}\n\nconst Label = styled.label`\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ${({ theme }) => px(theme.spacing[4])};\n cursor: pointer;\n outline: 0;\n\n ${theme((o) => o.disabled)}\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst LabelInner = styled.div`\n ${theme((o) => o.typography(14))}\n`\n\nconst SwitchInput = styled.input.attrs({\n type: 'checkbox',\n})`\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ${theme((o) => [\n o.borderRadius(16),\n o.height.px(16),\n o.bg.text4.hover.press,\n o.outline.default.focus,\n ])}\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport createTheme from '@charcoal-ui/styled'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes<HTMLLabelElement> {\n readonly className?: string\n readonly label: string\n readonly subLabel?: React.ReactNode\n readonly required?: boolean\n // TODO: 翻訳用のContextで注入する\n readonly requiredText?: string\n}\n\nconst FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel(\n {\n style,\n className,\n label,\n required = false,\n requiredText,\n subLabel,\n ...labelProps\n },\n ref\n ) {\n return (\n <FieldLabelWrapper style={style} className={className}>\n <Label ref={ref} {...labelProps}>\n {label}\n </Label>\n {required && <RequiredText>{requiredText}</RequiredText>}\n <SubLabelClickable>\n <span>{subLabel}</span>\n </SubLabelClickable>\n </FieldLabelWrapper>\n )\n }\n)\n\nexport default FieldLabel\n\nconst theme = createTheme(styled)\n\nconst Label = styled.label`\n ${theme((o) => [o.typography(14).bold, o.font.text1])}\n`\n\nconst RequiredText = styled.span`\n ${theme((o) => [o.typography(14), o.font.text3])}\n`\n\nconst SubLabelClickable = styled.div`\n ${theme((o) => [\n o.typography(14),\n o.font.text3.hover.press,\n o.outline.default.focus,\n ])}\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n ${theme((o) => o.margin.left(4))}\n }\n\n > ${SubLabelClickable} {\n ${theme((o) => o.margin.left('auto'))}\n }\n`\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport createTheme from '@charcoal-ui/styled'\n\nconst theme = createTheme(styled)\n\ninterface TextFieldBaseProps\n extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'> {\n readonly className?: string\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly placeholder?: string\n readonly assistiveText?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly maxLength?: number\n /**\n * tab-indexがー1かどうか\n */\n readonly excludeFromTabOrder?: boolean\n}\n\nexport interface SingleLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: never\n readonly multiline?: false\n readonly rows?: never\n readonly type?: string\n readonly prefix?: string\n readonly suffix?: string\n}\n\nexport interface MultiLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: boolean\n readonly multiline: true\n readonly rows?: number\n readonly type?: never\n readonly prefix?: never\n readonly suffix?: never\n}\n\nexport type TextFieldProps = SingleLineTextFieldProps | MultiLineTextFieldProps\ntype TextFieldElement = HTMLInputElement & HTMLTextAreaElement\n\nfunction mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nfunction countCodePointsInString(string: string) {\n // [...string] とするとproduction buildで動かなくなる\n // cf. https://twitter.com/f_subal/status/1497214727511891972\n return Array.from(string).length\n}\n\nconst TextField = React.forwardRef<TextFieldElement, TextFieldProps>(\n function TextField(props, ref) {\n return props.multiline !== undefined && props.multiline ? (\n <MultiLineTextField ref={ref} {...props} />\n ) : (\n <SingleLineTextField ref={ref} {...props} />\n )\n }\n)\n\nexport default TextField\n\nconst SingleLineTextField = React.forwardRef<\n HTMLInputElement,\n SingleLineTextFieldProps\n>(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showLabel = false,\n showCount = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n prefix = '',\n suffix = '',\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef<HTMLInputElement>(null)\n const prefixRef = useRef<HTMLSpanElement>(null)\n const suffixRef = useRef<HTMLSpanElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [prefixWidth, setPrefixWidth] = useState(0)\n const [suffixWidth, setSuffixWidth] = useState(0)\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n onChange?.(value)\n },\n [maxLength, nonControlled, onChange]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'input',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n const prefixObserver = new ResizeObserver((entries) => {\n setPrefixWidth(entries[0].contentRect.width)\n })\n const suffixObserver = new ResizeObserver((entries) => {\n setSuffixWidth(entries[0].contentRect.width)\n })\n\n if (prefixRef.current !== null) {\n prefixObserver.observe(prefixRef.current)\n }\n if (suffixRef.current !== null) {\n suffixObserver.observe(suffixRef.current)\n }\n\n return () => {\n suffixObserver.disconnect()\n prefixObserver.disconnect()\n }\n }, [])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledInputContainer>\n <PrefixContainer ref={prefixRef}>\n <Affix>{prefix}</Affix>\n </PrefixContainer>\n <StyledInput\n ref={mergeRefs(forwardRef, ariaRef)}\n invalid={invalid}\n extraLeftPadding={prefixWidth}\n extraRightPadding={suffixWidth}\n {...inputProps}\n />\n <SuffixContainer ref={suffixRef}>\n <Affix>{suffix}</Affix>\n {showCount && maxLength && (\n <SingleLineCounter>\n {count}/{maxLength}\n </SingleLineCounter>\n )}\n </SuffixContainer>\n </StyledInputContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst MultiLineTextField = React.forwardRef<\n HTMLTextAreaElement,\n MultiLineTextFieldProps\n>(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showCount = false,\n showLabel = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const ariaRef = useRef<HTMLTextAreaElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [rows, setRows] = useState(initialRows)\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const rows = `${textarea.value}\\n`.match(/\\n/gu)?.length ?? 1\n if (initialRows <= rows) {\n setRows(rows)\n }\n },\n [initialRows]\n )\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n onChange?.(value)\n },\n [autoHeight, maxLength, nonControlled, onChange, syncHeight]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'textarea',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [autoHeight, syncHeight])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(showLabel ? visuallyHiddenProps : {})}\n />\n <StyledTextareaContainer rows={rows}>\n <StyledTextarea\n ref={mergeRefs(textareaRef, forwardRef, ariaRef)}\n invalid={invalid}\n rows={rows}\n {...inputProps}\n />\n {showCount && <MultiLineCounter>{count}</MultiLineCounter>}\n </StyledTextareaContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst TextFieldRoot = styled.div<{ isDisabled: boolean }>`\n display: flex;\n flex-direction: column;\n\n ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}\n`\n\nconst TextFieldLabel = styled(FieldLabel)`\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst StyledInputContainer = styled.div`\n height: 40px;\n display: grid;\n position: relative;\n`\n\nconst PrefixContainer = styled.span`\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n`\n\nconst SuffixContainer = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n`\n\nconst Affix = styled.span`\n user-select: none;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\n extraLeftPadding: number\n extraRightPadding: number\n}>`\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-top: calc(9px / 0.875);\n padding-bottom: calc(9px / 0.875);\n padding-left: calc((8px + ${(p) => p.extraLeftPadding}px) / 0.875);\n padding-right: calc((8px + ${(p) => p.extraRightPadding}px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n`\n\nconst StyledTextareaContainer = styled.div<{ rows: number }>`\n display: grid;\n position: relative;\n\n ${({ rows }) => css`\n max-height: calc(22px * ${rows} + 18px);\n `};\n`\n\nconst StyledTextarea = styled.textarea<{ invalid: boolean }>`\n border: none;\n box-sizing: border-box;\n outline: none;\n resize: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) calc(8px / 0.875);\n border-radius: calc(4px / 0.875);\n\n ${({ rows }) => css`\n height: calc(22px / 0.875 * ${rows} + 18px / 0.875);\n `};\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n`\n\nconst SingleLineCounter = styled.span`\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst MultiLineCounter = styled.span`\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst AssistiveText = styled.p<{ invalid: boolean }>`\n ${(p) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n o.margin.bottom(0),\n o.font[p.invalid ? 'assertive' : 'text1'],\n ])}\n`\n"],"names":["DefaultValue","Link","React","forwardRef","ref","to","children","rest","href","ComponentAbstractionContext","createContext","ComponentAbstraction","components","Provider","value","useComponentAbstraction","useContext","theme","createTheme","styled","Clickable","props","onClick","disabled","A","as","undefined","Button","clickableCss","css","disabledSelector","button","span","variant","size","fixed","StyledButton","withConfig","shouldForwardProp","prop","attrs","font","background","Error","arguments","length","JSON","stringify","unreachable","variantToProps","height","padding","sizeToProps","p","o","hover","press","bg","typography","bold","preserveHalfLeading","horizontal","borderRadius","outline","default","focus","IconButton","icon","requiredIconSize","result","exec","iconSize","console","warn","validateIconSize","StyledIconButton","name","width","Radio","forceChecked","selected","isParentDisabled","readonly","hasError","onChange","RadioGroupContext","warning","isSelected","isDisabled","isReadonly","handleChange","useCallback","e","currentTarget","RadioRoot","RadioInput","checked","RadioLabel","label","px","spacing","input","type","text5","assertive","color","text4","brand","div","StyledRadioGroup","RadioGroup","className","next","role","SelectGroupContext","Select","parentDisabled","parentOnChange","includes","event","HTMLInputElement","SelectRoot","SelectInput","overlay","SelectInputOverlay","Boolean","SelectLabel","text1","text3","surface4","SelectGroup","ariaLabel","payload","index","indexOf","slice","Array","from","Set","SwitchCheckbox","ariaSwitchProps","useMemo","state","useToggleState","useRef","useSwitch","inputProps","Label","SwitchInput","LabelInner","FieldLabel","style","required","requiredText","subLabel","labelProps","FieldLabelWrapper","RequiredText","SubLabelClickable","margin","left","mergeRefs","refs","current","countCodePointsInString","string","TextField","multiline","MultiLineTextField","SingleLineTextField","showLabel","showCount","invalid","assistiveText","maxLength","prefix","suffix","visuallyHiddenProps","useVisuallyHidden","ariaRef","prefixRef","suffixRef","count","setCount","useState","prefixWidth","setPrefixWidth","suffixWidth","setSuffixWidth","nonControlled","useEffect","descriptionProps","errorMessageProps","useTextField","inputElementType","isRequired","validationState","description","errorMessage","prefixObserver","ResizeObserver","entries","contentRect","suffixObserver","observe","disconnect","TextFieldRoot","TextFieldLabel","StyledInputContainer","PrefixContainer","Affix","StyledInput","extraLeftPadding","extraRightPadding","SuffixContainer","SingleLineCounter","AssistiveText","autoHeight","rows","initialRows","textareaRef","setRows","syncHeight","textarea","match","_$match","StyledTextareaContainer","StyledTextarea","MultiLineCounter","opacity","elementEffect","bottom","text2","surface3","top"],"mappings":"o2BAuBMA,EAA2B,CAC/BC,KAfyBC,EAAMC,WAC/B,WAAgDC,OAA3BC,GAAEA,EAAFC,SAAMA,KAAaC,sBACtC,OACEL,uBAAGM,KAAMH,EAAID,IAAKA,GAASG,GACxBD,MAcHG,EAA8BP,EAAMQ,cAAcV,YAOhCW,GAAqBL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GAKlBf,GAAOqC,GAAM,CAACA,EAAEI,WAAW,IAAIE,oBAAqBN,EAAEb,KAAKuF,SAGzDwF,GAAgBrM,EAAOkC;IAAV;GACdA,GACDpC,GAAOqC,GAAM,CACXA,EAAEI,WAAW,IACbJ,EAAEyG,OAAO2E,IAAI,GACbpL,EAAEyG,OAAOwE,OAAO,GAChBjL,EAAEb,KAAKY,EAAEuH,QAAU,YAAc"}
1
+ {"version":3,"file":"index.modern.js","sources":["../src/core/ComponentAbstraction.tsx","../src/styled.ts","../src/components/Clickable/index.tsx","../src/components/Button/index.tsx","../src/_lib/index.ts","../src/components/IconButton/index.tsx","../src/components/Radio/index.tsx","../src/components/Select/context.ts","../src/components/Select/index.tsx","../src/components/Switch/index.tsx","../src/components/FieldLabel/index.tsx","../src/components/TextField/index.tsx","../src/components/Icon/index.tsx"],"sourcesContent":["import React, { useContext } from 'react'\n\nexport type LinkProps = {\n /**\n * リンクのURL\n */\n to: string\n} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>\n\nexport const DefaultLink = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function DefaultLink({ to, children, ...rest }, ref) {\n return (\n <a href={to} ref={ref} {...rest}>\n {children}\n </a>\n )\n }\n)\n\ninterface Components {\n Link: React.ComponentType<React.ComponentPropsWithRef<typeof DefaultLink>>\n}\n\nconst DefaultValue: Components = {\n Link: DefaultLink,\n}\n\nconst ComponentAbstractionContext = React.createContext(DefaultValue)\n\ninterface Props {\n children: React.ReactNode\n components: Partial<Components>\n}\n\nexport default function ComponentAbstraction({ children, components }: Props) {\n return (\n <ComponentAbstractionContext.Provider\n value={{ ...DefaultValue, ...components }}\n >\n {children}\n </ComponentAbstractionContext.Provider>\n )\n}\n\nexport function useComponentAbstraction() {\n return useContext(ComponentAbstractionContext)\n}\n","import styled from 'styled-components'\nimport { createTheme } from '@charcoal-ui/styled'\nexport const theme = createTheme(styled)\n","import React from 'react'\nimport styled, { css } from 'styled-components'\nimport {\n LinkProps,\n useComponentAbstraction,\n} from '../../core/ComponentAbstraction'\nimport { disabledSelector } from '@charcoal-ui/utils'\n\ninterface BaseProps {\n /**\n * クリックの無効化\n */\n disabled?: boolean\n}\n\ninterface LinkBaseProps {\n /**\n * リンクのURL。指定するとbuttonタグではなくaタグとして描画される\n */\n to: string\n}\n\nexport type ClickableProps =\n | (BaseProps & Omit<React.ComponentPropsWithoutRef<'button'>, 'disabled'>)\n | (BaseProps & LinkBaseProps & Omit<LinkProps, 'to'>)\nexport type ClickableElement = HTMLButtonElement & HTMLAnchorElement\n\nconst Clickable = React.forwardRef<ClickableElement, ClickableProps>(\n function Clickable(props, ref) {\n const { Link } = useComponentAbstraction()\n if ('to' in props) {\n const { onClick, disabled = false, ...rest } = props\n return (\n <A<typeof Link>\n {...rest}\n as={disabled ? undefined : Link}\n onClick={disabled ? undefined : onClick}\n aria-disabled={disabled}\n ref={ref}\n />\n )\n } else {\n return <Button {...props} ref={ref} />\n }\n }\n)\nexport default Clickable\n\nconst clickableCss = css`\n /* Clickable style */\n cursor: pointer;\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst Button = styled.button`\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ${clickableCss}\n`\n\nconst A = styled.span`\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ${clickableCss}\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { unreachable } from '../../_lib'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\n\ntype Variant = 'Primary' | 'Default' | 'Overlay' | 'Danger' | 'Navigation'\ntype Size = 'S' | 'M'\n\ninterface StyledProps {\n /**\n * ボタンのスタイル\n */\n variant: Variant\n /**\n * ボタンのサイズ\n */\n size: Size\n /**\n * 幅を最大まで広げて描画\n */\n fixed: boolean\n}\n\nexport type ButtonProps = Partial<StyledProps> & ClickableProps\n\nconst Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(\n {\n children,\n variant = 'Default',\n size = 'M',\n fixed = false,\n disabled = false,\n ...rest\n },\n ref\n) {\n return (\n <StyledButton\n {...rest}\n disabled={disabled}\n variant={variant}\n size={size}\n fixed={fixed}\n ref={ref}\n >\n {children}\n </StyledButton>\n )\n})\nexport default Button\n\nconst StyledButton = styled(Clickable)\n .withConfig<StyledProps>({\n shouldForwardProp(prop) {\n // fixed は <button> 要素に渡ってはいけない\n return prop !== 'fixed'\n },\n })\n .attrs<StyledProps, ReturnType<typeof styledProps>>(styledProps)`\n width: ${(p) => (p.fixed ? 'stretch' : 'min-content')};\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ${(p) =>\n theme((o) => [\n o.font[p.font].hover.press,\n o.bg[p.background].hover.press,\n o.typography(14).bold.preserveHalfLeading,\n o.padding.horizontal(p.padding),\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n\n /* よく考えたらheight=32って定義が存在しないな... */\n height: ${(p) => p.height}px;\n`\n\nfunction styledProps(props: StyledProps) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n case 'Default':\n return { font: 'text2', background: 'surface3' } as const\n case 'Primary':\n return { font: 'text5', background: 'brand' } as const\n case 'Navigation':\n return { font: 'text5', background: 'surface6' } as const\n case 'Danger':\n return { font: 'text5', background: 'assertive' } as const\n default:\n return unreachable(variant)\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'S':\n return {\n height: 32,\n padding: 16,\n } as const\n case 'M':\n return {\n height: 40,\n padding: 24,\n } as const\n }\n}\n","/**\n * 今後ポートされる予定の汎用的な関数群\n */\n\n/**\n * Function used to assert a given code path is unreachable\n */\nexport function unreachable(): never\n/**\n * Function used to assert a given code path is unreachable.\n * Very useful for ensuring switches are exhaustive:\n *\n * ```ts\n * switch (a.type) {\n * case Types.A:\n * case Types.B:\n * break\n * default:\n * unreachable(a) // will cause a build error if there was\n * // a Types.C that was not checked\n * }\n * ```\n *\n * @param value Value to be asserted as unreachable\n */\n// NOTE: Uses separate overloads, _not_ `value?: never`, to not allow `undefined` to be passed\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function unreachable(value: never): never\nexport function unreachable(value?: never): never {\n throw new Error(\n arguments.length === 0\n ? 'unreachable'\n : `unreachable (${JSON.stringify(value)})`\n )\n}\n","import React from 'react'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport Clickable, { ClickableElement, ClickableProps } from '../Clickable'\nimport type { KnownIconType } from '@charcoal-ui/icons'\n\ntype Variant = 'Default' | 'Overlay'\ntype Size = 'XS' | 'S' | 'M'\n\ninterface StyledProps {\n readonly variant?: Variant\n readonly size?: Size\n readonly icon: keyof KnownIconType\n}\n\nexport type IconButtonProps = StyledProps & ClickableProps\n\nconst IconButton = React.forwardRef<ClickableElement, IconButtonProps>(\n function IconButtonInner(\n { variant = 'Default', size = 'M', icon, ...rest }: IconButtonProps,\n ref\n ) {\n validateIconSize(size, icon)\n return (\n <StyledIconButton {...rest} ref={ref} variant={variant} size={size}>\n <pixiv-icon name={icon} />\n </StyledIconButton>\n )\n }\n)\n\nexport default IconButton\n\nconst StyledIconButton = styled(Clickable).attrs<\n Required<StyledProps>,\n ReturnType<typeof styledProps>\n>(styledProps)`\n user-select: none;\n\n width: ${(p) => p.width}px;\n height: ${(p) => p.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ font, background }) =>\n theme((o) => [\n o.font[font],\n o.bg[background].hover.press,\n o.disabled,\n o.borderRadius('oval'),\n o.outline.default.focus,\n ])}\n`\n\nfunction styledProps(props: Required<StyledProps>) {\n return {\n ...props,\n ...variantToProps(props.variant),\n ...sizeToProps(props.size),\n }\n}\n\nfunction variantToProps(variant: Variant) {\n switch (variant) {\n case 'Default':\n return { font: 'text3', background: 'transparent' } as const\n case 'Overlay':\n return { font: 'text5', background: 'surface4' } as const\n }\n}\n\nfunction sizeToProps(size: Size) {\n switch (size) {\n case 'XS':\n return {\n width: 20,\n height: 20,\n }\n case 'S':\n return {\n width: 32,\n height: 32,\n }\n case 'M':\n return {\n width: 40,\n height: 40,\n }\n }\n}\n\n/**\n * validates matches of size and icon\n */\nfunction validateIconSize(size: Size, icon: keyof KnownIconType) {\n let requiredIconSize: string\n switch (size) {\n case 'XS':\n requiredIconSize = '16'\n break\n case 'S':\n case 'M':\n requiredIconSize = '24'\n break\n }\n // アイコン名は サイズ/名前\n const result = /^\\d*/u.exec(icon)\n if (result == null) {\n throw new Error('Invalid icon name')\n }\n const [iconSize] = result\n if (iconSize !== requiredIconSize) {\n // eslint-disable-next-line no-console\n console.warn(\n `IconButton with size \"${size}\" expect icon size \"${requiredIconSize}, but got \"${iconSize}\"`\n )\n }\n}\n","import React, { useCallback, useContext } from 'react'\nimport styled from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { px } from '@charcoal-ui/utils'\n\nexport type RadioProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n}>\n\nexport default function Radio({\n value,\n forceChecked = false,\n disabled = false,\n children,\n}: RadioProps) {\n const {\n name,\n selected,\n disabled: isParentDisabled,\n readonly,\n hasError,\n onChange,\n } = useContext(RadioGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`\n )\n\n const isSelected = value === selected\n const isDisabled = disabled || isParentDisabled\n const isReadonly = readonly && !isSelected\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.value)\n },\n [onChange]\n )\n\n return (\n <RadioRoot aria-disabled={isDisabled || isReadonly}>\n <RadioInput\n name={name}\n value={value}\n checked={forceChecked || isSelected}\n hasError={hasError}\n onChange={handleChange}\n disabled={isDisabled || isReadonly}\n />\n {children != null && <RadioLabel>{children}</RadioLabel>}\n </RadioRoot>\n )\n}\n\nconst RadioRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[4])};\n align-items: center;\n cursor: pointer;\n\n ${theme((o) => [o.disabled])}\n`\n\nexport const RadioInput = styled.input.attrs({ type: 'radio' })<{\n hasError?: boolean\n}>`\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ${({ hasError = false }) =>\n theme((o) => [\n o.borderRadius('oval'),\n o.bg.text5.hover.press,\n hasError && o.outline.assertive,\n ])};\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ${({ theme }) => theme.color.text4};\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n }\n\n ${theme((o) => o.outline.default.focus)}\n }\n`\n\nconst RadioLabel = styled.div`\n ${theme((o) => [o.typography(14)])}\n`\n\nexport type RadioGroupProps = React.PropsWithChildren<{\n className?: string\n value?: string\n label: string\n name: string\n onChange(next: string): void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\n// TODO: use (or polyfill) flex gap\nconst StyledRadioGroup = styled.div`\n display: grid;\n grid-template-columns: 1fr;\n grid-gap: ${({ theme }) => px(theme.spacing[8])};\n`\n\ninterface RadioGroupContext {\n name: string\n selected?: string\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: (next: string) => void\n}\n\nconst RadioGroupContext = React.createContext<RadioGroupContext>({\n name: undefined as never,\n selected: undefined,\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?'\n )\n },\n})\n\nexport function RadioGroup({\n className,\n value,\n label,\n name,\n onChange,\n disabled,\n readonly,\n hasError,\n children,\n}: RadioGroupProps) {\n const handleChange = useCallback(\n (next: string) => {\n onChange(next)\n },\n [onChange]\n )\n\n return (\n <RadioGroupContext.Provider\n value={{\n name,\n selected: value,\n disabled: disabled ?? false,\n readonly: readonly ?? false,\n hasError: hasError ?? false,\n onChange: handleChange,\n }}\n >\n <StyledRadioGroup\n role=\"radiogroup\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-invalid={hasError}\n className={className}\n >\n {children}\n </StyledRadioGroup>\n </RadioGroupContext.Provider>\n )\n}\n","import { createContext } from 'react'\n\ntype SelectGroupContext = {\n name: string\n selected: string[]\n disabled: boolean\n readonly: boolean\n hasError: boolean\n onChange: ({ value, selected }: { value: string; selected: boolean }) => void\n}\n\nexport const SelectGroupContext = createContext<SelectGroupContext>({\n name: undefined as never,\n selected: [],\n disabled: false,\n readonly: false,\n hasError: false,\n onChange() {\n throw new Error(\n 'Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<SelectGroup />` ?'\n )\n },\n})\n","import React, { ChangeEvent, useCallback, useContext } from 'react'\nimport styled, { css } from 'styled-components'\nimport warning from 'warning'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nimport { SelectGroupContext } from './context'\n\nexport type SelectProps = React.PropsWithChildren<{\n value: string\n forceChecked?: boolean\n disabled?: boolean\n variant?: 'default' | 'overlay'\n onChange?: (payload: { value: string; selected: boolean }) => void\n}>\n\nexport default function Select({\n value,\n forceChecked = false,\n disabled = false,\n onChange,\n variant = 'default',\n children,\n}: SelectProps) {\n const {\n name,\n selected,\n disabled: parentDisabled,\n readonly,\n hasError,\n onChange: parentOnChange,\n } = useContext(SelectGroupContext)\n\n warning(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n name !== undefined,\n `\"name\" is not Provided for <Select>. Perhaps you forgot to wrap with <SelectGroup> ?`\n )\n\n const isSelected = selected.includes(value) || forceChecked\n const isDisabled = disabled || parentDisabled || readonly\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n if (!(event.currentTarget instanceof HTMLInputElement)) {\n return\n }\n if (onChange) onChange({ value, selected: event.currentTarget.checked })\n parentOnChange({ value, selected: event.currentTarget.checked })\n },\n [onChange, parentOnChange, value]\n )\n\n return (\n <SelectRoot aria-disabled={isDisabled}>\n <SelectInput\n {...{\n name,\n value,\n hasError,\n }}\n checked={isSelected}\n disabled={isDisabled}\n onChange={handleChange}\n overlay={variant === 'overlay'}\n aria-invalid={hasError}\n />\n <SelectInputOverlay\n overlay={variant === 'overlay'}\n hasError={hasError}\n aria-hidden={true}\n >\n <pixiv-icon name=\"24/Check\" unsafe-non-guideline-scale={16 / 24} />\n </SelectInputOverlay>\n {Boolean(children) && <SelectLabel>{children}</SelectLabel>}\n </SelectRoot>\n )\n}\n\nconst SelectRoot = styled.label`\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n ${disabledSelector} {\n cursor: default;\n }\n gap: ${({ theme }) => px(theme.spacing[4])};\n ${theme((o) => o.disabled)}\n`\n\nconst SelectLabel = styled.div`\n display: flex;\n align-items: center;\n ${theme((o) => [o.typography(14), o.font.text1])}\n`\n\nconst SelectInput = styled.input.attrs({ type: 'checkbox' })<{\n hasError: boolean\n overlay: boolean\n}>`\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n }\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.bg.text3.hover.press,\n o.borderRadius('oval'),\n hasError && !overlay && o.outline.assertive,\n overlay && o.bg.surface4,\n ])};\n }\n`\n\nconst SelectInputOverlay = styled.div<{ overlay: boolean; hasError: boolean }>`\n position: absolute;\n top: -2px;\n left: -2px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ${({ hasError, overlay }) =>\n theme((o) => [\n o.width.px(24),\n o.height.px(24),\n o.borderRadius('oval'),\n o.font.text5,\n hasError && overlay && o.outline.assertive,\n ])}\n\n ${({ overlay }) =>\n overlay &&\n css`\n border-color: ${({ theme }) => theme.color.text5};\n border-width: 2px;\n border-style: solid;\n `}\n`\n\nexport type SelectGroupProps = React.PropsWithChildren<{\n className?: string\n name: string\n ariaLabel: string\n selected: string[]\n onChange: (selected: string[]) => void\n disabled?: boolean\n readonly?: boolean\n hasError?: boolean\n}>\n\nexport function SelectGroup({\n className,\n name,\n ariaLabel,\n selected,\n onChange,\n disabled = false,\n readonly = false,\n hasError = false,\n children,\n}: SelectGroupProps) {\n const handleChange = useCallback(\n (payload: { value: string; selected: boolean }) => {\n const index = selected.indexOf(payload.value)\n\n if (payload.selected) {\n if (index < 0) {\n onChange([...selected, payload.value])\n }\n } else {\n if (index >= 0) {\n onChange([...selected.slice(0, index), ...selected.slice(index + 1)])\n }\n }\n },\n [onChange, selected]\n )\n\n return (\n <SelectGroupContext.Provider\n value={{\n name,\n selected: Array.from(new Set(selected)),\n disabled,\n readonly,\n hasError,\n onChange: handleChange,\n }}\n >\n <div\n className={className}\n aria-label={ariaLabel}\n data-testid=\"SelectGroup\"\n >\n {children}\n </div>\n </SelectGroupContext.Provider>\n )\n}\n","import { useSwitch } from '@react-aria/switch'\nimport type { AriaSwitchProps } from '@react-types/switch'\nimport React, { useRef, useMemo } from 'react'\nimport { useToggleState } from 'react-stately'\nimport styled from 'styled-components'\nimport { theme } from '../../styled'\nimport { disabledSelector, px } from '@charcoal-ui/utils'\n\nexport type SwitchProps = {\n name: string\n className?: string\n value?: string\n checked?: boolean\n disabled?: boolean\n onChange(checked: boolean): void\n} & (\n | // children か label は片方が必須\n {\n children: React.ReactNode\n }\n | {\n label: string\n }\n)\n\nexport default function SwitchCheckbox(props: SwitchProps) {\n const { disabled, className } = props\n\n const ariaSwitchProps: AriaSwitchProps = useMemo(\n () => ({\n ...props,\n\n // children がいない場合は aria-label をつけないといけない\n 'aria-label': 'children' in props ? undefined : props.label,\n isDisabled: props.disabled,\n isSelected: props.checked,\n }),\n [props]\n )\n\n const state = useToggleState(ariaSwitchProps)\n const ref = useRef<HTMLInputElement>(null)\n const {\n inputProps: { className: _className, type: _type, ...rest },\n } = useSwitch(ariaSwitchProps, state, ref)\n\n return (\n <Label className={className} aria-disabled={disabled}>\n <SwitchInput {...rest} ref={ref} />\n {'children' in props ? (\n // eslint-disable-next-line react/destructuring-assignment\n <LabelInner>{props.children}</LabelInner>\n ) : undefined}\n </Label>\n )\n}\n\nconst Label = styled.label`\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ${({ theme }) => px(theme.spacing[4])};\n cursor: pointer;\n outline: 0;\n\n ${theme((o) => o.disabled)}\n\n ${disabledSelector} {\n cursor: default;\n }\n`\n\nconst LabelInner = styled.div`\n ${theme((o) => o.typography(14))}\n`\n\nconst SwitchInput = styled.input.attrs({\n type: 'checkbox',\n})`\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ${theme((o) => [\n o.borderRadius(16),\n o.height.px(16),\n o.bg.text4.hover.press,\n o.outline.default.focus,\n ])}\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ${theme((o) => [o.bg.text5.hover.press, o.borderRadius('oval')])}\n }\n\n &:checked {\n ${theme((o) => o.bg.brand.hover.press)}\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n`\n","import React from 'react'\nimport styled from 'styled-components'\nimport { createTheme } from '@charcoal-ui/styled'\n\nexport interface FieldLabelProps\n extends React.LabelHTMLAttributes<HTMLLabelElement> {\n readonly className?: string\n readonly label: string\n readonly subLabel?: React.ReactNode\n readonly required?: boolean\n // TODO: 翻訳用のContextで注入する\n readonly requiredText?: string\n}\n\nconst FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel(\n {\n style,\n className,\n label,\n required = false,\n requiredText,\n subLabel,\n ...labelProps\n },\n ref\n ) {\n return (\n <FieldLabelWrapper style={style} className={className}>\n <Label ref={ref} {...labelProps}>\n {label}\n </Label>\n {required && <RequiredText>{requiredText}</RequiredText>}\n <SubLabelClickable>\n <span>{subLabel}</span>\n </SubLabelClickable>\n </FieldLabelWrapper>\n )\n }\n)\n\nexport default FieldLabel\n\nconst theme = createTheme(styled)\n\nconst Label = styled.label`\n ${theme((o) => [o.typography(14).bold, o.font.text1])}\n`\n\nconst RequiredText = styled.span`\n ${theme((o) => [o.typography(14), o.font.text3])}\n`\n\nconst SubLabelClickable = styled.div`\n ${theme((o) => [\n o.typography(14),\n o.font.text3.hover.press,\n o.outline.default.focus,\n ])}\n`\n\nconst FieldLabelWrapper = styled.div`\n display: inline-flex;\n align-items: center;\n\n > ${RequiredText} {\n ${theme((o) => o.margin.left(4))}\n }\n\n > ${SubLabelClickable} {\n ${theme((o) => o.margin.left('auto'))}\n }\n`\n","import { useTextField } from '@react-aria/textfield'\nimport { useVisuallyHidden } from '@react-aria/visually-hidden'\nimport React, {\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport styled, { css } from 'styled-components'\nimport FieldLabel, { FieldLabelProps } from '../FieldLabel'\nimport { createTheme } from '@charcoal-ui/styled'\n\nconst theme = createTheme(styled)\n\ninterface TextFieldBaseProps\n extends Pick<FieldLabelProps, 'label' | 'requiredText' | 'subLabel'> {\n readonly className?: string\n readonly defaultValue?: string\n readonly value?: string\n readonly onChange?: (value: string) => void\n readonly showCount?: boolean\n readonly showLabel?: boolean\n readonly placeholder?: string\n readonly assistiveText?: string\n readonly disabled?: boolean\n readonly required?: boolean\n readonly invalid?: boolean\n readonly maxLength?: number\n /**\n * tab-indexがー1かどうか\n */\n readonly excludeFromTabOrder?: boolean\n}\n\nexport interface SingleLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: never\n readonly multiline?: false\n readonly rows?: never\n readonly type?: string\n readonly prefix?: ReactNode\n readonly suffix?: ReactNode\n}\n\nexport interface MultiLineTextFieldProps extends TextFieldBaseProps {\n readonly autoHeight?: boolean\n readonly multiline: true\n readonly rows?: number\n readonly type?: never\n readonly prefix?: never\n readonly suffix?: never\n}\n\nexport type TextFieldProps = SingleLineTextFieldProps | MultiLineTextFieldProps\ntype TextFieldElement = HTMLInputElement & HTMLTextAreaElement\n\nfunction mergeRefs<T>(...refs: React.Ref<T>[]): React.RefCallback<T> {\n return (value) => {\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref !== null) {\n ;(ref as React.MutableRefObject<T | null>).current = value\n }\n }\n }\n}\n\nfunction countCodePointsInString(string: string) {\n // [...string] とするとproduction buildで動かなくなる\n // cf. https://twitter.com/f_subal/status/1497214727511891972\n return Array.from(string).length\n}\n\nconst TextField = React.forwardRef<TextFieldElement, TextFieldProps>(\n function TextField(props, ref) {\n return props.multiline !== undefined && props.multiline ? (\n <MultiLineTextField ref={ref} {...props} />\n ) : (\n <SingleLineTextField ref={ref} {...props} />\n )\n }\n)\n\nexport default TextField\n\nconst SingleLineTextField = React.forwardRef<\n HTMLInputElement,\n SingleLineTextFieldProps\n>(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showLabel = false,\n showCount = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n prefix = null,\n suffix = null,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const ariaRef = useRef<HTMLInputElement>(null)\n const prefixRef = useRef<HTMLSpanElement>(null)\n const suffixRef = useRef<HTMLSpanElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [prefixWidth, setPrefixWidth] = useState(0)\n const [suffixWidth, setSuffixWidth] = useState(0)\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n onChange?.(value)\n },\n [maxLength, nonControlled, onChange]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'input',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n const prefixObserver = new ResizeObserver((entries) => {\n setPrefixWidth(entries[0].contentRect.width)\n })\n const suffixObserver = new ResizeObserver((entries) => {\n setSuffixWidth(entries[0].contentRect.width)\n })\n\n if (prefixRef.current !== null) {\n prefixObserver.observe(prefixRef.current)\n }\n if (suffixRef.current !== null) {\n suffixObserver.observe(suffixRef.current)\n }\n\n return () => {\n suffixObserver.disconnect()\n prefixObserver.disconnect()\n }\n }, [])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledInputContainer>\n <PrefixContainer ref={prefixRef}>\n <Affix>{prefix}</Affix>\n </PrefixContainer>\n <StyledInput\n ref={mergeRefs(forwardRef, ariaRef)}\n invalid={invalid}\n extraLeftPadding={prefixWidth}\n extraRightPadding={suffixWidth}\n {...inputProps}\n />\n <SuffixContainer ref={suffixRef}>\n <Affix>{suffix}</Affix>\n {showCount && (\n <SingleLineCounter>\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </SingleLineCounter>\n )}\n </SuffixContainer>\n </StyledInputContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst MultiLineTextField = React.forwardRef<\n HTMLTextAreaElement,\n MultiLineTextFieldProps\n>(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef) {\n const {\n className,\n showCount = false,\n showLabel = false,\n label,\n requiredText,\n subLabel,\n disabled = false,\n required,\n invalid = false,\n assistiveText,\n maxLength,\n autoHeight = false,\n rows: initialRows = 4,\n } = props\n\n const { visuallyHiddenProps } = useVisuallyHidden()\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const ariaRef = useRef<HTMLTextAreaElement>(null)\n const [count, setCount] = useState(countCodePointsInString(props.value ?? ''))\n const [rows, setRows] = useState(initialRows)\n\n const syncHeight = useCallback(\n (textarea: HTMLTextAreaElement) => {\n const rows = `${textarea.value}\\n`.match(/\\n/gu)?.length ?? 1\n if (initialRows <= rows) {\n setRows(rows)\n }\n },\n [initialRows]\n )\n\n const nonControlled = props.value === undefined\n const handleChange = useCallback(\n (value: string) => {\n const count = countCodePointsInString(value)\n if (maxLength !== undefined && count > maxLength) {\n return\n }\n if (nonControlled) {\n setCount(count)\n }\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n onChange?.(value)\n },\n [autoHeight, maxLength, nonControlled, onChange, syncHeight]\n )\n\n useEffect(() => {\n setCount(countCodePointsInString(props.value ?? ''))\n }, [props.value])\n\n const { inputProps, labelProps, descriptionProps, errorMessageProps } =\n useTextField(\n {\n inputElementType: 'textarea',\n isDisabled: disabled,\n isRequired: required,\n validationState: invalid ? 'invalid' : 'valid',\n description: !invalid && assistiveText,\n errorMessage: invalid && assistiveText,\n onChange: handleChange,\n ...props,\n },\n ariaRef\n )\n\n useEffect(() => {\n if (autoHeight && textareaRef.current !== null) {\n syncHeight(textareaRef.current)\n }\n }, [autoHeight, syncHeight])\n\n return (\n <TextFieldRoot className={className} isDisabled={disabled}>\n <TextFieldLabel\n label={label}\n requiredText={requiredText}\n required={required}\n subLabel={subLabel}\n {...labelProps}\n {...(!showLabel ? visuallyHiddenProps : {})}\n />\n <StyledTextareaContainer\n invalid={invalid}\n rows={showCount ? rows + 1 : rows}\n >\n <StyledTextarea\n ref={mergeRefs(textareaRef, forwardRef, ariaRef)}\n rows={rows}\n noBottomPadding={showCount}\n {...inputProps}\n />\n {showCount && (\n <MultiLineCounter>\n {maxLength !== undefined ? `${count}/${maxLength}` : count}\n </MultiLineCounter>\n )}\n </StyledTextareaContainer>\n {assistiveText != null && assistiveText.length !== 0 && (\n <AssistiveText\n invalid={invalid}\n {...(invalid ? errorMessageProps : descriptionProps)}\n >\n {assistiveText}\n </AssistiveText>\n )}\n </TextFieldRoot>\n )\n})\n\nconst TextFieldRoot = styled.div<{ isDisabled: boolean }>`\n display: flex;\n flex-direction: column;\n\n ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}\n`\n\nconst TextFieldLabel = styled(FieldLabel)`\n ${theme((o) => o.margin.bottom(8))}\n`\n\nconst StyledInputContainer = styled.div`\n height: 40px;\n display: grid;\n position: relative;\n`\n\nconst PrefixContainer = styled.span`\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n`\n\nconst SuffixContainer = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n`\n\nconst Affix = styled.span`\n user-select: none;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}\n`\n\nconst StyledInput = styled.input<{\n invalid: boolean\n extraLeftPadding: number\n extraRightPadding: number\n}>`\n border: none;\n box-sizing: border-box;\n outline: none;\n font-family: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n height: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding-left: calc((8px + ${(p) => p.extraLeftPadding}px) / 0.875);\n padding-right: calc((8px + ${(p) => p.extraRightPadding}px) / 0.875);\n border-radius: calc(4px / 0.875);\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n o.outline.default.focus,\n p.invalid && o.outline.assertive,\n o.font.text2,\n ])}\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n`\n\nconst StyledTextareaContainer = styled.div<{ rows: number; invalid: boolean }>`\n position: relative;\n overflow: hidden;\n padding: 0 8px;\n\n ${(p) =>\n theme((o) => [\n o.bg.surface3.hover,\n p.invalid && o.outline.assertive,\n o.font.text2,\n o.borderRadius(4),\n ])}\n\n &:focus-within {\n ${(p) =>\n theme((o) => (p.invalid ? o.outline.assertive : o.outline.default))}\n }\n\n ${({ rows }) => css`\n height: calc(22px * ${rows} + 18px);\n `};\n`\n\nconst StyledTextarea = styled.textarea<{ noBottomPadding: boolean }>`\n border: none;\n outline: none;\n resize: none;\n font-family: inherit;\n color: inherit;\n\n /* Prevent zooming for iOS Safari */\n transform-origin: top left;\n transform: scale(0.875);\n width: calc(100% / 0.875);\n font-size: calc(14px / 0.875);\n line-height: calc(22px / 0.875);\n padding: calc(9px / 0.875) 0 ${(p) => (p.noBottomPadding ? 0 : '')};\n\n ${({ rows = 1 }) => css`\n height: calc(22px / 0.875 * ${rows});\n `};\n\n /* Display box-shadow for iOS Safari */\n appearance: none;\n\n background: none;\n\n &::placeholder {\n ${theme((o) => o.font.text3)}\n }\n\n /* Hide scrollbar for Chrome, Safari and Opera */\n &::-webkit-scrollbar {\n display: none;\n }\n /* Hide scrollbar for IE, Edge and Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n`\n\nconst SingleLineCounter = styled.span`\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst MultiLineCounter = styled.span`\n position: absolute;\n bottom: 9px;\n right: 8px;\n\n ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}\n`\n\nconst AssistiveText = styled.p<{ invalid: boolean }>`\n ${(p) =>\n theme((o) => [\n o.typography(14),\n o.margin.top(8),\n o.margin.bottom(0),\n o.font[p.invalid ? 'assertive' : 'text1'],\n ])}\n`\n","import React from 'react'\n\nimport '@charcoal-ui/icons'\nimport type { PixivIcon, Props } from '@charcoal-ui/icons'\n\nexport interface OwnProps {\n unsafeNonGuidelineScale?: number\n className?: string\n}\n\nexport interface IconProps\n extends OwnProps,\n React.PropsWithoutRef<\n Omit<Props, 'class' | 'unsafe-non-guideline-scale' | 'css'>\n > {}\n\nconst Icon = React.forwardRef<PixivIcon, IconProps>(function IconInner(\n { name, scale, unsafeNonGuidelineScale, className, ...rest },\n ref\n) {\n return (\n <pixiv-icon\n ref={ref}\n name={name}\n scale={scale}\n unsafe-non-guideline-scale={unsafeNonGuidelineScale}\n class={className}\n {...rest}\n />\n )\n})\n\nexport default Icon\n"],"names":["DefaultValue","Link","React","forwardRef","ref","to","children","rest","href","ComponentAbstractionContext","createContext","ComponentAbstraction","components","Provider","value","useComponentAbstraction","useContext","theme","createTheme","styled","Clickable","props","onClick","disabled","A","as","undefined","Button","clickableCss","css","disabledSelector","button","span","variant","size","fixed","StyledButton","withConfig","shouldForwardProp","prop","attrs","font","background","Error","arguments","length","JSON","stringify","unreachable","variantToProps","height","padding","sizeToProps","p","o","hover","press","bg","typography","bold","preserveHalfLeading","horizontal","borderRadius","outline","default","focus","IconButton","icon","requiredIconSize","result","exec","iconSize","console","warn","validateIconSize","StyledIconButton","name","width","Radio","forceChecked","selected","isParentDisabled","readonly","hasError","onChange","RadioGroupContext","warning","isSelected","isDisabled","isReadonly","handleChange","useCallback","e","currentTarget","RadioRoot","RadioInput","checked","RadioLabel","label","px","spacing","input","type","text5","assertive","color","text4","brand","div","StyledRadioGroup","RadioGroup","className","next","role","SelectGroupContext","Select","parentDisabled","parentOnChange","includes","event","HTMLInputElement","SelectRoot","SelectInput","overlay","SelectInputOverlay","Boolean","SelectLabel","text1","text3","surface4","SelectGroup","ariaLabel","payload","index","indexOf","slice","Array","from","Set","SwitchCheckbox","ariaSwitchProps","useMemo","state","useToggleState","useRef","useSwitch","inputProps","Label","SwitchInput","LabelInner","FieldLabel","style","required","requiredText","subLabel","labelProps","FieldLabelWrapper","RequiredText","SubLabelClickable","margin","left","mergeRefs","refs","current","countCodePointsInString","string","TextField","multiline","MultiLineTextField","SingleLineTextField","showLabel","showCount","invalid","assistiveText","maxLength","prefix","suffix","visuallyHiddenProps","useVisuallyHidden","ariaRef","prefixRef","suffixRef","count","setCount","useState","prefixWidth","setPrefixWidth","suffixWidth","setSuffixWidth","nonControlled","useEffect","descriptionProps","errorMessageProps","useTextField","inputElementType","isRequired","validationState","description","errorMessage","prefixObserver","ResizeObserver","entries","contentRect","suffixObserver","observe","disconnect","TextFieldRoot","TextFieldLabel","StyledInputContainer","PrefixContainer","Affix","StyledInput","extraLeftPadding","extraRightPadding","SuffixContainer","SingleLineCounter","AssistiveText","autoHeight","rows","initialRows","textareaRef","setRows","syncHeight","textarea","match","_$match","StyledTextareaContainer","StyledTextarea","noBottomPadding","MultiLineCounter","opacity","elementEffect","bottom","text2","surface3","top","Icon","scale","unsafeNonGuidelineScale","class"],"mappings":"84BAuBMA,EAA2B,CAC/BC,KAfyBC,EAAMC,WAC/B,WAAgDC,OAA3BC,GAAEA,EAAFC,SAAMA,KAAaC,sBACtC,OACEL,uBAAGM,KAAMH,EAAID,IAAKA,GAASG,GACxBD,MAcHG,EAA8BP,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