@dgshahr/ui-kit 0.0.94 → 0.0.96

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 dgshahr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # DGS UI Kit
2
+
3
+ A modern, accessible, and customizable React component library built with TypeScript and Tailwind CSS. This UI Kit is designed to help you rapidly build consistent, scalable user interfaces across your web applications.
4
+
5
+ ## ✨ Features
6
+
7
+ - 📦 **Reusable React Components** – A growing set of fully styled and typed UI components.
8
+ - 🎨 **Customizable Design Tokens** – Easily override colors via CSS variables.
9
+ - 🧩 **Tree-shakable** – Import only what you need.
10
+ - ⚡ **Tailwind CSS Utility Classes** – Built-in styles with scoped, prefixed Tailwind utilities.
11
+ - 📚 **Storybook Documentation** – [Explore live components & usage](https://dgshahr.github.io/uikit/).
12
+
13
+ ## 📦 Installation
14
+
15
+ Before using this library, make sure you have `react` installed in your project, as it's a peer dependency.
16
+
17
+ ```bash
18
+ npm install @dgshahr/uikit
19
+ ```
20
+
21
+ or
22
+
23
+ ```bash
24
+ yarn add @dgshahr/uikit
25
+ ```
26
+
27
+ > No need to set up Tailwind or any additional configuration. All styles are already bundled and scoped.
28
+
29
+ ## 🚀 Getting Started
30
+
31
+ Visit the [documentation site](https://dgshahr.github.io/uikit/) to learn more about:
32
+
33
+ - How to use the components
34
+ - Customizing theme tokens like colors
35
+ - Contributing to the project
36
+
37
+ ## 🧱 Project Structure
38
+
39
+ Each component lives in its own folder under the `src/components` directory.
40
+
41
+ - Every component must export from an `index.ts` or `index.tsx` file. Vite uses this to build each component individually.
42
+ - If a component exports multiple members (e.g., `Button`, `ButtonGroup`), use named exports in its `index` file.
43
+ - Each component must have a `ComponentName.stories.tsx` file to generate its documentation.
44
+
45
+ The root `index.ts` file serves as the main entry point for bundling the entire library and contains exports for all components.
46
+
47
+ ## 🛠️ Contributing
48
+
49
+ We welcome contributions! See the [Contributing Guide](https://dgshahr.github.io/uikit/?path=/docs/getting-started-contributing--documentation) to learn how to get started.
50
+
51
+ ## 📄 License
52
+
53
+ This project is licensed under the MIT License.
@@ -1 +1 @@
1
- "use strict";require('../../assets/styles.css');const r=require("react/jsx-runtime"),d=require("../../clsx-C11secjj.cjs"),q=require("../../index-CSis3p-s.cjs"),u=require("react"),W=require("../../IconSearch-BeVs-gUu.cjs"),R=require("../Checkbox/index.cjs"),_=require("../../Button/index.cjs"),A=require("../../PickerWrapper-VwVWt_Vr.cjs"),H=require("../../Chip/index.cjs");;/* empty css */function V(s,n=100){if(!s)return;if(window.innerWidth>768){s.focus(),s.click();return}const t=document.createElement("input");t.style.position="absolute",t.style.top=`${s.offsetTop+7}px`,t.style.left=`${s.offsetLeft}px`,t.style.height="0px",t.style.opacity="0px",document.body.appendChild(t),t.focus(),setTimeout(()=>{s.focus(),s.click(),document.body.removeChild(t)},n)}function z({label:s,isMultiple:n,isActive:t,disabled:o}){return n?r.jsx(R,{checked:t,label:s,readOnly:!0,disabled:o}):s}const D=s=>{const{option:n,onClick:t,value:o,mode:c,optionCellClassName:g,optionCell:i}=s;function l(){return Array.isArray(o)?o.includes(n.value):n.value===o}return r.jsx("button",{type:"button",onClick:t,className:d.clsx("dgs-ui-kit-w-full dgs-ui-kit-text-start dgs-ui-kit-px-3 disabled:dgs-ui-kit-cursor-not-allowed dgs-ui-kit-py-3 dgs-ui-kit-font-p1-regular disabled:dgs-ui-kit-bg-gray-50 dgs-ui-kit-transition",l()?"dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-500":"dgs-ui-kit-text-gray-700 disabled:dgs-ui-kit-text-gray-400",g),disabled:n.disabled,children:i?i(n,l()):z({label:n.label,isMultiple:c==="multiple",isActive:l(),disabled:n.disabled??!1})})},T=u.memo(D),K=20,U=s=>{const{options:n,mode:t="single",afterOptions:o,beforOptions:c,onChange:g,searchable:i=!0,separateSelectedOptions:l=!0,optionsTitle:f="عنوان‌ها",value:p,optionCellClassName:y,emptyContent:M="نتیجه‌ای یافت نشد !",showClearButtonOnEmpty:$=!0}=s,[k,I]=u.useState(""),[x,B]=u.useState(0),m=u.useRef(null),{toggleWrapperVisibility:F}=A.usePickerWrapperContext(),O=d.clsx("dgs-ui-kit-border-t dgs-ui-kit-border-solid dgs-ui-kit-border-gray-100",(!i&&!c||t==="multiple"&&l)&&"first-of-type:dgs-ui-kit-border-t-0",!!o&&"last-of-type:dgs-ui-kit-border-b");let h;const C=i;typeof i=="boolean"?h=i:h=Object.keys(i).length>0;const v=u.useMemo(()=>{if(!Array.isArray(n))throw new Error("options should be array");return k?n?.filter(e=>e.label.includes(k)):n},[k,n]),N=u.useMemo(()=>t==="multiple"&&l?n?.filter(e=>p.includes(e.value))??[]:[],[n,p]),P=u.useMemo(()=>{let e=v;t==="multiple"&&l&&(e=e?.filter(w=>!p.includes(w.value)));const a=Math.min(x+K,e?.length??0);return e?.slice(x,a)},[v,x,p]),b=m?.current?.children[0]?.clientHeight??50,L=(v?.length??0)*b,j=u.useCallback(()=>{const e=m?.current?.parentElement;if(!e)return;const a=e.scrollTop,w=m.current.offsetTop,E=Math.floor((a-w)/b);B(E>=0?E:0)},[b]);u.useEffect(()=>{const e=m.current?.parentElement;if(e)return e.addEventListener("scroll",j),()=>e.removeEventListener("scroll",j)},[j]),u.useEffect(()=>{h&&V(document.getElementById("search-input"),400)},[]);const S=u.useCallback(e=>{if(typeof g=="function")if(t==="multiple"){const a=[...p??[]];a.includes(e)?a.splice(a.indexOf(e),1):a.push(e),g(a)}else g(e),F()},[p]);return r.jsxs(r.Fragment,{children:[h&&r.jsx(q.Input,{id:"search-input",wrapperClassName:d.clsx("dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-pt-3 dgs-ui-kit-right-0 dgs-ui-kit-bg-white dgs-ui-kit-z-10 dgs-ui-kit-px-3",c?"dgs-ui-kit-pb-2":"dgs-ui-kit-pb-3",C?.wrapperClassName),placeholder:C?.placeholder??"جستجوی عنوان",value:k,onChange:e=>I(e.currentTarget.value),rightIcon:C?.rightIcon??r.jsx(W.IconSearch,{width:20,height:20}),...typeof i=="object"?i:{}}),c,t==="multiple"&&l&&N.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2",children:`${f}‌ی انتخاب شده`}),N.map(e=>r.jsx(T,{onClick:()=>S(e.value),option:e,optionCellClassName:d.clsx(O,y),...s},e.value))]}),r.jsxs(r.Fragment,{children:[t==="multiple"&&l&&r.jsx("p",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2",children:f}),r.jsx("div",{ref:m,className:"dgs-ui-kit-relative",style:{height:L},children:P?.map((e,a)=>r.jsx("div",{className:d.clsx("dgs-ui-kit-absolute dgs-ui-kit-w-full",O),style:{top:`${(x+a)*b}px`},children:r.jsx(T,{onClick:()=>S(e.value),option:e,...s})},e.value))}),!P?.length&&!N.length&&r.jsxs("div",{className:"dgs-ui-kit-text-center dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-items-center dgs-ui-kit-mt-2",children:[r.jsx("p",{className:"dgs-ui-kit-text-gray-500 dgs-ui-kit-font-p3-medium",children:M}),$&&r.jsx(_,{type:"button",className:"dgs-ui-kit-mt-1",variant:"text",size:"small",onClick:()=>I(""),children:"پاک کردن"})]})]}),o]})};function G(s,n){if(!Array.isArray(s))return n.find(t=>t.value===s)?.label??""}const J=s=>{const{searchable:n=!0,value:t,options:o}=s,c=Array.isArray(t)&&t.length>0;function g(){return s.inputProps?.prefix?s.inputProps.prefix:c?t.map(l=>r.jsx(H,{label:o.find(f=>f.value===l)?.label,clickable:!0,leftIcon:r.jsx(q.IconCloseSquare,{}),onClick:f=>{f.stopPropagation();const p=t.filter(y=>y!==l);s.onChange?.(p)}},l)):null}const i={...s};return i.dropdownType==="popover"&&!n&&(i.popoverClassName=d.clsx("dgs-ui-kit-pt-3",i.popoverClassName)),i.dropdownType==="drawer"&&(i.drawerProps={...i.drawerProps,containerClassName:d.clsx(n?"!dgs-ui-kit-pt-0":"!dgs-ui-kit-pt-3",i.drawerProps?.containerClassName)}),i.customInput||(i.inputProps={...i.inputProps,value:G(t,o),prefix:g(),prefixClassName:c?d.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center flex dgs-ui-kit-flex-wrap dgs-ui-kit-gap-2 dgs-ui-kit-w-full",i.inputProps?.prefixClassName):i.inputProps?.prefixClassName,className:c?"dgs-ui-kit-hidden":i.inputProps?.className,containerClassName:c?d.clsx("dgs-ui-kit-items-baseline",i.inputProps?.containerClassName):i.inputProps?.containerClassName}),r.jsx(A.PickerWrapper,{...i,children:r.jsx(U,{...s})})};module.exports=J;
1
+ "use strict";require('../../assets/styles.css');const r=require("react/jsx-runtime"),d=require("../../clsx-C11secjj.cjs"),q=require("../../index-CSis3p-s.cjs"),u=require("react"),W=require("../../IconSearch-BeVs-gUu.cjs"),R=require("../Checkbox/index.cjs"),_=require("../../Button/index.cjs"),A=require("../../PickerWrapper-VwVWt_Vr.cjs"),H=require("../../Chip/index.cjs");;/* empty css */function V(s,n=100){if(!s)return;if(window.innerWidth>768){s.focus(),s.click();return}const t=document.createElement("input");t.style.position="absolute",t.style.top=`${s.offsetTop+7}px`,t.style.left=`${s.offsetLeft}px`,t.style.height="0px",t.style.opacity="0px",document.body.appendChild(t),t.focus(),setTimeout(()=>{s.focus(),s.click(),document.body.removeChild(t)},n)}function z({label:s,isMultiple:n,isActive:t,disabled:o}){return n?r.jsx(R,{checked:t,label:s,readOnly:!0,disabled:o}):s}const D=s=>{const{option:n,onClick:t,value:o,mode:c,optionCellClassName:g,optionCell:i}=s;function l(){return Array.isArray(o)?o.includes(n.value):n.value===o}return r.jsx("button",{type:"button",onClick:t,className:d.clsx("dgs-ui-kit-w-full dgs-ui-kit-text-start dgs-ui-kit-px-3 disabled:dgs-ui-kit-cursor-not-allowed dgs-ui-kit-py-3 dgs-ui-kit-font-p1-regular disabled:dgs-ui-kit-bg-gray-50 dgs-ui-kit-transition",l()?"dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-500":"dgs-ui-kit-text-gray-700 disabled:dgs-ui-kit-text-gray-400",g),disabled:n.disabled,children:i?i(n,l()):z({label:n.label,isMultiple:c==="multiple",isActive:l(),disabled:n.disabled??!1})})},T=u.memo(D),K=20,U=s=>{const{options:n,mode:t="single",afterOptions:o,beforeOptions:c,onChange:g,searchable:i=!0,separateSelectedOptions:l=!0,optionsTitle:f="عنوان‌ها",value:p,optionCellClassName:y,emptyContent:M="نتیجه‌ای یافت نشد !",showClearButtonOnEmpty:$=!0}=s,[k,I]=u.useState(""),[x,B]=u.useState(0),m=u.useRef(null),{toggleWrapperVisibility:F}=A.usePickerWrapperContext(),O=d.clsx("dgs-ui-kit-border-t dgs-ui-kit-border-solid dgs-ui-kit-border-gray-100",(!i&&!c||t==="multiple"&&l)&&"first-of-type:dgs-ui-kit-border-t-0",!!o&&"last-of-type:dgs-ui-kit-border-b");let h;const C=i;typeof i=="boolean"?h=i:h=Object.keys(i).length>0;const v=u.useMemo(()=>{if(!Array.isArray(n))throw new Error("options should be array");return k?n?.filter(e=>e.label.includes(k)):n},[k,n]),N=u.useMemo(()=>t==="multiple"&&l?n?.filter(e=>p.includes(e.value))??[]:[],[n,p]),P=u.useMemo(()=>{let e=v;t==="multiple"&&l&&(e=e?.filter(w=>!p.includes(w.value)));const a=Math.min(x+K,e?.length??0);return e?.slice(x,a)},[v,x,p]),b=m?.current?.children[0]?.clientHeight??50,L=(v?.length??0)*b,j=u.useCallback(()=>{const e=m?.current?.parentElement;if(!e)return;const a=e.scrollTop,w=m.current.offsetTop,E=Math.floor((a-w)/b);B(E>=0?E:0)},[b]);u.useEffect(()=>{const e=m.current?.parentElement;if(e)return e.addEventListener("scroll",j),()=>e.removeEventListener("scroll",j)},[j]),u.useEffect(()=>{h&&V(document.getElementById("search-input"),400)},[]);const S=u.useCallback(e=>{if(typeof g=="function")if(t==="multiple"){const a=[...p??[]];a.includes(e)?a.splice(a.indexOf(e),1):a.push(e),g(a)}else g(e),F()},[p]);return r.jsxs(r.Fragment,{children:[h&&r.jsx(q.Input,{id:"search-input",wrapperClassName:d.clsx("dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-pt-3 dgs-ui-kit-right-0 dgs-ui-kit-bg-white dgs-ui-kit-z-10 dgs-ui-kit-px-3",c?"dgs-ui-kit-pb-2":"dgs-ui-kit-pb-3",C?.wrapperClassName),placeholder:C?.placeholder??"جستجوی عنوان",value:k,onChange:e=>I(e.currentTarget.value),rightIcon:C?.rightIcon??r.jsx(W.IconSearch,{width:20,height:20}),...typeof i=="object"?i:{}}),c,t==="multiple"&&l&&N.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2",children:`${f}‌ی انتخاب شده`}),N.map(e=>r.jsx(T,{onClick:()=>S(e.value),option:e,optionCellClassName:d.clsx(O,y),...s},e.value))]}),r.jsxs(r.Fragment,{children:[t==="multiple"&&l&&r.jsx("p",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2",children:f}),r.jsx("div",{ref:m,className:"dgs-ui-kit-relative",style:{height:L},children:P?.map((e,a)=>r.jsx("div",{className:d.clsx("dgs-ui-kit-absolute dgs-ui-kit-w-full",O),style:{top:`${(x+a)*b}px`},children:r.jsx(T,{onClick:()=>S(e.value),option:e,...s})},e.value))}),!P?.length&&!N.length&&r.jsxs("div",{className:"dgs-ui-kit-text-center dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-items-center dgs-ui-kit-mt-2",children:[r.jsx("p",{className:"dgs-ui-kit-text-gray-500 dgs-ui-kit-font-p3-medium",children:M}),$&&r.jsx(_,{type:"button",className:"dgs-ui-kit-mt-1",variant:"text",size:"small",onClick:()=>I(""),children:"پاک کردن"})]})]}),o]})};function G(s,n){if(!Array.isArray(s))return n.find(t=>t.value===s)?.label??""}const J=s=>{const{searchable:n=!0,value:t,options:o}=s,c=Array.isArray(t)&&t.length>0;function g(){return s.inputProps?.prefix?s.inputProps.prefix:c?t.map(l=>r.jsx(H,{label:o.find(f=>f.value===l)?.label,clickable:!0,leftIcon:r.jsx(q.IconCloseSquare,{}),onClick:f=>{f.stopPropagation();const p=t.filter(y=>y!==l);s.onChange?.(p)}},l)):null}const i={...s};return i.dropdownType==="popover"&&!n&&(i.popoverClassName=d.clsx("dgs-ui-kit-pt-3",i.popoverClassName)),i.dropdownType==="drawer"&&(i.drawerProps={...i.drawerProps,containerClassName:d.clsx(n?"!dgs-ui-kit-pt-0":"!dgs-ui-kit-pt-3",i.drawerProps?.containerClassName)}),i.customInput||(i.inputProps={...i.inputProps,value:G(t,o),prefix:g(),prefixClassName:c?d.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center flex dgs-ui-kit-flex-wrap dgs-ui-kit-gap-2 dgs-ui-kit-w-full",i.inputProps?.prefixClassName):i.inputProps?.prefixClassName,className:c?"dgs-ui-kit-hidden":i.inputProps?.className,containerClassName:c?d.clsx("dgs-ui-kit-items-baseline",i.inputProps?.containerClassName):i.inputProps?.containerClassName}),r.jsx(A.PickerWrapper,{...i,children:r.jsx(U,{...s})})};module.exports=J;
@@ -64,7 +64,7 @@ const ee = (s) => {
64
64
  options: r,
65
65
  mode: t = "single",
66
66
  afterOptions: o,
67
- beforOptions: u,
67
+ beforeOptions: u,
68
68
  onChange: p,
69
69
  searchable: i = !0,
70
70
  separateSelectedOptions: l = !0,
@@ -11,7 +11,7 @@ type SelectPropsBase<T> = {
11
11
  searchable?: boolean | Omit<InputProps, 'onChange'>;
12
12
  optionCell?: (option: Option<T>, isActive: boolean) => ReactNode;
13
13
  optionCellClassName?: string;
14
- beforOptions?: ReactNode;
14
+ beforeOptions?: ReactNode;
15
15
  afterOptions?: ReactNode;
16
16
  emptyContent?: ReactNode;
17
17
  showClearButtonOnEmpty?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,uBAAuB,CAAC,EAAE,KAAK,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAC7C,kBAAkB,GAClB,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,uBAAuB,CAAC,EAAE,KAAK,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAC7C,kBAAkB,GAClB,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TBody.d.ts","sourceRoot":"","sources":["../../src/components/Table/TBody.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,UAAU,UAAU;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AA8CD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CA4DzB,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"TBody.d.ts","sourceRoot":"","sources":["../../src/components/Table/TBody.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAchC,UAAU,UAAU;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AA8CD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAiEzB,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ declare const TBodyEmpty: FC;
3
+ export default TBodyEmpty;
4
+ //# sourceMappingURL=TBodyEmpty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TBodyEmpty.d.ts","sourceRoot":"","sources":["../../src/components/Table/TBodyEmpty.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,QAAA,MAAM,UAAU,EAAE,EAUjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ declare const TBodyLoading: FC;
3
+ export default TBodyLoading;
4
+ //# sourceMappingURL=TBodyLoading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TBodyLoading.d.ts","sourceRoot":"","sources":["../../src/components/Table/TBodyLoading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,QAAA,MAAM,YAAY,EAAE,EAiBnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"THead.d.ts","sourceRoot":"","sources":["../../src/components/Table/THead.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAiBhC,UAAU,UAAU;IAClB,UAAU,EAAE,OAAO,CAAC;CACrB;AA6CD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAkFzB,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"THead.d.ts","sourceRoot":"","sources":["../../src/components/Table/THead.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAiBhC,UAAU,UAAU;IAClB,UAAU,EAAE,OAAO,CAAC;CACrB;AA6CD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAkFzB,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/components/Table/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD,UAAU,WAAW,CAAC,CAAC,SAAS,aAAa,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAClE,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,YAAY,qDAKvB,CAAC;AAEH,UAAU,aAAa,CAAC,CAAC,SAAS,aAAa,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACpE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAYD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,2CA4C9F;AAED,eAAO,MAAM,eAAe,kCAAiC,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/components/Table/context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD,UAAU,WAAW,CAAC,CAAC,SAAS,aAAa,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAClE,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,YAAY,qDAKvB,CAAC;AAEH,UAAU,aAAa,CAAC,CAAC,SAAS,aAAa,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACpE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAYD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,2CA4C9F;AAED,eAAO,MAAM,eAAe,kCAAiC,CAAC"}
@@ -1 +1 @@
1
- "use client";"use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),c=require("../clsx-C11secjj.cjs"),g=require("react"),_=require("../Badge/index.cjs"),B=require("../Form/Checkbox/index.cjs"),S=require("../Tooltip/index.cjs"),I=require("../IconArrowDown2-C1dLVveG.cjs"),K=require("../IconInfoCircleOutline-0ef3qbeI.cjs"),y=require("../Divider/index.cjs"),L=require("../Pagination/index.cjs");;/* empty css */const T=g.createContext({observer:null,columns:[],data:[],rowKey:""}),A="after:!dgs-ui-kit-shadow-[rgba(0,0,0,0.06)]";function p(e){e.classList.add(A)}function H(e){e.classList.remove(A)}function D(e){const{children:t,...n}=e,{columns:l,rowSelection:r}=n,[d,u]=g.useState(null);return g.useEffect(()=>{let s=l.some(a=>!!a.sticky);return s||(s=!!r?.sticky),s&&u(new IntersectionObserver(a=>{let o=!1;for(const k of a)if(k.boundingClientRect.right>k.intersectionRect.right){document.querySelectorAll("#sticky-cell-right").forEach(p),o=!0;break}else if(k.boundingClientRect.left<k.intersectionRect.left){document.querySelectorAll("#sticky-cell-left").forEach(p),o=!0;break}o||document.querySelectorAll('[id^="sticky-cell-"]').forEach(H)},{threshold:1,rootMargin:"0% 100% 0% 100%"})),()=>{d&&d.disconnect()}},[]),i.jsx(T.Provider,{value:{observer:d,...n},children:t})}const h=()=>g.useContext(T),O=e=>{const{title:t,extraElement:n,showTotal:l,total:r,className:d}=e;return i.jsxs("div",{className:c.clsx("dgs-ui-kit-p-4 dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",d),children:[i.jsx("div",{className:"dgs-ui-kit-font-h4-bold dgs-ui-kit-text-gray-700 dgs-ui-kit-w-full",children:t}),l&&i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-shrink-0",children:[i.jsx("span",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-700 dgs-ui-kit-ml-1",children:"تعداد نتایج:"}),i.jsx(_,{value:r??0,valueType:"number",size:"large",color:"primary",type:"twoTone"})]}),n]})};function b(e){switch(e){case"center":return"dgs-ui-kit-justify-center";case"start":return"dgs-ui-kit-justify-start";case"end":return"dgs-ui-kit-justify-end";default:return}}function R(e,t){return e||(Array.isArray(t)?t[t.length-1]:t)}function E(e){return!!(e&&e.selectedRowKeys.length>1||typeof e?.onSelectRow=="function")}function q(e,t){return i.jsx("div",{className:c.clsx("dgs-ui-kit-w-full dgs-ui-kit-flex dgs-ui-kit-items-centerd",b(e??"center")),children:i.jsx(B,{...t})})}function P(e,t){if(e)return c.clsx("dgs-ui-kit-sticky dgs-ui-kit-z-10",'after:dgs-ui-kit-content[""] after:dgs-ui-kit-absolute after:dgs-ui-kit-top-0 after:dgs-ui-kit-h-full after:dgs-ui-kit-w-[30px] after:dgs-ui-kit-transition-shadow',{" dgs-ui-kit-right-[-1px] dgs-ui-kit-pr-[calc(1em+1px)] after:dgs-ui-kit-left-0 after:-dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_-10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent":e==="right"," dgs-ui-kit-left-[-1px] dgs-ui-kit-pl-[calc(1em+1px)] after:dgs-ui-kit-right-0 after:dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent":e==="left",'before:dgs-ui-kit-content-[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-top-0 before:dgs-ui-kit-right-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-t before:md:dgs-ui-kit-border-t-0 before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200':t})}const f=e=>{const{children:t,className:n,type:l,sticky:r,addBorderToSticky:d,stuckToTop:u}=e,s=g.useRef(null),a=l,{observer:o}=h();return g.useEffect(()=>{if(!(!s.current||!o))return r&&o.observe(s.current),()=>{!s.current||!o||r&&o.unobserve(s.current)}},[s,o]),i.jsx(a,{ref:s,className:c.clsx(n,P(r,d),{'dgs-ui-kit-border-b-0 before:dgs-ui-kit-content[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-bottom-0 before:dgs-ui-kit-left-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-b before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200':u,"dgs-ui-kit-top-0 dgs-ui-kit-z-20":u&&r,"dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-z-10":u&&!r}),id:r&&`sticky-cell-${r}`,children:t})},m="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-bg-white dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200";function z(e,t){return e?Array.isArray(e)?e.reduce((n,l)=>n?.[l]??null,t):t[e]:null}function $(e,t,n){if(typeof e.render=="function")return e.render(t,n);const l=z(e.dataIndex,t);if(e.ellipsis){const r=i.jsx("div",{className:"!dgs-ui-kit-truncate",children:l});return typeof e.ellipsis!="boolean"&&e.ellipsis.hideTooltip?r:i.jsx(S,{wrapperClassName:"dgs-ui-kit-w-full",content:l,children:r})}return l}const F=e=>{const{havePagination:t}=e,{columns:n,data:l,rowKey:r,rowSelection:d,stickyTableHeader:u}=h();return i.jsx("tbody",{children:l.map((s,a)=>i.jsxs("tr",{children:[E(d)&&i.jsx(f,{type:"td",className:c.clsx(m,d?.className,{"dgs-ui-kit-border-b-0 dgs-ui-kit-rounded-br-2xl":!t&&a===l.length-1},d?.className),sticky:d?.sticky,addBorderToSticky:u?a!==0:!0,children:q(d?.align,{onChange:o=>d?.onSelectRow(o,s[r]),checked:!!d?.selectedRowKeys.find(o=>o===s[r])})}),n.map(o=>i.jsx(f,{type:"td",className:c.clsx(m,{"dgs-ui-kit-border-b-0 first:dgs-ui-kit-rounded-br-2xl last:dgs-ui-kit-rounded-bl-2xl":!t&&a===l.length-1},o.className),sticky:o.sticky,addBorderToSticky:u?a!==0:!0,children:i.jsx("div",{className:c.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-ml-2",b(o.align)),children:$(o,s,a)})},`${s[r]}-${R(o.key,o.dataIndex)}`))]},s[r]))})},M=e=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M19.53 16.03a.75.75 0 0 1-.976.073l-.084-.073L12 9.561l-6.47 6.47a.75.75 0 0 1-.976.072l-.084-.073a.75.75 0 0 1-.073-.976l.073-.084 7-7a.75.75 0 0 1 .976-.073l.084.073 7 7a.75.75 0 0 1 0 1.06"})});function U(e,t){if(e.length!==t.length)return!1;e.sort(),t.sort();for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}const x=16,j="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-text-gray-500 dgs-ui-kit-bg-gray-50 dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",v="!dgs-ui-kit-h-8 dgs-ui-kit-shrink-0";function w(e,t){const n=e==="ascend"?M:I.IconArrowDown2;return i.jsx("button",{onClick:()=>t.onSort(e),children:i.jsx(n,{width:x,height:x,className:t.active===e?"dgs-ui-kit-text-primary-500":"dgs-ui-kit-text-gray-500"})})}function C(e,t){return i.jsxs("div",{className:"dgs-ui-kit-font-p1-medium dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse",children:[i.jsx("span",{children:e}),t&&(t.anchorIcon??i.jsx(K.IconInfoCircleOutline,{width:x,height:x}))]})}function N(e,t){return e.map(n=>n[t])}const W=e=>{const{haveHeader:t}=e,{columns:n,rowKey:l,rowSelection:r,data:d,stickyTableHeader:u}=h();return i.jsx("thead",{children:i.jsxs("tr",{children:[E(r)&&i.jsx(f,{type:"th",className:c.clsx(j,{"dgs-ui-kit-rounded-tr-2xl":!t},r?.className),sticky:r?.sticky,stuckToTop:u,children:i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-between",children:[q(r?.align,{checked:r.selectedRowKeys.length>0,isIndeterminate:!U(N(d,l),r.selectedRowKeys),onChange:s=>r?.onSelectRow(s,s.target.checked?N(d,l):[])}),i.jsx(y,{type:"vertical",className:v})]})}),n.map((s,a)=>i.jsx(f,{type:"th",sticky:s.sticky,className:c.clsx(j,{"first:dgs-ui-kit-rounded-tr-2xl last:dgs-ui-kit-rounded-tl-2xl":!t},s.className),stuckToTop:u,children:i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-items-center",children:[i.jsxs("div",{className:c.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-2 dgs-ui-kit-space-x-reverse dgs-ui-kit-w-full dgs-ui-kit-ml-2",b(s.align)),children:[s.tooltip?.content?i.jsx(S,{...s.tooltip,children:C(s.title,s.tooltip)}):C(s.title),typeof s.sort?.onSort=="function"&&i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-flex-col",children:[w("ascend",s.sort),w("descend",s.sort)]})]}),a!==n.length-1&&i.jsx(y,{type:"vertical",className:v})]})},R(s.key,s.dataIndex)))]})})};function Z(e){const{header:t,wrapperClassName:n,className:l,data:r,pagination:d}=e,u=(t&&Object.values(t).length>0)??!1,s=!!(d?.totalCount&&d?.pageSize);return i.jsxs("div",{className:c.clsx("dgs-ui-kit-relative dgs-ui-kit-bg-white dgs-ui-kit-border dgs-ui-kit-border-gray-200 dgs-ui-kit-border-solid dgs-ui-kit-rounded-2xl ",n),children:[u&&i.jsx(O,{...t,total:d?.totalCount??r.length}),i.jsx("table",{className:l,children:i.jsxs(D,{...e,children:[i.jsx(W,{haveHeader:u}),i.jsx(F,{havePagination:s})]})}),s&&i.jsx(L,{className:c.clsx("dgs-ui-kit-py-4 !dgs-ui-kit-px-0",d?.className),...d})]})}module.exports=Z;
1
+ "use client";"use strict";require('../assets/styles.css');const e=require("react/jsx-runtime"),c=require("../clsx-C11secjj.cjs"),k=require("react"),O=require("../Badge/index.cjs"),_=require("../Form/Checkbox/index.cjs"),S=require("../Tooltip/index.cjs"),L=require("../IconArrowDown2-C1dLVveG.cjs"),I=require("../IconInfoCircleOutline-0ef3qbeI.cjs"),p=require("../Divider/index.cjs"),K=require("../Pagination/index.cjs");;/* empty css */const A=k.createContext({observer:null,columns:[],data:[],rowKey:""}),E="after:!dgs-ui-kit-shadow-[rgba(0,0,0,0.06)]";function b(t){t.classList.add(E)}function H(t){t.classList.remove(E)}function z(t){const{children:i,...n}=t,{columns:l,rowSelection:r}=n,[a,d]=k.useState(null);return k.useEffect(()=>{let s=l.some(u=>!!u.sticky);return s||(s=!!r?.sticky),s&&d(new IntersectionObserver(u=>{let o=!1;for(const g of u)if(g.boundingClientRect.right>g.intersectionRect.right){document.querySelectorAll("#sticky-cell-right").forEach(b),o=!0;break}else if(g.boundingClientRect.left<g.intersectionRect.left){document.querySelectorAll("#sticky-cell-left").forEach(b),o=!0;break}o||document.querySelectorAll('[id^="sticky-cell-"]').forEach(H)},{threshold:1,rootMargin:"0% 100% 0% 100%"})),()=>{a&&a.disconnect()}},[]),e.jsx(A.Provider,{value:{observer:a,...n},children:i})}const x=()=>k.useContext(A),D=t=>{const{title:i,extraElement:n,showTotal:l,total:r,className:a}=t;return e.jsxs("div",{className:c.clsx("dgs-ui-kit-p-4 dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",a),children:[e.jsx("div",{className:"dgs-ui-kit-font-h4-bold dgs-ui-kit-text-gray-700 dgs-ui-kit-w-full",children:i}),l&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-shrink-0",children:[e.jsx("span",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-700 dgs-ui-kit-ml-1",children:"تعداد نتایج:"}),e.jsx(O,{value:r??0,valueType:"number",size:"large",color:"primary",type:"twoTone"})]}),n]})};function y(t){switch(t){case"center":return"dgs-ui-kit-justify-center";case"start":return"dgs-ui-kit-justify-start";case"end":return"dgs-ui-kit-justify-end";default:return}}function R(t,i){return t||(Array.isArray(i)?i[i.length-1]:i)}function B(t){return!!(t&&t.selectedRowKeys.length>1||typeof t?.onSelectRow=="function")}function q(t,i){return e.jsx("div",{className:c.clsx("dgs-ui-kit-w-full dgs-ui-kit-flex dgs-ui-kit-items-centerd",y(t??"center")),children:e.jsx(_,{...i})})}function P(t,i){if(t)return c.clsx("dgs-ui-kit-sticky dgs-ui-kit-z-10",'after:dgs-ui-kit-content[""] after:dgs-ui-kit-absolute after:dgs-ui-kit-top-0 after:dgs-ui-kit-h-full after:dgs-ui-kit-w-[30px] after:dgs-ui-kit-transition-shadow',{" dgs-ui-kit-right-[-1px] dgs-ui-kit-pr-[calc(1em+1px)] after:dgs-ui-kit-left-0 after:-dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_-10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent":t==="right"," dgs-ui-kit-left-[-1px] dgs-ui-kit-pl-[calc(1em+1px)] after:dgs-ui-kit-right-0 after:dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent":t==="left",'before:dgs-ui-kit-content-[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-top-0 before:dgs-ui-kit-right-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-t before:md:dgs-ui-kit-border-t-0 before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200':i})}const m=t=>{const{children:i,className:n,type:l,sticky:r,addBorderToSticky:a,stuckToTop:d}=t,s=k.useRef(null),u=l,{observer:o}=x();return k.useEffect(()=>{if(!(!s.current||!o))return r&&o.observe(s.current),()=>{!s.current||!o||r&&o.unobserve(s.current)}},[s,o]),e.jsx(u,{ref:s,className:c.clsx(n,P(r,a),{'dgs-ui-kit-border-b-0 before:dgs-ui-kit-content[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-bottom-0 before:dgs-ui-kit-left-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-b before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200':d,"dgs-ui-kit-top-0 dgs-ui-kit-z-20":d&&r,"dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-z-10":d&&!r}),id:r&&`sticky-cell-${r}`,children:i})},M=()=>{const{columns:t,emptyContent:i}=x();return e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,children:i})})})},F=t=>{const{className:i,...n}=t;return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"200px",height:"200px",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid",className:c.clsx("dgs-ui-kit-m-auto dgs-ui-kit-bg-none dgs-ui-kit-block dgs-ui-kit-text-primary-500",i),...n,children:[e.jsx("g",{transform:"translate(79,50)",children:e.jsx("g",{transform:"rotate(0)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"1",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"-0.875s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"-0.875s"})]})})}),e.jsx("g",{transform:"translate(70.50609665440987,70.50609665440987)",children:e.jsx("g",{transform:"rotate(45)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"0.875",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"-0.75s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"-0.75s"})]})})}),e.jsx("g",{transform:"translate(50,79)",children:e.jsx("g",{transform:"rotate(90)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"0.75",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"-0.625s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"-0.625s"})]})})}),e.jsx("g",{transform:"translate(29.493903345590123,70.50609665440987)",children:e.jsx("g",{transform:"rotate(135)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"0.625",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"-0.5s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"-0.5s"})]})})}),e.jsx("g",{transform:"translate(21,50)",children:e.jsx("g",{transform:"rotate(180)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"0.5",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"-0.375s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"-0.375s"})]})})}),e.jsx("g",{transform:"translate(29.493903345590116,29.493903345590123)",children:e.jsx("g",{transform:"rotate(225)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"0.375",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"-0.25s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"-0.25s"})]})})}),e.jsx("g",{transform:"translate(49.99999999999999,21)",children:e.jsx("g",{transform:"rotate(270)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"0.25",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"-0.125s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"-0.125s"})]})})}),e.jsx("g",{transform:"translate(70.50609665440987,29.493903345590116)",children:e.jsx("g",{transform:"rotate(315)",children:e.jsxs("circle",{cx:"0",cy:"0",r:"6",fill:"currentColor",fillOpacity:"0.125",children:[e.jsx("animateTransform",{attributeName:"transform",type:"scale",begin:"0s",values:"1.5 1.5;1 1",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite"}),e.jsx("animate",{attributeName:"fill-opacity",keyTimes:"0;1",dur:"1s",repeatCount:"indefinite",values:"1;0",begin:"0s"})]})})})]})},$=()=>{const{columns:t,loading:i}=x();return e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{className:"dgs-ui-kit-p-10",colSpan:t.length,children:e.jsx(F,{width:typeof i!="boolean"?i.size:100,height:typeof i!="boolean"?i.size:100})})})})},j="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-bg-white dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200";function U(t,i){return t?Array.isArray(t)?t.reduce((n,l)=>n?.[l]??null,i):i[t]:null}function W(t,i,n){if(typeof t.render=="function")return t.render(i,n);const l=U(t.dataIndex,i);if(t.ellipsis){const r=e.jsx("div",{className:"!dgs-ui-kit-truncate",children:l});return typeof t.ellipsis!="boolean"&&t.ellipsis.hideTooltip?r:e.jsx(S,{wrapperClassName:"dgs-ui-kit-w-full",content:l,children:r})}return l}const Y=t=>{const{havePagination:i}=t,{columns:n,data:l,rowKey:r,rowSelection:a,stickyTableHeader:d,loading:s,emptyContent:u}=x();return s?e.jsx($,{}):l.length<1&&u?e.jsx(M,{}):e.jsx("tbody",{children:l.map((o,g)=>e.jsxs("tr",{children:[B(a)&&e.jsx(m,{type:"td",className:c.clsx(j,a?.className,{"dgs-ui-kit-border-b-0 dgs-ui-kit-rounded-br-2xl":!i&&g===l.length-1},a?.className),sticky:a?.sticky,addBorderToSticky:d?g!==0:!0,children:q(a?.align,{onChange:f=>a?.onSelectRow(f,o[r]),checked:!!a?.selectedRowKeys.find(f=>f===o[r])})}),n.map(f=>e.jsx(m,{type:"td",className:c.clsx(j,{"dgs-ui-kit-border-b-0 first:dgs-ui-kit-rounded-br-2xl last:dgs-ui-kit-rounded-bl-2xl":!i&&g===l.length-1},f.className),sticky:f.sticky,addBorderToSticky:d?g!==0:!0,children:e.jsx("div",{className:c.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-ml-2",y(f.align)),children:W(f,o,g)})},`${o[r]}-${R(f.key,f.dataIndex)}`))]},o[r]))})},Z=t=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...t,children:e.jsx("path",{fill:"currentColor",d:"M19.53 16.03a.75.75 0 0 1-.976.073l-.084-.073L12 9.561l-6.47 6.47a.75.75 0 0 1-.976.072l-.084-.073a.75.75 0 0 1-.073-.976l.073-.084 7-7a.75.75 0 0 1 .976-.073l.084.073 7 7a.75.75 0 0 1 0 1.06"})});function G(t,i){if(t.length!==i.length)return!1;t.sort(),i.sort();for(let n=0;n<t.length;n++)if(t[n]!==i[n])return!1;return!0}const h=16,v="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-text-gray-500 dgs-ui-kit-bg-gray-50 dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",C="!dgs-ui-kit-h-8 dgs-ui-kit-shrink-0";function N(t,i){const n=t==="ascend"?Z:L.IconArrowDown2;return e.jsx("button",{onClick:()=>i.onSort(t),children:e.jsx(n,{width:h,height:h,className:i.active===t?"dgs-ui-kit-text-primary-500":"dgs-ui-kit-text-gray-500"})})}function w(t,i){return e.jsxs("div",{className:"dgs-ui-kit-font-p1-medium dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse",children:[e.jsx("span",{children:t}),i&&(i.anchorIcon??e.jsx(I.IconInfoCircleOutline,{width:h,height:h}))]})}function T(t,i){return t.map(n=>n[i])}const J=t=>{const{haveHeader:i}=t,{columns:n,rowKey:l,rowSelection:r,data:a,stickyTableHeader:d}=x();return e.jsx("thead",{children:e.jsxs("tr",{children:[B(r)&&e.jsx(m,{type:"th",className:c.clsx(v,{"dgs-ui-kit-rounded-tr-2xl":!i},r?.className),sticky:r?.sticky,stuckToTop:d,children:e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-between",children:[q(r?.align,{checked:r.selectedRowKeys.length>0,isIndeterminate:!G(T(a,l),r.selectedRowKeys),onChange:s=>r?.onSelectRow(s,s.target.checked?T(a,l):[])}),e.jsx(p,{type:"vertical",className:C})]})}),n.map((s,u)=>e.jsx(m,{type:"th",sticky:s.sticky,className:c.clsx(v,{"first:dgs-ui-kit-rounded-tr-2xl last:dgs-ui-kit-rounded-tl-2xl":!i},s.className),stuckToTop:d,children:e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-items-center",children:[e.jsxs("div",{className:c.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-2 dgs-ui-kit-space-x-reverse dgs-ui-kit-w-full dgs-ui-kit-ml-2",y(s.align)),children:[s.tooltip?.content?e.jsx(S,{...s.tooltip,children:w(s.title,s.tooltip)}):w(s.title),typeof s.sort?.onSort=="function"&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-flex-col",children:[N("ascend",s.sort),N("descend",s.sort)]})]}),u!==n.length-1&&e.jsx(p,{type:"vertical",className:C})]})},R(s.key,s.dataIndex)))]})})};function Q(t){const{header:i,wrapperClassName:n,className:l,data:r,pagination:a,layout:d="auto",containerClassName:s}=t,u=(i&&Object.values(i).length>0)??!1,o=!!(a?.totalCount&&a?.pageSize),g=d!=="fixed"?"div":k.Fragment;return e.jsxs("div",{className:c.clsx("dgs-ui-kit-relative dgs-ui-kit-bg-white dgs-ui-kit-border dgs-ui-kit-border-gray-200 dgs-ui-kit-border-solid dgs-ui-kit-rounded-2xl",n),children:[u&&e.jsx(D,{...i,total:a?.totalCount??r.length}),e.jsx(g,{...d!=="fixed"?{className:c.clsx("dgs-ui-kit-overflow-x-auto dgs-ui-kit-h-full",s)}:{},children:e.jsx(z,{...t,children:e.jsxs("table",{className:l,style:{tableLayout:d},children:[e.jsx(J,{haveHeader:u}),e.jsx(Y,{havePagination:o})]})})}),o&&e.jsx(K,{className:c.clsx("dgs-ui-kit-py-4 !dgs-ui-kit-px-0",a?.className),...a})]})}module.exports=Q;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Table/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,kBAAkB,CAAC;AAE1B,iBAAS,KAAK,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,2CAiCrE;AAED,eAAe,KAAK,CAAC;AACrB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Table/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,kBAAkB,CAAC;AAE1B,iBAAS,KAAK,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,2CAmDrE;AAED,eAAe,KAAK,CAAC;AACrB,cAAc,SAAS,CAAC"}