@zydon/common 2.9.62 → 2.9.64
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/README.md +10 -0
- package/dist/{chunk-W5SQJCRV.js → chunk-35HI7WFI.js} +2 -2
- package/dist/{chunk-6XWND7WS.js → chunk-3RFXFIBL.js} +2 -2
- package/dist/chunk-4L2H6KB4.js +36 -0
- package/dist/chunk-4L2H6KB4.js.map +1 -0
- package/dist/{chunk-ORYUMPWA.js → chunk-5ZMA4N4W.js} +1 -1
- package/dist/{chunk-GUESB6KF.js → chunk-7BIG6SAF.js} +2 -2
- package/dist/{chunk-VOWFY2XJ.js → chunk-COAGQGZA.js} +2 -2
- package/dist/{chunk-NS4YQBCL.js → chunk-CZ5Y53WA.js} +2 -2
- package/dist/{chunk-BGS7C2JO.js → chunk-EICUAMNN.js} +2 -2
- package/dist/{chunk-3MKH4GA7.js → chunk-FC4OALKP.js} +3 -3
- package/dist/{chunk-EH3H2KRA.js → chunk-G7TQARLI.js} +5 -5
- package/dist/{chunk-XQELM32G.js → chunk-H762KDPN.js} +2 -2
- package/dist/{chunk-RJDUZM6J.js → chunk-H7OG32Y5.js} +2 -2
- package/dist/{chunk-2XNZB6R7.js → chunk-IT6HMYIE.js} +3 -3
- package/dist/{chunk-ABUPUFBM.js → chunk-JKAMT5TC.js} +2 -2
- package/dist/{chunk-QJOC2VQK.js → chunk-KDSM2AIT.js} +2 -2
- package/dist/{chunk-GYQF73N2.js → chunk-L6CMWQCC.js} +2 -2
- package/dist/{chunk-44KLQXRW.js → chunk-MY4CZ5PC.js} +2 -2
- package/dist/{chunk-5GKALBQA.js → chunk-OWJ6XY6F.js} +3 -3
- package/dist/{chunk-YGLJRGMO.js → chunk-PMKM67BB.js} +2 -2
- package/dist/{chunk-Q5PV6YKW.js → chunk-TOZ66UM4.js} +2 -2
- package/dist/{chunk-VDATDEFK.js → chunk-TS7QZPD6.js} +2 -2
- package/dist/{chunk-KQM24IXA.js → chunk-TSEVZMIE.js} +2 -2
- package/dist/{chunk-HHN35KIG.js → chunk-VELCTMU2.js} +2 -2
- package/dist/{chunk-TYX6CIOM.js → chunk-VPZL6AIF.js} +2 -2
- package/dist/{chunk-7OQ2INNY.js → chunk-YJYS2LQQ.js} +2 -2
- package/dist/{chunk-BVWXGGJY.js → chunk-YKCEUH6C.js} +5 -5
- package/dist/{chunk-K2PVYOH6.js → chunk-YU5R3EXT.js} +2 -2
- package/dist/components/Accordion/index.js +2 -2
- package/dist/components/ActionButton/index.js +2 -2
- package/dist/components/Analytics/Carts/index.js +14 -14
- package/dist/components/Analytics/OrderProjection/index.js +7 -7
- package/dist/components/Analytics/OverviewAnalytics/index.js +11 -11
- package/dist/components/Analytics/PartnerAnalysis/index.js +10 -10
- package/dist/components/Analytics/index.js +6 -6
- package/dist/components/Autocomplete/index.js +2 -2
- package/dist/components/AvatarButton/index.js +2 -2
- package/dist/components/BuilderLayout/index.js +2 -2
- package/dist/components/BuilderSidebar/index.js +1 -1
- package/dist/components/BulkEditModal/index.js +4 -4
- package/dist/components/CardBrand/index.js +1 -1
- package/dist/components/ColorPickerInput/index.js +2 -2
- package/dist/components/Common/index.js +1 -1
- package/dist/components/CopyButton/index.js +2 -2
- package/dist/components/DataGrid/index.js +3 -3
- package/dist/components/DataView/index.js +6 -6
- package/dist/components/DragButton/index.js +2 -2
- package/dist/components/Drawer/index.js +2 -2
- package/dist/components/DynamicDataView/index.js +9 -9
- package/dist/components/EasyCropModal/index.js +3 -3
- package/dist/components/Error/index.js +1 -1
- package/dist/components/ExpandableGroup/index.js +1 -1
- package/dist/components/FileUpload/index.js +6 -6
- package/dist/components/Filters/index.js +3 -3
- package/dist/components/FrameSkeleton/index.js +1 -1
- package/dist/components/HelpButton/index.js +2 -2
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/IconButton/index.js +2 -2
- package/dist/components/ImageCropModal/index.js +2 -2
- package/dist/components/Incrementer/index.js +2 -2
- package/dist/components/InfoCircle/index.js +2 -2
- package/dist/components/ListBundles/index.js +2 -2
- package/dist/components/MenuItem/index.js +2 -2
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/MoreMenu/index.js +2 -2
- package/dist/components/NotFound/index.js +1 -1
- package/dist/components/PasswordRules/index.js +1 -1
- package/dist/components/PopoverSelect/index.js +1 -1
- package/dist/components/PortalBrandImage/index.js +1 -1
- package/dist/components/SearchInput/index.js +2 -2
- package/dist/components/SelectList/index.d.ts +1 -1
- package/dist/components/SelectList/index.js +6 -4
- package/dist/components/SelectableCards/index.js +3 -3
- package/dist/components/SeoPreview/index.js +1 -1
- package/dist/components/StateDisplay/index.js +2 -2
- package/dist/components/StepNavigator/index.js +2 -2
- package/dist/components/StepUpDialog/index.js +1 -1
- package/dist/components/Steps/index.js +1 -1
- package/dist/components/StyledTab/index.js +1 -1
- package/dist/components/SwapList/index.js +2 -2
- package/dist/components/WebhookCard/index.js +1 -1
- package/dist/components/carousel/index.js +2 -2
- package/dist/components/form/Address/index.js +3 -3
- package/dist/components/form/Autocomplete/index.js +3 -3
- package/dist/components/form/ColorPicker/index.js +2 -2
- package/dist/components/form/FileUpload/index.js +6 -6
- package/dist/components/form/Incrementer/index.js +2 -2
- package/dist/components/form/Password/index.js +1 -1
- package/dist/components/form/SelectList/index.d.ts +3 -2
- package/dist/components/form/SelectList/index.js +8 -6
- package/dist/components/form/SelectList/index.js.map +1 -1
- package/dist/components/form/SelectableCards/index.js +3 -3
- package/dist/components/form/Webhook/index.js +4 -4
- package/dist/components/lightbox/index.js +1 -1
- package/dist/components/table/index.js +2 -2
- package/dist/hooks/useSelectedOptions.d.ts +19 -0
- package/dist/hooks/useSelectedOptions.js +6 -0
- package/dist/hooks/useSelectedOptions.js.map +1 -0
- package/dist/types/selectList.d.ts +36 -9
- package/package.json +1 -1
- package/dist/chunk-ODYYZSIQ.js +0 -20
- package/dist/chunk-ODYYZSIQ.js.map +0 -1
- /package/dist/{chunk-W5SQJCRV.js.map → chunk-35HI7WFI.js.map} +0 -0
- /package/dist/{chunk-6XWND7WS.js.map → chunk-3RFXFIBL.js.map} +0 -0
- /package/dist/{chunk-ORYUMPWA.js.map → chunk-5ZMA4N4W.js.map} +0 -0
- /package/dist/{chunk-GUESB6KF.js.map → chunk-7BIG6SAF.js.map} +0 -0
- /package/dist/{chunk-VOWFY2XJ.js.map → chunk-COAGQGZA.js.map} +0 -0
- /package/dist/{chunk-NS4YQBCL.js.map → chunk-CZ5Y53WA.js.map} +0 -0
- /package/dist/{chunk-BGS7C2JO.js.map → chunk-EICUAMNN.js.map} +0 -0
- /package/dist/{chunk-3MKH4GA7.js.map → chunk-FC4OALKP.js.map} +0 -0
- /package/dist/{chunk-EH3H2KRA.js.map → chunk-G7TQARLI.js.map} +0 -0
- /package/dist/{chunk-XQELM32G.js.map → chunk-H762KDPN.js.map} +0 -0
- /package/dist/{chunk-RJDUZM6J.js.map → chunk-H7OG32Y5.js.map} +0 -0
- /package/dist/{chunk-2XNZB6R7.js.map → chunk-IT6HMYIE.js.map} +0 -0
- /package/dist/{chunk-ABUPUFBM.js.map → chunk-JKAMT5TC.js.map} +0 -0
- /package/dist/{chunk-QJOC2VQK.js.map → chunk-KDSM2AIT.js.map} +0 -0
- /package/dist/{chunk-GYQF73N2.js.map → chunk-L6CMWQCC.js.map} +0 -0
- /package/dist/{chunk-44KLQXRW.js.map → chunk-MY4CZ5PC.js.map} +0 -0
- /package/dist/{chunk-5GKALBQA.js.map → chunk-OWJ6XY6F.js.map} +0 -0
- /package/dist/{chunk-YGLJRGMO.js.map → chunk-PMKM67BB.js.map} +0 -0
- /package/dist/{chunk-Q5PV6YKW.js.map → chunk-TOZ66UM4.js.map} +0 -0
- /package/dist/{chunk-VDATDEFK.js.map → chunk-TS7QZPD6.js.map} +0 -0
- /package/dist/{chunk-KQM24IXA.js.map → chunk-TSEVZMIE.js.map} +0 -0
- /package/dist/{chunk-HHN35KIG.js.map → chunk-VELCTMU2.js.map} +0 -0
- /package/dist/{chunk-TYX6CIOM.js.map → chunk-VPZL6AIF.js.map} +0 -0
- /package/dist/{chunk-7OQ2INNY.js.map → chunk-YJYS2LQQ.js.map} +0 -0
- /package/dist/{chunk-BVWXGGJY.js.map → chunk-YKCEUH6C.js.map} +0 -0
- /package/dist/{chunk-K2PVYOH6.js.map → chunk-YU5R3EXT.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as a$3 } from '../../chunk-P2QZJ57W.js';
|
|
2
2
|
import { a as a$4 } from '../../chunk-BT3FTBTT.js';
|
|
3
3
|
import { a as a$2 } from '../../chunk-XAPSXJZO.js';
|
|
4
|
-
import { a as a$1 } from '../../chunk-
|
|
4
|
+
import { a as a$1 } from '../../chunk-5ZMA4N4W.js';
|
|
5
5
|
import '../../chunk-Z6YXPKWP.js';
|
|
6
6
|
import '../../chunk-FJBC6QA5.js';
|
|
7
7
|
import '../../chunk-POTVACYB.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as a$2 } from '../../chunk-6ZSTKYGL.js';
|
|
2
|
-
import { a } from '../../chunk-
|
|
2
|
+
import { a } from '../../chunk-35HI7WFI.js';
|
|
3
3
|
import { a as a$1 } from '../../chunk-4F2NKGF6.js';
|
|
4
4
|
import '../../chunk-NIQW2J3M.js';
|
|
5
|
-
import { a as a$4 } from '../../chunk-
|
|
5
|
+
import { a as a$4 } from '../../chunk-5ZMA4N4W.js';
|
|
6
6
|
import '../../chunk-Z6YXPKWP.js';
|
|
7
7
|
import { a as a$3 } from '../../chunk-F65ZXAGV.js';
|
|
8
8
|
import { useState } from 'react';
|
|
@@ -2,7 +2,7 @@ import { d } from '../../chunk-JNDZPNQJ.js';
|
|
|
2
2
|
import { a as a$3 } from '../../chunk-PUMCHXCD.js';
|
|
3
3
|
import { a as a$2 } from '../../chunk-UVPQR2Q2.js';
|
|
4
4
|
import { a } from '../../chunk-CO2KQFUN.js';
|
|
5
|
-
import { a as a$4 } from '../../chunk-
|
|
5
|
+
import { a as a$4 } from '../../chunk-5ZMA4N4W.js';
|
|
6
6
|
import '../../chunk-Z6YXPKWP.js';
|
|
7
7
|
import { a as a$1 } from '../../chunk-LQRRMVFN.js';
|
|
8
8
|
import '../../chunk-Y66XXBB3.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { j as ArrowButton, f as Carousel, g as CarouselArrowBasicButtons, i as CarouselArrowFloatButtons, h as CarouselArrowNumberButtons, k as CarouselDotButtons, l as CarouselProgressBar, c as CarouselSlide, n as CarouselThumb, m as CarouselThumbs, e as StyledContainer, d as StyledRoot, a as carouselBreakpoints, b as carouselClasses, o as useCarousel } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { j as ArrowButton, f as Carousel, g as CarouselArrowBasicButtons, i as CarouselArrowFloatButtons, h as CarouselArrowNumberButtons, k as CarouselDotButtons, l as CarouselProgressBar, c as CarouselSlide, n as CarouselThumb, m as CarouselThumbs, e as StyledContainer, d as StyledRoot, a as carouselBreakpoints, b as carouselClasses, o as useCarousel } from '../../chunk-H7OG32Y5.js';
|
|
2
|
+
import '../../chunk-5ZMA4N4W.js';
|
|
3
3
|
import '../../chunk-Z6YXPKWP.js';
|
|
4
4
|
import '../../chunk-Y66XXBB3.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,9 +2,9 @@ import { a as a$3 } from '../../../chunk-MSCOIJQ5.js';
|
|
|
2
2
|
import { a } from '../../../chunk-X64QHBVQ.js';
|
|
3
3
|
import { a as a$1 } from '../../../chunk-P2QZJ57W.js';
|
|
4
4
|
import '../../../chunk-RTC7H5E5.js';
|
|
5
|
-
import { a as a$2 } from '../../../chunk-
|
|
6
|
-
import '../../../chunk-
|
|
7
|
-
import '../../../chunk-
|
|
5
|
+
import { a as a$2 } from '../../../chunk-TOZ66UM4.js';
|
|
6
|
+
import '../../../chunk-YU5R3EXT.js';
|
|
7
|
+
import '../../../chunk-5ZMA4N4W.js';
|
|
8
8
|
import '../../../chunk-Z6YXPKWP.js';
|
|
9
9
|
import L from '@mui/material/CircularProgress';
|
|
10
10
|
import g from '@mui/material/InputAdornment';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as default } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
3
|
-
import '../../../chunk-
|
|
1
|
+
export { a as default } from '../../../chunk-TOZ66UM4.js';
|
|
2
|
+
import '../../../chunk-YU5R3EXT.js';
|
|
3
|
+
import '../../../chunk-5ZMA4N4W.js';
|
|
4
4
|
import '../../../chunk-Z6YXPKWP.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-L6CMWQCC.js';
|
|
2
|
+
import '../../../chunk-5ZMA4N4W.js';
|
|
3
3
|
import '../../../chunk-Z6YXPKWP.js';
|
|
4
4
|
import '../../../chunk-LQRRMVFN.js';
|
|
5
5
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { x, u, v, w } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
3
|
-
import '../../../chunk-
|
|
4
|
-
import '../../../chunk-KQM24IXA.js';
|
|
1
|
+
import { x, u, v, w } from '../../../chunk-G7TQARLI.js';
|
|
2
|
+
import '../../../chunk-TS7QZPD6.js';
|
|
3
|
+
import '../../../chunk-7BIG6SAF.js';
|
|
5
4
|
import '../../../chunk-KGLU4CR2.js';
|
|
6
|
-
import '../../../chunk-
|
|
5
|
+
import '../../../chunk-TSEVZMIE.js';
|
|
6
|
+
import '../../../chunk-3RFXFIBL.js';
|
|
7
7
|
import '../../../chunk-OF6623HG.js';
|
|
8
8
|
import '../../../chunk-5J35UAV6.js';
|
|
9
9
|
import '../../../chunk-6U5LS7MP.js';
|
|
10
|
-
import '../../../chunk-
|
|
10
|
+
import '../../../chunk-5ZMA4N4W.js';
|
|
11
11
|
import '../../../chunk-Z6YXPKWP.js';
|
|
12
12
|
import '../../../chunk-HW6M33F3.js';
|
|
13
13
|
import '../../../chunk-XNKYJHNL.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-COAGQGZA.js';
|
|
2
2
|
import '../../../chunk-I3HQNMR3.js';
|
|
3
3
|
import '../../../chunk-OF6623HG.js';
|
|
4
|
-
import '../../../chunk-
|
|
4
|
+
import '../../../chunk-5ZMA4N4W.js';
|
|
5
5
|
import '../../../chunk-Z6YXPKWP.js';
|
|
6
6
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a } from '../../../chunk-P2QZJ57W.js';
|
|
2
2
|
import { n } from '../../../chunk-55XSPNSX.js';
|
|
3
|
-
import { a as a$1 } from '../../../chunk-
|
|
3
|
+
import { a as a$1 } from '../../../chunk-5ZMA4N4W.js';
|
|
4
4
|
import '../../../chunk-Z6YXPKWP.js';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { useFormContext } from 'react-hook-form';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { BaseField } from '../../../types/baseField.js';
|
|
3
|
-
import {
|
|
3
|
+
import { SelectListSingleProps, SelectListMultipleProps } from '../../../types/selectList.js';
|
|
4
4
|
import 'react-hook-form';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type FieldProps<P> = BaseField<Omit<P, 'value' | 'onChange'>> & {
|
|
8
8
|
onChange?: (value: string | string[]) => void;
|
|
9
9
|
};
|
|
10
|
+
type SelectListProps = FieldProps<SelectListSingleProps> | FieldProps<SelectListMultipleProps>;
|
|
10
11
|
|
|
11
12
|
declare const SelectList: ({ name, rules, onChange, helperText, ...other }: SelectListProps) => react_jsx_runtime.JSX.Element;
|
|
12
13
|
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-4L2H6KB4.js';
|
|
2
2
|
import '../../../chunk-RUABKHIV.js';
|
|
3
|
-
import '../../../chunk-
|
|
3
|
+
import '../../../chunk-TSEVZMIE.js';
|
|
4
|
+
import '../../../chunk-35HI7WFI.js';
|
|
4
5
|
import '../../../chunk-4F2NKGF6.js';
|
|
5
6
|
import '../../../chunk-6U5LS7MP.js';
|
|
6
|
-
import '../../../chunk-
|
|
7
|
-
import '../../../chunk-
|
|
7
|
+
import '../../../chunk-MY4CZ5PC.js';
|
|
8
|
+
import '../../../chunk-5ZMA4N4W.js';
|
|
8
9
|
import '../../../chunk-Z6YXPKWP.js';
|
|
10
|
+
import '../../../chunk-GNNZB7DN.js';
|
|
9
11
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
10
12
|
import { jsx } from 'react/jsx-runtime';
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var S=({name:s,rules:p,onChange:l,helperText:m,...i})=>{let{control:a$1}=useFormContext();return jsx(Controller,{name:s,control:a$1,rules:p,render:({field:o,fieldState:{error:e}})=>jsx(a,{...i,value:o.value,onChange:t=>{o.onChange(t),l?.(t);},error:!!e,helperText:e?.message||m})})},u=S;
|
|
13
15
|
|
|
14
|
-
export {
|
|
16
|
+
export { u as default };
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/form/SelectList/index.tsx"],"names":["Controller","useFormContext","jsx","SelectList","name","rules","onChange","helperText","other","control","field","error","SelectList_default","value"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/form/SelectList/index.tsx"],"names":["Controller","useFormContext","jsx","SelectList","name","rules","onChange","helperText","other","control","field","error","SelectList_default","value"],"mappings":"0WAAA,OAAS,cAAAA,EAAY,kBAAAC,MAAsB,kBAuBjC,cAAAC,MAAA,oBAhBV,IAAMC,EAAa,CAAC,CAClB,KAAAC,EACA,MAAAC,EACA,SAAAC,EACA,WAAAC,EACA,GAAGC,CACL,IAAuB,CACrB,GAAM,CAAE,QAAAC,CAAQ,EAAIR,EAAe,EAEnC,OACEC,EAACF,EAAA,CACC,KAAMI,EACN,QAASK,EACT,MAAOJ,EACP,OAAQ,CAAC,CAAE,MAAAK,EAAO,WAAY,CAAE,MAAAC,CAAM,CAAE,IAEpCT,EAACU,EAAA,CAEG,GAAGJ,EACH,MAAOE,EAAM,MACb,SAAWG,GAA6B,CACtCH,EAAM,SAASG,CAAK,EACpBP,IAAWO,CAAK,CAClB,EACA,MAAO,CAAC,CAACF,EACT,WAAYA,GAAO,SAAWJ,EAElC,EAGN,CAEJ,EAEOK,EAAQT","sourcesContent":["import { Controller, useFormContext } from 'react-hook-form';\n\nimport SelectListComponent from 'components/SelectList';\nimport { SelectListProps as ComponentProps } from 'types/selectList';\n\nimport { SelectListProps } from './props';\n\nconst SelectList = ({\n name,\n rules,\n onChange,\n helperText,\n ...other\n}: SelectListProps) => {\n const { control } = useFormContext();\n\n return (\n <Controller\n name={name}\n control={control}\n rules={rules}\n render={({ field, fieldState: { error } }) => {\n return (\n <SelectListComponent\n {...({\n ...other,\n value: field.value,\n onChange: (value: string | string[]) => {\n field.onChange(value);\n onChange?.(value);\n },\n error: !!error,\n helperText: error?.message || helperText,\n } as ComponentProps)}\n />\n );\n }}\n />\n );\n};\n\nexport default SelectList;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-IT6HMYIE.js';
|
|
2
2
|
import '../../../chunk-6ZSTKYGL.js';
|
|
3
|
-
import '../../../chunk-
|
|
3
|
+
import '../../../chunk-35HI7WFI.js';
|
|
4
4
|
import '../../../chunk-4F2NKGF6.js';
|
|
5
5
|
import '../../../chunk-NIQW2J3M.js';
|
|
6
|
-
import '../../../chunk-
|
|
6
|
+
import '../../../chunk-5ZMA4N4W.js';
|
|
7
7
|
import '../../../chunk-Z6YXPKWP.js';
|
|
8
8
|
import '../../../chunk-F65ZXAGV.js';
|
|
9
9
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as a$1 } from '../../../chunk-P2QZJ57W.js';
|
|
2
|
-
import { a as a$
|
|
3
|
-
import { a as a$
|
|
4
|
-
import '../../../chunk-
|
|
5
|
-
import { a } from '../../../chunk-
|
|
2
|
+
import { a as a$2 } from '../../../chunk-TOZ66UM4.js';
|
|
3
|
+
import { a as a$3 } from '../../../chunk-MY4CZ5PC.js';
|
|
4
|
+
import '../../../chunk-YU5R3EXT.js';
|
|
5
|
+
import { a } from '../../../chunk-5ZMA4N4W.js';
|
|
6
6
|
import '../../../chunk-Z6YXPKWP.js';
|
|
7
7
|
import { useCallback, useMemo } from 'react';
|
|
8
8
|
import { useFormContext, useFieldArray } from 'react-hook-form';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { a } from '../../chunk-VPZL6AIF.js';
|
|
2
|
+
import '../../chunk-5ZMA4N4W.js';
|
|
3
3
|
import '../../chunk-Z6YXPKWP.js';
|
|
4
4
|
import S from '@mui/material/TableCell';
|
|
5
5
|
import F from '@mui/material/TableRow';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SelectListSelectedOption } from '../types/selectList.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
|
|
4
|
+
interface UseSelectedOptionsParams<T> {
|
|
5
|
+
value: string[];
|
|
6
|
+
sources: (T[] | undefined)[];
|
|
7
|
+
getId: (item: T) => string;
|
|
8
|
+
toOption: (item: T) => SelectListSelectedOption;
|
|
9
|
+
resolve?: (ids: string[]) => Promise<T[]>;
|
|
10
|
+
isComplete?: (item: T) => boolean;
|
|
11
|
+
}
|
|
12
|
+
interface UseSelectedOptionsResult<T> {
|
|
13
|
+
selectedOptions: SelectListSelectedOption[];
|
|
14
|
+
selectedLoading: boolean;
|
|
15
|
+
getItem: (id: string) => T | undefined;
|
|
16
|
+
}
|
|
17
|
+
declare const useSelectedOptions: <T>({ value, sources, getId, toOption, resolve, isComplete, }: UseSelectedOptionsParams<T>) => UseSelectedOptionsResult<T>;
|
|
18
|
+
|
|
19
|
+
export { UseSelectedOptionsParams, UseSelectedOptionsResult, useSelectedOptions as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
var U=({value:s,sources:u,getId:a,toOption:f,resolve:c,isComplete:p})=>{let r=useRef(new Map),g=useRef(0),h=useRef(new Set),[m,L]=useState(0),[R,S]=useState(!1),T=useMemo(()=>(u.forEach(e=>e?.forEach(n=>{let t=a(n);!t||r.current.has(t)||p&&!p(n)||(r.current.set(t,n),g.current+=1);})),g.current),u),i=useMemo(()=>s.filter(e=>!r.current.has(e)),[s,T,m]);return useEffect(()=>{if(!c)return;let e=i.filter(t=>!h.current.has(t));if(!e.length)return;e.forEach(t=>h.current.add(t));let n=!0;return S(!0),c(e).then(t=>{t.forEach(O=>{let o=a(O);o&&!r.current.has(o)&&r.current.set(o,O);});}).catch(()=>{}).finally(()=>{n&&(S(!1),L(t=>t+1));}),()=>{n=!1;}},[i.join(","),c]),{selectedOptions:useMemo(()=>s.flatMap(e=>{let n=r.current.get(e);return n?[f(n)]:[]}),[s,T,m,f]),selectedLoading:R&&i.length>0,getItem:e=>r.current.get(e)}},M=U;
|
|
4
|
+
|
|
5
|
+
export { M as default };
|
|
6
|
+
//# sourceMappingURL=useSelectedOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useSelectedOptions.ts"],"names":["useEffect","useMemo","useRef","useState","useSelectedOptions","value","sources","getId","toOption","resolve","isComplete","cache","cacheVersion","attempted","resolvedVersion","setResolvedVersion","pending","setPending","sourcesVersion","list","item","id","missing","toResolve","active","items","v","useSelectedOptions_default"],"mappings":"AAAA,OAAS,aAAAA,EAAW,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAqCrD,IAAMC,EAAqB,CAAI,CAC7B,MAAAC,EACA,QAAAC,EACA,MAAAC,EACA,SAAAC,EACA,QAAAC,EACA,WAAAC,CACF,IAAgE,CAC9D,IAAMC,EAAQT,EAAO,IAAI,GAAgB,EACnCU,EAAeV,EAAO,CAAC,EACvBW,EAAYX,EAAO,IAAI,GAAa,EACpC,CAACY,EAAiBC,CAAkB,EAAIZ,EAAS,CAAC,EAClD,CAACa,EAASC,CAAU,EAAId,EAAS,EAAK,EAGtCe,EAAiBjB,EAAQ,KAC7BK,EAAQ,QAAQa,GACdA,GAAM,QAAQC,GAAQ,CACpB,IAAMC,EAAKd,EAAMa,CAAI,EACjB,CAACC,GAAMV,EAAM,QAAQ,IAAIU,CAAE,GAC3BX,GAAc,CAACA,EAAWU,CAAI,IAClCT,EAAM,QAAQ,IAAIU,EAAID,CAAI,EAC1BR,EAAa,SAAW,EAC1B,CAAC,CACH,EACOA,EAAa,SAEnBN,CAAO,EAEJgB,EAAUrB,EACd,IAAMI,EAAM,OAAOgB,GAAM,CAACV,EAAM,QAAQ,IAAIU,CAAE,CAAC,EAE/C,CAAChB,EAAOa,EAAgBJ,CAAe,CACzC,EAEA,OAAAd,EAAU,IAAM,CACd,GAAI,CAACS,EAAS,OACd,IAAMc,EAAYD,EAAQ,OAAOD,GAAM,CAACR,EAAU,QAAQ,IAAIQ,CAAE,CAAC,EACjE,GAAI,CAACE,EAAU,OAAQ,OAEvBA,EAAU,QAAQF,GAAMR,EAAU,QAAQ,IAAIQ,CAAE,CAAC,EACjD,IAAIG,EAAS,GACb,OAAAP,EAAW,EAAI,EACfR,EAAQc,CAAS,EACd,KAAKE,GAAS,CACbA,EAAM,QAAQL,GAAQ,CACpB,IAAMC,EAAKd,EAAMa,CAAI,EACjBC,GAAM,CAACV,EAAM,QAAQ,IAAIU,CAAE,GAAGV,EAAM,QAAQ,IAAIU,EAAID,CAAI,CAC9D,CAAC,CACH,CAAC,EACA,MAAM,IAAG,EAAY,EACrB,QAAQ,IAAM,CACRI,IACLP,EAAW,EAAK,EAChBF,EAAmBW,GAAKA,EAAI,CAAC,EAC/B,CAAC,EAEI,IAAM,CACXF,EAAS,EACX,CAEF,EAAG,CAACF,EAAQ,KAAK,GAAG,EAAGb,CAAO,CAAC,EAaxB,CACL,gBAZsBR,EACtB,IACEI,EAAM,QAAQgB,GAAM,CAClB,IAAMD,EAAOT,EAAM,QAAQ,IAAIU,CAAE,EACjC,OAAOD,EAAO,CAACZ,EAASY,CAAI,CAAC,EAAI,CAAC,CACpC,CAAC,EAGH,CAACf,EAAOa,EAAgBJ,EAAiBN,CAAQ,CACnD,EAIE,gBAAiBQ,GAAWM,EAAQ,OAAS,EAC7C,QAASD,GAAMV,EAAM,QAAQ,IAAIU,CAAE,CACrC,CACF,EAEOM,EAAQvB","sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { SelectListSelectedOption } from 'types/selectList';\n\nexport interface UseSelectedOptionsParams<T> {\n /** Ids selecionados (o `value` do `SelectList`), na ordem do bloco. */\n value: string[];\n /**\n * Fontes de itens já conhecidos: os objetos do form (salvos) e as opções da\n * página atual. Tudo que passa aqui fica em cache por id, então um item\n * marcado na página 2 continua com nome quando a lista volta à página 1.\n */\n sources: (T[] | undefined)[];\n getId: (item: T) => string;\n toOption: (item: T) => SelectListSelectedOption;\n /** Busca os itens dos ids que ainda não têm nome. Chamado só para os faltantes. */\n resolve?: (ids: string[]) => Promise<T[]>;\n /**\n * Diz se o item já tem o que o bloco precisa (ex.: nome). Item incompleto não\n * entra no cache e o id continua pendente de `resolve`. Padrão: sempre completo.\n */\n isComplete?: (item: T) => boolean;\n}\n\nexport interface UseSelectedOptionsResult<T> {\n selectedOptions: SelectListSelectedOption[];\n /** Há ids selecionados sem item conhecido sendo resolvidos. */\n selectedLoading: boolean;\n /** Item conhecido (cache) de um id. */\n getItem: (id: string) => T | undefined;\n}\n\n/**\n * Monta as `selectedOptions` do `SelectList` (bloco \"Selecionados\") a partir dos\n * ids selecionados, dos itens já conhecidos e, opcionalmente, de um `resolve`\n * para os ids salvos cujo nome não veio no GET.\n */\nconst useSelectedOptions = <T>({\n value,\n sources,\n getId,\n toOption,\n resolve,\n isComplete,\n}: UseSelectedOptionsParams<T>): UseSelectedOptionsResult<T> => {\n const cache = useRef(new Map<string, T>());\n const cacheVersion = useRef(0);\n const attempted = useRef(new Set<string>());\n const [resolvedVersion, setResolvedVersion] = useState(0);\n const [pending, setPending] = useState(false);\n\n // Atualiza o cache com as fontes atuais (o form tem prioridade: vem primeiro).\n const sourcesVersion = useMemo(() => {\n sources.forEach(list =>\n list?.forEach(item => {\n const id = getId(item);\n if (!id || cache.current.has(id)) return;\n if (isComplete && !isComplete(item)) return;\n cache.current.set(id, item);\n cacheVersion.current += 1;\n }),\n );\n return cacheVersion.current;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, sources);\n\n const missing = useMemo(\n () => value.filter(id => !cache.current.has(id)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [value, sourcesVersion, resolvedVersion],\n );\n\n useEffect(() => {\n if (!resolve) return;\n const toResolve = missing.filter(id => !attempted.current.has(id));\n if (!toResolve.length) return;\n\n toResolve.forEach(id => attempted.current.add(id));\n let active = true;\n setPending(true);\n resolve(toResolve)\n .then(items => {\n items.forEach(item => {\n const id = getId(item);\n if (id && !cache.current.has(id)) cache.current.set(id, item);\n });\n })\n .catch(() => undefined)\n .finally(() => {\n if (!active) return;\n setPending(false);\n setResolvedVersion(v => v + 1);\n });\n\n return () => {\n active = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [missing.join(','), resolve]);\n\n const selectedOptions = useMemo(\n () =>\n value.flatMap(id => {\n const item = cache.current.get(id);\n return item ? [toOption(item)] : [];\n }),\n // toOption é recalculado a cada render para refletir estado da tela (ex.: estrela)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [value, sourcesVersion, resolvedVersion, toOption],\n );\n\n return {\n selectedOptions,\n selectedLoading: pending && missing.length > 0,\n getItem: id => cache.current.get(id),\n };\n};\n\nexport default useSelectedOptions;\n"]}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface SelectListColumn {
|
|
4
|
+
key: string;
|
|
5
|
+
header: ReactNode;
|
|
6
|
+
width?: number | string;
|
|
7
|
+
}
|
|
8
|
+
interface SelectListOption {
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
value: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
startContent?: ReactNode;
|
|
13
|
+
cells?: Record<string, ReactNode>;
|
|
14
|
+
searchText?: string;
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
type SelectListSelectedOption = SelectListOption;
|
|
18
|
+
interface SelectListEntityLabel {
|
|
19
|
+
singular: string;
|
|
20
|
+
plural: string;
|
|
21
|
+
feminine?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface SelectListBaseProps {
|
|
4
24
|
label?: ReactNode;
|
|
5
25
|
value?: string | string[];
|
|
6
|
-
|
|
7
|
-
options: {
|
|
8
|
-
label: ReactNode;
|
|
9
|
-
value: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
startContent?: ReactNode;
|
|
12
|
-
}[];
|
|
26
|
+
options: SelectListOption[];
|
|
13
27
|
total?: number;
|
|
14
28
|
onChange: (value: string | string[]) => void;
|
|
15
29
|
pagination?: {
|
|
@@ -27,5 +41,18 @@ interface SelectListProps {
|
|
|
27
41
|
helperText?: ReactNode;
|
|
28
42
|
error?: boolean;
|
|
29
43
|
}
|
|
44
|
+
interface SelectListSingleProps extends SelectListBaseProps {
|
|
45
|
+
multiple?: false;
|
|
46
|
+
}
|
|
47
|
+
interface SelectListMultipleProps extends SelectListBaseProps {
|
|
48
|
+
multiple: true;
|
|
49
|
+
selectedOptions: SelectListSelectedOption[];
|
|
50
|
+
entityLabel: SelectListEntityLabel;
|
|
51
|
+
columns?: SelectListColumn[];
|
|
52
|
+
readOnly?: boolean;
|
|
53
|
+
onRemoveSelected?: VoidFunction;
|
|
54
|
+
selectedLoading?: boolean;
|
|
55
|
+
}
|
|
56
|
+
type SelectListProps = SelectListSingleProps | SelectListMultipleProps;
|
|
30
57
|
|
|
31
|
-
export { SelectListProps };
|
|
58
|
+
export { SelectListColumn, SelectListEntityLabel, SelectListMultipleProps, SelectListOption, SelectListProps, SelectListSelectedOption, SelectListSingleProps };
|
package/package.json
CHANGED
package/dist/chunk-ODYYZSIQ.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-RUABKHIV.js';
|
|
2
|
-
import { a as a$1 } from './chunk-W5SQJCRV.js';
|
|
3
|
-
import { a as a$3 } from './chunk-4F2NKGF6.js';
|
|
4
|
-
import { a as a$4 } from './chunk-6U5LS7MP.js';
|
|
5
|
-
import { a as a$2 } from './chunk-44KLQXRW.js';
|
|
6
|
-
import { useMemo, useCallback } from 'react';
|
|
7
|
-
import B from '@mui/material/Checkbox';
|
|
8
|
-
import H from '@mui/material/FormControlLabel';
|
|
9
|
-
import D from '@mui/material/FormHelperText';
|
|
10
|
-
import G from '@mui/material/Pagination';
|
|
11
|
-
import K from '@mui/material/Radio';
|
|
12
|
-
import i from '@mui/material/Stack';
|
|
13
|
-
import u from '@mui/material/Typography';
|
|
14
|
-
import { styled } from '@mui/material/styles';
|
|
15
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
16
|
-
|
|
17
|
-
var A=styled(i)(({theme:r})=>({flexDirection:"row",minHeight:48,alignItems:"flex-start",justifyContent:"flex-start",padding:r.spacing(1.5,0),borderBottom:`1px dashed ${r.palette.divider}`,"& label":{marginInline:0,userSelect:"none",alignItems:"flex-start","& .MuiFormControlLabel-label":{minHeight:36,display:"flex",alignItems:"center"}}}));var $=Array.from({length:12},(r,p)=>jsx(a,{height:48},p)),q=({value:r,multiple:p,options:l,onChange:c,pagination:n,onSearch:f,onAdd:g,total:m=0,label:h,loading:b,loadingView:O,fetching:S,fetchingView:v,emptyView:M,error:N,helperText:k})=>{let s=p&&Array.isArray(r),C=useMemo(()=>Math.ceil(m/(n?.perPage||1)),[m,n?.perPage]),_=useMemo(()=>l.map(e=>e.value),[l]),j=s&&m>0&&_.every(e=>r.includes(e)),z=useCallback(()=>{if(!s)return;let e=l.filter(o=>!o.disabled).map(o=>o.value),a=e.every(o=>r.includes(o));c(a?r.filter(o=>!e.includes(o)):[...r,...e.filter(o=>!r.includes(o))]);},[s,r,c,l]),y=useCallback((e,a)=>{if(!s){c(e);return}c(a?[...r,e]:r.filter(o=>o!==e));},[s,r,c]),E=useCallback(e=>s?jsx(B,{checked:r.includes(e.value),onChange:(a,o)=>y(e.value,o),disabled:e.disabled}):jsx(K,{checked:r===e.value,onChange:()=>y(e.value,!0),disabled:e.disabled}),[s,r,y]);return jsxs(i,{gap:2,width:1,children:[h&&jsx(u,{variant:"overline",color:"text.secondary",children:h}),s&&jsxs(i,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",gap:1,children:[jsx(H,{label:"Selecionar todos",control:jsx(B,{checked:j,onChange:z}),componentsProps:{typography:{color:"text.secondary",ml:.5,sx:{fontSize:"12px !important"}}}}),m>0&&jsxs(u,{variant:"caption",color:"text.secondary",children:[jsx("strong",{children:r.length})," de ",jsx("strong",{children:m})," ","selecionados"]})]}),(f||g)&&jsxs(i,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",gap:1,children:[jsx(i,{maxWidth:280,flex:1,children:f&&jsx(a$1,{onSearch:f,trigger:"click",size:"small",fullWidth:!0,placeholder:"Buscar",iconPosition:"start"})}),g&&jsx(a$2,{actionType:"NEW",onClick:g,size:"small",variant:"text",children:"Adicionar"})]}),jsx(i,{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr"},gap:1,children:jsx(a$3,{isFetching:S,fetching:v||jsx(a$4,{}),isLoading:b,loading:O||$,children:l.map(e=>jsxs(A,{minHeight:48,justifyContent:"center",p:1.5,children:[e.startContent&&jsx(i,{children:e.startContent}),jsx(H,{label:e.label,control:E(e),componentsProps:{typography:{ml:.5}}})]},e.value))})}),k&&jsx(D,{error:N,children:k}),!b&&!S&&l.length===0&&(M||jsx(u,{variant:"body1",color:"text.secondary",align:"center",my:3,children:"Nenhum resultado encontrado"})),n&&C>1&&jsx(G,{page:n.page+1,count:C,onChange:(e,a)=>n.onChange(a-1,n.perPage),variant:"soft",sx:{mx:"auto"}})]})},me=q;
|
|
18
|
-
|
|
19
|
-
export { me as a };
|
|
20
|
-
//# sourceMappingURL=chunk-ODYYZSIQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SelectList/index.tsx","../src/components/SelectList/styles.ts"],"names":["useCallback","useMemo","Checkbox","FormControlLabel","FormHelperText","Pagination","Radio","Stack","Typography","styled","OptionItem","theme","jsx","jsxs","LOADING_SKELETON","_","i","Skeleton_default","SelectList","value","multiple","options","onChange","pagination","onSearch","onAdd","total","label","loading","loadingView","fetching","fetchingView","emptyView","error","helperText","isMultiple","totalPages","availableValues","o","allItemsSelected","v","toggleAll","selectableValues","allSelected","handleSelect","optionValue","checked","renderControl","option","SearchInput_default","ActionButton_default","Result_default","FixedProgressBar_default","page","SelectList_default"],"mappings":"wMAAA,OAAS,eAAAA,EAAa,WAAAC,MAAe,QACrC,OAAOC,MAAc,yBACrB,OAAOC,MAAsB,iCAC7B,OAAOC,MAAoB,+BAC3B,OAAOC,MAAgB,2BACvB,OAAOC,MAAW,sBAClB,OAAOC,MAAW,sBAClB,OAAOC,MAAgB,2BCPvB,OAAOD,MAAW,sBAClB,OAAS,UAAAE,MAAc,uBAEhB,IAAMC,EAAaD,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AQ,QACR,MAAM,iBACN,MAAM,SACN,GAAI,EACL,uCAED,GAGHe,GAAca,EAAa,GAC1BxB,EAACP,EAAA,CACC,KAAMkB,EAAW,KAAO,EACxB,MAAOa,EACP,SAAU,CAACrB,EAAGsC,IACZ9B,EAAW,SAAS8B,EAAO,EAAG9B,EAAW,OAAO,EAElD,QAAQ,OACR,GAAI,CAAE,GAAI,MAAO,EACnB,GAEJ,CAEJ,EAEO+B,GAAQpC","sourcesContent":["import { useCallback, useMemo } from 'react';\nimport Checkbox from '@mui/material/Checkbox';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport Pagination from '@mui/material/Pagination';\nimport Radio from '@mui/material/Radio';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport ActionButton from 'components/ActionButton';\nimport FixedProgressBar from 'components/FixedProgressBar';\nimport Result from 'components/Result';\nimport SearchInput from 'components/SearchInput';\nimport Skeleton from 'components/Skeleton';\nimport { SelectListProps } from 'types/selectList';\n\nimport { OptionItem } from './styles';\n\nconst LOADING_SKELETON = Array.from({ length: 12 }, (_, i) => (\n <Skeleton key={i} height={48} />\n));\n\nconst SelectList = ({\n value,\n multiple,\n options,\n onChange,\n pagination,\n onSearch,\n onAdd,\n total = 0,\n label,\n loading,\n loadingView,\n fetching,\n fetchingView,\n emptyView,\n error,\n helperText,\n}: SelectListProps) => {\n const isMultiple = multiple && Array.isArray(value);\n const totalPages = useMemo(\n () => Math.ceil(total / (pagination?.perPage || 1)),\n [total, pagination?.perPage],\n );\n const availableValues = useMemo(() => options.map(o => o.value), [options]);\n const allItemsSelected =\n isMultiple && total > 0 && availableValues.every(v => value.includes(v));\n\n const toggleAll = useCallback(() => {\n if (!isMultiple) return;\n\n const selectableValues = options.filter(o => !o.disabled).map(o => o.value);\n const allSelected = selectableValues.every(v => value.includes(v));\n\n onChange(\n allSelected\n ? value.filter(v => !selectableValues.includes(v))\n : [...value, ...selectableValues.filter(v => !value.includes(v))],\n );\n }, [isMultiple, value, onChange, options]);\n\n const handleSelect = useCallback(\n (optionValue: string, checked: boolean) => {\n if (!isMultiple) {\n onChange(optionValue);\n return;\n }\n\n onChange(\n checked\n ? [...value, optionValue]\n : value.filter(v => v !== optionValue),\n );\n },\n [isMultiple, value, onChange],\n );\n\n const renderControl = useCallback(\n (option: SelectListProps['options'][number]) =>\n isMultiple ? (\n <Checkbox\n checked={value.includes(option.value)}\n onChange={(_, checked) => handleSelect(option.value, checked)}\n disabled={option.disabled}\n />\n ) : (\n <Radio\n checked={value === option.value}\n onChange={() => handleSelect(option.value, true)}\n disabled={option.disabled}\n />\n ),\n [isMultiple, value, handleSelect],\n );\n\n return (\n <Stack gap={2} width={1}>\n {label && (\n <Typography variant=\"overline\" color=\"text.secondary\">\n {label}\n </Typography>\n )}\n\n {isMultiple && (\n <Stack\n direction={{ xs: 'column', sm: 'row' }}\n alignItems={{ xs: 'flex-start', sm: 'center' }}\n justifyContent=\"space-between\"\n gap={1}\n >\n <FormControlLabel\n label=\"Selecionar todos\"\n control={\n <Checkbox checked={allItemsSelected} onChange={toggleAll} />\n }\n componentsProps={{\n typography: {\n color: 'text.secondary',\n ml: 0.5,\n sx: { fontSize: '12px !important' },\n },\n }}\n />\n\n {total > 0 && (\n <Typography variant=\"caption\" color=\"text.secondary\">\n <strong>{value.length}</strong> de <strong>{total}</strong>{' '}\n selecionados\n </Typography>\n )}\n </Stack>\n )}\n\n {(onSearch || onAdd) && (\n <Stack\n direction={{ xs: 'column', sm: 'row' }}\n alignItems={{ xs: 'flex-start', sm: 'center' }}\n justifyContent=\"space-between\"\n gap={1}\n >\n <Stack maxWidth={280} flex={1}>\n {onSearch && (\n <SearchInput\n onSearch={onSearch}\n trigger=\"click\"\n size=\"small\"\n fullWidth\n placeholder=\"Buscar\"\n iconPosition=\"start\"\n />\n )}\n </Stack>\n\n {onAdd && (\n <ActionButton\n actionType=\"NEW\"\n onClick={onAdd}\n size=\"small\"\n variant=\"text\"\n >\n Adicionar\n </ActionButton>\n )}\n </Stack>\n )}\n\n <Stack\n display=\"grid\"\n gridTemplateColumns={{ xs: '1fr', sm: '1fr 1fr' }}\n gap={1}\n >\n <Result\n isFetching={fetching}\n fetching={fetchingView || <FixedProgressBar />}\n isLoading={loading}\n loading={loadingView || LOADING_SKELETON}\n >\n {options.map(option => (\n <OptionItem\n key={option.value}\n minHeight={48}\n justifyContent=\"center\"\n p={1.5}\n >\n {option.startContent && <Stack>{option.startContent}</Stack>}\n <FormControlLabel\n label={option.label}\n control={renderControl(option)}\n componentsProps={{ typography: { ml: 0.5 } }}\n />\n </OptionItem>\n ))}\n </Result>\n </Stack>\n\n {helperText && (\n <FormHelperText error={error}>{helperText}</FormHelperText>\n )}\n\n {!loading &&\n !fetching &&\n options.length === 0 &&\n (emptyView || (\n <Typography\n variant=\"body1\"\n color=\"text.secondary\"\n align=\"center\"\n my={3}\n >\n Nenhum resultado encontrado\n </Typography>\n ))}\n\n {pagination && totalPages > 1 && (\n <Pagination\n page={pagination.page + 1}\n count={totalPages}\n onChange={(_, page) =>\n pagination.onChange(page - 1, pagination.perPage)\n }\n variant=\"soft\"\n sx={{ mx: 'auto' }}\n />\n )}\n </Stack>\n );\n};\n\nexport default SelectList;\n","import Stack from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\n\nexport const OptionItem = styled(Stack)(({ theme }) => ({\n flexDirection: 'row',\n minHeight: 48,\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n padding: theme.spacing(1.5, 0),\n borderBottom: `1px dashed ${theme.palette.divider}`,\n\n '& label': {\n marginInline: 0,\n userSelect: 'none',\n alignItems: 'flex-start',\n\n '& .MuiFormControlLabel-label': {\n minHeight: 36,\n display: 'flex',\n alignItems: 'center',\n },\n },\n}));\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|