@kanda-libs/ks-design-library-new 0.0.1 → 0.0.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/index.esm.mjs +1 -1
- package/dist/index.esm.mjs.map +4 -4
- package/dist/library.css +94 -20
- package/package.json +1 -1
- package/src/components/Table/components/Cell/constants.ts +3 -2
- package/src/components/Table/components/Cell/index.tsx +14 -3
- package/src/components/Table/components/Cell/useCellClassNames.ts +2 -0
- package/src/components/Table/components/HeaderButton/constants.ts +2 -2
- package/src/components/Table/components/HeaderColumn/constants.ts +2 -2
- package/src/components/Table/components/HeaderColumn/index.tsx +5 -1
- package/src/components/Table/components/HeaderGroup/constants.ts +1 -1
- package/src/components/Table/components/Pages/index.tsx +36 -0
- package/src/components/Table/components/Row/constants.ts +1 -1
- package/src/components/Table/components/Row/index.tsx +1 -4
- package/src/components/Table/index.tsx +23 -16
- package/src/components/Table/useTableProps.ts +20 -1
- package/src/hooks/useMobileFullWidthCellStyle.ts +20 -0
- package/src/styles/library.css +94 -20
package/dist/index.esm.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SkeletonLoader as
|
|
1
|
+
import{Pagination as ve}from"@kanda-libs/ks-design-library";import{SkeletonLoader as re}from"@kanda-libs/ks-design-library";import{useIsDesktop as K}from"@kanda-libs/ks-design-library";function f(e){if(!e)return{};let o=K();return{...e,width:o?e==null?void 0:e.width:"100%"}}import{Icon as Q}from"@kanda-libs/ks-design-library";var v="flex px-3 py-1.75 h-9 -ml-3 my-auto rounded-lg bg-transparent hover:bg-neutral-100 text-style-g-em text-neutral-500 whitespace-nowrap z-20",H={icon:"chevron-down",stroke:"neutral-500",size:12,className:"ml-2 my-auto"},I={width:"calc(100% + 16px)"},b={container:{base:"w-full h-full overflow-hidden",padding:"pl-4 -ml-4"},flex:{base:"w-full h-full md:flex px-4 md:px-0",padding:"md:pl-4"}};import{jsx as ee,jsxs as oe}from"react/jsx-runtime";var Z=function({label:e,...o}){return oe("button",{className:v,...o,children:[e,ee(Q,{...H})]})},L=Z;import k from"clsx";function S(e){let o=e===0?I:{};return{classNames:{container:k(b.container.base,e===0?b.container.padding:""),flex:k(b.flex.base,e===0?"":b.flex.padding)},containerStyle:o}}import{jsx as O}from"react/jsx-runtime";var te=function({index:e,children:o}){let{classNames:t,containerStyle:r}=S(e);return O("div",{className:t.container,style:r,children:O("div",{className:t.flex,children:o})})},E=te;var T={Button:L,Wrapper:E};import M from"clsx";var m={main:"flex md:h-14",loading:{base:"my-auto w-full mr-8",margin:"ml-4"},wrapper:{padding:"md:px-2 md:pt-2",popover:"pb-1"}};function P(e,o){return{classNames:{...m,loading:M(m.loading.base,e===0?"":m.loading.margin),wrapper:M(m.wrapper.padding,o?"":m.wrapper.popover)}}}import{jsx as x}from"react/jsx-runtime";var ne=function({index:e,isLoading:o=!1,popoverButtons:t=!1,label:r,...n}){let{classNames:a}=P(e,t),{style:s,...p}=n,i=f(s);return x("div",{...p,style:i,className:a.main,children:x(re,{isLoading:o,wrapperClassName:a.loading,afterLoading:x(T.Wrapper,{index:e,children:x(T.Button,{label:r})})})})},F=ne;var A={base:"flex-col md:flex-row md:h-14 hidden lg:block border-b border-neutral-200"};function h(e,o){let{headers:t,getHeaderGroupProps:r}=e,n=r({}),a=o.filter(s=>s.isVisible).length;return{headers:t,headerGroupProps:n,totalVisible:a}}import{jsx as _}from"react/jsx-runtime";function ae({headerGroup:e,columns:o,isLoading:t}){let{headerGroupProps:r,headers:n}=h(e,o);return _("div",{...r,className:A.base,children:n.map((a,s)=>_(F,{index:s,label:a.render("Header"),isLoading:t,...a.getHeaderProps(a.getSortByToggleProps())}))})}var W=ae;import{SkeletonLoader as le,Text as pe}from"@kanda-libs/ks-design-library";import se from"clsx";var d={container:"flex w-full h-full",render:"w-full my-auto text-style-g text-neutral-600 whitespace-nowrap overflow-hidden overflow-ellipsis",renderLoading:"w-full my-auto mr-8 text-style-g",mobileLabel:"block md:hidden text-16-24-em text-neutral-600 mr-2",cell:{base:"px-4 py-1 md:pt-0 md:pr-0 md:pb-0 md:h-16 flex",compact:"h-8 flex",padding:"md:pl-4"}};function C(e,o,t){return{cell:se(o?d.cell.compact:d.cell.base,e===0?"":d.cell.padding),container:d.container,render:t?d.renderLoading:d.render,mobileLabel:d.mobileLabel}}import{Fragment as ce,jsx as g,jsxs as de}from"react/jsx-runtime";var ie=function({render:e,index:o,compact:t=!1,isLoading:r=!1,label:n,...a}){let s=C(o,t,r),{style:p,...i}=a,l=f(p);return g("div",{...i,style:l,className:s.cell,children:g("div",{className:s.container,children:g("div",{className:s.render,children:g(le,{isLoading:r,afterLoading:de(ce,{children:[g(pe,{text:`${n}:`,className:s.mobileLabel}),e()]})})})})})},G=ie;import{useClasses as me}from"@kanda-libs/ks-design-library";var j={base:"relative md:h-16 flex-col py-2 md:py-0 md:flex-row",compact:"relative h-8",border:"border-b border-neutral-200",hover:"group hover:bg-neutral-50 cursor-pointer",button:"hidden group-hover:block"};function y(e){return me(j,{base:[".base",e===9?"":".border",".hover"],button:[".button"]})}import{jsx as B}from"react/jsx-runtime";function ue({cells:e,index:o,compact:t=!1,isLoading:r=!1,...n}){let a=y(o);return B("div",{...n,className:t?a.compact:a.base,children:e.map((s,p)=>B(G,{...s.getCellProps(),index:p,isLoading:r,render:()=>s.render("Cell"),label:s.column.Header}))})}var z=ue;import{Fragment as be,jsx as V}from"react/jsx-runtime";function fe({page:e,prepareRow:o,isLoading:t=!1,compact:r=!1}){return V(be,{children:e.map((n,a)=>(o(n),V(z,{...n.getRowProps(),index:a,cells:n.cells,isLoading:t,compact:r})))})}var D=fe;import{useCallback as U,useState as ge}from"react";function w(e){let[o,t]=ge(""),r=U(a=>{t(a.currentTarget.value)},[t]),n=U(()=>{e(o)},[o,e]);return{search:o,onChange:r,onSubmit:n}}import{jsx as R,jsxs as Se}from"react/jsx-runtime";var xe=function({onSearch:e}){let{search:o,onChange:t,onSubmit:r}=w(e);return Se("div",{className:"flex flex-row gap-x-2",children:[R("span",{children:"Search:"}),R("input",{type:"text",value:o,onChange:t}),R("button",{onClick:r,children:"Search"})]})},J=xe;import{useTable as Ce,useGlobalFilter as ye,usePagination as we,useSortBy as Re,useFlexLayout as Ne}from"react-table";import Te from"fuse.js";var Pe=(e,o)=>e.filter(t=>Object.values(t.values).join(", ").toLowerCase().includes(o.toLowerCase())),X=(e,o)=>e.filter(({id:t})=>o.filter(r=>r.id===t).length===0),he=(e,o,t,r,n)=>{let a=e.map(l=>l.values),i=new Te(a,{keys:t.map(l=>({name:l,getFn:c=>c[l]}))}).search(o).map(({item:l})=>l).slice(0,r).map(l=>e.find(c=>c.values.cid===l.cid)).filter(Boolean);return X(i,n)},Y=(e,o,t,r=10)=>{if(t.length<1)return e;let n=Pe(e,t).slice(0,r),a=X(e,n),s=he(a,t,o,r-n.length,n),p=[...n,...s];return e.map(({id:i})=>p.find(l=>l.id===i)).filter(Boolean)};function N({columns:e,data:o,pageSize:t=10}){let r=Ce({columns:e,data:o,initialState:{pageSize:10,pageIndex:0},autoResetGlobalFilter:!1,globalFilter:(l,c,q)=>Y(l,c,q,t)},ye,Re,we,Ne),{gotoPage:n,pageCount:a,state:{pageIndex:s}}=r;return{onSearch:l=>{r.setGlobalFilter(l)},paginationProps:{pageCount:a,pageIndex:s,setPage:l=>{n(l)}},...r}}import{Fragment as Le,jsx as u,jsxs as $}from"react/jsx-runtime";function He({compact:e=!1,isLoading:o=!1,...t}){let{onSearch:r,page:n,prepareRow:a,columns:s,getTableProps:p,headerGroups:i,paginationProps:l}=N(t);return $(Le,{children:[u(J,{onSearch:c=>{r(c)}}),$("div",{...p(),className:"w-full",children:[u("div",{children:i.map(c=>u(W,{headerGroup:c,columns:s,isLoading:o}))}),u(D,{page:n,prepareRow:a,isLoading:o,compact:e})]}),u("div",{className:"px-4",children:u(ve,{...l})})]})}var Ie=He;export{Ie as Table};
|
|
2
2
|
//# sourceMappingURL=index.esm.mjs.map
|
package/dist/index.esm.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/components/Table/components/HeaderColumn/index.tsx", "../src/components/Table/components/HeaderButton/Button.tsx", "../src/components/Table/components/HeaderButton/constants.ts", "../src/components/Table/components/HeaderButton/useWrapperProps.ts", "../src/components/Table/components/HeaderButton/Wrapper.tsx", "../src/components/Table/components/HeaderButton/index.tsx", "../src/components/Table/components/HeaderColumn/useHeaderColumnProps.ts", "../src/components/Table/components/HeaderColumn/constants.ts", "../src/components/Table/components/HeaderGroup/constants.ts", "../src/components/Table/components/HeaderGroup/useHeaderGroupProps.ts", "../src/components/Table/components/HeaderGroup/index.tsx", "../src/components/Table/components/Cell/index.tsx", "../src/components/Table/components/Cell/useCellClassNames.ts", "../src/components/Table/components/Cell/constants.ts", "../src/components/Table/components/Row/useRowClassNames.ts", "../src/components/Table/components/Row/constants.ts", "../src/components/Table/components/Row/index.tsx", "../src/components/Table/components/
|
|
4
|
-
"sourcesContent": ["import { SkeletonLoader } from '@kanda-libs/ks-design-library';\nimport type { FunctionComponent, ReactNode } from 'react';\nimport type { TableHeaderProps } from 'react-table';\nimport HeaderButton from '../HeaderButton';\nimport useHeaderColumnProps from './useHeaderColumnProps';\n\nexport interface HeaderColumnProps extends TableHeaderProps {\n index: number;\n isLoading?: boolean;\n popoverButtons?: boolean;\n label: ReactNode;\n}\n\nconst HeaderColumn: FunctionComponent<HeaderColumnProps> = function ({\n index,\n isLoading = false,\n popoverButtons = false,\n label,\n ...props\n}) {\n const { classNames } = useHeaderColumnProps(index, popoverButtons);\n\n return (\n <div {...props} className={classNames.main}>\n <SkeletonLoader\n isLoading={isLoading}\n wrapperClassName={classNames.loading}\n afterLoading={\n <HeaderButton.Wrapper index={index}>\n <HeaderButton.Button label={label} />\n </HeaderButton.Wrapper>\n }\n />\n </div>\n );\n};\n\nexport default HeaderColumn;\n", "import type { FunctionComponent, HTMLAttributes, ReactNode } from 'react';\nimport { Icon } from '@kanda-libs/ks-design-library';\nimport { BUTTON_CLASS_NAMES, ICON_PROPS } from './constants';\n\nexport interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {\n label: ReactNode;\n}\n\nconst Button: FunctionComponent<ButtonProps> = function ({ label, ...props }) {\n return (\n <button className={BUTTON_CLASS_NAMES} {...props}>\n {label}\n <Icon {...ICON_PROPS} />\n </button>\n );\n};\n\nexport default Button;\n", "export const BUTTON_CLASS_NAMES =\n 'flex px-3 py-1.75 h-9 -ml-3 my-auto rounded-lg bg-transparent hover:bg-neutral-100 text-style-g-em text-neutral-500 whitespace-nowrap z-20';\n\nexport const ICON_PROPS = {\n icon: 'chevron-down',\n stroke: 'neutral-500',\n size: 12,\n className: 'ml-2 my-auto',\n};\n\nexport const WRAPPER_STYLE = {\n width: 'calc(100% + 16px)',\n};\n\nexport const WRAPPER_CLASS_NAMES = {\n container: {\n base: 'w-full h-full overflow-hidden',\n padding: 'pl-4 -ml-4',\n },\n flex: {\n base: 'w-full h-full flex',\n padding: 'pl-4',\n },\n};\n", "import type { CSSProperties } from 'react';\nimport clsx from 'clsx';\nimport { WRAPPER_STYLE, WRAPPER_CLASS_NAMES } from './constants';\n\nexport interface WrapperPropsHook {\n classNames: {\n container: string;\n flex: string;\n };\n containerStyle: CSSProperties;\n}\n\nexport default function useWrapperProps(index: number): WrapperPropsHook {\n const containerStyle = index === 0 ? WRAPPER_STYLE : {};\n\n const classNames = {\n container: clsx(\n WRAPPER_CLASS_NAMES.container.base,\n index === 0 ? WRAPPER_CLASS_NAMES.container.padding : '',\n ),\n flex: clsx(\n WRAPPER_CLASS_NAMES.flex.base,\n index === 0 ? '' : WRAPPER_CLASS_NAMES.flex.padding,\n ),\n };\n\n return {\n classNames,\n containerStyle,\n };\n}\n", "import type { FunctionComponent } from 'react';\nimport useWrapperProps from './useWrapperProps';\n\nexport interface WrapperProps {\n index: number;\n children?: JSX.Element | JSX.Element[];\n}\n\nconst Wrapper: FunctionComponent<WrapperProps> = function ({\n index,\n children,\n}) {\n const { classNames, containerStyle } = useWrapperProps(index);\n\n return (\n <div className={classNames.container} style={containerStyle}>\n <div className={classNames.flex}>{children}</div>\n </div>\n );\n};\n\nexport default Wrapper;\n", "import Button from './Button';\nimport Wrapper from './Wrapper';\n\nexport default {\n Button,\n Wrapper,\n};\n", "import clsx from 'clsx';\nimport { CLASS_NAMES } from './constants';\n\nexport interface HeaderColumnPropsHook {\n classNames: {\n main: string;\n loading: string;\n wrapper: string;\n };\n}\n\nexport default function useHeaderColumnProps(\n index: number,\n popoverButtons: boolean,\n): HeaderColumnPropsHook {\n const classNames = {\n ...CLASS_NAMES,\n loading: clsx(\n CLASS_NAMES.loading.base,\n index === 0 ? '' : CLASS_NAMES.loading.margin,\n ),\n wrapper: clsx(\n CLASS_NAMES.wrapper.padding,\n popoverButtons ? '' : CLASS_NAMES.wrapper.popover,\n ),\n };\n\n return {\n classNames,\n };\n}\n", "export const CLASS_NAMES = {\n main: 'flex h-14',\n loading: {\n base: 'my-auto w-full mr-8',\n margin: 'ml-4',\n },\n wrapper: {\n padding: 'px-2 pt-2',\n popover: 'pb-1',\n },\n};\n\nexport const MOVE_LEFT_ITEM_PROPS = {\n name: 'Move column left',\n icon: 'arrow-left',\n};\n\nexport const MOVE_RIGHT_ITEM_PROPS = {\n name: 'Move column right',\n icon: 'arrow-right',\n};\n\nexport const HIDE_COLUMN_PROPS = {\n name: 'Hide column',\n icon: 'eye-off',\n};\n", "export const CLASS_NAMES = {\n base: 'h-14 border-b border-neutral-200',\n};\n", "import type {\n ColumnInstance,\n HeaderGroup,\n TableHeaderProps,\n} from 'react-table';\n\nexport interface HeaderGroupPropsHook<T extends Object> {\n headers: ColumnInstance<T>[];\n headerGroupProps: TableHeaderProps;\n totalVisible: number;\n}\n\nexport default function useHeaderGroupProps<T extends Object>(\n headerGroup: HeaderGroup<T>,\n columns: ColumnInstance<T>[],\n): HeaderGroupPropsHook<T> {\n const { headers, getHeaderGroupProps } = headerGroup;\n const headerGroupProps = getHeaderGroupProps({});\n\n const totalVisible = columns.filter((column) => column.isVisible).length;\n\n return {\n headers,\n headerGroupProps,\n totalVisible,\n };\n}\n", "import type { PropsWithChildren } from 'react';\nimport type {\n ColumnInstance,\n HeaderGroup as HeaderGroupType,\n} from 'react-table';\nimport HeaderColumn from '../HeaderColumn';\nimport { CLASS_NAMES } from './constants';\nimport useHeaderGroupProps from './useHeaderGroupProps';\n\nexport interface HeaderGroupProps<T extends Object> {\n headerGroup: HeaderGroupType<T>;\n columns: ColumnInstance<T>[];\n isLoading?: boolean;\n}\n\nfunction HeaderGroup<T extends Object>({\n headerGroup,\n columns,\n isLoading,\n}: PropsWithChildren<HeaderGroupProps<T>>) {\n const { headerGroupProps, headers } = useHeaderGroupProps(\n headerGroup,\n columns,\n );\n\n return (\n <div {...headerGroupProps} className={CLASS_NAMES.base}>\n {headers.map((column, index) => (\n <HeaderColumn\n index={index}\n label={column.render('Header')}\n isLoading={isLoading}\n {...column.getHeaderProps(column.getSortByToggleProps())}\n />\n ))}\n </div>\n );\n}\n\nexport default HeaderGroup;\n", "import type { FunctionComponent, ReactNode } from 'react';\nimport type { TableCellProps } from 'react-table';\nimport { SkeletonLoader } from '@kanda-libs/ks-design-library';\nimport useCellClassNames from './useCellClassNames';\n\nexport interface CellProps extends TableCellProps {\n index: number;\n render: () => ReactNode;\n compact?: boolean;\n isLoading?: boolean;\n}\n\nconst Cell: FunctionComponent<CellProps> = function ({\n render,\n index,\n compact = false,\n isLoading = false,\n ...props\n}) {\n const classNames = useCellClassNames(index, compact, isLoading);\n\n return (\n <div {...props} className={classNames.cell}>\n <div className={classNames.container}>\n <div className={classNames.render}>\n <SkeletonLoader\n isLoading={isLoading}\n afterLoading={<>{render()}</>}\n />\n </div>\n </div>\n </div>\n );\n};\n\nexport default Cell;\n", "import clsx from 'clsx';\nimport { CLASS_NAMES } from './constants';\n\nexport type CellClassNamesHook = {\n cell: string;\n container: string;\n render: string;\n};\n\nexport default function useCellClassNames(\n index: number,\n compact: boolean,\n isLoading: boolean,\n): CellClassNamesHook {\n return {\n cell: clsx(\n compact ? CLASS_NAMES.cell.compact : CLASS_NAMES.cell.base,\n index === 0 ? '' : CLASS_NAMES.cell.padding,\n ),\n container: CLASS_NAMES.container,\n render: isLoading ? CLASS_NAMES.renderLoading : CLASS_NAMES.render,\n };\n}\n", "export const CLASS_NAMES = {\n container: 'flex w-full h-full',\n render:\n 'w-full my-auto text-style-g text-neutral-600 whitespace-nowrap overflow-hidden overflow-ellipsis',\n renderLoading: 'w-full my-auto mr-8 text-style-g',\n cell: {\n base: 'h-16 flex',\n compact: 'h-8 flex',\n padding: 'pl-4',\n },\n};\n", "import { useClasses } from '@kanda-libs/ks-design-library';\nimport { CLASS_NAMES } from './constants';\n\nexport interface RowClassNamesHook {\n base: string;\n compact: string;\n border: string;\n hover: string;\n button: string;\n}\n\nexport default function useRowClassNames(index: number): RowClassNamesHook {\n const classNames = useClasses(CLASS_NAMES, {\n base: ['.base', index === 9 ? '' : '.border', '.hover'],\n button: ['.button'],\n });\n\n return classNames as RowClassNamesHook;\n}\n", "export const CLASS_NAMES = {\n base: 'relative h-16',\n compact: 'relative h-8',\n border: 'border-b border-neutral-200',\n hover: 'group hover:bg-neutral-50 cursor-pointer',\n button: 'hidden group-hover:block',\n};\n", "import type { PropsWithChildren } from 'react';\nimport type { Row as RowType, TableRowProps } from 'react-table';\nimport Cell from '../Cell';\nimport useRowClassNames from './useRowClassNames';\n\nexport interface RowProps<T extends Object> extends TableRowProps {\n cells: RowType<T>['cells'];\n index: number;\n compact?: boolean;\n isLoading?: boolean;\n}\n\nfunction Row<T extends Object>({\n cells,\n index,\n compact = false,\n isLoading = false,\n ...props\n}: PropsWithChildren<RowProps<T>>) {\n const classNames = useRowClassNames(index);\n\n console.log({\n props,\n });\n\n return (\n <div {...props} className={compact ? classNames.compact : classNames.base}>\n {cells.map((cell, cellIndex) => (\n <Cell\n {...cell.getCellProps()}\n index={cellIndex}\n isLoading={isLoading}\n render={() => cell.render('Cell')}\n />\n ))}\n </div>\n );\n}\n\nexport default Row;\n", "import { FormEvent, useCallback, useState } from 'react';\n\nexport interface SearchInputHook {\n search: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n onSubmit: () => void;\n}\n\nexport default function useSearchInput(\n onSearch: (search: string) => void,\n): SearchInputHook {\n const [search, setSearch] = useState('');\n\n const onChange = useCallback(\n (e: FormEvent<HTMLInputElement>) => {\n setSearch(e.currentTarget.value);\n },\n [setSearch],\n );\n\n const onSubmit = useCallback(() => {\n onSearch(search);\n }, [search, onSearch]);\n\n return {\n search,\n onChange,\n onSubmit,\n };\n}\n", "import type { FunctionComponent } from 'react';\nimport useSearchInput from './useSearchInput';\n\nexport interface SearchInputProps {\n onSearch: (search: string) => void;\n}\n\nconst SearchInput: FunctionComponent<SearchInputProps> = function ({\n onSearch,\n}) {\n const { search, onChange, onSubmit } = useSearchInput(onSearch);\n\n return (\n <div className=\"flex flex-row gap-x-2\">\n <span>Search:</span>\n <input type=\"text\" value={search} onChange={onChange} />\n <button onClick={onSubmit}>Search</button>\n </div>\n );\n};\n\nexport default SearchInput;\n", "import type { TableInstance, Row } from '../../@types/index';\nimport {\n useTable,\n useGlobalFilter,\n usePagination,\n useSortBy,\n useFlexLayout,\n type IdType,\n TableOptions,\n} from 'react-table';\nimport type { TableProps } from '.';\nimport { globalFilter } from './helpers/search';\nimport type { StringIndexedObject } from '@kanda-libs/ks-design-library';\n\nexport interface TablePropsHook<T extends StringIndexedObject<unknown>>\n extends TableInstance<T> {\n onSearch: (value: string) => void;\n}\n\nexport default function useTableProps<T extends StringIndexedObject<unknown>>({\n columns,\n data,\n pageSize = 10,\n}: TableProps<T>): TablePropsHook<T> {\n const table = useTable<T>(\n {\n columns,\n data,\n initialState: {\n pageSize: 10,\n pageIndex: 0,\n },\n autoResetGlobalFilter: false,\n globalFilter: (\n rows: Row<T>[],\n searchKeys: IdType<T>[],\n filterValue: string,\n ) => globalFilter(rows, searchKeys, filterValue, pageSize),\n } as unknown as TableOptions<T>,\n useGlobalFilter,\n useSortBy,\n usePagination,\n useFlexLayout,\n );\n\n const onSearch = (search: string) => {\n table.setGlobalFilter(search);\n };\n\n return {\n onSearch,\n ...table,\n };\n}\n", "import type { IdType } from 'react-table';\nimport type { Row } from '../../../@types/index';\nimport Fuse from 'fuse.js';\nimport type { StringIndexedObject } from '~/types';\n\nconst exactMatchSearch = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n filterValue: string,\n) => {\n return rows.filter((row) => {\n // Take all values from the row, and add them together in a string\n // for the purposes of searching\n const rowValues = Object.values(row.values).join(', ');\n\n return rowValues.toLowerCase().includes(filterValue.toLowerCase());\n });\n};\n\nconst excludeExactMatches = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n exactMatchRows: Row<T>[],\n) =>\n rows.filter(\n ({ id }) => exactMatchRows.filter((p) => p.id === id).length === 0,\n );\n\nconst fuzzySearch = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n filterValue: string,\n searchKeys: string[],\n numberOfRows: number,\n exactMatchRows: Row<T>[],\n): Row<T>[] => {\n const currentRows = rows.map((row) => {\n return row.values;\n });\n\n const fuse = new Fuse(currentRows, {\n keys: searchKeys.map((key) => ({\n name: key,\n // Because FuseJS allows for dot notation,\n // we need to use a function to get the value\n // as the object returned from the table is flat,\n // rather than nested\n getFn: (obj: StringIndexedObject) => obj[key],\n })),\n });\n\n const results = fuse\n .search(filterValue)\n .map(({ item }) => item)\n .slice(0, numberOfRows);\n\n const filteredResults = results\n .map((result) => rows.find((row) => row.values.cid === result.cid))\n .filter(Boolean) as Row<T>[];\n\n return excludeExactMatches(filteredResults, exactMatchRows);\n};\n\nexport const globalFilter = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n searchKeys: IdType<T>[],\n filterValue: string,\n pageSize = 10,\n): Row<T>[] => {\n if (filterValue.length < 1) {\n return rows;\n }\n\n // Get the first 10 exact matches. The reason for this is that exact matching\n // should take presedence over fuzzy matching. An exact match is more useful\n // but also less expensive to compute. So there's no need to do a fuzzy search\n // if there are >= 10 exact matches.\n const exactMatches = exactMatchSearch(rows, filterValue).slice(0, pageSize);\n const currentRowsExcludingExactMatches = excludeExactMatches(\n rows,\n exactMatches,\n );\n\n const fuzzyMatches = fuzzySearch(\n currentRowsExcludingExactMatches,\n filterValue,\n searchKeys,\n pageSize - exactMatches.length,\n exactMatches,\n );\n\n const results = [...exactMatches, ...fuzzyMatches];\n\n // Return the rows in the same order as the original rows\n // to preserve sorting, which happens before fuzzy matching\n return rows\n .map(({ id }) => results.find((row) => row.id === id))\n .filter(Boolean) as Row<T>[];\n};\n", "import type { StringIndexedObject } from '@kanda-libs/ks-design-library';\nimport type { FunctionComponent, PropsWithChildren } from 'react';\nimport type { Column } from 'react-table';\nimport HeaderGroup from './components/HeaderGroup';\nimport Row from './components/Row';\nimport SearchInput from './components/SearchInput';\nimport useTableProps from './useTableProps';\n\nexport interface TableProps<T extends StringIndexedObject<unknown>> {\n columns: Readonly<Column<T>[]>;\n data: T[];\n filter?: string;\n pageSize?: number;\n compact?: boolean;\n isLoading?: boolean;\n}\n\nexport type TableFunctionComponent<\n T extends StringIndexedObject<unknown> = any,\n> = FunctionComponent<TableProps<T>>;\n\nfunction Table<T extends StringIndexedObject<unknown>>({\n compact = false,\n isLoading = false,\n ...props\n}: PropsWithChildren<TableProps<T>>) {\n const { onSearch, page, prepareRow, columns, getTableProps, headerGroups } =\n useTableProps(props);\n\n return (\n <>\n <SearchInput\n onSearch={(currentSearch) => {\n onSearch(currentSearch);\n }}\n />\n <div {...getTableProps()} className=\"w-full\">\n <div>\n {headerGroups.map((headerGroup) => (\n <HeaderGroup\n headerGroup={headerGroup}\n columns={columns}\n isLoading={isLoading}\n />\n ))}\n </div>\n {page.map((row, index) => {\n prepareRow(row);\n return (\n <Row\n {...row.getRowProps()}\n index={index}\n cells={row.cells}\n compact={compact}\n isLoading={isLoading}\n />\n );\n })}\n </div>\n </>\n );\n}\n\nexport default Table;\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,
|
|
6
|
-
"names": ["SkeletonLoader", "Icon", "BUTTON_CLASS_NAMES", "ICON_PROPS", "WRAPPER_STYLE", "WRAPPER_CLASS_NAMES", "jsx", "jsxs", "Button", "label", "props", "BUTTON_CLASS_NAMES", "Icon", "ICON_PROPS", "Button_default", "clsx", "useWrapperProps", "index", "containerStyle", "WRAPPER_STYLE", "clsx", "WRAPPER_CLASS_NAMES", "jsx", "Wrapper", "index", "children", "classNames", "containerStyle", "useWrapperProps", "Wrapper_default", "HeaderButton_default", "Button_default", "Wrapper_default", "clsx", "CLASS_NAMES", "useHeaderColumnProps", "index", "popoverButtons", "CLASS_NAMES", "clsx", "jsx", "HeaderColumn", "index", "isLoading", "popoverButtons", "label", "props", "classNames", "useHeaderColumnProps", "SkeletonLoader", "HeaderButton_default", "HeaderColumn_default", "CLASS_NAMES", "useHeaderGroupProps", "headerGroup", "columns", "headers", "getHeaderGroupProps", "headerGroupProps", "totalVisible", "column", "jsx", "HeaderGroup", "headerGroup", "columns", "isLoading", "headerGroupProps", "headers", "useHeaderGroupProps", "CLASS_NAMES", "column", "index", "HeaderColumn_default", "HeaderGroup_default", "SkeletonLoader", "clsx", "CLASS_NAMES", "useCellClassNames", "index", "compact", "isLoading", "clsx", "CLASS_NAMES", "Fragment", "jsx", "Cell", "render", "index", "compact", "isLoading", "props", "classNames", "useCellClassNames", "SkeletonLoader", "Cell_default", "useClasses", "CLASS_NAMES", "useRowClassNames", "index", "useClasses", "CLASS_NAMES", "jsx", "Row", "cells", "index", "compact", "isLoading", "props", "classNames", "useRowClassNames", "cell", "cellIndex", "Cell_default", "Row_default", "useCallback", "useState", "useSearchInput", "onSearch", "search", "setSearch", "onChange", "e", "onSubmit", "jsx", "jsxs", "SearchInput", "onSearch", "search", "onChange", "onSubmit", "useSearchInput", "SearchInput_default", "useTable", "useGlobalFilter", "usePagination", "useSortBy", "useFlexLayout", "Fuse", "exactMatchSearch", "rows", "filterValue", "row", "excludeExactMatches", "exactMatchRows", "id", "p", "fuzzySearch", "searchKeys", "numberOfRows", "currentRows", "filteredResults", "key", "obj", "item", "result", "globalFilter", "pageSize", "exactMatches", "currentRowsExcludingExactMatches", "fuzzyMatches", "results", "useTableProps", "columns", "data", "pageSize", "table", "useTable", "rows", "searchKeys", "filterValue", "globalFilter", "useGlobalFilter", "useSortBy", "usePagination", "useFlexLayout", "search", "Fragment", "jsx", "jsxs", "Table", "compact", "isLoading", "props", "onSearch", "page", "prepareRow", "columns", "getTableProps", "headerGroups", "useTableProps", "SearchInput_default", "currentSearch", "headerGroup", "HeaderGroup_default", "
|
|
3
|
+
"sources": ["../src/components/Table/index.tsx", "../src/components/Table/components/HeaderColumn/index.tsx", "../src/hooks/useMobileFullWidthCellStyle.ts", "../src/components/Table/components/HeaderButton/Button.tsx", "../src/components/Table/components/HeaderButton/constants.ts", "../src/components/Table/components/HeaderButton/useWrapperProps.ts", "../src/components/Table/components/HeaderButton/Wrapper.tsx", "../src/components/Table/components/HeaderButton/index.tsx", "../src/components/Table/components/HeaderColumn/useHeaderColumnProps.ts", "../src/components/Table/components/HeaderColumn/constants.ts", "../src/components/Table/components/HeaderGroup/constants.ts", "../src/components/Table/components/HeaderGroup/useHeaderGroupProps.ts", "../src/components/Table/components/HeaderGroup/index.tsx", "../src/components/Table/components/Cell/index.tsx", "../src/components/Table/components/Cell/useCellClassNames.ts", "../src/components/Table/components/Cell/constants.ts", "../src/components/Table/components/Row/useRowClassNames.ts", "../src/components/Table/components/Row/constants.ts", "../src/components/Table/components/Row/index.tsx", "../src/components/Table/components/Pages/index.tsx", "../src/components/Table/components/SearchInput/useSearchInput.ts", "../src/components/Table/components/SearchInput/index.tsx", "../src/components/Table/useTableProps.ts", "../src/components/Table/helpers/search.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n Pagination,\n type StringIndexedObject,\n} from '@kanda-libs/ks-design-library';\nimport type { FunctionComponent, PropsWithChildren } from 'react';\nimport type { Column } from 'react-table';\nimport HeaderGroup from './components/HeaderGroup';\nimport Pages from './components/Pages';\nimport SearchInput from './components/SearchInput';\nimport useTableProps from './useTableProps';\n\nexport interface TableProps<T extends StringIndexedObject<unknown>> {\n columns: Readonly<Column<T>[]>;\n data: T[];\n filter?: string;\n pageSize?: number;\n compact?: boolean;\n isLoading?: boolean;\n}\n\nexport type TableFunctionComponent<\n T extends StringIndexedObject<unknown> = any,\n> = FunctionComponent<TableProps<T>>;\n\nfunction Table<T extends StringIndexedObject<unknown>>({\n compact = false,\n isLoading = false,\n ...props\n}: PropsWithChildren<TableProps<T>>) {\n const {\n onSearch,\n page,\n prepareRow,\n columns,\n getTableProps,\n headerGroups,\n paginationProps,\n } = useTableProps(props);\n\n return (\n <>\n <SearchInput\n onSearch={(currentSearch) => {\n onSearch(currentSearch);\n }}\n />\n <div {...getTableProps()} className=\"w-full\">\n <div>\n {headerGroups.map((headerGroup) => (\n <HeaderGroup\n headerGroup={headerGroup}\n columns={columns}\n isLoading={isLoading}\n />\n ))}\n </div>\n <Pages\n page={page}\n prepareRow={prepareRow}\n isLoading={isLoading}\n compact={compact}\n />\n </div>\n <div className=\"px-4\">\n <Pagination {...paginationProps} />\n </div>\n </>\n );\n}\n\nexport default Table;\n", "import { SkeletonLoader } from '@kanda-libs/ks-design-library';\nimport type { FunctionComponent, ReactNode } from 'react';\nimport type { TableHeaderProps } from 'react-table';\nimport useMobileFullWidthCellStyle from '~/hooks/useMobileFullWidthCellStyle';\nimport HeaderButton from '../HeaderButton';\nimport useHeaderColumnProps from './useHeaderColumnProps';\n\nexport interface HeaderColumnProps extends TableHeaderProps {\n index: number;\n isLoading?: boolean;\n popoverButtons?: boolean;\n label: ReactNode;\n}\n\nconst HeaderColumn: FunctionComponent<HeaderColumnProps> = function ({\n index,\n isLoading = false,\n popoverButtons = false,\n label,\n ...props\n}) {\n const { classNames } = useHeaderColumnProps(index, popoverButtons);\n\n const { style: unformattedStyle, ...formattedProps } = props;\n const style = useMobileFullWidthCellStyle(unformattedStyle);\n\n return (\n <div {...formattedProps} style={style} className={classNames.main}>\n <SkeletonLoader\n isLoading={isLoading}\n wrapperClassName={classNames.loading}\n afterLoading={\n <HeaderButton.Wrapper index={index}>\n <HeaderButton.Button label={label} />\n </HeaderButton.Wrapper>\n }\n />\n </div>\n );\n};\n\nexport default HeaderColumn;\n", "import { useIsDesktop } from '@kanda-libs/ks-design-library';\nimport type { CSSProperties } from 'react';\n\nexport type MobileFullWidthCellStyleHook = CSSProperties;\n\nexport default function useMobileFullWidthCellStyle(\n style?: CSSProperties,\n): MobileFullWidthCellStyleHook {\n if (!style) return {};\n\n const isDesktop = useIsDesktop();\n\n // For mobile, we want to make sure that the cell is always 100% width\n const formattedStyle = {\n ...style,\n width: isDesktop ? style?.width : '100%',\n };\n\n return formattedStyle;\n}\n", "import type { FunctionComponent, HTMLAttributes, ReactNode } from 'react';\nimport { Icon } from '@kanda-libs/ks-design-library';\nimport { BUTTON_CLASS_NAMES, ICON_PROPS } from './constants';\n\nexport interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {\n label: ReactNode;\n}\n\nconst Button: FunctionComponent<ButtonProps> = function ({ label, ...props }) {\n return (\n <button className={BUTTON_CLASS_NAMES} {...props}>\n {label}\n <Icon {...ICON_PROPS} />\n </button>\n );\n};\n\nexport default Button;\n", "export const BUTTON_CLASS_NAMES =\n 'flex px-3 py-1.75 h-9 -ml-3 my-auto rounded-lg bg-transparent hover:bg-neutral-100 text-style-g-em text-neutral-500 whitespace-nowrap z-20';\n\nexport const ICON_PROPS = {\n icon: 'chevron-down',\n stroke: 'neutral-500',\n size: 12,\n className: 'ml-2 my-auto',\n};\n\nexport const WRAPPER_STYLE = {\n width: 'calc(100% + 16px)',\n};\n\nexport const WRAPPER_CLASS_NAMES = {\n container: {\n base: 'w-full h-full overflow-hidden',\n padding: 'pl-4 -ml-4',\n },\n flex: {\n base: 'w-full h-full md:flex px-4 md:px-0',\n padding: 'md:pl-4',\n },\n};\n", "import type { CSSProperties } from 'react';\nimport clsx from 'clsx';\nimport { WRAPPER_STYLE, WRAPPER_CLASS_NAMES } from './constants';\n\nexport interface WrapperPropsHook {\n classNames: {\n container: string;\n flex: string;\n };\n containerStyle: CSSProperties;\n}\n\nexport default function useWrapperProps(index: number): WrapperPropsHook {\n const containerStyle = index === 0 ? WRAPPER_STYLE : {};\n\n const classNames = {\n container: clsx(\n WRAPPER_CLASS_NAMES.container.base,\n index === 0 ? WRAPPER_CLASS_NAMES.container.padding : '',\n ),\n flex: clsx(\n WRAPPER_CLASS_NAMES.flex.base,\n index === 0 ? '' : WRAPPER_CLASS_NAMES.flex.padding,\n ),\n };\n\n return {\n classNames,\n containerStyle,\n };\n}\n", "import type { FunctionComponent } from 'react';\nimport useWrapperProps from './useWrapperProps';\n\nexport interface WrapperProps {\n index: number;\n children?: JSX.Element | JSX.Element[];\n}\n\nconst Wrapper: FunctionComponent<WrapperProps> = function ({\n index,\n children,\n}) {\n const { classNames, containerStyle } = useWrapperProps(index);\n\n return (\n <div className={classNames.container} style={containerStyle}>\n <div className={classNames.flex}>{children}</div>\n </div>\n );\n};\n\nexport default Wrapper;\n", "import Button from './Button';\nimport Wrapper from './Wrapper';\n\nexport default {\n Button,\n Wrapper,\n};\n", "import clsx from 'clsx';\nimport { CLASS_NAMES } from './constants';\n\nexport interface HeaderColumnPropsHook {\n classNames: {\n main: string;\n loading: string;\n wrapper: string;\n };\n}\n\nexport default function useHeaderColumnProps(\n index: number,\n popoverButtons: boolean,\n): HeaderColumnPropsHook {\n const classNames = {\n ...CLASS_NAMES,\n loading: clsx(\n CLASS_NAMES.loading.base,\n index === 0 ? '' : CLASS_NAMES.loading.margin,\n ),\n wrapper: clsx(\n CLASS_NAMES.wrapper.padding,\n popoverButtons ? '' : CLASS_NAMES.wrapper.popover,\n ),\n };\n\n return {\n classNames,\n };\n}\n", "export const CLASS_NAMES = {\n main: 'flex md:h-14',\n loading: {\n base: 'my-auto w-full mr-8',\n margin: 'ml-4',\n },\n wrapper: {\n padding: 'md:px-2 md:pt-2',\n popover: 'pb-1',\n },\n};\n\nexport const MOVE_LEFT_ITEM_PROPS = {\n name: 'Move column left',\n icon: 'arrow-left',\n};\n\nexport const MOVE_RIGHT_ITEM_PROPS = {\n name: 'Move column right',\n icon: 'arrow-right',\n};\n\nexport const HIDE_COLUMN_PROPS = {\n name: 'Hide column',\n icon: 'eye-off',\n};\n", "export const CLASS_NAMES = {\n base: 'flex-col md:flex-row md:h-14 hidden lg:block border-b border-neutral-200',\n};\n", "import type {\n ColumnInstance,\n HeaderGroup,\n TableHeaderProps,\n} from 'react-table';\n\nexport interface HeaderGroupPropsHook<T extends Object> {\n headers: ColumnInstance<T>[];\n headerGroupProps: TableHeaderProps;\n totalVisible: number;\n}\n\nexport default function useHeaderGroupProps<T extends Object>(\n headerGroup: HeaderGroup<T>,\n columns: ColumnInstance<T>[],\n): HeaderGroupPropsHook<T> {\n const { headers, getHeaderGroupProps } = headerGroup;\n const headerGroupProps = getHeaderGroupProps({});\n\n const totalVisible = columns.filter((column) => column.isVisible).length;\n\n return {\n headers,\n headerGroupProps,\n totalVisible,\n };\n}\n", "import type { PropsWithChildren } from 'react';\nimport type {\n ColumnInstance,\n HeaderGroup as HeaderGroupType,\n} from 'react-table';\nimport HeaderColumn from '../HeaderColumn';\nimport { CLASS_NAMES } from './constants';\nimport useHeaderGroupProps from './useHeaderGroupProps';\n\nexport interface HeaderGroupProps<T extends Object> {\n headerGroup: HeaderGroupType<T>;\n columns: ColumnInstance<T>[];\n isLoading?: boolean;\n}\n\nfunction HeaderGroup<T extends Object>({\n headerGroup,\n columns,\n isLoading,\n}: PropsWithChildren<HeaderGroupProps<T>>) {\n const { headerGroupProps, headers } = useHeaderGroupProps(\n headerGroup,\n columns,\n );\n\n return (\n <div {...headerGroupProps} className={CLASS_NAMES.base}>\n {headers.map((column, index) => (\n <HeaderColumn\n index={index}\n label={column.render('Header')}\n isLoading={isLoading}\n {...column.getHeaderProps(column.getSortByToggleProps())}\n />\n ))}\n </div>\n );\n}\n\nexport default HeaderGroup;\n", "import type { FunctionComponent, ReactNode } from 'react';\nimport type { TableCellProps } from 'react-table';\nimport { SkeletonLoader, Text } from '@kanda-libs/ks-design-library';\nimport useCellClassNames from './useCellClassNames';\nimport useMobileFullWidthCellStyle from '~/hooks/useMobileFullWidthCellStyle';\n\nexport interface CellProps extends TableCellProps {\n index: number;\n render: () => ReactNode;\n compact?: boolean;\n isLoading?: boolean;\n label?: string;\n}\n\nconst Cell: FunctionComponent<CellProps> = function ({\n render,\n index,\n compact = false,\n isLoading = false,\n label,\n ...props\n}) {\n const classNames = useCellClassNames(index, compact, isLoading);\n\n const { style: unformattedStyle, ...formattedProps } = props;\n const style = useMobileFullWidthCellStyle(unformattedStyle);\n\n return (\n <div {...formattedProps} style={style} className={classNames.cell}>\n <div className={classNames.container}>\n <div className={classNames.render}>\n <SkeletonLoader\n isLoading={isLoading}\n afterLoading={\n <>\n <Text text={`${label}:`} className={classNames.mobileLabel} />\n {render()}\n </>\n }\n />\n </div>\n </div>\n </div>\n );\n};\n\nexport default Cell;\n", "import clsx from 'clsx';\nimport { CLASS_NAMES } from './constants';\n\nexport type CellClassNamesHook = {\n cell: string;\n container: string;\n render: string;\n mobileLabel: string;\n};\n\nexport default function useCellClassNames(\n index: number,\n compact: boolean,\n isLoading: boolean,\n): CellClassNamesHook {\n return {\n cell: clsx(\n compact ? CLASS_NAMES.cell.compact : CLASS_NAMES.cell.base,\n index === 0 ? '' : CLASS_NAMES.cell.padding,\n ),\n container: CLASS_NAMES.container,\n render: isLoading ? CLASS_NAMES.renderLoading : CLASS_NAMES.render,\n mobileLabel: CLASS_NAMES.mobileLabel,\n };\n}\n", "export const CLASS_NAMES = {\n container: 'flex w-full h-full',\n render:\n 'w-full my-auto text-style-g text-neutral-600 whitespace-nowrap overflow-hidden overflow-ellipsis',\n renderLoading: 'w-full my-auto mr-8 text-style-g',\n mobileLabel: 'block md:hidden text-16-24-em text-neutral-600 mr-2',\n cell: {\n base: 'px-4 py-1 md:pt-0 md:pr-0 md:pb-0 md:h-16 flex',\n compact: 'h-8 flex',\n padding: 'md:pl-4',\n },\n};\n", "import { useClasses } from '@kanda-libs/ks-design-library';\nimport { CLASS_NAMES } from './constants';\n\nexport interface RowClassNamesHook {\n base: string;\n compact: string;\n border: string;\n hover: string;\n button: string;\n}\n\nexport default function useRowClassNames(index: number): RowClassNamesHook {\n const classNames = useClasses(CLASS_NAMES, {\n base: ['.base', index === 9 ? '' : '.border', '.hover'],\n button: ['.button'],\n });\n\n return classNames as RowClassNamesHook;\n}\n", "export const CLASS_NAMES = {\n base: 'relative md:h-16 flex-col py-2 md:py-0 md:flex-row',\n compact: 'relative h-8',\n border: 'border-b border-neutral-200',\n hover: 'group hover:bg-neutral-50 cursor-pointer',\n button: 'hidden group-hover:block',\n};\n", "import type { PropsWithChildren } from 'react';\nimport type { Row as RowType, TableRowProps } from 'react-table';\nimport Cell from '../Cell';\nimport useRowClassNames from './useRowClassNames';\n\nexport interface RowProps<T extends Object> extends TableRowProps {\n cells: RowType<T>['cells'];\n index: number;\n compact?: boolean;\n isLoading?: boolean;\n}\n\nfunction Row<T extends Object>({\n cells,\n index,\n compact = false,\n isLoading = false,\n ...props\n}: PropsWithChildren<RowProps<T>>) {\n const classNames = useRowClassNames(index);\n\n return (\n <div {...props} className={compact ? classNames.compact : classNames.base}>\n {cells.map((cell, cellIndex) => (\n <Cell\n {...cell.getCellProps()}\n index={cellIndex}\n isLoading={isLoading}\n render={() => cell.render('Cell')}\n label={cell.column.Header as string}\n />\n ))}\n </div>\n );\n}\n\nexport default Row;\n", "import type { StringIndexedObject } from '@kanda-libs/ks-design-library';\nimport type { PropsWithChildren } from 'react';\nimport type { Row as RowType } from 'react-table';\nimport Row from '../Row';\n\nexport interface PagesProps<T extends StringIndexedObject> {\n page: RowType<T>[];\n prepareRow: (row: RowType<T>) => void;\n isLoading?: boolean;\n compact?: boolean;\n}\n\nfunction Pages<T extends StringIndexedObject>({\n page,\n prepareRow,\n isLoading = false,\n compact = false,\n}: PropsWithChildren<PagesProps<T>>) {\n return (\n <>\n {page.map((row, index) => {\n prepareRow(row);\n return (\n <Row\n {...row.getRowProps()}\n index={index}\n cells={row.cells}\n isLoading={isLoading}\n compact={compact}\n />\n );\n })}\n </>\n );\n}\nexport default Pages;\n", "import { FormEvent, useCallback, useState } from 'react';\n\nexport interface SearchInputHook {\n search: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n onSubmit: () => void;\n}\n\nexport default function useSearchInput(\n onSearch: (search: string) => void,\n): SearchInputHook {\n const [search, setSearch] = useState('');\n\n const onChange = useCallback(\n (e: FormEvent<HTMLInputElement>) => {\n setSearch(e.currentTarget.value);\n },\n [setSearch],\n );\n\n const onSubmit = useCallback(() => {\n onSearch(search);\n }, [search, onSearch]);\n\n return {\n search,\n onChange,\n onSubmit,\n };\n}\n", "import type { FunctionComponent } from 'react';\nimport useSearchInput from './useSearchInput';\n\nexport interface SearchInputProps {\n onSearch: (search: string) => void;\n}\n\nconst SearchInput: FunctionComponent<SearchInputProps> = function ({\n onSearch,\n}) {\n const { search, onChange, onSubmit } = useSearchInput(onSearch);\n\n return (\n <div className=\"flex flex-row gap-x-2\">\n <span>Search:</span>\n <input type=\"text\" value={search} onChange={onChange} />\n <button onClick={onSubmit}>Search</button>\n </div>\n );\n};\n\nexport default SearchInput;\n", "import type { TableInstance, Row } from '../../@types/index';\nimport {\n useTable,\n useGlobalFilter,\n usePagination,\n useSortBy,\n useFlexLayout,\n type IdType,\n TableOptions,\n} from 'react-table';\nimport type { TableProps } from '.';\nimport { globalFilter } from './helpers/search';\nimport type {\n PaginationProps,\n StringIndexedObject,\n} from '@kanda-libs/ks-design-library';\n\nexport interface TablePropsHook<T extends StringIndexedObject<unknown>>\n extends TableInstance<T> {\n onSearch: (value: string) => void;\n paginationProps: PaginationProps;\n}\n\nexport default function useTableProps<T extends StringIndexedObject<unknown>>({\n columns,\n data,\n pageSize = 10,\n}: TableProps<T>): TablePropsHook<T> {\n const table = useTable<T>(\n {\n columns,\n data,\n initialState: {\n pageSize: 10,\n pageIndex: 0,\n },\n autoResetGlobalFilter: false,\n globalFilter: (\n rows: Row<T>[],\n searchKeys: IdType<T>[],\n filterValue: string,\n ) => globalFilter(rows, searchKeys, filterValue, pageSize),\n } as unknown as TableOptions<T>,\n useGlobalFilter,\n useSortBy,\n usePagination,\n useFlexLayout,\n );\n\n const {\n gotoPage,\n pageCount,\n state: { pageIndex },\n } = table;\n\n const paginationProps: PaginationProps = {\n pageCount,\n pageIndex,\n setPage: (nextPage: number) => {\n gotoPage(nextPage);\n },\n };\n\n const onSearch = (search: string) => {\n table.setGlobalFilter(search);\n };\n\n return {\n onSearch,\n paginationProps,\n ...table,\n };\n}\n", "import type { IdType } from 'react-table';\nimport type { Row } from '../../../@types/index';\nimport Fuse from 'fuse.js';\nimport type { StringIndexedObject } from '~/types';\n\nconst exactMatchSearch = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n filterValue: string,\n) => {\n return rows.filter((row) => {\n // Take all values from the row, and add them together in a string\n // for the purposes of searching\n const rowValues = Object.values(row.values).join(', ');\n\n return rowValues.toLowerCase().includes(filterValue.toLowerCase());\n });\n};\n\nconst excludeExactMatches = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n exactMatchRows: Row<T>[],\n) =>\n rows.filter(\n ({ id }) => exactMatchRows.filter((p) => p.id === id).length === 0,\n );\n\nconst fuzzySearch = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n filterValue: string,\n searchKeys: string[],\n numberOfRows: number,\n exactMatchRows: Row<T>[],\n): Row<T>[] => {\n const currentRows = rows.map((row) => {\n return row.values;\n });\n\n const fuse = new Fuse(currentRows, {\n keys: searchKeys.map((key) => ({\n name: key,\n // Because FuseJS allows for dot notation,\n // we need to use a function to get the value\n // as the object returned from the table is flat,\n // rather than nested\n getFn: (obj: StringIndexedObject) => obj[key],\n })),\n });\n\n const results = fuse\n .search(filterValue)\n .map(({ item }) => item)\n .slice(0, numberOfRows);\n\n const filteredResults = results\n .map((result) => rows.find((row) => row.values.cid === result.cid))\n .filter(Boolean) as Row<T>[];\n\n return excludeExactMatches(filteredResults, exactMatchRows);\n};\n\nexport const globalFilter = <T extends StringIndexedObject<unknown>>(\n rows: Row<T>[],\n searchKeys: IdType<T>[],\n filterValue: string,\n pageSize = 10,\n): Row<T>[] => {\n if (filterValue.length < 1) {\n return rows;\n }\n\n // Get the first 10 exact matches. The reason for this is that exact matching\n // should take presedence over fuzzy matching. An exact match is more useful\n // but also less expensive to compute. So there's no need to do a fuzzy search\n // if there are >= 10 exact matches.\n const exactMatches = exactMatchSearch(rows, filterValue).slice(0, pageSize);\n const currentRowsExcludingExactMatches = excludeExactMatches(\n rows,\n exactMatches,\n );\n\n const fuzzyMatches = fuzzySearch(\n currentRowsExcludingExactMatches,\n filterValue,\n searchKeys,\n pageSize - exactMatches.length,\n exactMatches,\n );\n\n const results = [...exactMatches, ...fuzzyMatches];\n\n // Return the rows in the same order as the original rows\n // to preserve sorting, which happens before fuzzy matching\n return rows\n .map(({ id }) => results.find((row) => row.id === id))\n .filter(Boolean) as Row<T>[];\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OACE,cAAAA,OAEK,gCCHP,OAAS,kBAAAC,OAAsB,gCCA/B,OAAS,gBAAAC,MAAoB,gCAKd,SAARC,EACLC,EAC8B,CAC9B,GAAI,CAACA,EAAO,MAAO,CAAC,EAEpB,IAAMC,EAAYH,EAAa,EAQ/B,MALuB,CACrB,GAAGE,EACH,MAAOC,EAAYD,GAAA,YAAAA,EAAO,MAAQ,MACpC,CAGF,CClBA,OAAS,QAAAE,MAAY,gCCDd,IAAMC,EACX,6IAEWC,EAAa,CACxB,KAAM,eACN,OAAQ,cACR,KAAM,GACN,UAAW,cACb,EAEaC,EAAgB,CAC3B,MAAO,mBACT,EAEaC,EAAsB,CACjC,UAAW,CACT,KAAM,gCACN,QAAS,YACX,EACA,KAAM,CACJ,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CACF,EAAIC,EAAcR,CAAK,EAEvB,OACEJ,EAAAF,GAAA,CACE,UAAAC,EAACc,EAAA,CACC,SAAWC,GAAkB,CAC3BT,EAASS,CAAa,CACxB,EACF,EACAd,EAAC,OAAK,GAAGS,EAAc,EAAG,UAAU,SAClC,UAAAV,EAAC,OACE,SAAAW,EAAa,IAAKK,GACjBhB,EAACiB,EAAA,CACC,YAAaD,EACb,QAASP,EACT,UAAWL,EACb,CACD,EACH,EACAJ,EAACkB,EAAA,CACC,KAAMX,EACN,WAAYC,EACZ,UAAWJ,EACX,QAASD,EACX,GACF,EACAH,EAAC,OAAI,UAAU,OACb,SAAAA,EAACmB,GAAA,CAAY,GAAGP,EAAiB,EACnC,GACF,CAEJ,CAEA,IAAOQ,GAAQlB",
|
|
6
|
+
"names": ["Pagination", "SkeletonLoader", "useIsDesktop", "useMobileFullWidthCellStyle", "style", "isDesktop", "Icon", "BUTTON_CLASS_NAMES", "ICON_PROPS", "WRAPPER_STYLE", "WRAPPER_CLASS_NAMES", "jsx", "jsxs", "Button", "label", "props", "BUTTON_CLASS_NAMES", "Icon", "ICON_PROPS", "Button_default", "clsx", "useWrapperProps", "index", "containerStyle", "WRAPPER_STYLE", "clsx", "WRAPPER_CLASS_NAMES", "jsx", "Wrapper", "index", "children", "classNames", "containerStyle", "useWrapperProps", "Wrapper_default", "HeaderButton_default", "Button_default", "Wrapper_default", "clsx", "CLASS_NAMES", "useHeaderColumnProps", "index", "popoverButtons", "CLASS_NAMES", "clsx", "jsx", "HeaderColumn", "index", "isLoading", "popoverButtons", "label", "props", "classNames", "useHeaderColumnProps", "unformattedStyle", "formattedProps", "style", "useMobileFullWidthCellStyle", "SkeletonLoader", "HeaderButton_default", "HeaderColumn_default", "CLASS_NAMES", "useHeaderGroupProps", "headerGroup", "columns", "headers", "getHeaderGroupProps", "headerGroupProps", "totalVisible", "column", "jsx", "HeaderGroup", "headerGroup", "columns", "isLoading", "headerGroupProps", "headers", "useHeaderGroupProps", "CLASS_NAMES", "column", "index", "HeaderColumn_default", "HeaderGroup_default", "SkeletonLoader", "Text", "clsx", "CLASS_NAMES", "useCellClassNames", "index", "compact", "isLoading", "clsx", "CLASS_NAMES", "Fragment", "jsx", "jsxs", "Cell", "render", "index", "compact", "isLoading", "label", "props", "classNames", "useCellClassNames", "unformattedStyle", "formattedProps", "style", "useMobileFullWidthCellStyle", "SkeletonLoader", "Text", "Cell_default", "useClasses", "CLASS_NAMES", "useRowClassNames", "index", "useClasses", "CLASS_NAMES", "jsx", "Row", "cells", "index", "compact", "isLoading", "props", "classNames", "useRowClassNames", "cell", "cellIndex", "Cell_default", "Row_default", "Fragment", "jsx", "Pages", "page", "prepareRow", "isLoading", "compact", "row", "index", "Row_default", "Pages_default", "useCallback", "useState", "useSearchInput", "onSearch", "search", "setSearch", "onChange", "e", "onSubmit", "jsx", "jsxs", "SearchInput", "onSearch", "search", "onChange", "onSubmit", "useSearchInput", "SearchInput_default", "useTable", "useGlobalFilter", "usePagination", "useSortBy", "useFlexLayout", "Fuse", "exactMatchSearch", "rows", "filterValue", "row", "excludeExactMatches", "exactMatchRows", "id", "p", "fuzzySearch", "searchKeys", "numberOfRows", "currentRows", "filteredResults", "key", "obj", "item", "result", "globalFilter", "pageSize", "exactMatches", "currentRowsExcludingExactMatches", "fuzzyMatches", "results", "useTableProps", "columns", "data", "pageSize", "table", "useTable", "rows", "searchKeys", "filterValue", "globalFilter", "useGlobalFilter", "useSortBy", "usePagination", "useFlexLayout", "gotoPage", "pageCount", "pageIndex", "search", "nextPage", "Fragment", "jsx", "jsxs", "Table", "compact", "isLoading", "props", "onSearch", "page", "prepareRow", "columns", "getTableProps", "headerGroups", "paginationProps", "useTableProps", "SearchInput_default", "currentSearch", "headerGroup", "HeaderGroup_default", "Pages_default", "Pagination", "Table_default"]
|
|
7
7
|
}
|
package/dist/library.css
CHANGED
|
@@ -776,6 +776,12 @@ video {
|
|
|
776
776
|
line-height: 24px;
|
|
777
777
|
}
|
|
778
778
|
|
|
779
|
+
.text-16-24-em {
|
|
780
|
+
font-weight: 600;
|
|
781
|
+
font-size: 16px;
|
|
782
|
+
line-height: 24px;
|
|
783
|
+
}
|
|
784
|
+
|
|
779
785
|
.text-16-20-em {
|
|
780
786
|
font-weight: 600;
|
|
781
787
|
font-size: 16px;
|
|
@@ -997,6 +1003,10 @@ video {
|
|
|
997
1003
|
margin-right: 32px;
|
|
998
1004
|
}
|
|
999
1005
|
|
|
1006
|
+
.mr-2 {
|
|
1007
|
+
margin-right: 8px;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1000
1010
|
.-ml-3 {
|
|
1001
1011
|
margin-left: -12px;
|
|
1002
1012
|
}
|
|
@@ -1013,6 +1023,10 @@ video {
|
|
|
1013
1023
|
margin-left: 16px;
|
|
1014
1024
|
}
|
|
1015
1025
|
|
|
1026
|
+
.block {
|
|
1027
|
+
display: block;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1016
1030
|
.flex {
|
|
1017
1031
|
display: flex;
|
|
1018
1032
|
}
|
|
@@ -1029,10 +1043,6 @@ video {
|
|
|
1029
1043
|
height: 100%;
|
|
1030
1044
|
}
|
|
1031
1045
|
|
|
1032
|
-
.h-16 {
|
|
1033
|
-
height: 64px;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
1046
|
.h-8 {
|
|
1037
1047
|
height: 32px;
|
|
1038
1048
|
}
|
|
@@ -1041,10 +1051,6 @@ video {
|
|
|
1041
1051
|
height: 36px;
|
|
1042
1052
|
}
|
|
1043
1053
|
|
|
1044
|
-
.h-14 {
|
|
1045
|
-
height: 56px;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
1054
|
.w-full {
|
|
1049
1055
|
width: 100%;
|
|
1050
1056
|
}
|
|
@@ -1061,6 +1067,10 @@ video {
|
|
|
1061
1067
|
flex-direction: row;
|
|
1062
1068
|
}
|
|
1063
1069
|
|
|
1070
|
+
.flex-col {
|
|
1071
|
+
flex-direction: column;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1064
1074
|
.gap-x-2 {
|
|
1065
1075
|
-moz-column-gap: 8px;
|
|
1066
1076
|
column-gap: 8px;
|
|
@@ -1099,6 +1109,16 @@ video {
|
|
|
1099
1109
|
background-color: transparent;
|
|
1100
1110
|
}
|
|
1101
1111
|
|
|
1112
|
+
.px-4 {
|
|
1113
|
+
padding-left: 16px;
|
|
1114
|
+
padding-right: 16px;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
.py-1 {
|
|
1118
|
+
padding-top: 4px;
|
|
1119
|
+
padding-bottom: 4px;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1102
1122
|
.px-3 {
|
|
1103
1123
|
padding-left: 12px;
|
|
1104
1124
|
padding-right: 12px;
|
|
@@ -1109,24 +1129,15 @@ video {
|
|
|
1109
1129
|
padding-bottom: 7px;
|
|
1110
1130
|
}
|
|
1111
1131
|
|
|
1112
|
-
.py-
|
|
1113
|
-
padding-top:
|
|
1114
|
-
padding-bottom:
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
.px-2 {
|
|
1118
|
-
padding-left: 8px;
|
|
1119
|
-
padding-right: 8px;
|
|
1132
|
+
.py-2 {
|
|
1133
|
+
padding-top: 8px;
|
|
1134
|
+
padding-bottom: 8px;
|
|
1120
1135
|
}
|
|
1121
1136
|
|
|
1122
1137
|
.pl-4 {
|
|
1123
1138
|
padding-left: 16px;
|
|
1124
1139
|
}
|
|
1125
1140
|
|
|
1126
|
-
.pt-2 {
|
|
1127
|
-
padding-top: 8px;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
1141
|
.pb-1 {
|
|
1131
1142
|
padding-bottom: 4px;
|
|
1132
1143
|
}
|
|
@@ -2051,3 +2062,66 @@ Modified version of toast CSS to match designs
|
|
|
2051
2062
|
.group:hover .group-hover\:block {
|
|
2052
2063
|
display: block;
|
|
2053
2064
|
}
|
|
2065
|
+
|
|
2066
|
+
@media (min-width: 768px) {
|
|
2067
|
+
.md\:flex {
|
|
2068
|
+
display: flex;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
.md\:hidden {
|
|
2072
|
+
display: none;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
.md\:h-16 {
|
|
2076
|
+
height: 64px;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
.md\:h-14 {
|
|
2080
|
+
height: 56px;
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
.md\:flex-row {
|
|
2084
|
+
flex-direction: row;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
.md\:px-0 {
|
|
2088
|
+
padding-left: 0;
|
|
2089
|
+
padding-right: 0;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.md\:px-2 {
|
|
2093
|
+
padding-left: 8px;
|
|
2094
|
+
padding-right: 8px;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
.md\:py-0 {
|
|
2098
|
+
padding-top: 0;
|
|
2099
|
+
padding-bottom: 0;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
.md\:pt-0 {
|
|
2103
|
+
padding-top: 0;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
.md\:pr-0 {
|
|
2107
|
+
padding-right: 0;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
.md\:pb-0 {
|
|
2111
|
+
padding-bottom: 0;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
.md\:pl-4 {
|
|
2115
|
+
padding-left: 16px;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
.md\:pt-2 {
|
|
2119
|
+
padding-top: 8px;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
@media (min-width: 1024px) {
|
|
2124
|
+
.lg\:block {
|
|
2125
|
+
display: block;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
package/package.json
CHANGED
|
@@ -3,9 +3,10 @@ export const CLASS_NAMES = {
|
|
|
3
3
|
render:
|
|
4
4
|
'w-full my-auto text-style-g text-neutral-600 whitespace-nowrap overflow-hidden overflow-ellipsis',
|
|
5
5
|
renderLoading: 'w-full my-auto mr-8 text-style-g',
|
|
6
|
+
mobileLabel: 'block md:hidden text-16-24-em text-neutral-600 mr-2',
|
|
6
7
|
cell: {
|
|
7
|
-
base: 'h-16 flex',
|
|
8
|
+
base: 'px-4 py-1 md:pt-0 md:pr-0 md:pb-0 md:h-16 flex',
|
|
8
9
|
compact: 'h-8 flex',
|
|
9
|
-
padding: 'pl-4',
|
|
10
|
+
padding: 'md:pl-4',
|
|
10
11
|
},
|
|
11
12
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import type { TableCellProps } from 'react-table';
|
|
3
|
-
import { SkeletonLoader } from '@kanda-libs/ks-design-library';
|
|
3
|
+
import { SkeletonLoader, Text } from '@kanda-libs/ks-design-library';
|
|
4
4
|
import useCellClassNames from './useCellClassNames';
|
|
5
|
+
import useMobileFullWidthCellStyle from '~/hooks/useMobileFullWidthCellStyle';
|
|
5
6
|
|
|
6
7
|
export interface CellProps extends TableCellProps {
|
|
7
8
|
index: number;
|
|
8
9
|
render: () => ReactNode;
|
|
9
10
|
compact?: boolean;
|
|
10
11
|
isLoading?: boolean;
|
|
12
|
+
label?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
const Cell: FunctionComponent<CellProps> = function ({
|
|
@@ -15,17 +17,26 @@ const Cell: FunctionComponent<CellProps> = function ({
|
|
|
15
17
|
index,
|
|
16
18
|
compact = false,
|
|
17
19
|
isLoading = false,
|
|
20
|
+
label,
|
|
18
21
|
...props
|
|
19
22
|
}) {
|
|
20
23
|
const classNames = useCellClassNames(index, compact, isLoading);
|
|
21
24
|
|
|
25
|
+
const { style: unformattedStyle, ...formattedProps } = props;
|
|
26
|
+
const style = useMobileFullWidthCellStyle(unformattedStyle);
|
|
27
|
+
|
|
22
28
|
return (
|
|
23
|
-
<div {...
|
|
29
|
+
<div {...formattedProps} style={style} className={classNames.cell}>
|
|
24
30
|
<div className={classNames.container}>
|
|
25
31
|
<div className={classNames.render}>
|
|
26
32
|
<SkeletonLoader
|
|
27
33
|
isLoading={isLoading}
|
|
28
|
-
afterLoading={
|
|
34
|
+
afterLoading={
|
|
35
|
+
<>
|
|
36
|
+
<Text text={`${label}:`} className={classNames.mobileLabel} />
|
|
37
|
+
{render()}
|
|
38
|
+
</>
|
|
39
|
+
}
|
|
29
40
|
/>
|
|
30
41
|
</div>
|
|
31
42
|
</div>
|
|
@@ -5,6 +5,7 @@ export type CellClassNamesHook = {
|
|
|
5
5
|
cell: string;
|
|
6
6
|
container: string;
|
|
7
7
|
render: string;
|
|
8
|
+
mobileLabel: string;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export default function useCellClassNames(
|
|
@@ -19,5 +20,6 @@ export default function useCellClassNames(
|
|
|
19
20
|
),
|
|
20
21
|
container: CLASS_NAMES.container,
|
|
21
22
|
render: isLoading ? CLASS_NAMES.renderLoading : CLASS_NAMES.render,
|
|
23
|
+
mobileLabel: CLASS_NAMES.mobileLabel,
|
|
22
24
|
};
|
|
23
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SkeletonLoader } from '@kanda-libs/ks-design-library';
|
|
2
2
|
import type { FunctionComponent, ReactNode } from 'react';
|
|
3
3
|
import type { TableHeaderProps } from 'react-table';
|
|
4
|
+
import useMobileFullWidthCellStyle from '~/hooks/useMobileFullWidthCellStyle';
|
|
4
5
|
import HeaderButton from '../HeaderButton';
|
|
5
6
|
import useHeaderColumnProps from './useHeaderColumnProps';
|
|
6
7
|
|
|
@@ -20,8 +21,11 @@ const HeaderColumn: FunctionComponent<HeaderColumnProps> = function ({
|
|
|
20
21
|
}) {
|
|
21
22
|
const { classNames } = useHeaderColumnProps(index, popoverButtons);
|
|
22
23
|
|
|
24
|
+
const { style: unformattedStyle, ...formattedProps } = props;
|
|
25
|
+
const style = useMobileFullWidthCellStyle(unformattedStyle);
|
|
26
|
+
|
|
23
27
|
return (
|
|
24
|
-
<div {...
|
|
28
|
+
<div {...formattedProps} style={style} className={classNames.main}>
|
|
25
29
|
<SkeletonLoader
|
|
26
30
|
isLoading={isLoading}
|
|
27
31
|
wrapperClassName={classNames.loading}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { StringIndexedObject } from '@kanda-libs/ks-design-library';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import type { Row as RowType } from 'react-table';
|
|
4
|
+
import Row from '../Row';
|
|
5
|
+
|
|
6
|
+
export interface PagesProps<T extends StringIndexedObject> {
|
|
7
|
+
page: RowType<T>[];
|
|
8
|
+
prepareRow: (row: RowType<T>) => void;
|
|
9
|
+
isLoading?: boolean;
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function Pages<T extends StringIndexedObject>({
|
|
14
|
+
page,
|
|
15
|
+
prepareRow,
|
|
16
|
+
isLoading = false,
|
|
17
|
+
compact = false,
|
|
18
|
+
}: PropsWithChildren<PagesProps<T>>) {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
{page.map((row, index) => {
|
|
22
|
+
prepareRow(row);
|
|
23
|
+
return (
|
|
24
|
+
<Row
|
|
25
|
+
{...row.getRowProps()}
|
|
26
|
+
index={index}
|
|
27
|
+
cells={row.cells}
|
|
28
|
+
isLoading={isLoading}
|
|
29
|
+
compact={compact}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
})}
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
export default Pages;
|
|
@@ -19,10 +19,6 @@ function Row<T extends Object>({
|
|
|
19
19
|
}: PropsWithChildren<RowProps<T>>) {
|
|
20
20
|
const classNames = useRowClassNames(index);
|
|
21
21
|
|
|
22
|
-
console.log({
|
|
23
|
-
props,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
22
|
return (
|
|
27
23
|
<div {...props} className={compact ? classNames.compact : classNames.base}>
|
|
28
24
|
{cells.map((cell, cellIndex) => (
|
|
@@ -31,6 +27,7 @@ function Row<T extends Object>({
|
|
|
31
27
|
index={cellIndex}
|
|
32
28
|
isLoading={isLoading}
|
|
33
29
|
render={() => cell.render('Cell')}
|
|
30
|
+
label={cell.column.Header as string}
|
|
34
31
|
/>
|
|
35
32
|
))}
|
|
36
33
|
</div>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
Pagination,
|
|
3
|
+
type StringIndexedObject,
|
|
4
|
+
} from '@kanda-libs/ks-design-library';
|
|
2
5
|
import type { FunctionComponent, PropsWithChildren } from 'react';
|
|
3
6
|
import type { Column } from 'react-table';
|
|
4
7
|
import HeaderGroup from './components/HeaderGroup';
|
|
5
|
-
import
|
|
8
|
+
import Pages from './components/Pages';
|
|
6
9
|
import SearchInput from './components/SearchInput';
|
|
7
10
|
import useTableProps from './useTableProps';
|
|
8
11
|
|
|
@@ -24,8 +27,15 @@ function Table<T extends StringIndexedObject<unknown>>({
|
|
|
24
27
|
isLoading = false,
|
|
25
28
|
...props
|
|
26
29
|
}: PropsWithChildren<TableProps<T>>) {
|
|
27
|
-
const {
|
|
28
|
-
|
|
30
|
+
const {
|
|
31
|
+
onSearch,
|
|
32
|
+
page,
|
|
33
|
+
prepareRow,
|
|
34
|
+
columns,
|
|
35
|
+
getTableProps,
|
|
36
|
+
headerGroups,
|
|
37
|
+
paginationProps,
|
|
38
|
+
} = useTableProps(props);
|
|
29
39
|
|
|
30
40
|
return (
|
|
31
41
|
<>
|
|
@@ -44,18 +54,15 @@ function Table<T extends StringIndexedObject<unknown>>({
|
|
|
44
54
|
/>
|
|
45
55
|
))}
|
|
46
56
|
</div>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
})}
|
|
57
|
+
<Pages
|
|
58
|
+
page={page}
|
|
59
|
+
prepareRow={prepareRow}
|
|
60
|
+
isLoading={isLoading}
|
|
61
|
+
compact={compact}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="px-4">
|
|
65
|
+
<Pagination {...paginationProps} />
|
|
59
66
|
</div>
|
|
60
67
|
</>
|
|
61
68
|
);
|
|
@@ -10,11 +10,15 @@ import {
|
|
|
10
10
|
} from 'react-table';
|
|
11
11
|
import type { TableProps } from '.';
|
|
12
12
|
import { globalFilter } from './helpers/search';
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
PaginationProps,
|
|
15
|
+
StringIndexedObject,
|
|
16
|
+
} from '@kanda-libs/ks-design-library';
|
|
14
17
|
|
|
15
18
|
export interface TablePropsHook<T extends StringIndexedObject<unknown>>
|
|
16
19
|
extends TableInstance<T> {
|
|
17
20
|
onSearch: (value: string) => void;
|
|
21
|
+
paginationProps: PaginationProps;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export default function useTableProps<T extends StringIndexedObject<unknown>>({
|
|
@@ -43,12 +47,27 @@ export default function useTableProps<T extends StringIndexedObject<unknown>>({
|
|
|
43
47
|
useFlexLayout,
|
|
44
48
|
);
|
|
45
49
|
|
|
50
|
+
const {
|
|
51
|
+
gotoPage,
|
|
52
|
+
pageCount,
|
|
53
|
+
state: { pageIndex },
|
|
54
|
+
} = table;
|
|
55
|
+
|
|
56
|
+
const paginationProps: PaginationProps = {
|
|
57
|
+
pageCount,
|
|
58
|
+
pageIndex,
|
|
59
|
+
setPage: (nextPage: number) => {
|
|
60
|
+
gotoPage(nextPage);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
46
64
|
const onSearch = (search: string) => {
|
|
47
65
|
table.setGlobalFilter(search);
|
|
48
66
|
};
|
|
49
67
|
|
|
50
68
|
return {
|
|
51
69
|
onSearch,
|
|
70
|
+
paginationProps,
|
|
52
71
|
...table,
|
|
53
72
|
};
|
|
54
73
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useIsDesktop } from '@kanda-libs/ks-design-library';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
export type MobileFullWidthCellStyleHook = CSSProperties;
|
|
5
|
+
|
|
6
|
+
export default function useMobileFullWidthCellStyle(
|
|
7
|
+
style?: CSSProperties,
|
|
8
|
+
): MobileFullWidthCellStyleHook {
|
|
9
|
+
if (!style) return {};
|
|
10
|
+
|
|
11
|
+
const isDesktop = useIsDesktop();
|
|
12
|
+
|
|
13
|
+
// For mobile, we want to make sure that the cell is always 100% width
|
|
14
|
+
const formattedStyle = {
|
|
15
|
+
...style,
|
|
16
|
+
width: isDesktop ? style?.width : '100%',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return formattedStyle;
|
|
20
|
+
}
|
package/src/styles/library.css
CHANGED
|
@@ -776,6 +776,12 @@ video {
|
|
|
776
776
|
line-height: 24px;
|
|
777
777
|
}
|
|
778
778
|
|
|
779
|
+
.text-16-24-em {
|
|
780
|
+
font-weight: 600;
|
|
781
|
+
font-size: 16px;
|
|
782
|
+
line-height: 24px;
|
|
783
|
+
}
|
|
784
|
+
|
|
779
785
|
.text-16-20-em {
|
|
780
786
|
font-weight: 600;
|
|
781
787
|
font-size: 16px;
|
|
@@ -997,6 +1003,10 @@ video {
|
|
|
997
1003
|
margin-right: 32px;
|
|
998
1004
|
}
|
|
999
1005
|
|
|
1006
|
+
.mr-2 {
|
|
1007
|
+
margin-right: 8px;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1000
1010
|
.-ml-3 {
|
|
1001
1011
|
margin-left: -12px;
|
|
1002
1012
|
}
|
|
@@ -1013,6 +1023,10 @@ video {
|
|
|
1013
1023
|
margin-left: 16px;
|
|
1014
1024
|
}
|
|
1015
1025
|
|
|
1026
|
+
.block {
|
|
1027
|
+
display: block;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1016
1030
|
.flex {
|
|
1017
1031
|
display: flex;
|
|
1018
1032
|
}
|
|
@@ -1029,10 +1043,6 @@ video {
|
|
|
1029
1043
|
height: 100%;
|
|
1030
1044
|
}
|
|
1031
1045
|
|
|
1032
|
-
.h-16 {
|
|
1033
|
-
height: 64px;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
1046
|
.h-8 {
|
|
1037
1047
|
height: 32px;
|
|
1038
1048
|
}
|
|
@@ -1041,10 +1051,6 @@ video {
|
|
|
1041
1051
|
height: 36px;
|
|
1042
1052
|
}
|
|
1043
1053
|
|
|
1044
|
-
.h-14 {
|
|
1045
|
-
height: 56px;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
1054
|
.w-full {
|
|
1049
1055
|
width: 100%;
|
|
1050
1056
|
}
|
|
@@ -1061,6 +1067,10 @@ video {
|
|
|
1061
1067
|
flex-direction: row;
|
|
1062
1068
|
}
|
|
1063
1069
|
|
|
1070
|
+
.flex-col {
|
|
1071
|
+
flex-direction: column;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1064
1074
|
.gap-x-2 {
|
|
1065
1075
|
-moz-column-gap: 8px;
|
|
1066
1076
|
column-gap: 8px;
|
|
@@ -1099,6 +1109,16 @@ video {
|
|
|
1099
1109
|
background-color: transparent;
|
|
1100
1110
|
}
|
|
1101
1111
|
|
|
1112
|
+
.px-4 {
|
|
1113
|
+
padding-left: 16px;
|
|
1114
|
+
padding-right: 16px;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
.py-1 {
|
|
1118
|
+
padding-top: 4px;
|
|
1119
|
+
padding-bottom: 4px;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1102
1122
|
.px-3 {
|
|
1103
1123
|
padding-left: 12px;
|
|
1104
1124
|
padding-right: 12px;
|
|
@@ -1109,24 +1129,15 @@ video {
|
|
|
1109
1129
|
padding-bottom: 7px;
|
|
1110
1130
|
}
|
|
1111
1131
|
|
|
1112
|
-
.py-
|
|
1113
|
-
padding-top:
|
|
1114
|
-
padding-bottom:
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
.px-2 {
|
|
1118
|
-
padding-left: 8px;
|
|
1119
|
-
padding-right: 8px;
|
|
1132
|
+
.py-2 {
|
|
1133
|
+
padding-top: 8px;
|
|
1134
|
+
padding-bottom: 8px;
|
|
1120
1135
|
}
|
|
1121
1136
|
|
|
1122
1137
|
.pl-4 {
|
|
1123
1138
|
padding-left: 16px;
|
|
1124
1139
|
}
|
|
1125
1140
|
|
|
1126
|
-
.pt-2 {
|
|
1127
|
-
padding-top: 8px;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
1141
|
.pb-1 {
|
|
1131
1142
|
padding-bottom: 4px;
|
|
1132
1143
|
}
|
|
@@ -2051,3 +2062,66 @@ Modified version of toast CSS to match designs
|
|
|
2051
2062
|
.group:hover .group-hover\:block {
|
|
2052
2063
|
display: block;
|
|
2053
2064
|
}
|
|
2065
|
+
|
|
2066
|
+
@media (min-width: 768px) {
|
|
2067
|
+
.md\:flex {
|
|
2068
|
+
display: flex;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
.md\:hidden {
|
|
2072
|
+
display: none;
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
.md\:h-16 {
|
|
2076
|
+
height: 64px;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
.md\:h-14 {
|
|
2080
|
+
height: 56px;
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
.md\:flex-row {
|
|
2084
|
+
flex-direction: row;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
.md\:px-0 {
|
|
2088
|
+
padding-left: 0;
|
|
2089
|
+
padding-right: 0;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.md\:px-2 {
|
|
2093
|
+
padding-left: 8px;
|
|
2094
|
+
padding-right: 8px;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
.md\:py-0 {
|
|
2098
|
+
padding-top: 0;
|
|
2099
|
+
padding-bottom: 0;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
.md\:pt-0 {
|
|
2103
|
+
padding-top: 0;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
.md\:pr-0 {
|
|
2107
|
+
padding-right: 0;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
.md\:pb-0 {
|
|
2111
|
+
padding-bottom: 0;
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
.md\:pl-4 {
|
|
2115
|
+
padding-left: 16px;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
.md\:pt-2 {
|
|
2119
|
+
padding-top: 8px;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
@media (min-width: 1024px) {
|
|
2124
|
+
.lg\:block {
|
|
2125
|
+
display: block;
|
|
2126
|
+
}
|
|
2127
|
+
}
|