@alextheman/components 6.13.1 → 6.14.0

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.d.cts CHANGED
@@ -139,14 +139,81 @@ declare function FileInputList({
139
139
  ...fileInputProps
140
140
  }: FileInputListProps): _$react_jsx_runtime0.JSX.Element;
141
141
  //#endregion
142
+ //#region src/components/ModeToggle.d.ts
143
+ /** A toggle to switch between dark mode and light mode. Must be used in a `ModeProvider`. */
144
+ declare function ModeToggle(): _$react_jsx_runtime0.JSX.Element;
145
+ //#endregion
146
+ //#region src/components/NavigationBottom.d.ts
147
+ interface NavItemBottom {
148
+ /** The value associated with the nav item. */
149
+ value: string;
150
+ /** The label to display on the nav item. */
151
+ label: string;
152
+ /** An icon to display alongside the nav item. */
153
+ icon?: JSX.Element;
154
+ /** Where in your app the nav item should navigate to. */
155
+ to: string;
156
+ }
157
+ interface NavigationBottomProps {
158
+ /** Children to display above the nav bar. */
159
+ children: ReactNode;
160
+ /** An array of nav items to show. */
161
+ navItems: Array<NavItemBottom>;
162
+ }
163
+ /** Renders a navigation bar at the bottom of the screen. Especially helpful for common navigation options in a mobile app. */
164
+ declare function NavigationBottom({
165
+ children,
166
+ navItems
167
+ }: NavigationBottomProps): _$react_jsx_runtime0.JSX.Element;
168
+ //#endregion
169
+ //#region src/components/Page.d.ts
170
+ interface PageProps {
171
+ /** The Page title to show */
172
+ title: string;
173
+ /** The subtitle to show under the Page title */
174
+ subtitle?: string;
175
+ /** The actions to show in the page header */
176
+ action?: ReactNode;
177
+ /** The actual page contents */
178
+ children: ReactNode;
179
+ }
180
+ /** Renders a pre-styled Page that can be used to structure pages throughout your React apps. */
181
+ declare function Page({
182
+ title,
183
+ subtitle,
184
+ action,
185
+ children
186
+ }: PageProps): _$react_jsx_runtime0.JSX.Element;
187
+ //#endregion
142
188
  //#region src/types/ContextHookOptions.d.ts
143
189
  interface ContextHookOptions<Strict extends boolean = true> {
144
190
  /** Error if the context is missing if this is set to true. */
145
191
  strict?: Strict;
146
192
  }
147
193
  //#endregion
148
- //#region src/providers/LoaderProvider/LoaderProvider.d.ts
149
- interface LoaderProviderBaseProps<DataType> {
194
+ //#region src/providers/ModeProvider.d.ts
195
+ interface ModeContextValue {
196
+ toggleMode: () => void;
197
+ mode: PaletteMode;
198
+ }
199
+ /** Access the mode context directly. */
200
+ declare function useMode<Strict extends boolean = true>({
201
+ strict
202
+ }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, ModeContextValue>;
203
+ interface ModeProviderProps {
204
+ /** The children that will have access to the current mode. */
205
+ children: ReactNode;
206
+ /** The initial mode. */
207
+ mode?: PaletteMode;
208
+ }
209
+ /** Provides information about the current theme mode to its children components. */
210
+ declare function ModeProvider({
211
+ children,
212
+ mode: modeProp
213
+ }: ModeProviderProps): _$react_jsx_runtime0.JSX.Element;
214
+ //#endregion
215
+ //#region src/providers/QueryBoundaryProvider/QueryBoundaryProvider.d.ts
216
+ interface QueryBoundaryProviderBaseProps<DataType> {
150
217
  /** The current loading status (true if loading, false if not) */
151
218
  isLoading: boolean;
152
219
  /** The data being loaded. */
@@ -156,12 +223,12 @@ interface LoaderProviderBaseProps<DataType> {
156
223
  /** The component to show when the data is being fetched. */
157
224
  loadingComponent?: ReactNode;
158
225
  }
159
- interface LoaderProviderPropsWithNoError<DataType> extends LoaderProviderBaseProps<DataType> {
226
+ interface QueryBoundaryProviderPropsWithNoError<DataType> extends QueryBoundaryProviderBaseProps<DataType> {
160
227
  error?: never;
161
228
  errorComponent?: never;
162
229
  logError?: never;
163
230
  }
164
- interface LoaderProviderPropsWithError<DataType> extends LoaderProviderBaseProps<DataType> {
231
+ interface QueryBoundaryProviderPropsWithError<DataType> extends QueryBoundaryProviderBaseProps<DataType> {
165
232
  /** The error given if the request gave an error. */
166
233
  error: unknown;
167
234
  /** The component to show if an error has been thrown. Note that this may not be provided unless the error prop has also been provided. */
@@ -169,24 +236,24 @@ interface LoaderProviderPropsWithError<DataType> extends LoaderProviderBaseProps
169
236
  /** Whether you want to log the error to the console or not. */
170
237
  logError?: boolean;
171
238
  }
172
- type LoaderContextValue<T> = LoaderProviderPropsWithNoError<T> | LoaderProviderPropsWithError<T>;
173
- type LoaderProviderProps<T> = LoaderContextValue<T> & {
239
+ type QueryBoundaryContextValue<DataType> = QueryBoundaryProviderPropsWithNoError<DataType> | QueryBoundaryProviderPropsWithError<DataType>;
240
+ type QueryBoundaryProviderProps<DataType> = QueryBoundaryContextValue<DataType> & {
174
241
  children: ReactNode;
175
242
  };
176
243
  /**
177
244
  * A provider for a context that deals with state management when fetching data from an API.
178
- * This may be used over Loader if you require more control over the placement of the error message and data display.
245
+ * This may be used over QueryBoundary if you require more control over the placement of the error message and data display.
179
246
  *
180
247
  * @template DataType - The type of data being loaded.
181
248
  */
182
- declare function LoaderProvider<DataType>({
249
+ declare function QueryBoundaryProvider<DataType>({
183
250
  children,
184
251
  loadingComponent,
185
252
  ...contextProps
186
- }: LoaderProviderProps<DataType>): _$react_jsx_runtime0.JSX.Element;
253
+ }: QueryBoundaryProviderProps<DataType>): _$react_jsx_runtime0.JSX.Element;
187
254
  //#endregion
188
- //#region src/providers/LoaderProvider/LoaderData.d.ts
189
- interface LoaderDataProps<T> {
255
+ //#region src/providers/QueryBoundaryProvider/QueryBoundaryData.d.ts
256
+ interface QueryBoundaryDataProps<T> {
190
257
  /**
191
258
  * The elements to show after data has been loaded.
192
259
  * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.
@@ -198,68 +265,47 @@ interface LoaderDataProps<T> {
198
265
  loadingComponent?: ReactNode;
199
266
  }
200
267
  /**
201
- * The component responsible for showing the data provided by LoaderProvider.
268
+ * The component responsible for showing the data provided by QueryBoundaryProvider.
202
269
  *
203
270
  * @template DataType - The type of data being loaded.
204
271
  */
205
- declare function LoaderData<DataType>({
272
+ declare function QueryBoundaryData<DataType>({
206
273
  children,
207
274
  dataParser: loaderDataParser,
208
275
  loadingComponent
209
- }: LoaderDataProps<DataType>): _$react_jsx_runtime0.JSX.Element;
276
+ }: QueryBoundaryDataProps<DataType>): _$react_jsx_runtime0.JSX.Element;
210
277
  //#endregion
211
- //#region src/providers/LoaderProvider/LoaderError.d.ts
212
- interface LoaderErrorBaseProps {
278
+ //#region src/providers/QueryBoundaryProvider/QueryBoundaryError.d.ts
279
+ interface QueryBoundaryErrorBaseProps {
213
280
  /** The component to show if an error has been thrown. */
214
281
  children?: ReactNode | ((error: unknown) => ReactNode);
215
282
  /** An option to log the error to the console. */
216
283
  logError?: boolean;
217
284
  }
218
- interface LoaderErrorPropsWithUndefinedOrNull extends LoaderErrorBaseProps {
285
+ interface QueryBoundaryErrorPropsWithUndefinedOrNull extends QueryBoundaryErrorBaseProps {
219
286
  /** The component to show if no error was thrown but data is undefined */
220
287
  undefinedComponent?: ReactNode;
221
288
  /** The component to show if no error was thrown but data is null */
222
289
  nullComponent?: ReactNode;
223
290
  nullableComponent?: never;
224
291
  }
225
- interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
292
+ interface QueryBoundaryErrorPropsWithNullable extends QueryBoundaryErrorBaseProps {
226
293
  undefinedComponent?: never;
227
294
  nullComponent?: never;
228
295
  /** The component to show if no error was thrown but data is undefined or null */
229
296
  nullableComponent?: ReactNode;
230
297
  }
231
- type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
298
+ type QueryBoundaryErrorProps = QueryBoundaryErrorPropsWithUndefinedOrNull | QueryBoundaryErrorPropsWithNullable;
232
299
  /**
233
- * The component responsible for showing any errors provided by LoaderProvider.
300
+ * The component responsible for showing any errors provided by QueryBoundaryProvider.
234
301
  */
235
- declare function LoaderError({
302
+ declare function QueryBoundaryError({
236
303
  children,
237
304
  undefinedComponent,
238
305
  nullComponent,
239
306
  nullableComponent,
240
307
  logError: propsLogError
241
- }: LoaderErrorProps): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
242
- //#endregion
243
- //#region src/providers/ModeProvider.d.ts
244
- interface ModeContextValue {
245
- toggleMode: () => void;
246
- mode: PaletteMode;
247
- }
248
- /** Access the mode context directly. */
249
- declare function useMode<Strict extends boolean = true>({
250
- strict
251
- }?: ContextHookOptions<Strict>): OptionalOnCondition<Strict, ModeContextValue>;
252
- interface ModeProviderProps {
253
- /** The children that will have access to the current mode. */
254
- children: ReactNode;
255
- /** The initial mode. */
256
- mode?: PaletteMode;
257
- }
258
- /** Provides information about the current theme mode to its children components. */
259
- declare function ModeProvider({
260
- children,
261
- mode: modeProp
262
- }: ModeProviderProps): _$react_jsx_runtime0.JSX.Element;
308
+ }: QueryBoundaryErrorProps): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
263
309
  //#endregion
264
310
  //#region src/providers/ScreenSizeProvider.d.ts
265
311
  interface ScreenSizeProps {
@@ -310,15 +356,15 @@ declare function SnackbarProvider({
310
356
  autoHideDuration
311
357
  }: SnackbarProviderProps): _$react_jsx_runtime0.JSX.Element;
312
358
  //#endregion
313
- //#region src/components/Loader.d.ts
314
- type LoaderProps<DataType> = Omit<LoaderProviderProps<DataType>, "children" | "logError"> & Omit<LoaderErrorProps, "errorComponent" | "children"> & Omit<LoaderDataProps<DataType>, "showOnError" | "onUndefined" | "onNull" | "onNullable">;
359
+ //#region src/components/QueryBoundary.d.ts
360
+ type QueryBoundaryProps<DataType> = Omit<QueryBoundaryProviderProps<DataType>, "children" | "logError"> & Omit<QueryBoundaryErrorProps, "errorComponent" | "children"> & Omit<QueryBoundaryDataProps<DataType>, "showOnError" | "onUndefined" | "onNull" | "onNullable">;
315
361
  /**
316
362
  * An in-line component that deals with state management when fetching data from an API.
317
- * This may be used over LoaderProvider if you don't require as much control over the placement of the error message and data display.
363
+ * This may be used over QueryBoundaryProvider if you don't require as much control over the placement of the error message and data display.
318
364
  *
319
365
  * @template DataType - The type of data being loaded.
320
366
  */
321
- declare function Loader<DataType>({
367
+ declare function QueryBoundary<DataType>({
322
368
  children,
323
369
  errorComponent,
324
370
  undefinedComponent,
@@ -327,53 +373,7 @@ declare function Loader<DataType>({
327
373
  logError,
328
374
  loadingComponent,
329
375
  ...loaderProviderProps
330
- }: LoaderProps<DataType>): _$react_jsx_runtime0.JSX.Element;
331
- //#endregion
332
- //#region src/components/ModeToggle.d.ts
333
- /** A toggle to switch between dark mode and light mode. Must be used in a `ModeProvider`. */
334
- declare function ModeToggle(): _$react_jsx_runtime0.JSX.Element;
335
- //#endregion
336
- //#region src/components/NavigationBottom.d.ts
337
- interface NavItemBottom {
338
- /** The value associated with the nav item. */
339
- value: string;
340
- /** The label to display on the nav item. */
341
- label: string;
342
- /** An icon to display alongside the nav item. */
343
- icon?: JSX.Element;
344
- /** Where in your app the nav item should navigate to. */
345
- to: string;
346
- }
347
- interface NavigationBottomProps {
348
- /** Children to display above the nav bar. */
349
- children: ReactNode;
350
- /** An array of nav items to show. */
351
- navItems: Array<NavItemBottom>;
352
- }
353
- /** Renders a navigation bar at the bottom of the screen. Especially helpful for common navigation options in a mobile app. */
354
- declare function NavigationBottom({
355
- children,
356
- navItems
357
- }: NavigationBottomProps): _$react_jsx_runtime0.JSX.Element;
358
- //#endregion
359
- //#region src/components/Page.d.ts
360
- interface PageProps {
361
- /** The Page title to show */
362
- title: string;
363
- /** The subtitle to show under the Page title */
364
- subtitle?: string;
365
- /** The actions to show in the page header */
366
- action?: ReactNode;
367
- /** The actual page contents */
368
- children: ReactNode;
369
- }
370
- /** Renders a pre-styled Page that can be used to structure pages throughout your React apps. */
371
- declare function Page({
372
- title,
373
- subtitle,
374
- action,
375
- children
376
- }: PageProps): _$react_jsx_runtime0.JSX.Element;
376
+ }: QueryBoundaryProps<DataType>): _$react_jsx_runtime0.JSX.Element;
377
377
  //#endregion
378
378
  //#region src/components/ReactPlayground.d.ts
379
379
  interface ReactPlaygroundProps extends ComponentProps<typeof LiveProvider> {
@@ -630,6 +630,38 @@ declare function ListItemInternalLink({
630
630
  ...listItemButtonProps
631
631
  }: ListItemInternalLinkProps): _$react_jsx_runtime0.JSX.Element;
632
632
  //#endregion
633
+ //#region src/deprecated/LoaderData.d.ts
634
+ /** @deprecated This type has been renamed to QueryBoundaryDataProps. */
635
+ type LoaderDataProps<DataType> = QueryBoundaryDataProps<DataType>;
636
+ /** @deprecated This component has been renamed to QueryBoundaryData. */
637
+ declare const LoaderData: typeof QueryBoundaryData;
638
+ //#endregion
639
+ //#region src/deprecated/LoaderError.d.ts
640
+ /** @deprecated This type has been renamed to QueryBoundaryErrorBaseProps. */
641
+ type LoaderErrorBaseProps = QueryBoundaryErrorBaseProps;
642
+ /** @deprecated This type has been renamed to QueryBoundaryErrorPropsWithUndefinedOrNull. */
643
+ type LoaderErrorPropsWithUndefinedOrNull = QueryBoundaryErrorPropsWithUndefinedOrNull;
644
+ /** @deprecated This type has been renamed to QueryBoundaryErrorPropsWithNullable. */
645
+ type LoaderErrorPropsWithNullable = QueryBoundaryErrorPropsWithNullable;
646
+ /** @deprecated This type has been renamed to QueryBoundaryErrorProps. */
647
+ type LoaderErrorProps = QueryBoundaryErrorProps;
648
+ /** @deprecated This component has been renamed to LoaderError. */
649
+ declare const LoaderError: typeof QueryBoundaryError;
650
+ //#endregion
651
+ //#region src/deprecated/LoaderProvider.d.ts
652
+ /** @deprecated This type has been renamed to QueryBoundaryProviderBaseProps. */
653
+ type LoaderProviderBaseProps<DataType> = QueryBoundaryProviderBaseProps<DataType>;
654
+ /** @deprecated This type has been renamed to QueryBoundaryProviderPropsWithNoError. */
655
+ type LoaderProviderPropsWithNoError<DataType> = QueryBoundaryProviderPropsWithNoError<DataType>;
656
+ /** @deprecated This type has been renamed to QueryBoundaryProviderPropsWithError. */
657
+ type LoaderProviderPropsWithError<DataType> = QueryBoundaryProviderPropsWithError<DataType>;
658
+ /** @deprecated This type has been renamed to QueryBoundaryContextValue. */
659
+ type LoaderContextValue<DataType> = QueryBoundaryContextValue<DataType>;
660
+ /** @deprecated This type has been renamed to QueryBoundaryProviderProps. */
661
+ type LoaderProviderProps<DataType> = QueryBoundaryProviderProps<DataType>;
662
+ /** @deprecated This component has been renamed to QueryBoundaryProvider */
663
+ declare const LoaderProvider: typeof QueryBoundaryProvider;
664
+ //#endregion
633
665
  //#region src/deprecated/NavigationDrawer.d.ts
634
666
  interface NavMenuItemOptions {
635
667
  /** The label to display on the nav item option. */
@@ -710,5 +742,5 @@ declare function SubmitButton({
710
742
  */
711
743
  declare function useHash<StateType extends string>(initialHash: StateType | undefined): [StateType, Dispatch<SetStateAction<StateType>>];
712
744
  //#endregion
713
- export { Artwork, CollapsableItem, type CollapsableItemProps, ContextHookOptions, DarkModeToggle, DropdownMenu, DropdownMenu2, type DropdownMenu2Props, DropdownMenuExternalLink, DropdownMenuInternalLink, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, Loader, LoaderData, type LoaderDataProps, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, ModeProvider, type ModeProviderProps, ModeToggle, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, Page, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useDropdownMenu, useHash, useMode, useScreenSize, useSnackbar };
745
+ export { Artwork, CollapsableItem, type CollapsableItemProps, ContextHookOptions, DarkModeToggle, DropdownMenu, DropdownMenu2, type DropdownMenu2Props, DropdownMenuExternalLink, DropdownMenuInternalLink, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type LoaderContextValue, LoaderData, type LoaderDataProps, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, ModeProvider, type ModeProviderProps, ModeToggle, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, Page, PopoverText, type PopoverTextProps, QueryBoundary, QueryBoundaryData, type QueryBoundaryDataProps, QueryBoundaryError, type QueryBoundaryErrorBaseProps, type QueryBoundaryErrorProps, type QueryBoundaryErrorPropsWithNullable, type QueryBoundaryErrorPropsWithUndefinedOrNull, type QueryBoundaryProps, QueryBoundaryProvider, type QueryBoundaryProviderBaseProps, type QueryBoundaryProviderProps, type QueryBoundaryProviderPropsWithError, type QueryBoundaryProviderPropsWithNoError, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useDropdownMenu, useHash, useMode, useScreenSize, useSnackbar };
714
746
  //# sourceMappingURL=index.d.cts.map