@wavy/react-ui 0.0.49 → 0.0.50

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/main.d.ts CHANGED
@@ -3301,14 +3301,58 @@ declare function useComputedStyle(elementTag: keyof HTMLElementTagNameMap, props
3301
3301
  };
3302
3302
  };
3303
3303
 
3304
- declare function useManagedRef<T extends NonFunction<any>>(initialValue: CastFn<T>, options?: Partial<{
3305
- onChange: (currentValue: T, previousValue: T) => void;
3304
+ type UpdaterFunction<T> = (value: T) => T;
3305
+ /** A more controlled state management hook */
3306
+ declare function useStore<T extends NonFunction<any>>(options: {
3307
+ /** The defaultValue of the store.
3308
+ * @note This can either be defined expicitly, or via the return value of an initializer function.
3309
+ * @warning Attempting to store a function will throw an error.
3310
+ */
3311
+ defaultValue: CastFn<T>;
3312
+ /**Re-renders the component when the value is changed
3313
+ * @default false
3314
+ */
3315
+ reactive?: boolean;
3316
+ /** Stores the data in either session-storage or local storage under the specified key
3317
+ * and attempts to fetch that data when the component first mounts. If no value is found,
3318
+ * the provided defaultValue is used.
3319
+ */
3320
+ persist?: {
3321
+ key: string;
3322
+ /**@default "session-storage" */
3323
+ storage?: "session-storage" | "local-storage";
3324
+ /**Delete the persisted data when the component unmounts
3325
+ * @default false */
3326
+ deleteOnUnmount?: boolean;
3327
+ };
3328
+ /** Determine if a value (post-transformation) should be stored.
3329
+ * @return whether the value should be stored or not
3330
+ */
3331
+ validate?: (value: T) => boolean;
3332
+ /** Called when the validate callback returns false
3333
+ * @param value The value that failed to pass validation
3334
+ */
3335
+ onValidationFail?: (value: T) => void;
3336
+ onChange?: (currentValue: T, previousValue: T) => void;
3306
3337
  /** Transform the updated value before the onChange method is called*/
3307
- transform: (value: T) => T;
3308
- }>): {
3338
+ transform?: (value: T) => T;
3339
+ }): {
3309
3340
  debug: () => Record<"difference" | "from" | "to", T | T[]>;
3310
- upsert: (value: T | ((value: T) => T)) => void;
3341
+ /**
3342
+ * @warning Attempting to store a function will throw an error.
3343
+ */
3344
+ upsert: (value: T | UpdaterFunction<T>, options?: Partial<{
3345
+ /** Skips the onChange callback for the store */
3346
+ skipOnChange: boolean;
3347
+ /** Skips re-rendering the store.
3348
+ * @note This is only effective when the store is reactive
3349
+ */
3350
+ skipRender: boolean;
3351
+ /** Skips the validate callback */
3352
+ skipValidation: boolean;
3353
+ }>) => void;
3311
3354
  read: () => T;
3355
+ /** Completely removes all the stored data (including persisted data) */
3312
3356
  delete: () => void;
3313
3357
  };
3314
3358
 
@@ -3426,4 +3470,4 @@ declare function remAsPx(rem: number): string;
3426
3470
  declare function isOverflown(element: HTMLElement): boolean;
3427
3471
  declare function computedCssVariable(cssVariable: string): string;
3428
3472
 
3429
- export { AttachmentsButton, AttachmentsDialog, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, BasicButton, type BasicColor$1 as BasicColor, BasicDiv, BasicImg, BasicOl, BasicOption, BasicSelect, BasicSpan, type BasicStyleProps, BasicTable, BasicTableProps, _default as Calendar, CalendarDialog, CancelButton, Card, CardProps, Checkbox, type CheckboxProps, ColorResources, type ComputedStyleProps, ConfirmationDialog, type ConfirmationDialogProps, CopyButton, CssColors, type CssProperties, CssShapes, CssSpacing, Debounce, type DebounceProps, DeleteButton, Dialog, DialogProps, Disclaimer, type DisclaimerProps, DownloadButton, Drawer, DrawerProps, EditButton, Editable, type EditableProps, EmailComposer, EmptyState, EmptyStateProps, ErrorTooltip, EventContainer, type EventContainerProps, ExpandableButton, FancyFormDialog, type FancyFormDialogProps, FileDropzone, type FileDropzoneProps, FileViewer, FileViewerProps, FontSize, Indicator, type IndicatorProps, type InlineCss, ItemInfo, type ItemInfoProps, JsonViewer, type JwtVerificationStatus, JwtVerifier, type JwtVerifierProps, MediaCard, MediaCardProps, Menu, type MenuPlacement, MoneyDisplayCard, NegativeButton, NextButton, NoButton, OpenButton, OptionsButton, PageIndicator, type PageIndicatorProps, PageSlider, type PageSliderProps, Paper, type PaperProps, PasteButton, PaymentOptionsButton, PaymentOptionsDialog, PictureUploader, Popover, type PopoverProps, PositiveButton, PreviousButton, ProfileCard, ProfileCardProps, ProgressBar, type ProgressBarProps, ReceiptCard, SaveButton, SearchTextField, SegmentedControls, type SegmentedControlsProps, SendButton, Separator, type SeparatorProps, SignInWidget, SimpleFormDialog, type SimpleFormDialogProps, Spinner, type SpinnerProps, Status, type StatusProps, Stepper, type StepperProps, SubmitButton, Tag, type TagProps, TaskLogger, TaskResultDialog, Terminal, TextField, type TextFieldProps, Timeline, TimelineProps, Tooltip, type TooltipPlacement, type TooltipProps, UploadButton, UploadReceiptButton, type UseModalControlsReturn, type UsePageSliderControllerReturn, UserProfile, VerifyButton, VerifyTextField, UiProvider as WavyUi, YesButton, YesNoButtonGroup, YesOrNoForm, applyBasicStyle, bankTransferPaymentOption, borderRadius, buildCSS, computedCssVariable, convertHexUnitTo256, cssTransition, definePaymentOption, disabledBorderRadius, dragElement, ellipsis, flexCenter, getFileIcon, getPaperDim, getScrollParent, hexToRgba, inAppPaymentOption, isOverflown, isSpanMultiLine, isValidHex, nativeEllipsis, noSpaceStyle, paperStyle, remAsPx, remToPx, resolveBasicColor, restrictLineCount, rgbToRgba, screenHasMaxWidth, screenHasMinWidth, solidBorder, stripHtml, tiledBackground, useAsyncEffect, useComputedStyle, useEvent, useManagedRef, useModalControls, usePageSliderController, usePopoverContext, usePostRenderEffect, useRerender, useSessionStorage, useSmartState };
3473
+ export { AttachmentsButton, AttachmentsDialog, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, BasicButton, type BasicColor$1 as BasicColor, BasicDiv, BasicImg, BasicOl, BasicOption, BasicSelect, BasicSpan, type BasicStyleProps, BasicTable, BasicTableProps, _default as Calendar, CalendarDialog, CancelButton, Card, CardProps, Checkbox, type CheckboxProps, ColorResources, type ComputedStyleProps, ConfirmationDialog, type ConfirmationDialogProps, CopyButton, CssColors, type CssProperties, CssShapes, CssSpacing, Debounce, type DebounceProps, DeleteButton, Dialog, DialogProps, Disclaimer, type DisclaimerProps, DownloadButton, Drawer, DrawerProps, EditButton, Editable, type EditableProps, EmailComposer, EmptyState, EmptyStateProps, ErrorTooltip, EventContainer, type EventContainerProps, ExpandableButton, FancyFormDialog, type FancyFormDialogProps, FileDropzone, type FileDropzoneProps, FileViewer, FileViewerProps, FontSize, Indicator, type IndicatorProps, type InlineCss, ItemInfo, type ItemInfoProps, JsonViewer, type JwtVerificationStatus, JwtVerifier, type JwtVerifierProps, MediaCard, MediaCardProps, Menu, type MenuPlacement, MoneyDisplayCard, NegativeButton, NextButton, NoButton, OpenButton, OptionsButton, PageIndicator, type PageIndicatorProps, PageSlider, type PageSliderProps, Paper, type PaperProps, PasteButton, PaymentOptionsButton, PaymentOptionsDialog, PictureUploader, Popover, type PopoverProps, PositiveButton, PreviousButton, ProfileCard, ProfileCardProps, ProgressBar, type ProgressBarProps, ReceiptCard, SaveButton, SearchTextField, SegmentedControls, type SegmentedControlsProps, SendButton, Separator, type SeparatorProps, SignInWidget, SimpleFormDialog, type SimpleFormDialogProps, Spinner, type SpinnerProps, Status, type StatusProps, Stepper, type StepperProps, SubmitButton, Tag, type TagProps, TaskLogger, TaskResultDialog, Terminal, TextField, type TextFieldProps, Timeline, TimelineProps, Tooltip, type TooltipPlacement, type TooltipProps, UploadButton, UploadReceiptButton, type UseModalControlsReturn, type UsePageSliderControllerReturn, UserProfile, VerifyButton, VerifyTextField, UiProvider as WavyUi, YesButton, YesNoButtonGroup, YesOrNoForm, applyBasicStyle, bankTransferPaymentOption, borderRadius, buildCSS, computedCssVariable, convertHexUnitTo256, cssTransition, definePaymentOption, disabledBorderRadius, dragElement, ellipsis, flexCenter, getFileIcon, getPaperDim, getScrollParent, hexToRgba, inAppPaymentOption, isOverflown, isSpanMultiLine, isValidHex, nativeEllipsis, noSpaceStyle, paperStyle, remAsPx, remToPx, resolveBasicColor, restrictLineCount, rgbToRgba, screenHasMaxWidth, screenHasMinWidth, solidBorder, stripHtml, tiledBackground, useAsyncEffect, useComputedStyle, useEvent, useModalControls, usePageSliderController, usePopoverContext, usePostRenderEffect, useRerender, useSessionStorage, useSmartState, useStore };