@arkyn/components 3.0.1-beta.154 → 3.0.1-beta.156
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/index.js +4694 -75
- package/dist/modules/components/alert/alertContainer/index.js +22 -0
- package/dist/modules/components/alert/alertContent/index.js +9 -0
- package/dist/modules/components/alert/alertDescription/index.js +9 -0
- package/dist/modules/components/alert/alertIcon/index.js +20 -0
- package/dist/modules/components/alert/alertTitle/index.js +9 -0
- package/dist/modules/components/audioPlayer/index.js +76 -0
- package/dist/modules/components/audioUpload/hasFileContent/index.js +63 -0
- package/dist/modules/components/audioUpload/index.js +80 -0
- package/dist/modules/components/audioUpload/noFileContent/index.js +46 -0
- package/dist/modules/components/badge/index.js +23 -0
- package/dist/modules/components/button/index.js +33 -0
- package/dist/modules/components/calendar/_calendarProvider.js +65 -0
- package/dist/modules/components/calendar/_viewService.js +141 -0
- package/dist/modules/components/calendar/calendarContainer/index.js +8 -0
- package/dist/modules/components/calendar/calendarHeader/index.js +73 -0
- package/dist/modules/components/calendar/calendarTableBody/index.js +11 -0
- package/dist/modules/components/calendar/calendarTableContainer/index.js +8 -0
- package/dist/modules/components/calendar/calendarTableHeader/index.js +11 -0
- package/dist/modules/components/calendar/calendarTableTd/index.js +24 -0
- package/dist/modules/components/calendar/index.js +50 -0
- package/dist/modules/components/cardTab/cardTabButton/index.js +30 -0
- package/dist/modules/components/cardTab/cardTabContainer/index.js +29 -0
- package/dist/modules/components/cardTab/cardTabContext.js +13 -0
- package/dist/modules/components/checkbox/index.js +65 -0
- package/dist/modules/components/clientOnly.js +9 -0
- package/dist/modules/components/currencyInput/index.js +140 -0
- package/dist/modules/components/divider/index.js +13 -0
- package/dist/modules/components/drawer/drawerContainer/index.js +44 -0
- package/dist/modules/components/drawer/drawerContext.js +13 -0
- package/dist/modules/components/drawer/drawerHeader/index.js +28 -0
- package/dist/modules/components/facebookPixel/facebookPixel.client.js +19 -0
- package/dist/modules/components/facebookPixel/index.js +9 -0
- package/dist/modules/components/facebookPixel/pixel.js +53 -0
- package/dist/modules/components/fieldError/index.js +9 -0
- package/dist/modules/components/fieldLabel/index.js +13 -0
- package/dist/modules/components/fieldWrapper/index.js +14 -0
- package/dist/modules/components/fileUpload/hasFileContent/index.js +68 -0
- package/dist/modules/components/fileUpload/index.js +73 -0
- package/dist/modules/components/fileUpload/noFileContent/index.js +46 -0
- package/dist/modules/components/fullCalendar/_fullCalendarProvider.js +48 -0
- package/dist/modules/components/fullCalendar/_viewService.js +106 -0
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +8 -0
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +79 -0
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +34 -0
- package/dist/modules/components/fullCalendar/dayCalendar/index.js +11 -0
- package/dist/modules/components/fullCalendar/fullCalendarContainer/index.js +8 -0
- package/dist/modules/components/fullCalendar/fullCalendarHeader/index.js +72 -0
- package/dist/modules/components/fullCalendar/index.js +31 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/index.js +13 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +37 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +11 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +10 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +11 -0
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +37 -0
- package/dist/modules/components/fullCalendar/weekCalendar/index.js +13 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +79 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +21 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +10 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +20 -0
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +40 -0
- package/dist/modules/components/googleAnalytics/googleAnalytics.client.js +8 -0
- package/dist/modules/components/googleAnalytics/googleAnalytics.js +18 -0
- package/dist/modules/components/googleAnalytics/index.js +10 -0
- package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js +16 -0
- package/dist/modules/components/googleTagManager/googleTagManager.client.js +8 -0
- package/dist/modules/components/googleTagManager/googleTagManager.js +49 -0
- package/dist/modules/components/googleTagManager/index.js +28 -0
- package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js +9 -0
- package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js +24 -0
- package/dist/modules/components/iconButton/index.js +30 -0
- package/dist/modules/components/imageUpload/hasFileContent/index.js +64 -0
- package/dist/modules/components/imageUpload/index.js +83 -0
- package/dist/modules/components/imageUpload/noFileContent/index.js +46 -0
- package/dist/modules/components/input/index.js +121 -0
- package/dist/modules/components/mapView/index.js +33 -0
- package/dist/modules/components/mapView/mapView.client.js +52 -0
- package/dist/modules/components/maskedInput/index.js +113 -0
- package/dist/modules/components/modal/modalContainer/index.js +43 -0
- package/dist/modules/components/modal/modalContext.js +13 -0
- package/dist/modules/components/modal/modalFooter/index.js +9 -0
- package/dist/modules/components/modal/modalHeader/index.js +28 -0
- package/dist/modules/components/multiSelect/index.js +155 -0
- package/dist/modules/components/multiSelect/multiSelectChevron/index.js +22 -0
- package/dist/modules/components/multiSelect/multiSelectContainer/index.js +30 -0
- package/dist/modules/components/multiSelect/multiSelectContent/index.js +9 -0
- package/dist/modules/components/multiSelect/multiSelectMark/index.js +23 -0
- package/dist/modules/components/multiSelect/multiSelectOption/index.js +14 -0
- package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js +46 -0
- package/dist/modules/components/multiSelect/multiSelectOverlay/index.js +9 -0
- package/dist/modules/components/multiSelect/multiSelectSpinner/index.js +17 -0
- package/dist/modules/components/pagination/chevronButton/index.js +18 -0
- package/dist/modules/components/pagination/currentButton/index.js +8 -0
- package/dist/modules/components/pagination/index.js +84 -0
- package/dist/modules/components/pagination/pageButton/index.js +9 -0
- package/dist/modules/components/pagination/paginationService.js +49 -0
- package/dist/modules/components/pagination/spread/index.js +9 -0
- package/dist/modules/components/phoneInput/index.js +152 -0
- package/dist/modules/components/phoneInput/phoneInputContainer/index.js +20 -0
- package/dist/modules/components/phoneInput/phoneInputCountriesOverlay/index.js +9 -0
- package/dist/modules/components/phoneInput/phoneInputCountryOption/index.js +16 -0
- package/dist/modules/components/phoneInput/phoneInputCountryOptionsContainer/index.js +44 -0
- package/dist/modules/components/phoneInput/phoneInputCountrySelector/index.js +22 -0
- package/dist/modules/components/phoneInput/phoneInputMask/index.js +62 -0
- package/dist/modules/components/popover/index.js +37 -0
- package/dist/modules/components/radio/radioBox/index.js +43 -0
- package/dist/modules/components/radio/radioContext.js +20 -0
- package/dist/modules/components/radio/radioGroup/index.js +65 -0
- package/dist/modules/components/richText/blockButton/index.js +24 -0
- package/dist/modules/components/richText/element/index.js +59 -0
- package/dist/modules/components/richText/index.js +136 -0
- package/dist/modules/components/richText/insertImage/index.js +106 -0
- package/dist/modules/components/richText/insertVideo/index.js +98 -0
- package/dist/modules/components/richText/leaf/index.js +7 -0
- package/dist/modules/components/richText/markButton/index.js +23 -0
- package/dist/modules/components/richText/toolbar/index.js +8 -0
- package/dist/modules/components/searchPlaces.js +67 -0
- package/dist/modules/components/select/index.js +145 -0
- package/dist/modules/components/select/selectChevron/index.js +22 -0
- package/dist/modules/components/select/selectContainer/index.js +30 -0
- package/dist/modules/components/select/selectContent/index.js +9 -0
- package/dist/modules/components/select/selectOption/index.js +14 -0
- package/dist/modules/components/select/selectOptionsContainer/index.js +46 -0
- package/dist/modules/components/select/selectOverlay/index.js +9 -0
- package/dist/modules/components/select/selectSpinner/index.js +10 -0
- package/dist/modules/components/slider/index.js +42 -0
- package/dist/modules/components/switch/index.js +63 -0
- package/dist/modules/components/tab/tabButton/index.js +30 -0
- package/dist/modules/components/tab/tabContainer/index.js +29 -0
- package/dist/modules/components/tab/tabContext.js +13 -0
- package/dist/modules/components/table/tableBody/index.js +15 -0
- package/dist/modules/components/table/tableCaption/index.js +9 -0
- package/dist/modules/components/table/tableContainer/index.js +9 -0
- package/dist/modules/components/table/tableFooter/index.js +12 -0
- package/dist/modules/components/table/tableHeader/index.js +12 -0
- package/dist/modules/components/textarea/index.js +70 -0
- package/dist/modules/components/tooltip/index.js +46 -0
- package/dist/modules/hooks/useAutomation.js +28 -0
- package/dist/modules/hooks/useDrawer.js +20 -0
- package/dist/modules/hooks/useForm.js +8 -0
- package/dist/modules/hooks/useHydrated.js +15 -0
- package/dist/modules/hooks/useModal.js +20 -0
- package/dist/modules/hooks/useScopedParams.js +18 -0
- package/dist/modules/hooks/useScrollLock.js +21 -0
- package/dist/modules/hooks/useSearchAutomation.js +15 -0
- package/dist/modules/hooks/useSlider.js +14 -0
- package/dist/modules/hooks/useToast.js +11 -0
- package/dist/modules/index.js +144 -0
- package/dist/modules/providers/drawerProvider.js +31 -0
- package/dist/modules/providers/formProvider.js +18 -0
- package/dist/modules/providers/modalProvider.js +34 -0
- package/dist/modules/providers/placesProvider.js +18 -0
- package/dist/modules/providers/toastProvider.js +52 -0
- package/dist/modules/services/extractTextFromNode.js +7 -0
- package/dist/modules/services/fieldTemplate.js +24 -0
- package/dist/modules/services/iconRenderer.js +8 -0
- package/dist/modules/services/isBlockActive.js +15 -0
- package/dist/modules/services/isMarkActive.js +8 -0
- package/dist/modules/services/maskCurrencyValues.js +14 -0
- package/dist/modules/services/toHtml.js +7 -0
- package/dist/modules/services/toRichTextValue.js +9 -0
- package/dist/modules/services/toggleBlock.js +20 -0
- package/dist/modules/services/toggleMark.js +8 -0
- package/dist/modules/style.css +1 -0
- package/dist/modules/templates/badResponses.js +14 -0
- package/dist/modules/templates/richTextTemplates.js +14 -0
- package/dist/modules/templates/successResponses.js +4 -0
- package/dist/modules/utils/phoneInputUtilities.js +32 -0
- package/dist/modules/utils/richTextUtilities.js +77 -0
- package/package.json +208 -208
- package/dist/components/alert/alertContainer/index.js +0 -71
- package/dist/components/alert/alertContent/index.js +0 -26
- package/dist/components/alert/alertDescription/index.js +0 -25
- package/dist/components/alert/alertIcon/index.js +0 -43
- package/dist/components/alert/alertTitle/index.js +0 -27
- package/dist/components/audioPlayer/index.js +0 -112
- package/dist/components/audioUpload/hasFileContent/index.js +0 -26
- package/dist/components/audioUpload/index.js +0 -95
- package/dist/components/audioUpload/noFileContent/index.js +0 -29
- package/dist/components/badge/index.js +0 -41
- package/dist/components/button/index.js +0 -51
- package/dist/components/calendar/_calendarProvider.js +0 -58
- package/dist/components/calendar/_viewService.js +0 -179
- package/dist/components/calendar/calendarContainer/index.js +0 -6
- package/dist/components/calendar/calendarHeader/index.js +0 -13
- package/dist/components/calendar/calendarTableBody/index.js +0 -9
- package/dist/components/calendar/calendarTableContainer/index.js +0 -6
- package/dist/components/calendar/calendarTableHeader/index.js +0 -9
- package/dist/components/calendar/calendarTableTd/index.js +0 -15
- package/dist/components/calendar/index.js +0 -54
- package/dist/components/cardTab/cardTabButton/index.js +0 -40
- package/dist/components/cardTab/cardTabContainer/index.js +0 -42
- package/dist/components/cardTab/cardTabContext.js +0 -10
- package/dist/components/checkbox/index.js +0 -71
- package/dist/components/clientOnly.js +0 -31
- package/dist/components/currencyInput/index.js +0 -126
- package/dist/components/divider/index.js +0 -28
- package/dist/components/drawer/drawerContainer/index.js +0 -38
- package/dist/components/drawer/drawerContext.js +0 -10
- package/dist/components/drawer/drawerHeader/index.js +0 -33
- package/dist/components/facebookPixel/facebookPixel.client.js +0 -23
- package/dist/components/facebookPixel/index.js +0 -45
- package/dist/components/facebookPixel/pixel.js +0 -111
- package/dist/components/fieldError/index.js +0 -26
- package/dist/components/fieldLabel/index.js +0 -23
- package/dist/components/fieldWrapper/index.js +0 -27
- package/dist/components/fileUpload/hasFileContent/index.js +0 -34
- package/dist/components/fileUpload/index.js +0 -89
- package/dist/components/fileUpload/noFileContent/index.js +0 -29
- package/dist/components/fullCalendar/_fullCalendarProvider.js +0 -36
- package/dist/components/fullCalendar/_viewService.js +0 -144
- package/dist/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +0 -6
- package/dist/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +0 -105
- package/dist/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +0 -24
- package/dist/components/fullCalendar/dayCalendar/index.js +0 -9
- package/dist/components/fullCalendar/fullCalendarContainer/index.js +0 -6
- package/dist/components/fullCalendar/fullCalendarHeader/index.js +0 -37
- package/dist/components/fullCalendar/index.js +0 -52
- package/dist/components/fullCalendar/monthlyCalendar/index.js +0 -8
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +0 -29
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +0 -9
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +0 -6
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +0 -9
- package/dist/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +0 -30
- package/dist/components/fullCalendar/weekCalendar/index.js +0 -8
- package/dist/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +0 -102
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +0 -11
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +0 -6
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +0 -10
- package/dist/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +0 -25
- package/dist/components/googleAnalytics/googleAnalytics.client.js +0 -8
- package/dist/components/googleAnalytics/googleAnalytics.js +0 -23
- package/dist/components/googleAnalytics/index.js +0 -31
- package/dist/components/googleAnalytics/snippets/generateGAElements.js +0 -16
- package/dist/components/googleTagManager/googleTagManager.client.js +0 -8
- package/dist/components/googleTagManager/googleTagManager.js +0 -52
- package/dist/components/googleTagManager/index.js +0 -47
- package/dist/components/googleTagManager/snippets/appendToDataLayer.js +0 -7
- package/dist/components/googleTagManager/snippets/generateGTMElements.js +0 -25
- package/dist/components/iconButton/index.js +0 -38
- package/dist/components/imageUpload/hasFileContent/index.js +0 -24
- package/dist/components/imageUpload/index.js +0 -101
- package/dist/components/imageUpload/noFileContent/index.js +0 -29
- package/dist/components/input/index.js +0 -94
- package/dist/components/mapView/index.js +0 -53
- package/dist/components/mapView/mapView.client.js +0 -51
- package/dist/components/maskedInput/index.js +0 -108
- package/dist/components/modal/modalContainer/index.js +0 -40
- package/dist/components/modal/modalContext.js +0 -10
- package/dist/components/modal/modalFooter/index.js +0 -32
- package/dist/components/modal/modalHeader/index.js +0 -34
- package/dist/components/multiSelect/index.js +0 -135
- package/dist/components/multiSelect/multiSelectChevron/index.js +0 -18
- package/dist/components/multiSelect/multiSelectContainer/index.js +0 -11
- package/dist/components/multiSelect/multiSelectContent/index.js +0 -8
- package/dist/components/multiSelect/multiSelectMark/index.js +0 -11
- package/dist/components/multiSelect/multiSelectOption/index.js +0 -10
- package/dist/components/multiSelect/multiSelectOptionsContainer/index.js +0 -44
- package/dist/components/multiSelect/multiSelectOverlay/index.js +0 -9
- package/dist/components/multiSelect/multiSelectSpinner/index.js +0 -10
- package/dist/components/pagination/chevronButton/index.js +0 -9
- package/dist/components/pagination/currentButton/index.js +0 -6
- package/dist/components/pagination/index.js +0 -46
- package/dist/components/pagination/pageButton/index.js +0 -7
- package/dist/components/pagination/paginationService.js +0 -62
- package/dist/components/pagination/spread/index.js +0 -7
- package/dist/components/phoneInput/index.js +0 -127
- package/dist/components/phoneInput/phoneInputContainer/index.js +0 -11
- package/dist/components/phoneInput/phoneInputCountriesOverlay/index.js +0 -9
- package/dist/components/phoneInput/phoneInputCountryOption/index.js +0 -10
- package/dist/components/phoneInput/phoneInputCountryOptionsContainer/index.js +0 -40
- package/dist/components/phoneInput/phoneInputCountrySelector/index.js +0 -9
- package/dist/components/phoneInput/phoneInputMask/index.js +0 -37
- package/dist/components/popover/index.js +0 -62
- package/dist/components/radio/radioBox/index.js +0 -48
- package/dist/components/radio/radioContext.js +0 -11
- package/dist/components/radio/radioGroup/index.js +0 -58
- package/dist/components/richText/blockButton/index.js +0 -18
- package/dist/components/richText/element/index.js +0 -26
- package/dist/components/richText/index.js +0 -136
- package/dist/components/richText/insertImage/index.js +0 -33
- package/dist/components/richText/insertVideo/index.js +0 -51
- package/dist/components/richText/leaf/index.js +0 -13
- package/dist/components/richText/markButton/index.js +0 -16
- package/dist/components/richText/toolbar/index.js +0 -6
- package/dist/components/searchPlaces.js +0 -99
- package/dist/components/select/index.js +0 -134
- package/dist/components/select/selectChevron/index.js +0 -18
- package/dist/components/select/selectContainer/index.js +0 -11
- package/dist/components/select/selectContent/index.js +0 -8
- package/dist/components/select/selectOption/index.js +0 -10
- package/dist/components/select/selectOptionsContainer/index.js +0 -44
- package/dist/components/select/selectOverlay/index.js +0 -9
- package/dist/components/select/selectSpinner/index.js +0 -10
- package/dist/components/slider/index.js +0 -79
- package/dist/components/switch/index.js +0 -66
- package/dist/components/tab/tabButton/index.js +0 -40
- package/dist/components/tab/tabContainer/index.js +0 -42
- package/dist/components/tab/tabContext.js +0 -10
- package/dist/components/table/tableBody/index.js +0 -34
- package/dist/components/table/tableCaption/index.js +0 -24
- package/dist/components/table/tableContainer/index.js +0 -37
- package/dist/components/table/tableFooter/index.js +0 -23
- package/dist/components/table/tableHeader/index.js +0 -25
- package/dist/components/textarea/index.js +0 -80
- package/dist/components/tooltip/index.js +0 -96
- package/dist/hooks/useAutomation.js +0 -74
- package/dist/hooks/useDrawer.js +0 -20
- package/dist/hooks/useForm.js +0 -35
- package/dist/hooks/useHydrated.js +0 -26
- package/dist/hooks/useModal.js +0 -20
- package/dist/hooks/useScopedParams.js +0 -55
- package/dist/hooks/useScrollLock.js +0 -46
- package/dist/hooks/useSearchAutomation.js +0 -64
- package/dist/hooks/useSlider.js +0 -35
- package/dist/hooks/useToast.js +0 -28
- package/dist/providers/drawerProvider.js +0 -54
- package/dist/providers/formProvider.js +0 -34
- package/dist/providers/modalProvider.js +0 -58
- package/dist/providers/placesProvider.js +0 -40
- package/dist/providers/toastProvider.js +0 -62
- package/dist/services/extractTextFromNode.js +0 -5
- package/dist/services/fieldTemplate.js +0 -11
- package/dist/services/iconRenderer.js +0 -13
- package/dist/services/isBlockActive.js +0 -14
- package/dist/services/isMarkActive.js +0 -6
- package/dist/services/maskCurrencyValues.js +0 -23
- package/dist/services/toHtml.js +0 -22
- package/dist/services/toRichTextValue.js +0 -34
- package/dist/services/toggleBlock.js +0 -32
- package/dist/services/toggleMark.js +0 -10
- package/dist/templates/badResponses.js +0 -12
- package/dist/templates/richTextTemplates.js +0 -12
- package/dist/templates/successResponses.js +0 -2
- package/dist/types/richTextTypes.js +0 -1
- package/dist/utils/phoneInputUtilities.js +0 -37
- package/dist/utils/richTextUtilities.js +0 -89
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { InputMask } from "@react-input/mask";
|
|
3
|
-
import { Loader2 } from "lucide-react";
|
|
4
|
-
import { forwardRef, useId, useRef, useState, } from "react";
|
|
5
|
-
import { useForm } from "../../hooks/useForm";
|
|
6
|
-
import { IconRenderer } from "../../services/iconRenderer";
|
|
7
|
-
import { FieldError } from "../fieldError";
|
|
8
|
-
import { FieldLabel } from "../fieldLabel";
|
|
9
|
-
import { FieldWrapper } from "../fieldWrapper";
|
|
10
|
-
import "./style.css";
|
|
11
|
-
const BaseInput = forwardRef((props, ref) => {
|
|
12
|
-
return _jsx("input", { ref: ref, ...props });
|
|
13
|
-
});
|
|
14
|
-
/**
|
|
15
|
-
* MaskedInput — text input with a configurable mask for structured values (phones, CPF, credit cards, etc.).
|
|
16
|
-
*
|
|
17
|
-
* Built on `@react-input/mask`. Integrates with `useForm` to display validation errors by field name.
|
|
18
|
-
*
|
|
19
|
-
* @param props.name - Field name for form submission. Required.
|
|
20
|
-
* @param props.mask - Mask pattern string. Required.
|
|
21
|
-
* @param props.replacement - Character or map that marks editable positions. Required.
|
|
22
|
-
* @param props.separate - Strips mask chars from the value, keeping only typed characters.
|
|
23
|
-
* @param props.showMask - Shows the full mask pattern before the user types.
|
|
24
|
-
* @param props.label - Label text displayed above the input.
|
|
25
|
-
* @param props.errorMessage - Validation error message.
|
|
26
|
-
* @param props.isLoading - Shows a spinner and disables the input. Default: false
|
|
27
|
-
* @param props.size - Input size (`md` | `lg`). Default: "md"
|
|
28
|
-
* @param props.variant - Visual style variant. Default: "solid"
|
|
29
|
-
* @param props.prefix - Text or icon at the far left.
|
|
30
|
-
* @param props.suffix - Text or icon at the far right.
|
|
31
|
-
* @param props.leftIcon - Lucide icon inside the input on the left.
|
|
32
|
-
* @param props.rightIcon - Lucide icon inside the input on the right.
|
|
33
|
-
* @param props.showAsterisk - Appends `*` to the label.
|
|
34
|
-
*
|
|
35
|
-
* **...Other valid HTML properties for `<input>` (except `type`)**
|
|
36
|
-
*
|
|
37
|
-
* @returns MaskedInput JSX element wrapped in `FieldWrapper`.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* // Brazilian mobile phone
|
|
42
|
-
* <MaskedInput
|
|
43
|
-
* name="phone"
|
|
44
|
-
* mask="(__) _____-____"
|
|
45
|
-
* replacement={{ _: /\d/ }}
|
|
46
|
-
* label="Phone"
|
|
47
|
-
* />
|
|
48
|
-
*
|
|
49
|
-
* // CPF with mask visible and validation
|
|
50
|
-
* <MaskedInput
|
|
51
|
-
* name="cpf"
|
|
52
|
-
* label="CPF"
|
|
53
|
-
* mask="___.___.___-__"
|
|
54
|
-
* replacement="_"
|
|
55
|
-
* showMask
|
|
56
|
-
* showAsterisk
|
|
57
|
-
* errorMessage="Invalid CPF"
|
|
58
|
-
* />
|
|
59
|
-
*
|
|
60
|
-
* // Credit card
|
|
61
|
-
* <MaskedInput
|
|
62
|
-
* name="card"
|
|
63
|
-
* label="Credit Card"
|
|
64
|
-
* mask="____ ____ ____ ____"
|
|
65
|
-
* replacement={{ _: /\d/ }}
|
|
66
|
-
* leftIcon={CreditCard}
|
|
67
|
-
* />
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
function MaskedInput(props) {
|
|
71
|
-
const { name, disabled, title, style, variant = "solid", separate, mask, showMask, replacement, label, className: wrapperClassName = "", prefix, suffix, isLoading = false, leftIcon, readOnly, onFocus, onBlur, errorMessage: baseErrorMessage, defaultValue, showAsterisk, rightIcon, size = "md", id, value, placeholder, ...rest } = props;
|
|
72
|
-
const { fieldErrors } = useForm();
|
|
73
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
74
|
-
const inputRef = useRef(null);
|
|
75
|
-
const inputId = id || useId();
|
|
76
|
-
const errorMessage = baseErrorMessage || fieldErrors?.[name];
|
|
77
|
-
const isError = !!errorMessage;
|
|
78
|
-
const isDisabled = disabled || isLoading;
|
|
79
|
-
const iconSizes = { md: 20, lg: 20 };
|
|
80
|
-
const iconSize = iconSizes[size];
|
|
81
|
-
const loadingPosition = rightIcon ? "right" : "left";
|
|
82
|
-
const showLeftSpinner = loadingPosition === "left" && isLoading;
|
|
83
|
-
const showRightSpinner = loadingPosition === "right" && isLoading;
|
|
84
|
-
function handleSectionClick() {
|
|
85
|
-
if (isDisabled || !inputRef?.current)
|
|
86
|
-
return;
|
|
87
|
-
setIsFocused(true);
|
|
88
|
-
inputRef.current.focus();
|
|
89
|
-
}
|
|
90
|
-
function handleFocus(e) {
|
|
91
|
-
setIsFocused(true);
|
|
92
|
-
if (onFocus)
|
|
93
|
-
onFocus(e);
|
|
94
|
-
}
|
|
95
|
-
function handleBlur(e) {
|
|
96
|
-
setIsFocused(false);
|
|
97
|
-
if (onBlur)
|
|
98
|
-
onBlur(e);
|
|
99
|
-
}
|
|
100
|
-
const hasPrefix = !!prefix ? "hasPrefix" : "";
|
|
101
|
-
const hasSuffix = !!suffix ? "hasSuffix" : "";
|
|
102
|
-
const errored = isError ? "errored" : "";
|
|
103
|
-
const opacity = isDisabled || readOnly || isLoading ? "opacity" : "";
|
|
104
|
-
const focused = isFocused ? "focused" : "";
|
|
105
|
-
const className = `arkynMaskedInput ${hasPrefix} ${hasSuffix} ${variant} ${size} ${opacity} ${errored} ${focused}`;
|
|
106
|
-
return (_jsxs(FieldWrapper, { className: wrapperClassName, children: [label && (_jsx(FieldLabel, { showAsterisk: showAsterisk, htmlFor: inputId, children: label })), _jsxs("section", { title: title, style: style, onClick: handleSectionClick, className: className, children: [_jsx(IconRenderer, { iconSize: iconSize, icon: prefix, className: "prefix" }), _jsx(IconRenderer, { show: showLeftSpinner, iconSize: iconSize, className: "spinner", icon: Loader2 }), _jsx(IconRenderer, { show: !isLoading, icon: leftIcon, iconSize: iconSize }), _jsx(InputMask, { component: BaseInput, mask: mask, replacement: replacement, separate: separate, showMask: showMask, ref: inputRef, onFocus: handleFocus, onBlur: handleBlur, disabled: isDisabled, readOnly: readOnly, id: inputId, name: name, defaultValue: defaultValue || undefined, placeholder: isDisabled ? value || placeholder : placeholder, value: isDisabled ? undefined : value, ...rest }), _jsx(IconRenderer, { show: !isLoading, icon: rightIcon, iconSize: iconSize }), _jsx(IconRenderer, { show: showRightSpinner, iconSize: iconSize, className: "spinner", icon: Loader2 }), _jsx(IconRenderer, { iconSize: iconSize, icon: suffix, className: "suffix" })] }), errorMessage && _jsx(FieldError, { children: errorMessage })] }));
|
|
107
|
-
}
|
|
108
|
-
export { MaskedInput };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
3
|
-
import { useScrollLock } from "../../../hooks/useScrollLock";
|
|
4
|
-
import { ModalProvider } from "../modalContext";
|
|
5
|
-
import "./styles.css";
|
|
6
|
-
/**
|
|
7
|
-
* ModalContainer — animated centered modal rendered over a backdrop overlay.
|
|
8
|
-
*
|
|
9
|
-
* Locks body scroll while open. Closes when the overlay is clicked.
|
|
10
|
-
* Provides context consumed by `ModalHeader` (close button).
|
|
11
|
-
*
|
|
12
|
-
* @param props.isVisible - Whether the modal is open. Required.
|
|
13
|
-
* @param props.makeInvisible - Called when the overlay is clicked. Required.
|
|
14
|
-
*
|
|
15
|
-
* **...Other valid HTML `<aside>` properties**
|
|
16
|
-
*
|
|
17
|
-
* @returns ModalContainer JSX element.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* const [isOpen, setIsOpen] = useState(false);
|
|
22
|
-
*
|
|
23
|
-
* <ModalContainer isVisible={isOpen} makeInvisible={() => setIsOpen(false)}>
|
|
24
|
-
* <ModalHeader><h2>Confirm deletion</h2></ModalHeader>
|
|
25
|
-
* <main><p>This action cannot be undone.</p></main>
|
|
26
|
-
* <ModalFooter>
|
|
27
|
-
* <Button onClick={() => setIsOpen(false)}>Cancel</Button>
|
|
28
|
-
* <Button scheme="danger" onClick={handleDelete}>Delete</Button>
|
|
29
|
-
* </ModalFooter>
|
|
30
|
-
* </ModalContainer>
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
function ModalContainer(args) {
|
|
34
|
-
const { isVisible, makeInvisible, children, className: baseClassName = "", ...rest } = args;
|
|
35
|
-
useScrollLock(isVisible);
|
|
36
|
-
const visibleClass = isVisible ? "visibleTrue" : "visibleFalse";
|
|
37
|
-
const className = `arkynModalContainer ${visibleClass} ${baseClassName}`;
|
|
38
|
-
return (_jsx(ModalProvider, { makeInvisible: makeInvisible, children: _jsx(AnimatePresence, { children: isVisible && (_jsxs("aside", { className: className.trim(), ...rest, children: [_jsx(motion.div, { className: "arkynModalContainerOverlay", transition: { duration: 0.15, ease: "easeOut" }, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: makeInvisible }), _jsx(motion.div, { className: "arkynModalContainerContent", transition: { duration: 0.15, ease: "easeOut" }, initial: { opacity: 0, scale: 0.75 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0 }, children: children })] })) }) }));
|
|
39
|
-
}
|
|
40
|
-
export { ModalContainer };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
const modalContext = createContext({});
|
|
4
|
-
function ModalProvider(props) {
|
|
5
|
-
return (_jsx(modalContext.Provider, { value: { makeInvisible: props.makeInvisible }, children: props.children }));
|
|
6
|
-
}
|
|
7
|
-
function useModal() {
|
|
8
|
-
return useContext(modalContext);
|
|
9
|
-
}
|
|
10
|
-
export { ModalProvider, useModal };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
/**
|
|
4
|
-
* ModalFooter — action bar at the bottom of a modal dialog.
|
|
5
|
-
*
|
|
6
|
-
* @param props.alignment - Horizontal alignment of children. Default: `"right"`
|
|
7
|
-
*
|
|
8
|
-
* **...Other valid HTML `<footer>` properties**
|
|
9
|
-
*
|
|
10
|
-
* @returns ModalFooter JSX element.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* // Confirm / cancel pattern (right-aligned by default)
|
|
15
|
-
* <ModalFooter>
|
|
16
|
-
* <Button variant="ghost" onClick={onClose}>Cancel</Button>
|
|
17
|
-
* <Button scheme="danger" onClick={onConfirm}>Delete</Button>
|
|
18
|
-
* </ModalFooter>
|
|
19
|
-
*
|
|
20
|
-
* // Space-between layout (e.g. back / next in a wizard)
|
|
21
|
-
* <ModalFooter alignment="between">
|
|
22
|
-
* <Button variant="outline" onClick={onBack}>Back</Button>
|
|
23
|
-
* <Button onClick={onNext}>Next</Button>
|
|
24
|
-
* </ModalFooter>
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
function ModalFooter(args) {
|
|
28
|
-
const { alignment = "right", className: baseClassName, ...rest } = args;
|
|
29
|
-
const className = `arkynModalFooter ${alignment} ${baseClassName}`;
|
|
30
|
-
return _jsx("footer", { className: className.trim(), ...rest });
|
|
31
|
-
}
|
|
32
|
-
export { ModalFooter };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { X } from "lucide-react";
|
|
3
|
-
import { useModal } from "../modalContext";
|
|
4
|
-
import "./styles.css";
|
|
5
|
-
/**
|
|
6
|
-
* ModalHeader — header section for a `ModalContainer`, with an optional close button.
|
|
7
|
-
*
|
|
8
|
-
* The close button calls `makeInvisible` from the nearest `ModalContainer` context.
|
|
9
|
-
* Must be rendered inside a `ModalContainer`.
|
|
10
|
-
*
|
|
11
|
-
* @param props.showCloseButton - Renders the X close button. Default: true
|
|
12
|
-
*
|
|
13
|
-
* **...Other valid HTML `<header>` properties**
|
|
14
|
-
*
|
|
15
|
-
* @returns ModalHeader JSX element.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <ModalContainer isVisible={isOpen} makeInvisible={() => setIsOpen(false)}>
|
|
20
|
-
* <ModalHeader>
|
|
21
|
-
* <h2>Edit profile</h2>
|
|
22
|
-
* </ModalHeader>
|
|
23
|
-
* <main>...</main>
|
|
24
|
-
* <ModalFooter><Button onClick={onSave}>Save</Button></ModalFooter>
|
|
25
|
-
* </ModalContainer>
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
function ModalHeader(args) {
|
|
29
|
-
const { showCloseButton = true, className: baseClassName, children, ...rest } = args;
|
|
30
|
-
const { makeInvisible } = useModal();
|
|
31
|
-
const className = `arkynModalHeader ${baseClassName}`;
|
|
32
|
-
return (_jsxs("header", { className: className.trim(), ...rest, children: [children, showCloseButton && (_jsx("button", { type: "button", onClick: makeInvisible, "aria-label": "Close modal button", className: "arkynModalHeaderCloseButton", children: _jsx(X, { size: 24 }) }))] }));
|
|
33
|
-
}
|
|
34
|
-
export { ModalHeader };
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useId, useRef, useState } from "react";
|
|
3
|
-
import { useForm } from "../../hooks/useForm";
|
|
4
|
-
import { FieldTemplate } from "../../services/fieldTemplate";
|
|
5
|
-
import { IconRenderer } from "../../services/iconRenderer";
|
|
6
|
-
import { MultiSelectChevron } from "./multiSelectChevron";
|
|
7
|
-
import { MultiSelectContainer } from "./multiSelectContainer";
|
|
8
|
-
import { MultiSelectContent } from "./multiSelectContent";
|
|
9
|
-
import { MultiSelectMark } from "./multiSelectMark";
|
|
10
|
-
import { MultiSelectOption } from "./multiSelectOption";
|
|
11
|
-
import { MultiSelectOptionsContainer } from "./multiSelectOptionsContainer";
|
|
12
|
-
import { MultiSelectOverlay } from "./multiSelectOverlay";
|
|
13
|
-
import { MultiSelectSpinner } from "./multiSelectSpinner";
|
|
14
|
-
/**
|
|
15
|
-
* MultiSelect — multi-option dropdown with optional search, label, validation, and form integration.
|
|
16
|
-
*
|
|
17
|
-
* Selected values are stored as a JSON array in a hidden `<input>` for form submission.
|
|
18
|
-
* Integrates with `useForm` to display validation errors by field name.
|
|
19
|
-
*
|
|
20
|
-
* @param props.name - Field name for form submission. Required.
|
|
21
|
-
* @param props.options - Array of selectable options (`{ label, value }`). Required.
|
|
22
|
-
* @param props.value - Controlled array of selected values.
|
|
23
|
-
* @param props.defaultValue - Uncontrolled default selection. Default: []
|
|
24
|
-
* @param props.label - Label text displayed above the multiselect.
|
|
25
|
-
* @param props.placeholder - Placeholder shown when nothing is selected. Default: "Selecione..."
|
|
26
|
-
* @param props.errorMessage - Validation error message.
|
|
27
|
-
* @param props.isSearchable - Enables search/filter within the dropdown. Default: false
|
|
28
|
-
* @param props.isLoading - Shows a loading spinner and disables interactions. Default: false
|
|
29
|
-
* @param props.closeOnSelect - Closes the dropdown after toggling an option. Default: false
|
|
30
|
-
* @param props.onChange - Callback fired when the selection changes.
|
|
31
|
-
* @param props.onSearch - Callback fired when the search query changes.
|
|
32
|
-
* @param props.size - MultiSelect size (`md` | `lg`). Default: "md"
|
|
33
|
-
* @param props.variant - Visual style variant. Default: "solid"
|
|
34
|
-
* @param props.orientation - Layout direction. Default: "horizontal"
|
|
35
|
-
* @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false
|
|
36
|
-
*
|
|
37
|
-
* @returns MultiSelect JSX element wrapped in `FieldTemplate`.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```tsx
|
|
41
|
-
* // Basic
|
|
42
|
-
* <MultiSelect
|
|
43
|
-
* name="categories"
|
|
44
|
-
* options={[
|
|
45
|
-
* { label: "Technology", value: "tech" },
|
|
46
|
-
* { label: "Design", value: "design" },
|
|
47
|
-
* ]}
|
|
48
|
-
* />
|
|
49
|
-
*
|
|
50
|
-
* // With label, validation, and searchable
|
|
51
|
-
* <MultiSelect
|
|
52
|
-
* name="skills"
|
|
53
|
-
* label="Skills"
|
|
54
|
-
* showAsterisk
|
|
55
|
-
* isSearchable
|
|
56
|
-
* options={skillOptions}
|
|
57
|
-
* errorMessage={errors.skills}
|
|
58
|
-
* />
|
|
59
|
-
*
|
|
60
|
-
* // Controlled with async search
|
|
61
|
-
* <MultiSelect
|
|
62
|
-
* name="tags"
|
|
63
|
-
* label="Tags"
|
|
64
|
-
* value={selectedTags}
|
|
65
|
-
* onChange={setSelectedTags}
|
|
66
|
-
* onSearch={fetchTagOptions}
|
|
67
|
-
* isLoading={isLoadingTags}
|
|
68
|
-
* options={tagOptions}
|
|
69
|
-
* />
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
function MultiSelect(props) {
|
|
73
|
-
const { name, options, className: wrapperClassName = "", placeholder = "Selecione...", closeOnSelect = false, defaultValue = [], errorMessage: baseErrorMessage, isLoading = false, readOnly = false, isSearchable = false, id, label, optionMaxHeight, showAsterisk, leftIcon: LeftIcon, onSearch, onChange, onBlur, notFoundText = "Sem opções disponíveis", onFocus, disabled: baseDisabled = false, prefix, size = "md", value, variant = "solid", unShowFieldTemplate = false, orientation = "vertical", } = props;
|
|
74
|
-
const { fieldErrors } = useForm();
|
|
75
|
-
const multiSelectRef = useRef(null);
|
|
76
|
-
const multiSelectId = id || useId();
|
|
77
|
-
const errorMessage = baseErrorMessage || fieldErrors?.[name];
|
|
78
|
-
const isError = !!errorMessage;
|
|
79
|
-
const disabled = baseDisabled || isLoading || readOnly;
|
|
80
|
-
const iconSizes = { md: 20, lg: 20 };
|
|
81
|
-
const iconSize = iconSizes[size];
|
|
82
|
-
const [search, setSearch] = useState("");
|
|
83
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
84
|
-
const [selectedOptions, setSelectedOptions] = useState(defaultValue);
|
|
85
|
-
const forceSelectedOptions = value || selectedOptions;
|
|
86
|
-
function optionHasSelected(value) {
|
|
87
|
-
return forceSelectedOptions.includes(value);
|
|
88
|
-
}
|
|
89
|
-
function getOptionLabel(value) {
|
|
90
|
-
const option = options.find((option) => option.value === value);
|
|
91
|
-
return option?.label || "";
|
|
92
|
-
}
|
|
93
|
-
function handleContainerFocus() {
|
|
94
|
-
if (disabled || !multiSelectRef?.current || isFocused)
|
|
95
|
-
return;
|
|
96
|
-
setIsFocused(true);
|
|
97
|
-
multiSelectRef.current.focus();
|
|
98
|
-
onFocus && onFocus();
|
|
99
|
-
}
|
|
100
|
-
function handleBlur() {
|
|
101
|
-
setIsFocused(false);
|
|
102
|
-
if (onBlur && multiSelectRef.current)
|
|
103
|
-
multiSelectRef.current.blur();
|
|
104
|
-
}
|
|
105
|
-
function handleSearch(value) {
|
|
106
|
-
setSearch(value);
|
|
107
|
-
if (onSearch)
|
|
108
|
-
onSearch(value);
|
|
109
|
-
}
|
|
110
|
-
function handleChangeValue(value) {
|
|
111
|
-
if (optionHasSelected(value)) {
|
|
112
|
-
setSelectedOptions(selectedOptions.filter((v) => v !== value));
|
|
113
|
-
if (onChange)
|
|
114
|
-
onChange(selectedOptions.filter((v) => v !== value));
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
setSelectedOptions([...selectedOptions, value]);
|
|
118
|
-
if (onChange)
|
|
119
|
-
onChange([...selectedOptions, value]);
|
|
120
|
-
}
|
|
121
|
-
if (closeOnSelect)
|
|
122
|
-
handleBlur();
|
|
123
|
-
}
|
|
124
|
-
const mappedOptions = options.filter((option) => {
|
|
125
|
-
if (props.onSearch)
|
|
126
|
-
return true;
|
|
127
|
-
if (!props.isSearchable)
|
|
128
|
-
return true;
|
|
129
|
-
if (option.label.toLowerCase().includes(search.toLowerCase()))
|
|
130
|
-
return true;
|
|
131
|
-
return false;
|
|
132
|
-
});
|
|
133
|
-
return (_jsx(FieldTemplate, { name: name, label: label, showAsterisk: showAsterisk, className: wrapperClassName, errorMessage: errorMessage, unShowFieldTemplate: unShowFieldTemplate, orientation: orientation, children: _jsxs(MultiSelectContainer, { handleContainerFocus: handleContainerFocus, disabled: disabled, isError: isError, isFocused: isFocused, isLoading: isLoading, readOnly: readOnly, size: size, variant: variant, prefixExists: !!prefix, id: multiSelectId, children: [_jsx("input", { ref: multiSelectRef, name: name, value: JSON.stringify(forceSelectedOptions), type: "hidden" }), _jsx(IconRenderer, { iconSize: iconSize, icon: prefix, className: "prefix" }), LeftIcon && _jsx(LeftIcon, { size: iconSize, strokeWidth: 2.5 }), _jsxs(MultiSelectContent, { size: size, children: [forceSelectedOptions.map((value) => (_jsx(MultiSelectMark, { label: getOptionLabel(value), value: value, handleChangeValue: handleChangeValue, disabled: disabled }, value))), forceSelectedOptions.length <= 0 && _jsx("p", { children: placeholder })] }), _jsxs(MultiSelectOptionsContainer, { isFocused: isFocused, isSearchable: isSearchable, search: search, onSearch: handleSearch, children: [mappedOptions.map(({ label, value }) => (_jsx(MultiSelectOption, { label: label, value: value, size: size, handleChangeValue: handleChangeValue, optionHasSelected: optionHasSelected }, value))), mappedOptions.length <= 0 && _jsx("p", { children: notFoundText })] }), _jsx(MultiSelectChevron, { disabled: disabled, isFocused: isFocused, readOnly: readOnly, iconSize: iconSize, isLoading: isLoading }), _jsx(MultiSelectSpinner, { iconSize: iconSize, isLoading: isLoading }), _jsx(MultiSelectOverlay, { handleBlur: handleBlur, isFocused: isFocused })] }) }));
|
|
134
|
-
}
|
|
135
|
-
export { MultiSelect };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronDown } from "lucide-react";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
function MultiSelectChevron(props) {
|
|
5
|
-
const { iconSize, isLoading, disabled, readOnly, isFocused } = props;
|
|
6
|
-
const notAnimate = disabled || readOnly ? "notAnimate" : "";
|
|
7
|
-
const focused = isFocused ? "focused" : "";
|
|
8
|
-
const className = `arkynMultiSelectChevron ${notAnimate} ${focused}`;
|
|
9
|
-
if (isLoading)
|
|
10
|
-
return _jsx(_Fragment, {});
|
|
11
|
-
return (_jsx(ChevronDown, { className: className, strokeWidth: 2.5, style: {
|
|
12
|
-
minWidth: iconSize,
|
|
13
|
-
minHeight: iconSize,
|
|
14
|
-
maxWidth: iconSize,
|
|
15
|
-
maxHeight: iconSize,
|
|
16
|
-
} }));
|
|
17
|
-
}
|
|
18
|
-
export { MultiSelectChevron };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
function MultiSelectContainer(props) {
|
|
4
|
-
const { children, handleContainerFocus, disabled, isError, isLoading, isFocused, className, readOnly, variant, size, id, prefixExists, } = props;
|
|
5
|
-
const hasPrefix = prefixExists ? "hasPrefix" : "";
|
|
6
|
-
const errored = isError ? "errored" : "";
|
|
7
|
-
const opacity = disabled || readOnly || isLoading ? "opacity" : "";
|
|
8
|
-
const focused = isFocused ? "focused" : "";
|
|
9
|
-
return (_jsx("section", { id: id, className: `arkynMultiSelectContainer ${hasPrefix} ${variant} ${size} ${opacity} ${errored} ${focused} ${className}`, onClick: handleContainerFocus, children: children }));
|
|
10
|
-
}
|
|
11
|
-
export { MultiSelectContainer };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
function MultiSelectContent(props) {
|
|
4
|
-
const { children, size } = props;
|
|
5
|
-
const className = `arkynMultiSelectContent ${size}`;
|
|
6
|
-
return _jsx("div", { className: className, children: children });
|
|
7
|
-
}
|
|
8
|
-
export { MultiSelectContent };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { X } from "lucide-react";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
function MultiSelectMark(props) {
|
|
5
|
-
const { label, value, disabled, handleChangeValue } = props;
|
|
6
|
-
return (_jsxs("div", { className: "arkynMultiSelectMark", children: [label, _jsx("button", { disabled: disabled, type: "button", onClick: (e) => {
|
|
7
|
-
e.stopPropagation();
|
|
8
|
-
handleChangeValue(value);
|
|
9
|
-
}, children: _jsx(X, {}) })] }));
|
|
10
|
-
}
|
|
11
|
-
export { MultiSelectMark };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Check } from "lucide-react";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
function MultiSelectOption(props) {
|
|
5
|
-
const { label, optionHasSelected, handleChangeValue, value, size } = props;
|
|
6
|
-
const hasActive = optionHasSelected(value) ? "active" : "";
|
|
7
|
-
const className = `arkynMultiSelectOption ${size} ${hasActive}`;
|
|
8
|
-
return (_jsxs("div", { onClick: () => handleChangeValue(value), className: className, children: [label, " ", _jsx(Check, {})] }));
|
|
9
|
-
}
|
|
10
|
-
export { MultiSelectOption };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Search } from "lucide-react";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import { useScrollLock } from "../../../hooks/useScrollLock";
|
|
5
|
-
import { Input } from "../../input";
|
|
6
|
-
import "./styles.css";
|
|
7
|
-
function MultiSelectOptionsContainer(props) {
|
|
8
|
-
const { children, isFocused, isSearchable, search, onSearch } = props;
|
|
9
|
-
const containerRef = useRef(null);
|
|
10
|
-
const [position, setPosition] = useState("bottom");
|
|
11
|
-
useScrollLock(isFocused);
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (!isFocused)
|
|
14
|
-
return;
|
|
15
|
-
const checkContainerPosition = () => {
|
|
16
|
-
if (!containerRef.current)
|
|
17
|
-
return;
|
|
18
|
-
const parentElement = containerRef.current.parentElement;
|
|
19
|
-
if (!parentElement)
|
|
20
|
-
return;
|
|
21
|
-
const parentRect = parentElement.getBoundingClientRect();
|
|
22
|
-
const viewportHeight = window.innerHeight;
|
|
23
|
-
const estimatedContainerHeight = 300;
|
|
24
|
-
const spaceBelow = viewportHeight - parentRect.bottom;
|
|
25
|
-
if (spaceBelow < estimatedContainerHeight &&
|
|
26
|
-
parentRect.top > estimatedContainerHeight) {
|
|
27
|
-
setPosition("top");
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
setPosition("bottom");
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
checkContainerPosition();
|
|
34
|
-
}, [isFocused]);
|
|
35
|
-
function handleSearch(e) {
|
|
36
|
-
if (!isSearchable)
|
|
37
|
-
return;
|
|
38
|
-
onSearch(e.target.value);
|
|
39
|
-
}
|
|
40
|
-
if (!isFocused)
|
|
41
|
-
return _jsx(_Fragment, {});
|
|
42
|
-
return (_jsxs("div", { ref: containerRef, className: `arkynMultiSelectOptionsContainer ${position}`, children: [isSearchable && (_jsx(Input, { type: "search", name: "search-select", variant: "underline", leftIcon: Search, value: search, onChange: handleSearch })), children] }));
|
|
43
|
-
}
|
|
44
|
-
export { MultiSelectOptionsContainer };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
function MultiSelectOverlay(props) {
|
|
4
|
-
const { isFocused, handleBlur } = props;
|
|
5
|
-
if (!isFocused)
|
|
6
|
-
return _jsx(_Fragment, {});
|
|
7
|
-
return _jsx("aside", { className: "arkynMultiSelectOverlay", onClick: handleBlur });
|
|
8
|
-
}
|
|
9
|
-
export { MultiSelectOverlay };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loader2 } from "lucide-react";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
function MultiSelectSpinner(props) {
|
|
5
|
-
const { iconSize, isLoading } = props;
|
|
6
|
-
if (!isLoading)
|
|
7
|
-
return _jsx(_Fragment, {});
|
|
8
|
-
return (_jsx(Loader2, { className: "arkynMultiSelectSpinner", size: iconSize, strokeWidth: 2.5 }));
|
|
9
|
-
}
|
|
10
|
-
export { MultiSelectSpinner };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
function ChevronButton(props) {
|
|
5
|
-
const { orientation, handlePageChange, disabled } = props;
|
|
6
|
-
const icon = { left: _jsx(ChevronLeft, {}), right: _jsx(ChevronRight, {}) };
|
|
7
|
-
return (_jsx("button", { className: "arkynChevronPageButton", disabled: disabled, onClick: handlePageChange, children: icon[orientation] }));
|
|
8
|
-
}
|
|
9
|
-
export { ChevronButton };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronButton } from "./chevronButton";
|
|
3
|
-
import { CurrentButton } from "./currentButton";
|
|
4
|
-
import { PageButton } from "./pageButton";
|
|
5
|
-
import { PaginationService } from "./paginationService";
|
|
6
|
-
import { Spread } from "./spread";
|
|
7
|
-
import "./styles.css";
|
|
8
|
-
/**
|
|
9
|
-
* Pagination — navigation control for paginated data sets.
|
|
10
|
-
*
|
|
11
|
-
* Renders page number buttons, prev/next arrows, and spread indicators (…)
|
|
12
|
-
* when the page count exceeds the visible range.
|
|
13
|
-
*
|
|
14
|
-
* @param props.totalCountRegisters - Total number of records. Required.
|
|
15
|
-
* @param props.currentPage - The currently active page (1-indexed). Required.
|
|
16
|
-
* @param props.registerPerPage - Records per page. Default: 10
|
|
17
|
-
* @param props.siblingsCount - Number of sibling pages visible on each side of the current page. Default: 1
|
|
18
|
-
* @param props.onChange - Callback fired when the user selects a different page.
|
|
19
|
-
*
|
|
20
|
-
* **...Other valid HTML properties for `<div>`**
|
|
21
|
-
*
|
|
22
|
-
* @returns Pagination JSX element.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* <Pagination
|
|
27
|
-
* totalCountRegisters={250}
|
|
28
|
-
* currentPage={page}
|
|
29
|
-
* registerPerPage={20}
|
|
30
|
-
* siblingsCount={1}
|
|
31
|
-
* onChange={(p) => setPage(p)}
|
|
32
|
-
* />
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
function Pagination(props) {
|
|
36
|
-
const { totalCountRegisters: baseTotalCountRegisters, siblingsCount: baseSiblingsCount, currentPage: baseCurrentPage, registerPerPage: baseRegisterPerPage, onChange: baseOnChange, ...rest } = props;
|
|
37
|
-
const { currentPage, siblingsCount, previousPages, nextPages, lastPage, handlePageChange, handleMinusChange, handlePlusChange, } = new PaginationService({
|
|
38
|
-
totalCountRegisters: baseTotalCountRegisters,
|
|
39
|
-
currentPage: baseCurrentPage,
|
|
40
|
-
registerPerPage: baseRegisterPerPage,
|
|
41
|
-
siblingsCount: baseSiblingsCount,
|
|
42
|
-
onChange: baseOnChange,
|
|
43
|
-
});
|
|
44
|
-
return (_jsxs("div", { className: "arkynPagination", ...rest, children: [_jsx(ChevronButton, { orientation: "left", handlePageChange: handleMinusChange, disabled: currentPage <= 1 }), currentPage > 1 + siblingsCount && (_jsxs(_Fragment, { children: [_jsx(PageButton, { page: 1, handlePageChange: () => handlePageChange(1) }), currentPage > 2 + siblingsCount && _jsx(Spread, {})] })), previousPages.map((page, index) => (_jsx(PageButton, { page: page, handlePageChange: handleMinusChange }, index))), _jsx(CurrentButton, { currentPage: currentPage }), nextPages.map((page, index) => (_jsx(PageButton, { page: page, handlePageChange: handlePlusChange }, index))), currentPage + siblingsCount < lastPage && (_jsxs(_Fragment, { children: [currentPage + 1 + siblingsCount < lastPage && _jsx(Spread, {}), _jsx(PageButton, { page: lastPage, handlePageChange: () => handlePageChange(lastPage) })] })), _jsx(ChevronButton, { orientation: "right", handlePageChange: handlePlusChange, disabled: currentPage >= lastPage })] }));
|
|
45
|
-
}
|
|
46
|
-
export { Pagination };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
function PageButton(props) {
|
|
4
|
-
const { page, handlePageChange } = props;
|
|
5
|
-
return (_jsx("button", { className: "arkynPaginationPageButton", onClick: handlePageChange, children: page }));
|
|
6
|
-
}
|
|
7
|
-
export { PageButton };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
class PaginationService {
|
|
2
|
-
currentPage;
|
|
3
|
-
totalCountRegisters;
|
|
4
|
-
registerPerPage;
|
|
5
|
-
siblingsCount;
|
|
6
|
-
lastPage;
|
|
7
|
-
onChange;
|
|
8
|
-
previousPages;
|
|
9
|
-
nextPages;
|
|
10
|
-
generatePagesArray(from, to) {
|
|
11
|
-
return [...new Array(to - from)]
|
|
12
|
-
.map((_, index) => from + index + 1)
|
|
13
|
-
.filter((page) => page > 0);
|
|
14
|
-
}
|
|
15
|
-
generatePreviousPages(currentPage, siblingsCount) {
|
|
16
|
-
if (!(currentPage > 1))
|
|
17
|
-
return [];
|
|
18
|
-
return this.generatePagesArray(currentPage - 1 - siblingsCount, currentPage - 1);
|
|
19
|
-
}
|
|
20
|
-
generateNextPages(currentPage, siblingsCount) {
|
|
21
|
-
if (!(currentPage < this.lastPage))
|
|
22
|
-
return [];
|
|
23
|
-
return this.generatePagesArray(currentPage, Math.min(currentPage + siblingsCount, this.lastPage));
|
|
24
|
-
}
|
|
25
|
-
constructor(props) {
|
|
26
|
-
this.totalCountRegisters = props.totalCountRegisters;
|
|
27
|
-
this.currentPage = props.currentPage;
|
|
28
|
-
this.registerPerPage = props?.registerPerPage || 20;
|
|
29
|
-
this.siblingsCount = props?.siblingsCount || 2;
|
|
30
|
-
this.lastPage = Math.ceil(this.totalCountRegisters / this.registerPerPage);
|
|
31
|
-
this.onChange = props?.onChange;
|
|
32
|
-
this.previousPages = this.generatePreviousPages(this.currentPage, this.siblingsCount);
|
|
33
|
-
this.nextPages = this.generateNextPages(this.currentPage, this.siblingsCount);
|
|
34
|
-
}
|
|
35
|
-
handlePageChange = (page) => {
|
|
36
|
-
if (page < 1)
|
|
37
|
-
return;
|
|
38
|
-
if (page > this.lastPage)
|
|
39
|
-
return;
|
|
40
|
-
if (this.onChange) {
|
|
41
|
-
this.currentPage = page;
|
|
42
|
-
this.onChange(this.currentPage);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
handlePlusChange = () => {
|
|
46
|
-
if (this.currentPage >= this.lastPage)
|
|
47
|
-
return;
|
|
48
|
-
if (this.onChange) {
|
|
49
|
-
this.currentPage += 1;
|
|
50
|
-
this.onChange(this.currentPage);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
handleMinusChange = () => {
|
|
54
|
-
if (this.currentPage <= 1)
|
|
55
|
-
return;
|
|
56
|
-
if (this.onChange) {
|
|
57
|
-
this.currentPage -= 1;
|
|
58
|
-
this.onChange(this.currentPage);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export { PaginationService };
|