@arkyn/components 3.0.1-beta.142 → 3.0.1-beta.144
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/bundle.css +1 -1
- package/dist/components/alert/alertContainer/index.d.ts +27 -43
- package/dist/components/alert/alertContainer/index.d.ts.map +1 -1
- package/dist/components/alert/alertContainer/index.js +20 -40
- package/dist/components/alert/alertContent/index.d.ts +11 -36
- package/dist/components/alert/alertContent/index.d.ts.map +1 -1
- package/dist/components/alert/alertContent/index.js +11 -31
- package/dist/components/alert/alertDescription/index.d.ts +10 -38
- package/dist/components/alert/alertDescription/index.d.ts.map +1 -1
- package/dist/components/alert/alertDescription/index.js +10 -33
- package/dist/components/alert/alertIcon/index.d.ts +14 -38
- package/dist/components/alert/alertIcon/index.d.ts.map +1 -1
- package/dist/components/alert/alertIcon/index.js +14 -32
- package/dist/components/alert/alertTitle/index.d.ts +12 -35
- package/dist/components/alert/alertTitle/index.d.ts.map +1 -1
- package/dist/components/alert/alertTitle/index.js +12 -27
- package/dist/components/audioPlayer/index.d.ts +24 -32
- package/dist/components/audioPlayer/index.d.ts.map +1 -1
- package/dist/components/audioPlayer/index.js +15 -18
- package/dist/components/audioUpload/index.d.ts +37 -48
- package/dist/components/audioUpload/index.d.ts.map +1 -1
- package/dist/components/audioUpload/index.js +23 -48
- package/dist/components/badge/index.d.ts +31 -22
- package/dist/components/badge/index.d.ts.map +1 -1
- package/dist/components/badge/index.js +14 -22
- package/dist/components/button/index.d.ts +38 -28
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/button/index.js +18 -28
- package/dist/components/cardTab/cardTabButton/index.d.ts +14 -52
- package/dist/components/cardTab/cardTabButton/index.d.ts.map +1 -1
- package/dist/components/cardTab/cardTabButton/index.js +12 -52
- package/dist/components/cardTab/cardTabContainer/index.d.ts +16 -58
- package/dist/components/cardTab/cardTabContainer/index.d.ts.map +1 -1
- package/dist/components/cardTab/cardTabContainer/index.js +12 -58
- package/dist/components/checkbox/index.d.ts +38 -37
- package/dist/components/checkbox/index.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +21 -37
- package/dist/components/clientOnly.d.ts +13 -66
- package/dist/components/clientOnly.d.ts.map +1 -1
- package/dist/components/clientOnly.js +11 -66
- package/dist/components/currencyInput/index.d.ts +67 -50
- package/dist/components/currencyInput/index.d.ts.map +1 -1
- package/dist/components/currencyInput/index.js +28 -50
- package/dist/components/divider/index.d.ts +12 -25
- package/dist/components/divider/index.d.ts.map +1 -1
- package/dist/components/divider/index.js +8 -25
- package/dist/components/drawer/drawerContainer/index.d.ts +16 -50
- package/dist/components/drawer/drawerContainer/index.d.ts.map +1 -1
- package/dist/components/drawer/drawerContainer/index.js +13 -50
- package/dist/components/drawer/drawerHeader/index.d.ts +9 -33
- package/dist/components/drawer/drawerHeader/index.d.ts.map +1 -1
- package/dist/components/drawer/drawerHeader/index.js +8 -33
- package/dist/components/facebookPixel/index.d.ts +47 -0
- package/dist/components/facebookPixel/index.d.ts.map +1 -1
- package/dist/components/facebookPixel/index.js +35 -0
- package/dist/components/fieldError/index.d.ts +4 -11
- package/dist/components/fieldError/index.d.ts.map +1 -1
- package/dist/components/fieldError/index.js +4 -11
- package/dist/components/fieldLabel/index.d.ts +6 -21
- package/dist/components/fieldLabel/index.d.ts.map +1 -1
- package/dist/components/fieldLabel/index.js +5 -21
- package/dist/components/fieldWrapper/index.d.ts +12 -22
- package/dist/components/fieldWrapper/index.d.ts.map +1 -1
- package/dist/components/fieldWrapper/index.js +7 -22
- package/dist/components/fileUpload/index.d.ts +36 -61
- package/dist/components/fileUpload/index.d.ts.map +1 -1
- package/dist/components/fileUpload/index.js +23 -61
- package/dist/components/googleAnalytics/index.d.ts +11 -7
- package/dist/components/googleAnalytics/index.d.ts.map +1 -1
- package/dist/components/googleAnalytics/index.js +9 -7
- package/dist/components/googleTagManager/index.d.ts +27 -21
- package/dist/components/googleTagManager/index.d.ts.map +1 -1
- package/dist/components/googleTagManager/index.js +20 -21
- package/dist/components/iconButton/index.d.ts +31 -15
- package/dist/components/iconButton/index.d.ts.map +1 -1
- package/dist/components/iconButton/index.js +12 -15
- package/dist/components/imageUpload/index.d.ts +47 -75
- package/dist/components/imageUpload/index.d.ts.map +1 -1
- package/dist/components/imageUpload/index.js +27 -75
- package/dist/components/input/index.d.ts +51 -44
- package/dist/components/input/index.d.ts.map +1 -1
- package/dist/components/input/index.js +24 -44
- package/dist/components/mapView/index.d.ts +44 -0
- package/dist/components/mapView/index.d.ts.map +1 -1
- package/dist/components/mapView/index.js +35 -0
- package/dist/components/maskedInput/index.d.ts +66 -51
- package/dist/components/maskedInput/index.d.ts.map +1 -1
- package/dist/components/maskedInput/index.js +28 -51
- package/dist/components/modal/modalContainer/index.d.ts +17 -57
- package/dist/components/modal/modalContainer/index.d.ts.map +1 -1
- package/dist/components/modal/modalContainer/index.js +15 -57
- package/dist/components/modal/modalFooter/index.d.ts +17 -50
- package/dist/components/modal/modalFooter/index.d.ts.map +1 -1
- package/dist/components/modal/modalFooter/index.js +10 -50
- package/dist/components/modal/modalHeader/index.d.ts +13 -47
- package/dist/components/modal/modalHeader/index.d.ts.map +1 -1
- package/dist/components/modal/modalHeader/index.js +12 -47
- package/dist/components/multiSelect/index.d.ts +67 -62
- package/dist/components/multiSelect/index.d.ts.map +1 -1
- package/dist/components/multiSelect/index.js +28 -62
- package/dist/components/pagination/index.d.ts +18 -9
- package/dist/components/pagination/index.d.ts.map +1 -1
- package/dist/components/pagination/index.js +18 -9
- package/dist/components/phoneInput/index.d.ts +65 -30
- package/dist/components/phoneInput/index.d.ts.map +1 -1
- package/dist/components/phoneInput/index.js +35 -30
- package/dist/components/popover/index.d.ts +34 -114
- package/dist/components/popover/index.d.ts.map +1 -1
- package/dist/components/popover/index.js +25 -114
- package/dist/components/radio/radioBox/index.d.ts +17 -65
- package/dist/components/radio/radioBox/index.d.ts.map +1 -1
- package/dist/components/radio/radioBox/index.js +14 -65
- package/dist/components/radio/radioGroup/index.d.ts +36 -67
- package/dist/components/radio/radioGroup/index.d.ts.map +1 -1
- package/dist/components/radio/radioGroup/index.js +25 -67
- package/dist/components/richText/index.d.ts +33 -47
- package/dist/components/richText/index.d.ts.map +1 -1
- package/dist/components/richText/index.js +30 -44
- package/dist/components/searchPlaces.d.ts +52 -50
- package/dist/components/searchPlaces.d.ts.map +1 -1
- package/dist/components/searchPlaces.js +23 -30
- package/dist/components/select/index.d.ts +68 -63
- package/dist/components/select/index.d.ts.map +1 -1
- package/dist/components/select/index.js +29 -63
- package/dist/components/slider/index.d.ts +20 -34
- package/dist/components/slider/index.d.ts.map +1 -1
- package/dist/components/slider/index.js +15 -33
- package/dist/components/switch/index.d.ts +42 -58
- package/dist/components/switch/index.d.ts.map +1 -1
- package/dist/components/switch/index.js +24 -58
- package/dist/components/tab/tabButton/index.d.ts +14 -52
- package/dist/components/tab/tabButton/index.d.ts.map +1 -1
- package/dist/components/tab/tabButton/index.js +12 -52
- package/dist/components/tab/tabContainer/index.d.ts +16 -58
- package/dist/components/tab/tabContainer/index.d.ts.map +1 -1
- package/dist/components/tab/tabContainer/index.js +12 -58
- package/dist/components/table/tableBody/index.d.ts +13 -47
- package/dist/components/table/tableBody/index.d.ts.map +1 -1
- package/dist/components/table/tableBody/index.js +12 -47
- package/dist/components/table/tableCaption/index.d.ts +6 -46
- package/dist/components/table/tableCaption/index.d.ts.map +1 -1
- package/dist/components/table/tableCaption/index.js +6 -46
- package/dist/components/table/tableContainer/index.d.ts +12 -41
- package/dist/components/table/tableContainer/index.d.ts.map +1 -1
- package/dist/components/table/tableContainer/index.js +12 -41
- package/dist/components/table/tableFooter/index.d.ts +5 -29
- package/dist/components/table/tableFooter/index.d.ts.map +1 -1
- package/dist/components/table/tableFooter/index.js +5 -29
- package/dist/components/table/tableHeader/index.d.ts +4 -25
- package/dist/components/table/tableHeader/index.d.ts.map +1 -1
- package/dist/components/table/tableHeader/index.js +4 -25
- package/dist/components/textarea/index.d.ts +32 -64
- package/dist/components/textarea/index.d.ts.map +1 -1
- package/dist/components/textarea/index.js +16 -64
- package/dist/components/tooltip/index.d.ts +27 -55
- package/dist/components/tooltip/index.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +16 -55
- package/dist/hooks/useAutomation.d.ts +18 -26
- package/dist/hooks/useAutomation.d.ts.map +1 -1
- package/dist/hooks/useAutomation.js +18 -26
- package/dist/hooks/useDrawer.d.ts +19 -64
- package/dist/hooks/useDrawer.d.ts.map +1 -1
- package/dist/hooks/useForm.d.ts +12 -29
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/hooks/useForm.js +12 -29
- package/dist/hooks/useHydrated.d.ts +8 -63
- package/dist/hooks/useHydrated.d.ts.map +1 -1
- package/dist/hooks/useHydrated.js +8 -63
- package/dist/hooks/useModal.d.ts +19 -59
- package/dist/hooks/useModal.d.ts.map +1 -1
- package/dist/hooks/useScopedParams.d.ts +17 -69
- package/dist/hooks/useScopedParams.d.ts.map +1 -1
- package/dist/hooks/useScopedParams.js +17 -69
- package/dist/hooks/useScrollLock.d.ts +11 -27
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +11 -33
- package/dist/hooks/useSearchAutomation.d.ts +16 -34
- package/dist/hooks/useSearchAutomation.d.ts.map +1 -1
- package/dist/hooks/useSearchAutomation.js +16 -34
- package/dist/hooks/useSlider.d.ts +5 -19
- package/dist/hooks/useSlider.d.ts.map +1 -1
- package/dist/hooks/useSlider.js +5 -19
- package/dist/hooks/useToast.d.ts +8 -52
- package/dist/hooks/useToast.d.ts.map +1 -1
- package/dist/hooks/useToast.js +8 -52
- package/dist/providers/drawerProvider.d.ts +15 -81
- package/dist/providers/drawerProvider.d.ts.map +1 -1
- package/dist/providers/drawerProvider.js +15 -81
- package/dist/providers/formProvider.d.ts +17 -53
- package/dist/providers/formProvider.d.ts.map +1 -1
- package/dist/providers/formProvider.js +17 -53
- package/dist/providers/modalProvider.d.ts +16 -77
- package/dist/providers/modalProvider.d.ts.map +1 -1
- package/dist/providers/modalProvider.js +16 -77
- package/dist/providers/placesProvider.d.ts +16 -11
- package/dist/providers/placesProvider.d.ts.map +1 -1
- package/dist/providers/placesProvider.js +16 -11
- package/dist/providers/toastProvider.d.ts +10 -21
- package/dist/providers/toastProvider.d.ts.map +1 -1
- package/dist/providers/toastProvider.js +10 -21
- package/dist/services/toHtml.d.ts +11 -10
- package/dist/services/toHtml.d.ts.map +1 -1
- package/dist/services/toHtml.js +11 -10
- package/dist/services/toRichTextValue.d.ts +11 -17
- package/dist/services/toRichTextValue.d.ts.map +1 -1
- package/dist/services/toRichTextValue.js +11 -17
- package/package.json +1 -1
|
@@ -2,90 +2,29 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext, useState } from "react";
|
|
3
3
|
const modalContext = createContext({});
|
|
4
4
|
/**
|
|
5
|
-
* ModalProvider
|
|
5
|
+
* ModalProvider — context provider that manages open/close state and data for named modals.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Wrap your app (or a subtree) with this once. Any component in the tree can then call
|
|
8
|
+
* `useModal(key)` to open, close, or read data for a specific modal. `closeAll()` is also
|
|
9
|
+
* available (used by `useAutomation` to close all modals after a successful form action).
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @param props.children - Components that will have access to modal context.
|
|
12
|
+
*
|
|
13
|
+
* @returns ModalProvider JSX element.
|
|
12
14
|
*
|
|
13
15
|
* @example
|
|
14
16
|
* ```tsx
|
|
15
|
-
* //
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* <UserModal />
|
|
20
|
-
* <ConfirmModal />
|
|
21
|
-
* <ImagePreviewModal />
|
|
22
|
-
* <MainContent />
|
|
23
|
-
* </ModalProvider>
|
|
24
|
-
* );
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* // Modal provider with automation enabled
|
|
28
|
-
* function AppWithAutomation() {
|
|
29
|
-
* return (
|
|
30
|
-
* <ModalProvider enableModalAutomation={true}>
|
|
31
|
-
* <Dashboard />
|
|
32
|
-
* <SettingsModal />
|
|
33
|
-
* <NotificationModal />
|
|
34
|
-
* </ModalProvider>
|
|
35
|
-
* );
|
|
36
|
-
* }
|
|
37
|
-
*
|
|
38
|
-
* // Using with multiple modals
|
|
39
|
-
* function MultiModalApp() {
|
|
40
|
-
* return (
|
|
41
|
-
* <ModalProvider>
|
|
42
|
-
* <Header />
|
|
43
|
-
* <Modal key="user-profile" />
|
|
44
|
-
* <Modal key="edit-settings" />
|
|
45
|
-
* <Modal key="confirm-delete" />
|
|
46
|
-
* <MainContent />
|
|
47
|
-
* </ModalProvider>
|
|
48
|
-
* );
|
|
49
|
-
* }
|
|
50
|
-
*
|
|
51
|
-
* // Component using modal context
|
|
52
|
-
* function ModalTrigger() {
|
|
53
|
-
* const { openModal, closeAll } = useModal();
|
|
54
|
-
*
|
|
55
|
-
* const handleOpenUserModal = () => {
|
|
56
|
-
* openModal('user-details', { userId: 123, mode: 'edit' });
|
|
57
|
-
* };
|
|
58
|
-
*
|
|
59
|
-
* const handleCloseAllModals = () => {
|
|
60
|
-
* closeAll();
|
|
61
|
-
* };
|
|
62
|
-
*
|
|
63
|
-
* return (
|
|
64
|
-
* <div>
|
|
65
|
-
* <button onClick={handleOpenUserModal}>
|
|
66
|
-
* Open User Modal
|
|
67
|
-
* </button>
|
|
68
|
-
* <button onClick={handleCloseAllModals}>
|
|
69
|
-
* Close All Modals
|
|
70
|
-
* </button>
|
|
71
|
-
* </div>
|
|
72
|
-
* );
|
|
73
|
-
* }
|
|
74
|
-
*
|
|
75
|
-
* // Modal component consuming context
|
|
76
|
-
* function UserDetailsModal() {
|
|
77
|
-
* const { modalIsOpen, modalData, closeModal } = useModal('user-details');
|
|
17
|
+
* // In your root layout
|
|
18
|
+
* <ModalProvider>
|
|
19
|
+
* <App />
|
|
20
|
+
* </ModalProvider>
|
|
78
21
|
*
|
|
79
|
-
*
|
|
22
|
+
* // Opening a modal from anywhere in the tree
|
|
23
|
+
* const { openModal } = useModal();
|
|
24
|
+
* openModal('confirm-delete', { id: user.id });
|
|
80
25
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* <h2>User Details</h2>
|
|
84
|
-
* <p>User ID: {modalData?.userId}</p>
|
|
85
|
-
* <p>Mode: {modalData?.mode}</p>
|
|
86
|
-
* </Modal>
|
|
87
|
-
* );
|
|
88
|
-
* }
|
|
26
|
+
* // Consuming in the modal component
|
|
27
|
+
* const { modalIsOpen, modalData, closeModal } = useModal<{ id: number }>('confirm-delete');
|
|
89
28
|
* ```
|
|
90
29
|
*/
|
|
91
30
|
function ModalProvider(args) {
|
|
@@ -5,22 +5,27 @@ type PlacesProviderProps = {
|
|
|
5
5
|
preventFontsLoading?: boolean;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* PlacesProvider
|
|
8
|
+
* PlacesProvider — loads the Google Maps JS API with `places`, `marker`, and `maps` libraries.
|
|
9
|
+
*
|
|
10
|
+
* Uses a render-prop pattern: `children` receives `isLoaded` so you can defer rendering
|
|
11
|
+
* `SearchPlaces` or `MapView` until the script is ready.
|
|
12
|
+
*
|
|
13
|
+
* @param props.apiKey - Google Maps API key. Required.
|
|
14
|
+
* @param props.children - Render function: `(isLoaded: boolean) => ReactNode`.
|
|
15
|
+
* @param props.preventFontsLoading - Prevents Google Fonts from being injected by the Maps SDK. @default true
|
|
16
|
+
*
|
|
17
|
+
* @returns The result of calling `children(isLoaded)`.
|
|
9
18
|
*
|
|
10
|
-
* @component
|
|
11
19
|
* @example
|
|
12
20
|
* ```tsx
|
|
13
|
-
* <PlacesProvider apiKey=
|
|
14
|
-
* {(isLoaded) =>
|
|
21
|
+
* <PlacesProvider apiKey={env.GOOGLE_MAPS_KEY}>
|
|
22
|
+
* {(isLoaded) => (
|
|
23
|
+
* isLoaded
|
|
24
|
+
* ? <SearchPlaces apiKey={env.GOOGLE_MAPS_KEY} onSelect={setAddress} />
|
|
25
|
+
* : <Skeleton />
|
|
26
|
+
* )}
|
|
15
27
|
* </PlacesProvider>
|
|
16
28
|
* ```
|
|
17
|
-
*
|
|
18
|
-
* @param {PlacesProviderProps} props - The component props
|
|
19
|
-
* @param {string} props.apiKey - Maps API key for authentication
|
|
20
|
-
* @param {(isLoaded: boolean) => ReactNode} props.children - Render function that receives the loading state
|
|
21
|
-
* @param {boolean} [props.preventFontsLoading=true] - Whether to prevent Fonts from loading
|
|
22
|
-
*
|
|
23
|
-
* @returns {ReactNode} The rendered children with the loading state
|
|
24
29
|
*/
|
|
25
30
|
declare function PlacesProvider(props: PlacesProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
26
31
|
export { PlacesProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placesProvider.d.ts","sourceRoot":"","sources":["../../src/providers/placesProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQlC,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"placesProvider.d.ts","sourceRoot":"","sources":["../../src/providers/placesProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQlC,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAUjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -6,22 +6,27 @@ const libraries = [
|
|
|
6
6
|
"maps",
|
|
7
7
|
];
|
|
8
8
|
/**
|
|
9
|
-
* PlacesProvider
|
|
9
|
+
* PlacesProvider — loads the Google Maps JS API with `places`, `marker`, and `maps` libraries.
|
|
10
|
+
*
|
|
11
|
+
* Uses a render-prop pattern: `children` receives `isLoaded` so you can defer rendering
|
|
12
|
+
* `SearchPlaces` or `MapView` until the script is ready.
|
|
13
|
+
*
|
|
14
|
+
* @param props.apiKey - Google Maps API key. Required.
|
|
15
|
+
* @param props.children - Render function: `(isLoaded: boolean) => ReactNode`.
|
|
16
|
+
* @param props.preventFontsLoading - Prevents Google Fonts from being injected by the Maps SDK. @default true
|
|
17
|
+
*
|
|
18
|
+
* @returns The result of calling `children(isLoaded)`.
|
|
10
19
|
*
|
|
11
|
-
* @component
|
|
12
20
|
* @example
|
|
13
21
|
* ```tsx
|
|
14
|
-
* <PlacesProvider apiKey=
|
|
15
|
-
* {(isLoaded) =>
|
|
22
|
+
* <PlacesProvider apiKey={env.GOOGLE_MAPS_KEY}>
|
|
23
|
+
* {(isLoaded) => (
|
|
24
|
+
* isLoaded
|
|
25
|
+
* ? <SearchPlaces apiKey={env.GOOGLE_MAPS_KEY} onSelect={setAddress} />
|
|
26
|
+
* : <Skeleton />
|
|
27
|
+
* )}
|
|
16
28
|
* </PlacesProvider>
|
|
17
29
|
* ```
|
|
18
|
-
*
|
|
19
|
-
* @param {PlacesProviderProps} props - The component props
|
|
20
|
-
* @param {string} props.apiKey - Maps API key for authentication
|
|
21
|
-
* @param {(isLoaded: boolean) => ReactNode} props.children - Render function that receives the loading state
|
|
22
|
-
* @param {boolean} [props.preventFontsLoading=true] - Whether to prevent Fonts from loading
|
|
23
|
-
*
|
|
24
|
-
* @returns {ReactNode} The rendered children with the loading state
|
|
25
30
|
*/
|
|
26
31
|
function PlacesProvider(props) {
|
|
27
32
|
const { apiKey, children, preventFontsLoading = true } = props;
|
|
@@ -11,36 +11,25 @@ type ToastProviderProps = {
|
|
|
11
11
|
};
|
|
12
12
|
declare const toastContext: import("react").Context<ToastContextProps>;
|
|
13
13
|
/**
|
|
14
|
-
* ToastProvider
|
|
14
|
+
* ToastProvider — mounts a `react-hot-toast` `<Toaster>` and exposes `showToast` via context.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Wrap your app once. Then call `useToast()` anywhere in the tree to show notifications.
|
|
17
|
+
* Supports two types: `"success"` (green) and `"danger"` (red).
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @param props.children - App subtree that will have access to `useToast`.
|
|
20
|
+
*
|
|
21
|
+
* @returns ToastProvider JSX element.
|
|
20
22
|
*
|
|
21
23
|
* @example
|
|
22
|
-
* Basic usage:
|
|
23
24
|
* ```tsx
|
|
25
|
+
* // In your root layout
|
|
24
26
|
* <ToastProvider>
|
|
25
27
|
* <App />
|
|
26
28
|
* </ToastProvider>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* Using toast in component:
|
|
31
|
-
* ```tsx
|
|
32
|
-
* function MyComponent() {
|
|
33
|
-
* const { showToast } = useToast();
|
|
34
|
-
*
|
|
35
|
-
* const handleClick = () => {
|
|
36
|
-
* showToast({
|
|
37
|
-
* message: 'Success!',
|
|
38
|
-
* type: 'success'
|
|
39
|
-
* });
|
|
40
|
-
* };
|
|
41
29
|
*
|
|
42
|
-
*
|
|
43
|
-
* }
|
|
30
|
+
* // Anywhere in the tree
|
|
31
|
+
* const { showToast } = useToast();
|
|
32
|
+
* showToast({ message: "Order placed!", type: "success" });
|
|
44
33
|
* ```
|
|
45
34
|
*/
|
|
46
35
|
declare function ToastProvider({ children }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toastProvider.d.ts","sourceRoot":"","sources":["../../src/providers/toastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjD,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,YAAY,4CAAyC,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"toastProvider.d.ts","sourceRoot":"","sources":["../../src/providers/toastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjD,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,YAAY,4CAAyC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CA2CtD;AAED,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -3,36 +3,25 @@ import { createContext } from "react";
|
|
|
3
3
|
import toast, { Toaster } from "react-hot-toast";
|
|
4
4
|
const toastContext = createContext({});
|
|
5
5
|
/**
|
|
6
|
-
* ToastProvider
|
|
6
|
+
* ToastProvider — mounts a `react-hot-toast` `<Toaster>` and exposes `showToast` via context.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Wrap your app once. Then call `useToast()` anywhere in the tree to show notifications.
|
|
9
|
+
* Supports two types: `"success"` (green) and `"danger"` (red).
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @param props.children - App subtree that will have access to `useToast`.
|
|
12
|
+
*
|
|
13
|
+
* @returns ToastProvider JSX element.
|
|
12
14
|
*
|
|
13
15
|
* @example
|
|
14
|
-
* Basic usage:
|
|
15
16
|
* ```tsx
|
|
17
|
+
* // In your root layout
|
|
16
18
|
* <ToastProvider>
|
|
17
19
|
* <App />
|
|
18
20
|
* </ToastProvider>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* Using toast in component:
|
|
23
|
-
* ```tsx
|
|
24
|
-
* function MyComponent() {
|
|
25
|
-
* const { showToast } = useToast();
|
|
26
|
-
*
|
|
27
|
-
* const handleClick = () => {
|
|
28
|
-
* showToast({
|
|
29
|
-
* message: 'Success!',
|
|
30
|
-
* type: 'success'
|
|
31
|
-
* });
|
|
32
|
-
* };
|
|
33
21
|
*
|
|
34
|
-
*
|
|
35
|
-
* }
|
|
22
|
+
* // Anywhere in the tree
|
|
23
|
+
* const { showToast } = useToast();
|
|
24
|
+
* showToast({ message: "Order placed!", type: "success" });
|
|
36
25
|
* ```
|
|
37
26
|
*/
|
|
38
27
|
function ToastProvider({ children }) {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { RichTextValue } from "../types/richTextTypes";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* toHtml — converts a `RichTextValue` (Slate.js Descendant array) to an HTML string.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Use this to persist or display the editor's content as plain HTML.
|
|
6
|
+
*
|
|
7
|
+
* @param richTextValue - The value from a `RichText` component's `onChange` callback.
|
|
8
|
+
* @returns HTML string representation of the rich text content.
|
|
7
9
|
*
|
|
8
10
|
* @example
|
|
9
|
-
* ```
|
|
10
|
-
* const
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* // Returns: "<p><strong>Hello world</strong></p>"
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const [content, setContent] = useState<RichTextValue>([]);
|
|
13
|
+
*
|
|
14
|
+
* // On form submit, convert to HTML for storage
|
|
15
|
+
* const html = toHtml(content);
|
|
16
|
+
* // e.g. "<p><strong>Hello world</strong></p>"
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
19
|
declare function toHtml(richTextValue: RichTextValue): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toHtml.d.ts","sourceRoot":"","sources":["../../src/services/toHtml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD
|
|
1
|
+
{"version":3,"file":"toHtml.d.ts","sourceRoot":"","sources":["../../src/services/toHtml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;;;;;;;;;;;;;GAgBG;AAEH,iBAAS,MAAM,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAEpD;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/services/toHtml.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { serialize } from "../utils/richTextUtilities";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* toHtml — converts a `RichTextValue` (Slate.js Descendant array) to an HTML string.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Use this to persist or display the editor's content as plain HTML.
|
|
6
|
+
*
|
|
7
|
+
* @param richTextValue - The value from a `RichText` component's `onChange` callback.
|
|
8
|
+
* @returns HTML string representation of the rich text content.
|
|
7
9
|
*
|
|
8
10
|
* @example
|
|
9
|
-
* ```
|
|
10
|
-
* const
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* // Returns: "<p><strong>Hello world</strong></p>"
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const [content, setContent] = useState<RichTextValue>([]);
|
|
13
|
+
*
|
|
14
|
+
* // On form submit, convert to HTML for storage
|
|
15
|
+
* const html = toHtml(content);
|
|
16
|
+
* // e.g. "<p><strong>Hello world</strong></p>"
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
19
|
function toHtml(richTextValue) {
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { RichTextValue } from "../types/richTextTypes";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Parses the HTML content and transforms it into an array of Descendant objects
|
|
5
|
-
* that can be used by the rich text editor.
|
|
3
|
+
* toRichTextValue — converts an HTML string to a `RichTextValue` (Slate.js Descendant array).
|
|
6
4
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Use this to populate a `RichText` editor with content previously stored as HTML
|
|
6
|
+
* (e.g. loaded from a database).
|
|
9
7
|
*
|
|
10
|
-
* @
|
|
11
|
-
*
|
|
12
|
-
* const richTextService = new RichTextService();
|
|
13
|
-
* const html = "<p><strong>Hello world</strong></p>";
|
|
14
|
-
* const richText = richTextService.toRichTextValue(html);
|
|
15
|
-
* // Returns: [{ type: 'paragraph', children: [{ text: 'Hello world', bold: true }] }]
|
|
16
|
-
* ```
|
|
8
|
+
* @param html - HTML string to convert.
|
|
9
|
+
* @returns Slate.js Descendant array ready to pass to `RichText`'s `defaultValue` prop.
|
|
17
10
|
*
|
|
18
11
|
* @example
|
|
19
|
-
* ```
|
|
20
|
-
* //
|
|
21
|
-
* const
|
|
22
|
-
*
|
|
23
|
-
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Load stored HTML into the editor
|
|
14
|
+
* const defaultValue = toRichTextValue(product.description);
|
|
15
|
+
* // e.g. [{ type: 'paragraph', children: [{ text: 'Hello', bold: true }] }]
|
|
16
|
+
*
|
|
17
|
+
* <RichText name="description" defaultValue={defaultValue} />
|
|
24
18
|
* ```
|
|
25
19
|
*/
|
|
26
20
|
declare function toRichTextValue(html: string): RichTextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toRichTextValue.d.ts","sourceRoot":"","sources":["../../src/services/toRichTextValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGrE
|
|
1
|
+
{"version":3,"file":"toRichTextValue.d.ts","sourceRoot":"","sources":["../../src/services/toRichTextValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGrE;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAYpD;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import parse from "html-react-parser";
|
|
2
2
|
import { deserialize } from "../utils/richTextUtilities";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Parses the HTML content and transforms it into an array of Descendant objects
|
|
6
|
-
* that can be used by the rich text editor.
|
|
4
|
+
* toRichTextValue — converts an HTML string to a `RichTextValue` (Slate.js Descendant array).
|
|
7
5
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Use this to populate a `RichText` editor with content previously stored as HTML
|
|
7
|
+
* (e.g. loaded from a database).
|
|
10
8
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
* const richTextService = new RichTextService();
|
|
14
|
-
* const html = "<p><strong>Hello world</strong></p>";
|
|
15
|
-
* const richText = richTextService.toRichTextValue(html);
|
|
16
|
-
* // Returns: [{ type: 'paragraph', children: [{ text: 'Hello world', bold: true }] }]
|
|
17
|
-
* ```
|
|
9
|
+
* @param html - HTML string to convert.
|
|
10
|
+
* @returns Slate.js Descendant array ready to pass to `RichText`'s `defaultValue` prop.
|
|
18
11
|
*
|
|
19
12
|
* @example
|
|
20
|
-
* ```
|
|
21
|
-
* //
|
|
22
|
-
* const
|
|
23
|
-
*
|
|
24
|
-
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Load stored HTML into the editor
|
|
15
|
+
* const defaultValue = toRichTextValue(product.description);
|
|
16
|
+
* // e.g. [{ type: 'paragraph', children: [{ text: 'Hello', bold: true }] }]
|
|
17
|
+
*
|
|
18
|
+
* <RichText name="description" defaultValue={defaultValue} />
|
|
25
19
|
* ```
|
|
26
20
|
*/
|
|
27
21
|
function toRichTextValue(html) {
|