@charcoal-ui/react 5.11.0-beta.1 → 5.11.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/TextArea/index.d.ts +15 -0
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/themeHelper.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +14 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/layered.css +14 -0
- package/dist/layered.css.map +1 -1
- package/package.json +5 -5
- package/src/components/FocusRing/__snapshots__/index.css.snap +6 -0
- package/src/components/FocusRing/index.css +10 -0
- package/src/components/FocusRing/index.story.tsx +33 -0
- package/src/components/TextArea/TextArea.story.tsx +88 -3
- package/src/components/TextArea/index.tsx +87 -37
- package/src/components/TextField/__snapshots__/index.css.snap +6 -0
- package/src/components/TextField/index.css +6 -0
- package/src/components/TextField/index.tsx +17 -15
- package/src/core/themeHelper.test.tsx +20 -0
- package/src/core/themeHelper.ts +26 -19
- package/src/index.ts +6 -1
package/dist/index.css
CHANGED
|
@@ -717,6 +717,12 @@
|
|
|
717
717
|
margin-left: 4px;
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
+
.charcoal-text-field-input-root {
|
|
721
|
+
flex: 1;
|
|
722
|
+
min-width: 0;
|
|
723
|
+
overflow: hidden;
|
|
724
|
+
}
|
|
725
|
+
|
|
720
726
|
.charcoal-text-field-input {
|
|
721
727
|
border: none;
|
|
722
728
|
box-sizing: border-box;
|
|
@@ -1769,3 +1775,11 @@
|
|
|
1769
1775
|
.charcoal-pagination-spacer.charcoal-icon-button:disabled {
|
|
1770
1776
|
opacity: 1;
|
|
1771
1777
|
}
|
|
1778
|
+
.charcoal-focus-ring:is(
|
|
1779
|
+
:not(:disabled):not([aria-disabled]),
|
|
1780
|
+
[aria-disabled='false']
|
|
1781
|
+
):focus-visible {
|
|
1782
|
+
outline: none;
|
|
1783
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
1784
|
+
transition: 0.2s box-shadow;
|
|
1785
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { RadioGroup, type RadioGroupProps } from './components/Radio/RadioGroup'
|
|
|
11
11
|
export { default as MultiSelect, type MultiSelectProps, MultiSelectGroup, type MultiSelectGroupProps, } from './components/MultiSelect';
|
|
12
12
|
export { default as Switch, type SwitchProps } from './components/Switch';
|
|
13
13
|
export { default as TextField, type TextFieldProps, } from './components/TextField';
|
|
14
|
-
export { default as TextArea, type TextAreaProps } from './components/TextArea';
|
|
14
|
+
export { default as TextArea, type TextAreaImperativeHandle, type TextAreaProps, } from './components/TextArea';
|
|
15
15
|
export { default as Icon, type IconProps } from './components/Icon';
|
|
16
16
|
export { default as Modal, type ModalProps, ModalCloseButton, } from './components/Modal';
|
|
17
17
|
export { ModalHeader, ModalAlign, ModalBody, ModalButtons, } from './components/Modal/ModalPlumbing';
|
|
@@ -26,4 +26,5 @@ export { default as TagItem, type TagItemProps } from './components/TagItem';
|
|
|
26
26
|
export { default as HintText, type HintTextProps, type HintTextContext, } from './components/HintText';
|
|
27
27
|
export { default as UnstableTextEllipsis, type TextEllipsisProps, } from './components/TextEllipsis';
|
|
28
28
|
export { default as UnstablePagination, type PaginationProps, } from './components/Pagination';
|
|
29
|
+
import './components/FocusRing/index.css';
|
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC9E,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAChF,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAA;AACjC,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC9E,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAChF,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAA;AACjC,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,EACL,OAAO,IAAI,QAAQ,EACnB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,GACnB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EACL,OAAO,IAAI,KAAK,EAChB,KAAK,UAAU,EACf,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,YAAY,GACb,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,OAAO,IAAI,cAAc,EACzB,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,OAAO,IAAI,gBAAgB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,KAAK,aAAa,GACnB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,OAAO,IAAI,gBAAgB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,gDAAgD,CAAA;AACvD,OAAO,EACL,OAAO,IAAI,aAAa,EACxB,KAAK,kBAAkB,GACxB,MAAM,6CAA6C,CAAA;AACpD,OAAO,EACL,OAAO,IAAI,gBAAgB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,KAAK,iBAAiB,GACvB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,kCAAkC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{SSRProvider as e}from"@react-aria/ssr";import*as t from"react";import n,{Children as r,Fragment as i,createContext as a,forwardRef as o,isValidElement as s,memo as c,useCallback as l,useContext as u,useDebugValue as d,useEffect as f,useImperativeHandle as p,useMemo as m,useRef as h,useState as g,version as _}from"react";import{DismissButton as v,Overlay as y,OverlayProvider as b,ariaHideOutside as x,useOverlay as S,useOverlayFocusContain as C,usePopover as w}from"@react-aria/overlays";import{jsx as T,jsxs as E}from"react/jsx-runtime";import D from"warning";import"@charcoal-ui/icons";import{mergeRefs as O,useId as k,useObjectRef as A}from"@react-aria/utils";import{useVisuallyHidden as j}from"@react-aria/visually-hidden";import{animated as M,easings as N,useTransition as P}from"@react-spring/web";import{useDialog as F}from"@react-aria/dialog";import{useRadioGroupState as I}from"@react-stately/radio";import{useRadio as L,useRadioGroup as
|
|
2
|
+
import{SSRProvider as e}from"@react-aria/ssr";import*as t from"react";import n,{Children as r,Fragment as i,createContext as a,forwardRef as o,isValidElement as s,memo as c,useCallback as l,useContext as u,useDebugValue as d,useEffect as f,useImperativeHandle as p,useMemo as m,useRef as h,useState as g,version as _}from"react";import{DismissButton as v,Overlay as y,OverlayProvider as b,ariaHideOutside as x,useOverlay as S,useOverlayFocusContain as C,usePopover as w}from"@react-aria/overlays";import{jsx as T,jsxs as E}from"react/jsx-runtime";import D from"warning";import"@charcoal-ui/icons";import{mergeRefs as O,useId as k,useObjectRef as A}from"@react-aria/utils";import{useVisuallyHidden as j}from"@react-aria/visually-hidden";import{animated as M,easings as N,useTransition as P}from"@react-spring/web";import{useDialog as F}from"@react-aria/dialog";import{useRadioGroupState as I}from"@react-stately/radio";import{useRadio as L,useRadioGroup as R}from"@react-aria/radio";import{c as z}from"react-compiler-runtime";function ee(e){let t=parseInt(_.split(`.`)[0],10);return Number.isFinite(t)?t>=e:!1}const B=ee(18)?i:e;function V({children:e}){return T(B,{children:T(b,{children:e})})}const H=`charcoal-theme`,U=`theme`,W=new RegExp(/^(\w|-)+$/);function G(e){if(!W.test(e))throw Error(`Unexpected key :${e}, expect: /^(\\w|-)+$/`)}const K=(e=U)=>t=>{G(e),t===void 0?delete document.documentElement.dataset[e]:document.documentElement.dataset[e]=t},te=K();function ne(e,t){return`:root[data-${t??`theme`}='${e}']`}function re(e){return`@media (prefers-color-scheme: ${e})`}function ie({key:e=H,setter:t=te}={}){let[n,,r]=oe(e);f(()=>{n!==void 0&&t(r?void 0:n)},[t,r,n])}function ae(e=H){return localStorage.getItem(e)}const oe=(e=H)=>{G(e);let t=ue(`(prefers-color-scheme: dark)`),n=t===void 0?void 0:t?`dark`:`light`,[r,i,a]=se(e);return[!a||n===void 0?void 0:r??n,i,r===void 0]};function se(e,t){let[n,r]=g(!1),[i,a]=g(),o=m(()=>t?.(),[t]),s=l(()=>{let t=localStorage.getItem(e);a((t===null?null:ce(t))??o),r(!0)},[o,e]),c=l(t=>{t.storageArea===localStorage&&t.key===e&&s()},[s,e]);return f(()=>(s(),window.addEventListener(`storage`,c),()=>{window.removeEventListener(`storage`,c)}),[s,c]),[i??o,t=>{if(t===void 0)localStorage.removeItem(e);else{let n=le(t);localStorage.setItem(e,n)}let n=new StorageEvent(`storage`,{bubbles:!0,cancelable:!1,key:e,url:location.href,storageArea:localStorage});dispatchEvent(n)},n]}function ce(e){try{return JSON.parse(e)}catch{return e}}function le(e){return typeof e==`string`?e:JSON.stringify(e)}function ue(e){let[t,n]=g();return f(()=>{let t=window.matchMedia(e),r=()=>{n(t.matches)};return t.addEventListener(`change`,r),n(t.matches),()=>{t.removeEventListener(`change`,r)}},[e]),t}function de({localStorageKey:e=q.localStorageKey,rootAttribute:t=q.rootAttribute}=q){return G(e),G(t),`'use strict';
|
|
3
3
|
(function () {
|
|
4
4
|
var localStorageKey = '${e}'
|
|
5
5
|
var rootAttribute = '${t}'
|
|
@@ -8,5 +8,5 @@ import{SSRProvider as e}from"@react-aria/ssr";import*as t from"react";import n,{
|
|
|
8
8
|
document.documentElement.dataset[rootAttribute] = currentTheme;
|
|
9
9
|
}
|
|
10
10
|
})();
|
|
11
|
-
`}function pe({localStorageKey:e=G.localStorageKey,rootAttribute:t=G.rootAttribute}){return T(`script`,{dangerouslySetInnerHTML:{__html:fe({localStorageKey:e,rootAttribute:t})}})}const G={localStorageKey:H,rootAttribute:U};function K(...e){return m(()=>e.filter(e=>e).join(` `),[e])}const me=o(function({variant:e,fullWidth:t,size:n,className:r,component:i,isActive:a,...o},s){let c=m(()=>i??`button`,[i]),l=K(`charcoal-button`,r);return T(c,{...o,className:l,"data-variant":e,"data-size":n,"data-full-width":t,"data-active":a,ref:s})}),he=o(function({component:e,...t},n){let r=K(`charcoal-clickable`,t.className);return T(m(()=>e??`button`,[e]),{...t,ref:n,className:r})}),q=o(function({variant:e=`Default`,size:t=`M`,icon:n,isActive:r=!1,component:i,...a},o){ge(t,n);let s=m(()=>i??`button`,[i]),c=K(`charcoal-icon-button`,a.className);return T(s,{...a,ref:o,className:c,"data-size":t,"data-active":r,"data-variant":e,children:T(`pixiv-icon`,{name:n})})});function ge(e,t){let n;switch(e){case`XS`:n=`16`;break;case`S`:case`M`:n=`24`;break}let r=/^\d*/u.exec(t);if(r==null)throw Error(`Invalid icon name`);let[i]=r;i!==n&&console.warn(`IconButton with size "${e}" expect icon size "${n}, but got "${i}"`)}const _e=t.createContext({name:void 0,selected:void 0,disabled:!1,readonly:!1,invalid:!1,onChange(){throw Error(`Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?`)}});var ve=c(o(function({onChange:e,invalid:t,className:n,...r},i){let a=l(t=>{let n=t.currentTarget;e?.(n.value)},[e]);return T(`input`,{className:K(`charcoal-radio-input`,n),ref:i,type:`radio`,onChange:a,"aria-invalid":t,...r})})),ye=c(o(function({value:e,disabled:t=!1,children:n,...r},i){let{name:a,selected:o,disabled:s,readonly:c,invalid:l,onChange:d}=u(_e),f=K(`charcoal-radio__label`,r.className);D(a!==void 0,`"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`);let p=e===o,m=t||s,h=c&&!p;return E(`label`,{"aria-disabled":m||h,className:f,children:[T(ve,{name:a,value:e,checked:p,"aria-invalid":l,onChange:d,disabled:m||h,ref:i}),n!=null&&T(`div`,{className:`charcoal-radio__label_div`,children:n})]})}));const be=o(function({value:e,label:t,name:n,onChange:r,disabled:i,readonly:a,invalid:o,children:s,"aria-orientation":c=`vertical`,...u},d){let f=K(`charcoal-radio-group`,u.className),p=l(e=>{r(e)},[r]),h=m(()=>({name:n,selected:e,disabled:i??!1,readonly:a??!1,invalid:o??!1,onChange:p}),[i,p,o,n,a,e]);return T(_e.Provider,{value:h,children:T(`div`,{role:`radiogroup`,"aria-disabled":i,"aria-invalid":o,"aria-label":t,"aria-labelledby":u[`aria-labelledby`],"aria-orientation":c,className:f,ref:d,children:s})})}),xe=a({name:void 0,selected:[],disabled:!1,readonly:!1,invalid:!1,onChange(){throw Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?")}}),J=t.forwardRef(function({name:e,scale:t,unsafeNonGuidelineScale:n,className:r,...i},a){return T(`pixiv-icon`,{ref:a,name:e,scale:t,"unsafe-non-guideline-scale":n,class:r,...i})});var Se=c(o(function({value:e,disabled:t=!1,onChange:n,variant:r=`default`,className:i,children:a},o){let{name:s,selected:c,disabled:d,readonly:f,invalid:p,onChange:m}=u(xe);D(s!==void 0,`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`);let h=c.includes(e),g=t||d||f,_=l(t=>{t.currentTarget instanceof HTMLInputElement&&(n&&n({value:e,selected:t.currentTarget.checked}),m({value:e,selected:t.currentTarget.checked}))},[n,m,e]),v=K(`charcoal-multi-select`,i);return E(`label`,{"aria-disabled":g,className:v,children:[T(`input`,{className:`charcoal-multi-select-input`,name:s,value:e,type:`checkbox`,checked:h,disabled:g,onChange:_,"data-overlay":r===`overlay`,"aria-invalid":p,ref:o}),T(`div`,{className:`charcoal-multi-select-overlay`,"data-overlay":r===`overlay`,"aria-invalid":p,"aria-hidden":!0,children:T(J,{name:`24/Check`,"unsafe-non-guideline-scale":16/24})}),!!a&&T(`div`,{className:`charcoal-multi-select-label`,children:a})]})}));function Ce({className:e,style:t,name:n,label:r,selected:i,onChange:a,disabled:o=!1,readonly:s=!1,invalid:c=!1,children:u}){let d=l(e=>{let t=i.indexOf(e.value);e.selected?t<0&&a([...i,e.value]):t>=0&&a([...i.slice(0,t),...i.slice(t+1)])},[a,i]);return T(xe.Provider,{value:{name:n,selected:Array.from(new Set(i)),disabled:o,readonly:s,invalid:c,onChange:d},children:T(`div`,{className:e,style:t,"aria-label":r,"data-testid":`SelectGroup`,children:u})})}const we=o(function({onChange:e,className:t,...n},r){let i=l(t=>{let n=t.currentTarget;e?.(n.checked)},[e]);return T(`input`,{ref:r,className:K(`charcoal-switch-input`,t),type:`checkbox`,onChange:i,...n})}),Te=t.memo(function({children:e,className:t,disabled:n,id:r,input:i}){return E(`label`,{htmlFor:r,className:K(`charcoal-switch__label`,t),"aria-disabled":n,children:[i,T(`div`,{className:`charcoal-switch__label_div`,children:e})]})});var Ee=c(o(function({children:e,onChange:t,disabled:n,className:r,id:i,...a},o){let s=k(i),c=e===void 0,l=T(we,{...a,disabled:n,className:c?r:void 0,id:s,onChange:t,ref:o,role:`switch`,type:`checkbox`});return c?l:T(Te,{className:r,disabled:n,id:s,input:l,children:e})}));const Y=t.forwardRef(function({style:e,className:t,label:n,required:r=!1,requiredText:i,subLabel:a,...o},s){return E(`div`,{style:e,className:K(`charcoal-field-label-root`,t),children:[T(`label`,{ref:s,className:`charcoal-field-label`,...o,children:n}),r&&T(`div`,{className:`charcoal-field-label-required-text`,children:i}),T(`div`,{className:`charcoal-field-label-sub-label`,children:T(`span`,{children:a})})]})});function De(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!==null&&(n.current=t)}}function Oe(e){return Array.from(e).length}function ke(e,t){f(()=>{let n=e.current;if(n){let e=e=>{e.target!==t.current&&t.current?.focus()};return n.addEventListener(`click`,e),()=>{n.removeEventListener(`click`,e)}}})}function X(e){return o(function({className:t,...n},r){return T(`div`,{className:K(e,t),ref:r,...n})})}const Z=X(`charcoal-text-field-assistive-text`),Ae=t.forwardRef(function({assistiveText:e,className:t,disabled:n=!1,label:r=``,maxLength:i,onChange:a,prefix:o=null,required:s,requiredText:c,showCount:u=!1,showLabel:d=!1,subLabel:p,suffix:m=null,type:_=`text`,invalid:v,value:y,getCount:b=Oe,...x},S){let C=h(null),{visuallyHiddenProps:w}=j(),[D,A]=g(b(y??``)),M=l(e=>{let t=e.target.value,n=b(t);i!==void 0&&n>i||(A(n),a?.(t))},[b,i,a]);f(()=>{A(b(y??``))},[b,y]);let N=h(null);ke(N,C);let P=k(x.id),F=k(),I=k(),L=e!=null&&e.length!==0;return E(`div`,{className:K(`charcoal-text-field-root`,t),"aria-disabled":n,children:[T(Y,{htmlFor:P,id:I,label:r,required:s,requiredText:c,subLabel:p,...d?{}:w}),E(`div`,{className:`charcoal-text-field-container`,"aria-disabled":n===!0?!0:void 0,"data-invalid":v===!0,ref:N,children:[o&&T(`div`,{className:`charcoal-text-field-prefix`,children:o}),T(`input`,{className:`charcoal-text-field-input`,"aria-describedby":L?F:void 0,"aria-invalid":v,"aria-labelledby":I,id:P,"data-invalid":v===!0,maxLength:i,onChange:M,disabled:n,ref:O(S,C),type:_,value:y,...x}),(m||u)&&E(`div`,{className:`charcoal-text-field-suffix`,children:[m,u&&T(`span`,{className:`charcoal-text-field-line-counter`,children:i===void 0?D:`${D}/${i}`})]})]}),L&&T(Z,{"data-invalid":v===!0,id:F,children:e})]})}),je=o(function({onChange:e,className:t,value:n,showCount:r=!1,showLabel:i=!1,label:a=``,requiredText:o,subLabel:s,disabled:c=!1,required:u,assistiveText:d,maxLength:p,autoHeight:_=!1,rows:v=4,maxRows:y,invalid:b,getCount:x=Oe,defaultValue:S,...C},w){let{visuallyHiddenProps:D}=j(),O=h(null),[A,M]=g(x(n??S?.toString()??``)),[N,P]=g(v),F=m(()=>_||y&&y>=0,[_,y]),I=l(e=>{let t=(`${e.value}\n`.match(/\n/gu)?.length??0)||1,n=y!==void 0&&y>=1,r=v<=t?t:v;if(!n||y<=v){P(r);return}P(r<=y?r:y)},[v,y]),L=n===void 0,ee=l(t=>{let n=t.target.value,r=x(n);p!==void 0&&r>p||(L&&M(r),F&&O.current!==null&&I(O.current),e?.(n))},[F,x,p,L,e,I]);f(()=>{M(x(n??S?.toString()??``))},[x,n,S]),f(()=>{F&&O.current!==null&&I(O.current)},[F,I]);let R=h(null);ke(R,O);let z=k(C.id),B=k(),V=k(),H=K(`charcoal-text-area-root`,t),U=d!=null&&d.length!==0;return E(`div`,{className:H,"aria-disabled":c,children:[T(Y,{htmlFor:z,id:V,label:a,required:u,requiredText:o,subLabel:s,...i?{}:D}),E(`div`,{className:`charcoal-text-area-container`,"aria-disabled":c===!0?`true`:void 0,"aria-invalid":b===!0,ref:R,style:{"--charcoal-text-area-rows":`${r?N+1:N}`},children:[T(`textarea`,{className:`charcoal-text-area-textarea`,"aria-describedby":U?B:void 0,"aria-invalid":b,"aria-labelledby":V,id:z,maxLength:p,"data-no-bottom-padding":r,onChange:ee,ref:De(w,O),rows:N,value:n,disabled:c,defaultValue:S,...C}),r&&T(`span`,{className:`charcoal-text-area-counter`,children:p===void 0?A:`${A}/${p}`})]}),U&&T(Z,{"data-invalid":b===!0,id:B,children:d})]})});function Me(e){let n=t.useRef(null);return t.useEffect(()=>{e&&(typeof e==`function`?e(n.current):e.current=n.current)}),n}const Ne=o(function({size:e,bottomSheet:t,className:n,...r},i){let a=Me(i),{dialogProps:o}=F({role:`dialog`},a);return T(`div`,{className:K(`charcoal-modal-dialog`,n),role:o.role,"data-bottom-sheet":t,tabIndex:o.tabIndex,"aria-labelledby":o[`aria-labelledby`],onBlur:o.onBlur,"data-size":e,ref:a,...r})}),Pe=t.createContext(null);function Fe(e,t,n=!1){f(()=>{if(t&&e){let t=e.style.paddingRight,r=e.style.overflow;return e.style.paddingRight=`${window.innerWidth-e.clientWidth}px`,e.style.overflow=n?`clip`:`hidden`,()=>{e.style.paddingRight=t,e.style.overflow=r}}},[e,t,n])}function Ie(e,n,r){let{overlayProps:i,underlayProps:a}=S({...e,isOpen:n.isOpen,onClose:n.onClose,shouldCloseOnInteractOutside:()=>!1},r);return Fe(typeof document<`u`?document.body:null,n.isOpen,e.overflowClip),C(),t.useEffect(()=>{if(n.isOpen&&r.current)return x([r.current])},[n.isOpen,r]),{modalProps:i,underlayProps:a}}function Le(){return typeof window<`u`}function Re(){let[e,n]=t.useState(Le()?window.innerWidth:null);return t.useEffect(()=>{let e=()=>{n(window.innerWidth)};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}}),e}const ze=o(function({children:e,zIndex:n=10,portalContainer:r,...i},a){let{title:o,size:s=`M`,bottomSheet:c=!1,isDismissable:l,onClose:u,className:d,isOpen:f=!1,closeButtonAriaLabel:p=`Close`}=i,m=A(a),{modalProps:h,underlayProps:g}=Ie({...i,isKeyboardDismissDisabled:l===void 0||l===!1},{onClose:u,isOpen:f},m),_=(Re()??1/0)<744,v=_&&c!==!1,b=!_||c!==!0,x=P(f,{from:{transform:`translateY(100%)`,backgroundColor:`rgba(0, 0, 0, 0)`,overflow:`hidden`},enter:{transform:`translateY(0%)`,backgroundColor:`rgba(0, 0, 0, 0.4)`},update:{overflow:`auto`},leave:{transform:`translateY(100%)`,backgroundColor:`rgba(0, 0, 0, 0)`,overflow:`hidden`},config:v?{duration:400,easing:N.easeOutQuart}:{duration:0}}),S=t.useRef(null),C=t.useCallback(e=>{e.currentTarget===e.target&&u()},[u]);return x(({backgroundColor:t,overflow:i,transform:a},f)=>f&&T(y,{portalContainer:r,children:T(M.div,{className:`charcoal-modal-background`,ref:S,...g,style:v?{backgroundColor:t,overflow:i,zIndex:n}:{zIndex:n},"data-bottom-sheet":c,onClick:C,children:T(Pe.Provider,{value:S.current,children:T(Be,{ref:m,...h,style:v?{transform:a}:{},size:s,bottomSheet:c,className:d,children:E(He.Provider,{value:{titleProps:{},title:o,close:u,showDismiss:b,bottomSheet:c},children:[e,l===!0&&T(Ue,{"aria-label":p,onClick:u})]})})})})}))}),Be=M(Ne);var Ve=c(ze);const He=t.createContext({titleProps:{},title:``,close:void 0,showDismiss:!0,bottomSheet:!1});function Ue(e){return T(q,{className:`charcoal-modal-close-button`,size:`S`,icon:`24/Close`,type:`button`,...e})}function We(){let e=u(He);return T(`div`,{className:`charcoal-modal-header-root`,"data-bottom-sheet":e.bottomSheet,children:T(`div`,{className:`charcoal-modal-header-title`,children:e.title})})}const Ge=X(`charcoal-modal-align`),Ke=X(`charcoal-modal-body`),qe=X(`charcoal-modal-buttons`);var Je=c(o(function({size:e=48,padding:t=16,transparent:n=!1,...r},i){let a=K(`charcoal-loading-spinner`,r.className);return T(`div`,{role:`progressbar`,style:{"--charcoal-loading-spinner-size":`${e}px`,"--charcoal-loading-spinner-padding":`${t}px`},"data-transparent":n,className:a,ref:i,children:T(Ye,{})})}));const Ye=o(function({once:e=!1},t){let n=h(null);return p(t,()=>({restart:()=>{n.current&&(n.current.dataset.resetAnimation=`true`,n.current.offsetWidth,delete n.current.dataset.resetAnimation)}})),T(`div`,{role:`presentation`,ref:n,"data-once":e,className:`charcoal-loading-spinner-icon`})}),Q=()=>null;function Xe(e){let t=h(null),n=e.popoverRef===void 0?t:e.popoverRef,{popoverProps:r,underlayProps:i}=w({triggerRef:e.triggerRef,popoverRef:n,containerPadding:16},{close:e.onClose,isOpen:e.isOpen,open:Q,setOpen:Q,toggle:Q});return Fe(u(Pe),e.isOpen),e.isOpen?E(y,{portalContainer:document.body,children:[T(`div`,{...i,...e.inertWorkaround?{"data-react-aria-top-layer":!0,onClick:e.onClose}:{},style:{position:`fixed`,zIndex:typeof r.style?.zIndex==`number`?r.style.zIndex-1:99999,inset:0}}),E(`div`,{...r,ref:n,className:`charcoal-popover`,children:[T(v,{onDismiss:()=>e.onClose()}),T(`div`,{tabIndex:0,onFocus:e.onClose}),e.children,T(`div`,{tabIndex:0,onFocus:e.onClose}),T(v,{onDismiss:()=>e.onClose()})]})]}):null}function Ze({children:e,...t}){let n=h(null);return f(()=>{t.isOpen&&n.current&&t.triggerRef.current&&(n.current.style.width=`${t.triggerRef.current.clientWidth}px`)},[t.triggerRef,t.isOpen]),f(()=>{if(t.isOpen)if(t.value!==void 0&&t.value!==``){let e=window.scrollY,n=window.scrollX;document.querySelector(`[data-key="${t.value.toString()}"]`)?.focus(),window.scrollTo(n,e)}else{let e=n.current?.querySelector(`[role='option']`);e instanceof HTMLElement&&e.focus()}},[t.value,t.isOpen]),T(Xe,{isOpen:t.isOpen,onClose:t.onClose,popoverRef:n,triggerRef:t.triggerRef,inertWorkaround:t.inertWorkaround,children:e})}function Qe(e,n){let r=t.Children.toArray(e);for(let e=0;e<r.length;e++){let i=r[e];if(t.isValidElement(i)){if(`value`in i.props&&i.props.value===n&&`children`in i.props)return i.props.children;if(`children`in i.props){let e=Qe(i.props.children,n);if(e!==void 0)return e}}}}const $=a({root:void 0,value:``,propsArray:[],setValue:e=>{}});function $e(e){let n=t.Children.toArray(e),r=[];for(let e=0;e<n.length;e++){let i=n[e];if(t.isValidElement(i)){let e=i.props;`value`in e&&typeof e.value==`string`&&r.push({disabled:e.disabled,value:e.value}),`children`in e&&e.children&&r.push(...$e(e.children))}}return r}function et(e){let t=h(null),n=m(()=>$e(e.children),[e.children]);return T(`ul`,{className:`charcoal-menu-list`,ref:t,children:T($.Provider,{value:{value:e.value??``,root:t,propsArray:n,setValue:t=>{e.onChange?.(t)}},children:e.children})})}function tt({onChange:e,showLabel:t=!1,selectRef:n,...r}){let i=h(null),[a,o]=g(!1),s=Qe(r.children,r.value),c=m(()=>r.placeholder!==void 0&&s===void 0,[s,r.placeholder]),u=$e(r.children),d=m(()=>u.some(e=>e.value===r.value),[u,r.value]),{visuallyHiddenProps:f}=j(),p=l(t=>{e(t.target.value)},[e]),_=k(),v=k();return E(`div`,{className:K(`charcoal-dropdown-selector-root`,r.className),"aria-disabled":r.disabled,children:[T(Y,{id:_,label:r.label,required:r.required,requiredText:r.requiredText,subLabel:r.subLabel,...t?{}:f}),T(`div`,{...f,"aria-hidden":`true`,children:E(`select`,{name:r.name,value:r.value,onChange:p,tabIndex:-1,ref:n,children:[!d&&T(`option`,{value:r.value,children:r.value}),u.map(e=>T(`option`,{value:e.value,disabled:e.disabled,children:e.value},e.value))]})}),E(`button`,{className:`charcoal-dropdown-selector-button`,"aria-labelledby":_,"aria-invalid":r.invalid,"aria-describedby":r.assistiveText===void 0?void 0:v,disabled:r.disabled,onClick:()=>{r.disabled!==!0&&o(!0)},ref:i,type:`button`,"data-active":a,children:[T(`span`,{className:`charcoal-ui-dropdown-selector-text`,"data-placeholder":c,children:c?r.placeholder:s}),T(J,{className:`charcoal-ui-dropdown-selector-icon`,name:`16/Menu`})]}),a&&T(Ze,{isOpen:a,onClose:()=>o(!1),triggerRef:i,value:r.value,inertWorkaround:r.inertWorkaround,children:T(et,{value:r.value,onChange:t=>{e(t),o(!1)},children:r.children})}),r.assistiveText!==void 0&&T(Z,{"data-invalid":r.invalid===!0,id:v,children:r.assistiveText})]})}const nt=o(function({as:e,className:t,...n},r){return T(m(()=>e??`li`,[e]),{className:K(`charcoal-list-item`,t),ref:r,...n})});function rt(e,t){if(t.scrollHeight>t.clientHeight){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();n.bottom>r.bottom?t.scrollTo({top:t.scrollTop+n.bottom-r.bottom}):n.top<r.top&&t.scrollTo({top:t.scrollTop-(r.top-n.top)})}else it(e)}function it(e){let t=e.getBoundingClientRect();t.top>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)||e.scrollIntoView({block:`nearest`})}function at(e){let{setValue:t,root:n,propsArray:r}=u($),i=l(()=>{e!==void 0&&t(e)},[e,t]);return[l(t=>{if(t.key===`Enter`)i();else if(t.key===`ArrowUp`||t.key===`ArrowDown`){let i=t.key===`ArrowDown`;if(t.preventDefault(),!r||e===void 0)return;let a=r.map(e=>e.value).filter(e=>e),o=a.indexOf(e);if(o===-1)return;for(let e=0;e<a.length;e++){let e=i?o+1>=a.length?a[0]:a[o+1]:o-1<0?a[a.length-1]:a[o-1],t=n?.current?.querySelector(`[data-key='${e}']`);if(t instanceof HTMLElement){if(t.ariaDisabled===`true`){o+=i?1:-1;continue}t.focus({preventScroll:!0}),n?.current?.parentElement&&rt(t,n.current.parentElement);break}}}},[i,r,e,n]),i]}const ot=o(function({className:e,value:t,disabled:n,...r},i){let[a,o]=at(t);return T(nt,{...r,ref:i,"data-key":t,onKeyDown:a,onClick:n===!0?void 0:o,tabIndex:-1,"aria-disabled":n,role:`option`,children:r.children})});function st(e){let{value:t}=u($),n=e.value===t,{children:r,secondary:i,...a}=e,o=e.contentFullWidth?`charcoal-dropdown-selector-menu-fullwidth`:``;return T(ot,{...a,"aria-selected":n,children:E(`div`,{className:o,children:[E(`div`,{className:`charcoal-dropdown-selector-menu-item-container ${o}`,children:[n&&T(J,{className:`charcoal-dropdown-selector-menu-item-icon`,name:`16/Check`}),T(`span`,{className:`charcoal-dropdown-selector-menu-item ${o}`,"data-selected":n,children:r})]}),i&&T(`span`,{className:`charcoal-dropdown-selector-menu-secondary`,children:i})]})})}function ct(e){return E(`li`,{className:`charcoal-menu-item-group`,role:`presentation`,children:[T(`span`,{children:e.text}),T(`ul`,{role:`group`,children:e.children})]})}const lt=a(null),ut=({value:e,children:t})=>T(lt.Provider,{value:e,children:t}),dt=()=>{let e=u(lt);if(e===null)throw Error("`<RadioProvider>` is not likely mounted.");return e};var ft=c(o(function(e,t){let n=K(`charcoal-segmented-control`,e.className),r=m(()=>({...e,isDisabled:e.disabled,isReadOnly:e.readonly,isRequired:e.required,"aria-label":e.name}),[e]),i=I(r),{radioGroupProps:a}=ee(r,i),o=m(()=>e.data.map(e=>typeof e==`string`?{value:e,label:e}:e),[e.data]);return T(`div`,{ref:t,...a,className:n,"data-uniform-segment-width":e.uniformSegmentWidth,"data-full-width":e.fullWidth,children:T(ut,{value:i,children:o.map(t=>T(pt,{value:t.value,disabled:t.disabled,uniformSegmentWidth:e.uniformSegmentWidth,children:t.label},t.value))})})}));const pt=e=>{let t=dt(),n=h(null),{inputProps:r,isDisabled:i,isSelected:a}=L(m(()=>({value:e.value,isDisabled:e.disabled,children:e.children}),[e]),t,n);return E(`label`,{className:`charcoal-segmented-control-radio__label`,"aria-disabled":i||t.isReadOnly,"data-checked":a,"data-uniform-segment-width":e.uniformSegmentWidth,"data-full-width":e.fullWidth,children:[T(`input`,{className:`charcoal-segmented-control-radio__input`,...r,ref:n}),e.children]})};var mt=c(o(function({onChange:e,checked:t,invalid:n,className:r,rounded:i,...a},o){let s=l(t=>{let n=t.currentTarget;e?.(n.checked)},[e]);return T(`input`,{className:K(`charcoal-checkbox-input`,r),ref:o,type:`checkbox`,onChange:s,"aria-invalid":n,checked:t,"data-rounded":i,...a})}));const ht=n.memo(function({className:e,children:t,input:n,id:r,disabled:i}){let a=K(`charcoal-checkbox__label`,e);return E(`label`,{htmlFor:r,"aria-disabled":i,className:a,children:[n,T(`div`,{className:`charcoal-checkbox__label_div`,children:t})]})});var gt=c(o(function({disabled:e,className:t,id:n,children:r,...i},a){let o=k(n),s=r===void 0,c=T(mt,{...i,className:s?t:void 0,disabled:e,id:o,ref:a});return s?c:T(ht,{className:t,disabled:e,id:o,input:c,children:r})})),_t=c(o(function({component:e,label:t,translatedLabel:n,bgColor:r=`#7ACCB1`,bgImage:i,size:a=`M`,status:o=`default`,...s},c){let l=A(c),u=n!==void 0&&n.length>0,d=K(`charcoal-tag-item`,`charcoal-tag-item__bg`,s.className),f=i!==void 0&&i.length>0?`image`:`color`,p=f===`color`?r:`url(${i??``})`;return E(m(()=>e??`button`,[e]),{...s,ref:l,className:d,"data-state":o,"data-bg-variant":f,"data-size":u?`M`:a,style:{"--charcoal-tag-item-bg":p},children:[E(`div`,{className:`charcoal-tag-item__label`,"data-has-translate":u,children:[u&&T(`span`,{className:`charcoal-tag-item__label__translated`,children:n}),T(`span`,{className:`charcoal-tag-item__label__text`,"data-has-translate":u,children:t})]}),o===`active`&&T(J,{name:`16/Remove`})]})}));function vt({children:e,context:t=`section`,className:n}){return E(`div`,{className:K(`charcoal-hint-text`,n),"data-context":t,children:[T(`div`,{className:`charcoal-hint-text-icon`,children:T(J,{name:`16/Info`})}),T(`p`,{className:`charcoal-hint-text-message`,children:e})]})}const yt=(e,t,n)=>{if(!e)return;let r=t??St(n);if(r)return r},bt=e=>s(e)&&!!e.props.children,xt=e=>e==null||typeof e==`boolean`||JSON.stringify(e)===`{}`?``:e.toString(),St=e=>!Array.isArray(e)&&!s(e)?xt(e):r.toArray(e).reduce((e,t)=>{let n=``;return n=s(t)&&bt(t)?St(t.props.children):s(t)&&!bt(t)?``:xt(t),e.concat(n)},``);function Ct(e){"use memo";let t=R(32),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({lineHeight:r,lineLimit:a,children:n,title:l,hyphens:o,showTooltip:s,useNowrap:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?1:a,d=o===void 0?`auto`:o,f=s===void 0?!0:s,p=c===void 0?!1:c,m;t[9]!==n||t[10]!==f||t[11]!==l?(m=yt(f,l,n),t[9]=n,t[10]=f,t[11]=l,t[12]=m):m=t[12];let h=m,g=K(`charcoal-text-ellipsis`,i.className),_=r!==void 0,v;t[13]===p?v=t[14]:(v=p?{"data-use-nowrap":p}:{},t[13]=p,t[14]=v);let y;t[15]!==_||t[16]!==r?(y=_&&{"--charcoal-text-ellipsis-line-height":`${r}px`},t[15]=_,t[16]=r,t[17]=y):y=t[17];let b;t[18]!==d||t[19]!==u||t[20]!==i.style||t[21]!==y?(b={...y,"--charcoal-text-ellipsis-line-limit":u,hyphens:d,...i.style},t[18]=d,t[19]=u,t[20]=i.style,t[21]=y,t[22]=b):b=t[22];let x=b,S;return t[23]!==n||t[24]!==g||t[25]!==h||t[26]!==_||t[27]!==u||t[28]!==i||t[29]!==v||t[30]!==x?(S=T(`div`,{...i,className:g,"data-line-limit":u,"data-has-line-height":_,...v,style:x,title:h,children:n}),t[23]=n,t[24]=g,t[25]=h,t[26]=_,t[27]=u,t[28]=i,t[29]=v,t[30]=x,t[31]=S):S=t[31],S}function wt(e,t,n){"use memo";let r=R(7),i=n===void 0?7:n;process.env.NODE_ENV!==`production`&&(D((e|0)===e,`\`page\` must be integer (${e})`),D((t|0)===t,`\`pageCount\` must be integer (${t})`),D(i===5||i===7,`\`pageRangeDisplayed\` must be 5 or 7 (${i})`));let a=Math.min(t,Math.max(e+Math.floor(i/2),i)),o;if(a<=i){let e;r[0]===a?e=r[1]:(e=Array.from({length:1+a-1},Tt),r[0]=a,r[1]=e),o=e}else{let e=a-(i-1)+2,t;if(r[2]!==e||r[3]!==a){let n;r[5]===e?n=r[6]:(n=(t,n)=>e+n,r[5]=e,r[6]=n),t=[1,`...`,...Array.from({length:1+a-e},n)],r[2]=e,r[3]=a,r[4]=t}else t=r[4];o=t}let s=o;return d(s),s}function Tt(e,t){return 1+t}const Et=a(null);function Dt(){let e=u(Et);if(e==null)throw Error(`Pagination components must be used within a Pagination component`);return e}function Ot(e){"use memo";let t=R(15),{direction:n,ariaLabel:r}=e,{page:i,pageCount:a,size:o,isLinkMode:s,makeUrl:c,LinkComponent:l,makeClickHandler:u,linkProps:d}=Dt(),f=n===`prev`,p=f?Math.max(1,i-1):Math.min(a,i+1),m=f?i<=1:i>=a,h=K(`charcoal-pagination-nav-button`,d?.className),g=f?`24/Prev`:`24/Next`,_;t[0]!==l||t[1]!==m||t[2]!==s||t[3]!==d||t[4]!==u||t[5]!==c||t[6]!==h||t[7]!==p?(_=s&&c?{component:l,href:c(p),"aria-disabled":m,...d,className:h}:{disabled:m,onClick:u(p),className:h},t[0]=l,t[1]=m,t[2]=s,t[3]=d,t[4]=u,t[5]=c,t[6]=h,t[7]=p,t[8]=_):_=t[8];let v;return t[9]!==r||t[10]!==m||t[11]!==o||t[12]!==g||t[13]!==_?(v=T(q,{icon:g,size:o,hidden:m,"aria-label":r,..._}),t[9]=r,t[10]=m,t[11]=o,t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function kt(e){"use memo";let t=R(19),{value:n}=e,{page:r,size:i,isLinkMode:a,makeUrl:o,LinkComponent:s,makeClickHandler:c,linkProps:l}=Dt(),u=K(`charcoal-pagination-button`,l?.className);if(n===`...`){let e;return t[0]===i?e=t[1]:(e=T(q,{icon:`24/Dot`,size:i,disabled:!0,className:`charcoal-pagination-spacer`,"aria-hidden":!0}),t[0]=i,t[1]=e),e}if(n===r){let e;return t[2]===n?e=t[3]:(e=T(`span`,{className:`charcoal-pagination-button`,"aria-current":`page`,children:n}),t[2]=n,t[3]=e),e}if(typeof n!=`number`)return null;if(a&&o){let e;t[4]!==o||t[5]!==n?(e=o(n),t[4]=o,t[5]=n,t[6]=e):e=t[6];let r;return t[7]!==s||t[8]!==l||t[9]!==u||t[10]!==e||t[11]!==n?(r=T(s,{href:e,...l,className:u,children:n}),t[7]=s,t[8]=l,t[9]=u,t[10]=e,t[11]=n,t[12]=r):r=t[12],r}let d;t[13]!==c||t[14]!==n?(d=c(n),t[13]=c,t[14]=n,t[15]=d):d=t[15];let f;return t[16]!==d||t[17]!==n?(f=T(`button`,{type:`button`,className:`charcoal-pagination-button`,onClick:d,children:n}),t[16]=d,t[17]=n,t[18]=f):f=t[18],f}function At(e){"use memo";let t=R(40),n,r,i,a,o,s,c,l,u,d,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12]):({page:s,pageCount:c,pageRangeDisplayed:l,size:u,onChange:o,makeUrl:i,component:d,linkProps:r,className:n,ariaLabelNext:f,ariaLabelPrev:p,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p);let m=u===void 0?`M`:u,h=d===void 0?`a`:d,g=f===void 0?`Next`:f,_=p===void 0?`Previous`:p,v=wt(s,c,l),y=i!==void 0,b;t[13]===o?b=t[14]:(b=e=>()=>o?.(e),t[13]=o,t[14]=b);let x=b,S=K(`charcoal-pagination`,n),C;t[15]!==h||t[16]!==y||t[17]!==r||t[18]!==x||t[19]!==i||t[20]!==s||t[21]!==c||t[22]!==m?(C={page:s,pageCount:c,size:m,isLinkMode:y,makeUrl:i,LinkComponent:h,makeClickHandler:x,linkProps:r},t[15]=h,t[16]=y,t[17]=r,t[18]=x,t[19]=i,t[20]=s,t[21]=c,t[22]=m,t[23]=C):C=t[23];let w=C,D;t[24]===_?D=t[25]:(D=T(Ot,{direction:`prev`,ariaLabel:_}),t[24]=_,t[25]=D);let O;t[26]===v?O=t[27]:(O=v.map(jt),t[26]=v,t[27]=O);let k;t[28]===g?k=t[29]:(k=T(Ot,{direction:`next`,ariaLabel:g}),t[28]=g,t[29]=k);let A;t[30]!==S||t[31]!==a||t[32]!==m||t[33]!==k||t[34]!==D||t[35]!==O?(A=E(`nav`,{"data-size":m,"aria-label":`Pagination`,...a,className:S,children:[D,O,k]}),t[30]=S,t[31]=a,t[32]=m,t[33]=k,t[34]=D,t[35]=O,t[36]=A):A=t[36];let j;return t[37]!==A||t[38]!==w?(j=T(Et.Provider,{value:w,children:A}),t[37]=A,t[38]=w,t[39]=j):j=t[39],j}function jt(e){return T(kt,{value:e},e)}export{me as Button,V as CharcoalProvider,gt as Checkbox,he as Clickable,st as DropdownMenuItem,tt as DropdownSelector,vt as HintText,J as Icon,q as IconButton,Je as LoadingSpinner,Ye as LoadingSpinnerIcon,ot as MenuItem,ct as MenuItemGroup,Ve as Modal,Ge as ModalAlign,Ke as ModalBody,qe as ModalButtons,Ue as ModalCloseButton,We as ModalHeader,Se as MultiSelect,Ce as MultiSelectGroup,b as OverlayProvider,ye as Radio,be as RadioGroup,B as SSRProvider,ft as SegmentedControl,pe as SetThemeScript,Ee as Switch,_t as TagItem,je as TextArea,Ae as TextField,At as UnstablePagination,Ct as UnstableTextEllipsis,oe as getThemeSync,fe as makeSetThemeScriptCode,ie as prefersColorScheme,re as themeSelector,ne as themeSetter,ce as useLocalStorage,de as useMedia,se as useTheme,ae as useThemeSetter};
|
|
11
|
+
`}function fe({localStorageKey:e=q.localStorageKey,rootAttribute:t=q.rootAttribute}){return T(`script`,{dangerouslySetInnerHTML:{__html:de({localStorageKey:e,rootAttribute:t})}})}const q={localStorageKey:H,rootAttribute:U};function J(...e){return m(()=>e.filter(e=>e).join(` `),[e])}const pe=o(function({variant:e,fullWidth:t,size:n,className:r,component:i,isActive:a,...o},s){let c=m(()=>i??`button`,[i]),l=J(`charcoal-button`,r);return T(c,{...o,className:l,"data-variant":e,"data-size":n,"data-full-width":t,"data-active":a,ref:s})}),me=o(function({component:e,...t},n){let r=J(`charcoal-clickable`,t.className);return T(m(()=>e??`button`,[e]),{...t,ref:n,className:r})}),Y=o(function({variant:e=`Default`,size:t=`M`,icon:n,isActive:r=!1,component:i,...a},o){he(t,n);let s=m(()=>i??`button`,[i]),c=J(`charcoal-icon-button`,a.className);return T(s,{...a,ref:o,className:c,"data-size":t,"data-active":r,"data-variant":e,children:T(`pixiv-icon`,{name:n})})});function he(e,t){let n;switch(e){case`XS`:n=`16`;break;case`S`:case`M`:n=`24`;break}let r=/^\d*/u.exec(t);if(r==null)throw Error(`Invalid icon name`);let[i]=r;i!==n&&console.warn(`IconButton with size "${e}" expect icon size "${n}, but got "${i}"`)}const ge=t.createContext({name:void 0,selected:void 0,disabled:!1,readonly:!1,invalid:!1,onChange(){throw Error(`Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?`)}});var _e=c(o(function({onChange:e,invalid:t,className:n,...r},i){let a=l(t=>{let n=t.currentTarget;e?.(n.value)},[e]);return T(`input`,{className:J(`charcoal-radio-input`,n),ref:i,type:`radio`,onChange:a,"aria-invalid":t,...r})})),ve=c(o(function({value:e,disabled:t=!1,children:n,...r},i){let{name:a,selected:o,disabled:s,readonly:c,invalid:l,onChange:d}=u(ge),f=J(`charcoal-radio__label`,r.className);D(a!==void 0,`"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`);let p=e===o,m=t||s,h=c&&!p;return E(`label`,{"aria-disabled":m||h,className:f,children:[T(_e,{name:a,value:e,checked:p,"aria-invalid":l,onChange:d,disabled:m||h,ref:i}),n!=null&&T(`div`,{className:`charcoal-radio__label_div`,children:n})]})}));const ye=o(function({value:e,label:t,name:n,onChange:r,disabled:i,readonly:a,invalid:o,children:s,"aria-orientation":c=`vertical`,...u},d){let f=J(`charcoal-radio-group`,u.className),p=l(e=>{r(e)},[r]),h=m(()=>({name:n,selected:e,disabled:i??!1,readonly:a??!1,invalid:o??!1,onChange:p}),[i,p,o,n,a,e]);return T(ge.Provider,{value:h,children:T(`div`,{role:`radiogroup`,"aria-disabled":i,"aria-invalid":o,"aria-label":t,"aria-labelledby":u[`aria-labelledby`],"aria-orientation":c,className:f,ref:d,children:s})})}),be=a({name:void 0,selected:[],disabled:!1,readonly:!1,invalid:!1,onChange(){throw Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?")}}),X=t.forwardRef(function({name:e,scale:t,unsafeNonGuidelineScale:n,className:r,...i},a){return T(`pixiv-icon`,{ref:a,name:e,scale:t,"unsafe-non-guideline-scale":n,class:r,...i})});var xe=c(o(function({value:e,disabled:t=!1,onChange:n,variant:r=`default`,className:i,children:a},o){let{name:s,selected:c,disabled:d,readonly:f,invalid:p,onChange:m}=u(be);D(s!==void 0,`"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`);let h=c.includes(e),g=t||d||f,_=l(t=>{t.currentTarget instanceof HTMLInputElement&&(n&&n({value:e,selected:t.currentTarget.checked}),m({value:e,selected:t.currentTarget.checked}))},[n,m,e]);return E(`label`,{"aria-disabled":g,className:J(`charcoal-multi-select`,i),children:[T(`input`,{className:`charcoal-multi-select-input`,name:s,value:e,type:`checkbox`,checked:h,disabled:g,onChange:_,"data-overlay":r===`overlay`,"aria-invalid":p,ref:o}),T(`div`,{className:`charcoal-multi-select-overlay`,"data-overlay":r===`overlay`,"aria-invalid":p,"aria-hidden":!0,children:T(X,{name:`24/Check`,"unsafe-non-guideline-scale":16/24})}),!!a&&T(`div`,{className:`charcoal-multi-select-label`,children:a})]})}));function Se({className:e,style:t,name:n,label:r,selected:i,onChange:a,disabled:o=!1,readonly:s=!1,invalid:c=!1,children:u}){let d=l(e=>{let t=i.indexOf(e.value);e.selected?t<0&&a([...i,e.value]):t>=0&&a([...i.slice(0,t),...i.slice(t+1)])},[a,i]);return T(be.Provider,{value:{name:n,selected:Array.from(new Set(i)),disabled:o,readonly:s,invalid:c,onChange:d},children:T(`div`,{className:e,style:t,"aria-label":r,"data-testid":`SelectGroup`,children:u})})}const Ce=o(function({onChange:e,className:t,...n},r){let i=l(t=>{let n=t.currentTarget;e?.(n.checked)},[e]);return T(`input`,{ref:r,className:J(`charcoal-switch-input`,t),type:`checkbox`,onChange:i,...n})}),we=t.memo(function({children:e,className:t,disabled:n,id:r,input:i}){return E(`label`,{htmlFor:r,className:J(`charcoal-switch__label`,t),"aria-disabled":n,children:[i,T(`div`,{className:`charcoal-switch__label_div`,children:e})]})});var Te=c(o(function({children:e,onChange:t,disabled:n,className:r,id:i,...a},o){let s=k(i),c=e===void 0,l=T(Ce,{...a,disabled:n,className:c?r:void 0,id:s,onChange:t,ref:o,role:`switch`,type:`checkbox`});return c?l:T(we,{className:r,disabled:n,id:s,input:l,children:e})}));const Z=t.forwardRef(function({style:e,className:t,label:n,required:r=!1,requiredText:i,subLabel:a,...o},s){return E(`div`,{style:e,className:J(`charcoal-field-label-root`,t),children:[T(`label`,{ref:s,className:`charcoal-field-label`,...o,children:n}),r&&T(`div`,{className:`charcoal-field-label-required-text`,children:i}),T(`div`,{className:`charcoal-field-label-sub-label`,children:T(`span`,{children:a})})]})});function Ee(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!==null&&(n.current=t)}}function De(e){return Array.from(e).length}function Oe(e,t){f(()=>{let n=e.current;if(n){let e=e=>{e.target!==t.current&&t.current?.focus()};return n.addEventListener(`click`,e),()=>{n.removeEventListener(`click`,e)}}})}function Q(e){return o(function({className:t,...n},r){return T(`div`,{className:J(e,t),ref:r,...n})})}const $=Q(`charcoal-text-field-assistive-text`),ke=t.forwardRef(function({assistiveText:e,className:t,disabled:n=!1,label:r=``,maxLength:i,onChange:a,prefix:o=null,required:s,requiredText:c,showCount:u=!1,showLabel:d=!1,subLabel:p,suffix:m=null,type:_=`text`,invalid:v,value:y,getCount:b=De,...x},S){let C=h(null),{visuallyHiddenProps:w}=j(),[D,A]=g(b(y??``)),M=l(e=>{let t=e.target.value,n=b(t);i!==void 0&&n>i||(A(n),a?.(t))},[b,i,a]);f(()=>{A(b(y??``))},[b,y]);let N=h(null);Oe(N,C);let P=k(x.id),F=k(),I=k(),L=e!=null&&e.length!==0;return E(`div`,{className:J(`charcoal-text-field-root`,t),"aria-disabled":n,children:[T(Z,{htmlFor:P,id:I,label:r,required:s,requiredText:c,subLabel:p,...d?{}:w}),E(`div`,{className:`charcoal-text-field-container`,"aria-disabled":n===!0?!0:void 0,"data-invalid":v===!0,ref:N,children:[o&&T(`div`,{className:`charcoal-text-field-prefix`,children:o}),T(`div`,{className:`charcoal-text-field-input-root`,children:T(`input`,{className:`charcoal-text-field-input`,"aria-describedby":L?F:void 0,"aria-invalid":v,"aria-labelledby":I,id:P,"data-invalid":v===!0,maxLength:i,onChange:M,disabled:n,ref:O(S,C),type:_,value:y,...x})}),(m||u)&&E(`div`,{className:`charcoal-text-field-suffix`,children:[m,u&&T(`span`,{className:`charcoal-text-field-line-counter`,children:i===void 0?D:`${D}/${i}`})]})]}),L&&T($,{"data-invalid":v===!0,id:F,children:e})]})}),Ae=o(function({onChange:e,className:t,value:n,showCount:r=!1,showLabel:i=!1,label:a=``,requiredText:o,subLabel:s,disabled:c=!1,required:u,assistiveText:d,maxLength:_,autoHeight:v=!1,rows:y=4,maxRows:b,invalid:x,getCount:S=De,defaultValue:C,imperativeRef:w,...D},O){let[A,M]=g(y),[N,P]=g(S(n??C?.toString()??``)),F=h(null),I=h(null);Oe(I,F);let{visuallyHiddenProps:L}=j(),R=n===void 0,z=m(()=>v||b&&b>=0,[v,b]),ee=J(`charcoal-text-area-root`,t),B=d!=null&&d.length!==0,V=l(e=>{let t=(`${e.value}\n`.match(/\n/gu)?.length??0)||1,n=b!==void 0&&b>=1,r=y<=t?t:y;if(!n){M(r);return}M(Math.min(r,b))},[y,b]),H=l(e=>{let t=S(e.value);return R&&P(t),z&&V(e),t},[S,z,R,V]),U=l(t=>{let n=t.currentTarget.value,r=S(n);_!==void 0&&r>_||(H(t.currentTarget),e?.(n))},[S,_,e,H]);p(w,()=>({setValue:e=>{F.current!==null&&(F.current.value=e,H(F.current))},sync:()=>{F.current!==null&&H(F.current)}}),[H]);let W=k(D.id),G=k(),K=k();return f(()=>{R||P(S(n)),z&&F.current!==null&&V(F.current)},[R,n,S,z,F,V]),E(`div`,{className:ee,"aria-disabled":c,children:[T(Z,{htmlFor:W,id:K,label:a,required:u,requiredText:o,subLabel:s,...i?{}:L}),E(`div`,{className:`charcoal-text-area-container`,"aria-disabled":c===!0?`true`:void 0,"aria-invalid":x===!0,ref:I,style:{"--charcoal-text-area-rows":`${r?A+1:A}`},children:[T(`textarea`,{className:`charcoal-text-area-textarea`,"aria-describedby":B?G:void 0,"aria-invalid":x,"aria-labelledby":K,id:W,maxLength:_,"data-no-bottom-padding":r,onChange:U,ref:Ee(O,F),rows:A,value:n,disabled:c,defaultValue:C,...D}),r&&T(`span`,{className:`charcoal-text-area-counter`,children:_===void 0?N:`${N}/${_}`})]}),B&&T($,{"data-invalid":x===!0,id:G,children:d})]})});function je(e){let n=t.useRef(null);return t.useEffect(()=>{e&&(typeof e==`function`?e(n.current):e.current=n.current)}),n}const Me=o(function({size:e,bottomSheet:t,className:n,...r},i){let a=je(i),{dialogProps:o}=F({role:`dialog`},a);return T(`div`,{className:J(`charcoal-modal-dialog`,n),role:o.role,"data-bottom-sheet":t,tabIndex:o.tabIndex,"aria-labelledby":o[`aria-labelledby`],onBlur:o.onBlur,"data-size":e,ref:a,...r})}),Ne=t.createContext(null);function Pe(e,t,n=!1){f(()=>{if(t&&e){let t=e.style.paddingRight,r=e.style.overflow;return e.style.paddingRight=`${window.innerWidth-e.clientWidth}px`,e.style.overflow=n?`clip`:`hidden`,()=>{e.style.paddingRight=t,e.style.overflow=r}}},[e,t,n])}function Fe(e,n,r){let{overlayProps:i,underlayProps:a}=S({...e,isOpen:n.isOpen,onClose:n.onClose,shouldCloseOnInteractOutside:()=>!1},r);return Pe(typeof document<`u`?document.body:null,n.isOpen,e.overflowClip),C(),t.useEffect(()=>{if(n.isOpen&&r.current)return x([r.current])},[n.isOpen,r]),{modalProps:i,underlayProps:a}}function Ie(){return typeof window<`u`}function Le(){let[e,n]=t.useState(Ie()?window.innerWidth:null);return t.useEffect(()=>{let e=()=>{n(window.innerWidth)};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}}),e}const Re=o(function({children:e,zIndex:n=10,portalContainer:r,...i},a){let{title:o,size:s=`M`,bottomSheet:c=!1,isDismissable:l,onClose:u,className:d,isOpen:f=!1,closeButtonAriaLabel:p=`Close`}=i,m=A(a),{modalProps:h,underlayProps:g}=Fe({...i,isKeyboardDismissDisabled:l===void 0||l===!1},{onClose:u,isOpen:f},m),_=(Le()??1/0)<744,v=_&&c!==!1,b=!_||c!==!0,x=P(f,{from:{transform:`translateY(100%)`,backgroundColor:`rgba(0, 0, 0, 0)`,overflow:`hidden`},enter:{transform:`translateY(0%)`,backgroundColor:`rgba(0, 0, 0, 0.4)`},update:{overflow:`auto`},leave:{transform:`translateY(100%)`,backgroundColor:`rgba(0, 0, 0, 0)`,overflow:`hidden`},config:v?{duration:400,easing:N.easeOutQuart}:{duration:0}}),S=t.useRef(null),C=t.useCallback(e=>{e.currentTarget===e.target&&u()},[u]);return x(({backgroundColor:t,overflow:i,transform:a},f)=>f&&T(y,{portalContainer:r,children:T(M.div,{className:`charcoal-modal-background`,ref:S,...g,style:v?{backgroundColor:t,overflow:i,zIndex:n}:{zIndex:n},"data-bottom-sheet":c,onClick:C,children:T(Ne.Provider,{value:S.current,children:T(ze,{ref:m,...h,style:v?{transform:a}:{},size:s,bottomSheet:c,className:d,children:E(Ve.Provider,{value:{titleProps:{},title:o,close:u,showDismiss:b,bottomSheet:c},children:[e,l===!0&&T(He,{"aria-label":p,onClick:u})]})})})})}))}),ze=M(Me);var Be=c(Re);const Ve=t.createContext({titleProps:{},title:``,close:void 0,showDismiss:!0,bottomSheet:!1});function He(e){return T(Y,{className:`charcoal-modal-close-button`,size:`S`,icon:`24/Close`,type:`button`,...e})}function Ue(){let e=u(Ve);return T(`div`,{className:`charcoal-modal-header-root`,"data-bottom-sheet":e.bottomSheet,children:T(`div`,{className:`charcoal-modal-header-title`,children:e.title})})}const We=Q(`charcoal-modal-align`),Ge=Q(`charcoal-modal-body`),Ke=Q(`charcoal-modal-buttons`);var qe=c(o(function({size:e=48,padding:t=16,transparent:n=!1,...r},i){let a=J(`charcoal-loading-spinner`,r.className);return T(`div`,{role:`progressbar`,style:{"--charcoal-loading-spinner-size":`${e}px`,"--charcoal-loading-spinner-padding":`${t}px`},"data-transparent":n,className:a,ref:i,children:T(Je,{})})}));const Je=o(function({once:e=!1},t){let n=h(null);return p(t,()=>({restart:()=>{n.current&&(n.current.dataset.resetAnimation=`true`,n.current.offsetWidth,delete n.current.dataset.resetAnimation)}})),T(`div`,{role:`presentation`,ref:n,"data-once":e,className:`charcoal-loading-spinner-icon`})}),Ye=()=>null;function Xe(e){let t=h(null),n=e.popoverRef===void 0?t:e.popoverRef,{popoverProps:r,underlayProps:i}=w({triggerRef:e.triggerRef,popoverRef:n,containerPadding:16},{close:e.onClose,isOpen:e.isOpen,open:Ye,setOpen:Ye,toggle:Ye});return Pe(u(Ne),e.isOpen),e.isOpen?E(y,{portalContainer:document.body,children:[T(`div`,{...i,...e.inertWorkaround?{"data-react-aria-top-layer":!0,onClick:e.onClose}:{},style:{position:`fixed`,zIndex:typeof r.style?.zIndex==`number`?r.style.zIndex-1:99999,inset:0}}),E(`div`,{...r,ref:n,className:`charcoal-popover`,children:[T(v,{onDismiss:()=>e.onClose()}),T(`div`,{tabIndex:0,onFocus:e.onClose}),e.children,T(`div`,{tabIndex:0,onFocus:e.onClose}),T(v,{onDismiss:()=>e.onClose()})]})]}):null}function Ze({children:e,...t}){let n=h(null);return f(()=>{t.isOpen&&n.current&&t.triggerRef.current&&(n.current.style.width=`${t.triggerRef.current.clientWidth}px`)},[t.triggerRef,t.isOpen]),f(()=>{if(t.isOpen)if(t.value!==void 0&&t.value!==``){let e=window.scrollY,n=window.scrollX;document.querySelector(`[data-key="${t.value.toString()}"]`)?.focus(),window.scrollTo(n,e)}else{let e=n.current?.querySelector(`[role='option']`);e instanceof HTMLElement&&e.focus()}},[t.value,t.isOpen]),T(Xe,{isOpen:t.isOpen,onClose:t.onClose,popoverRef:n,triggerRef:t.triggerRef,inertWorkaround:t.inertWorkaround,children:e})}function Qe(e,n){let r=t.Children.toArray(e);for(let e=0;e<r.length;e++){let i=r[e];if(t.isValidElement(i)){if(`value`in i.props&&i.props.value===n&&`children`in i.props)return i.props.children;if(`children`in i.props){let e=Qe(i.props.children,n);if(e!==void 0)return e}}}}const $e=a({root:void 0,value:``,propsArray:[],setValue:e=>{}});function et(e){let n=t.Children.toArray(e),r=[];for(let e=0;e<n.length;e++){let i=n[e];if(t.isValidElement(i)){let e=i.props;`value`in e&&typeof e.value==`string`&&r.push({disabled:e.disabled,value:e.value}),`children`in e&&e.children&&r.push(...et(e.children))}}return r}function tt(e){let t=h(null),n=m(()=>et(e.children),[e.children]);return T(`ul`,{className:`charcoal-menu-list`,ref:t,children:T($e.Provider,{value:{value:e.value??``,root:t,propsArray:n,setValue:t=>{e.onChange?.(t)}},children:e.children})})}function nt({onChange:e,showLabel:t=!1,selectRef:n,...r}){let i=h(null),[a,o]=g(!1),s=Qe(r.children,r.value),c=m(()=>r.placeholder!==void 0&&s===void 0,[s,r.placeholder]),u=et(r.children),d=m(()=>u.some(e=>e.value===r.value),[u,r.value]),{visuallyHiddenProps:f}=j(),p=l(t=>{e(t.target.value)},[e]),_=k(),v=k();return E(`div`,{className:J(`charcoal-dropdown-selector-root`,r.className),"aria-disabled":r.disabled,children:[T(Z,{id:_,label:r.label,required:r.required,requiredText:r.requiredText,subLabel:r.subLabel,...t?{}:f}),T(`div`,{...f,"aria-hidden":`true`,children:E(`select`,{name:r.name,value:r.value,onChange:p,tabIndex:-1,ref:n,children:[!d&&T(`option`,{value:r.value,children:r.value}),u.map(e=>T(`option`,{value:e.value,disabled:e.disabled,children:e.value},e.value))]})}),E(`button`,{className:`charcoal-dropdown-selector-button`,"aria-labelledby":_,"aria-invalid":r.invalid,"aria-describedby":r.assistiveText===void 0?void 0:v,disabled:r.disabled,onClick:()=>{r.disabled!==!0&&o(!0)},ref:i,type:`button`,"data-active":a,children:[T(`span`,{className:`charcoal-ui-dropdown-selector-text`,"data-placeholder":c,children:c?r.placeholder:s}),T(X,{className:`charcoal-ui-dropdown-selector-icon`,name:`16/Menu`})]}),a&&T(Ze,{isOpen:a,onClose:()=>o(!1),triggerRef:i,value:r.value,inertWorkaround:r.inertWorkaround,children:T(tt,{value:r.value,onChange:t=>{e(t),o(!1)},children:r.children})}),r.assistiveText!==void 0&&T($,{"data-invalid":r.invalid===!0,id:v,children:r.assistiveText})]})}const rt=o(function({as:e,className:t,...n},r){return T(m(()=>e??`li`,[e]),{className:J(`charcoal-list-item`,t),ref:r,...n})});function it(e,t){if(t.scrollHeight>t.clientHeight){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();n.bottom>r.bottom?t.scrollTo({top:t.scrollTop+n.bottom-r.bottom}):n.top<r.top&&t.scrollTo({top:t.scrollTop-(r.top-n.top)})}else at(e)}function at(e){let t=e.getBoundingClientRect();t.top>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)||e.scrollIntoView({block:`nearest`})}function ot(e){let{setValue:t,root:n,propsArray:r}=u($e),i=l(()=>{e!==void 0&&t(e)},[e,t]);return[l(t=>{if(t.key===`Enter`)i();else if(t.key===`ArrowUp`||t.key===`ArrowDown`){let i=t.key===`ArrowDown`;if(t.preventDefault(),!r||e===void 0)return;let a=r.map(e=>e.value).filter(e=>e),o=a.indexOf(e);if(o===-1)return;for(let e=0;e<a.length;e++){let e=i?o+1>=a.length?a[0]:a[o+1]:o-1<0?a[a.length-1]:a[o-1],t=n?.current?.querySelector(`[data-key='${e}']`);if(t instanceof HTMLElement){if(t.ariaDisabled===`true`){o+=i?1:-1;continue}t.focus({preventScroll:!0}),n?.current?.parentElement&&it(t,n.current.parentElement);break}}}},[i,r,e,n]),i]}const st=o(function({className:e,value:t,disabled:n,...r},i){let[a,o]=ot(t);return T(rt,{...r,ref:i,"data-key":t,onKeyDown:a,onClick:n===!0?void 0:o,tabIndex:-1,"aria-disabled":n,role:`option`,children:r.children})});function ct(e){let{value:t}=u($e),n=e.value===t,{children:r,secondary:i,...a}=e,o=e.contentFullWidth?`charcoal-dropdown-selector-menu-fullwidth`:``;return T(st,{...a,"aria-selected":n,children:E(`div`,{className:o,children:[E(`div`,{className:`charcoal-dropdown-selector-menu-item-container ${o}`,children:[n&&T(X,{className:`charcoal-dropdown-selector-menu-item-icon`,name:`16/Check`}),T(`span`,{className:`charcoal-dropdown-selector-menu-item ${o}`,"data-selected":n,children:r})]}),i&&T(`span`,{className:`charcoal-dropdown-selector-menu-secondary`,children:i})]})})}function lt(e){return E(`li`,{className:`charcoal-menu-item-group`,role:`presentation`,children:[T(`span`,{children:e.text}),T(`ul`,{role:`group`,children:e.children})]})}const ut=a(null),dt=({value:e,children:t})=>T(ut.Provider,{value:e,children:t}),ft=()=>{let e=u(ut);if(e===null)throw Error("`<RadioProvider>` is not likely mounted.");return e};var pt=c(o(function(e,t){let n=J(`charcoal-segmented-control`,e.className),r=m(()=>({...e,isDisabled:e.disabled,isReadOnly:e.readonly,isRequired:e.required,"aria-label":e.name}),[e]),i=I(r),{radioGroupProps:a}=R(r,i),o=m(()=>e.data.map(e=>typeof e==`string`?{value:e,label:e}:e),[e.data]);return T(`div`,{ref:t,...a,className:n,"data-uniform-segment-width":e.uniformSegmentWidth,"data-full-width":e.fullWidth,children:T(dt,{value:i,children:o.map(t=>T(mt,{value:t.value,disabled:t.disabled,uniformSegmentWidth:e.uniformSegmentWidth,children:t.label},t.value))})})}));const mt=e=>{let t=ft(),n=h(null),{inputProps:r,isDisabled:i,isSelected:a}=L(m(()=>({value:e.value,isDisabled:e.disabled,children:e.children}),[e]),t,n);return E(`label`,{className:`charcoal-segmented-control-radio__label`,"aria-disabled":i||t.isReadOnly,"data-checked":a,"data-uniform-segment-width":e.uniformSegmentWidth,"data-full-width":e.fullWidth,children:[T(`input`,{className:`charcoal-segmented-control-radio__input`,...r,ref:n}),e.children]})};var ht=c(o(function({onChange:e,checked:t,invalid:n,className:r,rounded:i,...a},o){let s=l(t=>{let n=t.currentTarget;e?.(n.checked)},[e]);return T(`input`,{className:J(`charcoal-checkbox-input`,r),ref:o,type:`checkbox`,onChange:s,"aria-invalid":n,checked:t,"data-rounded":i,...a})}));const gt=n.memo(function({className:e,children:t,input:n,id:r,disabled:i}){return E(`label`,{htmlFor:r,"aria-disabled":i,className:J(`charcoal-checkbox__label`,e),children:[n,T(`div`,{className:`charcoal-checkbox__label_div`,children:t})]})});var _t=c(o(function({disabled:e,className:t,id:n,children:r,...i},a){let o=k(n),s=r===void 0,c=T(ht,{...i,className:s?t:void 0,disabled:e,id:o,ref:a});return s?c:T(gt,{className:t,disabled:e,id:o,input:c,children:r})})),vt=c(o(function({component:e,label:t,translatedLabel:n,bgColor:r=`#7ACCB1`,bgImage:i,size:a=`M`,status:o=`default`,...s},c){let l=A(c),u=n!==void 0&&n.length>0,d=J(`charcoal-tag-item`,`charcoal-tag-item__bg`,s.className),f=i!==void 0&&i.length>0?`image`:`color`,p=f===`color`?r:`url(${i??``})`;return E(m(()=>e??`button`,[e]),{...s,ref:l,className:d,"data-state":o,"data-bg-variant":f,"data-size":u?`M`:a,style:{"--charcoal-tag-item-bg":p},children:[E(`div`,{className:`charcoal-tag-item__label`,"data-has-translate":u,children:[u&&T(`span`,{className:`charcoal-tag-item__label__translated`,children:n}),T(`span`,{className:`charcoal-tag-item__label__text`,"data-has-translate":u,children:t})]}),o===`active`&&T(X,{name:`16/Remove`})]})}));function yt({children:e,context:t=`section`,className:n}){return E(`div`,{className:J(`charcoal-hint-text`,n),"data-context":t,children:[T(`div`,{className:`charcoal-hint-text-icon`,children:T(X,{name:`16/Info`})}),T(`p`,{className:`charcoal-hint-text-message`,children:e})]})}const bt=(e,t,n)=>{if(!e)return;let r=t??Ct(n);if(r)return r},xt=e=>s(e)&&!!e.props.children,St=e=>e==null||typeof e==`boolean`||JSON.stringify(e)===`{}`?``:e.toString(),Ct=e=>!Array.isArray(e)&&!s(e)?St(e):r.toArray(e).reduce((e,t)=>{let n=``;return n=s(t)&&xt(t)?Ct(t.props.children):s(t)&&!xt(t)?``:St(t),e.concat(n)},``);function wt(e){"use memo";let t=z(32),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({lineHeight:r,lineLimit:a,children:n,title:l,hyphens:o,showTooltip:s,useNowrap:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?1:a,d=o===void 0?`auto`:o,f=s===void 0?!0:s,p=c===void 0?!1:c,m;t[9]!==n||t[10]!==f||t[11]!==l?(m=bt(f,l,n),t[9]=n,t[10]=f,t[11]=l,t[12]=m):m=t[12];let h=m,g=J(`charcoal-text-ellipsis`,i.className),_=r!==void 0,v;t[13]===p?v=t[14]:(v=p?{"data-use-nowrap":p}:{},t[13]=p,t[14]=v);let y;t[15]!==_||t[16]!==r?(y=_&&{"--charcoal-text-ellipsis-line-height":`${r}px`},t[15]=_,t[16]=r,t[17]=y):y=t[17];let b;t[18]!==d||t[19]!==u||t[20]!==i.style||t[21]!==y?(b={...y,"--charcoal-text-ellipsis-line-limit":u,hyphens:d,...i.style},t[18]=d,t[19]=u,t[20]=i.style,t[21]=y,t[22]=b):b=t[22];let x=b,S;return t[23]!==n||t[24]!==g||t[25]!==h||t[26]!==_||t[27]!==u||t[28]!==i||t[29]!==v||t[30]!==x?(S=T(`div`,{...i,className:g,"data-line-limit":u,"data-has-line-height":_,...v,style:x,title:h,children:n}),t[23]=n,t[24]=g,t[25]=h,t[26]=_,t[27]=u,t[28]=i,t[29]=v,t[30]=x,t[31]=S):S=t[31],S}function Tt(e,t,n){"use memo";let r=z(8);if(r[0]!==`ba14feb6736cfb4c0d0d38e25b9e21619705224ad19f5dc886004a78f422b93d`){for(let e=0;e<8;e+=1)r[e]=Symbol.for(`react.memo_cache_sentinel`);r[0]=`ba14feb6736cfb4c0d0d38e25b9e21619705224ad19f5dc886004a78f422b93d`}let i=n===void 0?7:n;process.env.NODE_ENV!==`production`&&(D((e|0)===e,`\`page\` must be integer (${e})`),D((t|0)===t,`\`pageCount\` must be integer (${t})`),D(i===5||i===7,`\`pageRangeDisplayed\` must be 5 or 7 (${i})`));let a=Math.min(t,Math.max(e+Math.floor(i/2),i)),o;if(a<=i){let e;r[1]===a?e=r[2]:(e=Array.from({length:1+a-1},Et),r[1]=a,r[2]=e),o=e}else{let e=a-(i-1)+2,t;if(r[3]!==e||r[4]!==a){let n;r[6]===e?n=r[7]:(n=(t,n)=>e+n,r[6]=e,r[7]=n),t=[1,`...`,...Array.from({length:1+a-e},n)],r[3]=e,r[4]=a,r[5]=t}else t=r[5];o=t}let s=o;return d(s),s}function Et(e,t){return 1+t}const Dt=a(null);function Ot(){let e=u(Dt);if(e==null)throw Error(`Pagination components must be used within a Pagination component`);return e}function kt(e){"use memo";let t=z(15),{direction:n,ariaLabel:r}=e,{page:i,pageCount:a,size:o,isLinkMode:s,makeUrl:c,LinkComponent:l,makeClickHandler:u,linkProps:d}=Ot(),f=n===`prev`,p=f?Math.max(1,i-1):Math.min(a,i+1),m=f?i<=1:i>=a,h=J(`charcoal-pagination-nav-button`,d?.className),g=f?`24/Prev`:`24/Next`,_;t[0]!==l||t[1]!==m||t[2]!==s||t[3]!==d||t[4]!==u||t[5]!==c||t[6]!==h||t[7]!==p?(_=s&&c?{component:l,href:c(p),"aria-disabled":m,...d,className:h}:{disabled:m,onClick:u(p),className:h},t[0]=l,t[1]=m,t[2]=s,t[3]=d,t[4]=u,t[5]=c,t[6]=h,t[7]=p,t[8]=_):_=t[8];let v;return t[9]!==r||t[10]!==m||t[11]!==o||t[12]!==g||t[13]!==_?(v=T(Y,{icon:g,size:o,hidden:m,"aria-label":r,..._}),t[9]=r,t[10]=m,t[11]=o,t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function At(e){"use memo";let t=z(19),{value:n}=e,{page:r,size:i,isLinkMode:a,makeUrl:o,LinkComponent:s,makeClickHandler:c,linkProps:l}=Ot(),u=J(`charcoal-pagination-button`,l?.className);if(n===`...`){let e;return t[0]===i?e=t[1]:(e=T(Y,{icon:`24/Dot`,size:i,disabled:!0,className:`charcoal-pagination-spacer`,"aria-hidden":!0}),t[0]=i,t[1]=e),e}if(n===r){let e;return t[2]===n?e=t[3]:(e=T(`span`,{className:`charcoal-pagination-button`,"aria-current":`page`,children:n}),t[2]=n,t[3]=e),e}if(typeof n!=`number`)return null;if(a&&o){let e;t[4]!==o||t[5]!==n?(e=o(n),t[4]=o,t[5]=n,t[6]=e):e=t[6];let r;return t[7]!==s||t[8]!==l||t[9]!==u||t[10]!==e||t[11]!==n?(r=T(s,{href:e,...l,className:u,children:n}),t[7]=s,t[8]=l,t[9]=u,t[10]=e,t[11]=n,t[12]=r):r=t[12],r}let d;t[13]!==c||t[14]!==n?(d=c(n),t[13]=c,t[14]=n,t[15]=d):d=t[15];let f;return t[16]!==d||t[17]!==n?(f=T(`button`,{type:`button`,className:`charcoal-pagination-button`,onClick:d,children:n}),t[16]=d,t[17]=n,t[18]=f):f=t[18],f}function jt(e){"use memo";let t=z(40),n,r,i,a,o,s,c,l,u,d,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12]):({page:s,pageCount:c,pageRangeDisplayed:l,size:u,onChange:o,makeUrl:i,component:d,linkProps:r,className:n,ariaLabelNext:f,ariaLabelPrev:p,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p);let m=u===void 0?`M`:u,h=d===void 0?`a`:d,g=f===void 0?`Next`:f,_=p===void 0?`Previous`:p,v=Tt(s,c,l),y=i!==void 0,b;t[13]===o?b=t[14]:(b=e=>()=>o?.(e),t[13]=o,t[14]=b);let x=b,S=J(`charcoal-pagination`,n),C;t[15]!==h||t[16]!==y||t[17]!==r||t[18]!==x||t[19]!==i||t[20]!==s||t[21]!==c||t[22]!==m?(C={page:s,pageCount:c,size:m,isLinkMode:y,makeUrl:i,LinkComponent:h,makeClickHandler:x,linkProps:r},t[15]=h,t[16]=y,t[17]=r,t[18]=x,t[19]=i,t[20]=s,t[21]=c,t[22]=m,t[23]=C):C=t[23];let w=C,D;t[24]===_?D=t[25]:(D=T(kt,{direction:`prev`,ariaLabel:_}),t[24]=_,t[25]=D);let O;t[26]===v?O=t[27]:(O=v.map(Mt),t[26]=v,t[27]=O);let k;t[28]===g?k=t[29]:(k=T(kt,{direction:`next`,ariaLabel:g}),t[28]=g,t[29]=k);let A;t[30]!==S||t[31]!==a||t[32]!==m||t[33]!==k||t[34]!==D||t[35]!==O?(A=E(`nav`,{"data-size":m,"aria-label":`Pagination`,...a,className:S,children:[D,O,k]}),t[30]=S,t[31]=a,t[32]=m,t[33]=k,t[34]=D,t[35]=O,t[36]=A):A=t[36];let j;return t[37]!==A||t[38]!==w?(j=T(Dt.Provider,{value:w,children:A}),t[37]=A,t[38]=w,t[39]=j):j=t[39],j}function Mt(e){return T(At,{value:e},e)}export{pe as Button,V as CharcoalProvider,_t as Checkbox,me as Clickable,ct as DropdownMenuItem,nt as DropdownSelector,yt as HintText,X as Icon,Y as IconButton,qe as LoadingSpinner,Je as LoadingSpinnerIcon,st as MenuItem,lt as MenuItemGroup,Be as Modal,We as ModalAlign,Ge as ModalBody,Ke as ModalButtons,He as ModalCloseButton,Ue as ModalHeader,xe as MultiSelect,Se as MultiSelectGroup,b as OverlayProvider,ve as Radio,ye as RadioGroup,B as SSRProvider,pt as SegmentedControl,fe as SetThemeScript,Te as Switch,vt as TagItem,Ae as TextArea,ke as TextField,jt as UnstablePagination,wt as UnstableTextEllipsis,ae as getThemeSync,de as makeSetThemeScriptCode,re as prefersColorScheme,ne as themeSelector,K as themeSetter,se as useLocalStorage,ue as useMedia,oe as useTheme,ie as useThemeSetter};
|
|
12
12
|
//# sourceMappingURL=index.js.map
|