@julseb-lib/react 0.1.18 → 0.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/dist/chunk-AOKNHBEF.js +1 -0
- package/dist/chunk-AOKNHBEF.js.map +1 -0
- package/dist/chunk-F55MXC3Z.js +1 -0
- package/dist/chunk-F55MXC3Z.js.map +1 -0
- package/dist/chunk-IH6ET7Q6.js +1 -0
- package/dist/chunk-IH6ET7Q6.js.map +1 -0
- package/dist/chunk-OOIPIHXS.js +1 -0
- package/dist/chunk-OOIPIHXS.js.map +1 -0
- package/dist/chunk-ZL3Z7QC7.js +1 -0
- package/dist/chunk-ZL3Z7QC7.js.map +1 -0
- package/dist/global-Bck2LNL3.d.cts +1472 -0
- package/dist/global-Bck2LNL3.d.ts +1472 -0
- package/dist/index.cjs +11892 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3231 -0
- package/dist/index.d.ts +3231 -1
- package/dist/index.js +11732 -0
- package/dist/index.js.map +1 -0
- package/dist/types/components-items-props.cjs +19 -0
- package/dist/types/components-items-props.cjs.map +1 -0
- package/dist/types/components-items-props.d.cts +175 -0
- package/dist/{lib/types/components-items-props.ts → types/components-items-props.d.ts} +56 -65
- package/dist/types/components-items-props.js +2 -0
- package/dist/types/components-items-props.js.map +1 -0
- package/dist/types/components-props.cjs +19 -0
- package/dist/types/components-props.cjs.map +1 -0
- package/dist/types/components-props.d.cts +1119 -0
- package/dist/types/components-props.d.ts +1119 -0
- package/dist/types/components-props.js +2 -0
- package/dist/types/components-props.js.map +1 -0
- package/dist/types/global.cjs +19 -0
- package/dist/types/global.cjs.map +1 -0
- package/dist/types/global.d.cts +3 -0
- package/dist/types/global.d.ts +3 -0
- package/dist/types/global.js +2 -0
- package/dist/types/global.js.map +1 -0
- package/dist/types/index.cjs +19 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +10 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/require-at-least-one.cjs +19 -0
- package/dist/types/require-at-least-one.cjs.map +1 -0
- package/dist/types/require-at-least-one.d.cts +5 -0
- package/dist/types/require-at-least-one.d.ts +5 -0
- package/dist/types/require-at-least-one.js +2 -0
- package/dist/types/require-at-least-one.js.map +1 -0
- package/dist/types/tailwind.cjs +19 -0
- package/dist/types/tailwind.cjs.map +1 -0
- package/dist/types/tailwind.d.cts +3259 -0
- package/dist/types/tailwind.d.ts +3259 -0
- package/dist/types/tailwind.js +2 -0
- package/dist/types/tailwind.js.map +1 -0
- package/package.json +31 -47
- package/LICENSE +0 -21
- package/README.md +0 -206
- package/dist/julseb-lib-react.cjs.js +0 -17
- package/dist/julseb-lib-react.es.js +0 -8977
- package/dist/lib/Variables.ts +0 -202
- package/dist/lib/components/Accordion/Accordion.tsx +0 -73
- package/dist/lib/components/Accordion/AccordionContent.tsx +0 -55
- package/dist/lib/components/Accordion/AccordionItem.tsx +0 -66
- package/dist/lib/components/Accordion/AccordionTitle.tsx +0 -80
- package/dist/lib/components/Accordion/index.ts +0 -2
- package/dist/lib/components/Accordion/subtypes.ts +0 -26
- package/dist/lib/components/Accordion/types.ts +0 -37
- package/dist/lib/components/Alert/Alert.tsx +0 -57
- package/dist/lib/components/Alert/index.ts +0 -1
- package/dist/lib/components/Alert/types.ts +0 -8
- package/dist/lib/components/Aside/Aside.tsx +0 -58
- package/dist/lib/components/Aside/index.ts +0 -1
- package/dist/lib/components/Aside/types.ts +0 -6
- package/dist/lib/components/Autocomplete/Autocomplete.tsx +0 -222
- package/dist/lib/components/Autocomplete/index.ts +0 -1
- package/dist/lib/components/Autocomplete/types.ts +0 -35
- package/dist/lib/components/Avatar/Avatar.tsx +0 -93
- package/dist/lib/components/Avatar/AvatarFn.tsx +0 -44
- package/dist/lib/components/Avatar/index.ts +0 -1
- package/dist/lib/components/Avatar/types.ts +0 -37
- package/dist/lib/components/BackToTop/BackToTop.tsx +0 -96
- package/dist/lib/components/BackToTop/index.ts +0 -1
- package/dist/lib/components/BackToTop/types.ts +0 -9
- package/dist/lib/components/Badge/Badge.tsx +0 -61
- package/dist/lib/components/Badge/index.ts +0 -1
- package/dist/lib/components/Badge/types.ts +0 -7
- package/dist/lib/components/Breadcrumbs/Breadcrumbs.tsx +0 -72
- package/dist/lib/components/Breadcrumbs/index.ts +0 -1
- package/dist/lib/components/Breadcrumbs/types.ts +0 -5
- package/dist/lib/components/Burger/Burger.tsx +0 -110
- package/dist/lib/components/Burger/index.ts +0 -1
- package/dist/lib/components/Burger/types.ts +0 -11
- package/dist/lib/components/Button/Button.tsx +0 -109
- package/dist/lib/components/Button/index.ts +0 -1
- package/dist/lib/components/Button/types.ts +0 -30
- package/dist/lib/components/ButtonGroup/ButtonGroup.tsx +0 -126
- package/dist/lib/components/ButtonGroup/index.ts +0 -1
- package/dist/lib/components/ButtonGroup/types.ts +0 -28
- package/dist/lib/components/ButtonIcon/ButtonFn.tsx +0 -76
- package/dist/lib/components/ButtonIcon/ButtonIcon.tsx +0 -134
- package/dist/lib/components/ButtonIcon/index.ts +0 -1
- package/dist/lib/components/ButtonIcon/types.ts +0 -52
- package/dist/lib/components/CodeContainer/CodeContainer.tsx +0 -108
- package/dist/lib/components/CodeContainer/index.ts +0 -1
- package/dist/lib/components/CodeContainer/types.ts +0 -230
- package/dist/lib/components/Cover/Cover.tsx +0 -91
- package/dist/lib/components/Cover/index.ts +0 -1
- package/dist/lib/components/Cover/types.ts +0 -10
- package/dist/lib/components/DragList/DragList.tsx +0 -111
- package/dist/lib/components/DragList/DragListItem.tsx +0 -114
- package/dist/lib/components/DragList/index.ts +0 -2
- package/dist/lib/components/DragList/types.ts +0 -55
- package/dist/lib/components/Drawer/Drawer.tsx +0 -145
- package/dist/lib/components/Drawer/index.ts +0 -1
- package/dist/lib/components/Drawer/types.ts +0 -24
- package/dist/lib/components/Dropdown/Dropdown.tsx +0 -89
- package/dist/lib/components/Dropdown/DropdownItem.tsx +0 -49
- package/dist/lib/components/Dropdown/index.ts +0 -2
- package/dist/lib/components/Dropdown/types.ts +0 -35
- package/dist/lib/components/Fade/Fade.tsx +0 -62
- package/dist/lib/components/Fade/index.ts +0 -1
- package/dist/lib/components/Fade/types.ts +0 -3
- package/dist/lib/components/Fieldset/Fieldset.tsx +0 -85
- package/dist/lib/components/Fieldset/index.ts +0 -1
- package/dist/lib/components/Fieldset/types.ts +0 -15
- package/dist/lib/components/Flexbox/Flexbox.tsx +0 -99
- package/dist/lib/components/Flexbox/index.ts +0 -1
- package/dist/lib/components/Flexbox/types.ts +0 -23
- package/dist/lib/components/Footer/Footer.tsx +0 -103
- package/dist/lib/components/Footer/index.ts +0 -1
- package/dist/lib/components/Footer/types.ts +0 -54
- package/dist/lib/components/Form/Form.tsx +0 -83
- package/dist/lib/components/Form/index.ts +0 -1
- package/dist/lib/components/Form/types.ts +0 -32
- package/dist/lib/components/Grid/Grid.tsx +0 -98
- package/dist/lib/components/Grid/index.ts +0 -1
- package/dist/lib/components/Grid/types.ts +0 -20
- package/dist/lib/components/Header/Header.tsx +0 -241
- package/dist/lib/components/Header/HeaderSearch.tsx +0 -50
- package/dist/lib/components/Header/index.ts +0 -1
- package/dist/lib/components/Header/subtypes.ts +0 -28
- package/dist/lib/components/Header/types.ts +0 -57
- package/dist/lib/components/Highlight/Highlight.tsx +0 -45
- package/dist/lib/components/Highlight/index.ts +0 -1
- package/dist/lib/components/Highlight/types.ts +0 -9
- package/dist/lib/components/Hr/Hr.tsx +0 -48
- package/dist/lib/components/Hr/index.ts +0 -1
- package/dist/lib/components/Hr/types.ts +0 -8
- package/dist/lib/components/Image/Image.tsx +0 -92
- package/dist/lib/components/Image/index.ts +0 -1
- package/dist/lib/components/Image/types.ts +0 -25
- package/dist/lib/components/Input/Input.tsx +0 -130
- package/dist/lib/components/Input/classes.ts +0 -1
- package/dist/lib/components/Input/index.ts +0 -1
- package/dist/lib/components/Input/subtypes.ts +0 -173
- package/dist/lib/components/Input/templates/ColorInput.tsx +0 -44
- package/dist/lib/components/Input/templates/DateInput.tsx +0 -63
- package/dist/lib/components/Input/templates/FileInput.tsx +0 -42
- package/dist/lib/components/Input/templates/PasswordInput.tsx +0 -73
- package/dist/lib/components/Input/templates/SearchInput.tsx +0 -89
- package/dist/lib/components/Input/templates/SelectInput.tsx +0 -79
- package/dist/lib/components/Input/templates/TextInput.tsx +0 -58
- package/dist/lib/components/Input/templates/TextareaInput.tsx +0 -27
- package/dist/lib/components/Input/templates/TimeInput.tsx +0 -67
- package/dist/lib/components/Input/types.ts +0 -22
- package/dist/lib/components/InputCheck/InputCheck.tsx +0 -161
- package/dist/lib/components/InputCheck/index.ts +0 -1
- package/dist/lib/components/InputCheck/types.ts +0 -27
- package/dist/lib/components/InputComponents/InputButton.tsx +0 -31
- package/dist/lib/components/InputComponents/InputIcon.tsx +0 -28
- package/dist/lib/components/InputComponents/InputList.tsx +0 -53
- package/dist/lib/components/InputComponents/InputListItem.tsx +0 -68
- package/dist/lib/components/InputComponents/InputPrefix.tsx +0 -15
- package/dist/lib/components/InputComponents/InputSuffix.tsx +0 -15
- package/dist/lib/components/InputComponents/InputValidation.tsx +0 -32
- package/dist/lib/components/InputComponents/InputWithListWrapper.tsx +0 -29
- package/dist/lib/components/InputComponents/InputWrapper.tsx +0 -45
- package/dist/lib/components/InputComponents/classes.ts +0 -101
- package/dist/lib/components/InputComponents/index.ts +0 -11
- package/dist/lib/components/InputComponents/types.ts +0 -63
- package/dist/lib/components/InputContainer/InputContainer.tsx +0 -149
- package/dist/lib/components/InputContainer/index.ts +0 -1
- package/dist/lib/components/InputContainer/types.ts +0 -11
- package/dist/lib/components/InputCounter/InputCounter.tsx +0 -141
- package/dist/lib/components/InputCounter/index.ts +0 -1
- package/dist/lib/components/InputCounter/types.ts +0 -45
- package/dist/lib/components/InputImage/EmptyContainer.tsx +0 -17
- package/dist/lib/components/InputImage/HoverContainer.tsx +0 -21
- package/dist/lib/components/InputImage/InputImage.tsx +0 -104
- package/dist/lib/components/InputImage/index.ts +0 -1
- package/dist/lib/components/InputImage/subtypes.ts +0 -7
- package/dist/lib/components/InputImage/types.ts +0 -24
- package/dist/lib/components/InputPhone/InputPhone.tsx +0 -256
- package/dist/lib/components/InputPhone/index.ts +0 -1
- package/dist/lib/components/InputPhone/types.ts +0 -32
- package/dist/lib/components/InputPhone/utils/countries.ts +0 -646
- package/dist/lib/components/InputPhone/utils/flags/ac.svg +0 -76
- package/dist/lib/components/InputPhone/utils/flags/bq.svg +0 -5
- package/dist/lib/components/InputPhone/utils/flags/bv.svg +0 -13
- package/dist/lib/components/InputPhone/utils/flags/cefta.svg +0 -13
- package/dist/lib/components/InputPhone/utils/flags/cp.svg +0 -7
- package/dist/lib/components/InputPhone/utils/flags/cw.svg +0 -14
- package/dist/lib/components/InputPhone/utils/flags/dg.svg +0 -129
- package/dist/lib/components/InputPhone/utils/flags/ea.svg +0 -544
- package/dist/lib/components/InputPhone/utils/flags/eh.svg +0 -16
- package/dist/lib/components/InputPhone/utils/flags/es-ct.svg +0 -4
- package/dist/lib/components/InputPhone/utils/flags/es-ga.svg +0 -187
- package/dist/lib/components/InputPhone/utils/flags/eu.svg +0 -28
- package/dist/lib/components/InputPhone/utils/flags/gb-eng.svg +0 -5
- package/dist/lib/components/InputPhone/utils/flags/gb-nir.svg +0 -132
- package/dist/lib/components/InputPhone/utils/flags/gb-sct.svg +0 -4
- package/dist/lib/components/InputPhone/utils/flags/gb-wls.svg +0 -9
- package/dist/lib/components/InputPhone/utils/flags/hm.svg +0 -8
- package/dist/lib/components/InputPhone/utils/flags/ic.svg +0 -7
- package/dist/lib/components/InputPhone/utils/flags/sx.svg +0 -56
- package/dist/lib/components/InputPhone/utils/flags/ta.svg +0 -76
- package/dist/lib/components/InputPhone/utils/flags/tf.svg +0 -15
- package/dist/lib/components/InputPhone/utils/flags/um.svg +0 -15
- package/dist/lib/components/InputPhone/utils/flags/un.svg +0 -16
- package/dist/lib/components/InputPhone/utils/flags/xk.svg +0 -8
- package/dist/lib/components/InputPhone/utils/flags/xx.svg +0 -4
- package/dist/lib/components/InputPin/InputPin.tsx +0 -121
- package/dist/lib/components/InputPin/index.ts +0 -1
- package/dist/lib/components/InputPin/types.ts +0 -22
- package/dist/lib/components/InputSlider/InputSlider.tsx +0 -176
- package/dist/lib/components/InputSlider/index.ts +0 -1
- package/dist/lib/components/InputSlider/types.ts +0 -22
- package/dist/lib/components/Key/Key.tsx +0 -84
- package/dist/lib/components/Key/index.ts +0 -1
- package/dist/lib/components/Key/types.ts +0 -16
- package/dist/lib/components/Linkify/Linkify.tsx +0 -67
- package/dist/lib/components/Linkify/index.ts +0 -1
- package/dist/lib/components/Linkify/types.ts +0 -8
- package/dist/lib/components/ListGroup/ListGroup.tsx +0 -96
- package/dist/lib/components/ListGroup/ListGroupItem.tsx +0 -86
- package/dist/lib/components/ListGroup/ListGroupTitle.tsx +0 -84
- package/dist/lib/components/ListGroup/index.ts +0 -3
- package/dist/lib/components/ListGroup/types.ts +0 -69
- package/dist/lib/components/Loader/Loader.tsx +0 -38
- package/dist/lib/components/Loader/index.ts +0 -1
- package/dist/lib/components/Loader/templates/LoaderOne.tsx +0 -27
- package/dist/lib/components/Loader/templates/LoaderThree.tsx +0 -47
- package/dist/lib/components/Loader/templates/LoaderTwo.tsx +0 -61
- package/dist/lib/components/Loader/types.ts +0 -13
- package/dist/lib/components/Loader/utils/gen-border-bottom.ts +0 -95
- package/dist/lib/components/Main/Main.tsx +0 -63
- package/dist/lib/components/Main/index.ts +0 -1
- package/dist/lib/components/Main/types.ts +0 -12
- package/dist/lib/components/MarkdownContainer/MarkdownContainer.tsx +0 -50
- package/dist/lib/components/MarkdownContainer/index.ts +0 -1
- package/dist/lib/components/MarkdownContainer/types.ts +0 -8
- package/dist/lib/components/MarkdownEditor/MarkdownButtons.tsx +0 -42
- package/dist/lib/components/MarkdownEditor/MarkdownEditor.tsx +0 -186
- package/dist/lib/components/MarkdownEditor/MarkdownEditorTitles.tsx +0 -86
- package/dist/lib/components/MarkdownEditor/MarkdownViewButtons.tsx +0 -48
- package/dist/lib/components/MarkdownEditor/buttons/icons.tsx +0 -85
- package/dist/lib/components/MarkdownEditor/buttons/markdown-buttons.tsx +0 -176
- package/dist/lib/components/MarkdownEditor/index.ts +0 -1
- package/dist/lib/components/MarkdownEditor/types.ts +0 -42
- package/dist/lib/components/Masonry/Masonry.tsx +0 -83
- package/dist/lib/components/Masonry/index.ts +0 -1
- package/dist/lib/components/Masonry/types.ts +0 -8
- package/dist/lib/components/Masonry/utils.tsx +0 -28
- package/dist/lib/components/Meta/Meta.tsx +0 -125
- package/dist/lib/components/Meta/index.ts +0 -1
- package/dist/lib/components/Meta/types.ts +0 -35
- package/dist/lib/components/Modal/Modal.tsx +0 -107
- package/dist/lib/components/Modal/index.ts +0 -1
- package/dist/lib/components/Modal/types.ts +0 -21
- package/dist/lib/components/PageLayout/PageLayout.tsx +0 -64
- package/dist/lib/components/PageLayout/index.ts +0 -1
- package/dist/lib/components/PageLayout/types.ts +0 -29
- package/dist/lib/components/PageLoading/PageLoading.tsx +0 -64
- package/dist/lib/components/PageLoading/index.ts +0 -1
- package/dist/lib/components/PageLoading/types.ts +0 -13
- package/dist/lib/components/Pagination/Pagination.tsx +0 -163
- package/dist/lib/components/Pagination/PaginationButton.tsx +0 -65
- package/dist/lib/components/Pagination/index.ts +0 -2
- package/dist/lib/components/Pagination/types.ts +0 -56
- package/dist/lib/components/Paginator/Paginator.tsx +0 -136
- package/dist/lib/components/Paginator/index.ts +0 -1
- package/dist/lib/components/Paginator/types.ts +0 -16
- package/dist/lib/components/ProgressBar/ProgressBar.tsx +0 -87
- package/dist/lib/components/ProgressBar/index.ts +0 -1
- package/dist/lib/components/ProgressBar/types.ts +0 -14
- package/dist/lib/components/ProgressCircle/ProgressCircle.tsx +0 -146
- package/dist/lib/components/ProgressCircle/index.ts +0 -1
- package/dist/lib/components/ProgressCircle/types.ts +0 -31
- package/dist/lib/components/Rating/Rating.tsx +0 -116
- package/dist/lib/components/Rating/index.ts +0 -1
- package/dist/lib/components/Rating/types.ts +0 -25
- package/dist/lib/components/Section/Section.tsx +0 -51
- package/dist/lib/components/Section/index.ts +0 -1
- package/dist/lib/components/Section/types.ts +0 -5
- package/dist/lib/components/Select/Select.tsx +0 -191
- package/dist/lib/components/Select/index.ts +0 -1
- package/dist/lib/components/Select/types.ts +0 -23
- package/dist/lib/components/Skeleton/Skeleton.tsx +0 -57
- package/dist/lib/components/Skeleton/SkeletonCard.tsx +0 -60
- package/dist/lib/components/Skeleton/index.ts +0 -2
- package/dist/lib/components/Skeleton/types.ts +0 -27
- package/dist/lib/components/Slideshow/Slideshow.tsx +0 -324
- package/dist/lib/components/Slideshow/SlideshowButton.tsx +0 -63
- package/dist/lib/components/Slideshow/SlideshowPagination.tsx +0 -111
- package/dist/lib/components/Slideshow/index.ts +0 -1
- package/dist/lib/components/Slideshow/subtypes.ts +0 -62
- package/dist/lib/components/Slideshow/types.ts +0 -41
- package/dist/lib/components/SrOnly/SrOnly.tsx +0 -33
- package/dist/lib/components/SrOnly/index.ts +0 -1
- package/dist/lib/components/SrOnly/types.ts +0 -7
- package/dist/lib/components/Sticky/Sticky.tsx +0 -58
- package/dist/lib/components/Sticky/index.ts +0 -1
- package/dist/lib/components/Sticky/types.ts +0 -5
- package/dist/lib/components/Table/Table.tsx +0 -141
- package/dist/lib/components/Table/index.ts +0 -1
- package/dist/lib/components/Table/types.ts +0 -43
- package/dist/lib/components/Tabs/Tabs.tsx +0 -88
- package/dist/lib/components/Tabs/TabsButton.tsx +0 -73
- package/dist/lib/components/Tabs/TabsButtonsContainer.tsx +0 -58
- package/dist/lib/components/Tabs/TabsContainer.tsx +0 -49
- package/dist/lib/components/Tabs/TabsContent.tsx +0 -52
- package/dist/lib/components/Tabs/index.ts +0 -5
- package/dist/lib/components/Tabs/types.ts +0 -46
- package/dist/lib/components/Tag/Tag.tsx +0 -77
- package/dist/lib/components/Tag/index.ts +0 -1
- package/dist/lib/components/Tag/types.ts +0 -13
- package/dist/lib/components/Text/Text.tsx +0 -88
- package/dist/lib/components/Text/index.ts +0 -1
- package/dist/lib/components/Text/templates/Blockquote.tsx +0 -41
- package/dist/lib/components/Text/templates/Dl.tsx +0 -42
- package/dist/lib/components/Text/templates/Em.tsx +0 -40
- package/dist/lib/components/Text/templates/H1.tsx +0 -44
- package/dist/lib/components/Text/templates/H2.tsx +0 -44
- package/dist/lib/components/Text/templates/H3.tsx +0 -44
- package/dist/lib/components/Text/templates/H4.tsx +0 -44
- package/dist/lib/components/Text/templates/H5.tsx +0 -44
- package/dist/lib/components/Text/templates/H6.tsx +0 -41
- package/dist/lib/components/Text/templates/Ol.tsx +0 -41
- package/dist/lib/components/Text/templates/P.tsx +0 -40
- package/dist/lib/components/Text/templates/Small.tsx +0 -40
- package/dist/lib/components/Text/templates/Strong.tsx +0 -40
- package/dist/lib/components/Text/templates/Ul.tsx +0 -41
- package/dist/lib/components/Text/types.ts +0 -36
- package/dist/lib/components/Toast/Toast.tsx +0 -113
- package/dist/lib/components/Toast/ToastContainer.tsx +0 -43
- package/dist/lib/components/Toast/ToastFn.tsx +0 -236
- package/dist/lib/components/Toast/index.ts +0 -3
- package/dist/lib/components/Toast/types.ts +0 -18
- package/dist/lib/components/Toast/utils.ts +0 -9
- package/dist/lib/components/Tooltip/Tooltip.tsx +0 -197
- package/dist/lib/components/Tooltip/index.ts +0 -1
- package/dist/lib/components/Tooltip/types.ts +0 -23
- package/dist/lib/components/Wrapper/Wrapper.tsx +0 -75
- package/dist/lib/components/Wrapper/index.ts +0 -1
- package/dist/lib/components/Wrapper/types.ts +0 -12
- package/dist/lib/context/Theme.context.tsx +0 -66
- package/dist/lib/context/index.ts +0 -1
- package/dist/lib/hooks/index.ts +0 -15
- package/dist/lib/hooks/useClickOutside.tsx +0 -50
- package/dist/lib/hooks/useCopyToClipboard.tsx +0 -50
- package/dist/lib/hooks/useDebounce.tsx +0 -37
- package/dist/lib/hooks/useExportData.tsx +0 -78
- package/dist/lib/hooks/useFetch.tsx +0 -42
- package/dist/lib/hooks/useForm.tsx +0 -51
- package/dist/lib/hooks/useIsOverflow.ts +0 -61
- package/dist/lib/hooks/useKeyPress.tsx +0 -110
- package/dist/lib/hooks/useMaxWidth.tsx +0 -40
- package/dist/lib/hooks/useMergeRefs.ts +0 -45
- package/dist/lib/hooks/useMinWidth.tsx +0 -40
- package/dist/lib/hooks/usePaginatedData.tsx +0 -52
- package/dist/lib/hooks/usePagination.tsx +0 -75
- package/dist/lib/hooks/useTouchScreen.tsx +0 -34
- package/dist/lib/hooks/useTranslation.tsx +0 -58
- package/dist/lib/index.css +0 -539
- package/dist/lib/index.ts +0 -129
- package/dist/lib/lib-utils/get-highlighted-text.tsx +0 -30
- package/dist/lib/lib-utils/index.ts +0 -3
- package/dist/lib/lib-utils/transfom-search-keys.ts +0 -13
- package/dist/lib/lib-utils/use-keyboard-navigation.tsx +0 -79
- package/dist/lib/types/components-props.ts +0 -66
- package/dist/lib/types/global.ts +0 -853
- package/dist/lib/types/index.ts +0 -4
- package/dist/lib/types/require-at-least-one.ts +0 -7
- package/dist/lib/types/tailwind.ts +0 -9041
- package/dist/lib/utils/clsx.tsx +0 -6
- package/dist/lib/utils/design-tokens.ts +0 -784
- package/dist/lib/utils/gen-align.ts +0 -24
- package/dist/lib/utils/gen-bg-color.ts +0 -158
- package/dist/lib/utils/gen-border-color.ts +0 -110
- package/dist/lib/utils/gen-border-radius.ts +0 -13
- package/dist/lib/utils/gen-border.ts +0 -30
- package/dist/lib/utils/gen-box-shadow.ts +0 -12
- package/dist/lib/utils/gen-button-color.ts +0 -9
- package/dist/lib/utils/gen-gap.ts +0 -34
- package/dist/lib/utils/gen-justify.ts +0 -25
- package/dist/lib/utils/gen-link-color.ts +0 -29
- package/dist/lib/utils/gen-max-width.ts +0 -30
- package/dist/lib/utils/gen-object-fit.ts +0 -9
- package/dist/lib/utils/gen-ring-color.ts +0 -21
- package/dist/lib/utils/gen-text-align.ts +0 -10
- package/dist/lib/utils/gen-text-color.ts +0 -111
- package/dist/lib/utils/gen-vertical-align.ts +0 -12
- package/dist/lib/utils/index.ts +0 -19
- package/dist/lib/utils/linkify-text.tsx +0 -26
- package/dist/lib/utils/options-markdown.ts +0 -60
- package/dist/lib/utils/tools.ts +0 -15
- package/dist/react.css +0 -1
- package/dist/style.css +0 -539
- /package/dist/{lib/components/InputPhone/utils/flags/ad.svg → ad-HTL7GHRB.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ae.svg → ae-ICAMTCAR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/af.svg → af-MHFH5L72.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ag.svg → ag-M7PMJTNC.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ai.svg → ai-ETDR2GEU.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/al.svg → al-RBPPZBOR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/am.svg → am-P5ZIE6XV.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ao.svg → ao-IDQ66LVW.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/aq.svg → aq-M762DUH3.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ar.svg → ar-DHRVFD4E.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/as.svg → as-ICEYFBWP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/at.svg → at-P53PFVFI.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/au.svg → au-OMD4QESS.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/aw.svg → aw-P7SRGNOX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ax.svg → ax-V7XPB664.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/az.svg → az-JZV3NJUP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ba.svg → ba-POV77HGO.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bb.svg → bb-WTDUG7VT.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bd.svg → bd-HMCXBQD3.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/be.svg → be-Y7RGT6WN.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bf.svg → bf-IFOTMWPV.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bg.svg → bg-QKOWF4RG.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bh.svg → bh-F7YG7A6Z.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bi.svg → bi-HWA2SSM7.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bj.svg → bj-SVZPUB6C.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bl.svg → bl-QXYAF6ZV.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bm.svg → bm-VAEN3IKJ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bn.svg → bn-CK5FI4T5.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bo.svg → bo-HY4TLIQH.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/br.svg → br-E7SKW6QV.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bs.svg → bs-5UC4R4TW.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bt.svg → bt-ILNGCG6V.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bw.svg → bw-GTCF3QZV.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/by.svg → by-I2PKD7MG.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/bz.svg → bz-ZSRW2FFJ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ca.svg → ca-WZPQPA7E.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cc.svg → cc-F56DXRNZ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cd.svg → cd-WTKKN7EX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cf.svg → cf-TPKKXILK.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cg.svg → cg-CKR7RUC4.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ch.svg → ch-USJZZOGC.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ci.svg → ci-KFEINJVJ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ck.svg → ck-ATMQHHMA.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cl.svg → cl-WMTRWE2W.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cm.svg → cm-2BN3OVZK.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cn.svg → cn-GFQJIK3L.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/co.svg → co-NN4OA66V.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cr.svg → cr-ZQEISEUX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cu.svg → cu-5GWMND5O.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cv.svg → cv-LWSGBQVT.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cx.svg → cx-XOUJ6BDY.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cy.svg → cy-ELWYQW3B.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/cz.svg → cz-PSDLWGGB.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/de.svg → de-UZ33VXB7.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/dj.svg → dj-6OAOTLZI.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/dk.svg → dk-JMBRHM34.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/dm.svg → dm-VNRMBZBS.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/do.svg → do-BKI25VAP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/dz.svg → dz-5TGC2F6O.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ec.svg → ec-RVY2TDQY.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ee.svg → ee-ESNNK5FI.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/eg.svg → eg-33P6HVEE.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/er.svg → er-24JCI44Y.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/es.svg → es-W6LDJAST.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/et.svg → et-3S4LEFBY.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/fi.svg → fi-S5EH7BG6.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/fj.svg → fj-YBL3EYQL.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/fk.svg → fk-GOTRGUW5.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/fm.svg → fm-W22Q42MJ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/fo.svg → fo-XAEBEWGY.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/fr.svg → fr-ZVO4L2CN.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ga.svg → ga-YVFEOFTR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gb.svg → gb-SC7363TA.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gd.svg → gd-DFU7DED6.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ge.svg → ge-YE7BR7QF.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gf.svg → gf-NI4GFY3X.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gg.svg → gg-7VUU64IM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gh.svg → gh-SZBUUZXW.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gi.svg → gi-CXD7K7GM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gl.svg → gl-PA2YIJP7.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gm.svg → gm-7ZOEQWBQ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gn.svg → gn-MSN2M353.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gp.svg → gp-JP5TO4OX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gq.svg → gq-EYN2DF4Z.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gr.svg → gr-YRG5TXUI.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gs.svg → gs-EDOECKEF.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gt.svg → gt-VFMRVU7E.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gu.svg → gu-AXDHACWU.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gw.svg → gw-F747MFB6.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/gy.svg → gy-C6UGO63R.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/hk.svg → hk-PPVUELHH.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/hn.svg → hn-IXKFBHL3.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/hr.svg → hr-7ORLAYLN.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ht.svg → ht-HCNXZLPJ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/hu.svg → hu-C3DDGX7P.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/id.svg → id-JSWZPKEB.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ie.svg → ie-QFERZM3U.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/il.svg → il-4AZPYABU.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/im.svg → im-TRGBU2MA.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/in.svg → in-QNJVAXMN.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/io.svg → io-ZTEO44HB.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/iq.svg → iq-7FWRTP5Y.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ir.svg → ir-7QU34OGP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/is.svg → is-VFU3W27Q.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/it.svg → it-SGJZRZTG.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/je.svg → je-ASNHCFDM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/jm.svg → jm-WELCOSBK.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/jo.svg → jo-4N4SRXFU.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/jp.svg → jp-IJJOLX65.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ke.svg → ke-ZX6MQKG6.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/kg.svg → kg-RCELGYWY.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/kh.svg → kh-Z4TCRAR5.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ki.svg → ki-4XP6EOEF.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/km.svg → km-UWFN6S3G.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/kn.svg → kn-QZWT5L2Z.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/kp.svg → kp-UEJKAESN.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/kr.svg → kr-37HGZWST.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/kw.svg → kw-DW7MW6JR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ky.svg → ky-UE77ZKNR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/kz.svg → kz-235M425O.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/la.svg → la-RJEPE22E.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/lb.svg → lb-EWVZKLTE.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/lc.svg → lc-SHXL3I23.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/li.svg → li-FRDARPUJ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/lk.svg → lk-24DJYERD.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/lr.svg → lr-NOV6G2QP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ls.svg → ls-DQYSLKA4.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/lt.svg → lt-X5H273BZ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/lu.svg → lu-Y7CETSZZ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/lv.svg → lv-UD2OKAKZ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ly.svg → ly-HXZ3F2PC.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ma.svg → ma-VSPIMR33.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mc.svg → mc-IV2TK64Y.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/md.svg → md-Z2KRCTSL.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/me.svg → me-GJ5HAC7T.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mf.svg → mf-PY7OO34H.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mg.svg → mg-7XGP7WEH.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mh.svg → mh-7N2SSCJ3.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mk.svg → mk-4CGYETXE.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ml.svg → ml-REJ3NIH6.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mm.svg → mm-G72WDHIA.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mn.svg → mn-QUEB3DP2.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mo.svg → mo-7RMY33IW.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mp.svg → mp-QLHHVVHP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mq.svg → mq-S4653T2D.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mr.svg → mr-ZBDE3KJQ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ms.svg → ms-HE6BUCKD.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mt.svg → mt-DUA34F2Z.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mu.svg → mu-ZHDOJ3TI.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mv.svg → mv-6NYHRQLF.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mw.svg → mw-AXRAJH26.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mx.svg → mx-MSPV6RQM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/my.svg → my-AIY7QQBP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/mz.svg → mz-3322L3KQ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/na.svg → na-EASCPZHA.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/nc.svg → nc-JJHA6YCG.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ne.svg → ne-NIQVZJOH.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/nf.svg → nf-6GXJMQE5.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ng.svg → ng-5QXHJYS4.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ni.svg → ni-HNZBL5LK.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/nl.svg → nl-QVISKFUO.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/no.svg → no-JTVUCTCT.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/np.svg → np-UCBDZ5AR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/nr.svg → nr-LG6XA46Y.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/nu.svg → nu-4OUEUAXX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/nz.svg → nz-T2NE6YVO.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/om.svg → om-6JFK3PR4.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pa.svg → pa-AT6O5EL5.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pe.svg → pe-WVRRE6RF.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pf.svg → pf-DLKFAUUG.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pg.svg → pg-R7GWNRSB.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ph.svg → ph-QSRFK225.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pk.svg → pk-FR3SZ2RO.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pl.svg → pl-JSSZW3KY.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pm.svg → pm-HA37R6HR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pn.svg → pn-4N36OSZ7.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pr.svg → pr-NNQH4LK7.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ps.svg → ps-OYLD266F.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pt.svg → pt-EJEEXNOR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/pw.svg → pw-AJH6MUWT.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/py.svg → py-BBGVETQS.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/qa.svg → qa-O6NUQ5WE.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/re.svg → re-UHLBILVM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ro.svg → ro-YBPUPSYC.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/rs.svg → rs-RTTQJKCP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ru.svg → ru-NVSR5C27.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/rw.svg → rw-L6HQTLZM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sa.svg → sa-5NCCG3JM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sb.svg → sb-ESFASP4O.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sc.svg → sc-V2MOTRIU.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sd.svg → sd-ALVTXIOB.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/se.svg → se-3UJAVTP2.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sg.svg → sg-PNK4IWVH.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sh.svg → sh-LSKBPKHJ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/si.svg → si-DU3RWKLO.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sj.svg → sj-EOPZSLCL.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sk.svg → sk-Z5T3FAV3.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sl.svg → sl-DE7XOWOL.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sm.svg → sm-OSI7YZKX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sn.svg → sn-KYWABXNT.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/so.svg → so-TUA5RNVD.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sr.svg → sr-HMODPFV5.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ss.svg → ss-R7O73JRT.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/st.svg → st-NPWJIGHE.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sv.svg → sv-NIXV2SRX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sy.svg → sy-HTLBFL4F.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/sz.svg → sz-FMNXHOEQ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tc.svg → tc-P6VEJX7T.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/td.svg → td-DN372MP5.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tg.svg → tg-5ZT7ZDBZ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/th.svg → th-WAHAQKQK.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tj.svg → tj-MG5ALKXM.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tk.svg → tk-G765JUVP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tl.svg → tl-UF7AWZC6.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tm.svg → tm-LGSUDTBO.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tn.svg → tn-MJPTN7EW.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/to.svg → to-4IPHWATD.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tr.svg → tr-KC7PK4TT.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tt.svg → tt-IVVKXXFH.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tv.svg → tv-HASL2ZPX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tw.svg → tw-Z2QVHLNU.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/tz.svg → tz-FVI6D4BP.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ua.svg → ua-6L6MVDVK.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ug.svg → ug-F73JMZTS.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/us.svg → us-VPPAAERF.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/uy.svg → uy-FJ6XTJUV.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/uz.svg → uz-FR2J6ZTX.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/va.svg → va-ZQHHJQ33.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/vc.svg → vc-F4EKLJYW.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ve.svg → ve-TXPQADML.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/vg.svg → vg-R3B6II5K.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/vi.svg → vi-7RSQ7357.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/vn.svg → vn-BMRRXIMR.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/vu.svg → vu-FZQPUNU3.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/wf.svg → wf-EYVXQET4.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ws.svg → ws-PVUKQ4PE.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/ye.svg → ye-NQNPF5YD.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/yt.svg → yt-TGBAMUTW.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/za.svg → za-HZOQXCXO.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/zm.svg → zm-NM4WJ5NQ.svg} +0 -0
- /package/dist/{lib/components/InputPhone/utils/flags/zw.svg → zw-MIQGG7RP.svg} +0 -0
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { useCallback, useRef, useState, type FC, type RefObject } from "react"
|
|
2
|
-
import { clsx, genBgAllColorsAndOverlays, genTextAllColor } from "../../utils"
|
|
3
|
-
import type { ILibTooltip } from "./types"
|
|
4
|
-
import { useClickOutside, useTouchScreen } from "../../hooks"
|
|
5
|
-
import type {
|
|
6
|
-
LibSpacers,
|
|
7
|
-
LibTooltipPosition,
|
|
8
|
-
LibTooltipTrigger,
|
|
9
|
-
} from "../../types"
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Tooltip component for displaying contextual information on hover or click interactions.
|
|
13
|
-
*
|
|
14
|
-
* @component
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* <Tooltip
|
|
18
|
-
* tooltip="This is a helpful tooltip"
|
|
19
|
-
* position="top"
|
|
20
|
-
* trigger="hover"
|
|
21
|
-
* backgroundColor="black-80"
|
|
22
|
-
* textColor="white"
|
|
23
|
-
* >
|
|
24
|
-
* <button>Hover me</button>
|
|
25
|
-
* </Tooltip>
|
|
26
|
-
*
|
|
27
|
-
* @extends HTMLDivElement
|
|
28
|
-
*
|
|
29
|
-
* @prop {string} [props.className] - Additional CSS classes to apply to the tooltip container.
|
|
30
|
-
* @prop {React.ElementType} [props.element="div"] - HTML element type to render as the container.
|
|
31
|
-
* @prop {React.Ref<HTMLDivElement>} [props.ref] - Ref to the tooltip container element.
|
|
32
|
-
* @prop {React.ReactNode} [props.children] - The element that triggers the tooltip on interaction.
|
|
33
|
-
* @prop {string} [props.tooltip] - The tooltip text content to display.
|
|
34
|
-
* @prop {"top" | "bottom" | "left" | "right"} [props.position="top"] - Position of the tooltip relative to the trigger element.
|
|
35
|
-
* @prop {boolean} [props.hideArrow] - Whether to hide the tooltip arrow pointer.
|
|
36
|
-
* @prop {"hover" | "click"} [props.trigger="hover"] - Event that triggers the tooltip display.
|
|
37
|
-
* @prop {LibAllColorsAndOverlays} [props.backgroundColor="black-80"] - Background color for the tooltip.
|
|
38
|
-
* @prop {LibAllColors} [props.textColor="white"] - Text color for the tooltip content.
|
|
39
|
-
* @prop {LibSpacers} [props.offset="xs"] - Distance offset between tooltip and trigger element.
|
|
40
|
-
* @prop {string} [props.tooltipClasses] - Additional CSS classes for the tooltip element.
|
|
41
|
-
* @prop {React.CSSProperties} [props.tooltipStyle] - Additional inline styles for the tooltip element.
|
|
42
|
-
* @prop {function} [props.onClick] - Click event handler for the trigger element.
|
|
43
|
-
* @prop {function} [props.onMouseEnter] - Mouse enter event handler for the trigger element.
|
|
44
|
-
* @prop {function} [props.onMouseLeave] - Mouse leave event handler for the trigger element.
|
|
45
|
-
*
|
|
46
|
-
* @returns {JSX.Element} The rendered Tooltip component.
|
|
47
|
-
*
|
|
48
|
-
* @see https://doc-julseb-lib-react.vercel.app/components/tooltip
|
|
49
|
-
*/
|
|
50
|
-
export const Tooltip: FC<ILibTooltip> = ({
|
|
51
|
-
className,
|
|
52
|
-
element = "div",
|
|
53
|
-
ref,
|
|
54
|
-
children,
|
|
55
|
-
tooltip,
|
|
56
|
-
position = "top",
|
|
57
|
-
hideArrow,
|
|
58
|
-
trigger = "hover",
|
|
59
|
-
backgroundColor = "black-80",
|
|
60
|
-
textColor = "white",
|
|
61
|
-
offset = "xs",
|
|
62
|
-
tooltipClasses,
|
|
63
|
-
tooltipStyle,
|
|
64
|
-
onClick,
|
|
65
|
-
onMouseEnter,
|
|
66
|
-
onMouseLeave,
|
|
67
|
-
...rest
|
|
68
|
-
}) => {
|
|
69
|
-
const Element = element
|
|
70
|
-
|
|
71
|
-
const isTouchScreen = useTouchScreen()
|
|
72
|
-
const defaultTrigger: LibTooltipTrigger =
|
|
73
|
-
trigger === "click" || isTouchScreen ? "click" : "hover"
|
|
74
|
-
|
|
75
|
-
const [isVisible, setIsVisible] = useState(false)
|
|
76
|
-
|
|
77
|
-
const el = useRef<HTMLDivElement>(null)
|
|
78
|
-
useClickOutside(el as RefObject<HTMLElement>, () => {
|
|
79
|
-
if (isVisible && defaultTrigger === "click") setIsVisible(false)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
const handleClick = useCallback(() => {
|
|
83
|
-
setIsVisible(!isVisible)
|
|
84
|
-
}, [isVisible])
|
|
85
|
-
|
|
86
|
-
const handleHover = useCallback(() => {
|
|
87
|
-
setIsVisible(true)
|
|
88
|
-
}, [])
|
|
89
|
-
|
|
90
|
-
const handleLeave = useCallback(() => {
|
|
91
|
-
setIsVisible(false)
|
|
92
|
-
}, [])
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<Element
|
|
96
|
-
ref={ref}
|
|
97
|
-
className={clsx(
|
|
98
|
-
"inline-block relative w-fit",
|
|
99
|
-
isVisible && "visible",
|
|
100
|
-
"[&.visible]:z-20",
|
|
101
|
-
"tooltip-wrapper",
|
|
102
|
-
className,
|
|
103
|
-
)}
|
|
104
|
-
onClick={
|
|
105
|
-
onClick
|
|
106
|
-
? onClick
|
|
107
|
-
: defaultTrigger === "click"
|
|
108
|
-
? handleClick
|
|
109
|
-
: undefined
|
|
110
|
-
}
|
|
111
|
-
onMouseEnter={
|
|
112
|
-
onMouseEnter
|
|
113
|
-
? onMouseEnter
|
|
114
|
-
: defaultTrigger === "hover"
|
|
115
|
-
? handleHover
|
|
116
|
-
: undefined
|
|
117
|
-
}
|
|
118
|
-
onMouseLeave={
|
|
119
|
-
onMouseLeave
|
|
120
|
-
? onMouseLeave
|
|
121
|
-
: defaultTrigger === "hover"
|
|
122
|
-
? handleLeave
|
|
123
|
-
: undefined
|
|
124
|
-
}
|
|
125
|
-
{...rest}
|
|
126
|
-
>
|
|
127
|
-
{children}
|
|
128
|
-
|
|
129
|
-
<span
|
|
130
|
-
className={clsx(
|
|
131
|
-
"absolute px-2 py-1 rounded-md max-w-[unset] text-sm whitespace-nowrap transition-all duration-200 ease-in-out",
|
|
132
|
-
genBgAllColorsAndOverlays[backgroundColor],
|
|
133
|
-
genTextAllColor[textColor],
|
|
134
|
-
isVisible ? "opacity-100 visible" : "opacity-0 invisible",
|
|
135
|
-
!hideArrow && "with-arrow",
|
|
136
|
-
genPosition[offset][position],
|
|
137
|
-
tooltipClasses,
|
|
138
|
-
"tooltip",
|
|
139
|
-
)}
|
|
140
|
-
style={tooltipStyle}
|
|
141
|
-
>
|
|
142
|
-
{tooltip}
|
|
143
|
-
</span>
|
|
144
|
-
</Element>
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const genPosition: Record<LibSpacers, Record<LibTooltipPosition, string>> = {
|
|
149
|
-
"0px": {
|
|
150
|
-
left: "top-0 -left-[86%] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
151
|
-
top: "left-[50%] -translate-x-[50%] top-[-70%] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
152
|
-
right: "top-0 -right-[80%] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
153
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-0px))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
154
|
-
},
|
|
155
|
-
"2xs": {
|
|
156
|
-
left: "top-0 -left-[calc(86%+var(--spacer-2xs))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
157
|
-
top: "left-[50%] -translate-x-[50%] top-[calc(-100%-var(--spacer-2xs)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
158
|
-
right: "top-0 -right-[calc(80%+var(--spacer-2xs))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
159
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-var(--spacer-2xs)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
160
|
-
},
|
|
161
|
-
xs: {
|
|
162
|
-
left: "top-0 -left-[calc(86%+var(--spacer-xs))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
163
|
-
top: "left-[50%] -translate-x-[50%] top-[calc(-100%-var(--spacer-xs)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
164
|
-
right: "top-0 -right-[calc(80%+var(--spacer-xs))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
165
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-var(--spacer-xs)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
166
|
-
},
|
|
167
|
-
sm: {
|
|
168
|
-
left: "top-0 -left-[calc(86%+var(--spacer-sm))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
169
|
-
top: "left-[50%] -translate-x-[50%] top-[calc(-100%-var(--spacer-sm)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
170
|
-
right: "top-0 -right-[calc(80%+var(--spacer-sm))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
171
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-var(--spacer-sm)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
172
|
-
},
|
|
173
|
-
md: {
|
|
174
|
-
left: "top-0 -left-[calc(86%+var(--spacer-md))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
175
|
-
top: "left-[50%] -translate-x-[50%] top-[calc(-100%-var(--spacer-md)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
176
|
-
right: "top-0 -right-[calc(80%+var(--spacer-md))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
177
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-var(--spacer-md)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
178
|
-
},
|
|
179
|
-
lg: {
|
|
180
|
-
left: "top-0 -left-[calc(86%+var(--spacer-lg))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
181
|
-
top: "left-[50%] -translate-x-[50%] top-[calc(-100%-var(--spacer-lg)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
182
|
-
right: "top-0 -right-[calc(80%+var(--spacer-lg))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
183
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-var(--spacer-lg)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
184
|
-
},
|
|
185
|
-
xl: {
|
|
186
|
-
left: "top-0 -left-[calc(86%+var(--spacer-xl))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
187
|
-
top: "left-[50%] -translate-x-[50%] top-[calc(-100%-var(--spacer-xl)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
188
|
-
right: "top-0 -right-[calc(80%+var(--spacer-xl))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
189
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-var(--spacer-xl)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
190
|
-
},
|
|
191
|
-
"2xl": {
|
|
192
|
-
left: "top-0 -left-[calc(86%+var(--spacer-2xl))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:left-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-l-(--color-overlay-black-80)",
|
|
193
|
-
top: "left-[50%] -translate-x-[50%] top-[calc(-100%-var(--spacer-2xl)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-t-(--color-overlay-black-80)",
|
|
194
|
-
right: "top-0 -right-[calc(80%+var(--spacer-2xl))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:top-[50%] [&.with-arrow]:after:right-[100%] [&.with-arrow]:after:translate-y-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-r-(--color-overlay-black-80)",
|
|
195
|
-
bottom: "left-[50%] -translate-x-[50%] bottom-[calc(-100%-var(--spacer-2xl)))] [&.with-arrow]:after:absolute [&.with-arrow]:after:border-4 [&.with-arrow]:after:bottom-[100%] [&.with-arrow]:after:left-[50%] [&.with-arrow]:after:translate-x-[-50%] [&.with-arrow]:after:border-transparent [&.with-arrow]:after:border-b-(--color-overlay-black-80)",
|
|
196
|
-
},
|
|
197
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Tooltip"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ReactElement } from "react"
|
|
2
|
-
import type {
|
|
3
|
-
ClassNames,
|
|
4
|
-
CSSProperties,
|
|
5
|
-
LibAllColors,
|
|
6
|
-
LibAllColorsAndOverlays,
|
|
7
|
-
LibComponentBase,
|
|
8
|
-
LibSpacers,
|
|
9
|
-
LibTooltipPosition,
|
|
10
|
-
LibTooltipTrigger,
|
|
11
|
-
} from "../../types"
|
|
12
|
-
|
|
13
|
-
export interface ILibTooltip extends LibComponentBase<HTMLSpanElement> {
|
|
14
|
-
tooltip: string | ReactElement
|
|
15
|
-
position?: LibTooltipPosition
|
|
16
|
-
hideArrow?: boolean
|
|
17
|
-
trigger?: LibTooltipTrigger
|
|
18
|
-
backgroundColor?: LibAllColorsAndOverlays
|
|
19
|
-
textColor?: LibAllColors
|
|
20
|
-
offset?: LibSpacers
|
|
21
|
-
tooltipClasses?: ClassNames
|
|
22
|
-
tooltipStyle?: CSSProperties
|
|
23
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type FC } from "react"
|
|
2
|
-
import { clsx, genBgAllColors, genGap } from "../../utils"
|
|
3
|
-
import type { ILibWrapper } from "./types"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Wrapper component for providing a responsive layout container.
|
|
7
|
-
*
|
|
8
|
-
* @component
|
|
9
|
-
* @example
|
|
10
|
-
* <Wrapper>
|
|
11
|
-
* <Main>Content</Main>
|
|
12
|
-
* </Wrapper>
|
|
13
|
-
*
|
|
14
|
-
* @extends HTMLDivElement
|
|
15
|
-
*
|
|
16
|
-
* @prop {object} props - Component props.
|
|
17
|
-
* @prop {string} [props.className] - Additional class names to apply.
|
|
18
|
-
* @prop {ElementType} [props.element="section"] - The HTML element or React component to render as the wrapper container.
|
|
19
|
-
* @prop {RefObject<HTMLDivElement>} [props.ref] - Ref for the wrapper container.
|
|
20
|
-
* @prop {ReactNode} props.children - Wrapper content.
|
|
21
|
-
* @prop {"px"|"full"|"screen"|"dvh"|"dvw"|"lvh"|"lvw"|"svw"|"svh"|"auto"|"min"|"max"|"fit"|"lh"|} [props.minHeight="svh"] - Minimum height class (uses Tailwind min-h-* utilities).
|
|
22
|
-
* @prop {string} [props.backgroundColor="background"] - Any color from the library.
|
|
23
|
-
* @prop {"2xs"|"xs"|"sm"|"md"|"lg"|"xl"|"2xl"|"0px"} [props.gap="lg"] - Gap between children (uses library spacers).
|
|
24
|
-
* @prop {object} [props.rest] - Additional props spread to the container.
|
|
25
|
-
*
|
|
26
|
-
* @returns {JSX.Element} The rendered wrapper container.
|
|
27
|
-
*
|
|
28
|
-
* @see https://doc-julseb-lib-react.vercel.app/styles/wrapper
|
|
29
|
-
*/
|
|
30
|
-
export const Wrapper: FC<ILibWrapper> = ({
|
|
31
|
-
className,
|
|
32
|
-
element = "section",
|
|
33
|
-
children,
|
|
34
|
-
ref,
|
|
35
|
-
minHeight = "svh",
|
|
36
|
-
backgroundColor = "background",
|
|
37
|
-
gap = "lg",
|
|
38
|
-
...rest
|
|
39
|
-
}) => {
|
|
40
|
-
const Element = element
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<Element
|
|
44
|
-
ref={ref}
|
|
45
|
-
className={clsx(
|
|
46
|
-
"z-10 relative flex sm:flex-row flex-col justify-stretch sm:justify-center-safe gap-5 px-4 md:px-5 lg:px-12 w-full",
|
|
47
|
-
(genBgAllColors as any)[backgroundColor],
|
|
48
|
-
genMinHeight[minHeight],
|
|
49
|
-
genGap[gap],
|
|
50
|
-
"wrapper",
|
|
51
|
-
className,
|
|
52
|
-
)}
|
|
53
|
-
{...rest}
|
|
54
|
-
>
|
|
55
|
-
{children}
|
|
56
|
-
</Element>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const genMinHeight = {
|
|
61
|
-
px: "min-h-px",
|
|
62
|
-
full: "min-h-full",
|
|
63
|
-
screen: "min-h-screen",
|
|
64
|
-
dvh: "min-h-dvh",
|
|
65
|
-
dvw: "min-h-dvw",
|
|
66
|
-
lvh: "min-h-lvh",
|
|
67
|
-
lvw: "min-h-lvw",
|
|
68
|
-
svw: "min-h-svw",
|
|
69
|
-
svh: "min-h-svh",
|
|
70
|
-
auto: "min-h-auto",
|
|
71
|
-
min: "min-h-min",
|
|
72
|
-
max: "min-h-max",
|
|
73
|
-
fit: "min-h-fit",
|
|
74
|
-
lh: "min-h-lh",
|
|
75
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Wrapper"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
LibComponentBase,
|
|
3
|
-
LibSpacers,
|
|
4
|
-
LibAllColors,
|
|
5
|
-
LibMinHeight,
|
|
6
|
-
} from "../../types"
|
|
7
|
-
|
|
8
|
-
export interface ILibWrapper extends LibComponentBase<HTMLDivElement> {
|
|
9
|
-
gap?: LibSpacers
|
|
10
|
-
backgroundColor?: LibAllColors
|
|
11
|
-
minHeight?: LibMinHeight
|
|
12
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, createContext, useContext } from "react"
|
|
2
|
-
import type { LibThemeNames, ReactChildren, DispatchState } from "../types"
|
|
3
|
-
|
|
4
|
-
type ILibThemeContext = {
|
|
5
|
-
theme: LibThemeNames
|
|
6
|
-
setTheme: DispatchState<LibThemeNames>
|
|
7
|
-
switchTheme: () => void
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const ThemeContext = createContext<ILibThemeContext | null>(null)
|
|
11
|
-
|
|
12
|
-
interface ILibThemeProvider {
|
|
13
|
-
children?: ReactChildren
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const ThemeProviderWrapper = ({ children }: ILibThemeProvider) => {
|
|
17
|
-
const storedTheme = localStorage.getItem("theme") as LibThemeNames
|
|
18
|
-
const [theme, setTheme] = useState(storedTheme ?? "light")
|
|
19
|
-
|
|
20
|
-
const docEl = document.documentElement
|
|
21
|
-
|
|
22
|
-
const switchToLight = () => {
|
|
23
|
-
docEl.classList.add("light")
|
|
24
|
-
docEl.classList.remove("dark")
|
|
25
|
-
setTheme("light")
|
|
26
|
-
localStorage.setItem("theme", "light")
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const switchToDark = () => {
|
|
30
|
-
docEl.classList.remove("light")
|
|
31
|
-
docEl.classList.add("dark")
|
|
32
|
-
setTheme("dark")
|
|
33
|
-
localStorage.setItem("theme", "dark")
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (storedTheme) {
|
|
38
|
-
if (theme === "light") switchToLight()
|
|
39
|
-
else switchToDark()
|
|
40
|
-
} else {
|
|
41
|
-
if (window.matchMedia("(prefers-color-scheme: dark)").matches)
|
|
42
|
-
switchToDark()
|
|
43
|
-
else switchToLight()
|
|
44
|
-
}
|
|
45
|
-
}, [theme, localStorage.getItem("theme"), docEl])
|
|
46
|
-
|
|
47
|
-
const switchTheme = () => {
|
|
48
|
-
if (theme === "light") switchToDark()
|
|
49
|
-
else switchToLight()
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<ThemeContext.Provider value={{ theme, setTheme, switchTheme }}>
|
|
54
|
-
{children}
|
|
55
|
-
</ThemeContext.Provider>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Custom hook to access the theme context.
|
|
61
|
-
*
|
|
62
|
-
* @returns {ILibThemeContext} The current theme, a setter for the theme, and a function to toggle between light and dark themes.
|
|
63
|
-
* @example
|
|
64
|
-
* const { theme, setTheme, switchTheme } = useLibTheme()
|
|
65
|
-
*/
|
|
66
|
-
export const useLibTheme = () => useContext(ThemeContext) as ILibThemeContext
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Theme.context"
|
package/dist/lib/hooks/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from "./useClickOutside"
|
|
2
|
-
export * from "./useCopyToClipboard"
|
|
3
|
-
export * from "./useDebounce"
|
|
4
|
-
export * from "./useExportData"
|
|
5
|
-
export * from "./useFetch"
|
|
6
|
-
export * from "./useForm"
|
|
7
|
-
export * from "./useIsOverflow"
|
|
8
|
-
export * from "./useKeyPress"
|
|
9
|
-
export * from "./useMaxWidth"
|
|
10
|
-
export * from "./useMergeRefs"
|
|
11
|
-
export * from "./useMinWidth"
|
|
12
|
-
export * from "./usePaginatedData"
|
|
13
|
-
export * from "./usePagination"
|
|
14
|
-
export * from "./useTouchScreen"
|
|
15
|
-
export * from "./useTranslation"
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useEffect, type RefObject } from "react"
|
|
2
|
-
|
|
3
|
-
type Event = MouseEvent | TouchEvent
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Hook to trigger a function when clicking outside a referenced element.
|
|
7
|
-
*
|
|
8
|
-
* @hook
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* const ref = useRef<HTMLDivElement>(null)
|
|
12
|
-
* useClickOutside(ref, () => {
|
|
13
|
-
* console.log('Clicked outside!')
|
|
14
|
-
* setIsOpen(false)
|
|
15
|
-
* })
|
|
16
|
-
*
|
|
17
|
-
* @template T - HTML element type that extends HTMLElement
|
|
18
|
-
* @param {RefObject<T>} ref - React ref object pointing to the target element
|
|
19
|
-
* @param {function} handler - Callback function to execute when clicking outside the element
|
|
20
|
-
* @param {Event} handler.event - The mouse or touch event that triggered the outside click
|
|
21
|
-
*
|
|
22
|
-
* @returns {void} This hook doesn't return anything
|
|
23
|
-
*
|
|
24
|
-
* @see https://doc-julseb-lib-react.vercel.app/helpers/hooks#useClickOutside
|
|
25
|
-
*/
|
|
26
|
-
export const useClickOutside = <T extends HTMLElement = HTMLElement>(
|
|
27
|
-
ref: RefObject<T>,
|
|
28
|
-
handler: (event: Event) => void,
|
|
29
|
-
) => {
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const listener = (e: Event) => {
|
|
32
|
-
const target = e.target as HTMLElement
|
|
33
|
-
|
|
34
|
-
if (target.getAttribute("href")) return false
|
|
35
|
-
|
|
36
|
-
const el = ref?.current
|
|
37
|
-
if (!el || el.contains((e?.target as Node) || null)) {
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
handler(e)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
document.addEventListener("mousedown", listener)
|
|
45
|
-
|
|
46
|
-
return () => {
|
|
47
|
-
document.removeEventListener("mousedown", listener)
|
|
48
|
-
}
|
|
49
|
-
}, [ref, handler])
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useState } from "react"
|
|
2
|
-
|
|
3
|
-
type CopiedValue = string | null
|
|
4
|
-
type CopyFn = (text: string) => Promise<boolean>
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Hook to copy text to clipboard and track the copied value state.
|
|
8
|
-
*
|
|
9
|
-
* @hook
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const [copiedText, copy] = useCopyToClipboard()
|
|
13
|
-
*
|
|
14
|
-
* const handleCopy = async () => {
|
|
15
|
-
* const success = await copy('Hello, World!')
|
|
16
|
-
* if (success) {
|
|
17
|
-
* console.log('Copied:', copiedText)
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
* @returns {[CopiedValue, CopyFn]} Array containing the last copied text and copy function
|
|
22
|
-
* @returns {string | null} returns[0] - The last successfully copied text, or null if no text copied or copy failed
|
|
23
|
-
* @returns {function} returns[1] - Async function to copy text to clipboard
|
|
24
|
-
* @returns {string} returns[1].text - Text to copy to clipboard
|
|
25
|
-
* @returns {Promise<boolean>} returns[1].Promise - Promise that resolves to true if copy succeeded, false otherwise
|
|
26
|
-
*
|
|
27
|
-
* @see https://doc-julseb-lib-react.vercel.app/helpers/hooks#useCopyToClipboard
|
|
28
|
-
*/
|
|
29
|
-
export const useCopyToClipboard = (): [CopiedValue, CopyFn] => {
|
|
30
|
-
const [copiedText, setCopiedText] = useState<CopiedValue>(null)
|
|
31
|
-
|
|
32
|
-
const copy: CopyFn = async text => {
|
|
33
|
-
if (!navigator?.clipboard) {
|
|
34
|
-
console.warn("Clipboard not supported")
|
|
35
|
-
return false
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
await navigator.clipboard.writeText(text)
|
|
40
|
-
setCopiedText(text)
|
|
41
|
-
return true
|
|
42
|
-
} catch (error) {
|
|
43
|
-
console.warn("Copy failed", error)
|
|
44
|
-
setCopiedText(null)
|
|
45
|
-
return false
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return [copiedText, copy]
|
|
50
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from "react"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Hook to delay the update of a value until after a specified delay period has passed without changes.
|
|
5
|
-
*
|
|
6
|
-
* @hook
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* const [searchTerm, setSearchTerm] = useState('')
|
|
10
|
-
* const debouncedSearchTerm = useDebounce(searchTerm, 500)
|
|
11
|
-
*
|
|
12
|
-
* useEffect(() => {
|
|
13
|
-
* if (debouncedSearchTerm) {
|
|
14
|
-
* // Perform search API call
|
|
15
|
-
* searchAPI(debouncedSearchTerm)
|
|
16
|
-
* }
|
|
17
|
-
* }, [debouncedSearchTerm])
|
|
18
|
-
*
|
|
19
|
-
* @template T - Type of the value being debounced
|
|
20
|
-
* @param {T} value - The value to debounce
|
|
21
|
-
* @param {number} [delay=1000] - Delay in milliseconds before updating the debounced value
|
|
22
|
-
*
|
|
23
|
-
* @returns {T} The debounced value that updates after the delay period
|
|
24
|
-
*
|
|
25
|
-
* @see https://doc-julseb-lib-react.vercel.app/helpers/hooks#useDebounce
|
|
26
|
-
*/
|
|
27
|
-
export const useDebounce = <T,>(value: T, delay: number = 1000) => {
|
|
28
|
-
const [debouncedValue, setDebouncedValue] = useState<T>(value)
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const timedValue = setTimeout(() => setDebouncedValue(value), delay)
|
|
32
|
-
|
|
33
|
-
return () => clearTimeout(timedValue)
|
|
34
|
-
}, [value, delay])
|
|
35
|
-
|
|
36
|
-
return debouncedValue
|
|
37
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
interface IDownloadFile {
|
|
2
|
-
blob: Blob
|
|
3
|
-
fileName: string
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const downloadFile = ({ blob, fileName }: IDownloadFile) => {
|
|
7
|
-
const a = document.createElement("a")
|
|
8
|
-
a.download = fileName
|
|
9
|
-
a.href = window.URL.createObjectURL(blob)
|
|
10
|
-
const clickEvt = new MouseEvent("click", {
|
|
11
|
-
view: window,
|
|
12
|
-
bubbles: true,
|
|
13
|
-
cancelable: true,
|
|
14
|
-
})
|
|
15
|
-
a.dispatchEvent(clickEvt)
|
|
16
|
-
a.remove()
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Hook to export data to JSON or CSV format with automatic file download functionality.
|
|
21
|
-
*
|
|
22
|
-
* @hook
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const { exportToJson, exportToCsv } = useExportData()
|
|
26
|
-
*
|
|
27
|
-
* // Export to JSON
|
|
28
|
-
* const users = [{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }]
|
|
29
|
-
* exportToJson(users, 'users-data')
|
|
30
|
-
*
|
|
31
|
-
* // Export to CSV
|
|
32
|
-
* const headers = ['ID', 'Name']
|
|
33
|
-
* exportToCsv(users, 'users-data', headers)
|
|
34
|
-
*
|
|
35
|
-
* @template T - Type of the data objects being exported
|
|
36
|
-
*
|
|
37
|
-
* @returns {object} Object containing export functions
|
|
38
|
-
* @returns {function} returns.exportToJson - Function to export data as JSON file
|
|
39
|
-
* @returns {Array<T>} returns.exportToJson.data - Array of data objects to export
|
|
40
|
-
* @returns {string} returns.exportToJson.fileName - Name for the downloaded file (without extension)
|
|
41
|
-
* @returns {function} returns.exportToCsv - Function to export data as CSV file
|
|
42
|
-
* @returns {Array<T>} returns.exportToCsv.data - Array of data objects to export
|
|
43
|
-
* @returns {string} returns.exportToCsv.fileName - Name for the downloaded file (without extension)
|
|
44
|
-
* @returns {Array<string>} returns.exportToCsv.headers - Array of column headers for the CSV file
|
|
45
|
-
*
|
|
46
|
-
* @see https://doc-julseb-lib-react.vercel.app/helpers/hooks#useExportData
|
|
47
|
-
*/
|
|
48
|
-
export const useExportData = <T,>() => {
|
|
49
|
-
const exportToJson = (data: Array<T>, fileName: string) =>
|
|
50
|
-
downloadFile({
|
|
51
|
-
blob: new Blob([JSON.stringify(data)], {
|
|
52
|
-
type: "application/json",
|
|
53
|
-
}),
|
|
54
|
-
fileName: `${fileName}.json`,
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const exportToCsv = (
|
|
58
|
-
data: Array<T>,
|
|
59
|
-
fileName: string,
|
|
60
|
-
headers: Array<string>,
|
|
61
|
-
) => {
|
|
62
|
-
const rows = [headers.join(","), ...data].join("\n")
|
|
63
|
-
|
|
64
|
-
const blob = new Blob([rows], {
|
|
65
|
-
type: "text/csv",
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return downloadFile({
|
|
69
|
-
blob,
|
|
70
|
-
fileName: `${fileName}.csv`,
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
exportToCsv,
|
|
76
|
-
exportToJson,
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Hook to fetch data from a Promise with loading and error state management.
|
|
5
|
-
*
|
|
6
|
-
* @hook
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* const { response, error, loading } = useFetch(
|
|
10
|
-
* fetch('/api/users').then(res => res.json()),
|
|
11
|
-
* [userId]
|
|
12
|
-
* )
|
|
13
|
-
*
|
|
14
|
-
* if (loading) return <div>Loading...</div>
|
|
15
|
-
* if (error) return <div>Error: {error.message}</div>
|
|
16
|
-
* return <div>{response?.name}</div>
|
|
17
|
-
*
|
|
18
|
-
* @template T - Type of the data returned by the fetch function
|
|
19
|
-
* @param {Promise<T>} fetchFunction - Promise that resolves to the data to be fetched
|
|
20
|
-
* @param {any} [dependencies] - Dependency array to trigger re-fetching when values change
|
|
21
|
-
*
|
|
22
|
-
* @returns {object} Object containing fetch state
|
|
23
|
-
* @returns {T | null} returns.response - The fetched data, or null if not yet loaded or failed
|
|
24
|
-
* @returns {any} returns.error - Error object if the fetch failed, undefined otherwise
|
|
25
|
-
* @returns {boolean} returns.loading - Whether the fetch operation is currently in progress
|
|
26
|
-
*
|
|
27
|
-
* @see https://doc-julseb-lib-react.vercel.app/helpers/hooks#useFetch
|
|
28
|
-
*/
|
|
29
|
-
export const useFetch = <T,>(fetchFunction: Promise<T>, dependencies?: any) => {
|
|
30
|
-
const [response, setResponse] = useState<T | null>(null)
|
|
31
|
-
const [loading, setLoading] = useState(true)
|
|
32
|
-
const [error, setError] = useState<any>(undefined)
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
fetchFunction
|
|
36
|
-
.then((res: T) => setResponse(res))
|
|
37
|
-
.catch((err: any) => setError(err))
|
|
38
|
-
.finally(() => setLoading(false))
|
|
39
|
-
}, [dependencies])
|
|
40
|
-
|
|
41
|
-
return { response, error, loading } as const
|
|
42
|
-
}
|