dgz-ui-shared 1.2.25 → 1.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{Actions-25X7c3Kg.es.js → Actions-Du8iQ3WR.es.js} +5 -5
- package/dist/chunks/Actions-Du8iQ3WR.es.js.map +1 -0
- package/dist/chunks/Actions-bpMDyl5M.cjs.js +2 -0
- package/dist/chunks/Actions-bpMDyl5M.cjs.js.map +1 -0
- package/dist/chunks/ExportData-BjS0xAqH.cjs.js +2 -0
- package/dist/chunks/{ExportData-C1Lrr1gH.cjs.js.map → ExportData-BjS0xAqH.cjs.js.map} +1 -1
- package/dist/chunks/{ExportData-Cuy6BvoM.es.js → ExportData-DQzwB_yW.es.js} +12 -12
- package/dist/chunks/{ExportData-Cuy6BvoM.es.js.map → ExportData-DQzwB_yW.es.js.map} +1 -1
- package/dist/chunks/{MyInput-D7YcKmAW.cjs.js → MyInput-5ir4eN2m.cjs.js} +2 -2
- package/dist/chunks/{MyInput-D7YcKmAW.cjs.js.map → MyInput-5ir4eN2m.cjs.js.map} +1 -1
- package/dist/chunks/{MyInput-hXxWHsU8.es.js → MyInput-Cb0FlVxQ.es.js} +5 -5
- package/dist/chunks/{MyInput-hXxWHsU8.es.js.map → MyInput-Cb0FlVxQ.es.js.map} +1 -1
- package/dist/chunks/{MySelect-eb1yHL0a.es.js → MySelect-5DHBVlKZ.es.js} +5 -5
- package/dist/chunks/{MySelect-eb1yHL0a.es.js.map → MySelect-5DHBVlKZ.es.js.map} +1 -1
- package/dist/chunks/{MySelect-u4r_aMVc.cjs.js → MySelect-Dl3jKf5s.cjs.js} +2 -2
- package/dist/chunks/{MySelect-u4r_aMVc.cjs.js.map → MySelect-Dl3jKf5s.cjs.js.map} +1 -1
- package/dist/chunks/{PasswordConfirm-C3Xvi3EE.es.js → PasswordConfirm-Dj97U7O9.es.js} +2 -2
- package/dist/chunks/{PasswordConfirm-C3Xvi3EE.es.js.map → PasswordConfirm-Dj97U7O9.es.js.map} +1 -1
- package/dist/chunks/{PasswordConfirm-BmPW7K7v.cjs.js → PasswordConfirm-Uc4pncGw.cjs.js} +2 -2
- package/dist/chunks/{PasswordConfirm-BmPW7K7v.cjs.js.map → PasswordConfirm-Uc4pncGw.cjs.js.map} +1 -1
- package/dist/chunks/{Search-CMQLM3fQ.es.js → Search-CR54BX3a.es.js} +11 -11
- package/dist/chunks/Search-CR54BX3a.es.js.map +1 -0
- package/dist/chunks/Search-D0G4Mda4.cjs.js +2 -0
- package/dist/chunks/Search-D0G4Mda4.cjs.js.map +1 -0
- package/dist/components/actions/index.cjs.js +1 -1
- package/dist/components/actions/index.es.js +1 -1
- package/dist/components/confirm/index.cjs.js +1 -1
- package/dist/components/confirm/index.es.js +1 -1
- package/dist/components/datatable/index.cjs.js +1 -1
- package/dist/components/datatable/index.cjs.js.map +1 -1
- package/dist/components/datatable/index.es.js +284 -221
- package/dist/components/datatable/index.es.js.map +1 -1
- package/dist/components/export/index.cjs.js +1 -1
- package/dist/components/export/index.es.js +1 -1
- package/dist/components/filters/index.cjs.js +1 -1
- package/dist/components/filters/index.es.js +1 -1
- package/dist/components/form/index.cjs.js +1 -1
- package/dist/components/form/index.cjs.js.map +1 -1
- package/dist/components/form/index.es.js +52 -51
- package/dist/components/form/index.es.js.map +1 -1
- package/dist/hooks/index.cjs.js +1 -1
- package/dist/hooks/index.es.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/App.d.ts.map +1 -1
- package/dist/types/components/datatable/DataTable.d.ts +3 -1
- package/dist/types/components/datatable/DataTable.d.ts.map +1 -1
- package/dist/types/components/filters/AppliedFilters.d.ts +24 -0
- package/dist/types/components/filters/AppliedFilters.d.ts.map +1 -0
- package/dist/types/components/form/MyHtmlEditor.d.ts +1 -1
- package/dist/types/components/form/MyHtmlEditor.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/Actions-25X7c3Kg.es.js.map +0 -1
- package/dist/chunks/Actions-DQPuVKCk.cjs.js +0 -2
- package/dist/chunks/Actions-DQPuVKCk.cjs.js.map +0 -1
- package/dist/chunks/ExportData-C1Lrr1gH.cjs.js +0 -2
- package/dist/chunks/Search-CMQLM3fQ.es.js.map +0 -1
- package/dist/chunks/Search-Ce5VAKq7.cjs.js +0 -2
- package/dist/chunks/Search-Ce5VAKq7.cjs.js.map +0 -1
|
@@ -9,9 +9,9 @@ const A = ({
|
|
|
9
9
|
contentProps: s,
|
|
10
10
|
title: t
|
|
11
11
|
}) => {
|
|
12
|
-
const { t:
|
|
12
|
+
const { t: a } = g();
|
|
13
13
|
return /* @__PURE__ */ o(p, { children: [
|
|
14
|
-
/* @__PURE__ */ n(u, { asChild: !0, ...i, children: /* @__PURE__ */ o(
|
|
14
|
+
/* @__PURE__ */ n(u, { asChild: !0, className: "grow", ...i, children: /* @__PURE__ */ o(
|
|
15
15
|
c,
|
|
16
16
|
{
|
|
17
17
|
variant: "secondary",
|
|
@@ -20,15 +20,15 @@ const A = ({
|
|
|
20
20
|
children: [
|
|
21
21
|
/* @__PURE__ */ n(d, {}),
|
|
22
22
|
" ",
|
|
23
|
-
/* @__PURE__ */ n("span", { className: "hidden
|
|
23
|
+
/* @__PURE__ */ n("span", { className: "hidden md:inline!", children: t || a("Actions") }),
|
|
24
24
|
/* @__PURE__ */ n(m, {})
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
) }),
|
|
28
|
-
/* @__PURE__ */ n(h, { align: "end", ...s, children: e.map((r,
|
|
28
|
+
/* @__PURE__ */ n(h, { align: "end", ...s, children: e.map((r, l) => /* @__PURE__ */ n(f, { onClick: () => r.onClick(), children: r.label }, l)) })
|
|
29
29
|
] });
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
32
|
A
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=Actions-
|
|
34
|
+
//# sourceMappingURL=Actions-Du8iQ3WR.es.js.map
|
|
@@ -0,0 +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 props.actions - Array of actions with label and onClick handler.\n * @returns 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":";;;;;AAsCO,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;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),r=require("./index-ClQFzqcq.cjs.js"),u=require("dgz-ui/button"),e=require("dgz-ui/dropdown"),a=require("react-i18next"),x=({actions:o,triggerProps:t,contentProps:i,title:c})=>{const{t:d}=a.useTranslation();return n.jsxs(e.DropdownMenu,{children:[n.jsx(e.DropdownMenuTrigger,{asChild:!0,className:"grow",...t,children:n.jsxs(u.Button,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[n.jsx(r.Wg,{})," ",n.jsx("span",{className:"hidden md:inline!",children:c||d("Actions")}),n.jsx(r.f1,{})]})}),n.jsx(e.DropdownMenuContent,{align:"end",...i,children:o.map((s,l)=>n.jsx(e.DropdownMenuItem,{onClick:()=>s.onClick(),children:s.label},l))})]})};exports.Actions=x;
|
|
2
|
+
//# sourceMappingURL=Actions-bpMDyl5M.cjs.js.map
|
|
@@ -0,0 +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 props.actions - Array of actions with label and onClick handler.\n * @returns 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":"0KAsCaA,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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),s=require("./index-ClQFzqcq.cjs.js"),u=require("dgz-ui/button"),e=require("dgz-ui/dropdown"),x=require("react-i18next"),p=require("./Spin-DUK1prd9.cjs.js"),j=({options:t,loading:o=!1,triggerProps:i,contentProps:a,title:c})=>{const{t:d}=x.useTranslation();return n.jsxs(e.DropdownMenu,{children:[n.jsx(e.DropdownMenuTrigger,{asChild:!0,...i,className:"grow",children:n.jsxs(u.Button,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[o?n.jsx(p.Spin,{}):n.jsx(s.ZC,{})," ",n.jsx("span",{className:"hidden md:inline!",children:c||d("Export")}),n.jsx(s.f1,{})]})}),n.jsx(e.DropdownMenuContent,{align:"end",...a,children:t.map((r,l)=>n.jsx(e.DropdownMenuItem,{onClick:()=>r.onClick(),children:r.label},l))})]})};exports.ExportData=j;
|
|
2
|
+
//# sourceMappingURL=ExportData-BjS0xAqH.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportData-
|
|
1
|
+
{"version":3,"file":"ExportData-BjS0xAqH.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 */\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 ? <Spin /> : <RiFileChartLine />}{' '}\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":"8MAuDaA,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,EAAUO,EAAAA,IAACI,OAAA,CAAA,CAAK,EAAKJ,EAAAA,IAACK,EAAAA,GAAA,EAAgB,EAAI,UAC1C,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"}
|
|
@@ -3,34 +3,34 @@ import { Z as d, f as p } from "./index-E1NtSoNr.es.js";
|
|
|
3
3
|
import { Button as c } from "dgz-ui/button";
|
|
4
4
|
import { DropdownMenu as u, DropdownMenuTrigger as f, DropdownMenuContent as h, DropdownMenuItem as x } from "dgz-ui/dropdown";
|
|
5
5
|
import { useTranslation as g } from "react-i18next";
|
|
6
|
-
import { S as
|
|
7
|
-
const
|
|
6
|
+
import { S as w } from "./Spin-DtW_edOq.es.js";
|
|
7
|
+
const k = ({
|
|
8
8
|
options: e,
|
|
9
|
-
loading:
|
|
10
|
-
triggerProps:
|
|
11
|
-
contentProps:
|
|
12
|
-
title:
|
|
9
|
+
loading: a = !1,
|
|
10
|
+
triggerProps: i,
|
|
11
|
+
contentProps: s,
|
|
12
|
+
title: t
|
|
13
13
|
}) => {
|
|
14
14
|
const { t: l } = g();
|
|
15
15
|
return /* @__PURE__ */ o(u, { children: [
|
|
16
|
-
/* @__PURE__ */ r(f, { asChild: !0, ...
|
|
16
|
+
/* @__PURE__ */ r(f, { asChild: !0, ...i, className: "grow", children: /* @__PURE__ */ o(
|
|
17
17
|
c,
|
|
18
18
|
{
|
|
19
19
|
variant: "secondary",
|
|
20
20
|
size: "sm",
|
|
21
21
|
className: "ml-auto rounded-lg px-3",
|
|
22
22
|
children: [
|
|
23
|
-
|
|
23
|
+
a ? /* @__PURE__ */ r(w, {}) : /* @__PURE__ */ r(d, {}),
|
|
24
24
|
" ",
|
|
25
|
-
/* @__PURE__ */ r("span", { className: "hidden
|
|
25
|
+
/* @__PURE__ */ r("span", { className: "hidden md:inline!", children: t || l("Export") }),
|
|
26
26
|
/* @__PURE__ */ r(p, {})
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
29
|
) }),
|
|
30
|
-
/* @__PURE__ */ r(h, { align: "end", ...
|
|
30
|
+
/* @__PURE__ */ r(h, { align: "end", ...s, children: e.map((n, m) => /* @__PURE__ */ r(x, { onClick: () => n.onClick(), children: n.label }, m)) })
|
|
31
31
|
] });
|
|
32
32
|
};
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
k as E
|
|
35
35
|
};
|
|
36
|
-
//# sourceMappingURL=ExportData-
|
|
36
|
+
//# sourceMappingURL=ExportData-DQzwB_yW.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportData-
|
|
1
|
+
{"version":3,"file":"ExportData-DQzwB_yW.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 */\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 ? <Spin /> : <RiFileChartLine />}{' '}\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":";;;;;;AAuDO,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,IAAU,gBAAAO,EAACI,GAAA,CAAA,CAAK,IAAK,gBAAAJ,EAACK,GAAA,EAAgB;AAAA,UAAI;AAAA,4BAC1C,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,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),s=require("dgz-ui/form"),u=require("dgz-ui/utils"),j=require("./lodash-BjH0kD7j.cjs.js"),g=({control:o,name:r,label:a,required:c,className:i,rules:m,floatingError:d,...l})=>r&&o&&e.jsx(s.FormField,{control:o,name:r,rules:m,render:({field:n,formState:x})=>e.jsxs(s.FormItem,{children:[a&&e.jsxs(s.FormLabel,{className:"block",children:[a," ",c&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.
|
|
2
|
-
//# sourceMappingURL=MyInput-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),s=require("dgz-ui/form"),u=require("dgz-ui/utils"),j=require("./lodash-BjH0kD7j.cjs.js"),g=({control:o,name:r,label:a,required:c,className:i,rules:m,floatingError:d,...l})=>r&&o&&e.jsx(s.FormField,{control:o,name:r,rules:m,render:({field:n,formState:x})=>e.jsxs(s.FormItem,{children:[a&&e.jsxs(s.FormLabel,{className:"block",children:[a," ",c&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsxs("div",{children:[e.jsx(s.FormControl,{children:e.jsx(s.Input,{variant:j.lodashExports.get(x.errors,`${r}.message`)?"failure":"default",...l,...n,onChange:h=>{const t=h.target.value;l.type==="number"?n.onChange(t?Number(t):void 0):n.onChange(t)},className:u.cn(i)})}),e.jsx(s.FormMessage,{className:u.cn(d&&"absolute -bottom-5")})]})]})})||null;exports.MyInput=g;
|
|
2
|
+
//# sourceMappingURL=MyInput-5ir4eN2m.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MyInput-
|
|
1
|
+
{"version":3,"file":"MyInput-5ir4eN2m.cjs.js","sources":["../../src/components/form/MyInput.tsx"],"sourcesContent":["import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Input,\n type InputProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyInput component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyInputProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & InputProps;\n\n/**\n * MyInput is a form-aware input field that integrates with react-hook-form.\n * Works in both controlled (with control/name) and uncontrolled modes.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the input.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Input and form item props.\n */\nexport const MyInput = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n floatingError,\n ...props\n}: MyInputProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <div>\n <FormControl>\n <Input\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n {...props}\n {...field}\n onChange={(event) => {\n const value = event.target.value;\n if (props.type === 'number') {\n field.onChange(value ? Number(value) : undefined);\n } else {\n field.onChange(value);\n }\n }}\n className={cn(className)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </div>\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n"],"names":["MyInput","control","name","label","required","className","rules","floatingError","props","jsx","FormField","field","formState","FormItem","jsxs","FormLabel","FormControl","Input","get","event","value","cn","FormMessage"],"mappings":"2IAmCaA,EAAU,CAAmC,CACxD,QAAAC,EACA,KAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAEKN,GAAQD,GACPQ,EAAAA,IAACC,EAAAA,UAAA,CACC,QAAAT,EACA,KAAAC,EACA,MAAAI,EACA,OAAQ,CAAC,CAAE,MAAAK,EAAO,UAAAC,CAAA,WACfC,EAAAA,SAAA,CACE,SAAA,CAAAV,GACCW,EAAAA,KAACC,EAAAA,UAAA,CAAU,UAAW,QACnB,SAAA,CAAAZ,EAAM,IAAEC,GAAYK,EAAAA,IAAC,OAAA,CAAK,UAAW,eAAgB,SAAA,GAAA,CAAC,CAAA,EACzD,SAED,MAAA,CACC,SAAA,CAAAA,MAACO,EAAAA,YAAA,CACC,SAAAP,EAAAA,IAACQ,EAAAA,MAAA,CACC,QACEC,EAAAA,cAAAA,IAAIN,EAAU,OAAQ,GAAGV,CAAI,UAAU,EACnC,UACA,UAEL,GAAGM,EACH,GAAGG,EACJ,SAAWQ,GAAU,CACnB,MAAMC,EAAQD,EAAM,OAAO,MACvBX,EAAM,OAAS,SACjBG,EAAM,SAASS,EAAQ,OAAOA,CAAK,EAAI,MAAS,EAEhDT,EAAM,SAASS,CAAK,CAExB,EACA,UAAWC,EAAAA,GAAGhB,CAAS,CAAA,CAAA,EAE3B,EACAI,EAAAA,IAACa,EAAAA,YAAA,CACC,UAAWD,EAAAA,GAAGd,GAAiB,oBAAoB,CAAA,CAAA,CACrD,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAAA,GAIN"}
|
|
@@ -23,8 +23,8 @@ const y = ({
|
|
|
23
23
|
" ",
|
|
24
24
|
i && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
|
|
25
25
|
] }),
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */ e(
|
|
26
|
+
/* @__PURE__ */ a("div", { children: [
|
|
27
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
28
28
|
v,
|
|
29
29
|
{
|
|
30
30
|
variant: N.get(h.errors, `${r}.message`) ? "failure" : "default",
|
|
@@ -36,18 +36,18 @@ const y = ({
|
|
|
36
36
|
},
|
|
37
37
|
className: l(c)
|
|
38
38
|
}
|
|
39
|
-
),
|
|
39
|
+
) }),
|
|
40
40
|
/* @__PURE__ */ e(
|
|
41
41
|
x,
|
|
42
42
|
{
|
|
43
43
|
className: l(d && "absolute -bottom-5")
|
|
44
44
|
}
|
|
45
45
|
)
|
|
46
|
-
] })
|
|
46
|
+
] })
|
|
47
47
|
] })
|
|
48
48
|
}
|
|
49
49
|
) || null;
|
|
50
50
|
export {
|
|
51
51
|
y as M
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=MyInput-
|
|
53
|
+
//# sourceMappingURL=MyInput-Cb0FlVxQ.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MyInput-
|
|
1
|
+
{"version":3,"file":"MyInput-Cb0FlVxQ.es.js","sources":["../../src/components/form/MyInput.tsx"],"sourcesContent":["import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n Input,\n type InputProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MyInput component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MyInputProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> & InputProps;\n\n/**\n * MyInput is a form-aware input field that integrates with react-hook-form.\n * Works in both controlled (with control/name) and uncontrolled modes.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the input.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Input and form item props.\n */\nexport const MyInput = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n floatingError,\n ...props\n}: MyInputProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => (\n <FormItem>\n {label && (\n <FormLabel className={'block'}>\n {label} {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <div>\n <FormControl>\n <Input\n variant={\n get(formState.errors, `${name}.message`)\n ? 'failure'\n : 'default'\n }\n {...props}\n {...field}\n onChange={(event) => {\n const value = event.target.value;\n if (props.type === 'number') {\n field.onChange(value ? Number(value) : undefined);\n } else {\n field.onChange(value);\n }\n }}\n className={cn(className)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </div>\n </FormItem>\n )}\n />\n )) ||\n null\n );\n};\n"],"names":["MyInput","control","name","label","required","className","rules","floatingError","props","jsx","FormField","field","formState","FormItem","jsxs","FormLabel","FormControl","Input","get","event","value","cn","FormMessage"],"mappings":";;;;AAmCO,MAAMA,IAAU,CAAmC;AAAA,EACxD,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,GAAGC;AACL,MAEKN,KAAQD,KACP,gBAAAQ;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,SAAAT;AAAA,IACA,MAAAC;AAAA,IACA,OAAAI;AAAA,IACA,QAAQ,CAAC,EAAE,OAAAK,GAAO,WAAAC,EAAA,wBACfC,GAAA,EACE,UAAA;AAAA,MAAAV,KACC,gBAAAW,EAACC,GAAA,EAAU,WAAW,SACnB,UAAA;AAAA,QAAAZ;AAAA,QAAM;AAAA,QAAEC,KAAY,gBAAAK,EAAC,QAAA,EAAK,WAAW,gBAAgB,UAAA,IAAA,CAAC;AAAA,MAAA,GACzD;AAAA,wBAED,OAAA,EACC,UAAA;AAAA,QAAA,gBAAAA,EAACO,GAAA,EACC,UAAA,gBAAAP;AAAA,UAACQ;AAAA,UAAA;AAAA,YACC,SACEC,EAAAA,IAAIN,EAAU,QAAQ,GAAGV,CAAI,UAAU,IACnC,YACA;AAAA,YAEL,GAAGM;AAAA,YACH,GAAGG;AAAA,YACJ,UAAU,CAACQ,MAAU;AACnB,oBAAMC,IAAQD,EAAM,OAAO;AAC3B,cAAIX,EAAM,SAAS,WACjBG,EAAM,SAASS,IAAQ,OAAOA,CAAK,IAAI,MAAS,IAEhDT,EAAM,SAASS,CAAK;AAAA,YAExB;AAAA,YACA,WAAWC,EAAGhB,CAAS;AAAA,UAAA;AAAA,QAAA,GAE3B;AAAA,QACA,gBAAAI;AAAA,UAACa;AAAA,UAAA;AAAA,YACC,WAAWD,EAAGd,KAAiB,oBAAoB;AAAA,UAAA;AAAA,QAAA;AAAA,MACrD,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA;AAAA,KAIN;"}
|
|
@@ -29,8 +29,8 @@ const I = ({
|
|
|
29
29
|
" ",
|
|
30
30
|
n && /* @__PURE__ */ r("span", { className: "text-red-600", children: "*" })
|
|
31
31
|
] }),
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */ r(
|
|
32
|
+
/* @__PURE__ */ o("div", { children: [
|
|
33
|
+
/* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(
|
|
34
34
|
C,
|
|
35
35
|
{
|
|
36
36
|
className: c(i),
|
|
@@ -40,14 +40,14 @@ const I = ({
|
|
|
40
40
|
options: h,
|
|
41
41
|
error: !!j.get(x.errors, `${e}`)
|
|
42
42
|
}
|
|
43
|
-
),
|
|
43
|
+
) }),
|
|
44
44
|
/* @__PURE__ */ r(
|
|
45
45
|
M,
|
|
46
46
|
{
|
|
47
47
|
className: c(p && "absolute -bottom-5")
|
|
48
48
|
}
|
|
49
49
|
)
|
|
50
|
-
] })
|
|
50
|
+
] })
|
|
51
51
|
] });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -55,4 +55,4 @@ const I = ({
|
|
|
55
55
|
export {
|
|
56
56
|
I as M
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=MySelect-
|
|
58
|
+
//# sourceMappingURL=MySelect-5DHBVlKZ.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySelect-
|
|
1
|
+
{"version":3,"file":"MySelect-5DHBVlKZ.es.js","sources":["../../src/components/form/MySelect.tsx"],"sourcesContent":["import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n ReactSelect,\n type ReactSelectProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MySelect component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MySelectProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n ReactSelectProps & {\n /** Optional callback for change events. */\n onChange?: (value: unknown) => void;\n };\n\n/**\n * MySelect wraps a ReactSelect with react-hook-form support.\n * Can also be used standalone when no control/name are provided.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the select.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param options - The options to display in the select.\n * @param onChange - Optional callback for change events.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Select and form item props.\n * @returns A select component integrated with react-hook-form.\n */\nexport const MySelect = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n options = [],\n onChange,\n floatingError,\n ...props\n}: MySelectProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => {\n const handleChange = (value: unknown) => {\n field.onChange(value);\n if (onChange) {\n onChange(value);\n }\n };\n\n return (\n <FormItem>\n {label && (\n <FormLabel className={'block'}>\n {label}{' '}\n {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <div>\n <FormControl>\n <ReactSelect\n className={cn(className)}\n {...props}\n {...field}\n onChange={handleChange}\n options={options}\n error={!!get(formState.errors, `${name}`)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </div>\n </FormItem>\n );\n }}\n />\n )) ||\n null\n );\n};\n"],"names":["MySelect","control","name","label","required","className","rules","options","onChange","floatingError","props","jsx","FormField","field","formState","handleChange","value","FormItem","jsxs","FormLabel","FormControl","ReactSelect","cn","get","FormMessage"],"mappings":";;;;AA0CO,MAAMA,IAAW,CAAmC;AAAA,EACzD,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU,CAAA;AAAA,EACV,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,GAAGC;AACL,MAEKR,KAAQD,KACP,gBAAAU;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,SAAAX;AAAA,IACA,MAAAC;AAAA,IACA,OAAAI;AAAA,IACA,QAAQ,CAAC,EAAE,OAAAO,GAAO,WAAAC,QAAgB;AAChC,YAAMC,IAAe,CAACC,MAAmB;AACvC,QAAAH,EAAM,SAASG,CAAK,GAChBR,KACFA,EAASQ,CAAK;AAAA,MAElB;AAEA,+BACGC,GAAA,EACE,UAAA;AAAA,QAAAd,KACC,gBAAAe,EAACC,GAAA,EAAU,WAAW,SACnB,UAAA;AAAA,UAAAhB;AAAA,UAAO;AAAA,UACPC,KAAY,gBAAAO,EAAC,QAAA,EAAK,WAAW,gBAAgB,UAAA,IAAA,CAAC;AAAA,QAAA,GACjD;AAAA,0BAED,OAAA,EACC,UAAA;AAAA,UAAA,gBAAAA,EAACS,GAAA,EACC,UAAA,gBAAAT;AAAA,YAACU;AAAA,YAAA;AAAA,cACC,WAAWC,EAAGjB,CAAS;AAAA,cACtB,GAAGK;AAAA,cACH,GAAGG;AAAA,cACJ,UAAUE;AAAA,cACV,SAAAR;AAAA,cACA,OAAO,CAAC,CAACgB,MAAIT,EAAU,QAAQ,GAAGZ,CAAI,EAAE;AAAA,YAAA;AAAA,UAAA,GAE5C;AAAA,UACA,gBAAAS;AAAA,YAACa;AAAA,YAAA;AAAA,cACC,WAAWF,EAAGb,KAAiB,oBAAoB;AAAA,YAAA;AAAA,UAAA;AAAA,QACrD,EAAA,CACF;AAAA,MAAA,GACF;AAAA,IAEJ;AAAA,EAAA;AAAA,KAGJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),s=require("dgz-ui/form"),a=require("dgz-ui/utils"),g=require("./lodash-BjH0kD7j.cjs.js"),q=({control:t,name:r,label:c,required:i,className:d,rules:m,options:x=[],onChange:o,floatingError:h,...u})=>r&&t&&e.jsx(s.FormField,{control:t,name:r,rules:m,render:({field:n,formState:j})=>{const F=l=>{n.onChange(l),o&&o(l)};return e.jsxs(s.FormItem,{children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",i&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.
|
|
2
|
-
//# sourceMappingURL=MySelect-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),s=require("dgz-ui/form"),a=require("dgz-ui/utils"),g=require("./lodash-BjH0kD7j.cjs.js"),q=({control:t,name:r,label:c,required:i,className:d,rules:m,options:x=[],onChange:o,floatingError:h,...u})=>r&&t&&e.jsx(s.FormField,{control:t,name:r,rules:m,render:({field:n,formState:j})=>{const F=l=>{n.onChange(l),o&&o(l)};return e.jsxs(s.FormItem,{children:[c&&e.jsxs(s.FormLabel,{className:"block",children:[c," ",i&&e.jsx("span",{className:"text-red-600",children:"*"})]}),e.jsxs("div",{children:[e.jsx(s.FormControl,{children:e.jsx(s.ReactSelect,{className:a.cn(d),...u,...n,onChange:F,options:x,error:!!g.lodashExports.get(j.errors,`${r}`)})}),e.jsx(s.FormMessage,{className:a.cn(h&&"absolute -bottom-5")})]})]})}})||null;exports.MySelect=q;
|
|
2
|
+
//# sourceMappingURL=MySelect-Dl3jKf5s.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySelect-
|
|
1
|
+
{"version":3,"file":"MySelect-Dl3jKf5s.cjs.js","sources":["../../src/components/form/MySelect.tsx"],"sourcesContent":["import {\n FormControl,\n FormField,\n FormItem,\n type FormItemProps,\n FormLabel,\n FormMessage,\n ReactSelect,\n type ReactSelectProps,\n} from 'dgz-ui/form';\nimport { cn } from 'dgz-ui/utils';\nimport { get } from 'lodash';\nimport type { FieldPath, FieldValues } from 'react-hook-form';\n\n/**\n * Props for the MySelect component.\n * @template TFieldValues - The type of the form values.\n */\nexport type MySelectProps<TFieldValues extends FieldValues> =\n FormItemProps<TFieldValues> &\n ReactSelectProps & {\n /** Optional callback for change events. */\n onChange?: (value: unknown) => void;\n };\n\n/**\n * MySelect wraps a ReactSelect with react-hook-form support.\n * Can also be used standalone when no control/name are provided.\n *\n * @template TFieldValues - Form values type used by react-hook-form.\n * @param control - The `react-hook-form` control object.\n * @param name - The name of the field in `react-hook-form`.\n * @param label - The label to display for the select.\n * @param required - Whether the field is required.\n * @param className - Custom CSS class name.\n * @param rules - The `react-hook-form` validation rules.\n * @param options - The options to display in the select.\n * @param onChange - Optional callback for change events.\n * @param floatingError - Whether to show the error message in a floating container.\n * @param props - Select and form item props.\n * @returns A select component integrated with react-hook-form.\n */\nexport const MySelect = <TFieldValues extends FieldValues>({\n control,\n name,\n label,\n required,\n className,\n rules,\n options = [],\n onChange,\n floatingError,\n ...props\n}: MySelectProps<TFieldValues>) => {\n return (\n (name && control && (\n <FormField<TFieldValues, FieldPath<TFieldValues>>\n control={control}\n name={name}\n rules={rules}\n render={({ field, formState }) => {\n const handleChange = (value: unknown) => {\n field.onChange(value);\n if (onChange) {\n onChange(value);\n }\n };\n\n return (\n <FormItem>\n {label && (\n <FormLabel className={'block'}>\n {label}{' '}\n {required && <span className={'text-red-600'}>*</span>}\n </FormLabel>\n )}\n <div>\n <FormControl>\n <ReactSelect\n className={cn(className)}\n {...props}\n {...field}\n onChange={handleChange}\n options={options}\n error={!!get(formState.errors, `${name}`)}\n />\n </FormControl>\n <FormMessage\n className={cn(floatingError && 'absolute -bottom-5')}\n />\n </div>\n </FormItem>\n );\n }}\n />\n )) ||\n null\n );\n};\n"],"names":["MySelect","control","name","label","required","className","rules","options","onChange","floatingError","props","jsx","FormField","field","formState","handleChange","value","FormItem","jsxs","FormLabel","FormControl","ReactSelect","cn","get","FormMessage"],"mappings":"2IA0CaA,EAAW,CAAmC,CACzD,QAAAC,EACA,KAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,QAAAC,EAAU,CAAA,EACV,SAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IAEKR,GAAQD,GACPU,EAAAA,IAACC,EAAAA,UAAA,CACC,QAAAX,EACA,KAAAC,EACA,MAAAI,EACA,OAAQ,CAAC,CAAE,MAAAO,EAAO,UAAAC,KAAgB,CAChC,MAAMC,EAAgBC,GAAmB,CACvCH,EAAM,SAASG,CAAK,EAChBR,GACFA,EAASQ,CAAK,CAElB,EAEA,cACGC,WAAA,CACE,SAAA,CAAAd,GACCe,EAAAA,KAACC,EAAAA,UAAA,CAAU,UAAW,QACnB,SAAA,CAAAhB,EAAO,IACPC,GAAYO,EAAAA,IAAC,OAAA,CAAK,UAAW,eAAgB,SAAA,GAAA,CAAC,CAAA,EACjD,SAED,MAAA,CACC,SAAA,CAAAA,MAACS,EAAAA,YAAA,CACC,SAAAT,EAAAA,IAACU,EAAAA,YAAA,CACC,UAAWC,EAAAA,GAAGjB,CAAS,EACtB,GAAGK,EACH,GAAGG,EACJ,SAAUE,EACV,QAAAR,EACA,MAAO,CAAC,CAACgB,oBAAIT,EAAU,OAAQ,GAAGZ,CAAI,EAAE,CAAA,CAAA,EAE5C,EACAS,EAAAA,IAACa,EAAAA,YAAA,CACC,UAAWF,EAAAA,GAAGb,GAAiB,oBAAoB,CAAA,CAAA,CACrD,CAAA,CACF,CAAA,EACF,CAEJ,CAAA,CAAA,GAGJ"}
|
|
@@ -4,7 +4,7 @@ import { AlertDialog as gt, AlertDialogTrigger as yt, AlertDialogContent as vt,
|
|
|
4
4
|
import { useTranslation as Tt } from "react-i18next";
|
|
5
5
|
import { get as je, set as Ie, appendErrors as Ct, useForm as qt } from "react-hook-form";
|
|
6
6
|
import { Form as Ht } from "dgz-ui/form";
|
|
7
|
-
import { M as Xt } from "./MyInput-
|
|
7
|
+
import { M as Xt } from "./MyInput-Cb0FlVxQ.es.js";
|
|
8
8
|
function Et(t) {
|
|
9
9
|
var e, r, n = "";
|
|
10
10
|
if (typeof t == "string" || typeof t == "number") n += t;
|
|
@@ -3267,4 +3267,4 @@ export {
|
|
|
3267
3267
|
Cn as P,
|
|
3268
3268
|
A as y
|
|
3269
3269
|
};
|
|
3270
|
-
//# sourceMappingURL=PasswordConfirm-
|
|
3270
|
+
//# sourceMappingURL=PasswordConfirm-Dj97U7O9.es.js.map
|