@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.
Files changed (207) hide show
  1. package/dist/bundle.css +1 -1
  2. package/dist/components/alert/alertContainer/index.d.ts +27 -43
  3. package/dist/components/alert/alertContainer/index.d.ts.map +1 -1
  4. package/dist/components/alert/alertContainer/index.js +20 -40
  5. package/dist/components/alert/alertContent/index.d.ts +11 -36
  6. package/dist/components/alert/alertContent/index.d.ts.map +1 -1
  7. package/dist/components/alert/alertContent/index.js +11 -31
  8. package/dist/components/alert/alertDescription/index.d.ts +10 -38
  9. package/dist/components/alert/alertDescription/index.d.ts.map +1 -1
  10. package/dist/components/alert/alertDescription/index.js +10 -33
  11. package/dist/components/alert/alertIcon/index.d.ts +14 -38
  12. package/dist/components/alert/alertIcon/index.d.ts.map +1 -1
  13. package/dist/components/alert/alertIcon/index.js +14 -32
  14. package/dist/components/alert/alertTitle/index.d.ts +12 -35
  15. package/dist/components/alert/alertTitle/index.d.ts.map +1 -1
  16. package/dist/components/alert/alertTitle/index.js +12 -27
  17. package/dist/components/audioPlayer/index.d.ts +24 -32
  18. package/dist/components/audioPlayer/index.d.ts.map +1 -1
  19. package/dist/components/audioPlayer/index.js +15 -18
  20. package/dist/components/audioUpload/index.d.ts +37 -48
  21. package/dist/components/audioUpload/index.d.ts.map +1 -1
  22. package/dist/components/audioUpload/index.js +23 -48
  23. package/dist/components/badge/index.d.ts +31 -22
  24. package/dist/components/badge/index.d.ts.map +1 -1
  25. package/dist/components/badge/index.js +14 -22
  26. package/dist/components/button/index.d.ts +38 -28
  27. package/dist/components/button/index.d.ts.map +1 -1
  28. package/dist/components/button/index.js +18 -28
  29. package/dist/components/cardTab/cardTabButton/index.d.ts +14 -52
  30. package/dist/components/cardTab/cardTabButton/index.d.ts.map +1 -1
  31. package/dist/components/cardTab/cardTabButton/index.js +12 -52
  32. package/dist/components/cardTab/cardTabContainer/index.d.ts +16 -58
  33. package/dist/components/cardTab/cardTabContainer/index.d.ts.map +1 -1
  34. package/dist/components/cardTab/cardTabContainer/index.js +12 -58
  35. package/dist/components/checkbox/index.d.ts +38 -37
  36. package/dist/components/checkbox/index.d.ts.map +1 -1
  37. package/dist/components/checkbox/index.js +21 -37
  38. package/dist/components/clientOnly.d.ts +13 -66
  39. package/dist/components/clientOnly.d.ts.map +1 -1
  40. package/dist/components/clientOnly.js +11 -66
  41. package/dist/components/currencyInput/index.d.ts +67 -50
  42. package/dist/components/currencyInput/index.d.ts.map +1 -1
  43. package/dist/components/currencyInput/index.js +28 -50
  44. package/dist/components/divider/index.d.ts +12 -25
  45. package/dist/components/divider/index.d.ts.map +1 -1
  46. package/dist/components/divider/index.js +8 -25
  47. package/dist/components/drawer/drawerContainer/index.d.ts +16 -50
  48. package/dist/components/drawer/drawerContainer/index.d.ts.map +1 -1
  49. package/dist/components/drawer/drawerContainer/index.js +13 -50
  50. package/dist/components/drawer/drawerHeader/index.d.ts +9 -33
  51. package/dist/components/drawer/drawerHeader/index.d.ts.map +1 -1
  52. package/dist/components/drawer/drawerHeader/index.js +8 -33
  53. package/dist/components/facebookPixel/index.d.ts +47 -0
  54. package/dist/components/facebookPixel/index.d.ts.map +1 -1
  55. package/dist/components/facebookPixel/index.js +35 -0
  56. package/dist/components/fieldError/index.d.ts +4 -11
  57. package/dist/components/fieldError/index.d.ts.map +1 -1
  58. package/dist/components/fieldError/index.js +4 -11
  59. package/dist/components/fieldLabel/index.d.ts +6 -21
  60. package/dist/components/fieldLabel/index.d.ts.map +1 -1
  61. package/dist/components/fieldLabel/index.js +5 -21
  62. package/dist/components/fieldWrapper/index.d.ts +12 -22
  63. package/dist/components/fieldWrapper/index.d.ts.map +1 -1
  64. package/dist/components/fieldWrapper/index.js +7 -22
  65. package/dist/components/fileUpload/index.d.ts +36 -61
  66. package/dist/components/fileUpload/index.d.ts.map +1 -1
  67. package/dist/components/fileUpload/index.js +23 -61
  68. package/dist/components/googleAnalytics/index.d.ts +11 -7
  69. package/dist/components/googleAnalytics/index.d.ts.map +1 -1
  70. package/dist/components/googleAnalytics/index.js +9 -7
  71. package/dist/components/googleTagManager/index.d.ts +27 -21
  72. package/dist/components/googleTagManager/index.d.ts.map +1 -1
  73. package/dist/components/googleTagManager/index.js +20 -21
  74. package/dist/components/iconButton/index.d.ts +31 -15
  75. package/dist/components/iconButton/index.d.ts.map +1 -1
  76. package/dist/components/iconButton/index.js +12 -15
  77. package/dist/components/imageUpload/index.d.ts +47 -75
  78. package/dist/components/imageUpload/index.d.ts.map +1 -1
  79. package/dist/components/imageUpload/index.js +27 -75
  80. package/dist/components/input/index.d.ts +51 -44
  81. package/dist/components/input/index.d.ts.map +1 -1
  82. package/dist/components/input/index.js +24 -44
  83. package/dist/components/mapView/index.d.ts +44 -0
  84. package/dist/components/mapView/index.d.ts.map +1 -1
  85. package/dist/components/mapView/index.js +35 -0
  86. package/dist/components/maskedInput/index.d.ts +66 -51
  87. package/dist/components/maskedInput/index.d.ts.map +1 -1
  88. package/dist/components/maskedInput/index.js +28 -51
  89. package/dist/components/modal/modalContainer/index.d.ts +17 -57
  90. package/dist/components/modal/modalContainer/index.d.ts.map +1 -1
  91. package/dist/components/modal/modalContainer/index.js +15 -57
  92. package/dist/components/modal/modalFooter/index.d.ts +17 -50
  93. package/dist/components/modal/modalFooter/index.d.ts.map +1 -1
  94. package/dist/components/modal/modalFooter/index.js +10 -50
  95. package/dist/components/modal/modalHeader/index.d.ts +13 -47
  96. package/dist/components/modal/modalHeader/index.d.ts.map +1 -1
  97. package/dist/components/modal/modalHeader/index.js +12 -47
  98. package/dist/components/multiSelect/index.d.ts +67 -62
  99. package/dist/components/multiSelect/index.d.ts.map +1 -1
  100. package/dist/components/multiSelect/index.js +28 -62
  101. package/dist/components/pagination/index.d.ts +18 -9
  102. package/dist/components/pagination/index.d.ts.map +1 -1
  103. package/dist/components/pagination/index.js +18 -9
  104. package/dist/components/phoneInput/index.d.ts +65 -30
  105. package/dist/components/phoneInput/index.d.ts.map +1 -1
  106. package/dist/components/phoneInput/index.js +35 -30
  107. package/dist/components/popover/index.d.ts +34 -114
  108. package/dist/components/popover/index.d.ts.map +1 -1
  109. package/dist/components/popover/index.js +25 -114
  110. package/dist/components/radio/radioBox/index.d.ts +17 -65
  111. package/dist/components/radio/radioBox/index.d.ts.map +1 -1
  112. package/dist/components/radio/radioBox/index.js +14 -65
  113. package/dist/components/radio/radioGroup/index.d.ts +36 -67
  114. package/dist/components/radio/radioGroup/index.d.ts.map +1 -1
  115. package/dist/components/radio/radioGroup/index.js +25 -67
  116. package/dist/components/richText/index.d.ts +33 -47
  117. package/dist/components/richText/index.d.ts.map +1 -1
  118. package/dist/components/richText/index.js +30 -44
  119. package/dist/components/searchPlaces.d.ts +52 -50
  120. package/dist/components/searchPlaces.d.ts.map +1 -1
  121. package/dist/components/searchPlaces.js +23 -30
  122. package/dist/components/select/index.d.ts +68 -63
  123. package/dist/components/select/index.d.ts.map +1 -1
  124. package/dist/components/select/index.js +29 -63
  125. package/dist/components/slider/index.d.ts +20 -34
  126. package/dist/components/slider/index.d.ts.map +1 -1
  127. package/dist/components/slider/index.js +15 -33
  128. package/dist/components/switch/index.d.ts +42 -58
  129. package/dist/components/switch/index.d.ts.map +1 -1
  130. package/dist/components/switch/index.js +24 -58
  131. package/dist/components/tab/tabButton/index.d.ts +14 -52
  132. package/dist/components/tab/tabButton/index.d.ts.map +1 -1
  133. package/dist/components/tab/tabButton/index.js +12 -52
  134. package/dist/components/tab/tabContainer/index.d.ts +16 -58
  135. package/dist/components/tab/tabContainer/index.d.ts.map +1 -1
  136. package/dist/components/tab/tabContainer/index.js +12 -58
  137. package/dist/components/table/tableBody/index.d.ts +13 -47
  138. package/dist/components/table/tableBody/index.d.ts.map +1 -1
  139. package/dist/components/table/tableBody/index.js +12 -47
  140. package/dist/components/table/tableCaption/index.d.ts +6 -46
  141. package/dist/components/table/tableCaption/index.d.ts.map +1 -1
  142. package/dist/components/table/tableCaption/index.js +6 -46
  143. package/dist/components/table/tableContainer/index.d.ts +12 -41
  144. package/dist/components/table/tableContainer/index.d.ts.map +1 -1
  145. package/dist/components/table/tableContainer/index.js +12 -41
  146. package/dist/components/table/tableFooter/index.d.ts +5 -29
  147. package/dist/components/table/tableFooter/index.d.ts.map +1 -1
  148. package/dist/components/table/tableFooter/index.js +5 -29
  149. package/dist/components/table/tableHeader/index.d.ts +4 -25
  150. package/dist/components/table/tableHeader/index.d.ts.map +1 -1
  151. package/dist/components/table/tableHeader/index.js +4 -25
  152. package/dist/components/textarea/index.d.ts +32 -64
  153. package/dist/components/textarea/index.d.ts.map +1 -1
  154. package/dist/components/textarea/index.js +16 -64
  155. package/dist/components/tooltip/index.d.ts +27 -55
  156. package/dist/components/tooltip/index.d.ts.map +1 -1
  157. package/dist/components/tooltip/index.js +16 -55
  158. package/dist/hooks/useAutomation.d.ts +18 -26
  159. package/dist/hooks/useAutomation.d.ts.map +1 -1
  160. package/dist/hooks/useAutomation.js +18 -26
  161. package/dist/hooks/useDrawer.d.ts +19 -64
  162. package/dist/hooks/useDrawer.d.ts.map +1 -1
  163. package/dist/hooks/useForm.d.ts +12 -29
  164. package/dist/hooks/useForm.d.ts.map +1 -1
  165. package/dist/hooks/useForm.js +12 -29
  166. package/dist/hooks/useHydrated.d.ts +8 -63
  167. package/dist/hooks/useHydrated.d.ts.map +1 -1
  168. package/dist/hooks/useHydrated.js +8 -63
  169. package/dist/hooks/useModal.d.ts +19 -59
  170. package/dist/hooks/useModal.d.ts.map +1 -1
  171. package/dist/hooks/useScopedParams.d.ts +17 -69
  172. package/dist/hooks/useScopedParams.d.ts.map +1 -1
  173. package/dist/hooks/useScopedParams.js +17 -69
  174. package/dist/hooks/useScrollLock.d.ts +11 -27
  175. package/dist/hooks/useScrollLock.d.ts.map +1 -1
  176. package/dist/hooks/useScrollLock.js +11 -33
  177. package/dist/hooks/useSearchAutomation.d.ts +16 -34
  178. package/dist/hooks/useSearchAutomation.d.ts.map +1 -1
  179. package/dist/hooks/useSearchAutomation.js +16 -34
  180. package/dist/hooks/useSlider.d.ts +5 -19
  181. package/dist/hooks/useSlider.d.ts.map +1 -1
  182. package/dist/hooks/useSlider.js +5 -19
  183. package/dist/hooks/useToast.d.ts +8 -52
  184. package/dist/hooks/useToast.d.ts.map +1 -1
  185. package/dist/hooks/useToast.js +8 -52
  186. package/dist/providers/drawerProvider.d.ts +15 -81
  187. package/dist/providers/drawerProvider.d.ts.map +1 -1
  188. package/dist/providers/drawerProvider.js +15 -81
  189. package/dist/providers/formProvider.d.ts +17 -53
  190. package/dist/providers/formProvider.d.ts.map +1 -1
  191. package/dist/providers/formProvider.js +17 -53
  192. package/dist/providers/modalProvider.d.ts +16 -77
  193. package/dist/providers/modalProvider.d.ts.map +1 -1
  194. package/dist/providers/modalProvider.js +16 -77
  195. package/dist/providers/placesProvider.d.ts +16 -11
  196. package/dist/providers/placesProvider.d.ts.map +1 -1
  197. package/dist/providers/placesProvider.js +16 -11
  198. package/dist/providers/toastProvider.d.ts +10 -21
  199. package/dist/providers/toastProvider.d.ts.map +1 -1
  200. package/dist/providers/toastProvider.js +10 -21
  201. package/dist/services/toHtml.d.ts +11 -10
  202. package/dist/services/toHtml.d.ts.map +1 -1
  203. package/dist/services/toHtml.js +11 -10
  204. package/dist/services/toRichTextValue.d.ts +11 -17
  205. package/dist/services/toRichTextValue.d.ts.map +1 -1
  206. package/dist/services/toRichTextValue.js +11 -17
  207. 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 component - provides modal context for managing multiple modals state and data
5
+ * ModalProvider context provider that manages open/close state and data for named modals.
6
6
  *
7
- * @param props - ModalProvider component properties
8
- * @param props.children - React elements that will have access to the modal context
9
- * @param props.enableModalAutomation - Optional flag to enable modal automation features
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
- * @returns ModalProvider JSX element that wraps children with modal context
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
- * // Basic modal provider setup
16
- * function App() {
17
- * return (
18
- * <ModalProvider>
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
- * if (!modalIsOpen) return null;
22
+ * // Opening a modal from anywhere in the tree
23
+ * const { openModal } = useModal();
24
+ * openModal('confirm-delete', { id: user.id });
80
25
  *
81
- * return (
82
- * <Modal onClose={() => closeModal('user-details')}>
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 component that loads Google Maps API with Places, Marker, and Maps libraries.
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="YOUR_API_KEY">
14
- * {(isLoaded) => isLoaded ? <MapComponent /> : <LoadingSpinner />)}
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;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAUjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
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 component that loads Google Maps API with Places, Marker, and Maps libraries.
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="YOUR_API_KEY">
15
- * {(isLoaded) => isLoaded ? <MapComponent /> : <LoadingSpinner />)}
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 component - provides toast context for managing toast notifications
14
+ * ToastProvider mounts a `react-hot-toast` `<Toaster>` and exposes `showToast` via context.
15
15
  *
16
- * @param props - ToastProvider component properties
17
- * @param props.children - React elements that will have access to the toast context
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
- * @returns ToastProvider JSX element that wraps children with toast context
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
- * return <button onClick={handleClick}>Show Toast</button>;
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CA2CtD;AAED,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC"}
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 component - provides toast context for managing toast notifications
6
+ * ToastProvider mounts a `react-hot-toast` `<Toaster>` and exposes `showToast` via context.
7
7
  *
8
- * @param props - ToastProvider component properties
9
- * @param props.children - React elements that will have access to the toast context
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
- * @returns ToastProvider JSX element that wraps children with toast context
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
- * return <button onClick={handleClick}>Show Toast</button>;
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
- * Converts a RichTextValue array to HTML string format.
3
+ * toHtml — converts a `RichTextValue` (Slate.js Descendant array) to an HTML string.
4
4
  *
5
- * @param {RichTextValue} richTextValue - Array of Descendant objects representing rich text content
6
- * @returns {string} HTML string representation of the rich text content
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
- * ```typescript
10
- * const richTextService = new RichTextService();
11
- * const richText = [
12
- * { type: 'paragraph', children: [{ text: 'Hello world', bold: true }] }
13
- * ];
14
- * const html = richTextService.toHtml(richText);
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;;;;;;;;;;;;;;;GAeG;AAEH,iBAAS,MAAM,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAEpD;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
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"}
@@ -1,18 +1,19 @@
1
1
  import { serialize } from "../utils/richTextUtilities";
2
2
  /**
3
- * Converts a RichTextValue array to HTML string format.
3
+ * toHtml — converts a `RichTextValue` (Slate.js Descendant array) to an HTML string.
4
4
  *
5
- * @param {RichTextValue} richTextValue - Array of Descendant objects representing rich text content
6
- * @returns {string} HTML string representation of the rich text content
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
- * ```typescript
10
- * const richTextService = new RichTextService();
11
- * const richText = [
12
- * { type: 'paragraph', children: [{ text: 'Hello world', bold: true }] }
13
- * ];
14
- * const html = richTextService.toHtml(richText);
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
- * Converts an HTML string to RichTextValue format.
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
- * @param {string} html - HTML string to be converted to rich text format
8
- * @returns {RichTextValue} Array of Descendant objects representing the parsed content
5
+ * Use this to populate a `RichText` editor with content previously stored as HTML
6
+ * (e.g. loaded from a database).
9
7
  *
10
- * @example
11
- * ```typescript
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
- * ```typescript
20
- * // Handling plain text
21
- * const plainText = "Simple text";
22
- * const richText = richTextService.toRichTextValue(plainText);
23
- * // Returns: [{ text: 'Simple text' }]
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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAYpD;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
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
- * Converts an HTML string to RichTextValue format.
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
- * @param {string} html - HTML string to be converted to rich text format
9
- * @returns {RichTextValue} Array of Descendant objects representing the parsed content
6
+ * Use this to populate a `RichText` editor with content previously stored as HTML
7
+ * (e.g. loaded from a database).
10
8
  *
11
- * @example
12
- * ```typescript
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
- * ```typescript
21
- * // Handling plain text
22
- * const plainText = "Simple text";
23
- * const richText = richTextService.toRichTextValue(plainText);
24
- * // Returns: [{ text: 'Simple text' }]
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/components",
3
- "version": "3.0.1-beta.142",
3
+ "version": "3.0.1-beta.144",
4
4
  "main": "./dist/bundle.js",
5
5
  "module": "./dist/bundle.js",
6
6
  "types": "./dist/index.d.ts",