import{j as r}from"./jsx-runtime-CnH95YSl.js";import{O as I}from"./OdysseyStorybookThemeDecorator-BuDiOG2V.js";import{u as w,M as B}from"./index.esm-DTxqsiYY.js";import{r as e}from"./index-NdkWRN8K.js";import{K as F}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{M}from"./Button-BEA5U6Tg.js";import"./index-BJTM6NaI.js";import"./OdysseyProvider-qIn9QVYS.js";import"./_commonjsHelpers-gnU0ypJ3.js";import"./createSvgIcon-ClUWwDzL.js";import"./createChainedFunction-BO_9K8Jh.js";import"./debounce-Be36O1Ab.js";import"./ListItem-C0ExFtXb.js";import"./utils-iop7lDec.js";import"./useFormControl-BMISTZuX.js";import"./FormLabel-CiGre9wK.js";import"./List-CmjR1pNu.js";import"./useIsFocusVisible-DH0qxT5e.js";import"./isHostComponent-DVu5iVWx.js";import"./ButtonBase-BNqa2TMD.js";import"./assertThisInitialized-B9jnkVVz.js";import"./inheritsLoose-CJ6Ie9dp.js";import"./TransitionGroupContext-DAL84N7p.js";import"./ownerDocument-DW-IO8s5.js";import"./ownerWindow-HkKU3E4x.js";import"./useControlled-NQulfz4l.js";import"./index-B5xazMy1.js";import"./index-DieBXP3Z.js";import"./utils-kUZVaD1e.js";import"./Stack-B7OGvu7C.js";import"./createStyled-D6bTcpHC.js";import"./useThemeProps-DwvbKxez.js";import"./Tooltip-Cq2rQGbD.js";import"./Grow-C8kUeGCY.js";import"./getReactElementRef-DsIevm5t.js";import"./resolveComponentProps-DXQ8X87i.js";import"./Popper-BARIxJrI.js";import"./popper-BVOCD5jc.js";import"./Portal-C6D59xAE.js";import"./Paper-D-_O-EjU.js";import"./Box-BcMTQ_R2.js";import"./createBox-Dxawkfow.js";import"./CircularProgress-HbIdZLBB.js";import"./DialogContent-Cwn-I-C_.js";import"./Fade-dUgBN8rJ.js";import"./Modal-CSDyCVCf.js";import"./getScrollbarSize-Bqq2hMjQ.js";import"./dialogActionsClasses-ZEPlxVw-.js";import"./DialogTitle-C-K7jEio.js";import"./Typography-ClQ35Rr-.js";import"./Menu-K9lpVvDG.js";import"./MenuList-BMOesnfs.js";import"./colorManipulator-DKifQsuo.js";import"./IconButton-5qShmnSr.js";import"./Radio-B4gVvwps.js";import"./SwitchBase-CefEM0OA.js";import"./Checkbox-vZwuXtzm.js";import"./useMobilePicker-DZhX9dEQ.js";import"./Select-DZTigpTO.js";import"./ArrowDropDown-DdemyKZU.js";import"./InputBase-DeB4_faH.js";import"./FormHelperText-CsNAE1E3.js";import"./useThemeProps-BPvYx-mf.js";import"./InputAdornment-CdR3XT6f.js";import"./visuallyHidden-Dan1xhjv.js";import"./Button-BzIwUmSM.js";import"./Chip-CXnMieIl.js";import"./MenuItem-vhp8G-Nb.js";import"./Collapse-DfdoVIdP.js";import"./AlertTitle-q6ff_Zkl.js";import"./useSlot-CvpE2t6D.js";import"./Close-OXBt1nIe.js";import"./Skeleton-BPjIT6NG.js";import"./Divider-Ln3VaO81.js";import"./Autocomplete-CxtGbb8j.js";import"./ListSubheader-CQJAAOsd.js";import"./tableSortLabelClasses-CkKrbp1R.js";import"./FormControlLabel-0BBemR80.js";import"./DateTimePicker-B7a9bgL6.js";import"./Tabs-CQz87GHd.js";import"./DatePicker-BwDkz3WT.js";import"./BaseButton-DYZHKnV3.js";import"./MuiPropsContext-DhRylJZk.js";import"./Tooltip-CsVWtVfL.js";/*!
 * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */const j=({columns:a=[],data:S=[],getRowId:J,hasError:E,initialState:T,onGlobalFilterChange:i,state:l,ToolbarButtons:n})=>{const{t:L}=F(),c=e.useRef(null),[d,R]=e.useState([]),[t,K]=e.useState();e.useEffect(()=>{t!==void 0&&(i==null||i(t))},[t,i]);const v=e.useMemo(()=>({globalFilter:t,columnFilters:d,...l}),[t,d,l]),V=e.useCallback(({table:s})=>r.jsx(r.Fragment,{children:n&&r.jsx(n,{table:s})}),[n]);e.useEffect(()=>{var s,p;try{(p=(s=c.current)==null?void 0:s.scrollToIndex)==null||p.call(s,0)}catch(C){console.error(C)}},[d,t]);const O=w({columns:a,data:S,enableBottomToolbar:!1,enablePagination:!1,enableRowVirtualization:!0,enableSorting:!1,getRowId:J,initialState:T,muiToolbarAlertBannerProps:E?{children:L("table.error"),color:"error"}:void 0,onColumnFiltersChange:R,onGlobalFilterChange:K,renderTopToolbarCustomActions:V,rowVirtualizerInstanceRef:c,rowVirtualizerOptions:{overscan:4},state:v});return r.jsx(B,{table:O})},k=e.memo(j);k.displayName="StaticTable";const fe={component:k,decorators:[I],argTypes:{columns:{control:"object",type:{required:!0,name:"other",value:"MaterialReactTableProps<TData>"}},data:{control:"object",type:{required:!0,name:"other",value:"MaterialReactTableProps<TData>"}},getRowId:{},fetchMoreData:{},hasError:{control:"boolean"},hasRowSelection:{control:"boolean"},initialState:{control:"object"},isFetching:{control:"boolean"},onGlobalFilterChange:{},onPaginationChange:{},onRowSelectionChange:{},state:{control:"object"}}},D=[{accessorKey:"name.firstName",header:"First Name"},{accessorKey:"name.lastName",header:"Last Name"},{accessorKey:"address",Cell:({cell:a})=>a.getValue().concat(","),header:"Address"},{accessorKey:"city",header:"City"},{accessorKey:"state",header:"State"}],g=[{address:"261 Erdman Ford",city:"East Daphne",id:"234823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"234823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"234823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"234823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"234823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"},{address:"261 Erdman Ford",city:"East Daphne",id:"334823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"334823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"334823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"334823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"334823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"},{address:"261 Erdman Ford",city:"East Daphne",id:"434823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"434823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"434823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"434823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"434823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"},{address:"261 Erdman Ford",city:"East Daphne",id:"534823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"534823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"534823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"534823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"534823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"},{address:"261 Erdman Ford",city:"East Daphne",id:"634823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"634823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"634823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"634823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"634823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"},{address:"261 Erdman Ford",city:"East Daphne",id:"734823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"734823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"734823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"734823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"734823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"},{address:"261 Erdman Ford",city:"East Daphne",id:"834823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"834823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"834823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"834823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"834823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"},{address:"261 Erdman Ford",city:"East Daphne",id:"934823773",name:{firstName:"John",lastName:"Doe"},state:"Kentucky"},{address:"769 Dominic Grove",city:"Columbus",id:"934823774",name:{firstName:"Jane",lastName:"Doe"},state:"Ohio"},{address:"566 Brakus Inlet",city:"South Linda",id:"934823775",name:{firstName:"Joe",lastName:"Doe"},state:"West Virginia"},{address:"722 Emie Stream",city:"Lincoln",id:"934823776",name:{firstName:"Kevin",lastName:"Vandy"},state:"Nebraska"},{address:"32188 Larkin Turnpike",city:"Omaha",id:"934823777",name:{firstName:"Joshua",lastName:"Rolluffs"},state:"Nebraska"}],o={args:{columns:D,data:g,getRowId:({id:a})=>a}},m={args:{columns:D,data:g,getRowId:({id:a})=>a,ToolbarButtons:({table:a})=>r.jsx(M,{label:"New Action",onClick:()=>console.info(a.getState()),variant:"primary"})}};var u,N,f;o.parameters={...o.parameters,docs:{...(u=o.parameters)==null?void 0:u.docs,source:{originalSource:`{
  args: {
    columns,
    data,
    getRowId: ({
      id
    }: {
      id: string;
    }) => id
  }
}`,...(f=(N=o.parameters)==null?void 0:N.docs)==null?void 0:f.source}}};var y,h,b;m.parameters={...m.parameters,docs:{...(y=m.parameters)==null?void 0:y.docs,source:{originalSource:`{
  args: {
    columns,
    data,
    getRowId: ({
      id
    }: {
      id: string;
    }) => id,
    ToolbarButtons: ({
      table
    }) => <Button label="New Action" onClick={() => console.info(table.getState())} variant="primary" />
  }
}`,...(b=(h=m.parameters)==null?void 0:h.docs)==null?void 0:b.source}}};const ye=["BasicUsage","CustomToolbar"];export{o as BasicUsage,m as CustomToolbar,ye as __namedExportsOrder,fe as default};
