@wavy/react-ui 0.0.49 → 0.0.51

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
@@ -6,7 +6,7 @@ import { NoUndefinedField, SafeOmit, FileDetails, Prettify, AddPrefix, TaskResul
6
6
  import { IconType } from 'react-icons';
7
7
  import * as CSS from 'csstype';
8
8
  import CSS__default from 'csstype';
9
- import { AvatarGroupProps as AvatarGroupProps$1, SpinnerProps as SpinnerProps$1, Drawer as Drawer$1, FileUpload, InputProps, InputAddonProps, InputElementProps, AvatarRootProps, FloatProps, CloseButtonProps, Dialog as Dialog$1, MenuRootProps, SegmentGroupRootProps, Steps, Tooltip as Tooltip$1, SeparatorProps as SeparatorProps$1 } from '@chakra-ui/react';
9
+ import { SwitchRootProps, AvatarGroupProps as AvatarGroupProps$1, SpinnerProps as SpinnerProps$1, Drawer as Drawer$1, FileUpload, InputProps, InputAddonProps, InputElementProps, AvatarRootProps, FloatProps, CloseButtonProps, Dialog as Dialog$1, MenuRootProps, SegmentGroupRootProps, Steps, Tooltip as Tooltip$1, SeparatorProps as SeparatorProps$1 } from '@chakra-ui/react';
10
10
  export { MenuRootProps, UseStepsProps, useSteps } from '@chakra-ui/react';
11
11
  import { JSX as JSX$1 } from '@emotion/react/jsx-runtime';
12
12
  import { StepsVariant } from 'node_modules/@chakra-ui/react/dist/types/styled-system/generated/recipes.gen';
@@ -1478,6 +1478,24 @@ interface BasicOptionProps extends Partial<Record<"leadingEl" | "trailingEl", Re
1478
1478
  }
1479
1479
  declare function BasicOption(props: BasicOptionProps): react_jsx_runtime.JSX.Element;
1480
1480
 
1481
+ interface SwitchProps extends Partial<Record<`${"track" | "thumb"}Indicator`, Partial<Record<"on" | "off", React__default.ReactNode>>>>, Partial<Record<`${"thumb" | "track"}Style`,
1482
+ /** Apply conditional styles based on the `checked` state. */
1483
+ (checked: boolean) => SafeOmit<CSS.Properties, "backgroundColor" | "color" | "borderColor"> & {
1484
+ backgroundColor?: BasicColor$1;
1485
+ color?: BasicColor$1;
1486
+ borderColor?: BasicColor$1;
1487
+ }>> {
1488
+ defaultChecked?: boolean;
1489
+ checked?: boolean;
1490
+ label?: string;
1491
+ disabled?: boolean;
1492
+ size?: SwitchRootProps["size"];
1493
+ /**@default "solid" */
1494
+ variant?: SwitchRootProps["variant"];
1495
+ onChange?: (checked: boolean) => void;
1496
+ }
1497
+ declare function Switch(props: SwitchProps): react_jsx_runtime.JSX.Element;
1498
+
1481
1499
  interface DebounceProps {
1482
1500
  /**@default 300 */
1483
1501
  delay?: number;
@@ -3292,23 +3310,71 @@ declare function usePostRenderEffect(effect: React__default.EffectCallback, deps
3292
3310
  interface ComputedStyleProps extends SafeOmit<BasicStyleProps, "className"> {
3293
3311
  children?: React__default.ReactNode;
3294
3312
  }
3295
- declare function useComputedStyle(elementTag: keyof HTMLElementTagNameMap, props: ComputedStyleProps, options?: Partial<{
3296
- debug: boolean;
3297
- inject: () => CSS.Properties;
3298
- }>): {
3313
+ declare function useComputedStyle(options: {
3314
+ /**@default "div" */
3315
+ tag?: keyof HTMLElementTagNameMap;
3316
+ style: ComputedStyleProps;
3317
+ inject?: () => CSS.Properties;
3318
+ }): {
3299
3319
  style: {
3300
3320
  [key: string]: string;
3301
3321
  };
3302
3322
  };
3303
3323
 
3304
- declare function useManagedRef<T extends NonFunction<any>>(initialValue: CastFn<T>, options?: Partial<{
3305
- onChange: (currentValue: T, previousValue: T) => void;
3324
+ type UpdaterFunction<T> = (value: T) => T;
3325
+ /** A more controlled state management hook */
3326
+ declare function useStore<T extends NonFunction<any>>(options: {
3327
+ /** The defaultValue of the store.
3328
+ * @note This can either be defined expicitly, or via the return value of an initializer function.
3329
+ * @warning Attempting to store a function will throw an error.
3330
+ */
3331
+ defaultValue: CastFn<T>;
3332
+ readOnly?: boolean;
3333
+ /**Re-renders the component when the value is changed
3334
+ * @default false
3335
+ */
3336
+ reactive?: boolean;
3337
+ /** Stores the data in either session-storage or local storage under the specified key
3338
+ * and attempts to fetch that data when the component first mounts. If no value is found,
3339
+ * the provided defaultValue is used.
3340
+ */
3341
+ persist?: {
3342
+ key: string;
3343
+ /**@default "session-storage" */
3344
+ storage?: "session-storage" | "local-storage";
3345
+ /**Delete the persisted data when the component unmounts
3346
+ * @default false */
3347
+ deleteOnUnmount?: boolean;
3348
+ };
3349
+ /** Determine if a value (post-transformation) should be stored.
3350
+ * @return whether the value should be stored or not
3351
+ */
3352
+ validate?: (value: T) => boolean;
3353
+ /** Called when the validate callback returns false
3354
+ * @param value The value that failed to pass validation
3355
+ */
3356
+ onValidationFail?: (value: T) => void;
3357
+ onChange?: (currentValue: T, previousValue: T) => void;
3306
3358
  /** Transform the updated value before the onChange method is called*/
3307
- transform: (value: T) => T;
3308
- }>): {
3359
+ transform?: (value: T) => T;
3360
+ }): {
3309
3361
  debug: () => Record<"difference" | "from" | "to", T | T[]>;
3310
- upsert: (value: T | ((value: T) => T)) => void;
3362
+ /**
3363
+ * @warning Attempting to store a function will throw an error.
3364
+ */
3365
+ upsert: (value: T | UpdaterFunction<T>, options?: Partial<{
3366
+ /** Skips the onChange callback for the store */
3367
+ skipOnChange: boolean;
3368
+ /** Skips re-rendering the store.
3369
+ * @note This is only effective when the store is reactive
3370
+ */
3371
+ skipRender: boolean;
3372
+ /** Skips the validate callback */
3373
+ skipValidation: boolean;
3374
+ bypassReadOnly: boolean;
3375
+ }>) => void;
3311
3376
  read: () => T;
3377
+ /** Completely removes all the stored data (including persisted data) */
3312
3378
  delete: () => void;
3313
3379
  };
3314
3380
 
@@ -3340,6 +3406,7 @@ declare function useRerender(): {
3340
3406
  triggerRerender: () => void;
3341
3407
  };
3342
3408
 
3409
+ /**@deprecated Migrate to useStore (set the reactive option to true, and configure the persist option) */
3343
3410
  declare function useSessionStorage<Value extends NonFunction<any>>(key: string, initialValue: Value): readonly [Value, (update: Value | ((previousValue: Value) => Value)) => void, () => void];
3344
3411
 
3345
3412
  declare function useEvent<EventMapper extends Record<string, any>>(options?: Partial<{
@@ -3357,7 +3424,7 @@ declare function useEvent<EventMapper extends Record<string, any>>(options?: Par
3357
3424
  dettach: (key: keyof EventMapper) => boolean;
3358
3425
  };
3359
3426
 
3360
- /**A hook that allows you to optionally skip re-rendering on state change */
3427
+ /**@deprecated Migrate to useStore */
3361
3428
  declare function useSmartState<T>(value?: CastFn<T>): readonly [T, (value: T | ((previousValue: T) => T), options?: {
3362
3429
  skipRender: boolean;
3363
3430
  }) => void];
@@ -3426,4 +3493,4 @@ declare function remAsPx(rem: number): string;
3426
3493
  declare function isOverflown(element: HTMLElement): boolean;
3427
3494
  declare function computedCssVariable(cssVariable: string): string;
3428
3495
 
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 };
3496
+ 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, Switch, type SwitchProps, 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 };