@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,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTab } from "../tabContext";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
/**
|
|
5
|
-
* TabButton — individual tab button inside a `TabContainer`.
|
|
6
|
-
*
|
|
7
|
-
* Reads active state and disabled state from `TabContainer` context.
|
|
8
|
-
* The button's own `disabled` prop is ORed with the container's `disabled`.
|
|
9
|
-
*
|
|
10
|
-
* @param props.children - Tab label content. Required.
|
|
11
|
-
* @param props.value - Tab identifier. Required.
|
|
12
|
-
* @param props.disabled - Disables this tab individually (container can also disable all tabs).
|
|
13
|
-
*
|
|
14
|
-
* **...Other valid HTML `<button>` properties except `type`**
|
|
15
|
-
*
|
|
16
|
-
* @returns TabButton JSX element.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <TabContainer defaultValue="overview" onChange={setTab}>
|
|
21
|
-
* <TabButton value="overview">Overview</TabButton>
|
|
22
|
-
* <TabButton value="activity">Activity</TabButton>
|
|
23
|
-
* <TabButton value="settings" disabled>Settings</TabButton>
|
|
24
|
-
* </TabContainer>
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
function TabButton(props) {
|
|
28
|
-
const { children, disabled: rawDisabled = false, className: baseClassName = "", onClick, value, ...rest } = props;
|
|
29
|
-
const { disabled, currentTab, changeCurrentTab } = useTab();
|
|
30
|
-
const isDisabled = disabled || rawDisabled;
|
|
31
|
-
const disabledClass = isDisabled ? "isDisabled" : "";
|
|
32
|
-
const activeClass = currentTab === value && value ? "isActive" : "";
|
|
33
|
-
const className = `arkynTabButton ${disabledClass} ${activeClass} ${baseClassName}`;
|
|
34
|
-
function handleClick(event) {
|
|
35
|
-
changeCurrentTab(value);
|
|
36
|
-
onClick && onClick(event);
|
|
37
|
-
}
|
|
38
|
-
return (_jsx("button", { onClick: handleClick, className: className.trim(), ...rest, disabled: isDisabled, type: "button", children: children }));
|
|
39
|
-
}
|
|
40
|
-
export { TabButton };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { TabProvider } from "../tabContext";
|
|
4
|
-
import "./styles.css";
|
|
5
|
-
/**
|
|
6
|
-
* TabContainer — wrapper that manages active state for a group of `TabButton` components.
|
|
7
|
-
*
|
|
8
|
-
* Renders as a `<nav>` element. Provides context consumed by each `TabButton`.
|
|
9
|
-
*
|
|
10
|
-
* @param props.children - `TabButton` elements. Required.
|
|
11
|
-
* @param props.defaultValue - Initially selected tab value.
|
|
12
|
-
* @param props.disabled - Disables all buttons. Default: false
|
|
13
|
-
* @param props.onChange - Called with the new value whenever the active tab changes.
|
|
14
|
-
*
|
|
15
|
-
* **...Other valid HTML `<nav>` properties**
|
|
16
|
-
*
|
|
17
|
-
* @returns TabContainer JSX element.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* <TabContainer defaultValue="overview" onChange={setActiveTab}>
|
|
22
|
-
* <TabButton value="overview">Overview</TabButton>
|
|
23
|
-
* <TabButton value="analytics">Analytics</TabButton>
|
|
24
|
-
* <TabButton value="settings">Settings</TabButton>
|
|
25
|
-
* </TabContainer>
|
|
26
|
-
*
|
|
27
|
-
* {activeTab === 'overview' && <OverviewPanel />}
|
|
28
|
-
* {activeTab === 'analytics' && <AnalyticsPanel />}
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
function TabContainer(props) {
|
|
32
|
-
const { children, onChange, defaultValue, disabled = false, className: baseClassName, ...rest } = props;
|
|
33
|
-
const [currentTab, setCurrentTab] = useState(defaultValue || "");
|
|
34
|
-
const className = `arkynTabContainer ${baseClassName || ""}`;
|
|
35
|
-
function changeCurrentTab(value) {
|
|
36
|
-
setCurrentTab(value);
|
|
37
|
-
if (onChange)
|
|
38
|
-
onChange(value);
|
|
39
|
-
}
|
|
40
|
-
return (_jsx(TabProvider, { disabled: disabled, currentTab: currentTab, changeCurrentTab: changeCurrentTab, children: _jsx("nav", { className: className.trim(), ...rest, children: children }) }));
|
|
41
|
-
}
|
|
42
|
-
export { TabContainer };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
const TabContext = createContext({});
|
|
4
|
-
function useTab() {
|
|
5
|
-
return useContext(TabContext);
|
|
6
|
-
}
|
|
7
|
-
function TabProvider(props) {
|
|
8
|
-
return (_jsx(TabContext.Provider, { value: props, children: props.children }));
|
|
9
|
-
}
|
|
10
|
-
export { TabProvider, useTab };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Children } from "react";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
/**
|
|
5
|
-
* TableBody — `<tbody>` section with built-in empty state handling.
|
|
6
|
-
*
|
|
7
|
-
* When `children` is empty, renders a full-width row with `emptyMessage`.
|
|
8
|
-
* Accepts all standard HTML `<tbody>` attributes.
|
|
9
|
-
*
|
|
10
|
-
* @param props.emptyMessage - Empty state text. Default: `"Nenhum dado adicionado."`
|
|
11
|
-
*
|
|
12
|
-
* **...Other valid HTML `<tbody>` properties**
|
|
13
|
-
*
|
|
14
|
-
* @returns TableBody JSX element.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* <TableBody emptyMessage="No orders found">
|
|
19
|
-
* {orders.map(o => (
|
|
20
|
-
* <tr key={o.id}>
|
|
21
|
-
* <td>{o.number}</td>
|
|
22
|
-
* <td>{o.status}</td>
|
|
23
|
-
* </tr>
|
|
24
|
-
* ))}
|
|
25
|
-
* </TableBody>
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
function TableBody(props) {
|
|
29
|
-
const { emptyMessage = "Nenhum dado adicionado.", className: baseClassName, children, ...rest } = props;
|
|
30
|
-
const className = `arkynTableBody ${baseClassName}`;
|
|
31
|
-
const isEmpty = Children.count(children) === 0;
|
|
32
|
-
return (_jsx("tbody", { className: className.trim(), ...rest, children: isEmpty ? (_jsx("tr", { className: "arkynTableBodyEmptyLine", children: _jsx("td", { colSpan: 100, children: _jsx("div", { children: emptyMessage }) }) })) : (children) }));
|
|
33
|
-
}
|
|
34
|
-
export { TableBody };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
/**
|
|
4
|
-
* TableCaption — title / description placed above a table. Renders as a `<caption>` element.
|
|
5
|
-
*
|
|
6
|
-
* Accepts all standard HTML element attributes.
|
|
7
|
-
*
|
|
8
|
-
* @returns TableCaption JSX element.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <TableContainer>
|
|
13
|
-
* <TableCaption>Orders — Q2 2025</TableCaption>
|
|
14
|
-
* <TableHeader>...</TableHeader>
|
|
15
|
-
* <TableBody>...</TableBody>
|
|
16
|
-
* </TableContainer>
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
function TableCaption(props) {
|
|
20
|
-
const { className: baseClassName, children, ...rest } = props;
|
|
21
|
-
const className = `arkynTableCaption ${baseClassName}`;
|
|
22
|
-
return (_jsx("caption", { className: className.trim(), ...rest, children: _jsx("div", { className: "arkynTableCaptionContent", children: children }) }));
|
|
23
|
-
}
|
|
24
|
-
export { TableCaption };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
/**
|
|
4
|
-
* TableContainer — root wrapper for the Table component set. Renders a responsive scrollable container around a `<table>`.
|
|
5
|
-
*
|
|
6
|
-
* Accepts all standard HTML `<table>` attributes.
|
|
7
|
-
*
|
|
8
|
-
* @returns TableContainer JSX element.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <TableContainer>
|
|
13
|
-
* <TableCaption>Users</TableCaption>
|
|
14
|
-
* <TableHeader>
|
|
15
|
-
* <th>Name</th>
|
|
16
|
-
* <th>Email</th>
|
|
17
|
-
* <th>Status</th>
|
|
18
|
-
* </TableHeader>
|
|
19
|
-
* <TableBody emptyMessage="No users found">
|
|
20
|
-
* {users.map(u => (
|
|
21
|
-
* <tr key={u.id}>
|
|
22
|
-
* <td>{u.name}</td>
|
|
23
|
-
* <td>{u.email}</td>
|
|
24
|
-
* <td>{u.status}</td>
|
|
25
|
-
* </tr>
|
|
26
|
-
* ))}
|
|
27
|
-
* </TableBody>
|
|
28
|
-
* <TableFooter><Pagination /></TableFooter>
|
|
29
|
-
* </TableContainer>
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
function TableContainer(props) {
|
|
33
|
-
const { children, className: baseClassName, ...rest } = props;
|
|
34
|
-
const className = `arkynTableContainer ${baseClassName}`;
|
|
35
|
-
return (_jsx("div", { className: className.trim(), ...rest, children: _jsx("table", { children: children }) }));
|
|
36
|
-
}
|
|
37
|
-
export { TableContainer };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
/**
|
|
4
|
-
* TableFooter — `<tfoot>` section with an automatic spacing row above the content.
|
|
5
|
-
*
|
|
6
|
-
* Children span all columns via `colSpan={100}`. Commonly used for `Pagination`.
|
|
7
|
-
* Accepts all standard HTML `<tfoot>` attributes.
|
|
8
|
-
*
|
|
9
|
-
* @returns TableFooter JSX element.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* <TableFooter>
|
|
14
|
-
* <Pagination currentPage={page} totalPages={totalPages} onChange={setPage} />
|
|
15
|
-
* </TableFooter>
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
function TableFooter(props) {
|
|
19
|
-
const { className: baseClassName, children, ...rest } = props;
|
|
20
|
-
const className = `arkynTableFooter ${baseClassName}`;
|
|
21
|
-
return (_jsxs("tfoot", { className: className.trim(), ...rest, children: [_jsx("tr", { className: "spacingRow" }), _jsx("tr", { children: _jsx("th", { colSpan: 100, children: _jsx("div", { className: "arkynTableFooterContent", children: children }) }) })] }));
|
|
22
|
-
}
|
|
23
|
-
export { TableFooter };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "./styles.css";
|
|
3
|
-
/**
|
|
4
|
-
* TableHeader — `<thead>` section with an automatic spacing row below the header row.
|
|
5
|
-
*
|
|
6
|
-
* Pass `<th>` elements as children — they are wrapped in a `<tr>` automatically.
|
|
7
|
-
* Accepts all standard HTML `<thead>` attributes.
|
|
8
|
-
*
|
|
9
|
-
* @returns TableHeader JSX element.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* <TableHeader>
|
|
14
|
-
* <th>Name</th>
|
|
15
|
-
* <th>Email</th>
|
|
16
|
-
* <th>Actions</th>
|
|
17
|
-
* </TableHeader>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
function TableHeader(props) {
|
|
21
|
-
const { className: baseClassName, children, ...rest } = props;
|
|
22
|
-
const className = `arkynTableHeader ${baseClassName}`;
|
|
23
|
-
return (_jsxs("thead", { className: className.trim(), ...rest, children: [_jsx("tr", { children: children }), _jsx("tr", { className: "spacingRow" })] }));
|
|
24
|
-
}
|
|
25
|
-
export { TableHeader };
|
|
@@ -1,80 +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 { FieldLabel } from "../fieldLabel";
|
|
5
|
-
import { FieldWrapper } from "../fieldWrapper";
|
|
6
|
-
import { FieldError } from "../fieldError";
|
|
7
|
-
import "./styles.css";
|
|
8
|
-
/**
|
|
9
|
-
* Textarea — multi-line text input with label, validation, and form integration.
|
|
10
|
-
*
|
|
11
|
-
* Integrates with `useForm` to display validation errors by field name.
|
|
12
|
-
*
|
|
13
|
-
* @param props.name - Field name for form submission. Required.
|
|
14
|
-
* @param props.label - Label text displayed above the textarea.
|
|
15
|
-
* @param props.showAsterisk - Appends `*` to the label.
|
|
16
|
-
* @param props.errorMessage - Validation error message.
|
|
17
|
-
* @param props.size - Textarea size (`md` | `lg`). Default: "md"
|
|
18
|
-
* @param props.variant - Visual style variant. Default: "solid"
|
|
19
|
-
*
|
|
20
|
-
* **...Other valid HTML properties for `<textarea>`**
|
|
21
|
-
*
|
|
22
|
-
* @returns Textarea JSX element wrapped in `FieldWrapper`.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* // Basic
|
|
27
|
-
* <Textarea name="description" placeholder="Enter description..." />
|
|
28
|
-
*
|
|
29
|
-
* // With label and validation
|
|
30
|
-
* <Textarea
|
|
31
|
-
* name="bio"
|
|
32
|
-
* label="Biography"
|
|
33
|
-
* showAsterisk
|
|
34
|
-
* placeholder="Tell us about yourself"
|
|
35
|
-
* errorMessage="Biography is required"
|
|
36
|
-
* />
|
|
37
|
-
*
|
|
38
|
-
* // Controlled with custom rows
|
|
39
|
-
* <Textarea
|
|
40
|
-
* name="message"
|
|
41
|
-
* label="Message"
|
|
42
|
-
* value={message}
|
|
43
|
-
* onChange={(e) => setMessage(e.target.value)}
|
|
44
|
-
* rows={5}
|
|
45
|
-
* size="lg"
|
|
46
|
-
* variant="outline"
|
|
47
|
-
* />
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
function Textarea(props) {
|
|
51
|
-
const { variant = "solid", size = "md", className: wrapperClassName, errorMessage: baseErrorMessage, disabled = false, readOnly = false, label, showAsterisk, name, onFocus, onBlur, title, style, value, defaultValue, placeholder, id, ...rest } = props;
|
|
52
|
-
const { fieldErrors } = useForm();
|
|
53
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
54
|
-
const textareaRef = useRef(null);
|
|
55
|
-
const textareaId = id || useId();
|
|
56
|
-
const errorMessage = baseErrorMessage || fieldErrors?.[name];
|
|
57
|
-
const isError = !!errorMessage;
|
|
58
|
-
const errorClass = isError ? "errorTrue" : "errorFalse";
|
|
59
|
-
const opacityClass = disabled || readOnly ? "opacityTrue" : "opacityFalse";
|
|
60
|
-
const focusedClass = isFocused ? "focusedTrue" : "focusedFalse";
|
|
61
|
-
const className = `arkynTextarea ${variant} ${size} ${opacityClass} ${errorClass} ${focusedClass}`;
|
|
62
|
-
function handleSectionClick() {
|
|
63
|
-
if (disabled || !textareaRef?.current)
|
|
64
|
-
return;
|
|
65
|
-
setIsFocused(true);
|
|
66
|
-
textareaRef.current.focus();
|
|
67
|
-
}
|
|
68
|
-
function handleFocus(e) {
|
|
69
|
-
setIsFocused(true);
|
|
70
|
-
if (onFocus)
|
|
71
|
-
onFocus(e);
|
|
72
|
-
}
|
|
73
|
-
function handleBlur(e) {
|
|
74
|
-
setIsFocused(false);
|
|
75
|
-
if (onBlur)
|
|
76
|
-
onBlur(e);
|
|
77
|
-
}
|
|
78
|
-
return (_jsxs(FieldWrapper, { className: wrapperClassName, children: [label && (_jsx(FieldLabel, { htmlFor: textareaId, showAsterisk: showAsterisk, children: label })), _jsx("section", { title: title, style: style, onClick: handleSectionClick, className: className, children: _jsx("textarea", { id: textareaId, disabled: disabled, readOnly: readOnly, ref: textareaRef, name: name, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue || "", placeholder: disabled ? value || placeholder : placeholder, value: disabled ? undefined : value, ...rest }) }), errorMessage && _jsx(FieldError, { children: errorMessage })] }));
|
|
79
|
-
}
|
|
80
|
-
export { Textarea };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId, useRef, useState, } from "react";
|
|
3
|
-
import "./styles.css";
|
|
4
|
-
/**
|
|
5
|
-
* Tooltip — shows a contextual text bubble on hover with smart viewport-aware positioning.
|
|
6
|
-
*
|
|
7
|
-
* The tooltip automatically flips to the opposite side when it would overflow the viewport.
|
|
8
|
-
*
|
|
9
|
-
* @param props.text - Text (or HTML) to display in the tooltip. Required.
|
|
10
|
-
* @param props.children - Trigger element. Required.
|
|
11
|
-
* @param props.orientation - Preferred position relative to the trigger. Default: "top"
|
|
12
|
-
* @param props.size - Tooltip size. Default: "lg"
|
|
13
|
-
*
|
|
14
|
-
* **...Other valid HTML properties for `<div>`**
|
|
15
|
-
*
|
|
16
|
-
* @returns Tooltip JSX element.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* <Tooltip text="Save changes before leaving">
|
|
21
|
-
* <IconButton icon={SaveIcon} aria-label="Save" />
|
|
22
|
-
* </Tooltip>
|
|
23
|
-
*
|
|
24
|
-
* // Toolbar with bottom-oriented tooltips
|
|
25
|
-
* <Tooltip text="Add item" orientation="bottom">
|
|
26
|
-
* <IconButton icon={Plus} aria-label="Add" />
|
|
27
|
-
* </Tooltip>
|
|
28
|
-
*
|
|
29
|
-
* <Tooltip text="Delete" orientation="bottom" size="md">
|
|
30
|
-
* <IconButton icon={Trash2} aria-label="Delete" scheme="danger" />
|
|
31
|
-
* </Tooltip>
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
function Tooltip(props) {
|
|
35
|
-
const { text, size = "lg", children, orientation = "top", className: baseClassName = "", ...rest } = props;
|
|
36
|
-
const tooltipId = useId();
|
|
37
|
-
const tooltipRef = useRef(null);
|
|
38
|
-
const [adjustedOrientation, setAdjustedOrientation] = useState(orientation);
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
const checkTooltipPosition = () => {
|
|
41
|
-
if (!tooltipRef.current)
|
|
42
|
-
return;
|
|
43
|
-
const tooltipText = document.getElementById(tooltipId);
|
|
44
|
-
if (!tooltipText)
|
|
45
|
-
return;
|
|
46
|
-
setAdjustedOrientation(orientation);
|
|
47
|
-
requestAnimationFrame(() => {
|
|
48
|
-
const rect = tooltipText.getBoundingClientRect();
|
|
49
|
-
const viewportWidth = window.innerWidth;
|
|
50
|
-
const viewportHeight = window.innerHeight;
|
|
51
|
-
let newOrientation = orientation;
|
|
52
|
-
if (orientation === "left" && rect.left < 0) {
|
|
53
|
-
newOrientation = "right";
|
|
54
|
-
}
|
|
55
|
-
else if (orientation === "right" && rect.right > viewportWidth) {
|
|
56
|
-
newOrientation = "left";
|
|
57
|
-
}
|
|
58
|
-
else if (orientation === "top" && rect.top < 0) {
|
|
59
|
-
newOrientation = "bottom";
|
|
60
|
-
}
|
|
61
|
-
else if (orientation === "bottom" && rect.bottom > viewportHeight) {
|
|
62
|
-
newOrientation = "top";
|
|
63
|
-
}
|
|
64
|
-
if (newOrientation === "right" && rect.right > viewportWidth) {
|
|
65
|
-
newOrientation = "left";
|
|
66
|
-
}
|
|
67
|
-
else if (newOrientation === "left" && rect.left < 0) {
|
|
68
|
-
newOrientation = "right";
|
|
69
|
-
}
|
|
70
|
-
else if (newOrientation === "bottom" &&
|
|
71
|
-
rect.bottom > viewportHeight) {
|
|
72
|
-
newOrientation = "top";
|
|
73
|
-
}
|
|
74
|
-
else if (newOrientation === "top" && rect.top < 0) {
|
|
75
|
-
newOrientation = "bottom";
|
|
76
|
-
}
|
|
77
|
-
setAdjustedOrientation(newOrientation);
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
const tooltip = tooltipRef.current;
|
|
81
|
-
if (!tooltip)
|
|
82
|
-
return;
|
|
83
|
-
const handleMouseEnter = () => {
|
|
84
|
-
setTimeout(checkTooltipPosition, 1);
|
|
85
|
-
};
|
|
86
|
-
tooltip.addEventListener("mouseenter", handleMouseEnter);
|
|
87
|
-
window.addEventListener("resize", checkTooltipPosition);
|
|
88
|
-
return () => {
|
|
89
|
-
tooltip.removeEventListener("mouseenter", handleMouseEnter);
|
|
90
|
-
window.removeEventListener("resize", checkTooltipPosition);
|
|
91
|
-
};
|
|
92
|
-
}, [orientation, tooltipId]);
|
|
93
|
-
const className = `arkynTooltip ${size} ${adjustedOrientation} ${baseClassName}`;
|
|
94
|
-
return (_jsxs("div", { className: className.trim(), ...rest, ref: tooltipRef, children: [children, _jsx("div", { className: "arkynTooltipText", id: tooltipId, dangerouslySetInnerHTML: { __html: text } })] }));
|
|
95
|
-
}
|
|
96
|
-
export { Tooltip };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { scroller } from "react-scroll";
|
|
3
|
-
import { useModal } from "./useModal";
|
|
4
|
-
import { useToast } from "./useToast";
|
|
5
|
-
import { badResponses } from "../templates/badResponses";
|
|
6
|
-
import { successResponses } from "../templates/successResponses";
|
|
7
|
-
/**
|
|
8
|
-
* useAutomation — runs UI side-effects (close modals, scroll, toast) in response to a server action payload.
|
|
9
|
-
*
|
|
10
|
-
* Pass the raw response from a form submission. On every change the hook:
|
|
11
|
-
* 1. Closes all open modals if `closeModal` is `true`.
|
|
12
|
-
* 2. Smooth-scrolls to a named element if `cause.data.scrollTo` is set.
|
|
13
|
-
* 3. Shows a toast based on `name` (matched against `successResponses`/`badResponses`) and `message`.
|
|
14
|
-
* When `cause.fieldErrors` is present, the first field error takes priority in the toast.
|
|
15
|
-
* The message `"Unprocessable entity"` is intentionally suppressed.
|
|
16
|
-
*
|
|
17
|
-
* @param formResponseData - Raw server response payload.
|
|
18
|
-
* @param formResponseData.closeModal - Closes all open modals when `true`.
|
|
19
|
-
* @param formResponseData.name - Response identifier matched against success/bad response lists.
|
|
20
|
-
* @param formResponseData.message - Text shown in the toast notification.
|
|
21
|
-
* @param formResponseData.cause.data.scrollTo - Element name to scroll to via `react-scroll`.
|
|
22
|
-
* @param formResponseData.cause.fieldErrors - Field-level errors; the first value is shown in the toast.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* // After a successful create action
|
|
27
|
-
* useAutomation({ closeModal: true, name: "created", message: "Saved successfully" });
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```tsx
|
|
32
|
-
* // Validation error with field-level feedback and scroll
|
|
33
|
-
* useAutomation({
|
|
34
|
-
* name: "validation_error",
|
|
35
|
-
* message: "Invalid payload",
|
|
36
|
-
* cause: {
|
|
37
|
-
* data: { scrollTo: "email" },
|
|
38
|
-
* fieldErrors: { email: "E-mail is required" },
|
|
39
|
-
* },
|
|
40
|
-
* });
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
function useAutomation(formResponseData) {
|
|
44
|
-
const { closeAll } = useModal();
|
|
45
|
-
const { showToast } = useToast();
|
|
46
|
-
const closeModal = formResponseData?.closeModal;
|
|
47
|
-
const message = formResponseData?.message;
|
|
48
|
-
const name = formResponseData?.name;
|
|
49
|
-
const scrollTo = formResponseData?.cause?.data?.scrollTo;
|
|
50
|
-
const firstErrorField = formResponseData?.cause?.fieldErrors
|
|
51
|
-
? Object.values(formResponseData?.cause?.fieldErrors)[0]
|
|
52
|
-
: null;
|
|
53
|
-
function fireToast() {
|
|
54
|
-
if (!message && !firstErrorField)
|
|
55
|
-
return;
|
|
56
|
-
if (successResponses.includes(name))
|
|
57
|
-
return showToast({ message, type: "success" });
|
|
58
|
-
if (!badResponses.includes(name))
|
|
59
|
-
return;
|
|
60
|
-
if (!!firstErrorField)
|
|
61
|
-
return showToast({ message: firstErrorField, type: "danger" });
|
|
62
|
-
if (message === "Unprocessable entity")
|
|
63
|
-
return;
|
|
64
|
-
return showToast({ message, type: "danger" });
|
|
65
|
-
}
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (closeModal)
|
|
68
|
-
closeAll();
|
|
69
|
-
if (scrollTo)
|
|
70
|
-
scroller.scrollTo(scrollTo, { smooth: true, offset: 20 });
|
|
71
|
-
fireToast();
|
|
72
|
-
}, [formResponseData]);
|
|
73
|
-
}
|
|
74
|
-
export { useAutomation };
|
package/dist/hooks/useDrawer.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { drawerContext } from "../providers/drawerProvider";
|
|
3
|
-
function useDrawer(key) {
|
|
4
|
-
const contextData = useContext(drawerContext);
|
|
5
|
-
if (Object.entries(contextData).length === 0) {
|
|
6
|
-
throw new Error("useDrawer must be used within a Provider");
|
|
7
|
-
}
|
|
8
|
-
if (key) {
|
|
9
|
-
const { drawerData: contextDrawerData, drawerIsOpen: contextDrawerIsOpen, openDrawer: contextOpenDrawer, closeDrawer: contextCloseDrawer, } = contextData;
|
|
10
|
-
const drawerIsOpen = contextDrawerIsOpen(key);
|
|
11
|
-
const drawerData = contextDrawerData(key);
|
|
12
|
-
const openDrawer = (data) => contextOpenDrawer(key, data);
|
|
13
|
-
const closeDrawer = () => contextCloseDrawer(key);
|
|
14
|
-
return { drawerIsOpen, drawerData, openDrawer, closeDrawer };
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return contextData;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export { useDrawer };
|
package/dist/hooks/useForm.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { formContext } from "../providers/formProvider";
|
|
3
|
-
/**
|
|
4
|
-
* useForm — reads the nearest `FormProvider` context to access field-level validation errors.
|
|
5
|
-
*
|
|
6
|
-
* All form inputs (`Input`, `Select`, `Checkbox`, etc.) call this hook internally,
|
|
7
|
-
* so you rarely need it directly. Use it when you want to read errors outside of
|
|
8
|
-
* an input component, or build a custom input.
|
|
9
|
-
*
|
|
10
|
-
* @returns Form context containing:
|
|
11
|
-
* - `fieldErrors` — `Record<string, string>` mapping field names to error messages.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* // Wrapping a form with FormProvider
|
|
16
|
-
* function App() {
|
|
17
|
-
* return (
|
|
18
|
-
* <FormProvider fieldErrors={{ email: "Invalid email" }}>
|
|
19
|
-
* <MyForm />
|
|
20
|
-
* </FormProvider>
|
|
21
|
-
* );
|
|
22
|
-
* }
|
|
23
|
-
*
|
|
24
|
-
* // Reading errors manually
|
|
25
|
-
* function CustomField() {
|
|
26
|
-
* const { fieldErrors } = useForm();
|
|
27
|
-
* return <span>{fieldErrors?.username}</span>;
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
function useForm() {
|
|
32
|
-
const context = useContext(formContext);
|
|
33
|
-
return context;
|
|
34
|
-
}
|
|
35
|
-
export { useForm };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore } from "react";
|
|
2
|
-
function subscribe() {
|
|
3
|
-
return () => { };
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* useHydrated — returns `true` once the component has hydrated on the client, `false` during SSR.
|
|
7
|
-
*
|
|
8
|
-
* Built on `useSyncExternalStore` so it is safe with React 18 concurrent rendering.
|
|
9
|
-
* Use this when you need to defer client-only rendering (e.g. browser APIs, `window`, `navigator`)
|
|
10
|
-
* without causing a hydration mismatch. For most cases, prefer the `ClientOnly` component.
|
|
11
|
-
*
|
|
12
|
-
* @returns `true` on the client after hydration; `false` on the server.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* function Map() {
|
|
17
|
-
* const isHydrated = useHydrated();
|
|
18
|
-
* if (!isHydrated) return <Skeleton />;
|
|
19
|
-
* return <MapView accessToken={token} coordinates={coords} />;
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
function useHydrated() {
|
|
24
|
-
return useSyncExternalStore(subscribe, () => true, () => false);
|
|
25
|
-
}
|
|
26
|
-
export { useHydrated };
|
package/dist/hooks/useModal.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { modalContext } from "../providers/modalProvider";
|
|
3
|
-
function useModal(key) {
|
|
4
|
-
const contextData = useContext(modalContext);
|
|
5
|
-
if (Object.entries(contextData).length === 0) {
|
|
6
|
-
throw new Error("useModal must be used within a Provider");
|
|
7
|
-
}
|
|
8
|
-
if (key) {
|
|
9
|
-
const { modalData: contextModalData, modalIsOpen: contextModalIsOpen, openModal: contextOpenModal, closeModal: contextCloseModal, } = contextData;
|
|
10
|
-
const modalIsOpen = contextModalIsOpen(key);
|
|
11
|
-
const modalData = contextModalData(key);
|
|
12
|
-
const openModal = (data) => contextOpenModal(key, data);
|
|
13
|
-
const closeModal = () => contextCloseModal(key);
|
|
14
|
-
return { modalIsOpen, modalData, openModal, closeModal };
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return contextData;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export { useModal };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useScopedParams — reads and writes URL search parameters with an optional namespace prefix.
|
|
3
|
-
*
|
|
4
|
-
* When `scope` is provided, every key is namespaced as `scope:key`, so multiple features
|
|
5
|
-
* can share the same URL without collisions (e.g. `filters:status` and `table:page`).
|
|
6
|
-
*
|
|
7
|
-
* @param searchString - Current URL search string (e.g. `location.search`).
|
|
8
|
-
* @param scope - Namespace prefix. Default: `""` (no prefix).
|
|
9
|
-
*
|
|
10
|
-
* @returns
|
|
11
|
-
* - `getParam(key)` — returns the (scoped) param value, or `null` if absent.
|
|
12
|
-
* - `getScopedSearch(params)` — merges `params` into the existing search string and returns the result.
|
|
13
|
-
* Pass `undefined` as a value to delete that param.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* // Without scope — plain key/value params
|
|
18
|
-
* const { getParam, getScopedSearch } = useScopedParams(location.search);
|
|
19
|
-
* getParam('page'); // "1"
|
|
20
|
-
* getScopedSearch({ page: 2, sort: 'name' }); // "?page=2&sort=name"
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* // With scope — all keys prefixed as "filters:key"
|
|
26
|
-
* const { getParam, getScopedSearch } = useScopedParams(location.search, 'filters');
|
|
27
|
-
* getParam('status'); // reads "filters:status"
|
|
28
|
-
* getScopedSearch({ status: 'active', category: undefined }); // removes "filters:category"
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
function useScopedParams(searchString, scope = "") {
|
|
32
|
-
const searchParams = new URLSearchParams(searchString);
|
|
33
|
-
const prefix = scope ? `${scope}:` : "";
|
|
34
|
-
const updateSearchParams = (params) => {
|
|
35
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
36
|
-
if (value === undefined) {
|
|
37
|
-
searchParams.delete(`${prefix}${key}`);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
searchParams.set(`${prefix}${key}`, String(value));
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
getParam: (key) => searchParams.get(`${prefix}${key}`),
|
|
46
|
-
getScopedSearch: (params) => {
|
|
47
|
-
updateSearchParams(params);
|
|
48
|
-
let search = searchParams.toString();
|
|
49
|
-
if (search)
|
|
50
|
-
search = "?" + search;
|
|
51
|
-
return search;
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export { useScopedParams };
|