pixelize-design-library 2.1.18 → 2.1.20
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/.github/workflows/build.yml +31 -0
- package/dist/index.d.mts +1468 -0
- package/dist/index.d.ts +1468 -55
- package/dist/index.js +263 -148
- package/dist/index.mjs +263 -0
- package/package.json +24 -10
- package/src/Components/Accordion/Accordion.tsx +59 -0
- package/src/Components/Accordion/AccordionProps.tsx +22 -0
- package/src/Components/AlertDialog/AlertDialog.tsx +69 -0
- package/{dist/Components/AlertDialog/AlertDialogProps.d.ts → src/Components/AlertDialog/AlertDialogProps.tsx} +9 -2
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.stories.tsx +42 -0
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChart.tsx +80 -0
- package/src/Components/Apexcharts/ApexBarChart/ApexBarChartProps.tsx +19 -0
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.stories.tsx +34 -0
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChart.tsx +42 -0
- package/src/Components/Apexcharts/ApexPieChart/ApexPieChartProps.tsx +42 -0
- package/src/Components/Breadcrumbs/Breadcrumbs.stories.tsx +27 -0
- package/src/Components/Breadcrumbs/Breadcrumbs.tsx +42 -0
- package/{dist/Components/Breadcrumbs/BreadcrumbsProps.d.ts → src/Components/Breadcrumbs/BreadcrumbsProps.tsx} +2 -1
- package/src/Components/Button/Button.stories.tsx +33 -0
- package/src/Components/Button/Button.styles.ts +104 -0
- package/src/Components/Button/Button.tsx +49 -0
- package/src/Components/Button/ButtonProps.tsx +25 -0
- package/src/Components/ButtonGroupIcon/ButtonGoupIconProps.tsx +46 -0
- package/src/Components/ButtonGroupIcon/ButtonGroupIcon.stories.tsx +37 -0
- package/src/Components/ButtonGroupIcon/ButtonGroupIcon.tsx +159 -0
- package/src/Components/Buttons/Buttons.tsx +16 -0
- package/{dist/Components/Buttons/ButtonsProps.d.ts → src/Components/Buttons/ButtonsProps.ts} +1 -1
- package/src/Components/Card/Card.tsx +35 -0
- package/src/Components/Card/CardProps.tsx +41 -0
- package/src/Components/Checkbox/Checkbox.stories.tsx +46 -0
- package/src/Components/Checkbox/Checkbox.styles.ts +56 -0
- package/src/Components/Checkbox/Checkbox.tsx +68 -0
- package/src/Components/Checkbox/CheckboxProps.tsx +42 -0
- package/src/Components/Common/ErrorComponent.tsx +16 -0
- package/src/Components/Common/ErrorMessage.tsx +22 -0
- package/src/Components/Common/FormLabel.tsx +48 -0
- package/src/Components/Common/HelperText.tsx +14 -0
- package/src/Components/Common/Label.tsx +12 -0
- package/src/Components/ContactForm/ContactForm.tsx +250 -0
- package/src/Components/ContactForm/ContactFormProps.tsx +10 -0
- package/src/Components/DatePicker/DatePicker.tsx +378 -0
- package/src/Components/DatePicker/DatePickerProps.tsx +48 -0
- package/src/Components/DatePicker/TimePicker.tsx +112 -0
- package/src/Components/Divider/Divider.tsx +17 -0
- package/src/Components/Drawer/Drawer.tsx +66 -0
- package/src/Components/Drawer/DrawerProps.tsx +11 -0
- package/src/Components/Dropdown/DropDown.tsx +189 -0
- package/src/Components/Dropdown/DropdownProps.tsx +26 -0
- package/src/Components/Editor/Editor.tsx +23 -0
- package/src/Components/Editor/EditorProps.tsx +8 -0
- package/src/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.tsx +78 -0
- package/src/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtpProps.tsx +12 -0
- package/src/Components/FileUpload/FileUpload.tsx +282 -0
- package/src/Components/FileUpload/FileUploadProps.tsx +34 -0
- package/src/Components/FileUpload/constants.ts +30 -0
- package/src/Components/Form/FormWrapper.tsx +47 -0
- package/src/Components/Header/Header.tsx +92 -0
- package/src/Components/Header/HeaderActions.tsx +96 -0
- package/src/Components/Header/HeaderProps.ts +72 -0
- package/src/Components/Header/components/desktopMenu.tsx +116 -0
- package/src/Components/Header/components/mobileMenu.tsx +99 -0
- package/src/Components/Input/Input/Input.tsx +56 -0
- package/{dist/Components/Input/Input/InputProps.d.ts → src/Components/Input/Input/InputProps.tsx} +2 -1
- package/src/Components/Input/TextInput.stories.tsx +46 -0
- package/{dist/Components/Input/TextInput.styles.js → src/Components/Input/TextInput.styles.ts} +20 -19
- package/src/Components/Input/TextInput.tsx +112 -0
- package/{dist/Components/Input/TextInputProps.d.ts → src/Components/Input/TextInputProps.tsx} +21 -2
- package/src/Components/InputTextArea/InputTextArea.stories.tsx +49 -0
- package/src/Components/InputTextArea/InputTextArea.tsx +54 -0
- package/{dist/Components/InputTextArea/InputTextAreaProps.d.ts → src/Components/InputTextArea/InputTextAreaProps.tsx} +2 -1
- package/src/Components/KanbanBoard/AccountCard.tsx +121 -0
- package/src/Components/KanbanBoard/AccountRow.tsx +35 -0
- package/src/Components/KanbanBoard/KanbanActions/KanbanActions.tsx +37 -0
- package/src/Components/KanbanBoard/KanbanBoard.tsx +185 -0
- package/src/Components/KanbanBoard/KanbanBoardProps.ts +34 -0
- package/src/Components/Loading/Loading.stories.tsx +26 -0
- package/src/Components/Loading/Loading.tsx +80 -0
- package/src/Components/Loading/LoadingProps.tsx +5 -0
- package/src/Components/Modal/Modal.stories.tsx +107 -0
- package/src/Components/Modal/Modal.tsx +107 -0
- package/src/Components/Modal/ModalProps.tsx +22 -0
- package/src/Components/MultiSelect/MultiSelect.tsx +154 -0
- package/src/Components/MultiSelect/MultiSelectProps.tsx +20 -0
- package/src/Components/NavigationBar/NavBar.stories.tsx +27 -0
- package/src/Components/NavigationBar/NavigationBar.tsx +125 -0
- package/src/Components/NavigationBar/NavigationBarProps.tsx +19 -0
- package/src/Components/NoteTextArea/NoteTextArea.tsx +409 -0
- package/src/Components/NoteTextArea/NoteTextAreaProps.tsx +22 -0
- package/src/Components/NumberInput/NumberInput.stories.tsx +32 -0
- package/src/Components/NumberInput/NumberInput.tsx +63 -0
- package/src/Components/NumberInput/NumberInputProps.tsx +28 -0
- package/src/Components/PinInput/PinInput.stories.tsx +41 -0
- package/src/Components/PinInput/PinInput.tsx +49 -0
- package/src/Components/PinInput/PinInputProps.tsx +33 -0
- package/src/Components/PinInputs/PinInputs.tsx +63 -0
- package/{dist/Components/PinInputs/PinInputsProps.d.ts → src/Components/PinInputs/PinInputsProps.tsx} +1 -1
- package/src/Components/ProductCard/ProductCard.tsx +77 -0
- package/{dist/Components/ProductCard/ProductCardProps.d.ts → src/Components/ProductCard/ProductCardProps.tsx} +15 -14
- package/src/Components/ProductCard/ProductLabel.tsx +13 -0
- package/src/Components/ProductCard/ProductPrice.tsx +177 -0
- package/src/Components/ProductCard/ProductReview.tsx +37 -0
- package/src/Components/ProductCard/ProductTags.tsx +57 -0
- package/src/Components/ProfileCard/ProfileCard.stories.tsx +31 -0
- package/src/Components/ProfileCard/ProfileCard.tsx +97 -0
- package/src/Components/ProfileCard/ProfileCardProps.tsx +39 -0
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.stories.tsx +26 -0
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewer.tsx +177 -0
- package/src/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.tsx +18 -0
- package/src/Components/ProgressBar/ProgressBar.stories.tsx +48 -0
- package/src/Components/ProgressBar/ProgressBar.tsx +31 -0
- package/{dist/Components/ProgressBar/ProgressBarProps.d.ts → src/Components/ProgressBar/ProgressBarProps.tsx} +6 -5
- package/src/Components/RadioButton/RadioButton.stories.tsx +47 -0
- package/src/Components/RadioButton/RadioButton.tsx +78 -0
- package/src/Components/RadioButton/RadioButtonProps.tsx +10 -0
- package/src/Components/Reorder/Reorder.tsx +121 -0
- package/src/Components/Reorder/ReorderProps.tsx +11 -0
- package/src/Components/Search/Search.tsx +80 -0
- package/src/Components/Search/SearchProps.tsx +7 -0
- package/src/Components/SearchSelect/SearchSelect.tsx +525 -0
- package/src/Components/SearchSelect/SearchSelectProps.tsx +60 -0
- package/src/Components/SearchSelect/SelectTruncatedLabel.tsx +31 -0
- package/src/Components/Select/Select.stories.tsx +59 -0
- package/src/Components/Select/Select.styles.ts +97 -0
- package/src/Components/Select/Select.tsx +89 -0
- package/src/Components/Select/SelectProps.tsx +37 -0
- package/src/Components/SelectSearch/SelectSearch.tsx +447 -0
- package/src/Components/SelectSearch/SelectSearchProps.tsx +43 -0
- package/src/Components/SideBar/SideBar.tsx +206 -0
- package/src/Components/SideBar/SideBarProps.tsx +31 -0
- package/src/Components/SideBar/Sidebar.stories.tsx +80 -0
- package/src/Components/SideBar/components/MenuItemBox.tsx +217 -0
- package/src/Components/SideBar/components/MenuItems.tsx +29 -0
- package/src/Components/SideBar/components/MenuPopoverContent.tsx +98 -0
- package/src/Components/SideBar/components/TextTruncation.tsx +76 -0
- package/src/Components/Skeletons/Skeleton.stories.tsx +65 -0
- package/src/Components/Skeletons/SkeletonProps.tsx +23 -0
- package/src/Components/Skeletons/Skeletons.tsx +51 -0
- package/src/Components/Slider/Slider.tsx +121 -0
- package/src/Components/Switch/Switch.tsx +104 -0
- package/src/Components/Switch/SwitchProps.tsx +28 -0
- package/src/Components/Table/Components/HeaderActions.tsx +79 -0
- package/src/Components/Table/Components/Pagination.tsx +101 -0
- package/src/Components/Table/Components/TableActions.tsx +75 -0
- package/src/Components/Table/Components/TableBody.tsx +299 -0
- package/src/Components/Table/Components/TableFilters.tsx +77 -0
- package/src/Components/Table/Components/TableHeader.tsx +314 -0
- package/src/Components/Table/Components/TableLoading.tsx +83 -0
- package/src/Components/Table/Components/TableSearch.tsx +84 -0
- package/src/Components/Table/Components/useDebounce.ts +31 -0
- package/src/Components/Table/Components/useTable.ts +220 -0
- package/src/Components/Table/Table.stories.tsx +48 -0
- package/src/Components/Table/Table.tsx +258 -0
- package/src/Components/Table/TableProps.tsx +163 -0
- package/src/Components/Table/TableSettings/ManageColumns.tsx +148 -0
- package/src/Components/Table/TableSettings/TableSettings.tsx +153 -0
- package/{dist/Components/Table/TableToDo.js → src/Components/Table/TableToDo.tsx} +105 -100
- package/src/Components/Tag/Tag.styles.tsx +56 -0
- package/src/Components/Tag/Tag.tsx +68 -0
- package/src/Components/Timeline/Timeline.tsx +310 -0
- package/src/Components/Timeline/TimelineProps.tsx +22 -0
- package/src/Components/Toaster/Toaster.stories.tsx +60 -0
- package/src/Components/Toaster/Toaster.tsx +99 -0
- package/{dist/Components/Toaster/ToasterProps.d.ts → src/Components/Toaster/ToasterProps.tsx} +9 -6
- package/src/Components/Toggle/TableToggle.tsx +68 -0
- package/{dist/Components/Toggle/TableToggleProps.d.ts → src/Components/Toggle/TableToggleProps.ts} +3 -2
- package/src/Components/ToolTip/ToolTip.stories.tsx +38 -0
- package/src/Components/ToolTip/ToolTip.tsx +62 -0
- package/src/Components/ToolTip/ToolTipProps.tsx +46 -0
- package/src/Components/Trail/EditableCell.tsx +116 -0
- package/src/Components/Trail/SelectAllCheckbox.tsx +22 -0
- package/{dist/Components/Trail/TrailWorks.js → src/Components/Trail/TrailWorks.tsx} +108 -65
- package/src/Components/Trail/data.ts +42 -0
- package/src/Constants/Sidebar.ts +39 -0
- package/src/Hooks/usePreferences.ts +105 -0
- package/{dist/Theme/Dark/theme.js → src/Theme/Dark/theme.ts} +74 -79
- package/src/Theme/Default/palette.ts +373 -0
- package/src/Theme/Default/theme.ts +16 -0
- package/src/Theme/Meadow/palette.ts +372 -0
- package/src/Theme/Meadow/theme.ts +17 -0
- package/src/Theme/Radiant/palette.ts +372 -0
- package/src/Theme/Radiant/theme.ts +17 -0
- package/src/Theme/Skyline/palette.ts +372 -0
- package/src/Theme/Skyline/theme.ts +17 -0
- package/{dist/Theme/common.js → src/Theme/common.ts} +30 -22
- package/src/Theme/componentStyles.ts +13 -0
- package/src/Theme/fonts.ts +41 -0
- package/{dist/Theme/index.d.ts → src/Theme/index.ts} +8 -6
- package/src/Theme/space.ts +34 -0
- package/src/Theme/theme.ts +9 -0
- package/src/Theme/themeProps.ts +477 -0
- package/src/Theme/useCustomTheme.ts +6 -0
- package/src/Utils/table.ts +200 -0
- package/src/index.ts +146 -0
- package/src/types/pixelize-design-library.d.ts +4 -0
- package/src/withTheme.tsx +20 -0
- package/tsconfig.json +23 -0
- package/dist/App.d.ts +0 -4
- package/dist/App.js +0 -158
- package/dist/Assets/defaultLogo.d.ts +0 -3
- package/dist/Assets/defaultLogo.js +0 -15
- package/dist/Components/Accordion/Accordion.d.ts +0 -4
- package/dist/Components/Accordion/Accordion.js +0 -40
- package/dist/Components/Accordion/AccordionProps.d.ts +0 -17
- package/dist/Components/Accordion/AccordionProps.js +0 -2
- package/dist/Components/AlertDialog/AlertDialog.d.ts +0 -4
- package/dist/Components/AlertDialog/AlertDialog.js +0 -20
- package/dist/Components/AlertDialog/AlertDialogProps.js +0 -2
- package/dist/Components/Apexcharts/ApexBarChart/ApexBarChart.d.ts +0 -3
- package/dist/Components/Apexcharts/ApexBarChart/ApexBarChart.js +0 -64
- package/dist/Components/Apexcharts/ApexBarChart/ApexBarChart.stories.d.ts +0 -1
- package/dist/Components/Apexcharts/ApexBarChart/ApexBarChart.stories.js +0 -6
- package/dist/Components/Apexcharts/ApexBarChart/ApexBarChartProps.d.ts +0 -19
- package/dist/Components/Apexcharts/ApexBarChart/ApexBarChartProps.js +0 -2
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.d.ts +0 -3
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.js +0 -29
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.stories.d.ts +0 -1
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.stories.js +0 -6
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChartProps.d.ts +0 -41
- package/dist/Components/Apexcharts/ApexPieChart/ApexPieChartProps.js +0 -2
- package/dist/Components/Breadcrumbs/Breadcrumbs.d.ts +0 -3
- package/dist/Components/Breadcrumbs/Breadcrumbs.js +0 -17
- package/dist/Components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -1
- package/dist/Components/Breadcrumbs/Breadcrumbs.stories.js +0 -6
- package/dist/Components/Breadcrumbs/BreadcrumbsProps.js +0 -2
- package/dist/Components/Button/Button.d.ts +0 -5
- package/dist/Components/Button/Button.js +0 -32
- package/dist/Components/Button/Button.stories.d.ts +0 -1
- package/dist/Components/Button/Button.stories.js +0 -6
- package/dist/Components/Button/Button.styles.d.ts +0 -2
- package/dist/Components/Button/Button.styles.js +0 -112
- package/dist/Components/Button/ButtonProps.d.ts +0 -13
- package/dist/Components/Button/ButtonProps.js +0 -2
- package/dist/Components/ButtonGroupIcon/ButtonGoupIconProps.d.ts +0 -33
- package/dist/Components/ButtonGroupIcon/ButtonGoupIconProps.js +0 -2
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.d.ts +0 -5
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +0 -86
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.stories.d.ts +0 -1
- package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.stories.js +0 -6
- package/dist/Components/Buttons/Buttons.d.ts +0 -4
- package/dist/Components/Buttons/Buttons.js +0 -11
- package/dist/Components/Buttons/ButtonsProps.js +0 -2
- package/dist/Components/Card/Card.d.ts +0 -3
- package/dist/Components/Card/Card.js +0 -12
- package/dist/Components/Card/CardProps.d.ts +0 -14
- package/dist/Components/Card/CardProps.js +0 -2
- package/dist/Components/Checkbox/Checkbox.d.ts +0 -3
- package/dist/Components/Checkbox/Checkbox.js +0 -20
- package/dist/Components/Checkbox/Checkbox.stories.d.ts +0 -1
- package/dist/Components/Checkbox/Checkbox.stories.js +0 -7
- package/dist/Components/Checkbox/Checkbox.styles.d.ts +0 -2
- package/dist/Components/Checkbox/Checkbox.styles.js +0 -54
- package/dist/Components/Checkbox/CheckboxProps.d.ts +0 -15
- package/dist/Components/Checkbox/CheckboxProps.js +0 -2
- package/dist/Components/Common/ErrorComponent.d.ts +0 -6
- package/dist/Components/Common/ErrorComponent.js +0 -16
- package/dist/Components/Common/ErrorMessage.d.ts +0 -5
- package/dist/Components/Common/ErrorMessage.js +0 -17
- package/dist/Components/Common/FormLabel.d.ts +0 -8
- package/dist/Components/Common/FormLabel.js +0 -22
- package/dist/Components/Common/HelperText.d.ts +0 -5
- package/dist/Components/Common/HelperText.js +0 -14
- package/dist/Components/Common/Label.d.ts +0 -7
- package/dist/Components/Common/Label.js +0 -13
- package/dist/Components/ContactForm/ContactForm.d.ts +0 -4
- package/dist/Components/ContactForm/ContactForm.js +0 -215
- package/dist/Components/ContactForm/ContactFormProps.d.ts +0 -9
- package/dist/Components/ContactForm/ContactFormProps.js +0 -2
- package/dist/Components/DatePicker/DatePicker.d.ts +0 -3
- package/dist/Components/DatePicker/DatePicker.js +0 -235
- package/dist/Components/DatePicker/DatePickerProps.d.ts +0 -42
- package/dist/Components/DatePicker/DatePickerProps.js +0 -2
- package/dist/Components/DatePicker/TimePicker.d.ts +0 -4
- package/dist/Components/DatePicker/TimePicker.js +0 -101
- package/dist/Components/Divider/Divider.d.ts +0 -3
- package/dist/Components/Divider/Divider.js +0 -14
- package/dist/Components/Drawer/Drawer.d.ts +0 -12
- package/dist/Components/Drawer/Drawer.js +0 -40
- package/dist/Components/Drawer/DrawerProps.d.ts +0 -8
- package/dist/Components/Drawer/DrawerProps.js +0 -2
- package/dist/Components/Dropdown/DropDown.d.ts +0 -4
- package/dist/Components/Dropdown/DropDown.js +0 -97
- package/dist/Components/Dropdown/DropdownProps.d.ts +0 -26
- package/dist/Components/Dropdown/DropdownProps.js +0 -2
- package/dist/Components/Editor/Editor.d.ts +0 -3
- package/dist/Components/Editor/Editor.js +0 -12
- package/dist/Components/Editor/EditorProps.d.ts +0 -5
- package/dist/Components/Editor/EditorProps.js +0 -2
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.d.ts +0 -3
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtp.js +0 -44
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtpProps.d.ts +0 -13
- package/dist/Components/EmailCards/VerifyEmailOtp/VerifyEmailOtpProps.js +0 -2
- package/dist/Components/FileUpload/FileUpload.d.ts +0 -4
- package/dist/Components/FileUpload/FileUpload.js +0 -156
- package/dist/Components/FileUpload/FileUploadProps.d.ts +0 -11
- package/dist/Components/FileUpload/FileUploadProps.js +0 -2
- package/dist/Components/FileUpload/constants.d.ts +0 -3
- package/dist/Components/FileUpload/constants.js +0 -28
- package/dist/Components/Form/FormWrapper.d.ts +0 -7
- package/dist/Components/Form/FormWrapper.js +0 -19
- package/dist/Components/Header/Header.d.ts +0 -4
- package/dist/Components/Header/Header.js +0 -57
- package/dist/Components/Header/HeaderActions.d.ts +0 -23
- package/dist/Components/Header/HeaderActions.js +0 -37
- package/dist/Components/Header/HeaderProps.d.ts +0 -44
- package/dist/Components/Header/HeaderProps.js +0 -2
- package/dist/Components/Header/components/desktopMenu.d.ts +0 -4
- package/dist/Components/Header/components/desktopMenu.js +0 -33
- package/dist/Components/Header/components/mobileMenu.d.ts +0 -4
- package/dist/Components/Header/components/mobileMenu.js +0 -32
- package/dist/Components/Input/Input/Input.d.ts +0 -4
- package/dist/Components/Input/Input/Input.js +0 -45
- package/dist/Components/Input/Input/InputProps.js +0 -2
- package/dist/Components/Input/TextInput.d.ts +0 -4
- package/dist/Components/Input/TextInput.js +0 -68
- package/dist/Components/Input/TextInput.stories.d.ts +0 -1
- package/dist/Components/Input/TextInput.stories.js +0 -8
- package/dist/Components/Input/TextInput.styles.d.ts +0 -2
- package/dist/Components/Input/TextInputProps.js +0 -2
- package/dist/Components/InputTextArea/InputTextArea.d.ts +0 -3
- package/dist/Components/InputTextArea/InputTextArea.js +0 -16
- package/dist/Components/InputTextArea/InputTextArea.stories.d.ts +0 -1
- package/dist/Components/InputTextArea/InputTextArea.stories.js +0 -7
- package/dist/Components/InputTextArea/InputTextAreaProps.js +0 -2
- package/dist/Components/KaTable/CustomHeader.d.ts +0 -14
- package/dist/Components/KaTable/CustomHeader.js +0 -69
- package/dist/Components/KaTable/KaTable.d.ts +0 -13
- package/dist/Components/KaTable/KaTable.js +0 -111
- package/dist/Components/KaTable/KaTableProps.d.ts +0 -23
- package/dist/Components/KaTable/KaTableProps.js +0 -2
- package/dist/Components/KaTable/SelectionCell.d.ts +0 -8
- package/dist/Components/KaTable/SelectionCell.js +0 -38
- package/dist/Components/KaTable/SelectionHeader.d.ts +0 -3
- package/dist/Components/KaTable/SelectionHeader.js +0 -56
- package/dist/Components/KaTable/ka-table.css +0 -27
- package/dist/Components/KaTable/useMergedChildComponents.d.ts +0 -14
- package/dist/Components/KaTable/useMergedChildComponents.js +0 -224
- package/dist/Components/KanbanBoard/AccountCard.d.ts +0 -9
- package/dist/Components/KanbanBoard/AccountCard.js +0 -74
- package/dist/Components/KanbanBoard/AccountRow.d.ts +0 -6
- package/dist/Components/KanbanBoard/AccountRow.js +0 -20
- package/dist/Components/KanbanBoard/KanbanActions/KanbanActions.d.ts +0 -9
- package/dist/Components/KanbanBoard/KanbanActions/KanbanActions.js +0 -26
- package/dist/Components/KanbanBoard/KanbanBoard.d.ts +0 -4
- package/dist/Components/KanbanBoard/KanbanBoard.js +0 -120
- package/dist/Components/KanbanBoard/KanbanBoardProps.d.ts +0 -27
- package/dist/Components/KanbanBoard/KanbanBoardProps.js +0 -2
- package/dist/Components/Loading/Loading.d.ts +0 -3
- package/dist/Components/Loading/Loading.js +0 -36
- package/dist/Components/Loading/Loading.stories.d.ts +0 -1
- package/dist/Components/Loading/Loading.stories.js +0 -7
- package/dist/Components/Loading/LoadingProps.d.ts +0 -5
- package/dist/Components/Loading/LoadingProps.js +0 -2
- package/dist/Components/Modal/Modal.d.ts +0 -12
- package/dist/Components/Modal/Modal.js +0 -50
- package/dist/Components/Modal/Modal.stories.d.ts +0 -1
- package/dist/Components/Modal/Modal.stories.js +0 -7
- package/dist/Components/Modal/ModalProps.d.ts +0 -11
- package/dist/Components/Modal/ModalProps.js +0 -2
- package/dist/Components/MultiSelect/MultiSelect.d.ts +0 -3
- package/dist/Components/MultiSelect/MultiSelect.js +0 -115
- package/dist/Components/MultiSelect/MultiSelectProps.d.ts +0 -20
- package/dist/Components/MultiSelect/MultiSelectProps.js +0 -2
- package/dist/Components/NavigationBar/NavBar.stories.d.ts +0 -1
- package/dist/Components/NavigationBar/NavBar.stories.js +0 -3
- package/dist/Components/NavigationBar/NavigationBar.d.ts +0 -3
- package/dist/Components/NavigationBar/NavigationBar.js +0 -50
- package/dist/Components/NavigationBar/NavigationBarProps.d.ts +0 -19
- package/dist/Components/NavigationBar/NavigationBarProps.js +0 -2
- package/dist/Components/NoteTextArea/NoteTextArea.d.ts +0 -3
- package/dist/Components/NoteTextArea/NoteTextArea.js +0 -274
- package/dist/Components/NoteTextArea/NoteTextAreaProps.d.ts +0 -16
- package/dist/Components/NoteTextArea/NoteTextAreaProps.js +0 -2
- package/dist/Components/NumberInput/NumberInput.d.ts +0 -3
- package/dist/Components/NumberInput/NumberInput.js +0 -16
- package/dist/Components/NumberInput/NumberInput.stories.d.ts +0 -1
- package/dist/Components/NumberInput/NumberInput.stories.js +0 -5
- package/dist/Components/NumberInput/NumberInputProps.d.ts +0 -12
- package/dist/Components/NumberInput/NumberInputProps.js +0 -2
- package/dist/Components/PinInput/PinInput.d.ts +0 -3
- package/dist/Components/PinInput/PinInput.js +0 -15
- package/dist/Components/PinInput/PinInput.stories.d.ts +0 -1
- package/dist/Components/PinInput/PinInput.stories.js +0 -6
- package/dist/Components/PinInput/PinInputProps.d.ts +0 -9
- package/dist/Components/PinInput/PinInputProps.js +0 -2
- package/dist/Components/PinInputs/PinInputs.d.ts +0 -4
- package/dist/Components/PinInputs/PinInputs.js +0 -71
- package/dist/Components/PinInputs/PinInputsProps.js +0 -2
- package/dist/Components/ProductCard/ProductCard.d.ts +0 -4
- package/dist/Components/ProductCard/ProductCard.js +0 -51
- package/dist/Components/ProductCard/ProductCardProps.js +0 -2
- package/dist/Components/ProductCard/ProductLabel.d.ts +0 -6
- package/dist/Components/ProductCard/ProductLabel.js +0 -14
- package/dist/Components/ProductCard/ProductPrice.d.ts +0 -7
- package/dist/Components/ProductCard/ProductPrice.js +0 -88
- package/dist/Components/ProductCard/ProductReview.d.ts +0 -7
- package/dist/Components/ProductCard/ProductReview.js +0 -23
- package/dist/Components/ProductCard/ProductTags.d.ts +0 -7
- package/dist/Components/ProductCard/ProductTags.js +0 -30
- package/dist/Components/ProfileCard/ProfileCard.d.ts +0 -12
- package/dist/Components/ProfileCard/ProfileCard.js +0 -57
- package/dist/Components/ProfileCard/ProfileCard.stories.d.ts +0 -1
- package/dist/Components/ProfileCard/ProfileCard.stories.js +0 -6
- package/dist/Components/ProfileCard/ProfileCardProps.d.ts +0 -16
- package/dist/Components/ProfileCard/ProfileCardProps.js +0 -2
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.d.ts +0 -3
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +0 -94
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.stories.d.ts +0 -1
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.stories.js +0 -6
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.d.ts +0 -19
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.js +0 -2
- package/dist/Components/ProgressBar/ProgressBar.d.ts +0 -3
- package/dist/Components/ProgressBar/ProgressBar.js +0 -12
- package/dist/Components/ProgressBar/ProgressBar.stories.d.ts +0 -1
- package/dist/Components/ProgressBar/ProgressBar.stories.js +0 -7
- package/dist/Components/ProgressBar/ProgressBarProps.js +0 -2
- package/dist/Components/RadioButton/RadioButton.d.ts +0 -5
- package/dist/Components/RadioButton/RadioButton.js +0 -31
- package/dist/Components/RadioButton/RadioButton.stories.d.ts +0 -1
- package/dist/Components/RadioButton/RadioButton.stories.js +0 -7
- package/dist/Components/RadioButton/RadioButtonProps.d.ts +0 -11
- package/dist/Components/RadioButton/RadioButtonProps.js +0 -2
- package/dist/Components/Reorder/Reorder.d.ts +0 -4
- package/dist/Components/Reorder/Reorder.js +0 -50
- package/dist/Components/Reorder/ReorderProps.d.ts +0 -10
- package/dist/Components/Reorder/ReorderProps.js +0 -2
- package/dist/Components/Search/Search.d.ts +0 -3
- package/dist/Components/Search/Search.js +0 -66
- package/dist/Components/Search/SearchProps.d.ts +0 -8
- package/dist/Components/Search/SearchProps.js +0 -2
- package/dist/Components/SearchSelect/SearchSelect.d.ts +0 -4
- package/dist/Components/SearchSelect/SearchSelect.js +0 -237
- package/dist/Components/SearchSelect/SearchSelectProps.d.ts +0 -60
- package/dist/Components/SearchSelect/SearchSelectProps.js +0 -2
- package/dist/Components/SearchSelect/SelectTruncatedLabel.d.ts +0 -6
- package/dist/Components/SearchSelect/SelectTruncatedLabel.js +0 -45
- package/dist/Components/Select/Select.d.ts +0 -3
- package/dist/Components/Select/Select.js +0 -54
- package/dist/Components/Select/Select.stories.d.ts +0 -1
- package/dist/Components/Select/Select.stories.js +0 -8
- package/dist/Components/Select/Select.styles.d.ts +0 -2
- package/dist/Components/Select/Select.styles.js +0 -98
- package/dist/Components/Select/SelectProps.d.ts +0 -20
- package/dist/Components/Select/SelectProps.js +0 -2
- package/dist/Components/SelectSearch/SelectSearch.d.ts +0 -3
- package/dist/Components/SelectSearch/SelectSearch.js +0 -239
- package/dist/Components/SelectSearch/SelectSearchProps.d.ts +0 -42
- package/dist/Components/SelectSearch/SelectSearchProps.js +0 -2
- package/dist/Components/SideBar/SideBar.d.ts +0 -3
- package/dist/Components/SideBar/SideBar.js +0 -55
- package/dist/Components/SideBar/SideBarProps.d.ts +0 -29
- package/dist/Components/SideBar/SideBarProps.js +0 -2
- package/dist/Components/SideBar/Sidebar.stories.d.ts +0 -1
- package/dist/Components/SideBar/Sidebar.stories.js +0 -7
- package/dist/Components/SideBar/components/MenuItemBox.d.ts +0 -11
- package/dist/Components/SideBar/components/MenuItemBox.js +0 -116
- package/dist/Components/SideBar/components/MenuItems.d.ts +0 -4
- package/dist/Components/SideBar/components/MenuItems.js +0 -13
- package/dist/Components/SideBar/components/MenuPopoverContent.d.ts +0 -9
- package/dist/Components/SideBar/components/MenuPopoverContent.js +0 -37
- package/dist/Components/SideBar/components/TextTruncation.d.ts +0 -8
- package/dist/Components/SideBar/components/TextTruncation.js +0 -77
- package/dist/Components/Skeletons/Skeleton.stories.d.ts +0 -1
- package/dist/Components/Skeletons/Skeleton.stories.js +0 -7
- package/dist/Components/Skeletons/SkeletonProps.d.ts +0 -4
- package/dist/Components/Skeletons/SkeletonProps.js +0 -2
- package/dist/Components/Skeletons/Skeletons.d.ts +0 -3
- package/dist/Components/Skeletons/Skeletons.js +0 -15
- package/dist/Components/Slider/Slider.d.ts +0 -8
- package/dist/Components/Slider/Slider.js +0 -57
- package/dist/Components/Switch/Switch.d.ts +0 -3
- package/dist/Components/Switch/Switch.js +0 -39
- package/dist/Components/Switch/SwitchProps.d.ts +0 -9
- package/dist/Components/Switch/SwitchProps.js +0 -2
- package/dist/Components/Table/Components/HeaderActions.d.ts +0 -7
- package/dist/Components/Table/Components/HeaderActions.js +0 -45
- package/dist/Components/Table/Components/Pagination.d.ts +0 -14
- package/dist/Components/Table/Components/Pagination.js +0 -32
- package/dist/Components/Table/Components/TableActions.d.ts +0 -3
- package/dist/Components/Table/Components/TableActions.js +0 -28
- package/dist/Components/Table/Components/TableBody.d.ts +0 -4
- package/dist/Components/Table/Components/TableBody.js +0 -140
- package/dist/Components/Table/Components/TableFilters.d.ts +0 -4
- package/dist/Components/Table/Components/TableFilters.js +0 -59
- package/dist/Components/Table/Components/TableHeader.d.ts +0 -4
- package/dist/Components/Table/Components/TableHeader.js +0 -147
- package/dist/Components/Table/Components/TableLoading.d.ts +0 -7
- package/dist/Components/Table/Components/TableLoading.js +0 -41
- package/dist/Components/Table/Components/TableSearch.d.ts +0 -6
- package/dist/Components/Table/Components/TableSearch.js +0 -60
- package/dist/Components/Table/Components/useDebounce.d.ts +0 -2
- package/dist/Components/Table/Components/useDebounce.js +0 -28
- package/dist/Components/Table/Components/useTable.d.ts +0 -46
- package/dist/Components/Table/Components/useTable.js +0 -168
- package/dist/Components/Table/Table.css +0 -16
- package/dist/Components/Table/Table.d.ts +0 -3
- package/dist/Components/Table/Table.js +0 -129
- package/dist/Components/Table/Table.stories.d.ts +0 -1
- package/dist/Components/Table/Table.stories.js +0 -9
- package/dist/Components/Table/TableProps.d.ts +0 -112
- package/dist/Components/Table/TableProps.js +0 -2
- package/dist/Components/Table/TableSettings/ManageColumns.d.ts +0 -10
- package/dist/Components/Table/TableSettings/ManageColumns.js +0 -107
- package/dist/Components/Table/TableSettings/TableSettings.d.ts +0 -7
- package/dist/Components/Table/TableSettings/TableSettings.js +0 -73
- package/dist/Components/Table/TableToDo.d.ts +0 -2
- package/dist/Components/Tag/Tag.d.ts +0 -12
- package/dist/Components/Tag/Tag.js +0 -21
- package/dist/Components/Tag/Tag.styles.d.ts +0 -2
- package/dist/Components/Tag/Tag.styles.js +0 -63
- package/dist/Components/Timeline/Timeline.d.ts +0 -4
- package/dist/Components/Timeline/Timeline.js +0 -166
- package/dist/Components/Timeline/TimelineProps.d.ts +0 -20
- package/dist/Components/Timeline/TimelineProps.js +0 -2
- package/dist/Components/Toaster/Toaster.d.ts +0 -4
- package/dist/Components/Toaster/Toaster.js +0 -86
- package/dist/Components/Toaster/Toaster.stories.d.ts +0 -1
- package/dist/Components/Toaster/Toaster.stories.js +0 -8
- package/dist/Components/Toaster/ToasterProps.js +0 -2
- package/dist/Components/Toggle/TableToggle.d.ts +0 -4
- package/dist/Components/Toggle/TableToggle.js +0 -60
- package/dist/Components/Toggle/TableToggleProps.js +0 -2
- package/dist/Components/ToolTip/ToolTip.d.ts +0 -3
- package/dist/Components/ToolTip/ToolTip.js +0 -12
- package/dist/Components/ToolTip/ToolTip.stories.d.ts +0 -1
- package/dist/Components/ToolTip/ToolTip.stories.js +0 -7
- package/dist/Components/ToolTip/ToolTipProps.d.ts +0 -7
- package/dist/Components/ToolTip/ToolTipProps.js +0 -2
- package/dist/Components/Trail/EditableCell.d.ts +0 -11
- package/dist/Components/Trail/EditableCell.js +0 -71
- package/dist/Components/Trail/SelectAllCheckbox.d.ts +0 -8
- package/dist/Components/Trail/SelectAllCheckbox.js +0 -13
- package/dist/Components/Trail/TrailWorks.d.ts +0 -3
- package/dist/Components/Trail/data.d.ts +0 -15
- package/dist/Components/Trail/data.js +0 -29
- package/dist/Constants/Sidebar.d.ts +0 -38
- package/dist/Constants/Sidebar.js +0 -42
- package/dist/Hooks/usePreferences.d.ts +0 -24
- package/dist/Hooks/usePreferences.js +0 -73
- package/dist/Layout.d.ts +0 -3
- package/dist/Layout.js +0 -269
- package/dist/Pages/KaTableExample.d.ts +0 -3
- package/dist/Pages/KaTableExample.js +0 -259
- package/dist/Pages/TInput.d.ts +0 -3
- package/dist/Pages/TInput.js +0 -46
- package/dist/Pages/accordion.d.ts +0 -3
- package/dist/Pages/accordion.js +0 -42
- package/dist/Pages/alertdialog.d.ts +0 -3
- package/dist/Pages/alertdialog.js +0 -44
- package/dist/Pages/button.d.ts +0 -3
- package/dist/Pages/button.js +0 -29
- package/dist/Pages/card.d.ts +0 -3
- package/dist/Pages/card.js +0 -48
- package/dist/Pages/chart.d.ts +0 -3
- package/dist/Pages/chart.js +0 -28
- package/dist/Pages/checkbox.d.ts +0 -3
- package/dist/Pages/checkbox.js +0 -12
- package/dist/Pages/contactForm.d.ts +0 -3
- package/dist/Pages/contactForm.js +0 -16
- package/dist/Pages/datePick.d.ts +0 -3
- package/dist/Pages/datePick.js +0 -70
- package/dist/Pages/drawer.d.ts +0 -3
- package/dist/Pages/drawer.js +0 -48
- package/dist/Pages/dropdown.d.ts +0 -3
- package/dist/Pages/dropdown.js +0 -24
- package/dist/Pages/editor.d.ts +0 -3
- package/dist/Pages/editor.js +0 -14
- package/dist/Pages/fileUpload.d.ts +0 -2
- package/dist/Pages/fileUpload.js +0 -65
- package/dist/Pages/input.d.ts +0 -3
- package/dist/Pages/input.js +0 -42
- package/dist/Pages/kanbanboard.d.ts +0 -3
- package/dist/Pages/kanbanboard.js +0 -115
- package/dist/Pages/modal.d.ts +0 -3
- package/dist/Pages/modal.js +0 -55
- package/dist/Pages/multiSelect.d.ts +0 -3
- package/dist/Pages/multiSelect.js +0 -45
- package/dist/Pages/noteArea.d.ts +0 -3
- package/dist/Pages/noteArea.js +0 -49
- package/dist/Pages/numberInput.d.ts +0 -3
- package/dist/Pages/numberInput.js +0 -39
- package/dist/Pages/photoViewer.d.ts +0 -3
- package/dist/Pages/photoViewer.js +0 -12
- package/dist/Pages/pinInputs.d.ts +0 -3
- package/dist/Pages/pinInputs.js +0 -12
- package/dist/Pages/productCaard.d.ts +0 -3
- package/dist/Pages/productCaard.js +0 -32
- package/dist/Pages/progressbar.d.ts +0 -3
- package/dist/Pages/progressbar.js +0 -12
- package/dist/Pages/radioButton.d.ts +0 -3
- package/dist/Pages/radioButton.js +0 -44
- package/dist/Pages/search.d.ts +0 -3
- package/dist/Pages/search.js +0 -44
- package/dist/Pages/searchSelect.d.ts +0 -3
- package/dist/Pages/searchSelect.js +0 -151
- package/dist/Pages/select.d.ts +0 -3
- package/dist/Pages/select.js +0 -43
- package/dist/Pages/selectSearch.d.ts +0 -3
- package/dist/Pages/selectSearch.js +0 -93
- package/dist/Pages/skeleton.d.ts +0 -3
- package/dist/Pages/skeleton.js +0 -22
- package/dist/Pages/switch.d.ts +0 -3
- package/dist/Pages/switch.js +0 -40
- package/dist/Pages/table.d.ts +0 -2
- package/dist/Pages/table.js +0 -144
- package/dist/Pages/textArea.d.ts +0 -3
- package/dist/Pages/textArea.js +0 -12
- package/dist/Pages/timeline.d.ts +0 -3
- package/dist/Pages/timeline.js +0 -74
- package/dist/Pages/tooltip.d.ts +0 -3
- package/dist/Pages/tooltip.js +0 -12
- package/dist/Pages/toster.d.ts +0 -3
- package/dist/Pages/toster.js +0 -63
- package/dist/Pages/verifyEmail.d.ts +0 -3
- package/dist/Pages/verifyEmail.js +0 -18
- package/dist/Theme/Dark/theme.d.ts +0 -2
- package/dist/Theme/Default/fonts.d.ts +0 -35
- package/dist/Theme/Default/fonts.js +0 -37
- package/dist/Theme/Default/palette.d.ts +0 -370
- package/dist/Theme/Default/palette.js +0 -372
- package/dist/Theme/Default/theme.d.ts +0 -2
- package/dist/Theme/Default/theme.js +0 -23
- package/dist/Theme/Meadow/palette.d.ts +0 -368
- package/dist/Theme/Meadow/palette.js +0 -356
- package/dist/Theme/Meadow/theme.d.ts +0 -2
- package/dist/Theme/Meadow/theme.js +0 -23
- package/dist/Theme/Radiant/palette.d.ts +0 -368
- package/dist/Theme/Radiant/palette.js +0 -356
- package/dist/Theme/Radiant/theme.d.ts +0 -2
- package/dist/Theme/Radiant/theme.js +0 -23
- package/dist/Theme/Skyline/palette.d.ts +0 -368
- package/dist/Theme/Skyline/palette.js +0 -356
- package/dist/Theme/Skyline/theme.d.ts +0 -2
- package/dist/Theme/Skyline/theme.js +0 -23
- package/dist/Theme/common.d.ts +0 -166
- package/dist/Theme/componentStyles.d.ts +0 -7
- package/dist/Theme/componentStyles.js +0 -15
- package/dist/Theme/fonts.d.ts +0 -34
- package/dist/Theme/fonts.js +0 -41
- package/dist/Theme/index.js +0 -20
- package/dist/Theme/space.d.ts +0 -33
- package/dist/Theme/space.js +0 -35
- package/dist/Theme/theme.d.ts +0 -2
- package/dist/Theme/theme.js +0 -9
- package/dist/Theme/themeProps.d.ts +0 -475
- package/dist/Theme/themeProps.js +0 -3
- package/dist/Theme/useCustomTheme.d.ts +0 -2
- package/dist/Theme/useCustomTheme.js +0 -8
- package/dist/Utils/table.d.ts +0 -36
- package/dist/Utils/table.js +0 -168
- package/dist/bootstrap.d.ts +0 -1
- package/dist/bootstrap.js +0 -14
- package/dist/withTheme.d.ts +0 -3
- package/dist/withTheme.js +0 -28
- /package/{dist → src}/Assets/defaultLogo.tsx +0 -0
- /package/{dist → src}/global.css +0 -0
- /package/{dist → src}/index.css +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React, { ChangeEvent, useRef, useState } from "react";
|
|
2
|
+
import { Box, Image, IconButton, Input, Text, Tooltip } from "@chakra-ui/react";
|
|
3
|
+
import { ProfilePhotoViewerProps } from "./ProfilePhotoViewerProps";
|
|
4
|
+
import { Eye, FileText, SquarePen, User } from "lucide-react";
|
|
5
|
+
|
|
6
|
+
export default function ProfilePhotoViewer({
|
|
7
|
+
photoUrl,
|
|
8
|
+
onPhotoChange,
|
|
9
|
+
imageWidth = "100px",
|
|
10
|
+
imageAlt = "Profile Photo",
|
|
11
|
+
imageObjectFit = "cover",
|
|
12
|
+
imageBorderRadius = "full",
|
|
13
|
+
editIconSize = "sm",
|
|
14
|
+
editIconPositionRight = "0px",
|
|
15
|
+
editIconPositionBottom = "0px",
|
|
16
|
+
isRound = true,
|
|
17
|
+
boxStyle,
|
|
18
|
+
isEditable = false,
|
|
19
|
+
isView = false,
|
|
20
|
+
style,
|
|
21
|
+
handleIsView,
|
|
22
|
+
fallbackText,
|
|
23
|
+
}: ProfilePhotoViewerProps) {
|
|
24
|
+
const [photo, setPhoto] = useState<string>(photoUrl);
|
|
25
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
26
|
+
|
|
27
|
+
const handlePhotoChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
28
|
+
if (!isEditable) return;
|
|
29
|
+
const file = event.target.files?.[0];
|
|
30
|
+
if (file) {
|
|
31
|
+
const reader = new FileReader();
|
|
32
|
+
reader.onload = () => {
|
|
33
|
+
const photoUrl = reader.result as string;
|
|
34
|
+
setPhoto(photoUrl);
|
|
35
|
+
onPhotoChange(file);
|
|
36
|
+
};
|
|
37
|
+
reader.readAsDataURL(file);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const handleClick = () => {
|
|
41
|
+
if (!isEditable) return;
|
|
42
|
+
fileInputRef.current?.click();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const isPdf = photo?.endsWith(".pdf");
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Box
|
|
49
|
+
position="relative"
|
|
50
|
+
display="inline-block"
|
|
51
|
+
style={boxStyle}
|
|
52
|
+
sx={{
|
|
53
|
+
"&:hover .icon-button": {
|
|
54
|
+
opacity: 1,
|
|
55
|
+
},
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{photo ? (
|
|
59
|
+
isPdf ? (
|
|
60
|
+
<Box
|
|
61
|
+
width={imageWidth}
|
|
62
|
+
height={imageWidth}
|
|
63
|
+
borderRadius={imageBorderRadius}
|
|
64
|
+
bg="gray.200"
|
|
65
|
+
display="flex"
|
|
66
|
+
alignItems="center"
|
|
67
|
+
justifyContent="center"
|
|
68
|
+
overflow="hidden"
|
|
69
|
+
>
|
|
70
|
+
<FileText size={"50%"} />
|
|
71
|
+
</Box>
|
|
72
|
+
) : (
|
|
73
|
+
<Image
|
|
74
|
+
src={photo}
|
|
75
|
+
alt={imageAlt}
|
|
76
|
+
boxSize={imageWidth}
|
|
77
|
+
objectFit={imageObjectFit}
|
|
78
|
+
borderRadius={imageBorderRadius}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
) : fallbackText ? (
|
|
82
|
+
<Box
|
|
83
|
+
boxSize={imageWidth}
|
|
84
|
+
display="flex"
|
|
85
|
+
alignItems="center"
|
|
86
|
+
justifyContent="center"
|
|
87
|
+
borderRadius={imageBorderRadius}
|
|
88
|
+
bg="gray.200"
|
|
89
|
+
>
|
|
90
|
+
<Text fontSize="2xl" fontWeight="bold">
|
|
91
|
+
{fallbackText}
|
|
92
|
+
</Text>
|
|
93
|
+
</Box>
|
|
94
|
+
) : (
|
|
95
|
+
<Box
|
|
96
|
+
boxSize={imageWidth}
|
|
97
|
+
display="flex"
|
|
98
|
+
alignItems="center"
|
|
99
|
+
justifyContent="center"
|
|
100
|
+
borderRadius={imageBorderRadius}
|
|
101
|
+
bg="gray.200"
|
|
102
|
+
>
|
|
103
|
+
<User size="50%" />
|
|
104
|
+
</Box>
|
|
105
|
+
)}
|
|
106
|
+
|
|
107
|
+
{(isEditable || isView) && (
|
|
108
|
+
<>
|
|
109
|
+
<Box
|
|
110
|
+
className="icon-button"
|
|
111
|
+
position="absolute"
|
|
112
|
+
right={editIconPositionRight}
|
|
113
|
+
bottom={editIconPositionBottom}
|
|
114
|
+
transform="translate(-25%, -25%)"
|
|
115
|
+
sx={{
|
|
116
|
+
opacity: 0,
|
|
117
|
+
transition: "opacity 0.3s",
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
{isEditable && (
|
|
121
|
+
<Tooltip label="Edit" aria-label="Edit">
|
|
122
|
+
<IconButton
|
|
123
|
+
icon={<SquarePen size={14}/>}
|
|
124
|
+
isRound={isRound}
|
|
125
|
+
size={editIconSize}
|
|
126
|
+
onClick={handleClick}
|
|
127
|
+
aria-label="Edit photo"
|
|
128
|
+
style={{
|
|
129
|
+
...style,
|
|
130
|
+
transition: "transform 0.3s, box-shadow 0.3s",
|
|
131
|
+
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.2)",
|
|
132
|
+
marginRight: "3px",
|
|
133
|
+
}}
|
|
134
|
+
_hover={{
|
|
135
|
+
transform: "scale(1.1)",
|
|
136
|
+
color: "blue.500",
|
|
137
|
+
boxShadow: "0 8px 16px rgba(0, 0, 0, 0.3)",
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
</Tooltip>
|
|
141
|
+
)}
|
|
142
|
+
{isView && (
|
|
143
|
+
<Tooltip label="View" aria-label="View">
|
|
144
|
+
<IconButton
|
|
145
|
+
icon={<Eye size={14}/>}
|
|
146
|
+
isRound={isRound}
|
|
147
|
+
size={editIconSize}
|
|
148
|
+
onClick={handleIsView}
|
|
149
|
+
aria-label="View photo"
|
|
150
|
+
style={{
|
|
151
|
+
...style,
|
|
152
|
+
transition: "transform 0.3s, box-shadow 0.3s",
|
|
153
|
+
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.2)",
|
|
154
|
+
}}
|
|
155
|
+
_hover={{
|
|
156
|
+
transform: "scale(1.1)",
|
|
157
|
+
color: "blue.500",
|
|
158
|
+
boxShadow: "0 8px 16px rgba(0, 0, 0, 0.3)",
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
</Tooltip>
|
|
162
|
+
)}
|
|
163
|
+
</Box>
|
|
164
|
+
{isEditable && (
|
|
165
|
+
<Input
|
|
166
|
+
type="file"
|
|
167
|
+
accept="image/*"
|
|
168
|
+
onChange={handlePhotoChange}
|
|
169
|
+
hidden
|
|
170
|
+
ref={fileInputRef}
|
|
171
|
+
/>
|
|
172
|
+
)}
|
|
173
|
+
</>
|
|
174
|
+
)}
|
|
175
|
+
</Box>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ProfilePhotoViewerProps = {
|
|
2
|
+
photoUrl: string;
|
|
3
|
+
onPhotoChange: (photoUrl: File) => void;
|
|
4
|
+
imageWidth?: string;
|
|
5
|
+
imageAlt?: string;
|
|
6
|
+
imageObjectFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
7
|
+
imageBorderRadius?: string;
|
|
8
|
+
isEditable?: boolean;
|
|
9
|
+
editIconSize?: string;
|
|
10
|
+
editIconPositionRight?: string;
|
|
11
|
+
editIconPositionBottom?: string;
|
|
12
|
+
isRound?: boolean;
|
|
13
|
+
boxStyle?: React.CSSProperties;
|
|
14
|
+
isView?: boolean;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
handleIsView?: () => void;
|
|
17
|
+
fallbackText?: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
// import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
// import { ChakraProvider } from '@chakra-ui/react';
|
|
4
|
+
// import ProgressBar from './ProgressBar'; // Adjust the import path and component type if needed
|
|
5
|
+
// import { ProgressBarProps } from "./ProgressBarProps";
|
|
6
|
+
|
|
7
|
+
// export default {
|
|
8
|
+
// title: 'Components/ProgressBar/ProgressBar',
|
|
9
|
+
// component: ProgressBar,
|
|
10
|
+
// argTypes: {
|
|
11
|
+
// size: { control: { type: 'select', options: ['sm', 'md', 'lg'] } },
|
|
12
|
+
// variant: {
|
|
13
|
+
// control: { type: 'select', options: ["solid","outline","ghost","link"] },
|
|
14
|
+
// defaultValue: 'solid'
|
|
15
|
+
// },
|
|
16
|
+
// color: {
|
|
17
|
+
// control: { type: 'select', options: ["gray" ,"red" ,"orange" ,"yellow" ,"green" ,"teal" ,"blue" ,"cyan" ,"purple" ,"pink" ,"whiteAlpha" ,"blackAlpha"] },
|
|
18
|
+
// defaultValue: 'blue'
|
|
19
|
+
// },
|
|
20
|
+
// height: { control: { type: 'text' } },
|
|
21
|
+
// value: { control: { type: 'range', min: 0, max: 100, step: 1 } },
|
|
22
|
+
// max: { control: { type: 'number' } },
|
|
23
|
+
// min: { control: { type: 'number' } },
|
|
24
|
+
// },
|
|
25
|
+
// } as Meta;
|
|
26
|
+
|
|
27
|
+
// const Template: StoryFn<ProgressBarProps> = (args) => (
|
|
28
|
+
// <ChakraProvider>
|
|
29
|
+
// <ProgressBar {...args} />
|
|
30
|
+
// </ChakraProvider>
|
|
31
|
+
// );
|
|
32
|
+
|
|
33
|
+
// // Default Story
|
|
34
|
+
// export const Default = Template.bind({});
|
|
35
|
+
// Default.args = {
|
|
36
|
+
// size: 'md', // Provide appropriate size
|
|
37
|
+
// isIndeterminate: false, // Provide appropriate value
|
|
38
|
+
// color: 'blue', // Provide appropriate color scheme
|
|
39
|
+
// hasStripe: true, // Provide appropriate value
|
|
40
|
+
// height: '12px', // Provide appropriate height
|
|
41
|
+
// value: 50, // Provide appropriate value
|
|
42
|
+
// isAnimated: true, // Provide appropriate value
|
|
43
|
+
// max: 100, // Provide appropriate value
|
|
44
|
+
// min: 0, // Provide appropriate value
|
|
45
|
+
// variant: 'solid', // Provide appropriate variant
|
|
46
|
+
// };
|
|
47
|
+
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Progress } from "@chakra-ui/react";
|
|
3
|
+
import { ProgressBarProps } from "./ProgressBarProps";
|
|
4
|
+
|
|
5
|
+
export default function ProgressBar({
|
|
6
|
+
size,
|
|
7
|
+
isIndeterminate,
|
|
8
|
+
color,
|
|
9
|
+
hasStripe,
|
|
10
|
+
height,
|
|
11
|
+
value,
|
|
12
|
+
isAnimated,
|
|
13
|
+
max,
|
|
14
|
+
min,
|
|
15
|
+
variant,
|
|
16
|
+
}: ProgressBarProps) {
|
|
17
|
+
return (
|
|
18
|
+
<Progress
|
|
19
|
+
size={size}
|
|
20
|
+
isIndeterminate={isIndeterminate}
|
|
21
|
+
colorScheme={color}
|
|
22
|
+
hasStripe={hasStripe}
|
|
23
|
+
height={height}
|
|
24
|
+
value={value}
|
|
25
|
+
isAnimated={isAnimated}
|
|
26
|
+
max={max}
|
|
27
|
+
min={min}
|
|
28
|
+
variant={variant}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ProgressProps } from "@chakra-ui/react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
export type ProgressBarProps =Pick<ProgressProps,"size"|"isIndeterminate"|"value"|"height"|"hasStripe"|"isAnimated"|"max"|"min">&{
|
|
4
|
+
color?: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "whiteAlpha" | "blackAlpha",
|
|
5
|
+
variant?: "solid" | "outline" | "ghost" | "link" | "unstyled",
|
|
6
|
+
size?: "lg" | "md" | "sm" | "xs",
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// import React, { useState } from 'react';
|
|
2
|
+
// import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
// import { ChakraProvider } from '@chakra-ui/react';
|
|
4
|
+
// import { RadioButton, RadioButtonGroup } from './RadioButton';
|
|
5
|
+
// import { ChakraRadioProps, ChakraRadioGroupProps } from './RadioButtonProps';
|
|
6
|
+
|
|
7
|
+
// export default {
|
|
8
|
+
// title: 'Components/RadioButton/RadioButton',
|
|
9
|
+
// component: RadioButton,
|
|
10
|
+
// decorators: [(Story: any) => <ChakraProvider><Story /></ChakraProvider>],
|
|
11
|
+
// } as Meta<typeof RadioButton>;
|
|
12
|
+
|
|
13
|
+
// const RadioButtonTemplate: StoryFn<typeof RadioButton> = (args: ChakraRadioProps) => <RadioButton {...args} />;
|
|
14
|
+
|
|
15
|
+
// export const SingleRadioButton = RadioButtonTemplate.bind({});
|
|
16
|
+
// SingleRadioButton.args = {
|
|
17
|
+
// label: 'Option 1',
|
|
18
|
+
// value: '1',
|
|
19
|
+
// colorScheme: 'blue',
|
|
20
|
+
// size: 'md',
|
|
21
|
+
// };
|
|
22
|
+
|
|
23
|
+
// const RadioButtonGroupTemplate: StoryFn<typeof RadioButtonGroup> = (args: ChakraRadioGroupProps) => {
|
|
24
|
+
// const [selectedValue, setSelectedValue] = useState<string>(args.value as string);
|
|
25
|
+
|
|
26
|
+
// const handleChange = (value: string) => {
|
|
27
|
+
// setSelectedValue(value);
|
|
28
|
+
// if (args.onChange) {
|
|
29
|
+
// args.onChange(value);
|
|
30
|
+
// }
|
|
31
|
+
// };
|
|
32
|
+
|
|
33
|
+
// return <RadioButtonGroup {...args} value={selectedValue} onChange={handleChange} />;
|
|
34
|
+
// };
|
|
35
|
+
|
|
36
|
+
// export const RadioButtonGroupStory = RadioButtonGroupTemplate.bind({});
|
|
37
|
+
// RadioButtonGroupStory.args = {
|
|
38
|
+
// options: [
|
|
39
|
+
// { label: 'Option 1', id: '1' },
|
|
40
|
+
// { label: 'Option 2', id: '2' },
|
|
41
|
+
// { label: 'Option 3', id: '3' },
|
|
42
|
+
// ],
|
|
43
|
+
// value: '1',
|
|
44
|
+
// colorScheme: 'blue',
|
|
45
|
+
// size: 'md',
|
|
46
|
+
// };
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Radio as ChakraRadio,
|
|
4
|
+
RadioGroup as ChakraRadioGroup,
|
|
5
|
+
Box,
|
|
6
|
+
Stack,
|
|
7
|
+
} from "@chakra-ui/react";
|
|
8
|
+
import { ChakraRadioProps, ChakraRadioGroupProps } from "./RadioButtonProps";
|
|
9
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme";
|
|
10
|
+
|
|
11
|
+
const RadioButton = ({
|
|
12
|
+
label,
|
|
13
|
+
colorScheme,
|
|
14
|
+
isChecked,
|
|
15
|
+
onChange,
|
|
16
|
+
isDisabled,
|
|
17
|
+
size,
|
|
18
|
+
value,
|
|
19
|
+
defaultChecked,
|
|
20
|
+
}: ChakraRadioProps) => {
|
|
21
|
+
const theme = useCustomTheme();
|
|
22
|
+
return (
|
|
23
|
+
<ChakraRadio
|
|
24
|
+
colorScheme={colorScheme}
|
|
25
|
+
isChecked={isChecked}
|
|
26
|
+
onChange={onChange}
|
|
27
|
+
isDisabled={isDisabled}
|
|
28
|
+
size={size}
|
|
29
|
+
value={value}
|
|
30
|
+
defaultChecked={defaultChecked}
|
|
31
|
+
sx={{
|
|
32
|
+
"&[data-checked]": {
|
|
33
|
+
backgroundColor: theme.colors.primary[500],
|
|
34
|
+
borderColor: theme.colors.primary[500]
|
|
35
|
+
},
|
|
36
|
+
"&[data-checked]:hover": {
|
|
37
|
+
backgroundColor: theme.colors.primary[300], // Change this to your desired hover color
|
|
38
|
+
borderColor: theme.colors.primary[300], // Change this to your desired hover color
|
|
39
|
+
},
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<Box as="span">{label}</Box>
|
|
43
|
+
</ChakraRadio>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const RadioButtonGroup = ({
|
|
48
|
+
options,
|
|
49
|
+
onChange,
|
|
50
|
+
value,
|
|
51
|
+
defaultValue,
|
|
52
|
+
isDisabled,
|
|
53
|
+
size,
|
|
54
|
+
colorScheme,
|
|
55
|
+
}: ChakraRadioGroupProps) => {
|
|
56
|
+
return (
|
|
57
|
+
<ChakraRadioGroup
|
|
58
|
+
onChange={onChange}
|
|
59
|
+
value={value}
|
|
60
|
+
defaultValue={defaultValue}
|
|
61
|
+
>
|
|
62
|
+
<Stack direction="row" spacing={4}>
|
|
63
|
+
{options.map((option) => (
|
|
64
|
+
<RadioButton
|
|
65
|
+
key={option.id}
|
|
66
|
+
label={option.label}
|
|
67
|
+
value={option.id}
|
|
68
|
+
isDisabled={isDisabled}
|
|
69
|
+
size={size}
|
|
70
|
+
colorScheme={colorScheme}
|
|
71
|
+
/>
|
|
72
|
+
))}
|
|
73
|
+
</Stack>
|
|
74
|
+
</ChakraRadioGroup>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export { RadioButton, RadioButtonGroup };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { RadioProps, RadioGroupProps } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export type ChakraRadioProps = Pick<RadioProps, | "size" | "colorScheme" | "isChecked" | "onChange" | "isDisabled" | "value" | "defaultChecked"> & {
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export type ChakraRadioGroupProps = Pick<RadioGroupProps, | "size" | "colorScheme" | "isDisabled" | "defaultValue" | "value"> & {
|
|
8
|
+
options: { label: string; id: string }[];
|
|
9
|
+
onChange?: (value: string) => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Badge,
|
|
4
|
+
Box,
|
|
5
|
+
Divider,
|
|
6
|
+
HStack,
|
|
7
|
+
IconButton,
|
|
8
|
+
Image,
|
|
9
|
+
Text,
|
|
10
|
+
} from "@chakra-ui/react";
|
|
11
|
+
import {
|
|
12
|
+
DragDropContext,
|
|
13
|
+
Droppable,
|
|
14
|
+
Draggable,
|
|
15
|
+
DropResult,
|
|
16
|
+
} from "@hello-pangea/dnd";
|
|
17
|
+
import { BetweenHorizonalStart, GripVertical } from "lucide-react";
|
|
18
|
+
import { ReorderItem, ReorderListProps } from "./ReorderProps";
|
|
19
|
+
import { useCustomTheme } from "../../Theme/useCustomTheme";
|
|
20
|
+
|
|
21
|
+
const ReorderList = <T extends ReorderItem>({
|
|
22
|
+
label = "",
|
|
23
|
+
items,
|
|
24
|
+
onReorder,
|
|
25
|
+
}: ReorderListProps<T>): JSX.Element => {
|
|
26
|
+
const { colors } = useCustomTheme();
|
|
27
|
+
const handleDragEnd = (result: DropResult) => {
|
|
28
|
+
if (!result.destination) return;
|
|
29
|
+
|
|
30
|
+
const reordered = Array.from(items);
|
|
31
|
+
const [moved] = reordered.splice(result.source.index, 1);
|
|
32
|
+
reordered.splice(result.destination.index, 0, moved);
|
|
33
|
+
onReorder(reordered);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Box
|
|
38
|
+
borderWidth="0.063rem"
|
|
39
|
+
borderRadius="md"
|
|
40
|
+
px={3}
|
|
41
|
+
py={2}
|
|
42
|
+
bg={colors?.white}
|
|
43
|
+
>
|
|
44
|
+
<Box display={"flex"} alignItems={"center"} gap={2}>
|
|
45
|
+
<BetweenHorizonalStart />
|
|
46
|
+
<Text
|
|
47
|
+
fontFamily={"open-sans, sans-serif"}
|
|
48
|
+
fontWeight={600}
|
|
49
|
+
fontSize={14}
|
|
50
|
+
lineHeight="100%"
|
|
51
|
+
letterSpacing="4%"
|
|
52
|
+
textTransform="uppercase"
|
|
53
|
+
py={4}
|
|
54
|
+
>
|
|
55
|
+
{label}
|
|
56
|
+
</Text>
|
|
57
|
+
</Box>
|
|
58
|
+
<Divider />
|
|
59
|
+
<br />
|
|
60
|
+
<DragDropContext onDragEnd={handleDragEnd}>
|
|
61
|
+
<Droppable droppableId="item-list" direction="horizontal">
|
|
62
|
+
{(provided) => (
|
|
63
|
+
<HStack
|
|
64
|
+
ref={provided.innerRef}
|
|
65
|
+
{...provided.droppableProps}
|
|
66
|
+
spacing={4}
|
|
67
|
+
overflowX="auto"
|
|
68
|
+
>
|
|
69
|
+
{items.map((item, index) => (
|
|
70
|
+
<Draggable key={item.id} draggableId={item.id} index={index}>
|
|
71
|
+
{(provided) => (
|
|
72
|
+
<Box
|
|
73
|
+
ref={provided.innerRef}
|
|
74
|
+
{...provided.draggableProps}
|
|
75
|
+
{...provided.dragHandleProps}
|
|
76
|
+
position="relative"
|
|
77
|
+
border="0.063rem solid"
|
|
78
|
+
borderColor={colors?.gray?.[300]}
|
|
79
|
+
borderRadius="md"
|
|
80
|
+
overflow="hidden"
|
|
81
|
+
>
|
|
82
|
+
<Image
|
|
83
|
+
src={item.previewUrl}
|
|
84
|
+
alt={item.name ?? `item-${index}`}
|
|
85
|
+
boxSize="7.5rem"
|
|
86
|
+
objectFit="cover"
|
|
87
|
+
/>
|
|
88
|
+
<IconButton
|
|
89
|
+
icon={
|
|
90
|
+
<GripVertical size={16} color={colors?.gray?.[500]} />
|
|
91
|
+
}
|
|
92
|
+
aria-label="Drag"
|
|
93
|
+
size="sm"
|
|
94
|
+
position="absolute"
|
|
95
|
+
top={1}
|
|
96
|
+
left={1}
|
|
97
|
+
variant="ghost"
|
|
98
|
+
/>
|
|
99
|
+
<Badge
|
|
100
|
+
position={"absolute"}
|
|
101
|
+
colorScheme="gray"
|
|
102
|
+
variant="solid"
|
|
103
|
+
bottom={1}
|
|
104
|
+
right={1}
|
|
105
|
+
>
|
|
106
|
+
{index + 1}
|
|
107
|
+
</Badge>
|
|
108
|
+
</Box>
|
|
109
|
+
)}
|
|
110
|
+
</Draggable>
|
|
111
|
+
))}
|
|
112
|
+
{provided.placeholder}
|
|
113
|
+
</HStack>
|
|
114
|
+
)}
|
|
115
|
+
</Droppable>
|
|
116
|
+
</DragDropContext>
|
|
117
|
+
</Box>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default ReorderList;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import styled from "@emotion/styled";
|
|
3
|
+
import { SearchProps } from "./SearchProps";
|
|
4
|
+
import { Search as SearchIconComponent, X } from 'lucide-react';
|
|
5
|
+
|
|
6
|
+
const Container = styled.div`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
padding: 0.5rem 0.7rem 0.5rem 0.7rem;
|
|
11
|
+
width: 100%;
|
|
12
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
|
13
|
+
border-radius: 20px;
|
|
14
|
+
background: #fff;
|
|
15
|
+
border: 1px solid #f1f1f1;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const Input = styled.input`
|
|
19
|
+
flex: 1;
|
|
20
|
+
border: none;
|
|
21
|
+
outline: none;
|
|
22
|
+
margin-left: 0.5rem;
|
|
23
|
+
background: transparent;
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const SearchIcon = styled(SearchIconComponent)`
|
|
27
|
+
color: #888;
|
|
28
|
+
`;
|
|
29
|
+
const CloseIcon = styled(X)`
|
|
30
|
+
color: #888;
|
|
31
|
+
font-size: 1.5rem;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const Shortcut = styled.span`
|
|
35
|
+
margin-left: auto;
|
|
36
|
+
padding-left: 0.5rem;
|
|
37
|
+
color: #888;
|
|
38
|
+
font-size: 0.9rem;
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export default function Search({
|
|
42
|
+
placeholder = "Search...",
|
|
43
|
+
onSearch,
|
|
44
|
+
onclose,
|
|
45
|
+
shortcut = "Ctrl+K",
|
|
46
|
+
query,
|
|
47
|
+
}: SearchProps) {
|
|
48
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
51
|
+
if (
|
|
52
|
+
shortcut &&
|
|
53
|
+
event.ctrlKey &&
|
|
54
|
+
event.key === shortcut.split("+")[1].toLowerCase()
|
|
55
|
+
) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
inputRef.current?.focus();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
61
|
+
return () => {
|
|
62
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
63
|
+
};
|
|
64
|
+
}, [shortcut]);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Container>
|
|
68
|
+
<SearchIcon />
|
|
69
|
+
<Input
|
|
70
|
+
ref={inputRef}
|
|
71
|
+
type="text"
|
|
72
|
+
value={query}
|
|
73
|
+
onChange={onSearch}
|
|
74
|
+
placeholder={placeholder}
|
|
75
|
+
/>
|
|
76
|
+
{query && <CloseIcon onClick={onclose} />}
|
|
77
|
+
{shortcut && <Shortcut>{shortcut}</Shortcut>}
|
|
78
|
+
</Container>
|
|
79
|
+
);
|
|
80
|
+
}
|