@trsys-tech/matrix-library 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/breadcrumb.es.js +18 -19
- package/dist/breadcrumb.es.js.map +1 -1
- package/dist/button.es.js +16 -16
- package/dist/button.es.js.map +1 -1
- package/dist/calendar.es.js +21 -23
- package/dist/calendar.es.js.map +1 -1
- package/dist/checkbox.es.js +9 -10
- package/dist/checkbox.es.js.map +1 -1
- package/dist/chip.es.js +4 -4
- package/dist/chip.es.js.map +1 -1
- package/dist/command.es.js +1 -1
- package/dist/command.es.js.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/command/Command.d.ts.map +1 -1
- package/dist/components/context-menu/ContextMenu.d.ts.map +1 -1
- package/dist/components/data-grid/DataGrid.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DesktopDatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DesktopDateRangePicker.d.ts +2 -0
- package/dist/components/date-picker/DesktopDateRangePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DesktopTimePicker.d.ts +1 -0
- package/dist/components/date-picker/DesktopTimePicker.d.ts.map +1 -1
- package/dist/components/date-picker/MobileDatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/MobileDateRangePicker.d.ts +2 -0
- package/dist/components/date-picker/MobileDateRangePicker.d.ts.map +1 -1
- package/dist/components/date-picker/MobileTimePicker.d.ts +1 -0
- package/dist/components/date-picker/MobileTimePicker.d.ts.map +1 -1
- package/dist/components/date-picker/TimePicker.d.ts.map +1 -1
- package/dist/components/date-picker/calendar.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.d.ts +0 -1
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/form-combobox/FormCombobox.d.ts.map +1 -1
- package/dist/components/form-date-picker/FormDatePicker.d.ts +18 -0
- package/dist/components/form-date-picker/FormDatePicker.d.ts.map +1 -0
- package/dist/components/form-date-range-picker/FormDateRangePicker.d.ts +18 -0
- package/dist/components/form-date-range-picker/FormDateRangePicker.d.ts.map +1 -0
- package/dist/components/form-rating/FormRating.d.ts.map +1 -1
- package/dist/components/form-select/FormSelect.d.ts.map +1 -1
- package/dist/components/form-time-picker/FormTimePicker.d.ts +18 -0
- package/dist/components/form-time-picker/FormTimePicker.d.ts.map +1 -0
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/datagrid.es.js +66 -72
- package/dist/datagrid.es.js.map +1 -1
- package/dist/datepicker.es.js +8 -21
- package/dist/datepicker.es.js.map +1 -1
- package/dist/daterangepicker.es.js +7 -18
- package/dist/daterangepicker.es.js.map +1 -1
- package/dist/desktopdatepicker.es.js +35 -34
- package/dist/desktopdatepicker.es.js.map +1 -1
- package/dist/desktopdaterangepicker.es.js +40 -35
- package/dist/desktopdaterangepicker.es.js.map +1 -1
- package/dist/desktoptimepicker.es.js +23 -15
- package/dist/desktoptimepicker.es.js.map +1 -1
- package/dist/dialog.es.js +1 -1
- package/dist/dialog.es.js.map +1 -1
- package/dist/drawer.es.js +34 -43
- package/dist/drawer.es.js.map +1 -1
- package/dist/formcombobox.es.js +31 -33
- package/dist/formcombobox.es.js.map +1 -1
- package/dist/formdatepicker.es.js +29 -0
- package/dist/formdatepicker.es.js.map +1 -0
- package/dist/formdaterangepicker.es.js +29 -0
- package/dist/formdaterangepicker.es.js.map +1 -0
- package/dist/formrating.es.js +12 -12
- package/dist/formrating.es.js.map +1 -1
- package/dist/formselect.es.js +17 -17
- package/dist/formselect.es.js.map +1 -1
- package/dist/formtextarea.es.js +29 -0
- package/dist/formtextarea.es.js.map +1 -0
- package/dist/formtimepicker.es.js +29 -0
- package/dist/formtimepicker.es.js.map +1 -0
- package/dist/iconbutton.es.js +9 -9
- package/dist/iconbutton.es.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +144 -136
- package/dist/index.es.js.map +1 -1
- package/dist/mobiledatepicker.es.js +35 -34
- package/dist/mobiledatepicker.es.js.map +1 -1
- package/dist/mobiledaterangepicker.es.js +54 -49
- package/dist/mobiledaterangepicker.es.js.map +1 -1
- package/dist/mobiletimepicker.es.js +26 -18
- package/dist/mobiletimepicker.es.js.map +1 -1
- package/dist/modal.es.js +10 -10
- package/dist/modal.es.js.map +1 -1
- package/dist/multiselect.es.js +66 -69
- package/dist/multiselect.es.js.map +1 -1
- package/dist/radiogroup.es.js +1 -1
- package/dist/radiogroup.es.js.map +1 -1
- package/dist/rating.es.js +1 -1
- package/dist/rating.es.js.map +1 -1
- package/dist/select.es.js +24 -27
- package/dist/select.es.js.map +1 -1
- package/dist/sheet.es.js +1 -1
- package/dist/sheet.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/textarea.es.js +19 -0
- package/dist/textarea.es.js.map +1 -0
- package/dist/timepicker.es.js +8 -19
- package/dist/timepicker.es.js.map +1 -1
- package/dist/toast-components.es.js +2 -2
- package/dist/toast-components.es.js.map +1 -1
- package/package.json +4 -2
- package/dist/_commonjshelpers.es.js +0 -7
- package/dist/_commonjshelpers.es.js.map +0 -1
- package/dist/calendaricon.es.js +0 -8
- package/dist/calendaricon.es.js.map +0 -1
- package/dist/checkicon.es.js +0 -8
- package/dist/checkicon.es.js.map +0 -1
- package/dist/chevrondownicon.es.js +0 -8
- package/dist/chevrondownicon.es.js.map +0 -1
- package/dist/chevronlefticon.es.js +0 -8
- package/dist/chevronlefticon.es.js.map +0 -1
- package/dist/chevronrighticon.es.js +0 -8
- package/dist/chevronrighticon.es.js.map +0 -1
- package/dist/chevronsrighticon.es.js +0 -8
- package/dist/chevronsrighticon.es.js.map +0 -1
- package/dist/chevronupicon.es.js +0 -8
- package/dist/chevronupicon.es.js.map +0 -1
- package/dist/circleicon.es.js +0 -8
- package/dist/circleicon.es.js.map +0 -1
- package/dist/clonedeep.es.js +0 -18
- package/dist/clonedeep.es.js.map +0 -1
- package/dist/clonedeep.es2.js +0 -5
- package/dist/clonedeep.es2.js.map +0 -1
- package/dist/closecircleicon.es.js +0 -8
- package/dist/closecircleicon.es.js.map +0 -1
- package/dist/closeicon.es.js +0 -8
- package/dist/closeicon.es.js.map +0 -1
- package/dist/components/Icons/CalendarIcon.d.ts +0 -3
- package/dist/components/Icons/CalendarIcon.d.ts.map +0 -1
- package/dist/components/Icons/CheckIcon.d.ts +0 -3
- package/dist/components/Icons/CheckIcon.d.ts.map +0 -1
- package/dist/components/Icons/ChevronDownIcon.d.ts +0 -3
- package/dist/components/Icons/ChevronDownIcon.d.ts.map +0 -1
- package/dist/components/Icons/ChevronLeftIcon.d.ts +0 -3
- package/dist/components/Icons/ChevronLeftIcon.d.ts.map +0 -1
- package/dist/components/Icons/ChevronRightIcon.d.ts +0 -3
- package/dist/components/Icons/ChevronRightIcon.d.ts.map +0 -1
- package/dist/components/Icons/ChevronUpIcon.d.ts +0 -3
- package/dist/components/Icons/ChevronUpIcon.d.ts.map +0 -1
- package/dist/components/Icons/ChevronsRightIcon.d.ts +0 -3
- package/dist/components/Icons/ChevronsRightIcon.d.ts.map +0 -1
- package/dist/components/Icons/CircleIcon.d.ts +0 -3
- package/dist/components/Icons/CircleIcon.d.ts.map +0 -1
- package/dist/components/Icons/CloseCircleIcon.d.ts +0 -3
- package/dist/components/Icons/CloseCircleIcon.d.ts.map +0 -1
- package/dist/components/Icons/CloseIcon.d.ts +0 -3
- package/dist/components/Icons/CloseIcon.d.ts.map +0 -1
- package/dist/components/Icons/ElipsisHorizontal.d.ts +0 -3
- package/dist/components/Icons/ElipsisHorizontal.d.ts.map +0 -1
- package/dist/components/Icons/ElipsisVerticalIcon.d.ts +0 -3
- package/dist/components/Icons/ElipsisVerticalIcon.d.ts.map +0 -1
- package/dist/components/Icons/HomeIcon.d.ts +0 -3
- package/dist/components/Icons/HomeIcon.d.ts.map +0 -1
- package/dist/components/Icons/MinusIcon.d.ts +0 -3
- package/dist/components/Icons/MinusIcon.d.ts.map +0 -1
- package/dist/components/Icons/PlusIcon.d.ts +0 -3
- package/dist/components/Icons/PlusIcon.d.ts.map +0 -1
- package/dist/components/Icons/PrintIcon.d.ts +0 -3
- package/dist/components/Icons/PrintIcon.d.ts.map +0 -1
- package/dist/components/Icons/RefreshIcon.d.ts +0 -3
- package/dist/components/Icons/RefreshIcon.d.ts.map +0 -1
- package/dist/components/Icons/SearchIcon.d.ts +0 -3
- package/dist/components/Icons/SearchIcon.d.ts.map +0 -1
- package/dist/components/Icons/SnowflakeIcon.d.ts +0 -3
- package/dist/components/Icons/SnowflakeIcon.d.ts.map +0 -1
- package/dist/components/Icons/SpinnerIcon.d.ts +0 -3
- package/dist/components/Icons/SpinnerIcon.d.ts.map +0 -1
- package/dist/components/Icons/StartIcon.d.ts +0 -3
- package/dist/components/Icons/StartIcon.d.ts.map +0 -1
- package/dist/components/Icons/TrashcanIcon.d.ts +0 -3
- package/dist/components/Icons/TrashcanIcon.d.ts.map +0 -1
- package/dist/config.es.js +0 -1066
- package/dist/config.es.js.map +0 -1
- package/dist/default-theme.es.js +0 -22
- package/dist/default-theme.es.js.map +0 -1
- package/dist/default-theme.es2.js +0 -5
- package/dist/default-theme.es2.js.map +0 -1
- package/dist/defaulttheme.es.js +0 -10
- package/dist/defaulttheme.es.js.map +0 -1
- package/dist/elipsishorizontal.es.js +0 -8
- package/dist/elipsishorizontal.es.js.map +0 -1
- package/dist/elipsisverticalicon.es.js +0 -8
- package/dist/elipsisverticalicon.es.js.map +0 -1
- package/dist/minusicon.es.js +0 -8
- package/dist/minusicon.es.js.map +0 -1
- package/dist/printicon.es.js +0 -8
- package/dist/printicon.es.js.map +0 -1
- package/dist/refreshicon.es.js +0 -8
- package/dist/refreshicon.es.js.map +0 -1
- package/dist/searchicon.es.js +0 -8
- package/dist/searchicon.es.js.map +0 -1
- package/dist/snowflakeicon.es.js +0 -8
- package/dist/snowflakeicon.es.js.map +0 -1
- package/dist/spinnericon.es.js +0 -18
- package/dist/spinnericon.es.js.map +0 -1
- package/dist/starticon.es.js +0 -23
- package/dist/starticon.es.js.map +0 -1
- package/dist/trashcanicon.es.js +0 -6
- package/dist/trashcanicon.es.js.map +0 -1
package/dist/drawer.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.es.js","sources":["../src/components/drawer/Drawer.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\nimport defaultTheme from \"tailwindcss/defaultTheme\";\r\nimport { createContextScope, Scope } from \"@radix-ui/react-context\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Modal } from \"../modal/Modal\";\r\nimport { IconButton } from \"../icon-botton/IconButton\";\r\nimport { ChevronsRightIcon } from \"../Icons/ChevronsRightIcon\";\r\n\r\ntype ScopedProps<P> = P & { __scopeDrawer?: Scope };\r\n\r\nconst DRAWER_NAME = \"Drawer\";\r\n\r\nconst [createDrawerContext] = createContextScope(DRAWER_NAME);\r\n\r\ninterface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {\r\n open: boolean;\r\n onClose?: () => void;\r\n anchor?: \"left\" | \"right\";\r\n width?: number;\r\n children?: React.ReactNode;\r\n asChild?: boolean;\r\n mobileBreakpoint?: number;\r\n}\r\n\r\ntype DrawerContextValue = {\r\n open: boolean;\r\n onClose?: () => void;\r\n anchor: \"left\" | \"right\";\r\n width: number;\r\n isMobile: boolean;\r\n};\r\n\r\nconst [DrawerProvider, useDrawerProvider] = createDrawerContext<DrawerContextValue>(DRAWER_NAME);\r\n\r\n/**\r\n * Drawer component\r\n * This is the wrapper component for Drawer content and main components\r\n * @param {React.HTMLAttributes<HTMLDivElement>} props\r\n * @param {boolean} open - Drawer open state\r\n * @param {() => void} onClose - Drawer close handler\r\n * @param {\"left\" | \"right\"} anchor - Drawer anchor position\r\n * @param {number} width - Drawer width\r\n * @param {React.ReactNode} children - Drawer children\r\n * @param {boolean} asChild - Render as child component\r\n * @param {number} mobileBreakpoint - Mobile breakpoint\r\n * @returns {React.ReactElement}\r\n */\r\nconst Drawer = React.forwardRef<React.ElementRef<\"div\">, ScopedProps<DrawerProps>>((props, ref) => {\r\n const { asChild, anchor = \"right\", children, open, width = 240, className, onClose, __scopeDrawer, mobileBreakpoint, ...restProps } = props;\r\n const Comp = asChild ? Slot : \"div\";\r\n\r\n // re render to show proper modal on resize\r\n const [windowSize, setWindowSize] = React.useState(0);\r\n React.useEffect(() => {\r\n const observer = new ResizeObserver(() => {\r\n setWindowSize(window.innerWidth);\r\n });\r\n\r\n observer.observe(document.documentElement);\r\n\r\n return () => {\r\n observer.disconnect();\r\n };\r\n }, []);\r\n\r\n const isMobile = React.useMemo(() => {\r\n if (window !== undefined) {\r\n if (mobileBreakpoint) {\r\n return !window?.matchMedia?.(`(min-width: ${mobileBreakpoint})`)?.matches;\r\n }\r\n return !window?.matchMedia?.(`(min-width: ${defaultTheme.screens.md})`)?.matches;\r\n }\r\n return false;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [mobileBreakpoint, windowSize]);\r\n\r\n return (\r\n <Comp ref={ref} className={cn(\"flex\", className)} {...restProps}>\r\n <DrawerProvider anchor={anchor} onClose={onClose} open={open} width={width} isMobile={isMobile} scope={__scopeDrawer}>\r\n {children}\r\n </DrawerProvider>\r\n </Comp>\r\n );\r\n});\r\n\r\nDrawer.displayName = DRAWER_NAME;\r\n\r\ninterface DrawerMainProps extends React.HTMLAttributes<HTMLDivElement> {\r\n asChild: boolean;\r\n}\r\n\r\nconst DRAWER_MAIN_NAME = \"DrawerMain\";\r\n\r\n/**\r\n * DrawerMain component\r\n * This is the main container for the tree that should be shown always\r\n * @param {React.HTMLAttributes<HTMLDivElement>} props\r\n * @param {boolean} asChild - Render as child component\r\n * @property {React.ReactNode} children - DrawerMain children\r\n * @property {string} className - DrawerMain class name\r\n * @property {React.CSSProperties} style - DrawerMain style\r\n * @property {ScopedProps<DrawerMainProps>} __scopeDrawer - DrawerMain scope\r\n * @property {React.Ref<HTMLDivElement>} ref - DrawerMain ref\r\n * @property {React.HTMLAttributes<HTMLDivElement>} props - DrawerMain props\r\n * @returns {React.ReactElement}\r\n */\r\nconst DrawerMain = React.forwardRef<HTMLDivElement, ScopedProps<DrawerMainProps>>(\r\n ({ asChild, children, className, style, __scopeDrawer, ...props }, ref) => {\r\n const Comp = asChild ? Slot : \"div\";\r\n const { anchor, open, width, isMobile } = useDrawerProvider(DRAWER_MAIN_NAME, __scopeDrawer);\r\n\r\n const marginStyle = React.useMemo(() => {\r\n if (isMobile) {\r\n return {};\r\n }\r\n if (anchor === \"left\") {\r\n return { marginInlineStart: open ? width : 0 };\r\n } else {\r\n return { marginInlineEnd: open ? width : 0 };\r\n }\r\n }, [anchor, open, width, isMobile]);\r\n\r\n return (\r\n <Comp ref={ref} className={cn(\"flex-grow overflow-hidden\", className)} style={{ ...style, ...marginStyle }} {...props}>\r\n {children}\r\n </Comp>\r\n );\r\n },\r\n);\r\n\r\nDrawerMain.displayName = DRAWER_MAIN_NAME;\r\n\r\ntype DrawerContentProps = {\r\n children?: React.ReactNode;\r\n title: React.ReactNode;\r\n};\r\n\r\nconst DRAWER_CONTENT_NAME = \"DrawerContent\";\r\n\r\n/**\r\n * DrawerContent component\r\n * This is the content container for the tree that should be shown when the drawer is open\r\n * @param {React.HTMLAttributes<HTMLDivElement>} props\r\n * @param {React.ReactNode} children - DrawerContent children\r\n * @param {React.ReactNode} title - DrawerContent title\r\n * @property {ScopedProps<DrawerContentProps>} __scopeDrawer - DrawerContent scope\r\n * @property {React.Ref<HTMLDivElement>} ref - DrawerContent ref\r\n * @property {React.HTMLAttributes<HTMLDivElement>} props - DrawerContent props\r\n * @returns {React.ReactElement}\r\n */\r\nconst DrawerContent = React.forwardRef<HTMLDivElement, ScopedProps<DrawerContentProps>>(({ children, title, __scopeDrawer }, ref) => {\r\n const { anchor, open, width, onClose, isMobile } = useDrawerProvider(DRAWER_CONTENT_NAME, __scopeDrawer);\r\n\r\n return (\r\n <>\r\n {isMobile ? (\r\n <Modal title={title} open={open} onOpenChange={onClose} ref={ref} fullScreen>\r\n {children}\r\n </Modal>\r\n ) : (\r\n <div className={cn(\"hidden md:block overflow-hidden\")} style={{ width }} ref={ref}>\r\n <div\r\n className={cn(\r\n \"overflow-y-auto flex flex-col h-full top-0 z-[120] bg-background transition-all border-gray-200\",\r\n open ? \"\" : anchor === \"left\" ? \"-translate-x-full rtl:translate-x-full invisible\" : \"translate-x-full rtl:-translate-x-full invisible\",\r\n anchor === \"left\" ? \"border-r\" : \"border-l\",\r\n )}\r\n >\r\n <div\r\n className={cn(\r\n \"h-9 flex items-center gap-2 p-2 bg-background w-full sticky top-0 border-b border-gray-200\",\r\n anchor === \"right\" ? \"justify-start rtl:justify-end\" : \"justify-end rtl:justify-start\",\r\n )}\r\n >\r\n <IconButton onClick={onClose} className=\"w-5 h-5 p-0\">\r\n <ChevronsRightIcon className={cn(\"w-5 h-5\", anchor === \"right\" ? \"rtl:-scale-100\" : \"-scale-100 rtl:scale-100\")} />\r\n </IconButton>\r\n {typeof title === \"string\" || typeof title === \"number\" ? <h2 className=\"text-lg font-bold text-text\">{title}</h2> : title}\r\n </div>\r\n {children}\r\n </div>\r\n </div>\r\n )}\r\n </>\r\n );\r\n});\r\n\r\nDrawerContent.displayName = DRAWER_CONTENT_NAME;\r\n\r\nconst Root = Drawer;\r\nconst Main = DrawerMain;\r\nconst Content = DrawerContent;\r\n\r\nexport { Drawer, DrawerMain, DrawerContent, Root, Main, Content };\r\nexport type { DrawerContentProps, DrawerMainProps, DrawerProps };\r\n"],"names":["DRAWER_NAME","createDrawerContext","createContextScope","DrawerProvider","useDrawerProvider","Drawer","React","props","ref","asChild","anchor","children","open","width","className","onClose","__scopeDrawer","mobileBreakpoint","restProps","Comp","Slot","windowSize","setWindowSize","observer","isMobile","defaultTheme","jsx","cn","DRAWER_MAIN_NAME","DrawerMain","style","marginStyle","DRAWER_CONTENT_NAME","DrawerContent","title","Fragment","Modal","jsxs","IconButton","ChevronsRightIcon"],"mappings":";;;;;;;;;AAcA,MAAMA,IAAc,UAEd,CAACC,CAAmB,IAAIC,EAAmBF,CAAW,GAoBtD,CAACG,GAAgBC,CAAiB,IAAIH,EAAwCD,CAAW,GAezFK,IAASC,EAAM,WAA8D,CAACC,GAAOC,MAAQ;AACjG,QAAM,EAAE,SAAAC,GAAS,QAAAC,IAAS,SAAS,UAAAC,GAAU,MAAAC,GAAM,OAAAC,IAAQ,KAAK,WAAAC,GAAW,SAAAC,GAAS,eAAAC,GAAe,kBAAAC,GAAkB,GAAGC,EAAc,IAAAX,GAChIY,IAAOV,IAAUW,IAAO,OAGxB,CAACC,GAAYC,CAAa,IAAIhB,EAAM,SAAS,CAAC;AACpD,EAAAA,EAAM,UAAU,MAAM;AACd,UAAAiB,IAAW,IAAI,eAAe,MAAM;AACxC,MAAAD,EAAc,OAAO,UAAU;AAAA,IAAA,CAChC;AAEQ,WAAAC,EAAA,QAAQ,SAAS,eAAe,GAElC,MAAM;AACX,MAAAA,EAAS,WAAW;AAAA,IACtB;AAAA,EACF,GAAG,EAAE;AAEC,QAAAC,IAAWlB,EAAM,QAAQ,MACzB,WAAW,SACTW,IACK,CAAC,QAAQ,aAAa,eAAeA,CAAgB,GAAG,GAAG,UAE7D,CAAC,QAAQ,aAAa,eAAeQ,EAAa,QAAQ,EAAE,GAAG,GAAG,UAEpE,IAEN,CAACR,GAAkBI,CAAU,CAAC;AAG/B,SAAA,gBAAAK,EAACP,KAAK,KAAAX,GAAU,WAAWmB,EAAG,QAAQb,CAAS,GAAI,GAAGI,GACpD,4BAACf,GAAe,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I,EAAA,WAAWC,EAAG,iCAAiC,GAAG,OAAO,EAAE,OAAAd,EAAM,GAAG,KAAAL,GACvE,UAAA,gBAAA6B;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWV;AAAA,QACT;AAAA,QACAf,IAAO,KAAKF,MAAW,SAAS,qDAAqD;AAAA,QACrFA,MAAW,SAAS,aAAa;AAAA,MACnC;AAAA,MAEA,UAAA;AAAA,QAAA,gBAAA2B;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWV;AAAA,cACT;AAAA,cACAjB,MAAW,UAAU,kCAAkC;AAAA,YACzD;AAAA,YAEA,UAAA;AAAA,cAAA,gBAAAgB,EAACY,GAAW,EAAA,SAASvB,GAAS,WAAU,eACtC,UAAC,gBAAAW,EAAAa,GAAA,EAAkB,WAAWZ,EAAG,WAAWjB,MAAW,UAAU,mBAAmB,0BAA0B,EAAG,CAAA,GACnH;AAAA,cACC,OAAOwB,KAAU,YAAY,OAAOA,KAAU,WAAW,gBAAAR,EAAC,MAAG,EAAA,WAAU,+BAA+B,UAAAQ,EAAM,CAAA,IAAQA;AAAA,YAAA;AAAA,UAAA;AAAA,QACvH;AAAA,QACCvB;AAAA,MAAA;AAAA,IAAA;AAAA,KAEL,EAEJ,CAAA;AAEJ,CAAC;AAEDsB,EAAc,cAAcD;"}
|
|
1
|
+
{"version":3,"file":"drawer.es.js","sources":["../src/components/drawer/Drawer.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\nimport { Slot } from \"@radix-ui/react-slot\";\r\nimport { ChevronsRight } from \"@trsys-tech/matrix-icons\";\r\nimport { createContextScope, Scope } from \"@radix-ui/react-context\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Modal } from \"../modal/Modal\";\r\nimport { IconButton } from \"../icon-botton/IconButton\";\r\nimport { useIsMobile } from \"../../lib/hooks/use-mobile\";\r\n\r\ntype ScopedProps<P> = P & { __scopeDrawer?: Scope };\r\n\r\nconst DRAWER_NAME = \"Drawer\";\r\n\r\nconst [createDrawerContext] = createContextScope(DRAWER_NAME);\r\n\r\ninterface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {\r\n open: boolean;\r\n onClose?: () => void;\r\n anchor?: \"left\" | \"right\";\r\n width?: number;\r\n children?: React.ReactNode;\r\n asChild?: boolean;\r\n mobileBreakpoint?: number;\r\n}\r\n\r\ntype DrawerContextValue = {\r\n open: boolean;\r\n onClose?: () => void;\r\n anchor: \"left\" | \"right\";\r\n width: number;\r\n isMobile: boolean;\r\n};\r\n\r\nconst [DrawerProvider, useDrawerProvider] = createDrawerContext<DrawerContextValue>(DRAWER_NAME);\r\n\r\n/**\r\n * Drawer component\r\n * This is the wrapper component for Drawer content and main components\r\n * @param {React.HTMLAttributes<HTMLDivElement>} props\r\n * @param {boolean} open - Drawer open state\r\n * @param {() => void} onClose - Drawer close handler\r\n * @param {\"left\" | \"right\"} anchor - Drawer anchor position\r\n * @param {number} width - Drawer width\r\n * @param {React.ReactNode} children - Drawer children\r\n * @param {boolean} asChild - Render as child component\r\n * @returns {React.ReactElement}\r\n */\r\nconst Drawer = React.forwardRef<React.ElementRef<\"div\">, ScopedProps<DrawerProps>>((props, ref) => {\r\n const { asChild, anchor = \"right\", children, open, width = 240, className, onClose, __scopeDrawer, ...restProps } = props;\r\n const Comp = asChild ? Slot : \"div\";\r\n\r\n const isMobile = useIsMobile();\r\n\r\n return (\r\n <Comp ref={ref} className={cn(\"flex\", className)} {...restProps}>\r\n <DrawerProvider anchor={anchor} onClose={onClose} open={open} width={width} isMobile={isMobile} scope={__scopeDrawer}>\r\n {children}\r\n </DrawerProvider>\r\n </Comp>\r\n );\r\n});\r\n\r\nDrawer.displayName = DRAWER_NAME;\r\n\r\ninterface DrawerMainProps extends React.HTMLAttributes<HTMLDivElement> {\r\n asChild: boolean;\r\n}\r\n\r\nconst DRAWER_MAIN_NAME = \"DrawerMain\";\r\n\r\n/**\r\n * DrawerMain component\r\n * This is the main container for the tree that should be shown always\r\n * @param {React.HTMLAttributes<HTMLDivElement>} props\r\n * @param {boolean} asChild - Render as child component\r\n * @property {React.ReactNode} children - DrawerMain children\r\n * @property {string} className - DrawerMain class name\r\n * @property {React.CSSProperties} style - DrawerMain style\r\n * @property {ScopedProps<DrawerMainProps>} __scopeDrawer - DrawerMain scope\r\n * @property {React.Ref<HTMLDivElement>} ref - DrawerMain ref\r\n * @property {React.HTMLAttributes<HTMLDivElement>} props - DrawerMain props\r\n * @returns {React.ReactElement}\r\n */\r\nconst DrawerMain = React.forwardRef<HTMLDivElement, ScopedProps<DrawerMainProps>>(\r\n ({ asChild, children, className, style, __scopeDrawer, ...props }, ref) => {\r\n const Comp = asChild ? Slot : \"div\";\r\n const { anchor, open, width, isMobile } = useDrawerProvider(DRAWER_MAIN_NAME, __scopeDrawer);\r\n\r\n const marginStyle = React.useMemo(() => {\r\n if (isMobile) {\r\n return {};\r\n }\r\n if (anchor === \"left\") {\r\n return { marginInlineStart: open ? width : 0 };\r\n } else {\r\n return { marginInlineEnd: open ? width : 0 };\r\n }\r\n }, [anchor, open, width, isMobile]);\r\n\r\n return (\r\n <Comp ref={ref} className={cn(\"flex-grow overflow-hidden\", className)} style={{ ...style, ...marginStyle }} {...props}>\r\n {children}\r\n </Comp>\r\n );\r\n },\r\n);\r\n\r\nDrawerMain.displayName = DRAWER_MAIN_NAME;\r\n\r\ntype DrawerContentProps = {\r\n children?: React.ReactNode;\r\n title: React.ReactNode;\r\n};\r\n\r\nconst DRAWER_CONTENT_NAME = \"DrawerContent\";\r\n\r\n/**\r\n * DrawerContent component\r\n * This is the content container for the tree that should be shown when the drawer is open\r\n * @param {React.HTMLAttributes<HTMLDivElement>} props\r\n * @param {React.ReactNode} children - DrawerContent children\r\n * @param {React.ReactNode} title - DrawerContent title\r\n * @property {ScopedProps<DrawerContentProps>} __scopeDrawer - DrawerContent scope\r\n * @property {React.Ref<HTMLDivElement>} ref - DrawerContent ref\r\n * @property {React.HTMLAttributes<HTMLDivElement>} props - DrawerContent props\r\n * @returns {React.ReactElement}\r\n */\r\nconst DrawerContent = React.forwardRef<HTMLDivElement, ScopedProps<DrawerContentProps>>(({ children, title, __scopeDrawer }, ref) => {\r\n const { anchor, open, width, onClose, isMobile } = useDrawerProvider(DRAWER_CONTENT_NAME, __scopeDrawer);\r\n\r\n return (\r\n <>\r\n {isMobile ? (\r\n <Modal title={title} open={open} onOpenChange={onClose} ref={ref} fullScreen>\r\n {children}\r\n </Modal>\r\n ) : (\r\n <div className={cn(\"hidden md:block overflow-hidden\")} style={{ width }} ref={ref}>\r\n <div\r\n className={cn(\r\n \"overflow-y-auto flex flex-col h-full top-0 z-[120] bg-background transition-all border-gray-200\",\r\n open ? \"\" : anchor === \"left\" ? \"-translate-x-full rtl:translate-x-full invisible\" : \"translate-x-full rtl:-translate-x-full invisible\",\r\n anchor === \"left\" ? \"border-r\" : \"border-l\",\r\n )}\r\n >\r\n <div\r\n className={cn(\r\n \"h-9 flex items-center gap-2 p-2 bg-background w-full sticky top-0 border-b border-gray-200\",\r\n anchor === \"right\" ? \"justify-start rtl:justify-end\" : \"justify-end rtl:justify-start\",\r\n )}\r\n >\r\n <IconButton onClick={onClose} className=\"w-5 h-5 p-0\">\r\n <ChevronsRight className={cn(\"w-5 h-5\", anchor === \"right\" ? \"rtl:-scale-100\" : \"-scale-100 rtl:scale-100\")} />\r\n </IconButton>\r\n {typeof title === \"string\" || typeof title === \"number\" ? <h2 className=\"text-lg font-bold text-text\">{title}</h2> : title}\r\n </div>\r\n {children}\r\n </div>\r\n </div>\r\n )}\r\n </>\r\n );\r\n});\r\n\r\nDrawerContent.displayName = DRAWER_CONTENT_NAME;\r\n\r\nconst Root = Drawer;\r\nconst Main = DrawerMain;\r\nconst Content = DrawerContent;\r\n\r\nexport { Drawer, DrawerMain, DrawerContent, Root, Main, Content };\r\nexport type { DrawerContentProps, DrawerMainProps, DrawerProps };\r\n"],"names":["DRAWER_NAME","createDrawerContext","createContextScope","DrawerProvider","useDrawerProvider","Drawer","React","props","ref","asChild","anchor","children","open","width","className","onClose","__scopeDrawer","restProps","Comp","Slot","isMobile","useIsMobile","jsx","cn","DRAWER_MAIN_NAME","DrawerMain","style","marginStyle","DRAWER_CONTENT_NAME","DrawerContent","title","Fragment","Modal","jsxs","IconButton","ChevronsRight"],"mappings":";;;;;;;;;AAcA,MAAMA,IAAc,UAEd,CAACC,CAAmB,IAAIC,EAAmBF,CAAW,GAoBtD,CAACG,GAAgBC,CAAiB,IAAIH,EAAwCD,CAAW,GAczFK,IAASC,EAAM,WAA8D,CAACC,GAAOC,MAAQ;AACjG,QAAM,EAAE,SAAAC,GAAS,QAAAC,IAAS,SAAS,UAAAC,GAAU,MAAAC,GAAM,OAAAC,IAAQ,KAAK,WAAAC,GAAW,SAAAC,GAAS,eAAAC,GAAe,GAAGC,EAAc,IAAAV,GAC9GW,IAAOT,IAAUU,IAAO,OAExBC,IAAWC,EAAY;AAG3B,SAAA,gBAAAC,EAACJ,KAAK,KAAAV,GAAU,WAAWe,EAAG,QAAQT,CAAS,GAAI,GAAGG,GACpD,4BAACd,GAAe,EAAA,QAAAO,GAAgB,SAAAK,GAAkB,MAAAH,GAAY,OAAAC,GAAc,UAAAO,GAAoB,OAAOJ,GACpG,UAAAL,GACH,EACF,CAAA;AAEJ,CAAC;AAEDN,EAAO,cAAcL;AAMrB,MAAMwB,IAAmB,cAenBC,IAAanB,EAAM;AAAA,EACvB,CAAC,EAAE,SAAAG,GAAS,UAAAE,GAAU,WAAAG,GAAW,OAAAY,GAAO,eAAAV,GAAe,GAAGT,EAAM,GAAGC,MAAQ;AACnE,UAAAU,IAAOT,IAAUU,IAAO,OACxB,EAAE,QAAAT,GAAQ,MAAAE,GAAM,OAAAC,GAAO,UAAAO,MAAahB,EAAkBoB,GAAkBR,CAAa,GAErFW,IAAcrB,EAAM,QAAQ,MAC5Bc,IACK,CAAC,IAENV,MAAW,SACN,EAAE,mBAAmBE,IAAOC,IAAQ,EAAE,IAEtC,EAAE,iBAAiBD,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A,cACC,OAAOoB,KAAU,YAAY,OAAOA,KAAU,WAAW,gBAAAR,EAAC,MAAG,EAAA,WAAU,+BAA+B,UAAAQ,EAAM,CAAA,IAAQA;AAAA,YAAA;AAAA,UAAA;AAAA,QACvH;AAAA,QACCnB;AAAA,MAAA;AAAA,IAAA;AAAA,KAEL,EAEJ,CAAA;AAEJ,CAAC;AAEDkB,EAAc,cAAcD;"}
|
package/dist/formcombobox.es.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as w, useMemo as L, createElement as E } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronDown as M, Spinner as O, Check as V } from "@trsys-tech/matrix-icons";
|
|
4
|
+
import { useController as j } from "react-hook-form";
|
|
4
5
|
import { cn as i } from "./utils.es.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { Combobox as z, ComboboxTrigger as A, ComboboxContent as G, ComboboxInput as H, ComboboxList as J, ComboboxEmpty as K, ComboboxItem as P } from "./combobox.es.js";
|
|
10
|
-
import { ChevronDownIcon as Q } from "./chevrondownicon.es.js";
|
|
11
|
-
const to = (I) => {
|
|
6
|
+
import { Button as q } from "./button.es.js";
|
|
7
|
+
import { FormField as B, FormItem as D, FormLabel as U, FormControl as _, FormMessage as z } from "./form.es.js";
|
|
8
|
+
import { Combobox as A, ComboboxTrigger as G, ComboboxContent as H, ComboboxInput as J, ComboboxList as K, ComboboxEmpty as Q, ComboboxItem as P } from "./combobox.es.js";
|
|
9
|
+
const ro = (N) => {
|
|
12
10
|
const {
|
|
13
11
|
name: d,
|
|
14
12
|
control: b,
|
|
@@ -19,17 +17,17 @@ const to = (I) => {
|
|
|
19
17
|
label: f,
|
|
20
18
|
options: n,
|
|
21
19
|
loading: a,
|
|
22
|
-
loadingText:
|
|
23
|
-
emptyOptionsText:
|
|
24
|
-
placeholder:
|
|
20
|
+
loadingText: s,
|
|
21
|
+
emptyOptionsText: v,
|
|
22
|
+
placeholder: I,
|
|
25
23
|
slotProps: e,
|
|
26
24
|
required: h,
|
|
27
25
|
...y
|
|
28
|
-
} =
|
|
29
|
-
|
|
30
|
-
}, T = L(() => n.find((t) => t.value ===
|
|
26
|
+
} = N, { field: m } = j({ name: d, control: b, rules: u, defaultValue: p, disabled: l, shouldUnregister: x }), [F, g] = w(!1), S = (t) => {
|
|
27
|
+
m.onChange(t), g(!1);
|
|
28
|
+
}, T = L(() => n.find((t) => t.value === m.value), [m.value, n]);
|
|
31
29
|
return /* @__PURE__ */ o(
|
|
32
|
-
|
|
30
|
+
B,
|
|
33
31
|
{
|
|
34
32
|
control: b,
|
|
35
33
|
name: d,
|
|
@@ -37,14 +35,14 @@ const to = (I) => {
|
|
|
37
35
|
disabled: l,
|
|
38
36
|
rules: u,
|
|
39
37
|
shouldUnregister: x,
|
|
40
|
-
render: ({ field: t }) => /* @__PURE__ */ r(
|
|
41
|
-
/* @__PURE__ */ r(
|
|
38
|
+
render: ({ field: t }) => /* @__PURE__ */ r(D, { ...y, children: [
|
|
39
|
+
/* @__PURE__ */ r(U, { ...e?.formLabelProps ?? {}, children: [
|
|
42
40
|
f,
|
|
43
41
|
h && /* @__PURE__ */ o("span", { className: "text-danger text-sm", children: "*" })
|
|
44
42
|
] }),
|
|
45
|
-
/* @__PURE__ */ r(
|
|
46
|
-
/* @__PURE__ */ o(
|
|
47
|
-
|
|
43
|
+
/* @__PURE__ */ r(A, { ...e?.comboboxProps ?? {}, open: F, onOpenChange: g, children: [
|
|
44
|
+
/* @__PURE__ */ o(_, { children: /* @__PURE__ */ o(
|
|
45
|
+
G,
|
|
48
46
|
{
|
|
49
47
|
className: i("*:truncate [&>span]:inline-block", e?.comboboxTriggerProps?.className),
|
|
50
48
|
disabled: l ?? a,
|
|
@@ -52,7 +50,7 @@ const to = (I) => {
|
|
|
52
50
|
"aria-required": h,
|
|
53
51
|
...e?.comboboxTriggerProps ?? {},
|
|
54
52
|
children: /* @__PURE__ */ o(
|
|
55
|
-
|
|
53
|
+
q,
|
|
56
54
|
{
|
|
57
55
|
variant: "text",
|
|
58
56
|
...e?.comboboxValueProps ?? {},
|
|
@@ -61,7 +59,7 @@ const to = (I) => {
|
|
|
61
59
|
e?.comboboxValueProps?.className
|
|
62
60
|
),
|
|
63
61
|
endIcon: /* @__PURE__ */ o(
|
|
64
|
-
|
|
62
|
+
M,
|
|
65
63
|
{
|
|
66
64
|
role: "button",
|
|
67
65
|
"aria-label": "Expand dropdown",
|
|
@@ -69,18 +67,18 @@ const to = (I) => {
|
|
|
69
67
|
}
|
|
70
68
|
),
|
|
71
69
|
loading: a,
|
|
72
|
-
children: a &&
|
|
70
|
+
children: a && s ? /* @__PURE__ */ o("span", { className: "text-muted-foreground", children: s }) : T?.label || /* @__PURE__ */ o("span", { className: "text-muted-foreground", children: I || f })
|
|
73
71
|
}
|
|
74
72
|
)
|
|
75
73
|
}
|
|
76
74
|
) }),
|
|
77
|
-
/* @__PURE__ */ r(
|
|
78
|
-
/* @__PURE__ */ o(
|
|
79
|
-
/* @__PURE__ */ r(
|
|
80
|
-
a && /* @__PURE__ */ r(
|
|
81
|
-
/* @__PURE__ */ o(
|
|
75
|
+
/* @__PURE__ */ r(H, { ...e?.comboboxContentProps ?? {}, children: [
|
|
76
|
+
/* @__PURE__ */ o(J, { placeholder: "Search for a car..." }),
|
|
77
|
+
/* @__PURE__ */ r(K, { children: [
|
|
78
|
+
a && /* @__PURE__ */ r(Q, { children: [
|
|
79
|
+
/* @__PURE__ */ o(O, { className: "inline-block mb-0.5" }),
|
|
82
80
|
" ",
|
|
83
|
-
|
|
81
|
+
s || "Loading..."
|
|
84
82
|
] }),
|
|
85
83
|
!a && !n.length ? /* @__PURE__ */ o(
|
|
86
84
|
P,
|
|
@@ -88,7 +86,7 @@ const to = (I) => {
|
|
|
88
86
|
...e?.comboboxItemProps ?? {},
|
|
89
87
|
value: "8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee7564623",
|
|
90
88
|
disabled: !0,
|
|
91
|
-
children:
|
|
89
|
+
children: v || "No Items"
|
|
92
90
|
}
|
|
93
91
|
) : null,
|
|
94
92
|
n?.map(({ value: c, label: C }, k) => /* @__PURE__ */ E(
|
|
@@ -100,17 +98,17 @@ const to = (I) => {
|
|
|
100
98
|
onSelect: () => S(c)
|
|
101
99
|
},
|
|
102
100
|
C,
|
|
103
|
-
/* @__PURE__ */ o(
|
|
101
|
+
/* @__PURE__ */ o(V, { className: i("ml-auto", c === t.value ? "opacity-100" : "opacity-0") })
|
|
104
102
|
))
|
|
105
103
|
] })
|
|
106
104
|
] })
|
|
107
105
|
] }),
|
|
108
|
-
/* @__PURE__ */ o(
|
|
106
|
+
/* @__PURE__ */ o(z, { ...e?.formMessageProps ?? {} })
|
|
109
107
|
] })
|
|
110
108
|
}
|
|
111
109
|
);
|
|
112
110
|
};
|
|
113
111
|
export {
|
|
114
|
-
|
|
112
|
+
ro as FormCombobox
|
|
115
113
|
};
|
|
116
114
|
//# sourceMappingURL=formcombobox.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formcombobox.es.js","sources":["../src/components/form-combobox/FormCombobox.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\r\nimport { ControllerProps, FieldPath, FieldValues, useController } from \"react-hook-form\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { CheckIcon } from \"../Icons/CheckIcon\";\r\nimport { SpinnerIcon } from \"../Icons/SpinnerIcon\";\r\nimport { Button, ButtonProps } from \"../button/Button\";\r\nimport { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger } from \"../combobox/Combobox\";\r\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\r\n\r\ntype FormComboboxProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n options: { value: string | number; label: string | number }[];\r\n loading?: boolean;\r\n loadingText?: string;\r\n emptyOptionsText?: string;\r\n placeholder?: string;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n comboboxProps?: React.ComponentProps<typeof Combobox>;\r\n comboboxTriggerProps?: React.ComponentProps<typeof ComboboxTrigger>;\r\n comboboxValueProps?: ButtonProps;\r\n comboboxContentProps?: React.ComponentProps<typeof ComboboxContent>;\r\n comboboxItemProps?: React.ComponentProps<typeof ComboboxItem>;\r\n };\r\n };\r\n\r\nconst FormCombobox = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(\r\n props: FormComboboxProps<TFieldValues, TName>,\r\n) => {\r\n const {\r\n name,\r\n control,\r\n defaultValue,\r\n disabled,\r\n rules,\r\n shouldUnregister,\r\n label,\r\n options,\r\n loading,\r\n loadingText,\r\n emptyOptionsText,\r\n placeholder,\r\n slotProps,\r\n required,\r\n ...formItemProps\r\n } = props;\r\n\r\n const { field } = useController({ name, control, rules, defaultValue, disabled, shouldUnregister });\r\n const [open, setOpen] = useState(false);\r\n\r\n const handleChange = (value: string | number) => {\r\n field.onChange(value);\r\n setOpen(false);\r\n };\r\n\r\n const value = useMemo(() => options.find(option => option.value === field.value), [field.value, options]);\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm\">*</span>}\r\n </FormLabel>\r\n <Combobox {...(slotProps?.comboboxProps ?? {})} open={open} onOpenChange={setOpen}>\r\n <FormControl>\r\n <ComboboxTrigger\r\n className={cn(\"*:truncate [&>span]:inline-block\", slotProps?.comboboxTriggerProps?.className)}\r\n disabled={disabled ?? loading}\r\n asChild\r\n aria-required={required}\r\n {...(slotProps?.comboboxTriggerProps ?? {})}\r\n >\r\n <Button\r\n variant=\"text\"\r\n {...(slotProps?.comboboxValueProps ?? {})}\r\n className={cn(\r\n \"group flex h-9 w-full border text-sm border-gray-300 disabled:bg-gray-100\",\r\n slotProps?.comboboxValueProps?.className,\r\n )}\r\n endIcon={\r\n <ChevronDownIcon\r\n role=\"button\"\r\n aria-label=\"Expand dropdown\"\r\n className=\"ms-auto h-5 w-5 !text-muted-foreground cursor-pointer group-data-[state=open]:rotate-180 transition-transform\"\r\n />\r\n }\r\n loading={loading}\r\n >\r\n {loading && loadingText ? (\r\n <span className=\"text-muted-foreground\">{loadingText}</span>\r\n ) : (\r\n value?.label || <span className=\"text-muted-foreground\">{placeholder || label}</span>\r\n )}\r\n </Button>\r\n </ComboboxTrigger>\r\n </FormControl>\r\n <ComboboxContent {...(slotProps?.comboboxContentProps ?? {})}>\r\n <ComboboxInput placeholder=\"Search for a car...\" />\r\n <ComboboxList>\r\n {loading && (\r\n <ComboboxEmpty>\r\n <SpinnerIcon className=\"inline-block mb-0.5\" /> {loadingText || \"Loading...\"}\r\n </ComboboxEmpty>\r\n )}\r\n {!loading && !options.length ? (\r\n <ComboboxItem\r\n {...(slotProps?.comboboxItemProps ?? {})}\r\n value=\"8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee7564623\"\r\n disabled\r\n >\r\n {emptyOptionsText || \"No Items\"}\r\n </ComboboxItem>\r\n ) : null}\r\n {options?.map(({ value, label }, index) => (\r\n <ComboboxItem\r\n {...(slotProps?.comboboxItemProps ?? {})}\r\n value={String(value)}\r\n key={index + \"_\" + label}\r\n onSelect={() => handleChange(value)}\r\n >\r\n {label}\r\n <CheckIcon className={cn(\"ml-auto\", value === field.value ? \"opacity-100\" : \"opacity-0\")} />\r\n </ComboboxItem>\r\n ))}\r\n </ComboboxList>\r\n </ComboboxContent>\r\n </Combobox>\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormCombobox, type FormComboboxProps };\r\n"],"names":["FormCombobox","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","options","loading","loadingText","emptyOptionsText","placeholder","slotProps","required","formItemProps","field","useController","open","setOpen","useState","handleChange","value","useMemo","option","jsx","FormField","jsxs","FormItem","FormLabel","Combobox","FormControl","ComboboxTrigger","cn","Button","ChevronDownIcon","ComboboxContent","ComboboxInput","ComboboxList","ComboboxEmpty","SpinnerIcon","ComboboxItem","index","createElement","CheckIcon","FormMessage"],"mappings":";;;;;;;;;;AAkCM,MAAAA,KAAe,CACnBC,MACG;AACG,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDf,GAEE,EAAE,OAAAgB,EAAM,IAAIC,EAAc,EAAE,MAAAhB,GAAM,SAAAC,GAAS,OAAAG,GAAO,cAAAF,GAAc,UAAAC,GAAU,kBAAAE,GAAkB,GAC5F,CAACY,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAEhCC,IAAe,CAACC,MAA2B;AAC/C,IAAAN,EAAM,SAASM,CAAK,GACpBH,EAAQ,EAAK;AAAA,EACf,GAEMG,IAAQC,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C6B,GAAa,EAAA,GAAIhC,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"formcombobox.es.js","sources":["../src/components/form-combobox/FormCombobox.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\r\nimport { Check, ChevronDown, Spinner } from \"@trsys-tech/matrix-icons\";\r\nimport { ControllerProps, FieldPath, FieldValues, useController } from \"react-hook-form\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\nimport { Button, ButtonProps } from \"../button/Button\";\r\nimport { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger } from \"../combobox/Combobox\";\r\n\r\ntype FormComboboxProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n options: { value: string | number; label: string | number }[];\r\n loading?: boolean;\r\n loadingText?: string;\r\n emptyOptionsText?: string;\r\n placeholder?: string;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n comboboxProps?: React.ComponentProps<typeof Combobox>;\r\n comboboxTriggerProps?: React.ComponentProps<typeof ComboboxTrigger>;\r\n comboboxValueProps?: ButtonProps;\r\n comboboxContentProps?: React.ComponentProps<typeof ComboboxContent>;\r\n comboboxItemProps?: React.ComponentProps<typeof ComboboxItem>;\r\n };\r\n };\r\n\r\nconst FormCombobox = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(\r\n props: FormComboboxProps<TFieldValues, TName>,\r\n) => {\r\n const {\r\n name,\r\n control,\r\n defaultValue,\r\n disabled,\r\n rules,\r\n shouldUnregister,\r\n label,\r\n options,\r\n loading,\r\n loadingText,\r\n emptyOptionsText,\r\n placeholder,\r\n slotProps,\r\n required,\r\n ...formItemProps\r\n } = props;\r\n\r\n const { field } = useController({ name, control, rules, defaultValue, disabled, shouldUnregister });\r\n const [open, setOpen] = useState(false);\r\n\r\n const handleChange = (value: string | number) => {\r\n field.onChange(value);\r\n setOpen(false);\r\n };\r\n\r\n const value = useMemo(() => options.find(option => option.value === field.value), [field.value, options]);\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm\">*</span>}\r\n </FormLabel>\r\n <Combobox {...(slotProps?.comboboxProps ?? {})} open={open} onOpenChange={setOpen}>\r\n <FormControl>\r\n <ComboboxTrigger\r\n className={cn(\"*:truncate [&>span]:inline-block\", slotProps?.comboboxTriggerProps?.className)}\r\n disabled={disabled ?? loading}\r\n asChild\r\n aria-required={required}\r\n {...(slotProps?.comboboxTriggerProps ?? {})}\r\n >\r\n <Button\r\n variant=\"text\"\r\n {...(slotProps?.comboboxValueProps ?? {})}\r\n className={cn(\r\n \"group flex h-9 w-full border text-sm border-gray-300 disabled:bg-gray-100\",\r\n slotProps?.comboboxValueProps?.className,\r\n )}\r\n endIcon={\r\n <ChevronDown\r\n role=\"button\"\r\n aria-label=\"Expand dropdown\"\r\n className=\"ms-auto h-5 w-5 !text-muted-foreground cursor-pointer group-data-[state=open]:rotate-180 transition-transform\"\r\n />\r\n }\r\n loading={loading}\r\n >\r\n {loading && loadingText ? (\r\n <span className=\"text-muted-foreground\">{loadingText}</span>\r\n ) : (\r\n value?.label || <span className=\"text-muted-foreground\">{placeholder || label}</span>\r\n )}\r\n </Button>\r\n </ComboboxTrigger>\r\n </FormControl>\r\n <ComboboxContent {...(slotProps?.comboboxContentProps ?? {})}>\r\n <ComboboxInput placeholder=\"Search for a car...\" />\r\n <ComboboxList>\r\n {loading && (\r\n <ComboboxEmpty>\r\n <Spinner className=\"inline-block mb-0.5\" /> {loadingText || \"Loading...\"}\r\n </ComboboxEmpty>\r\n )}\r\n {!loading && !options.length ? (\r\n <ComboboxItem\r\n {...(slotProps?.comboboxItemProps ?? {})}\r\n value=\"8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee7564623\"\r\n disabled\r\n >\r\n {emptyOptionsText || \"No Items\"}\r\n </ComboboxItem>\r\n ) : null}\r\n {options?.map(({ value, label }, index) => (\r\n <ComboboxItem\r\n {...(slotProps?.comboboxItemProps ?? {})}\r\n value={String(value)}\r\n key={index + \"_\" + label}\r\n onSelect={() => handleChange(value)}\r\n >\r\n {label}\r\n <Check className={cn(\"ml-auto\", value === field.value ? \"opacity-100\" : \"opacity-0\")} />\r\n </ComboboxItem>\r\n ))}\r\n </ComboboxList>\r\n </ComboboxContent>\r\n </Combobox>\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormCombobox, type FormComboboxProps };\r\n"],"names":["FormCombobox","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","options","loading","loadingText","emptyOptionsText","placeholder","slotProps","required","formItemProps","field","useController","open","setOpen","useState","handleChange","value","useMemo","option","jsx","FormField","jsxs","FormItem","FormLabel","Combobox","FormControl","ComboboxTrigger","cn","Button","ChevronDown","ComboboxContent","ComboboxInput","ComboboxList","ComboboxEmpty","Spinner","ComboboxItem","index","createElement","Check","FormMessage"],"mappings":";;;;;;;;AAgCM,MAAAA,KAAe,CACnBC,MACG;AACG,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,SAAAC;AAAA,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AAoBF,KAAA;AAAA,gBAAA;AAAA,cAAA,IAErB;AAAA,cACHH,GAAS,IAAI,CAAC,EAAE,OAAAc,GAAO,OAAAf,KAASmC,MAC/B,gBAAAC;AAAA,gBAACF;AAAA,gBAAA;AAAA,kBACE,GAAI5B,GAAW,qBAAqB,CAAC;AAAA,kBACtC,OAAO,OAAOS,CAAK;AAAA,kBACnB,KAAKoB,IAAQ,MAAMnC;AAAAA,kBACnB,UAAU,MAAMc,EAAaC,CAAK;AAAA,gBAAA;AAAA,gBAEjCf;AAAAA,gBACD,gBAAAkB,EAACmB,GAAM,EAAA,WAAWX,EAAG,WAAWX,MAAUN,EAAM,QAAQ,gBAAgB,WAAW,EAAG,CAAA;AAAA,cAEzF,CAAA;AAAA,YAAA,EACH,CAAA;AAAA,UAAA,EACF,CAAA;AAAA,QAAA,GACF;AAAA,0BACC6B,GAAa,EAAA,GAAIhC,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { FormField as P, FormItem as f, FormLabel as F, FormControl as h, FormMessage as g } from "./form.es.js";
|
|
3
|
+
import { DatePicker as x } from "./datepicker.es.js";
|
|
4
|
+
const j = (t) => {
|
|
5
|
+
const { name: l, control: m, defaultValue: n, disabled: a, rules: c, shouldUnregister: d, label: i, slotProps: e, required: p, ...u } = t;
|
|
6
|
+
return /* @__PURE__ */ r(
|
|
7
|
+
P,
|
|
8
|
+
{
|
|
9
|
+
control: m,
|
|
10
|
+
name: l,
|
|
11
|
+
defaultValue: n,
|
|
12
|
+
disabled: a,
|
|
13
|
+
rules: c,
|
|
14
|
+
shouldUnregister: d,
|
|
15
|
+
render: ({ field: o }) => /* @__PURE__ */ s(f, { ...u, children: [
|
|
16
|
+
/* @__PURE__ */ s(F, { ...e?.formLabelProps ?? {}, children: [
|
|
17
|
+
i,
|
|
18
|
+
p && /* @__PURE__ */ r("span", { className: "text-danger text-sm", children: "*" })
|
|
19
|
+
] }),
|
|
20
|
+
/* @__PURE__ */ r(h, { ...e?.formControlProps ?? {}, children: /* @__PURE__ */ r(x, { ...e?.datepickerProps ?? {}, selected: o.value, onSelect: o.onChange }) }),
|
|
21
|
+
/* @__PURE__ */ r(g, { ...e?.formMessageProps ?? {} })
|
|
22
|
+
] })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
j as FormDatePicker
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=formdatepicker.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formdatepicker.es.js","sources":["../src/components/form-date-picker/FormDatePicker.tsx"],"sourcesContent":["import { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { SlotProps } from \"@radix-ui/react-slot\";\r\nimport { Control, ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\r\nimport { DatePicker, type DatePickerProps } from \"../date-picker/DatePicker\";\r\n\r\ntype FormDatePickerProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n control: Control<TFieldValues>;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n formControlProps?: Omit<SlotProps & React.RefAttributes<HTMLElement>, \"ref\"> & React.RefAttributes<HTMLElement>;\r\n datepickerProps?: DatePickerProps;\r\n };\r\n };\r\n\r\nconst FormDatePicker = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>(props: FormDatePickerProps<TFieldValues, TName>) => {\r\n const { name, control, defaultValue, disabled, rules, shouldUnregister, label, slotProps, required, ...formItemProps } = props;\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm\">*</span>}\r\n </FormLabel>\r\n <FormControl {...(slotProps?.formControlProps ?? {})}>\r\n <DatePicker {...(slotProps?.datepickerProps ?? {})} selected={field.value} onSelect={field.onChange} />\r\n </FormControl>\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormDatePicker, type FormDatePickerProps };\r\n"],"names":["FormDatePicker","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","slotProps","required","formItemProps","jsx","FormField","field","jsxs","FormItem","FormLabel","FormControl","DatePicker","FormMessage"],"mappings":";;;AAqBM,MAAAA,IAAiB,CAA0EC,MAAoD;AACnJ,QAAM,EAAE,MAAAC,GAAM,SAAAC,GAAS,cAAAC,GAAc,UAAAC,GAAU,OAAAC,GAAO,kBAAAC,GAAkB,OAAAC,GAAO,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAkB,IAAAV;AAGvH,SAAA,gBAAAW;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAV;AAAA,MACA,MAAAD;AAAA,MACA,cAAAE;AAAA,MACA,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAO,QAEP,gBAAAC,EAACC,GAAU,EAAA,GAAGL,GACZ,UAAA;AAAA,QAAA,gBAAAI,EAACE,GAAW,EAAA,GAAIR,GAAW,kBAAkB,CAC1C,GAAA,UAAA;AAAA,UAAAD;AAAA,UACAE,KAAY,gBAAAE,EAAC,QAAK,EAAA,WAAU,uBAAsB,UAAC,IAAA,CAAA;AAAA,QAAA,GACtD;AAAA,QACA,gBAAAA,EAACM,KAAa,GAAIT,GAAW,oBAAoB,CAAA,GAC/C,4BAACU,GAAY,EAAA,GAAIV,GAAW,mBAAmB,CAAA,GAAK,UAAUK,EAAM,OAAO,UAAUA,EAAM,SAAU,CAAA,GACvG;AAAA,0BACCM,GAAa,EAAA,GAAIX,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { FormField as P, FormItem as f, FormLabel as g, FormControl as F, FormMessage as h } from "./form.es.js";
|
|
3
|
+
import { DateRangePicker as x } from "./daterangepicker.es.js";
|
|
4
|
+
const j = (t) => {
|
|
5
|
+
const { name: l, control: m, defaultValue: n, disabled: a, rules: c, shouldUnregister: d, label: i, slotProps: r, required: p, ...u } = t;
|
|
6
|
+
return /* @__PURE__ */ e(
|
|
7
|
+
P,
|
|
8
|
+
{
|
|
9
|
+
control: m,
|
|
10
|
+
name: l,
|
|
11
|
+
defaultValue: n,
|
|
12
|
+
disabled: a,
|
|
13
|
+
rules: c,
|
|
14
|
+
shouldUnregister: d,
|
|
15
|
+
render: ({ field: o }) => /* @__PURE__ */ s(f, { ...u, children: [
|
|
16
|
+
/* @__PURE__ */ s(g, { ...r?.formLabelProps ?? {}, children: [
|
|
17
|
+
i,
|
|
18
|
+
p && /* @__PURE__ */ e("span", { className: "text-danger text-sm", children: "*" })
|
|
19
|
+
] }),
|
|
20
|
+
/* @__PURE__ */ e(F, { ...r?.formControlProps ?? {}, children: /* @__PURE__ */ e(x, { ...r?.datepickerProps ?? {}, selected: o.value, onSelect: o.onChange }) }),
|
|
21
|
+
/* @__PURE__ */ e(h, { ...r?.formMessageProps ?? {} })
|
|
22
|
+
] })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
j as FormDateRangePicker
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=formdaterangepicker.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formdaterangepicker.es.js","sources":["../src/components/form-date-range-picker/FormDateRangePicker.tsx"],"sourcesContent":["import { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { SlotProps } from \"@radix-ui/react-slot\";\r\nimport { Control, ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\r\n\r\nimport { DateRangePicker, DateRangePickerProps } from \"../date-picker/DateRangePicker\";\r\n\r\ntype FormDateRangePickerProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n control: Control<TFieldValues>;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n formControlProps?: Omit<SlotProps & React.RefAttributes<HTMLElement>, \"ref\"> & React.RefAttributes<HTMLElement>;\r\n datepickerProps?: DateRangePickerProps;\r\n };\r\n };\r\n\r\nconst FormDateRangePicker = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>(\r\n props: FormDateRangePickerProps<TFieldValues, TName>,\r\n) => {\r\n const { name, control, defaultValue, disabled, rules, shouldUnregister, label, slotProps, required, ...formItemProps } = props;\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm\">*</span>}\r\n </FormLabel>\r\n <FormControl {...(slotProps?.formControlProps ?? {})}>\r\n <DateRangePicker {...(slotProps?.datepickerProps ?? {})} selected={field.value} onSelect={field.onChange} />\r\n </FormControl>\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormDateRangePicker, type FormDateRangePickerProps };\r\n"],"names":["FormDateRangePicker","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","slotProps","required","formItemProps","jsx","FormField","field","jsxs","FormItem","FormLabel","FormControl","DateRangePicker","FormMessage"],"mappings":";;;AAsBM,MAAAA,IAAsB,CAC1BC,MACG;AACH,QAAM,EAAE,MAAAC,GAAM,SAAAC,GAAS,cAAAC,GAAc,UAAAC,GAAU,OAAAC,GAAO,kBAAAC,GAAkB,OAAAC,GAAO,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAkB,IAAAV;AAGvH,SAAA,gBAAAW;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAV;AAAA,MACA,MAAAD;AAAA,MACA,cAAAE;AAAA,MACA,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAO,QAEP,gBAAAC,EAACC,GAAU,EAAA,GAAGL,GACZ,UAAA;AAAA,QAAA,gBAAAI,EAACE,GAAW,EAAA,GAAIR,GAAW,kBAAkB,CAC1C,GAAA,UAAA;AAAA,UAAAD;AAAA,UACAE,KAAY,gBAAAE,EAAC,QAAK,EAAA,WAAU,uBAAsB,UAAC,IAAA,CAAA;AAAA,QAAA,GACtD;AAAA,QACA,gBAAAA,EAACM,KAAa,GAAIT,GAAW,oBAAoB,CAAA,GAC/C,4BAACU,GAAiB,EAAA,GAAIV,GAAW,mBAAmB,CAAA,GAAK,UAAUK,EAAM,OAAO,UAAUA,EAAM,SAAU,CAAA,GAC5G;AAAA,0BACCM,GAAa,EAAA,GAAIX,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
package/dist/formrating.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { Star as h } from "@trsys-tech/matrix-icons";
|
|
3
3
|
import { Rating as F } from "./rating.es.js";
|
|
4
4
|
import { FormField as x, FormItem as P, FormLabel as b, FormControl as C, FormMessage as I } from "./form.es.js";
|
|
5
|
-
const R = (
|
|
5
|
+
const R = (n) => {
|
|
6
6
|
const {
|
|
7
7
|
name: s,
|
|
8
8
|
control: a,
|
|
@@ -12,11 +12,11 @@ const R = (m) => {
|
|
|
12
12
|
shouldUnregister: p,
|
|
13
13
|
label: d,
|
|
14
14
|
slotProps: o,
|
|
15
|
-
required:
|
|
16
|
-
Icon:
|
|
15
|
+
required: u,
|
|
16
|
+
Icon: c = h,
|
|
17
17
|
max: g = 5,
|
|
18
18
|
...f
|
|
19
|
-
} =
|
|
19
|
+
} = n;
|
|
20
20
|
return /* @__PURE__ */ r(
|
|
21
21
|
x,
|
|
22
22
|
{
|
|
@@ -26,19 +26,19 @@ const R = (m) => {
|
|
|
26
26
|
disabled: e,
|
|
27
27
|
rules: i,
|
|
28
28
|
shouldUnregister: p,
|
|
29
|
-
render: ({ field:
|
|
30
|
-
/* @__PURE__ */
|
|
29
|
+
render: ({ field: t }) => /* @__PURE__ */ m(P, { ...f, children: [
|
|
30
|
+
/* @__PURE__ */ m(b, { ...o?.formLabelProps ?? {}, children: [
|
|
31
31
|
d,
|
|
32
|
-
|
|
32
|
+
u && /* @__PURE__ */ r("span", { className: "text-danger text-sm", children: "*" })
|
|
33
33
|
] }),
|
|
34
34
|
/* @__PURE__ */ r(C, { ...o?.formControlProps ?? {}, children: /* @__PURE__ */ r(
|
|
35
35
|
F,
|
|
36
36
|
{
|
|
37
37
|
...o?.ratingProps ?? {},
|
|
38
|
-
value:
|
|
38
|
+
value: t.value,
|
|
39
39
|
max: g,
|
|
40
|
-
Icon:
|
|
41
|
-
onValueChange:
|
|
40
|
+
Icon: c,
|
|
41
|
+
onValueChange: t.onChange,
|
|
42
42
|
disabled: e
|
|
43
43
|
}
|
|
44
44
|
) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formrating.es.js","sources":["../src/components/form-rating/FormRating.tsx"],"sourcesContent":["import { SlotProps } from \"@radix-ui/react-slot\";\r\nimport { Control, ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\r\n\r\nimport {
|
|
1
|
+
{"version":3,"file":"formrating.es.js","sources":["../src/components/form-rating/FormRating.tsx"],"sourcesContent":["import { Star } from \"@trsys-tech/matrix-icons\";\r\nimport { SlotProps } from \"@radix-ui/react-slot\";\r\nimport { Control, ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\r\n\r\nimport { Rating, RatingProps } from \"../rating/Rating\";\r\nimport { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\n\r\ntype FormRatingProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = Omit<ControllerProps<TFieldValues, TName>, \"render\"> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n control: Control<TFieldValues>;\r\n required?: boolean;\r\n Icon?: React.JSXElementConstructor<React.SVGProps<SVGSVGElement>>;\r\n max?: number;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n formControlProps?: Omit<SlotProps & React.RefAttributes<HTMLElement>, \"ref\"> & React.RefAttributes<HTMLElement>;\r\n ratingProps?: RatingProps;\r\n };\r\n };\r\n\r\nconst FormRating = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>(props: FormRatingProps<TFieldValues, TName>) => {\r\n const {\r\n name,\r\n control,\r\n defaultValue,\r\n disabled,\r\n rules,\r\n shouldUnregister,\r\n label,\r\n slotProps,\r\n required,\r\n Icon = Star,\r\n max = 5,\r\n ...formItemProps\r\n } = props;\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm\">*</span>}\r\n </FormLabel>\r\n <FormControl {...(slotProps?.formControlProps ?? {})}>\r\n <Rating\r\n {...(slotProps?.ratingProps ?? {})}\r\n value={field.value}\r\n max={max}\r\n Icon={Icon}\r\n onValueChange={field.onChange}\r\n disabled={disabled}\r\n ></Rating>\r\n </FormControl>\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormRating, type FormRatingProps };\r\n"],"names":["FormRating","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","slotProps","required","Icon","Star","max","formItemProps","jsx","FormField","field","jsxs","FormItem","FormLabel","FormControl","Rating","FormMessage"],"mappings":";;;;AAsBM,MAAAA,IAAa,CAA0EC,MAAgD;AACrI,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC,IAAOC;AAAA,IACP,KAAAC,IAAM;AAAA,IACN,GAAGC;AAAA,EAAA,IACDb;AAGF,SAAA,gBAAAc;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAb;AAAA,MACA,MAAAD;AAAA,MACA,cAAAE;AAAA,MACA,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAU,QAEP,gBAAAC,EAACC,GAAU,EAAA,GAAGL,GACZ,UAAA;AAAA,QAAA,gBAAAI,EAACE,GAAW,EAAA,GAAIX,GAAW,kBAAkB,CAC1C,GAAA,UAAA;AAAA,UAAAD;AAAA,UACAE,KAAY,gBAAAK,EAAC,QAAK,EAAA,WAAU,uBAAsB,UAAC,IAAA,CAAA;AAAA,QAAA,GACtD;AAAA,0BACCM,GAAa,EAAA,GAAIZ,GAAW,oBAAoB,CAAA,GAC/C,UAAA,gBAAAM;AAAA,UAACO;AAAA,UAAA;AAAA,YACE,GAAIb,GAAW,eAAe,CAAC;AAAA,YAChC,OAAOQ,EAAM;AAAA,YACb,KAAAJ;AAAA,YACA,MAAAF;AAAA,YACA,eAAeM,EAAM;AAAA,YACrB,UAAAZ;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,0BACCkB,GAAa,EAAA,GAAId,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
package/dist/formselect.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
2
2
|
import { createElement as N } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Spinner as T } from "@trsys-tech/matrix-icons";
|
|
4
|
+
import { useController as V } from "react-hook-form";
|
|
5
|
+
import { cn as k } from "./utils.es.js";
|
|
6
6
|
import { FormField as y, FormItem as L, FormLabel as j, FormControl as q, FormMessage as M } from "./form.es.js";
|
|
7
|
-
import { Select as E, SelectTrigger as O, SelectValue as U, SelectContent as _, SelectItem as
|
|
7
|
+
import { Select as E, SelectTrigger as O, SelectValue as U, SelectContent as _, SelectItem as n } from "./select.es.js";
|
|
8
8
|
const J = (b) => {
|
|
9
9
|
const {
|
|
10
10
|
name: c,
|
|
@@ -13,8 +13,8 @@ const J = (b) => {
|
|
|
13
13
|
disabled: t,
|
|
14
14
|
rules: d,
|
|
15
15
|
shouldUnregister: p,
|
|
16
|
-
label:
|
|
17
|
-
options:
|
|
16
|
+
label: s,
|
|
17
|
+
options: a,
|
|
18
18
|
loading: u,
|
|
19
19
|
loadingText: P,
|
|
20
20
|
emptyOptionsText: v,
|
|
@@ -22,8 +22,8 @@ const J = (b) => {
|
|
|
22
22
|
slotProps: e,
|
|
23
23
|
required: g,
|
|
24
24
|
...C
|
|
25
|
-
} = b, { field: h } =
|
|
26
|
-
|
|
25
|
+
} = b, { field: h } = V({ name: c, control: i, rules: d, defaultValue: m, disabled: t, shouldUnregister: p }), x = typeof a[0]?.value == "number", F = (l) => {
|
|
26
|
+
x ? h.onChange(Number(l)) : h.onChange(l);
|
|
27
27
|
};
|
|
28
28
|
return /* @__PURE__ */ r(
|
|
29
29
|
y,
|
|
@@ -36,7 +36,7 @@ const J = (b) => {
|
|
|
36
36
|
shouldUnregister: p,
|
|
37
37
|
render: ({ field: l }) => /* @__PURE__ */ o(L, { ...C, children: [
|
|
38
38
|
/* @__PURE__ */ o(j, { ...e?.formLabelProps ?? {}, children: [
|
|
39
|
-
|
|
39
|
+
s,
|
|
40
40
|
g && /* @__PURE__ */ r("span", { className: "text-danger text-sm", children: "*" })
|
|
41
41
|
] }),
|
|
42
42
|
/* @__PURE__ */ o(
|
|
@@ -44,7 +44,7 @@ const J = (b) => {
|
|
|
44
44
|
{
|
|
45
45
|
...e?.selectProps ?? {},
|
|
46
46
|
disabled: t,
|
|
47
|
-
onValueChange:
|
|
47
|
+
onValueChange: F,
|
|
48
48
|
value: l.value !== void 0 ? String(l.value) : void 0,
|
|
49
49
|
children: [
|
|
50
50
|
/* @__PURE__ */ r(q, { children: /* @__PURE__ */ r(
|
|
@@ -53,18 +53,18 @@ const J = (b) => {
|
|
|
53
53
|
"aria-required": g,
|
|
54
54
|
disabled: t,
|
|
55
55
|
...e?.selectTriggerProps ?? {},
|
|
56
|
-
className:
|
|
57
|
-
children: /* @__PURE__ */ r(U, { ...e?.selectValueProps ?? {}, placeholder: S ??
|
|
56
|
+
className: k("*:truncate [&>span]:inline-block", e?.selectTriggerProps?.className),
|
|
57
|
+
children: /* @__PURE__ */ r(U, { ...e?.selectValueProps ?? {}, placeholder: S ?? s })
|
|
58
58
|
}
|
|
59
59
|
) }),
|
|
60
60
|
/* @__PURE__ */ o(_, { ...e?.selectContentProps ?? {}, children: [
|
|
61
|
-
u && /* @__PURE__ */ o(
|
|
62
|
-
/* @__PURE__ */ r(
|
|
61
|
+
u && /* @__PURE__ */ o(n, { ...e?.selectItemProps ?? {}, value: "-1", disabled: !0, children: [
|
|
62
|
+
/* @__PURE__ */ r(T, { className: "inline-block mb-0.5" }),
|
|
63
63
|
" ",
|
|
64
64
|
P || "Loading..."
|
|
65
65
|
] }),
|
|
66
|
-
!u && !
|
|
67
|
-
|
|
66
|
+
!u && !a.length ? /* @__PURE__ */ r(
|
|
67
|
+
n,
|
|
68
68
|
{
|
|
69
69
|
...e?.selectItemProps ?? {},
|
|
70
70
|
value: "8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee728623",
|
|
@@ -72,7 +72,7 @@ const J = (b) => {
|
|
|
72
72
|
children: v || "No Items"
|
|
73
73
|
}
|
|
74
74
|
) : null,
|
|
75
|
-
|
|
75
|
+
a?.map((f, I) => /* @__PURE__ */ N(n, { ...e?.selectItemProps ?? {}, value: String(f.value), key: I + "_" + s }, f.label))
|
|
76
76
|
] })
|
|
77
77
|
]
|
|
78
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formselect.es.js","sources":["../src/components/form-select/FormSelect.tsx"],"sourcesContent":["import { ControllerProps, FieldPath, FieldValues, useController } from \"react-hook-form\";\r\nimport { SelectContentProps, SelectItemProps, SelectProps, SelectTriggerProps, SelectValueProps } from \"@radix-ui/react-select\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nimport {
|
|
1
|
+
{"version":3,"file":"formselect.es.js","sources":["../src/components/form-select/FormSelect.tsx"],"sourcesContent":["import { Spinner } from \"@trsys-tech/matrix-icons\";\r\nimport { ControllerProps, FieldPath, FieldValues, useController } from \"react-hook-form\";\r\nimport { SelectContentProps, SelectItemProps, SelectProps, SelectTriggerProps, SelectValueProps } from \"@radix-ui/react-select\";\r\n\r\nimport { cn } from \"../../lib/utils\";\r\n\r\nimport { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"../select/Select\";\r\n\r\ntype FormSelectProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n options: { value: string | number; label: string | number }[];\r\n loading?: boolean;\r\n loadingText?: string;\r\n emptyOptionsText?: string;\r\n placeholder?: string;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n selectProps?: SelectProps;\r\n selectTriggerProps?: SelectTriggerProps;\r\n selectValueProps?: Omit<SelectValueProps, \"placeholder\">;\r\n selectContentProps?: SelectContentProps;\r\n selectItemProps?: SelectItemProps;\r\n };\r\n };\r\n\r\nconst FormSelect = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(\r\n props: FormSelectProps<TFieldValues, TName>,\r\n) => {\r\n const {\r\n name,\r\n control,\r\n defaultValue,\r\n disabled,\r\n rules,\r\n shouldUnregister,\r\n label,\r\n options,\r\n loading,\r\n loadingText,\r\n emptyOptionsText,\r\n placeholder,\r\n slotProps,\r\n required,\r\n ...formItemProps\r\n } = props;\r\n\r\n const { field } = useController({ name, control, rules, defaultValue, disabled, shouldUnregister });\r\n\r\n const isNumericValue = typeof options[0]?.value === \"number\";\r\n\r\n const handleChange = (value: string) => {\r\n if (isNumericValue) {\r\n field.onChange(Number(value));\r\n } else {\r\n field.onChange(value);\r\n }\r\n };\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm\">*</span>}\r\n </FormLabel>\r\n <Select\r\n {...(slotProps?.selectProps ?? {})}\r\n disabled={disabled}\r\n onValueChange={handleChange}\r\n value={field.value !== undefined ? String(field.value) : undefined}\r\n >\r\n <FormControl>\r\n <SelectTrigger\r\n aria-required={required}\r\n disabled={disabled}\r\n {...(slotProps?.selectTriggerProps ?? {})}\r\n className={cn(\"*:truncate [&>span]:inline-block\", slotProps?.selectTriggerProps?.className)}\r\n >\r\n <SelectValue {...(slotProps?.selectValueProps ?? {})} placeholder={placeholder ?? label} />\r\n </SelectTrigger>\r\n </FormControl>\r\n <SelectContent {...(slotProps?.selectContentProps ?? {})}>\r\n {loading && (\r\n <SelectItem {...(slotProps?.selectItemProps ?? {})} value=\"-1\" disabled>\r\n <Spinner className=\"inline-block mb-0.5\" /> {loadingText || \"Loading...\"}\r\n </SelectItem>\r\n )}\r\n {!loading && !options.length ? (\r\n <SelectItem\r\n {...(slotProps?.selectItemProps ?? {})}\r\n value=\"8fdcaeb67c8ad943c80fe54c3b1059b700d9254389a38a4a1fc39a6eee728623\"\r\n disabled\r\n >\r\n {emptyOptionsText || \"No Items\"}\r\n </SelectItem>\r\n ) : null}\r\n {options?.map((option, index) => (\r\n <SelectItem {...(slotProps?.selectItemProps ?? {})} value={String(option.value)} key={index + \"_\" + label}>\r\n {option.label}\r\n </SelectItem>\r\n ))}\r\n </SelectContent>\r\n </Select>\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormSelect, type FormSelectProps };\r\n"],"names":["FormSelect","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","options","loading","loadingText","emptyOptionsText","placeholder","slotProps","required","formItemProps","field","useController","isNumericValue","handleChange","value","jsx","FormField","jsxs","FormItem","FormLabel","Select","FormControl","SelectTrigger","cn","SelectValue","SelectContent","SelectItem","Spinner","option","index","createElement","FormMessage"],"mappings":";;;;;;;AAgCM,MAAAA,IAAa,CACjBC,MACG;AACG,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDf,GAEE,EAAE,OAAAgB,EAAM,IAAIC,EAAc,EAAE,MAAAhB,GAAM,SAAAC,GAAS,OAAAG,GAAO,cAAAF,GAAc,UAAAC,GAAU,kBAAAE,GAAkB,GAE5FY,IAAiB,OAAOV,EAAQ,CAAC,GAAG,SAAU,UAE9CW,IAAe,CAACC,MAAkB;AACtC,IAAIF,IACIF,EAAA,SAAS,OAAOI,CAAK,CAAC,IAE5BJ,EAAM,SAASI,CAAK;AAAA,EAExB;AAGE,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAApB;AAAA,MACA,MAAAD;AAAA,MACA,cAAAE;AAAA,MACA,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAQ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,OAAM;AAAA,oBACN,UAAQ;AAAA,oBAEP,UAAoBF,KAAA;AAAA,kBAAA;AAAA,gBAAA,IAErB;AAAA,gBACHH,GAAS,IAAI,CAAC0B,GAAQC,MACpB,gBAAAC,EAAAJ,GAAA,EAAY,GAAInB,GAAW,mBAAmB,IAAK,OAAO,OAAOqB,EAAO,KAAK,GAAG,KAAKC,IAAQ,MAAM5B,EAAA,GACjG2B,EAAO,KACV,CACD;AAAA,cAAA,EACH,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,0BACCG,GAAa,EAAA,GAAIxB,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { FormField as u, FormItem as x, FormLabel as F, FormControl as P, FormMessage as h } from "./form.es.js";
|
|
3
|
+
import { Textarea as b } from "./textarea.es.js";
|
|
4
|
+
const C = (a) => {
|
|
5
|
+
const { name: m, control: l, defaultValue: n, disabled: o, rules: d, shouldUnregister: i, label: p, slotProps: e, required: s, ...c } = a;
|
|
6
|
+
return /* @__PURE__ */ r(
|
|
7
|
+
u,
|
|
8
|
+
{
|
|
9
|
+
control: l,
|
|
10
|
+
name: m,
|
|
11
|
+
defaultValue: n,
|
|
12
|
+
disabled: o,
|
|
13
|
+
rules: d,
|
|
14
|
+
shouldUnregister: i,
|
|
15
|
+
render: ({ field: f }) => /* @__PURE__ */ t(x, { ...c, children: [
|
|
16
|
+
/* @__PURE__ */ t(F, { ...e?.formLabelProps ?? {}, children: [
|
|
17
|
+
p,
|
|
18
|
+
s && /* @__PURE__ */ r("span", { className: "text-danger text-sm", children: "*" })
|
|
19
|
+
] }),
|
|
20
|
+
/* @__PURE__ */ r(P, { ...e?.formControlProps ?? {}, children: /* @__PURE__ */ r(b, { "aria-required": s, disabled: o, ...e?.textareaProps ?? {}, ...f }) }),
|
|
21
|
+
/* @__PURE__ */ r(h, { ...e?.formMessageProps ?? {} })
|
|
22
|
+
] })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
C as FormTextarea
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=formtextarea.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formtextarea.es.js","sources":["../src/components/form-textarea/FormTextarea.tsx"],"sourcesContent":["import { FormControl, FormField, FormItem, FormLabel, FormMessage } from \"../form/Form\";\r\nimport { SlotProps } from \"@radix-ui/react-slot\";\r\nimport { Control, ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\r\nimport { Textarea, TextareaProps } from \"../textarea/Textarea\";\r\n\r\ntype FormTextareaProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = Omit<\r\n ControllerProps<TFieldValues, TName>,\r\n \"render\"\r\n> &\r\n React.ComponentProps<typeof FormItem> & {\r\n label: string;\r\n control: Control<TFieldValues>;\r\n required?: boolean;\r\n slotProps?: {\r\n formLabelProps?: React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>;\r\n formMessageProps?: React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>;\r\n formControlProps?: Omit<SlotProps & React.RefAttributes<HTMLElement>, \"ref\"> & React.RefAttributes<HTMLElement>;\r\n textareaProps?: TextareaProps;\r\n };\r\n };\r\n\r\nconst FormTextarea = <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>(props: FormTextareaProps<TFieldValues, TName>) => {\r\n const { name, control, defaultValue, disabled, rules, shouldUnregister, label, slotProps, required, ...formItemProps } = props;\r\n\r\n return (\r\n <FormField\r\n control={control}\r\n name={name}\r\n defaultValue={defaultValue}\r\n disabled={disabled}\r\n rules={rules}\r\n shouldUnregister={shouldUnregister}\r\n render={({ field }) => {\r\n return (\r\n <FormItem {...formItemProps}>\r\n <FormLabel {...(slotProps?.formLabelProps ?? {})}>\r\n {label}\r\n {required && <span className=\"text-danger text-sm\">*</span>}\r\n </FormLabel>\r\n <FormControl {...(slotProps?.formControlProps ?? {})}>\r\n <Textarea aria-required={required} disabled={disabled} {...(slotProps?.textareaProps ?? {})} {...field} />\r\n </FormControl>\r\n <FormMessage {...(slotProps?.formMessageProps ?? {})} />\r\n </FormItem>\r\n );\r\n }}\r\n />\r\n );\r\n};\r\nexport { FormTextarea, type FormTextareaProps };\r\n"],"names":["FormTextarea","props","name","control","defaultValue","disabled","rules","shouldUnregister","label","slotProps","required","formItemProps","jsx","FormField","field","jsxs","FormItem","FormLabel","FormControl","Textarea","FormMessage"],"mappings":";;;AAqBM,MAAAA,IAAe,CAA0EC,MAAkD;AAC/I,QAAM,EAAE,MAAAC,GAAM,SAAAC,GAAS,cAAAC,GAAc,UAAAC,GAAU,OAAAC,GAAO,kBAAAC,GAAkB,OAAAC,GAAO,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAkB,IAAAV;AAGvH,SAAA,gBAAAW;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAV;AAAA,MACA,MAAAD;AAAA,MACA,cAAAE;AAAA,MACA,UAAAC;AAAA,MACA,OAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAO,QAEP,gBAAAC,EAACC,GAAU,EAAA,GAAGL,GACZ,UAAA;AAAA,QAAA,gBAAAI,EAACE,GAAW,EAAA,GAAIR,GAAW,kBAAkB,CAC1C,GAAA,UAAA;AAAA,UAAAD;AAAA,UACAE,KAAY,gBAAAE,EAAC,QAAK,EAAA,WAAU,uBAAsB,UAAC,IAAA,CAAA;AAAA,QAAA,GACtD;AAAA,0BACCM,GAAa,EAAA,GAAIT,GAAW,oBAAoB,IAC/C,UAAC,gBAAAG,EAAAO,GAAA,EAAS,iBAAeT,GAAU,UAAAL,GAAqB,GAAII,GAAW,iBAAiB,IAAM,GAAGK,EAAO,CAAA,GAC1G;AAAA,0BACCM,GAAa,EAAA,GAAIX,GAAW,oBAAoB,CAAA,EAAK,CAAA;AAAA,MAAA,GACxD;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { FormField as P, FormItem as f, FormLabel as h, FormControl as F, FormMessage as g } from "./form.es.js";
|
|
3
|
+
import { TimePicker as x } from "./timepicker.es.js";
|
|
4
|
+
const T = (s) => {
|
|
5
|
+
const { name: t, control: n, defaultValue: l, disabled: a, rules: i, shouldUnregister: d, label: p, slotProps: e, required: c, ...u } = s;
|
|
6
|
+
return /* @__PURE__ */ r(
|
|
7
|
+
P,
|
|
8
|
+
{
|
|
9
|
+
control: n,
|
|
10
|
+
name: t,
|
|
11
|
+
defaultValue: l,
|
|
12
|
+
disabled: a,
|
|
13
|
+
rules: i,
|
|
14
|
+
shouldUnregister: d,
|
|
15
|
+
render: ({ field: o }) => /* @__PURE__ */ m(f, { ...u, children: [
|
|
16
|
+
/* @__PURE__ */ m(h, { ...e?.formLabelProps ?? {}, children: [
|
|
17
|
+
p,
|
|
18
|
+
c && /* @__PURE__ */ r("span", { className: "text-danger text-sm", children: "*" })
|
|
19
|
+
] }),
|
|
20
|
+
/* @__PURE__ */ r(F, { ...e?.formControlProps ?? {}, children: /* @__PURE__ */ r(x, { ...e?.datepickerProps ?? {}, time: o.value, onTimeChange: o.onChange }) }),
|
|
21
|
+
/* @__PURE__ */ r(g, { ...e?.formMessageProps ?? {} })
|
|
22
|
+
] })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
T as FormTimePicker
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=formtimepicker.es.js.map
|