dgz-ui-shared 1.2.43 → 1.2.44

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.
Files changed (28) hide show
  1. package/dist/chunks/Actions-Du8iQ3WR.es.js.map +1 -1
  2. package/dist/chunks/Actions-bpMDyl5M.cjs.js.map +1 -1
  3. package/dist/chunks/ExportData-CwotVgye.es.js.map +1 -1
  4. package/dist/chunks/ExportData-DJE0jOHc.cjs.js.map +1 -1
  5. package/dist/chunks/Search-DunDXQgP.es.js.map +1 -1
  6. package/dist/chunks/Search-kbkeTeSI.cjs.js.map +1 -1
  7. package/dist/chunks/useSortable-B1BtakAy.es.js +256 -0
  8. package/dist/chunks/{useSortable-rCSw-6ZK.es.js.map → useSortable-B1BtakAy.es.js.map} +1 -1
  9. package/dist/chunks/useSortable-BZKLpg8U.cjs.js +2 -0
  10. package/dist/chunks/{useSortable-BKwVnk6V.cjs.js.map → useSortable-BZKLpg8U.cjs.js.map} +1 -1
  11. package/dist/components/datatable/index.cjs.js +1 -1
  12. package/dist/components/datatable/index.cjs.js.map +1 -1
  13. package/dist/components/datatable/index.es.js +226 -231
  14. package/dist/components/datatable/index.es.js.map +1 -1
  15. package/dist/hooks/index.cjs.js +1 -1
  16. package/dist/hooks/index.es.js +1 -1
  17. package/dist/types/components/actions/Actions.d.ts +1 -0
  18. package/dist/types/components/actions/Actions.d.ts.map +1 -1
  19. package/dist/types/components/datatable/DataTable.d.ts +1 -1
  20. package/dist/types/components/datatable/DataTable.d.ts.map +1 -1
  21. package/dist/types/components/export/ExportData.d.ts +1 -0
  22. package/dist/types/components/export/ExportData.d.ts.map +1 -1
  23. package/dist/types/components/filters/FilterWrapper.d.ts +1 -0
  24. package/dist/types/components/filters/FilterWrapper.d.ts.map +1 -1
  25. package/dist/types/hooks/useDataTable.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunks/useSortable-BKwVnk6V.cjs.js +0 -2
  28. package/dist/chunks/useSortable-rCSw-6ZK.es.js +0 -263
@@ -1 +1 @@
1
- {"version":3,"file":"Actions-Du8iQ3WR.es.js","sources":["../../src/components/actions/Actions.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiPlayList2Line } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Interface representing a single action item.\n */\nexport interface ActionInterface {\n /** The content to display for the action item. */\n label: ReactNode;\n /** Callback function to execute when the action is clicked. */\n onClick: () => void;\n}\n\n/**\n * Props for the Actions component.\n */\nexport interface ActionsProps extends DropdownContainerProps {\n /** Array of action items to be displayed in the dropdown. */\n actions: ActionInterface[];\n /** Title for the actions button. */\n title?: ReactNode;\n}\n\n/**\n * Actions renders a dropdown menu with a list of action items.\n *\n * @param actions - Array of actions with label and onClick handler.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the actions button.\n * @returns {JSX.Element} React element rendering the actions dropdown.\n */\nexport const Actions = ({\n actions,\n triggerProps,\n contentProps,\n title,\n}: ActionsProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild className={'grow'} {...triggerProps}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n <RiPlayList2Line />{' '}\n <span className={'hidden md:inline!'}>{title || t('Actions')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {actions.map((action, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => action.onClick()}>\n {action.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["Actions","actions","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","RiPlayList2Line","RiArrowDownSLine","DropdownMenuContent","action","index","DropdownMenuItem"],"mappings":";;;;;AAyCO,MAAMA,IAAU,CAAC;AAAA,EACtB,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AACF,MAAoB;AAClB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAoB,SAAO,IAAC,WAAW,QAAS,GAAGP,GAClD,UAAA,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAM;AAAA,QACN,WAAW;AAAA,QAEX,UAAA;AAAA,UAAA,gBAAAH,EAACI,GAAA,EAAgB;AAAA,UAAG;AAAA,4BACnB,QAAA,EAAK,WAAW,qBAAsB,UAAAR,KAASC,EAAE,SAAS,GAAE;AAAA,4BAC5DQ,GAAA,CAAA,CAAiB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEtB;AAAA,IACA,gBAAAL,EAACM,GAAA,EAAoB,OAAM,OAAO,GAAGX,GAClC,UAAAF,EAAQ,IAAI,CAACc,GAAQC,MAElB,gBAAAR,EAACS,KAA6B,SAAS,MAAMF,EAAO,QAAA,GACjD,UAAAA,EAAO,MAAA,GADaC,CAEvB,CAEH,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Actions-Du8iQ3WR.es.js","sources":["../../src/components/actions/Actions.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiPlayList2Line } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Interface representing a single action item.\n */\nexport interface ActionInterface {\n /** The content to display for the action item. */\n label: ReactNode;\n /** Callback function to execute when the action is clicked. */\n onClick: () => void;\n access?: string[];\n}\n\n/**\n * Props for the Actions component.\n */\nexport interface ActionsProps extends DropdownContainerProps {\n /** Array of action items to be displayed in the dropdown. */\n actions: ActionInterface[];\n /** Title for the actions button. */\n title?: ReactNode;\n}\n\n/**\n * Actions renders a dropdown menu with a list of action items.\n *\n * @param actions - Array of actions with label and onClick handler.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the actions button.\n * @returns {JSX.Element} React element rendering the actions dropdown.\n */\nexport const Actions = ({\n actions,\n triggerProps,\n contentProps,\n title,\n}: ActionsProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild className={'grow'} {...triggerProps}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n <RiPlayList2Line />{' '}\n <span className={'hidden md:inline!'}>{title || t('Actions')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {actions.map((action, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => action.onClick()}>\n {action.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["Actions","actions","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","RiPlayList2Line","RiArrowDownSLine","DropdownMenuContent","action","index","DropdownMenuItem"],"mappings":";;;;;AA0CO,MAAMA,IAAU,CAAC;AAAA,EACtB,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AACF,MAAoB;AAClB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAoB,SAAO,IAAC,WAAW,QAAS,GAAGP,GAClD,UAAA,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAM;AAAA,QACN,WAAW;AAAA,QAEX,UAAA;AAAA,UAAA,gBAAAH,EAACI,GAAA,EAAgB;AAAA,UAAG;AAAA,4BACnB,QAAA,EAAK,WAAW,qBAAsB,UAAAR,KAASC,EAAE,SAAS,GAAE;AAAA,4BAC5DQ,GAAA,CAAA,CAAiB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEtB;AAAA,IACA,gBAAAL,EAACM,GAAA,EAAoB,OAAM,OAAO,GAAGX,GAClC,UAAAF,EAAQ,IAAI,CAACc,GAAQC,MAElB,gBAAAR,EAACS,KAA6B,SAAS,MAAMF,EAAO,QAAA,GACjD,UAAAA,EAAO,MAAA,GADaC,CAEvB,CAEH,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Actions-bpMDyl5M.cjs.js","sources":["../../src/components/actions/Actions.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiPlayList2Line } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Interface representing a single action item.\n */\nexport interface ActionInterface {\n /** The content to display for the action item. */\n label: ReactNode;\n /** Callback function to execute when the action is clicked. */\n onClick: () => void;\n}\n\n/**\n * Props for the Actions component.\n */\nexport interface ActionsProps extends DropdownContainerProps {\n /** Array of action items to be displayed in the dropdown. */\n actions: ActionInterface[];\n /** Title for the actions button. */\n title?: ReactNode;\n}\n\n/**\n * Actions renders a dropdown menu with a list of action items.\n *\n * @param actions - Array of actions with label and onClick handler.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the actions button.\n * @returns {JSX.Element} React element rendering the actions dropdown.\n */\nexport const Actions = ({\n actions,\n triggerProps,\n contentProps,\n title,\n}: ActionsProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild className={'grow'} {...triggerProps}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n <RiPlayList2Line />{' '}\n <span className={'hidden md:inline!'}>{title || t('Actions')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {actions.map((action, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => action.onClick()}>\n {action.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["Actions","actions","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","RiPlayList2Line","RiArrowDownSLine","DropdownMenuContent","action","index","DropdownMenuItem"],"mappings":"0KAyCaA,EAAU,CAAC,CACtB,QAAAC,EACA,aAAAC,EACA,aAAAC,EACA,MAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,EAAAC,CAAA,EAAMC,iBAAA,EAEd,cACGC,eAAA,CACC,SAAA,CAAAC,MAACC,EAAAA,qBAAoB,QAAO,GAAC,UAAW,OAAS,GAAGP,EAClD,SAAAQ,EAAAA,KAACC,EAAAA,OAAA,CACC,QAAQ,YACR,KAAM,KACN,UAAW,0BAEX,SAAA,CAAAH,EAAAA,IAACI,EAAAA,GAAA,EAAgB,EAAG,UACnB,OAAA,CAAK,UAAW,oBAAsB,SAAAR,GAASC,EAAE,SAAS,EAAE,QAC5DQ,EAAAA,GAAA,CAAA,CAAiB,CAAA,CAAA,CAAA,EAEtB,EACAL,EAAAA,IAACM,EAAAA,oBAAA,CAAoB,MAAM,MAAO,GAAGX,EAClC,SAAAF,EAAQ,IAAI,CAACc,EAAQC,IAElBR,MAACS,EAAAA,kBAA6B,QAAS,IAAMF,EAAO,QAAA,EACjD,SAAAA,EAAO,KAAA,EADaC,CAEvB,CAEH,CAAA,CACH,CAAA,EACF,CAEJ"}
1
+ {"version":3,"file":"Actions-bpMDyl5M.cjs.js","sources":["../../src/components/actions/Actions.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiPlayList2Line } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * Interface representing a single action item.\n */\nexport interface ActionInterface {\n /** The content to display for the action item. */\n label: ReactNode;\n /** Callback function to execute when the action is clicked. */\n onClick: () => void;\n access?: string[];\n}\n\n/**\n * Props for the Actions component.\n */\nexport interface ActionsProps extends DropdownContainerProps {\n /** Array of action items to be displayed in the dropdown. */\n actions: ActionInterface[];\n /** Title for the actions button. */\n title?: ReactNode;\n}\n\n/**\n * Actions renders a dropdown menu with a list of action items.\n *\n * @param actions - Array of actions with label and onClick handler.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the actions button.\n * @returns {JSX.Element} React element rendering the actions dropdown.\n */\nexport const Actions = ({\n actions,\n triggerProps,\n contentProps,\n title,\n}: ActionsProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild className={'grow'} {...triggerProps}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n <RiPlayList2Line />{' '}\n <span className={'hidden md:inline!'}>{title || t('Actions')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {actions.map((action, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => action.onClick()}>\n {action.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["Actions","actions","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","RiPlayList2Line","RiArrowDownSLine","DropdownMenuContent","action","index","DropdownMenuItem"],"mappings":"0KA0CaA,EAAU,CAAC,CACtB,QAAAC,EACA,aAAAC,EACA,aAAAC,EACA,MAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,EAAAC,CAAA,EAAMC,iBAAA,EAEd,cACGC,eAAA,CACC,SAAA,CAAAC,MAACC,EAAAA,qBAAoB,QAAO,GAAC,UAAW,OAAS,GAAGP,EAClD,SAAAQ,EAAAA,KAACC,EAAAA,OAAA,CACC,QAAQ,YACR,KAAM,KACN,UAAW,0BAEX,SAAA,CAAAH,EAAAA,IAACI,EAAAA,GAAA,EAAgB,EAAG,UACnB,OAAA,CAAK,UAAW,oBAAsB,SAAAR,GAASC,EAAE,SAAS,EAAE,QAC5DQ,EAAAA,GAAA,CAAA,CAAiB,CAAA,CAAA,CAAA,EAEtB,EACAL,EAAAA,IAACM,EAAAA,oBAAA,CAAoB,MAAM,MAAO,GAAGX,EAClC,SAAAF,EAAQ,IAAI,CAACc,EAAQC,IAElBR,MAACS,EAAAA,kBAA6B,QAAS,IAAMF,EAAO,QAAA,EACjD,SAAAA,EAAO,KAAA,EADaC,CAEvB,CAEH,CAAA,CACH,CAAA,EACF,CAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExportData-CwotVgye.es.js","sources":["../../src/components/export/ExportData.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiFileChartLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Spin } from '../loader';\n\n/**\n * Describes a single export option in the ExportData dropdown.\n *\n * - Use `label` to render the visible option content (text or any React node).\n * - Provide `onClick` to trigger the export logic (CSV/XLS/PDF, etc.).\n */\nexport interface ExportDataInterface {\n /** Visible content for the dropdown item (text, icon, etc.). */\n label: ReactNode;\n /** Callback executed when the export option is selected. */\n onClick: () => void;\n}\n\n/**\n * Props for the `ExportData` component.\n *\n * - `options` — A list of export actions displayed in the dropdown.\n * - `loading` — When `true`, shows a small spinner in the button to indicate an export is in progress.\n */\nexport interface ExportDataProps extends DropdownContainerProps {\n /** Export actions displayed in the dropdown. */\n options: ExportDataInterface[];\n /** If `true`, renders a spinner icon in the button. */\n loading?: boolean;\n /** Title for the export button. */\n title?: ReactNode;\n}\n\n/**\n * ExportData renders a compact dropdown button for exporting data in various formats.\n *\n * Behavior\n * - Shows a button with an export icon and localized \"Export\" label.\n * - Clicking opens a dropdown with the provided `options` list.\n * - Each option calls its `onClick` handler when selected.\n *\n * Accessibility\n * - Uses the shared Dropdown primitives and Button which provide keyboard and ARIA support.\n *\n * Internationalization\n * - The button label is translated via `react-i18next` using the `Export` key.\n *\n * @param options - Array of export actions with label and onClick handler.\n * @param loading - When true, shows a spinner in the button.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the export button.\n * @returns {JSX.Element} React element rendering the export data dropdown.\n */\nexport const ExportData = ({\n options,\n loading = false,\n triggerProps,\n contentProps,\n title,\n}: ExportDataProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild {...triggerProps} className={'grow'}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n {loading ? (\n <Spin className={'text-item-primary'} />\n ) : (\n <RiFileChartLine />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Export')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {options.map((option, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => option.onClick()}>\n {option.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["ExportData","options","loading","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","Spin","RiFileChartLine","RiArrowDownSLine","DropdownMenuContent","option","index","DropdownMenuItem"],"mappings":";;;;;;AA8DO,MAAMA,IAAa,CAAC;AAAA,EACzB,SAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AACF,MAAuB;AACrB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAoB,SAAO,IAAE,GAAGP,GAAc,WAAW,QACxD,UAAA,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAM;AAAA,QACN,WAAW;AAAA,QAEV,UAAA;AAAA,UAAAV,sBACEW,GAAA,EAAK,WAAW,oBAAA,CAAqB,sBAErCC,GAAA,EAAgB;AAAA,UAChB;AAAA,4BACF,QAAA,EAAK,WAAW,qBAAsB,UAAAT,KAASC,EAAE,QAAQ,GAAE;AAAA,4BAC3DS,GAAA,CAAA,CAAiB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEtB;AAAA,IACA,gBAAAN,EAACO,GAAA,EAAoB,OAAM,OAAO,GAAGZ,GAClC,UAAAH,EAAQ,IAAI,CAACgB,GAAQC,MAElB,gBAAAT,EAACU,KAA6B,SAAS,MAAMF,EAAO,QAAA,GACjD,UAAAA,EAAO,MAAA,GADaC,CAEvB,CAEH,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"ExportData-CwotVgye.es.js","sources":["../../src/components/export/ExportData.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiFileChartLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Spin } from '../loader';\n\n/**\n * Describes a single export option in the ExportData dropdown.\n *\n * - Use `label` to render the visible option content (text or any React node).\n * - Provide `onClick` to trigger the export logic (CSV/XLS/PDF, etc.).\n */\nexport interface ExportDataInterface {\n /** Visible content for the dropdown item (text, icon, etc.). */\n label: ReactNode;\n /** Callback executed when the export option is selected. */\n onClick: () => void;\n access?: string[];\n}\n\n/**\n * Props for the `ExportData` component.\n *\n * - `options` — A list of export actions displayed in the dropdown.\n * - `loading` — When `true`, shows a small spinner in the button to indicate an export is in progress.\n */\nexport interface ExportDataProps extends DropdownContainerProps {\n /** Export actions displayed in the dropdown. */\n options: ExportDataInterface[];\n /** If `true`, renders a spinner icon in the button. */\n loading?: boolean;\n /** Title for the export button. */\n title?: ReactNode;\n}\n\n/**\n * ExportData renders a compact dropdown button for exporting data in various formats.\n *\n * Behavior\n * - Shows a button with an export icon and localized \"Export\" label.\n * - Clicking opens a dropdown with the provided `options` list.\n * - Each option calls its `onClick` handler when selected.\n *\n * Accessibility\n * - Uses the shared Dropdown primitives and Button which provide keyboard and ARIA support.\n *\n * Internationalization\n * - The button label is translated via `react-i18next` using the `Export` key.\n *\n * @param options - Array of export actions with label and onClick handler.\n * @param loading - When true, shows a spinner in the button.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the export button.\n * @returns {JSX.Element} React element rendering the export data dropdown.\n */\nexport const ExportData = ({\n options,\n loading = false,\n triggerProps,\n contentProps,\n title,\n}: ExportDataProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild {...triggerProps} className={'grow'}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n {loading ? (\n <Spin className={'text-item-primary'} />\n ) : (\n <RiFileChartLine />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Export')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {options.map((option, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => option.onClick()}>\n {option.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["ExportData","options","loading","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","Spin","RiFileChartLine","RiArrowDownSLine","DropdownMenuContent","option","index","DropdownMenuItem"],"mappings":";;;;;;AA+DO,MAAMA,IAAa,CAAC;AAAA,EACzB,SAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AACF,MAAuB;AACrB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,2BACGC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAoB,SAAO,IAAE,GAAGP,GAAc,WAAW,QACxD,UAAA,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAM;AAAA,QACN,WAAW;AAAA,QAEV,UAAA;AAAA,UAAAV,sBACEW,GAAA,EAAK,WAAW,oBAAA,CAAqB,sBAErCC,GAAA,EAAgB;AAAA,UAChB;AAAA,4BACF,QAAA,EAAK,WAAW,qBAAsB,UAAAT,KAASC,EAAE,QAAQ,GAAE;AAAA,4BAC3DS,GAAA,CAAA,CAAiB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEtB;AAAA,IACA,gBAAAN,EAACO,GAAA,EAAoB,OAAM,OAAO,GAAGZ,GAClC,UAAAH,EAAQ,IAAI,CAACgB,GAAQC,MAElB,gBAAAT,EAACU,KAA6B,SAAS,MAAMF,EAAO,QAAA,GACjD,UAAAA,EAAO,MAAA,GADaC,CAEvB,CAEH,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExportData-DJE0jOHc.cjs.js","sources":["../../src/components/export/ExportData.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiFileChartLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Spin } from '../loader';\n\n/**\n * Describes a single export option in the ExportData dropdown.\n *\n * - Use `label` to render the visible option content (text or any React node).\n * - Provide `onClick` to trigger the export logic (CSV/XLS/PDF, etc.).\n */\nexport interface ExportDataInterface {\n /** Visible content for the dropdown item (text, icon, etc.). */\n label: ReactNode;\n /** Callback executed when the export option is selected. */\n onClick: () => void;\n}\n\n/**\n * Props for the `ExportData` component.\n *\n * - `options` — A list of export actions displayed in the dropdown.\n * - `loading` — When `true`, shows a small spinner in the button to indicate an export is in progress.\n */\nexport interface ExportDataProps extends DropdownContainerProps {\n /** Export actions displayed in the dropdown. */\n options: ExportDataInterface[];\n /** If `true`, renders a spinner icon in the button. */\n loading?: boolean;\n /** Title for the export button. */\n title?: ReactNode;\n}\n\n/**\n * ExportData renders a compact dropdown button for exporting data in various formats.\n *\n * Behavior\n * - Shows a button with an export icon and localized \"Export\" label.\n * - Clicking opens a dropdown with the provided `options` list.\n * - Each option calls its `onClick` handler when selected.\n *\n * Accessibility\n * - Uses the shared Dropdown primitives and Button which provide keyboard and ARIA support.\n *\n * Internationalization\n * - The button label is translated via `react-i18next` using the `Export` key.\n *\n * @param options - Array of export actions with label and onClick handler.\n * @param loading - When true, shows a spinner in the button.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the export button.\n * @returns {JSX.Element} React element rendering the export data dropdown.\n */\nexport const ExportData = ({\n options,\n loading = false,\n triggerProps,\n contentProps,\n title,\n}: ExportDataProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild {...triggerProps} className={'grow'}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n {loading ? (\n <Spin className={'text-item-primary'} />\n ) : (\n <RiFileChartLine />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Export')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {options.map((option, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => option.onClick()}>\n {option.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["ExportData","options","loading","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","Spin","RiFileChartLine","RiArrowDownSLine","DropdownMenuContent","option","index","DropdownMenuItem"],"mappings":"8MA8DaA,EAAa,CAAC,CACzB,QAAAC,EACA,QAAAC,EAAU,GACV,aAAAC,EACA,aAAAC,EACA,MAAAC,CACF,IAAuB,CACrB,KAAM,CAAE,EAAAC,CAAA,EAAMC,iBAAA,EAEd,cACGC,eAAA,CACC,SAAA,CAAAC,MAACC,EAAAA,qBAAoB,QAAO,GAAE,GAAGP,EAAc,UAAW,OACxD,SAAAQ,EAAAA,KAACC,EAAAA,OAAA,CACC,QAAQ,YACR,KAAM,KACN,UAAW,0BAEV,SAAA,CAAAV,QACEW,EAAAA,KAAA,CAAK,UAAW,mBAAA,CAAqB,QAErCC,EAAAA,GAAA,EAAgB,EAChB,UACF,OAAA,CAAK,UAAW,oBAAsB,SAAAT,GAASC,EAAE,QAAQ,EAAE,QAC3DS,EAAAA,GAAA,CAAA,CAAiB,CAAA,CAAA,CAAA,EAEtB,EACAN,EAAAA,IAACO,EAAAA,oBAAA,CAAoB,MAAM,MAAO,GAAGZ,EAClC,SAAAH,EAAQ,IAAI,CAACgB,EAAQC,IAElBT,MAACU,EAAAA,kBAA6B,QAAS,IAAMF,EAAO,QAAA,EACjD,SAAAA,EAAO,KAAA,EADaC,CAEvB,CAEH,CAAA,CACH,CAAA,EACF,CAEJ"}
1
+ {"version":3,"file":"ExportData-DJE0jOHc.cjs.js","sources":["../../src/components/export/ExportData.tsx"],"sourcesContent":["import { RiArrowDownSLine, RiFileChartLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport {\n type DropdownContainerProps,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from 'dgz-ui/dropdown';\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Spin } from '../loader';\n\n/**\n * Describes a single export option in the ExportData dropdown.\n *\n * - Use `label` to render the visible option content (text or any React node).\n * - Provide `onClick` to trigger the export logic (CSV/XLS/PDF, etc.).\n */\nexport interface ExportDataInterface {\n /** Visible content for the dropdown item (text, icon, etc.). */\n label: ReactNode;\n /** Callback executed when the export option is selected. */\n onClick: () => void;\n access?: string[];\n}\n\n/**\n * Props for the `ExportData` component.\n *\n * - `options` — A list of export actions displayed in the dropdown.\n * - `loading` — When `true`, shows a small spinner in the button to indicate an export is in progress.\n */\nexport interface ExportDataProps extends DropdownContainerProps {\n /** Export actions displayed in the dropdown. */\n options: ExportDataInterface[];\n /** If `true`, renders a spinner icon in the button. */\n loading?: boolean;\n /** Title for the export button. */\n title?: ReactNode;\n}\n\n/**\n * ExportData renders a compact dropdown button for exporting data in various formats.\n *\n * Behavior\n * - Shows a button with an export icon and localized \"Export\" label.\n * - Clicking opens a dropdown with the provided `options` list.\n * - Each option calls its `onClick` handler when selected.\n *\n * Accessibility\n * - Uses the shared Dropdown primitives and Button which provide keyboard and ARIA support.\n *\n * Internationalization\n * - The button label is translated via `react-i18next` using the `Export` key.\n *\n * @param options - Array of export actions with label and onClick handler.\n * @param loading - When true, shows a spinner in the button.\n * @param triggerProps - Props passed to the dropdown trigger.\n * @param contentProps - Props passed to the dropdown content.\n * @param title - Optional title for the export button.\n * @returns {JSX.Element} React element rendering the export data dropdown.\n */\nexport const ExportData = ({\n options,\n loading = false,\n triggerProps,\n contentProps,\n title,\n}: ExportDataProps) => {\n const { t } = useTranslation();\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild {...triggerProps} className={'grow'}>\n <Button\n variant=\"secondary\"\n size={'sm'}\n className={'ml-auto rounded-lg px-3'}\n >\n {loading ? (\n <Spin className={'text-item-primary'} />\n ) : (\n <RiFileChartLine />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Export')}</span>\n <RiArrowDownSLine />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" {...contentProps}>\n {options.map((option, index) => {\n return (\n <DropdownMenuItem key={index} onClick={() => option.onClick()}>\n {option.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["ExportData","options","loading","triggerProps","contentProps","title","t","useTranslation","DropdownMenu","jsx","DropdownMenuTrigger","jsxs","Button","Spin","RiFileChartLine","RiArrowDownSLine","DropdownMenuContent","option","index","DropdownMenuItem"],"mappings":"8MA+DaA,EAAa,CAAC,CACzB,QAAAC,EACA,QAAAC,EAAU,GACV,aAAAC,EACA,aAAAC,EACA,MAAAC,CACF,IAAuB,CACrB,KAAM,CAAE,EAAAC,CAAA,EAAMC,iBAAA,EAEd,cACGC,eAAA,CACC,SAAA,CAAAC,MAACC,EAAAA,qBAAoB,QAAO,GAAE,GAAGP,EAAc,UAAW,OACxD,SAAAQ,EAAAA,KAACC,EAAAA,OAAA,CACC,QAAQ,YACR,KAAM,KACN,UAAW,0BAEV,SAAA,CAAAV,QACEW,EAAAA,KAAA,CAAK,UAAW,mBAAA,CAAqB,QAErCC,EAAAA,GAAA,EAAgB,EAChB,UACF,OAAA,CAAK,UAAW,oBAAsB,SAAAT,GAASC,EAAE,QAAQ,EAAE,QAC3DS,EAAAA,GAAA,CAAA,CAAiB,CAAA,CAAA,CAAA,EAEtB,EACAN,EAAAA,IAACO,EAAAA,oBAAA,CAAoB,MAAM,MAAO,GAAGZ,EAClC,SAAAH,EAAQ,IAAI,CAACgB,EAAQC,IAElBT,MAACU,EAAAA,kBAA6B,QAAS,IAAMF,EAAO,QAAA,EACjD,SAAAA,EAAO,KAAA,EADaC,CAEvB,CAEH,CAAA,CACH,CAAA,EACF,CAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"Search-DunDXQgP.es.js","sources":["../../src/components/filters/FilterWrapper.tsx","../../src/components/filters/Search.tsx"],"sourcesContent":["import { Button, type ButtonProps } from 'dgz-ui/button';\nimport { Form, type Option } from 'dgz-ui/form';\nimport {\n Popover,\n type PopoverContainerProps,\n PopoverContent,\n PopoverTrigger,\n} from 'dgz-ui/popover';\nimport get from 'lodash.get';\nimport { ChevronDown, ListFilterIcon, ListFilterPlusIcon } from 'lucide-react';\nimport { memo, type ReactNode, useCallback, useEffect, useState } from 'react';\nimport type { FieldValues } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { useFilter } from '../../hooks';\nimport { MyInput, MySelect } from '../form';\n\n/**\n * Interface representing a filter configuration.\n */\nexport interface FilterInterface {\n /** Label for the filter field. */\n label?: ReactNode;\n /** Placeholder text for the input/select. */\n placeholder?: string;\n /** Default value for the filter. */\n value?: string | string[];\n /** Name of the filter field (used as key). */\n name: string;\n /** Whether the filter supports multiple values (for select inputs). */\n isMulti?: boolean;\n /** Whether the filter supports searchable inputs (for select inputs). */\n isSearchable?: boolean;\n /** Options for select inputs. */\n options?: Option[];\n}\n\n/**\n * Props for the FilterWrapper component.\n */\nexport interface FilterWrapperProps\n extends Omit<ButtonProps, 'title'>, PopoverContainerProps {\n /** Array of filter definitions to render. */\n filters: FilterInterface[];\n /** Current active parameters/filters. */\n params?: Record<string, unknown>;\n /** Callback fired when filters are applied. */\n onFilter?: (filters: Record<string, unknown>) => void;\n /** Callback fired when the filter popover is closed/cancelled. */\n onCancel?: () => void;\n /** Callback fired when filter form values change. */\n onChange?: (filters: FieldValues) => void;\n /** Title for the filter button. */\n title?: ReactNode;\n /** Text for the reset button. */\n resetText?: ReactNode;\n /** Text for the apply button. */\n applyText?: ReactNode;\n}\n\n/**\n * FilterWrapper shows a popover with a dynamic list of field filters and emits selected filter values.\n *\n * @param props.filters - Array of filter definitions to render.\n * @param props.params - Current params used to detect active filters.\n * @param props.onFilter - Callback fired when user applies filters.\n * @param props.onCancel - Callback fired on cancel.\n * @param props.onChange - Callback fired whenever filter form values change.\n * @returns {JSX.Element} A filter button that opens a popover with filter controls\n */\nexport const FilterWrapper = memo(function FilterWrapper({\n filters,\n params,\n onFilter,\n onChange,\n onCancel,\n triggerProps,\n contentProps,\n title,\n resetText,\n applyText,\n ...btnProps\n}: FilterWrapperProps) {\n const { t } = useTranslation();\n const [isFiltered, setIsFiltered] = useState(false);\n const [open, setOpen] = useState(false);\n const { form } = useFilter({ params });\n\n const { watch, handleSubmit, control, reset } = form;\n\n useEffect(() => {\n let hasFilter = false;\n filters.map((filter) => {\n const value = get(params, `${filter.name}`);\n if (Array.isArray(value) ? value.length > 0 : Boolean(value)) {\n hasFilter = true;\n }\n\n setIsFiltered(hasFilter);\n });\n }, [filters, params]);\n\n const values = watch();\n\n useEffect(() => {\n onChange?.(values);\n }, [values, onChange]);\n\n const handleFilter = useCallback(\n (data = {}) => {\n onFilter?.(data);\n setOpen(false);\n },\n [onFilter]\n );\n\n const handleReset = useCallback(() => {\n reset();\n if (onFilter) {\n onFilter({\n ...Object.fromEntries(\n filters.map((filter) => [filter.name, undefined])\n ),\n });\n }\n setOpen(false);\n }, [onFilter, reset, filters]);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger {...triggerProps} className={'grow'}>\n <Button\n asChild\n size={'sm'}\n variant=\"secondary\"\n className={'ml-auto w-full px-3'}\n {...btnProps}\n >\n <div className={'flex items-center'}>\n {isFiltered ? (\n <ListFilterPlusIcon className={'size-5'} />\n ) : (\n <ListFilterIcon className={'size-5'} />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Filter')}</span>\n <ChevronDown />\n </div>\n </Button>\n </PopoverTrigger>\n <PopoverContent side={'bottom'} align={'end'} {...contentProps}>\n <Form {...form}>\n <form onSubmit={handleSubmit(handleFilter)} className={'space-y-4'}>\n <div className={'h-full shrink space-y-6 p-1'}>\n {filters.map((filter) =>\n filter.options ? (\n <MySelect\n key={filter.name}\n control={control}\n name={filter.name}\n isSearchable={Boolean(filter.isSearchable)}\n placeholder={filter.placeholder}\n isMulti={filter.isMulti}\n options={filter.options}\n label={filter.label}\n />\n ) : (\n <MyInput\n key={filter.name}\n control={control}\n placeholder={filter.placeholder}\n name={filter.name}\n label={filter.label}\n />\n )\n )}\n </div>\n <div className={'flex shrink-0 justify-end gap-2'}>\n <Button\n variant={'destructive'}\n type=\"reset\"\n size={'sm'}\n onClick={handleReset}\n >\n {resetText || t('Reset')}\n </Button>\n <Button type=\"submit\" size={'sm'}>\n {applyText || t('Apply')}\n </Button>\n </div>\n </form>\n </Form>\n </PopoverContent>\n </Popover>\n );\n});\n","import { RiSearchLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport type { CardProps } from 'dgz-ui/card';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport get from 'lodash.get';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Keyboard } from '../../enums';\n\n/**\n * Props for the Search component.\n */\nexport type SearchProps = Omit<CardProps, 'title'> & {\n /** Custom placeholder text for the input. */\n placeholder?: string;\n /** Callback fired when the search is triggered. */\n onSearchChange: (search?: string) => void;\n inputProps?: InputProps;\n};\n\n/**\n * Search input with a submit button that triggers a search action.\n *\n * This component renders a search input field and a search button. The search\n * is triggered when the user presses Enter or clicks the button. The search\n * value is then passed to the `onSearchChange` callback.\n *\n * @param {SearchProps} props - The props for the component.\n * @param {string} [props.placeholder] - Optional placeholder text for the input field.\n * @param {Function} props.onSearchChange - Callback function that is called when a search is performed.\n * @param {string} [props.className] - Optional class name for the component.\n * @param {InputProps} [props.inputProps] - Optional props to pass to the underlying Input component.\n * @returns {JSX.Element} A search input field with submit button\n */\nexport const Search = ({\n placeholder,\n onSearchChange,\n className,\n inputProps,\n ...props\n}: SearchProps) => {\n const { t } = useTranslation();\n const [search, setSearch] = useState('');\n\n return (\n <div {...props} className={cn('relative w-full', className)}>\n <Input\n {...inputProps}\n placeholder={placeholder || t('Type text and press Enter')}\n onInput={(evt) => setSearch(get(evt, 'target.value', ''))}\n onKeyUp={(evt) => {\n if (evt.key === Keyboard.ENTER) {\n onSearchChange(search || undefined);\n evt.stopPropagation();\n evt.preventDefault();\n }\n }}\n onKeyDown={(event) => {\n if (event.key === Keyboard.ENTER) {\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n />\n <Button\n type={'button'}\n variant={'ghost'}\n className={\n 'text-foreground absolute top-0 right-0 cursor-pointer rounded-md bg-transparent!'\n }\n onClick={() => onSearchChange(search)}\n >\n <RiSearchLine />\n </Button>\n </div>\n );\n};\n"],"names":["FilterWrapper","memo","filters","params","onFilter","onChange","onCancel","triggerProps","contentProps","title","resetText","applyText","btnProps","t","useTranslation","isFiltered","setIsFiltered","useState","open","setOpen","form","useFilter","watch","handleSubmit","control","reset","useEffect","hasFilter","filter","value","get","values","handleFilter","useCallback","data","handleReset","jsxs","Popover","jsx","PopoverTrigger","Button","ListFilterPlusIcon","ListFilterIcon","ChevronDown","PopoverContent","Form","MySelect","MyInput","Search","placeholder","onSearchChange","className","inputProps","props","search","setSearch","cn","Input","evt","Keyboard","event","RiSearchLine"],"mappings":";;;;;;;;;;;;;AAqEO,MAAMA,KAAgBC,EAAK,SAAuB;AAAA,EACvD,SAAAC;AAAA,EACA,QAAAC;AA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AU;AACpB,UAAIA,EAAM,QAAQD,EAAS,UACzBC,EAAM,gBAAA,GACNA,EAAM,eAAA;AAAA,QAEV;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAtB;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WACE;AAAA,QAEF,SAAS,MAAMU,EAAeI,CAAM;AAAA,QAEpC,4BAACO,GAAA,CAAA,CAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EAChB,GACF;AAEJ;"}
1
+ {"version":3,"file":"Search-DunDXQgP.es.js","sources":["../../src/components/filters/FilterWrapper.tsx","../../src/components/filters/Search.tsx"],"sourcesContent":["import { Button, type ButtonProps } from 'dgz-ui/button';\nimport { Form, type Option } from 'dgz-ui/form';\nimport {\n Popover,\n type PopoverContainerProps,\n PopoverContent,\n PopoverTrigger,\n} from 'dgz-ui/popover';\nimport get from 'lodash.get';\nimport { ChevronDown, ListFilterIcon, ListFilterPlusIcon } from 'lucide-react';\nimport { memo, type ReactNode, useCallback, useEffect, useState } from 'react';\nimport type { FieldValues } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { useFilter } from '../../hooks';\nimport { MyInput, MySelect } from '../form';\n\n/**\n * Interface representing a filter configuration.\n */\nexport interface FilterInterface {\n /** Label for the filter field. */\n label?: ReactNode;\n /** Placeholder text for the input/select. */\n placeholder?: string;\n /** Default value for the filter. */\n value?: string | string[];\n /** Name of the filter field (used as key). */\n name: string;\n /** Whether the filter supports multiple values (for select inputs). */\n isMulti?: boolean;\n /** Whether the filter supports searchable inputs (for select inputs). */\n isSearchable?: boolean;\n /** Options for select inputs. */\n options?: Option[];\n access?: string[];\n}\n\n/**\n * Props for the FilterWrapper component.\n */\nexport interface FilterWrapperProps\n extends Omit<ButtonProps, 'title'>, PopoverContainerProps {\n /** Array of filter definitions to render. */\n filters: FilterInterface[];\n /** Current active parameters/filters. */\n params?: Record<string, unknown>;\n /** Callback fired when filters are applied. */\n onFilter?: (filters: Record<string, unknown>) => void;\n /** Callback fired when the filter popover is closed/cancelled. */\n onCancel?: () => void;\n /** Callback fired when filter form values change. */\n onChange?: (filters: FieldValues) => void;\n /** Title for the filter button. */\n title?: ReactNode;\n /** Text for the reset button. */\n resetText?: ReactNode;\n /** Text for the apply button. */\n applyText?: ReactNode;\n}\n\n/**\n * FilterWrapper shows a popover with a dynamic list of field filters and emits selected filter values.\n *\n * @param props.filters - Array of filter definitions to render.\n * @param props.params - Current params used to detect active filters.\n * @param props.onFilter - Callback fired when user applies filters.\n * @param props.onCancel - Callback fired on cancel.\n * @param props.onChange - Callback fired whenever filter form values change.\n * @returns {JSX.Element} A filter button that opens a popover with filter controls\n */\nexport const FilterWrapper = memo(function FilterWrapper({\n filters,\n params,\n onFilter,\n onChange,\n onCancel,\n triggerProps,\n contentProps,\n title,\n resetText,\n applyText,\n ...btnProps\n}: FilterWrapperProps) {\n const { t } = useTranslation();\n const [isFiltered, setIsFiltered] = useState(false);\n const [open, setOpen] = useState(false);\n const { form } = useFilter({ params });\n\n const { watch, handleSubmit, control, reset } = form;\n\n useEffect(() => {\n let hasFilter = false;\n filters.map((filter) => {\n const value = get(params, `${filter.name}`);\n if (Array.isArray(value) ? value.length > 0 : Boolean(value)) {\n hasFilter = true;\n }\n\n setIsFiltered(hasFilter);\n });\n }, [filters, params]);\n\n const values = watch();\n\n useEffect(() => {\n onChange?.(values);\n }, [values, onChange]);\n\n const handleFilter = useCallback(\n (data = {}) => {\n onFilter?.(data);\n setOpen(false);\n },\n [onFilter]\n );\n\n const handleReset = useCallback(() => {\n reset();\n if (onFilter) {\n onFilter({\n ...Object.fromEntries(\n filters.map((filter) => [filter.name, undefined])\n ),\n });\n }\n setOpen(false);\n }, [onFilter, reset, filters]);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger {...triggerProps} className={'grow'}>\n <Button\n asChild\n size={'sm'}\n variant=\"secondary\"\n className={'ml-auto w-full px-3'}\n {...btnProps}\n >\n <div className={'flex items-center'}>\n {isFiltered ? (\n <ListFilterPlusIcon className={'size-5'} />\n ) : (\n <ListFilterIcon className={'size-5'} />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Filter')}</span>\n <ChevronDown />\n </div>\n </Button>\n </PopoverTrigger>\n <PopoverContent side={'bottom'} align={'end'} {...contentProps}>\n <Form {...form}>\n <form onSubmit={handleSubmit(handleFilter)} className={'space-y-4'}>\n <div className={'h-full shrink space-y-6 p-1'}>\n {filters.map((filter) =>\n filter.options ? (\n <MySelect\n key={filter.name}\n control={control}\n name={filter.name}\n isSearchable={Boolean(filter.isSearchable)}\n placeholder={filter.placeholder}\n isMulti={filter.isMulti}\n options={filter.options}\n label={filter.label}\n />\n ) : (\n <MyInput\n key={filter.name}\n control={control}\n placeholder={filter.placeholder}\n name={filter.name}\n label={filter.label}\n />\n )\n )}\n </div>\n <div className={'flex shrink-0 justify-end gap-2'}>\n <Button\n variant={'destructive'}\n type=\"reset\"\n size={'sm'}\n onClick={handleReset}\n >\n {resetText || t('Reset')}\n </Button>\n <Button type=\"submit\" size={'sm'}>\n {applyText || t('Apply')}\n </Button>\n </div>\n </form>\n </Form>\n </PopoverContent>\n </Popover>\n );\n});\n","import { RiSearchLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport type { CardProps } from 'dgz-ui/card';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport get from 'lodash.get';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Keyboard } from '../../enums';\n\n/**\n * Props for the Search component.\n */\nexport type SearchProps = Omit<CardProps, 'title'> & {\n /** Custom placeholder text for the input. */\n placeholder?: string;\n /** Callback fired when the search is triggered. */\n onSearchChange: (search?: string) => void;\n inputProps?: InputProps;\n};\n\n/**\n * Search input with a submit button that triggers a search action.\n *\n * This component renders a search input field and a search button. The search\n * is triggered when the user presses Enter or clicks the button. The search\n * value is then passed to the `onSearchChange` callback.\n *\n * @param {SearchProps} props - The props for the component.\n * @param {string} [props.placeholder] - Optional placeholder text for the input field.\n * @param {Function} props.onSearchChange - Callback function that is called when a search is performed.\n * @param {string} [props.className] - Optional class name for the component.\n * @param {InputProps} [props.inputProps] - Optional props to pass to the underlying Input component.\n * @returns {JSX.Element} A search input field with submit button\n */\nexport const Search = ({\n placeholder,\n onSearchChange,\n className,\n inputProps,\n ...props\n}: SearchProps) => {\n const { t } = useTranslation();\n const [search, setSearch] = useState('');\n\n return (\n <div {...props} className={cn('relative w-full', className)}>\n <Input\n {...inputProps}\n placeholder={placeholder || t('Type text and press Enter')}\n onInput={(evt) => setSearch(get(evt, 'target.value', ''))}\n onKeyUp={(evt) => {\n if (evt.key === Keyboard.ENTER) {\n onSearchChange(search || undefined);\n evt.stopPropagation();\n evt.preventDefault();\n }\n }}\n onKeyDown={(event) => {\n if (event.key === Keyboard.ENTER) {\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n />\n <Button\n type={'button'}\n variant={'ghost'}\n className={\n 'text-foreground absolute top-0 right-0 cursor-pointer rounded-md bg-transparent!'\n }\n onClick={() => onSearchChange(search)}\n >\n <RiSearchLine />\n </Button>\n </div>\n );\n};\n"],"names":["FilterWrapper","memo","filters","params","onFilter","onChange","onCancel","triggerProps","contentProps","title","resetText","applyText","btnProps","t","useTranslation","isFiltered","setIsFiltered","useState","open","setOpen","form","useFilter","watch","handleSubmit","control","reset","useEffect","hasFilter","filter","value","get","values","handleFilter","useCallback","data","handleReset","jsxs","Popover","jsx","PopoverTrigger","Button","ListFilterPlusIcon","ListFilterIcon","ChevronDown","PopoverContent","Form","MySelect","MyInput","Search","placeholder","onSearchChange","className","inputProps","props","search","setSearch","cn","Input","evt","Keyboard","event","RiSearchLine"],"mappings":";;;;;;;;;;;;;AAsEO,MAAMA,KAAgBC,EAAK,SAAuB;AAAA,EACvD,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UA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M,gBAAA,GACNA,EAAM,eAAA;AAAA,QAEV;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAtB;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS;AAAA,QACT,WACE;AAAA,QAEF,SAAS,MAAMU,EAAeI,CAAM;AAAA,QAEpC,4BAACO,GAAA,CAAA,CAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EAChB,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Search-kbkeTeSI.cjs.js","sources":["../../src/components/filters/FilterWrapper.tsx","../../src/components/filters/Search.tsx"],"sourcesContent":["import { Button, type ButtonProps } from 'dgz-ui/button';\nimport { Form, type Option } from 'dgz-ui/form';\nimport {\n Popover,\n type PopoverContainerProps,\n PopoverContent,\n PopoverTrigger,\n} from 'dgz-ui/popover';\nimport get from 'lodash.get';\nimport { ChevronDown, ListFilterIcon, ListFilterPlusIcon } from 'lucide-react';\nimport { memo, type ReactNode, useCallback, useEffect, useState } from 'react';\nimport type { FieldValues } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { useFilter } from '../../hooks';\nimport { MyInput, MySelect } from '../form';\n\n/**\n * Interface representing a filter configuration.\n */\nexport interface FilterInterface {\n /** Label for the filter field. */\n label?: ReactNode;\n /** Placeholder text for the input/select. */\n placeholder?: string;\n /** Default value for the filter. */\n value?: string | string[];\n /** Name of the filter field (used as key). */\n name: string;\n /** Whether the filter supports multiple values (for select inputs). */\n isMulti?: boolean;\n /** Whether the filter supports searchable inputs (for select inputs). */\n isSearchable?: boolean;\n /** Options for select inputs. */\n options?: Option[];\n}\n\n/**\n * Props for the FilterWrapper component.\n */\nexport interface FilterWrapperProps\n extends Omit<ButtonProps, 'title'>, PopoverContainerProps {\n /** Array of filter definitions to render. */\n filters: FilterInterface[];\n /** Current active parameters/filters. */\n params?: Record<string, unknown>;\n /** Callback fired when filters are applied. */\n onFilter?: (filters: Record<string, unknown>) => void;\n /** Callback fired when the filter popover is closed/cancelled. */\n onCancel?: () => void;\n /** Callback fired when filter form values change. */\n onChange?: (filters: FieldValues) => void;\n /** Title for the filter button. */\n title?: ReactNode;\n /** Text for the reset button. */\n resetText?: ReactNode;\n /** Text for the apply button. */\n applyText?: ReactNode;\n}\n\n/**\n * FilterWrapper shows a popover with a dynamic list of field filters and emits selected filter values.\n *\n * @param props.filters - Array of filter definitions to render.\n * @param props.params - Current params used to detect active filters.\n * @param props.onFilter - Callback fired when user applies filters.\n * @param props.onCancel - Callback fired on cancel.\n * @param props.onChange - Callback fired whenever filter form values change.\n * @returns {JSX.Element} A filter button that opens a popover with filter controls\n */\nexport const FilterWrapper = memo(function FilterWrapper({\n filters,\n params,\n onFilter,\n onChange,\n onCancel,\n triggerProps,\n contentProps,\n title,\n resetText,\n applyText,\n ...btnProps\n}: FilterWrapperProps) {\n const { t } = useTranslation();\n const [isFiltered, setIsFiltered] = useState(false);\n const [open, setOpen] = useState(false);\n const { form } = useFilter({ params });\n\n const { watch, handleSubmit, control, reset } = form;\n\n useEffect(() => {\n let hasFilter = false;\n filters.map((filter) => {\n const value = get(params, `${filter.name}`);\n if (Array.isArray(value) ? value.length > 0 : Boolean(value)) {\n hasFilter = true;\n }\n\n setIsFiltered(hasFilter);\n });\n }, [filters, params]);\n\n const values = watch();\n\n useEffect(() => {\n onChange?.(values);\n }, [values, onChange]);\n\n const handleFilter = useCallback(\n (data = {}) => {\n onFilter?.(data);\n setOpen(false);\n },\n [onFilter]\n );\n\n const handleReset = useCallback(() => {\n reset();\n if (onFilter) {\n onFilter({\n ...Object.fromEntries(\n filters.map((filter) => [filter.name, undefined])\n ),\n });\n }\n setOpen(false);\n }, [onFilter, reset, filters]);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger {...triggerProps} className={'grow'}>\n <Button\n asChild\n size={'sm'}\n variant=\"secondary\"\n className={'ml-auto w-full px-3'}\n {...btnProps}\n >\n <div className={'flex items-center'}>\n {isFiltered ? (\n <ListFilterPlusIcon className={'size-5'} />\n ) : (\n <ListFilterIcon className={'size-5'} />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Filter')}</span>\n <ChevronDown />\n </div>\n </Button>\n </PopoverTrigger>\n <PopoverContent side={'bottom'} align={'end'} {...contentProps}>\n <Form {...form}>\n <form onSubmit={handleSubmit(handleFilter)} className={'space-y-4'}>\n <div className={'h-full shrink space-y-6 p-1'}>\n {filters.map((filter) =>\n filter.options ? (\n <MySelect\n key={filter.name}\n control={control}\n name={filter.name}\n isSearchable={Boolean(filter.isSearchable)}\n placeholder={filter.placeholder}\n isMulti={filter.isMulti}\n options={filter.options}\n label={filter.label}\n />\n ) : (\n <MyInput\n key={filter.name}\n control={control}\n placeholder={filter.placeholder}\n name={filter.name}\n label={filter.label}\n />\n )\n )}\n </div>\n <div className={'flex shrink-0 justify-end gap-2'}>\n <Button\n variant={'destructive'}\n type=\"reset\"\n size={'sm'}\n onClick={handleReset}\n >\n {resetText || t('Reset')}\n </Button>\n <Button type=\"submit\" size={'sm'}>\n {applyText || t('Apply')}\n </Button>\n </div>\n </form>\n </Form>\n </PopoverContent>\n </Popover>\n );\n});\n","import { RiSearchLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport type { CardProps } from 'dgz-ui/card';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport get from 'lodash.get';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Keyboard } from '../../enums';\n\n/**\n * Props for the Search component.\n */\nexport type SearchProps = Omit<CardProps, 'title'> & {\n /** Custom placeholder text for the input. */\n placeholder?: string;\n /** Callback fired when the search is triggered. */\n onSearchChange: (search?: string) => void;\n inputProps?: InputProps;\n};\n\n/**\n * Search input with a submit button that triggers a search action.\n *\n * This component renders a search input field and a search button. The search\n * is triggered when the user presses Enter or clicks the button. The search\n * value is then passed to the `onSearchChange` callback.\n *\n * @param {SearchProps} props - The props for the component.\n * @param {string} [props.placeholder] - Optional placeholder text for the input field.\n * @param {Function} props.onSearchChange - Callback function that is called when a search is performed.\n * @param {string} [props.className] - Optional class name for the component.\n * @param {InputProps} [props.inputProps] - Optional props to pass to the underlying Input component.\n * @returns {JSX.Element} A search input field with submit button\n */\nexport const Search = ({\n placeholder,\n onSearchChange,\n className,\n inputProps,\n ...props\n}: SearchProps) => {\n const { t } = useTranslation();\n const [search, setSearch] = useState('');\n\n return (\n <div {...props} className={cn('relative w-full', className)}>\n <Input\n {...inputProps}\n placeholder={placeholder || t('Type text and press Enter')}\n onInput={(evt) => setSearch(get(evt, 'target.value', ''))}\n onKeyUp={(evt) => {\n if (evt.key === Keyboard.ENTER) {\n onSearchChange(search || undefined);\n evt.stopPropagation();\n evt.preventDefault();\n }\n }}\n onKeyDown={(event) => {\n if (event.key === Keyboard.ENTER) {\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n />\n <Button\n type={'button'}\n variant={'ghost'}\n className={\n 'text-foreground absolute top-0 right-0 cursor-pointer rounded-md bg-transparent!'\n }\n onClick={() => onSearchChange(search)}\n >\n <RiSearchLine />\n </Button>\n </div>\n );\n};\n"],"names":["FilterWrapper","memo","filters","params","onFilter","onChange","onCancel","triggerProps","contentProps","title","resetText","applyText","btnProps","t","useTranslation","isFiltered","setIsFiltered","useState","open","setOpen","form","useFilter","watch","handleSubmit","control","reset","useEffect","hasFilter","filter","value","get","values","handleFilter","useCallback","data","handleReset","jsxs","Popover","jsx","PopoverTrigger","Button","ListFilterPlusIcon","ListFilterIcon","ChevronDown","PopoverContent","Form","MySelect","MyInput","Search","placeholder","onSearchChange","className","inputProps","props","search","setSearch","cn","Input","evt","Keyboard","event","RiSearchLine"],"mappings":"yaAqEaA,EAAgBC,EAAAA,KAAK,SAAuB,CACvD,QAAAC,EACA,OAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,aAAAC,EACA,aAAAC,EACA,MAAAC,EACA,UAAAC,EACA,UAAAC,EACA,GAAGC,CACL,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,CAAA,CAAA,CACF,CAAA,CAAA,CACF,EACF,CAAA,CACF,CAAA,EACF,CAEJ,CAAC,EC9JYmC,EAAS,CAAC,CACrB,YAAAC,EACA,eAAAC,EACA,UAAAC,EACA,WAAAC,EACA,GAAGC,CACL,IAAmB,CACjB,KAAM,CAAA,EAAExC,CAAA,EAAMC,iBAAA,EACR,CAACwC,EAAQC,CAAS,EAAItC,EAAAA,SAAS,EAAE,EAEvC,OACEmB,EAAAA,KAAC,OAAK,GAAGiB,EAAO,UAAWG,EAAAA,GAAG,kBAAmBL,CAAS,EACxD,SAAA,CAAAb,EAAAA,IAACmB,EAAAA,MAAA,CACE,GAAGL,EACJ,YAAaH,GAAepC,EAAE,2BAA2B,EACzD,QAAU6C,GAAQH,EAAUzB,EAAAA,IAAI4B,EAAK,eAAgB,EAAE,CAAC,EACxD,QAAUA,GAAQ,CACZA,EAAI,MAAQC,EAAAA,SAAS,QACvBT,EAAeI,GAAU,MAAS,EAClCI,EAAI,gBAAA,EACJA,EAAI,eAAA,EAER,EACA,UAAYE,GAAU,CAChBA,EAAM,MAAQD,EAAAA,SAAS,QACzBC,EAAM,gBAAA,EACNA,EAAM,eAAA,EAEV,CAAA,CAAA,EAEFtB,EAAAA,IAACE,EAAAA,OAAA,CACC,KAAM,SACN,QAAS,QACT,UACE,mFAEF,QAAS,IAAMU,EAAeI,CAAM,EAEpC,eAACO,EAAAA,GAAA,CAAA,CAAa,CAAA,CAAA,CAChB,EACF,CAEJ"}
1
+ {"version":3,"file":"Search-kbkeTeSI.cjs.js","sources":["../../src/components/filters/FilterWrapper.tsx","../../src/components/filters/Search.tsx"],"sourcesContent":["import { Button, type ButtonProps } from 'dgz-ui/button';\nimport { Form, type Option } from 'dgz-ui/form';\nimport {\n Popover,\n type PopoverContainerProps,\n PopoverContent,\n PopoverTrigger,\n} from 'dgz-ui/popover';\nimport get from 'lodash.get';\nimport { ChevronDown, ListFilterIcon, ListFilterPlusIcon } from 'lucide-react';\nimport { memo, type ReactNode, useCallback, useEffect, useState } from 'react';\nimport type { FieldValues } from 'react-hook-form';\nimport { useTranslation } from 'react-i18next';\nimport { useFilter } from '../../hooks';\nimport { MyInput, MySelect } from '../form';\n\n/**\n * Interface representing a filter configuration.\n */\nexport interface FilterInterface {\n /** Label for the filter field. */\n label?: ReactNode;\n /** Placeholder text for the input/select. */\n placeholder?: string;\n /** Default value for the filter. */\n value?: string | string[];\n /** Name of the filter field (used as key). */\n name: string;\n /** Whether the filter supports multiple values (for select inputs). */\n isMulti?: boolean;\n /** Whether the filter supports searchable inputs (for select inputs). */\n isSearchable?: boolean;\n /** Options for select inputs. */\n options?: Option[];\n access?: string[];\n}\n\n/**\n * Props for the FilterWrapper component.\n */\nexport interface FilterWrapperProps\n extends Omit<ButtonProps, 'title'>, PopoverContainerProps {\n /** Array of filter definitions to render. */\n filters: FilterInterface[];\n /** Current active parameters/filters. */\n params?: Record<string, unknown>;\n /** Callback fired when filters are applied. */\n onFilter?: (filters: Record<string, unknown>) => void;\n /** Callback fired when the filter popover is closed/cancelled. */\n onCancel?: () => void;\n /** Callback fired when filter form values change. */\n onChange?: (filters: FieldValues) => void;\n /** Title for the filter button. */\n title?: ReactNode;\n /** Text for the reset button. */\n resetText?: ReactNode;\n /** Text for the apply button. */\n applyText?: ReactNode;\n}\n\n/**\n * FilterWrapper shows a popover with a dynamic list of field filters and emits selected filter values.\n *\n * @param props.filters - Array of filter definitions to render.\n * @param props.params - Current params used to detect active filters.\n * @param props.onFilter - Callback fired when user applies filters.\n * @param props.onCancel - Callback fired on cancel.\n * @param props.onChange - Callback fired whenever filter form values change.\n * @returns {JSX.Element} A filter button that opens a popover with filter controls\n */\nexport const FilterWrapper = memo(function FilterWrapper({\n filters,\n params,\n onFilter,\n onChange,\n onCancel,\n triggerProps,\n contentProps,\n title,\n resetText,\n applyText,\n ...btnProps\n}: FilterWrapperProps) {\n const { t } = useTranslation();\n const [isFiltered, setIsFiltered] = useState(false);\n const [open, setOpen] = useState(false);\n const { form } = useFilter({ params });\n\n const { watch, handleSubmit, control, reset } = form;\n\n useEffect(() => {\n let hasFilter = false;\n filters.map((filter) => {\n const value = get(params, `${filter.name}`);\n if (Array.isArray(value) ? value.length > 0 : Boolean(value)) {\n hasFilter = true;\n }\n\n setIsFiltered(hasFilter);\n });\n }, [filters, params]);\n\n const values = watch();\n\n useEffect(() => {\n onChange?.(values);\n }, [values, onChange]);\n\n const handleFilter = useCallback(\n (data = {}) => {\n onFilter?.(data);\n setOpen(false);\n },\n [onFilter]\n );\n\n const handleReset = useCallback(() => {\n reset();\n if (onFilter) {\n onFilter({\n ...Object.fromEntries(\n filters.map((filter) => [filter.name, undefined])\n ),\n });\n }\n setOpen(false);\n }, [onFilter, reset, filters]);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger {...triggerProps} className={'grow'}>\n <Button\n asChild\n size={'sm'}\n variant=\"secondary\"\n className={'ml-auto w-full px-3'}\n {...btnProps}\n >\n <div className={'flex items-center'}>\n {isFiltered ? (\n <ListFilterPlusIcon className={'size-5'} />\n ) : (\n <ListFilterIcon className={'size-5'} />\n )}{' '}\n <span className={'hidden md:inline!'}>{title || t('Filter')}</span>\n <ChevronDown />\n </div>\n </Button>\n </PopoverTrigger>\n <PopoverContent side={'bottom'} align={'end'} {...contentProps}>\n <Form {...form}>\n <form onSubmit={handleSubmit(handleFilter)} className={'space-y-4'}>\n <div className={'h-full shrink space-y-6 p-1'}>\n {filters.map((filter) =>\n filter.options ? (\n <MySelect\n key={filter.name}\n control={control}\n name={filter.name}\n isSearchable={Boolean(filter.isSearchable)}\n placeholder={filter.placeholder}\n isMulti={filter.isMulti}\n options={filter.options}\n label={filter.label}\n />\n ) : (\n <MyInput\n key={filter.name}\n control={control}\n placeholder={filter.placeholder}\n name={filter.name}\n label={filter.label}\n />\n )\n )}\n </div>\n <div className={'flex shrink-0 justify-end gap-2'}>\n <Button\n variant={'destructive'}\n type=\"reset\"\n size={'sm'}\n onClick={handleReset}\n >\n {resetText || t('Reset')}\n </Button>\n <Button type=\"submit\" size={'sm'}>\n {applyText || t('Apply')}\n </Button>\n </div>\n </form>\n </Form>\n </PopoverContent>\n </Popover>\n );\n});\n","import { RiSearchLine } from '@remixicon/react';\nimport { Button } from 'dgz-ui/button';\nimport type { CardProps } from 'dgz-ui/card';\nimport { Input, type InputProps } from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport get from 'lodash.get';\nimport { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Keyboard } from '../../enums';\n\n/**\n * Props for the Search component.\n */\nexport type SearchProps = Omit<CardProps, 'title'> & {\n /** Custom placeholder text for the input. */\n placeholder?: string;\n /** Callback fired when the search is triggered. */\n onSearchChange: (search?: string) => void;\n inputProps?: InputProps;\n};\n\n/**\n * Search input with a submit button that triggers a search action.\n *\n * This component renders a search input field and a search button. The search\n * is triggered when the user presses Enter or clicks the button. The search\n * value is then passed to the `onSearchChange` callback.\n *\n * @param {SearchProps} props - The props for the component.\n * @param {string} [props.placeholder] - Optional placeholder text for the input field.\n * @param {Function} props.onSearchChange - Callback function that is called when a search is performed.\n * @param {string} [props.className] - Optional class name for the component.\n * @param {InputProps} [props.inputProps] - Optional props to pass to the underlying Input component.\n * @returns {JSX.Element} A search input field with submit button\n */\nexport const Search = ({\n placeholder,\n onSearchChange,\n className,\n inputProps,\n ...props\n}: SearchProps) => {\n const { t } = useTranslation();\n const [search, setSearch] = useState('');\n\n return (\n <div {...props} className={cn('relative w-full', className)}>\n <Input\n {...inputProps}\n placeholder={placeholder || t('Type text and press Enter')}\n onInput={(evt) => setSearch(get(evt, 'target.value', ''))}\n onKeyUp={(evt) => {\n if (evt.key === Keyboard.ENTER) {\n onSearchChange(search || undefined);\n evt.stopPropagation();\n evt.preventDefault();\n }\n }}\n onKeyDown={(event) => {\n if (event.key === Keyboard.ENTER) {\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n />\n <Button\n type={'button'}\n variant={'ghost'}\n className={\n 'text-foreground absolute top-0 right-0 cursor-pointer rounded-md bg-transparent!'\n }\n onClick={() => onSearchChange(search)}\n >\n <RiSearchLine />\n </Button>\n </div>\n );\n};\n"],"names":["FilterWrapper","memo","filters","params","onFilter","onChange","onCancel","triggerProps","contentProps","title","resetText","applyText","btnProps","t","useTranslation","isFiltered","setIsFiltered","useState","open","setOpen","form","useFilter","watch","handleSubmit","control","reset","useEffect","hasFilter","filter","value","get","values","handleFilter","useCallback","data","handleReset","jsxs","Popover","jsx","PopoverTrigger","Button","ListFilterPlusIcon","ListFilterIcon","ChevronDown","PopoverContent","Form","MySelect","MyInput","Search","placeholder","onSearchChange","className","inputProps","props","search","setSearch","cn","Input","evt","Keyboard","event","RiSearchLine"],"mappings":"yaAsEaA,EAAgBC,EAAAA,KAAK,SAAuB,CACvD,QAAAC,EACA,OAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,aAAAC,EACA,aAAAC,EACA,MAAAC,EACA,UAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAuB,CACrB,KAAM,CAAA,EAAEC,CAAA,EAAMC,iBAAA,EACR,CAACC,EAAYC,CAAa,EAAIC,EAAAA,SAAS,EAAK,EAC5C,CAACC,EAAMC,CAAO,EAAIF,EAAAA,SAAS,EAAK,EAChC,CAAA,KAAEG,CAAA,EAASC,YAAU,CAAE,OAAAlB,EAAQ,EAE/B,CAAE,MAAAmB,EAAO,aAAAC,EAAc,QAAAC,EAAS,MAAAC,GAAUL,EAEhDM,EAAAA,UAAU,IAAM,CACd,IAAIC,EAAY,GAChBzB,EAAQ,IAAK0B,GAAW,CACtB,MAAMC,EAAQC,EAAAA,IAAI3B,EAAQ,GAAGyB,EAAO,IAAI,EAAE,GACtC,MAAM,QAAQC,CAAK,EAAIA,EAAM,OAAS,EAAYA,KACpDF,EAAY,IAGdX,EAAcW,CAAS,CACzB,CAAC,CACH,EAAG,CAACzB,EAASC,CAAM,CAAC,EAEpB,MAAM4B,EAAST,EAAA,EAEfI,EAAAA,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AI,gBAAA,EACJA,EAAI,eAAA,EAER,EACA,UAAYE,GAAU,CAChBA,EAAM,MAAQD,EAAAA,SAAS,QACzBC,EAAM,gBAAA,EACNA,EAAM,eAAA,EAEV,CAAA,CAAA,EAEFtB,EAAAA,IAACE,EAAAA,OAAA,CACC,KAAM,SACN,QAAS,QACT,UACE,mFAEF,QAAS,IAAMU,EAAeI,CAAM,EAEpC,eAACO,EAAAA,GAAA,CAAA,CAAa,CAAA,CAAA,CAChB,EACF,CAEJ"}
@@ -0,0 +1,256 @@
1
+ import { g as T } from "./MyInput-ByJ5vTAN.es.js";
2
+ import { c as A, g as Et } from "./_commonjsHelpers-DaMA6jEr.es.js";
3
+ import { useEffect as J, useMemo as wt, useCallback as y, useState as X } from "react";
4
+ import { u as Tt } from "./useColumnsStore-ByK5r4ZY.es.js";
5
+ import { S as D } from "./SortOrder-CwuehjY1.es.js";
6
+ var C = { exports: {} };
7
+ C.exports;
8
+ var H;
9
+ function At() {
10
+ return H || (H = 1, (function(o, i) {
11
+ var e = 9007199254740991, u = "[object Arguments]", g = "[object Function]", p = "[object GeneratorFunction]", c = "[object Map]", s = "[object Object]", n = "[object Promise]", a = "[object Set]", f = "[object WeakMap]", l = "[object DataView]", h = /[\\^$.*+?()[\]{}|]/g, O = /^\[object .+?Constructor\]$/, v = typeof A == "object" && A && A.Object === Object && A, Q = typeof self == "object" && self && self.Object === Object && self, d = v || Q || Function("return this")(), R = i && !i.nodeType && i, B = R && !0 && o && !o.nodeType && o, U = B && B.exports === R;
12
+ function Y(t, r) {
13
+ return t == null ? void 0 : t[r];
14
+ }
15
+ function Z(t) {
16
+ var r = !1;
17
+ if (t != null && typeof t.toString != "function")
18
+ try {
19
+ r = !!(t + "");
20
+ } catch {
21
+ }
22
+ return r;
23
+ }
24
+ function tt(t, r) {
25
+ return function(b) {
26
+ return t(r(b));
27
+ };
28
+ }
29
+ var rt = Function.prototype, E = Object.prototype, P = d["__core-js_shared__"], L = (function() {
30
+ var t = /[^.]+$/.exec(P && P.keys && P.keys.IE_PROTO || "");
31
+ return t ? "Symbol(src)_1." + t : "";
32
+ })(), V = rt.toString, x = E.hasOwnProperty, w = E.toString, et = RegExp(
33
+ "^" + V.call(x).replace(h, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
34
+ ), G = U ? d.Buffer : void 0, K = E.propertyIsEnumerable, nt = G ? G.isBuffer : void 0, ot = tt(Object.keys, Object), _ = S(d, "DataView"), M = S(d, "Map"), F = S(d, "Promise"), k = S(d, "Set"), I = S(d, "WeakMap"), st = !K.call({ valueOf: 1 }, "valueOf"), it = m(_), ct = m(M), at = m(F), ft = m(k), ut = m(I);
35
+ function lt(t) {
36
+ return w.call(t);
37
+ }
38
+ function bt(t) {
39
+ if (!W(t) || gt(t))
40
+ return !1;
41
+ var r = $(t) || Z(t) ? et : O;
42
+ return r.test(m(t));
43
+ }
44
+ function S(t, r) {
45
+ var b = Y(t, r);
46
+ return bt(b) ? b : void 0;
47
+ }
48
+ var j = lt;
49
+ (_ && j(new _(new ArrayBuffer(1))) != l || M && j(new M()) != c || F && j(F.resolve()) != n || k && j(new k()) != a || I && j(new I()) != f) && (j = function(t) {
50
+ var r = w.call(t), b = r == s ? t.constructor : void 0, q = b ? m(b) : void 0;
51
+ if (q)
52
+ switch (q) {
53
+ case it:
54
+ return l;
55
+ case ct:
56
+ return c;
57
+ case at:
58
+ return n;
59
+ case ft:
60
+ return a;
61
+ case ut:
62
+ return f;
63
+ }
64
+ return r;
65
+ });
66
+ function gt(t) {
67
+ return !!L && L in t;
68
+ }
69
+ function pt(t) {
70
+ var r = t && t.constructor, b = typeof r == "function" && r.prototype || E;
71
+ return t === b;
72
+ }
73
+ function m(t) {
74
+ if (t != null) {
75
+ try {
76
+ return V.call(t);
77
+ } catch {
78
+ }
79
+ try {
80
+ return t + "";
81
+ } catch {
82
+ }
83
+ }
84
+ return "";
85
+ }
86
+ function dt(t) {
87
+ return mt(t) && x.call(t, "callee") && (!K.call(t, "callee") || w.call(t) == u);
88
+ }
89
+ var jt = Array.isArray;
90
+ function N(t) {
91
+ return t != null && Ot(t.length) && !$(t);
92
+ }
93
+ function mt(t) {
94
+ return St(t) && N(t);
95
+ }
96
+ var yt = nt || Ct;
97
+ function ht(t) {
98
+ if (N(t) && (jt(t) || typeof t == "string" || typeof t.splice == "function" || yt(t) || dt(t)))
99
+ return !t.length;
100
+ var r = j(t);
101
+ if (r == c || r == a)
102
+ return !t.size;
103
+ if (st || pt(t))
104
+ return !ot(t).length;
105
+ for (var b in t)
106
+ if (x.call(t, b))
107
+ return !1;
108
+ return !0;
109
+ }
110
+ function $(t) {
111
+ var r = W(t) ? w.call(t) : "";
112
+ return r == g || r == p;
113
+ }
114
+ function Ot(t) {
115
+ return typeof t == "number" && t > -1 && t % 1 == 0 && t <= e;
116
+ }
117
+ function W(t) {
118
+ var r = typeof t;
119
+ return !!t && (r == "object" || r == "function");
120
+ }
121
+ function St(t) {
122
+ return !!t && typeof t == "object";
123
+ }
124
+ function Ct() {
125
+ return !1;
126
+ }
127
+ o.exports = ht;
128
+ })(C, C.exports)), C.exports;
129
+ }
130
+ var Pt = At();
131
+ const z = /* @__PURE__ */ Et(Pt), It = ({
132
+ key: o,
133
+ columns: i = []
134
+ }) => {
135
+ const { storedColumns: e, setColumns: u } = Tt();
136
+ J(() => {
137
+ if (z(T(e, o)) && !z(i)) {
138
+ const s = {};
139
+ i.forEach((n) => {
140
+ Object.assign(s, { [n.key]: !!n.hidden });
141
+ }), u({
142
+ ...e,
143
+ [o]: s
144
+ });
145
+ }
146
+ }, [o, i, e, u]);
147
+ const g = wt(() => {
148
+ const s = T(e, o, {});
149
+ return i.filter((n) => n.type !== "action").map((n) => {
150
+ const { hidden: a, ...f } = n;
151
+ return {
152
+ ...f,
153
+ hidden: T(s, n.key, !!a)
154
+ };
155
+ });
156
+ }, [o, e, i]), p = y(
157
+ (s, n) => {
158
+ const a = T(e, o, {});
159
+ Object.assign(a, { [s.key]: n }), u({
160
+ ...e,
161
+ [o]: a
162
+ });
163
+ },
164
+ [o, u, e]
165
+ ), c = y(() => {
166
+ const s = {};
167
+ i.forEach((n) => {
168
+ Object.assign(s, { [n.key]: !!n.hidden });
169
+ }), u({
170
+ ...e,
171
+ [o]: s
172
+ });
173
+ }, [o, u, e, i]);
174
+ return {
175
+ formattedColumns: g,
176
+ handleColumnsChange: p,
177
+ resetColumns: c
178
+ };
179
+ }, Dt = ({
180
+ rows: o = [],
181
+ defaultSelectedRows: i
182
+ }) => {
183
+ const [e, u] = X(i), g = y(
184
+ (n, a) => {
185
+ u((f) => {
186
+ const l = o.map((O) => O[n]) || [], h = (f == null ? void 0 : f.filter((O) => !l.includes(O))) || [];
187
+ return a ? [...h, ...l] : h;
188
+ });
189
+ },
190
+ [o]
191
+ ), p = y(
192
+ (n, a) => {
193
+ u((f) => {
194
+ const l = f || [];
195
+ return a ? [...l, n] : l.filter((h) => h !== n);
196
+ });
197
+ },
198
+ []
199
+ ), c = y(
200
+ (n) => !!(e != null && e.includes(n)),
201
+ [e]
202
+ ), s = y(
203
+ (n) => {
204
+ const a = o.map((l) => l[n]) || [];
205
+ let f = 0;
206
+ for (const l of a)
207
+ e != null && e.includes(l) && f++;
208
+ return a.length === f ? !0 : f ? "indeterminate" : !1;
209
+ },
210
+ [e, o]
211
+ );
212
+ return {
213
+ selectedRows: e,
214
+ isRowSelected: c,
215
+ isAllRowsSelected: s,
216
+ handleSelectAllRows: g,
217
+ handleSelectRow: p
218
+ };
219
+ }, Rt = ({
220
+ sortField: o,
221
+ sortOrder: i,
222
+ onSortOrderChange: e
223
+ }) => {
224
+ const [u, g] = X();
225
+ J(() => {
226
+ o && g(
227
+ (c) => (c == null ? void 0 : c.sortField) === i && (c == null ? void 0 : c.sortOrder) === i ? c : {
228
+ sortField: o,
229
+ sortOrder: i || void 0
230
+ }
231
+ );
232
+ }, [o, i]);
233
+ const p = y(
234
+ (c) => {
235
+ g((s) => {
236
+ const a = (s == null ? void 0 : s.sortField) === c ? (s == null ? void 0 : s.sortOrder) === D.ASC ? D.DESC : void 0 : D.ASC, f = {
237
+ sortField: a ? c : void 0,
238
+ sortOrder: a
239
+ };
240
+ return e && e(f), f;
241
+ });
242
+ },
243
+ [e]
244
+ );
245
+ return {
246
+ sortObject: u,
247
+ handleSort: p
248
+ };
249
+ };
250
+ export {
251
+ Dt as a,
252
+ It as b,
253
+ z as i,
254
+ Rt as u
255
+ };
256
+ //# sourceMappingURL=useSortable-B1BtakAy.es.js.map