@purpurds/tabs 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE.txt +1 -1
- package/dist/styles.css +1 -1
- package/dist/tab-header.d.ts +1 -0
- package/dist/tab-header.d.ts.map +1 -1
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.es.js +334 -329
- package/dist/tabs.es.js.map +1 -1
- package/package.json +9 -9
- package/src/tab-header.module.scss +4 -0
- package/src/tab-header.tsx +5 -1
- package/src/tabs.module.scss +1 -1
- package/src/tabs.stories.tsx +164 -143
- package/src/tabs.tsx +2 -1
package/dist/LICENSE.txt
CHANGED
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._purpur-tab-content_1ugbi_1{position:relative}._purpur-tab-content_1ugbi_1:focus-visible{outline:0}._purpur-tab-content_1ugbi_1:focus-visible:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;outline:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-focus);border-radius:var(--purpur-border-radius-xs);pointer-events:none}._purpur-tab-content--force-mount_1ugbi_15[data-state=inactive]{display:none}._purpur-tab-
|
|
1
|
+
._purpur-tab-content_1ugbi_1{position:relative}._purpur-tab-content_1ugbi_1:focus-visible{outline:0}._purpur-tab-content_1ugbi_1:focus-visible:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;outline:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-focus);border-radius:var(--purpur-border-radius-xs);pointer-events:none}._purpur-tab-content--force-mount_1ugbi_15[data-state=inactive]{display:none}._purpur-tab-header_1tc2s_1{position:relative;display:flex;align-items:center;justify-content:center;width:auto;padding:calc(var(--purpur-spacing-100) + var(--purpur-spacing-25)) var(--purpur-spacing-200);border:0;border-radius:var(--purpur-border-radius-sm) var(--purpur-border-radius-sm) 0 0;background:transparent;font-family:var(--purpur-typography-family-default);font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-loose);font-weight:500;white-space:nowrap;cursor:pointer;transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out)}._purpur-tab-header_1tc2s_1[aria-selected=true]{cursor:auto}._purpur-tab-header_1tc2s_1:focus-visible{outline:0}._purpur-tab-header_1tc2s_1:focus-visible:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:20;outline:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-focus);outline-offset:calc(-1 * var(--purpur-border-width-sm));border-radius:var(--purpur-border-radius-sm) var(--purpur-border-radius-sm) 0 0;pointer-events:none}._purpur-tab-header--contained_1tc2s_36:focus-visible:after,._purpur-tab-header--contained-negative_1tc2s_36:focus-visible:after{top:calc(-1 * var(--purpur-border-width-sm))}._purpur-tab-header--line_1tc2s_39{color:var(--purpur-color-text-interactive-primary);background:var(--purpur-color-functional-transparent)}._purpur-tab-header--line_1tc2s_39:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-hover);background:var(--purpur-color-background-interactive-transparent-hover)}._purpur-tab-header--line_1tc2s_39:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-active);background:var(--purpur-color-background-interactive-transparent-active)}._purpur-tab-header--line-negative_1tc2s_51{color:var(--purpur-color-text-interactive-primary-negative);background:var(--purpur-color-functional-transparent)}._purpur-tab-header--line-negative_1tc2s_51:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-hover-negative);background:var(--purpur-color-background-interactive-transparent-hover-negative)}._purpur-tab-header--line-negative_1tc2s_51:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-active-negative);background:var(--purpur-color-background-interactive-transparent-active-negative)}._purpur-tab-header--contained_1tc2s_36{padding-top:calc(var(--purpur-spacing-100) + var(--purpur-spacing-25) - var(--purpur-border-width-sm));border-top:var(--purpur-border-width-sm) solid transparent;color:var(--purpur-color-text-interactive-primary);background:var(--purpur-color-background-interactive-inactive)}._purpur-tab-header--contained_1tc2s_36._purpur-tab-header_1tc2s_1[aria-selected=true]{border-color:var(--purpur-color-border-interactive-primary);background:var(--purpur-color-background-primary)}._purpur-tab-header--contained_1tc2s_36:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-hover);background:var(--purpur-color-background-interactive-transparent-hover)}._purpur-tab-header--contained_1tc2s_36:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-active);background:var(--purpur-color-background-interactive-transparent-active)}._purpur-tab-header--contained-negative_1tc2s_36{padding-top:calc(var(--purpur-spacing-100) + var(--purpur-spacing-25) - var(--purpur-border-width-sm));border-top:var(--purpur-border-width-sm) solid transparent;color:var(--purpur-color-text-interactive-primary-negative);background:var(--purpur-color-background-interactive-inactive-negative)}._purpur-tab-header--contained-negative_1tc2s_36._purpur-tab-header_1tc2s_1[aria-selected=true]{border-color:var(--purpur-color-border-interactive-primary-negative);color:var(--purpur-color-text-interactive-primary);background:var(--purpur-color-background-primary)}._purpur-tab-header--contained-negative_1tc2s_36:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):hover{color:var(--purpur-color-text-interactive-primary-hover-negative);background:var(--purpur-color-background-interactive-transparent-hover-negative)}._purpur-tab-header--contained-negative_1tc2s_36:not(._purpur-tab-header_1tc2s_1[aria-selected=true]):active{color:var(--purpur-color-text-interactive-primary-active-negative);background:var(--purpur-color-background-interactive-transparent-active-negative)}._purpur-tab-header--full-width_1tc2s_100{width:100%}._purpur-tabs__wrapper_jv2vl_1{position:relative;-ms-overflow-style:none;scrollbar-width:none}._purpur-tabs__wrapper_jv2vl_1 ::-webkit-scrollbar{display:none}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9{display:none;align-items:center;position:absolute;top:0;z-index:10;height:100%;padding:0;border:var(--purpur-border-width-xs) solid var(--purpur-color-border-interactive-subtle);border-radius:var(--purpur-border-radius-xs);color:var(--purpur-color-text-default);background:var(--purpur-color-background-primary);box-shadow:var(--purpur-shadow-md);cursor:pointer}@media (prefers-reduced-motion: no-preference){._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9{transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out)}}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:after{content:"";position:absolute;inset:calc(-1 * var(--purpur-border-width-xs));border:var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-subtle-hover);border-radius:var(--purpur-border-radius-xs);box-sizing:border-box;opacity:0}@media (prefers-reduced-motion: no-preference){._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:after{transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out)}}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:hover{box-shadow:none;border-color:transparent;color:var(--purpur-color-text-interactive-primary-hover)}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:hover:after{opacity:1}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:active:after{border-width:var(--purpur-border-width-xs)}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:focus{outline:0}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:focus-visible{outline:0;border-color:var(--purpur-color-border-interactive-subtle);box-shadow:none}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button_jv2vl_9:focus-visible:after{left:calc(-1 * var(--purpur-border-width-sm) * 2);top:calc(-1 * var(--purpur-border-width-sm) * 2);width:calc(100% + var(--purpur-border-width-sm) * 4);height:calc(100% + var(--purpur-border-width-sm) * 4);border-color:var(--purpur-color-border-interactive-focus);opacity:1;pointer-events:none}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button--left_jv2vl_71{left:0}._purpur-tabs__wrapper_jv2vl_1 ._purpur-tabs__scroll-button--right_jv2vl_74{right:0}._purpur-tabs__wrapper--scroll-start_jv2vl_77 ._purpur-tabs__scroll-button--left_jv2vl_71,._purpur-tabs__wrapper--scroll-end_jv2vl_80 ._purpur-tabs__scroll-button--right_jv2vl_74{display:flex}._purpur-tabs--line_jv2vl_83 ._purpur-tabs__wrapper_jv2vl_1:after,._purpur-tabs--line-negative_jv2vl_83 ._purpur-tabs__wrapper_jv2vl_1:after{content:"";position:absolute;bottom:0;left:0;width:100%;height:var(--purpur-border-width-sm)}._purpur-tabs--line_jv2vl_83 ._purpur-tabs__selected-border_jv2vl_91,._purpur-tabs--line-negative_jv2vl_83 ._purpur-tabs__selected-border_jv2vl_91{position:absolute;bottom:0;left:0;z-index:10;height:var(--purpur-border-width-sm)}@media (prefers-reduced-motion: no-preference){._purpur-tabs--line_jv2vl_83 ._purpur-tabs__selected-border_jv2vl_91,._purpur-tabs--line-negative_jv2vl_83 ._purpur-tabs__selected-border_jv2vl_91{transition:all var(--purpur-motion-duration-150) var(--purpur-motion-easing-ease-in-out)}}._purpur-tabs--line_jv2vl_83 ._purpur-tabs__wrapper_jv2vl_1:after{background:var(--purpur-color-border-weak)}._purpur-tabs--line_jv2vl_83 ._purpur-tabs__selected-border_jv2vl_91{background:var(--purpur-color-border-interactive-primary)}._purpur-tabs--line-negative_jv2vl_83 ._purpur-tabs__wrapper_jv2vl_1:after{background:var(--purpur-color-border-weak-negative)}._purpur-tabs--line-negative_jv2vl_83 ._purpur-tabs__selected-border_jv2vl_91{background:var(--purpur-color-border-interactive-primary-negative)}._purpur-tabs__content-wrapper_jv2vl_115{overflow:hidden}@media (prefers-reduced-motion: no-preference){._purpur-tabs__content-wrapper_jv2vl_115{transition:height var(--purpur-motion-duration-200) var(--purpur-motion-easing-ease-in-out)}}._purpur-tabs--contained_jv2vl_123 ._purpur-tabs__list_jv2vl_123,._purpur-tabs--contained-negative_jv2vl_123 ._purpur-tabs__list_jv2vl_123{gap:var(--purpur-spacing-100)}._purpur-tabs--contained_jv2vl_123 ._purpur-tabs__content-container_jv2vl_126,._purpur-tabs--contained-negative_jv2vl_123 ._purpur-tabs__content-container_jv2vl_126{background:var(--purpur-color-background-primary)}._purpur-tabs__list_jv2vl_123{position:relative;display:inline-flex;align-items:flex-end;max-width:100%;overflow:auto}._purpur-tabs--full-width_jv2vl_136 ._purpur-tabs__list_jv2vl_123{min-width:100%}
|
package/dist/tab-header.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ type TabHeaderProps = {
|
|
|
8
8
|
variant: TabsVariant;
|
|
9
9
|
negative?: boolean;
|
|
10
10
|
onFocus: FocusEventHandler<HTMLButtonElement>;
|
|
11
|
+
fullWidth?: boolean;
|
|
11
12
|
children: ReactNode;
|
|
12
13
|
};
|
|
13
14
|
export declare const TabHeader: React.ForwardRefExoticComponent<TabHeaderProps & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/tab-header.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-header.d.ts","sourceRoot":"","sources":["../src/tab-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAGtB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,cAAc,GAAG;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAKF,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"tab-header.d.ts","sourceRoot":"","sources":["../src/tab-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAGtB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,cAAc,GAAG;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAKF,eAAO,MAAM,SAAS,0FA4BrB,CAAC"}
|
package/dist/tabs.cjs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),b=require("react");require("react-dom");function Ve(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),b=require("react");require("react-dom");function Ve(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const a=Ve(b);function Be(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ce={exports:{}};/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
|
-
*/var ie;function Ue(){return ie||(ie=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(r=s(r,o.call(this,c)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var c in r)t.call(r,c)&&r[c]&&(i=s(i,this&&this[c]||c));return i}function s(r,i){return i?r?r+" "+i:r+i:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(se)),se.exports}var We=Ue();const Ge=Be(We),ke={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},ze=Ge.bind(ke),ce="purpur-icon",qe="md",Ke=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),Ye=({content:e="",title:t}={})=>{const n=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},t?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],o=t?`<title>${t}</title>`:"";return`<svg ${Ke(n)}>${o}${e}</svg>`},Ze=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),fe=({svg:e,allyTitle:t,className:n,size:o=qe,...s})=>{const r=Ye({content:Ze(e.svg),title:t}),i=ze(ce,`${ce}--${o}`,n);return m.jsx("span",{className:i,dangerouslySetInnerHTML:{__html:r},...s})};fe.displayName="Icon";const Xe={name:"chevron-left",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M16.175 3.905a.9.9 0 0 1-.08 1.27L8.36 12l7.736 6.825a.9.9 0 0 1-1.191 1.35l-8.5-7.5a.9.9 0 0 1 0-1.35l8.5-7.5a.9.9 0 0 1 1.27.08Z" clip-rule="evenodd"/></svg>',keywords:["chevron-left"],category:"utility"},He={name:"chevron-right",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M7.809 3.924a.9.9 0 0 0 .115 1.267L16.094 12l-8.17 6.809a.9.9 0 0 0 1.152 1.382l9-7.5a.9.9 0 0 0 0-1.382l-9-7.5a.9.9 0 0 0-1.267.115Z" clip-rule="evenodd"/></svg>',keywords:["chevron-right"],category:"utility"};function O(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function te(e,t=[]){let n=[];function o(r,i){const c=u.createContext(i),d=n.length;n=[...n,i];const a=f=>{var x;const{scope:_,children:h,...I}=f,w=((x=_==null?void 0:_[e])==null?void 0:x[d])||c,v=u.useMemo(()=>I,Object.values(I));return m.jsx(w.Provider,{value:v,children:h})};a.displayName=r+"Provider";function l(f,_){var w;const h=((w=_==null?void 0:_[e])==null?void 0:w[d])||c,I=u.useContext(h);if(I)return I;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[a,l]}const s=()=>{const r=n.map(i=>u.createContext(i));return function(c){const d=(c==null?void 0:c[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return s.scopeName=e,[o,Je(s,...t)]}function Je(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const i=o.reduce((c,{useScope:d,scopeName:a})=>{const f=d(r)[`__scope${a}`];return{...c,...f}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function ue(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function pe(...e){return t=>{let n=!1;const o=e.map(s=>{const r=ue(s,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;s<o.length;s++){const r=o[s];typeof r=="function"?r():ue(e[s],null)}}}}function K(...e){return u.useCallback(pe(...e),e)}function Q(e){const t=Qe(e),n=u.forwardRef((o,s)=>{const{children:r,...i}=o,c=u.Children.toArray(r),d=c.find(tt);if(d){const a=d.props.children,l=c.map(f=>f===d?u.Children.count(a)>1?u.Children.only(null):u.isValidElement(a)?a.props.children:null:f);return m.jsx(t,{...i,ref:s,children:u.isValidElement(a)?u.cloneElement(a,void 0,l):null})}return m.jsx(t,{...i,ref:s,children:r})});return n.displayName=`${e}.Slot`,n}function Qe(e){const t=u.forwardRef((n,o)=>{const{children:s,...r}=n;if(u.isValidElement(s)){const i=rt(s),c=nt(r,s.props);return s.type!==u.Fragment&&(c.ref=o?pe(o,i):i),u.cloneElement(s,c)}return u.Children.count(s)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var et=Symbol("radix.slottable");function tt(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===et}function nt(e,t){const n={...t};for(const o in t){const s=e[o],r=t[o];/^on[A-Z]/.test(o)?s&&r?n[o]=(...c)=>{const d=r(...c);return s(...c),d}:s&&(n[o]=s):o==="style"?n[o]={...s,...r}:o==="className"&&(n[o]=[s,r].filter(Boolean).join(" "))}return{...e,...n}}function rt(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ot(e){const t=e+"CollectionProvider",[n,o]=te(t),[s,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=w=>{const{scope:v,children:x}=w,N=b.useRef(null),C=b.useRef(new Map).current;return m.jsx(s,{scope:v,itemMap:C,collectionRef:N,children:x})};i.displayName=t;const c=e+"CollectionSlot",d=Q(c),a=b.forwardRef((w,v)=>{const{scope:x,children:N}=w,C=r(c,x),g=K(v,C.collectionRef);return m.jsx(d,{ref:g,children:N})});a.displayName=c;const l=e+"CollectionItemSlot",f="data-radix-collection-item",_=Q(l),h=b.forwardRef((w,v)=>{const{scope:x,children:N,...C}=w,g=b.useRef(null),R=K(v,g),E=r(l,x);return b.useEffect(()=>(E.itemMap.set(g,{ref:g,...C}),()=>void E.itemMap.delete(g))),m.jsx(_,{[f]:"",ref:R,children:N})});h.displayName=l;function I(w){const v=r(e+"CollectionConsumer",w);return b.useCallback(()=>{const N=v.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((E,$)=>C.indexOf(E.ref.current)-C.indexOf($.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:a,ItemSlot:h},I,o]}var Y=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},st=u[" useId ".trim().toString()]||(()=>{}),it=0;function me(e){const[t,n]=u.useState(st());return Y(()=>{n(o=>o??String(it++))},[e]),t?`radix-${t}`:""}var ct=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=ct.reduce((e,t)=>{const n=Q(`Primitive.${t}`),o=u.forwardRef((s,r)=>{const{asChild:i,...c}=s,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(d,{...c,ref:r})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function ut(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}var at=u[" useInsertionEffect ".trim().toString()]||Y;function _e({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[s,r,i]=lt({defaultProp:t,onChange:n}),c=e!==void 0,d=c?e:s;{const l=u.useRef(e!==void 0);u.useEffect(()=>{const f=l.current;f!==c&&console.warn(`${o} is changing from ${f?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=c},[c,o])}const a=u.useCallback(l=>{var f;if(c){const _=dt(l)?l(e):l;_!==e&&((f=i.current)==null||f.call(i,_))}else r(l)},[c,e,r,i]);return[d,a]}function lt({defaultProp:e,onChange:t}){const[n,o]=u.useState(e),s=u.useRef(n),r=u.useRef(t);return at(()=>{r.current=t},[t]),u.useEffect(()=>{var i;s.current!==n&&((i=r.current)==null||i.call(r,n),s.current=n)},[n,s]),[n,o,r]}function dt(e){return typeof e=="function"}var ft=u.createContext(void 0);function ve(e){const t=u.useContext(ft);return e||t||"ltr"}var H="rovingFocusGroup.onEntryFocus",pt={bubbles:!1,cancelable:!0},B="RovingFocusGroup",[ee,be,mt]=ot(B),[_t,ge]=te(B,[mt]),[vt,bt]=_t(B),he=u.forwardRef((e,t)=>m.jsx(ee.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(ee.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(gt,{...e,ref:t})})}));he.displayName=B;var gt=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:a,preventScrollOnEntryFocus:l=!1,...f}=e,_=u.useRef(null),h=K(t,_),I=ve(r),[w,v]=_e({prop:i,defaultProp:c??null,onChange:d,caller:B}),[x,N]=u.useState(!1),C=ut(a),g=be(n),R=u.useRef(!1),[E,$]=u.useState(0);return u.useEffect(()=>{const y=_.current;if(y)return y.addEventListener(H,C),()=>y.removeEventListener(H,C)},[C]),m.jsx(vt,{scope:n,orientation:o,dir:I,loop:s,currentTabStopId:w,onItemFocus:u.useCallback(y=>v(y),[v]),onItemShiftTab:u.useCallback(()=>N(!0),[]),onFocusableItemAdd:u.useCallback(()=>$(y=>y+1),[]),onFocusableItemRemove:u.useCallback(()=>$(y=>y-1),[]),children:m.jsx(D.div,{tabIndex:x||E===0?-1:0,"data-orientation":o,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:O(e.onMouseDown,()=>{R.current=!0}),onFocus:O(e.onFocus,y=>{const X=!R.current;if(y.target===y.currentTarget&&X&&!x){const j=new CustomEvent(H,pt);if(y.currentTarget.dispatchEvent(j),!j.defaultPrevented){const L=g().filter(A=>A.focusable),V=L.find(A=>A.active),U=L.find(A=>A.id===w),G=[V,U,...L].filter(Boolean).map(A=>A.ref.current);xe(G,l)}}R.current=!1}),onBlur:O(e.onBlur,()=>N(!1))})})}),we="RovingFocusGroupItem",Ce=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:r,children:i,...c}=e,d=me(),a=r||d,l=bt(we,n),f=l.currentTabStopId===a,_=be(n),{onFocusableItemAdd:h,onFocusableItemRemove:I,currentTabStopId:w}=l;return u.useEffect(()=>{if(o)return h(),()=>I()},[o,h,I]),m.jsx(ee.ItemSlot,{scope:n,id:a,focusable:o,active:s,children:m.jsx(D.span,{tabIndex:f?0:-1,"data-orientation":l.orientation,...c,ref:t,onMouseDown:O(e.onMouseDown,v=>{o?l.onItemFocus(a):v.preventDefault()}),onFocus:O(e.onFocus,()=>l.onItemFocus(a)),onKeyDown:O(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){l.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=Ct(v,l.orientation,l.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=_().filter(g=>g.focusable).map(g=>g.ref.current);if(x==="last")C.reverse();else if(x==="prev"||x==="next"){x==="prev"&&C.reverse();const g=C.indexOf(v.currentTarget);C=l.loop?xt(C,g+1):C.slice(g+1)}setTimeout(()=>xe(C))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:w!=null}):i})})});Ce.displayName=we;var ht={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function wt(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ct(e,t,n){const o=wt(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return ht[o]}function xe(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function xt(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var St=he,yt=Ce;function It(e,t){return u.useReducer((n,o)=>t[n][o]??n,e)}var Se=e=>{const{present:t,children:n}=e,o=Rt(t),s=typeof n=="function"?n({present:o.isPresent}):u.Children.only(n),r=K(o.ref,Nt(s));return typeof n=="function"||o.isPresent?u.cloneElement(s,{ref:r}):null};Se.displayName="Presence";function Rt(e){const[t,n]=u.useState(),o=u.useRef(null),s=u.useRef(e),r=u.useRef("none"),i=e?"mounted":"unmounted",[c,d]=It(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const a=q(o.current);r.current=c==="mounted"?a:"none"},[c]),Y(()=>{const a=o.current,l=s.current;if(l!==e){const _=r.current,h=q(a);e?d("MOUNT"):h==="none"||(a==null?void 0:a.display)==="none"?d("UNMOUNT"):d(l&&_!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,d]),Y(()=>{if(t){let a;const l=t.ownerDocument.defaultView??window,f=h=>{const w=q(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&w&&(d("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",a=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},_=h=>{h.target===t&&(r.current=q(o.current))};return t.addEventListener("animationstart",_),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{l.clearTimeout(a),t.removeEventListener("animationstart",_),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:u.useCallback(a=>{o.current=a?getComputedStyle(a):null,n(a)},[])}}function q(e){return(e==null?void 0:e.animationName)||"none"}function Nt(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Z="Tabs",[Tt]=te(Z,[ge]),ye=ge(),[Et,ne]=Tt(Z),Ie=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:s,defaultValue:r,orientation:i="horizontal",dir:c,activationMode:d="automatic",...a}=e,l=ve(c),[f,_]=_e({prop:o,onChange:s,defaultProp:r??"",caller:Z});return m.jsx(Et,{scope:n,baseId:me(),value:f,onValueChange:_,orientation:i,dir:l,activationMode:d,children:m.jsx(D.div,{dir:l,"data-orientation":i,...a,ref:t})})});Ie.displayName=Z;var Re="TabsList",Ne=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...s}=e,r=ne(Re,n),i=ye(n);return m.jsx(St,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:o,children:m.jsx(D.div,{role:"tablist","aria-orientation":r.orientation,...s,ref:t})})});Ne.displayName=Re;var Te="TabsTrigger",Ee=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:s=!1,...r}=e,i=ne(Te,n),c=ye(n),d=Pe(i.baseId,o),a=Me(i.baseId,o),l=o===i.value;return m.jsx(yt,{asChild:!0,...c,focusable:!s,active:l,children:m.jsx(D.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":a,"data-state":l?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...r,ref:t,onMouseDown:O(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(o):f.preventDefault()}),onKeyDown:O(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(o)}),onFocus:O(e.onFocus,()=>{const f=i.activationMode!=="manual";!l&&!s&&f&&i.onValueChange(o)})})})});Ee.displayName=Te;var Ae="TabsContent",Oe=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:s,children:r,...i}=e,c=ne(Ae,n),d=Pe(c.baseId,o),a=Me(c.baseId,o),l=o===c.value,f=u.useRef(l);return u.useEffect(()=>{const _=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(_)},[]),m.jsx(Se,{present:s||l,children:({present:_})=>m.jsx(D.div,{"data-state":l?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!_,id:a,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:_&&r})})});Oe.displayName=Ae;function Pe(e,t){return`${e}-trigger-${t}`}function Me(e,t){return`${e}-content-${t}`}var At=Ie,Ot=Ne,Pt=Ee,Mt=Oe;function $t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J={exports:{}};/*!
|
|
5
|
+
*/var ie;function Ue(){return ie||(ie=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",c=0;c<arguments.length;c++){var i=arguments[c];i&&(r=s(r,o.call(this,i)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var c="";for(var i in r)t.call(r,i)&&r[i]&&(c=s(c,this&&this[i]||i));return c}function s(r,c){return c?r?r+" "+c:r+c:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ce)),ce.exports}var Ge=Ue();const ke=Be(Ge),We={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},qe=ke.bind(We),ae="purpur-icon",Ke="md",ze=e=>e.filter(t=>Object.keys(t).length>=1).map(t=>`${t.name}="${t.value}"`).join(" "),Ye=({content:e="",title:t}={})=>{const n=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},t?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],o=t?`<title>${t}</title>`:"";return`<svg ${ze(n)}>${o}${e}</svg>`},Ze=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),fe=({svg:e,allyTitle:t,className:n,size:o=Ke,...s})=>{const r=Ye({content:Ze(e.svg),title:t}),c=qe(ae,`${ae}--${o}`,n);return m.jsx("span",{className:c,dangerouslySetInnerHTML:{__html:r},...s})};fe.displayName="Icon";const Xe={name:"chevron-left",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M16.175 3.905a.9.9 0 0 1-.08 1.27L8.36 12l7.736 6.825a.9.9 0 0 1-1.191 1.35l-8.5-7.5a.9.9 0 0 1 0-1.35l8.5-7.5a.9.9 0 0 1 1.27.08Z" clip-rule="evenodd"/></svg>',keywords:["chevron-left"],category:"utility"},He={name:"chevron-right",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M7.809 3.924a.9.9 0 0 0 .115 1.267L16.094 12l-8.17 6.809a.9.9 0 0 0 1.152 1.382l9-7.5a.9.9 0 0 0 0-1.382l-9-7.5a.9.9 0 0 0-1.267.115Z" clip-rule="evenodd"/></svg>',keywords:["chevron-right"],category:"utility"};function A(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function ne(e,t=[]){let n=[];function o(r,c){const i=a.createContext(c),d=n.length;n=[...n,c];const u=f=>{var x;const{scope:v,children:h,...I}=f,w=((x=v==null?void 0:v[e])==null?void 0:x[d])||i,_=a.useMemo(()=>I,Object.values(I));return m.jsx(w.Provider,{value:_,children:h})};u.displayName=r+"Provider";function l(f,v){var w;const h=((w=v==null?void 0:v[e])==null?void 0:w[d])||i,I=a.useContext(h);if(I)return I;if(c!==void 0)return c;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[u,l]}const s=()=>{const r=n.map(c=>a.createContext(c));return function(i){const d=(i==null?void 0:i[e])||r;return a.useMemo(()=>({[`__scope${e}`]:{...i,[e]:d}}),[i,d])}};return s.scopeName=e,[o,Je(s,...t)]}function Je(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const c=o.reduce((i,{useScope:d,scopeName:u})=>{const f=d(r)[`__scope${u}`];return{...i,...f}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}function ue(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function pe(...e){return t=>{let n=!1;const o=e.map(s=>{const r=ue(s,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;s<o.length;s++){const r=o[s];typeof r=="function"?r():ue(e[s],null)}}}}function z(...e){return a.useCallback(pe(...e),e)}function ee(e){const t=Qe(e),n=a.forwardRef((o,s)=>{const{children:r,...c}=o,i=a.Children.toArray(r),d=i.find(tt);if(d){const u=d.props.children,l=i.map(f=>f===d?a.Children.count(u)>1?a.Children.only(null):a.isValidElement(u)?u.props.children:null:f);return m.jsx(t,{...c,ref:s,children:a.isValidElement(u)?a.cloneElement(u,void 0,l):null})}return m.jsx(t,{...c,ref:s,children:r})});return n.displayName=`${e}.Slot`,n}function Qe(e){const t=a.forwardRef((n,o)=>{const{children:s,...r}=n;if(a.isValidElement(s)){const c=rt(s),i=nt(r,s.props);return s.type!==a.Fragment&&(i.ref=o?pe(o,c):c),a.cloneElement(s,i)}return a.Children.count(s)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var et=Symbol("radix.slottable");function tt(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===et}function nt(e,t){const n={...t};for(const o in t){const s=e[o],r=t[o];/^on[A-Z]/.test(o)?s&&r?n[o]=(...i)=>{const d=r(...i);return s(...i),d}:s&&(n[o]=s):o==="style"?n[o]={...s,...r}:o==="className"&&(n[o]=[s,r].filter(Boolean).join(" "))}return{...e,...n}}function rt(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ot(e){const t=e+"CollectionProvider",[n,o]=ne(t),[s,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=w=>{const{scope:_,children:x}=w,N=b.useRef(null),C=b.useRef(new Map).current;return m.jsx(s,{scope:_,itemMap:C,collectionRef:N,children:x})};c.displayName=t;const i=e+"CollectionSlot",d=ee(i),u=b.forwardRef((w,_)=>{const{scope:x,children:N}=w,C=r(i,x),g=z(_,C.collectionRef);return m.jsx(d,{ref:g,children:N})});u.displayName=i;const l=e+"CollectionItemSlot",f="data-radix-collection-item",v=ee(l),h=b.forwardRef((w,_)=>{const{scope:x,children:N,...C}=w,g=b.useRef(null),R=z(_,g),E=r(l,x);return b.useEffect(()=>(E.itemMap.set(g,{ref:g,...C}),()=>void E.itemMap.delete(g))),m.jsx(v,{[f]:"",ref:R,children:N})});h.displayName=l;function I(w){const _=r(e+"CollectionConsumer",w);return b.useCallback(()=>{const N=_.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${f}]`));return Array.from(_.itemMap.values()).sort((E,M)=>C.indexOf(E.ref.current)-C.indexOf(M.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:c,Slot:u,ItemSlot:h},I,o]}var Y=globalThis!=null&&globalThis.document?a.useLayoutEffect:()=>{},st=a[" useId ".trim().toString()]||(()=>{}),ct=0;function me(e){const[t,n]=a.useState(st());return Y(()=>{n(o=>o??String(ct++))},[e]),t?`radix-${t}`:""}var it=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=it.reduce((e,t)=>{const n=ee(`Primitive.${t}`),o=a.forwardRef((s,r)=>{const{asChild:c,...i}=s,d=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(d,{...i,ref:r})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function at(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}var ut=a[" useInsertionEffect ".trim().toString()]||Y;function ve({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[s,r,c]=lt({defaultProp:t,onChange:n}),i=e!==void 0,d=i?e:s;{const l=a.useRef(e!==void 0);a.useEffect(()=>{const f=l.current;f!==i&&console.warn(`${o} is changing from ${f?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,o])}const u=a.useCallback(l=>{var f;if(i){const v=dt(l)?l(e):l;v!==e&&((f=c.current)==null||f.call(c,v))}else r(l)},[i,e,r,c]);return[d,u]}function lt({defaultProp:e,onChange:t}){const[n,o]=a.useState(e),s=a.useRef(n),r=a.useRef(t);return ut(()=>{r.current=t},[t]),a.useEffect(()=>{var c;s.current!==n&&((c=r.current)==null||c.call(r,n),s.current=n)},[n,s]),[n,o,r]}function dt(e){return typeof e=="function"}var ft=a.createContext(void 0);function _e(e){const t=a.useContext(ft);return e||t||"ltr"}var H="rovingFocusGroup.onEntryFocus",pt={bubbles:!1,cancelable:!0},B="RovingFocusGroup",[te,be,mt]=ot(B),[vt,ge]=ne(B,[mt]),[_t,bt]=vt(B),he=a.forwardRef((e,t)=>m.jsx(te.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(te.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(gt,{...e,ref:t})})}));he.displayName=B;var gt=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:r,currentTabStopId:c,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:l=!1,...f}=e,v=a.useRef(null),h=z(t,v),I=_e(r),[w,_]=ve({prop:c,defaultProp:i??null,onChange:d,caller:B}),[x,N]=a.useState(!1),C=at(u),g=be(n),R=a.useRef(!1),[E,M]=a.useState(0);return a.useEffect(()=>{const y=v.current;if(y)return y.addEventListener(H,C),()=>y.removeEventListener(H,C)},[C]),m.jsx(_t,{scope:n,orientation:o,dir:I,loop:s,currentTabStopId:w,onItemFocus:a.useCallback(y=>_(y),[_]),onItemShiftTab:a.useCallback(()=>N(!0),[]),onFocusableItemAdd:a.useCallback(()=>M(y=>y+1),[]),onFocusableItemRemove:a.useCallback(()=>M(y=>y-1),[]),children:m.jsx(D.div,{tabIndex:x||E===0?-1:0,"data-orientation":o,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:A(e.onMouseDown,()=>{R.current=!0}),onFocus:A(e.onFocus,y=>{const X=!R.current;if(y.target===y.currentTarget&&X&&!x){const $=new CustomEvent(H,pt);if(y.currentTarget.dispatchEvent($),!$.defaultPrevented){const L=g().filter(j=>j.focusable),V=L.find(j=>j.active),U=L.find(j=>j.id===w),k=[V,U,...L].filter(Boolean).map(j=>j.ref.current);xe(k,l)}}R.current=!1}),onBlur:A(e.onBlur,()=>N(!1))})})}),we="RovingFocusGroupItem",Ce=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:r,children:c,...i}=e,d=me(),u=r||d,l=bt(we,n),f=l.currentTabStopId===u,v=be(n),{onFocusableItemAdd:h,onFocusableItemRemove:I,currentTabStopId:w}=l;return a.useEffect(()=>{if(o)return h(),()=>I()},[o,h,I]),m.jsx(te.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:m.jsx(D.span,{tabIndex:f?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:A(e.onMouseDown,_=>{o?l.onItemFocus(u):_.preventDefault()}),onFocus:A(e.onFocus,()=>l.onItemFocus(u)),onKeyDown:A(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){l.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const x=Ct(_,l.orientation,l.dir);if(x!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let C=v().filter(g=>g.focusable).map(g=>g.ref.current);if(x==="last")C.reverse();else if(x==="prev"||x==="next"){x==="prev"&&C.reverse();const g=C.indexOf(_.currentTarget);C=l.loop?xt(C,g+1):C.slice(g+1)}setTimeout(()=>xe(C))}}),children:typeof c=="function"?c({isCurrentTabStop:f,hasTabStop:w!=null}):c})})});Ce.displayName=we;var ht={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function wt(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ct(e,t,n){const o=wt(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return ht[o]}function xe(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function xt(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var St=he,yt=Ce;function It(e,t){return a.useReducer((n,o)=>t[n][o]??n,e)}var Se=e=>{const{present:t,children:n}=e,o=Rt(t),s=typeof n=="function"?n({present:o.isPresent}):a.Children.only(n),r=z(o.ref,Nt(s));return typeof n=="function"||o.isPresent?a.cloneElement(s,{ref:r}):null};Se.displayName="Presence";function Rt(e){const[t,n]=a.useState(),o=a.useRef(null),s=a.useRef(e),r=a.useRef("none"),c=e?"mounted":"unmounted",[i,d]=It(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const u=K(o.current);r.current=i==="mounted"?u:"none"},[i]),Y(()=>{const u=o.current,l=s.current;if(l!==e){const v=r.current,h=K(u);e?d("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?d("UNMOUNT"):d(l&&v!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,d]),Y(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=h=>{const w=K(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&w&&(d("ANIMATION_END"),!s.current)){const _=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=_)})}},v=h=>{h.target===t&&(r.current=K(o.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{l.clearTimeout(u),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:a.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function K(e){return(e==null?void 0:e.animationName)||"none"}function Nt(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Z="Tabs",[Tt]=ne(Z,[ge]),ye=ge(),[Et,re]=Tt(Z),Ie=a.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:s,defaultValue:r,orientation:c="horizontal",dir:i,activationMode:d="automatic",...u}=e,l=_e(i),[f,v]=ve({prop:o,onChange:s,defaultProp:r??"",caller:Z});return m.jsx(Et,{scope:n,baseId:me(),value:f,onValueChange:v,orientation:c,dir:l,activationMode:d,children:m.jsx(D.div,{dir:l,"data-orientation":c,...u,ref:t})})});Ie.displayName=Z;var Re="TabsList",Ne=a.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...s}=e,r=re(Re,n),c=ye(n);return m.jsx(St,{asChild:!0,...c,orientation:r.orientation,dir:r.dir,loop:o,children:m.jsx(D.div,{role:"tablist","aria-orientation":r.orientation,...s,ref:t})})});Ne.displayName=Re;var Te="TabsTrigger",Ee=a.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:s=!1,...r}=e,c=re(Te,n),i=ye(n),d=Oe(c.baseId,o),u=Pe(c.baseId,o),l=o===c.value;return m.jsx(yt,{asChild:!0,...i,focusable:!s,active:l,children:m.jsx(D.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":u,"data-state":l?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:d,...r,ref:t,onMouseDown:A(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?c.onValueChange(o):f.preventDefault()}),onKeyDown:A(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&c.onValueChange(o)}),onFocus:A(e.onFocus,()=>{const f=c.activationMode!=="manual";!l&&!s&&f&&c.onValueChange(o)})})})});Ee.displayName=Te;var je="TabsContent",Ae=a.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:s,children:r,...c}=e,i=re(je,n),d=Oe(i.baseId,o),u=Pe(i.baseId,o),l=o===i.value,f=a.useRef(l);return a.useEffect(()=>{const v=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(v)},[]),m.jsx(Se,{present:s||l,children:({present:v})=>m.jsx(D.div,{"data-state":l?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":d,hidden:!v,id:u,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:v&&r})})});Ae.displayName=je;function Oe(e,t){return`${e}-trigger-${t}`}function Pe(e,t){return`${e}-content-${t}`}var jt=Ie,At=Ne,Ot=Ee,Pt=Ae;function Mt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J={exports:{}};/*!
|
|
6
6
|
Copyright (c) 2018 Jed Watson.
|
|
7
7
|
Licensed under the MIT License (MIT), see
|
|
8
8
|
http://jedwatson.github.io/classnames
|
|
9
|
-
*/var
|
|
9
|
+
*/var le;function $t(){return le||(le=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",c=0;c<arguments.length;c++){var i=arguments[c];i&&(r=s(r,o.call(this,i)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var c="";for(var i in r)t.call(r,i)&&r[i]&&(c=s(c,this&&this[i]||i));return c}function s(r,c){return c?r?r+" "+c:r+c:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(J)),J.exports}var Ft=$t();const oe=Mt(Ft),Dt={"purpur-tab-content":"_purpur-tab-content_1ugbi_1","purpur-tab-content--force-mount":"_purpur-tab-content--force-mount_1ugbi_15"},Lt=oe.bind(Dt),de="purpur-tab-content",Vt=b.forwardRef(({children:e,tabId:t,"data-testid":n,className:o,disableForceMount:s,...r},c)=>m.jsx(Pt,{ref:c,className:Lt(de,o,{[`${de}--force-mount`]:!s}),"data-testid":n,value:t,forceMount:!s||void 0,...r,children:e})),Bt=e=>!!e&&b.isValidElement(e)&&!!e.props.name&&!!e.props.tabId,Ut={"purpur-tab-header":"_purpur-tab-header_1tc2s_1","purpur-tab-header--contained":"_purpur-tab-header--contained_1tc2s_36","purpur-tab-header--contained-negative":"_purpur-tab-header--contained-negative_1tc2s_36","purpur-tab-header--line":"_purpur-tab-header--line_1tc2s_39","purpur-tab-header--line-negative":"_purpur-tab-header--line-negative_1tc2s_51","purpur-tab-header--full-width":"_purpur-tab-header--full-width_1tc2s_100"},Gt=oe.bind(Ut),Q="purpur-tab-header",kt=b.forwardRef(({index:e,tabId:t,variant:n,negative:o,onFocus:s,fullWidth:r,"data-testid":c,children:i},d)=>m.jsx(Ot,{id:`${t}-trigger`,className:Gt(Q,`${Q}--${n}${o?"-negative":""}`,{[`${Q}--full-width`]:r}),value:t,"data-testid":c,"data-index":e,ref:d,onFocus:s,children:i})),Wt={"purpur-tabs__wrapper":"_purpur-tabs__wrapper_jv2vl_1","purpur-tabs__scroll-button":"_purpur-tabs__scroll-button_jv2vl_9","purpur-tabs__scroll-button--left":"_purpur-tabs__scroll-button--left_jv2vl_71","purpur-tabs__scroll-button--right":"_purpur-tabs__scroll-button--right_jv2vl_74","purpur-tabs__wrapper--scroll-start":"_purpur-tabs__wrapper--scroll-start_jv2vl_77","purpur-tabs__wrapper--scroll-end":"_purpur-tabs__wrapper--scroll-end_jv2vl_80","purpur-tabs--line":"_purpur-tabs--line_jv2vl_83","purpur-tabs--line-negative":"_purpur-tabs--line-negative_jv2vl_83","purpur-tabs__selected-border":"_purpur-tabs__selected-border_jv2vl_91","purpur-tabs__content-wrapper":"_purpur-tabs__content-wrapper_jv2vl_115","purpur-tabs--contained":"_purpur-tabs--contained_jv2vl_123","purpur-tabs__list":"_purpur-tabs__list_jv2vl_123","purpur-tabs--contained-negative":"_purpur-tabs--contained-negative_jv2vl_123","purpur-tabs__content-container":"_purpur-tabs__content-container_jv2vl_126","purpur-tabs--full-width":"_purpur-tabs--full-width_jv2vl_136"},qt=["line","contained"],Me=e=>new CustomEvent("tabChangeDetail",{detail:{value:e}}),P=oe.bind(Wt),T="purpur-tabs",Kt=(e,t)=>{var d;if(typeof(e==null?void 0:e.getBoundingClientRect)!="function"||typeof(t==null?void 0:t.scroll)!="function")return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),s=t.clientWidth,r=parseInt((d=getComputedStyle(t).borderLeftWidth)==null?void 0:d.split("px")[0],10),c=o.left+(isNaN(r)?0:r);let i;n.right>o.right&&(i=n.left+t.scrollLeft,i=i+n.width-s+s*.1,i=i-c),n.left<o.left&&(i=n.left+t.scrollLeft,i=i-s*.1,i=i-c),i!==void 0&&t.scroll({left:i,behavior:"smooth"})},$e=({children:e,variant:t="line",negative:n=!1,fullWidth:o=!1,onChange:s,className:r,defaultValue:c,animateHeight:i=!1,"data-testid":d,value:u,...l})=>{const f=b.useRef(null),[v,h]=b.useState(-1),[I,w]=b.useState({}),[_,x]=b.useState(0),[N,C]=b.useState(0),g=b.Children.toArray(e).filter(Bt),R=b.useRef(null),E=b.useRef(new Array(g.length)),M=200,y=t==="line",X=P(T,`${T}--${t}${n?"-negative":""}`,{[`${T}--full-width`]:o},r),$=b.Children.map(g,({props:{tabId:p}})=>p),L=()=>{const p=$.findIndex(S=>S===c);return p>=0?p:0};b.useEffect(()=>{u&&U(g.findIndex(p=>p.props.tabId===u))},[g,u]);const[V,U]=b.useState(L);if(new Set($).size!==$.length)throw new Error("tabId must be unique");const G=(p,S)=>S||d?`${S||d}-${p}`:void 0,k=()=>{if(!y)return;const p=E.current[V];x((p==null?void 0:p.offsetLeft)||0),C((p==null?void 0:p.getBoundingClientRect().width)||0)},j=p=>{y&&!u&&U(g.findIndex(S=>S.props.tabId===p)),s==null||s(Me(p))},Fe=p=>{if(R!=null&&R.current){const{scrollLeft:S}=R.current,O=p==="left"?-M:M;R.current.scroll({left:S+O,behavior:"smooth"})}},se=({side:p})=>m.jsx("button",{className:P(`${T}__scroll-button`,`${T}__scroll-button--${p}`),onClick:()=>Fe(p),type:"button","aria-hidden":"true",tabIndex:-1,"data-testid":G("scroll-button"),children:m.jsx(fe,{svg:p==="left"?Xe:He,size:"md"})});return b.useEffect(()=>{const p=()=>{if(f.current&&i){const O=f.current.offsetHeight;h(O)}},S=()=>{p(),k()};return p(),window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[V,i]),b.useEffect(()=>{k()},[V,o,g.length,t]),b.useEffect(()=>{const p=R.current;if(!p)return;const S=()=>{const{scrollLeft:O,scrollWidth:W,clientWidth:q}=p,F=W>q,De=O<=1,Le=O+q>=W-1;if(!F){w({});return}w({[`${T}__wrapper--scroll-start`]:!De,[`${T}__wrapper--scroll-end`]:!Le})};return S(),p.addEventListener("scroll",S,{passive:!0}),window.addEventListener("resize",S),()=>{p.removeEventListener("scroll",S),window.removeEventListener("resize",S)}},[]),m.jsx(jt,{defaultValue:c??g[0].props.tabId,onValueChange:j,"data-testid":d,className:X,value:u,...l,children:m.jsxs("div",{className:P(`${T}__container`),children:[m.jsxs("div",{className:P(`${T}__wrapper`,I),children:[m.jsxs(At,{ref:p=>{R.current=p},className:P(`${T}__list`),children:[b.Children.map(g,(p,S)=>{const{name:O,tabId:W,"data-testid":q}=p.props;return m.jsx(kt,{"data-testid":G("header",q),index:S,tabId:W,ref:F=>{F&&(E.current[S]=F)},onFocus:F=>{Kt(F.target,R.current)},variant:t,negative:n,fullWidth:o,children:O})}),y&&m.jsx("div",{className:P(`${T}__selected-border`),style:{width:N,transform:`translateX(${_}px)`},"data-testid":G("selected-border")})]}),m.jsx(se,{side:"left"}),m.jsx(se,{side:"right"})]}),m.jsx("div",{className:i?P(`${T}__content-wrapper`):"",style:{height:i&&v>-1?`${v}px`:"auto"},children:m.jsx("div",{ref:f,className:P(`${T}__content-container`),children:b.Children.map(g,p=>p)})})]})})};$e.Content=Vt;exports.Tabs=$e;exports.createTabChangeDetailEvent=Me;exports.tabsVariants=qt;
|
|
10
10
|
//# sourceMappingURL=tabs.cjs.js.map
|