@geomak/ui 6.27.3 → 6.28.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.cjs +114 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -1
- package/dist/index.d.ts +81 -1
- package/dist/index.js +111 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4941,6 +4941,86 @@ declare const FormContext: React$1.Context<FormStore>;
|
|
|
4941
4941
|
/** Read the enclosing `<Form>`'s store. Throws if used outside a `<Form>`. */
|
|
4942
4942
|
declare function useFormStore(): FormStore;
|
|
4943
4943
|
|
|
4944
|
+
type SetValue<T> = (value: T | ((prev: T) => T)) => void;
|
|
4945
|
+
/**
|
|
4946
|
+
* Persist React state to `localStorage`, JSON-serialised. SSR-safe (falls back
|
|
4947
|
+
* to `initialValue` when `window` is absent), and synced both **across tabs**
|
|
4948
|
+
* (the native `storage` event) and **across hook instances in the same tab**
|
|
4949
|
+
* (a custom event), so two components on the same key stay consistent.
|
|
4950
|
+
*
|
|
4951
|
+
* @returns `[value, setValue, remove]` — `setValue` accepts a value or an
|
|
4952
|
+
* updater, like `useState`; `remove` deletes the key and resets to initial.
|
|
4953
|
+
*
|
|
4954
|
+
* @example
|
|
4955
|
+
* const [theme, setTheme, clearTheme] = useLocalStorage('theme', 'system')
|
|
4956
|
+
* setTheme('dark')
|
|
4957
|
+
* setTheme((t) => (t === 'dark' ? 'light' : 'dark'))
|
|
4958
|
+
*/
|
|
4959
|
+
declare function useLocalStorage<T>(key: string, initialValue: T): [T, SetValue<T>, () => void];
|
|
4960
|
+
|
|
4961
|
+
/**
|
|
4962
|
+
* Track a CSS media query reactively. SSR-safe (returns `false` until mounted /
|
|
4963
|
+
* when `matchMedia` is unavailable) and updates as the match changes.
|
|
4964
|
+
*
|
|
4965
|
+
* @example
|
|
4966
|
+
* const isWide = useMediaQuery('(min-width: 1024px)')
|
|
4967
|
+
* const reduced = useMediaQuery('(prefers-reduced-motion: reduce)')
|
|
4968
|
+
* const dark = useMediaQuery('(prefers-color-scheme: dark)')
|
|
4969
|
+
*/
|
|
4970
|
+
declare function useMediaQuery(query: string): boolean;
|
|
4971
|
+
declare const BREAKPOINTS: {
|
|
4972
|
+
readonly sm: 480;
|
|
4973
|
+
readonly md: 768;
|
|
4974
|
+
readonly lg: 976;
|
|
4975
|
+
readonly xl: 1440;
|
|
4976
|
+
};
|
|
4977
|
+
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
4978
|
+
interface BreakpointState {
|
|
4979
|
+
/** ≥ 480px */ sm: boolean;
|
|
4980
|
+
/** ≥ 768px */ md: boolean;
|
|
4981
|
+
/** ≥ 976px */ lg: boolean;
|
|
4982
|
+
/** ≥ 1440px */ xl: boolean;
|
|
4983
|
+
/** The largest matched breakpoint, or `'base'` below `sm`. */
|
|
4984
|
+
active: 'base' | Breakpoint;
|
|
4985
|
+
}
|
|
4986
|
+
/**
|
|
4987
|
+
* Reactive view of the library's responsive breakpoints (matching the Tailwind
|
|
4988
|
+
* `screens`). Each flag is a min-width match; `active` is the largest one met.
|
|
4989
|
+
*
|
|
4990
|
+
* @example
|
|
4991
|
+
* const { md, active } = useBreakpoint()
|
|
4992
|
+
* if (!md) return <MobileNav /> // below 768px
|
|
4993
|
+
*/
|
|
4994
|
+
declare function useBreakpoint(): BreakpointState;
|
|
4995
|
+
|
|
4996
|
+
interface JwtResult<T> {
|
|
4997
|
+
/** Decoded claims (payload), or `null` if absent / unparseable. */
|
|
4998
|
+
payload: T | null;
|
|
4999
|
+
/** Decoded header, or `null`. */
|
|
5000
|
+
header: Record<string, unknown> | null;
|
|
5001
|
+
/** Expiry as a Date (from the `exp` claim), or `null` if none. */
|
|
5002
|
+
expiresAt: Date | null;
|
|
5003
|
+
/** True once `exp` is in the past. `false` when there's no `exp`. */
|
|
5004
|
+
isExpired: boolean;
|
|
5005
|
+
/** Parseable payload AND not expired. */
|
|
5006
|
+
isValid: boolean;
|
|
5007
|
+
/** The original token. */
|
|
5008
|
+
raw: string | null;
|
|
5009
|
+
}
|
|
5010
|
+
/**
|
|
5011
|
+
* Decode a JWT client-side and track its expiry reactively. The hook
|
|
5012
|
+
* re-renders exactly when the token crosses its `exp`, so `isExpired` / `isValid`
|
|
5013
|
+
* flip on their own without polling.
|
|
5014
|
+
*
|
|
5015
|
+
* Decodes only — it never verifies the signature. Treat the result as a UI hint;
|
|
5016
|
+
* real authorization belongs on the server. Pairs with `SecureLayout`.
|
|
5017
|
+
*
|
|
5018
|
+
* @example
|
|
5019
|
+
* const { payload, isValid, expiresAt } = useJwt(token)
|
|
5020
|
+
* if (!isValid) redirectToLogin()
|
|
5021
|
+
*/
|
|
5022
|
+
declare function useJwt<T = Record<string, unknown>>(token: string | null | undefined): JwtResult<T>;
|
|
5023
|
+
|
|
4944
5024
|
/**
|
|
4945
5025
|
* Zero-dependency credit-card helpers: brand detection, Luhn checksum, and
|
|
4946
5026
|
* display formatting. Pure functions — no React, no deps — so they're unit
|
|
@@ -4983,4 +5063,4 @@ declare function expiryError(value: string, now?: Date): string | undefined;
|
|
|
4983
5063
|
/** Validate the CVV against the detected brand's expected length. */
|
|
4984
5064
|
declare function cvvError(value: string, cardNumber: string): string | undefined;
|
|
4985
5065
|
|
|
4986
|
-
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CARD_BRANDS, Calendar, type CalendarEvent, type CalendarProps, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, ColorPicker, type ColorPickerProps, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, EmptyCart, type EmptyCartProps, type ErrorMap, type ExpandRowOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridProps, Icon, IconButton, type IconButtonProps, Kbd, type KbdProps, type KbdSize, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Password, type PasswordProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, RadioGroup, type RadioGroupProps, type RadioOption, Rating, type RatingProps, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, Slider, type SliderMark, type SliderProps, type SliderValue, type Spacing, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type ValidateTrigger, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useCart, useFieldArray, useForm, useFormField, useFormStore, useNotification };
|
|
5066
|
+
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, type Breakpoint, type BreakpointState, Button, type ButtonProps, CARD_BRANDS, Calendar, type CalendarEvent, type CalendarProps, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, ColorPicker, type ColorPickerProps, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, EmptyCart, type EmptyCartProps, type ErrorMap, type ExpandRowOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridProps, Icon, IconButton, type IconButtonProps, type JwtResult, Kbd, type KbdProps, type KbdSize, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Password, type PasswordProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, RadioGroup, type RadioGroupProps, type RadioOption, Rating, type RatingProps, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, Slider, type SliderMark, type SliderProps, type SliderValue, type Spacing, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type ValidateTrigger, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
|
package/dist/index.d.ts
CHANGED
|
@@ -4941,6 +4941,86 @@ declare const FormContext: React$1.Context<FormStore>;
|
|
|
4941
4941
|
/** Read the enclosing `<Form>`'s store. Throws if used outside a `<Form>`. */
|
|
4942
4942
|
declare function useFormStore(): FormStore;
|
|
4943
4943
|
|
|
4944
|
+
type SetValue<T> = (value: T | ((prev: T) => T)) => void;
|
|
4945
|
+
/**
|
|
4946
|
+
* Persist React state to `localStorage`, JSON-serialised. SSR-safe (falls back
|
|
4947
|
+
* to `initialValue` when `window` is absent), and synced both **across tabs**
|
|
4948
|
+
* (the native `storage` event) and **across hook instances in the same tab**
|
|
4949
|
+
* (a custom event), so two components on the same key stay consistent.
|
|
4950
|
+
*
|
|
4951
|
+
* @returns `[value, setValue, remove]` — `setValue` accepts a value or an
|
|
4952
|
+
* updater, like `useState`; `remove` deletes the key and resets to initial.
|
|
4953
|
+
*
|
|
4954
|
+
* @example
|
|
4955
|
+
* const [theme, setTheme, clearTheme] = useLocalStorage('theme', 'system')
|
|
4956
|
+
* setTheme('dark')
|
|
4957
|
+
* setTheme((t) => (t === 'dark' ? 'light' : 'dark'))
|
|
4958
|
+
*/
|
|
4959
|
+
declare function useLocalStorage<T>(key: string, initialValue: T): [T, SetValue<T>, () => void];
|
|
4960
|
+
|
|
4961
|
+
/**
|
|
4962
|
+
* Track a CSS media query reactively. SSR-safe (returns `false` until mounted /
|
|
4963
|
+
* when `matchMedia` is unavailable) and updates as the match changes.
|
|
4964
|
+
*
|
|
4965
|
+
* @example
|
|
4966
|
+
* const isWide = useMediaQuery('(min-width: 1024px)')
|
|
4967
|
+
* const reduced = useMediaQuery('(prefers-reduced-motion: reduce)')
|
|
4968
|
+
* const dark = useMediaQuery('(prefers-color-scheme: dark)')
|
|
4969
|
+
*/
|
|
4970
|
+
declare function useMediaQuery(query: string): boolean;
|
|
4971
|
+
declare const BREAKPOINTS: {
|
|
4972
|
+
readonly sm: 480;
|
|
4973
|
+
readonly md: 768;
|
|
4974
|
+
readonly lg: 976;
|
|
4975
|
+
readonly xl: 1440;
|
|
4976
|
+
};
|
|
4977
|
+
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
4978
|
+
interface BreakpointState {
|
|
4979
|
+
/** ≥ 480px */ sm: boolean;
|
|
4980
|
+
/** ≥ 768px */ md: boolean;
|
|
4981
|
+
/** ≥ 976px */ lg: boolean;
|
|
4982
|
+
/** ≥ 1440px */ xl: boolean;
|
|
4983
|
+
/** The largest matched breakpoint, or `'base'` below `sm`. */
|
|
4984
|
+
active: 'base' | Breakpoint;
|
|
4985
|
+
}
|
|
4986
|
+
/**
|
|
4987
|
+
* Reactive view of the library's responsive breakpoints (matching the Tailwind
|
|
4988
|
+
* `screens`). Each flag is a min-width match; `active` is the largest one met.
|
|
4989
|
+
*
|
|
4990
|
+
* @example
|
|
4991
|
+
* const { md, active } = useBreakpoint()
|
|
4992
|
+
* if (!md) return <MobileNav /> // below 768px
|
|
4993
|
+
*/
|
|
4994
|
+
declare function useBreakpoint(): BreakpointState;
|
|
4995
|
+
|
|
4996
|
+
interface JwtResult<T> {
|
|
4997
|
+
/** Decoded claims (payload), or `null` if absent / unparseable. */
|
|
4998
|
+
payload: T | null;
|
|
4999
|
+
/** Decoded header, or `null`. */
|
|
5000
|
+
header: Record<string, unknown> | null;
|
|
5001
|
+
/** Expiry as a Date (from the `exp` claim), or `null` if none. */
|
|
5002
|
+
expiresAt: Date | null;
|
|
5003
|
+
/** True once `exp` is in the past. `false` when there's no `exp`. */
|
|
5004
|
+
isExpired: boolean;
|
|
5005
|
+
/** Parseable payload AND not expired. */
|
|
5006
|
+
isValid: boolean;
|
|
5007
|
+
/** The original token. */
|
|
5008
|
+
raw: string | null;
|
|
5009
|
+
}
|
|
5010
|
+
/**
|
|
5011
|
+
* Decode a JWT client-side and track its expiry reactively. The hook
|
|
5012
|
+
* re-renders exactly when the token crosses its `exp`, so `isExpired` / `isValid`
|
|
5013
|
+
* flip on their own without polling.
|
|
5014
|
+
*
|
|
5015
|
+
* Decodes only — it never verifies the signature. Treat the result as a UI hint;
|
|
5016
|
+
* real authorization belongs on the server. Pairs with `SecureLayout`.
|
|
5017
|
+
*
|
|
5018
|
+
* @example
|
|
5019
|
+
* const { payload, isValid, expiresAt } = useJwt(token)
|
|
5020
|
+
* if (!isValid) redirectToLogin()
|
|
5021
|
+
*/
|
|
5022
|
+
declare function useJwt<T = Record<string, unknown>>(token: string | null | undefined): JwtResult<T>;
|
|
5023
|
+
|
|
4944
5024
|
/**
|
|
4945
5025
|
* Zero-dependency credit-card helpers: brand detection, Luhn checksum, and
|
|
4946
5026
|
* display formatting. Pure functions — no React, no deps — so they're unit
|
|
@@ -4983,4 +5063,4 @@ declare function expiryError(value: string, now?: Date): string | undefined;
|
|
|
4983
5063
|
/** Validate the CVV against the detected brand's expected length. */
|
|
4984
5064
|
declare function cvvError(value: string, cardNumber: string): string | undefined;
|
|
4985
5065
|
|
|
4986
|
-
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CARD_BRANDS, Calendar, type CalendarEvent, type CalendarProps, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, ColorPicker, type ColorPickerProps, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, EmptyCart, type EmptyCartProps, type ErrorMap, type ExpandRowOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridProps, Icon, IconButton, type IconButtonProps, Kbd, type KbdProps, type KbdSize, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Password, type PasswordProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, RadioGroup, type RadioGroupProps, type RadioOption, Rating, type RatingProps, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, Slider, type SliderMark, type SliderProps, type SliderValue, type Spacing, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type ValidateTrigger, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useCart, useFieldArray, useForm, useFormField, useFormStore, useNotification };
|
|
5066
|
+
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, type Breakpoint, type BreakpointState, Button, type ButtonProps, CARD_BRANDS, Calendar, type CalendarEvent, type CalendarProps, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, ColorPicker, type ColorPickerProps, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, EmptyCart, type EmptyCartProps, type ErrorMap, type ExpandRowOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridProps, Icon, IconButton, type IconButtonProps, type JwtResult, Kbd, type KbdProps, type KbdSize, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Password, type PasswordProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, RadioGroup, type RadioGroupProps, type RadioOption, Rating, type RatingProps, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, Slider, type SliderMark, type SliderProps, type SliderValue, type Spacing, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type ValidateTrigger, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
|
package/dist/index.js
CHANGED
|
@@ -9125,7 +9125,117 @@ function ColorPicker({
|
|
|
9125
9125
|
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: valid ? value : "" })
|
|
9126
9126
|
] });
|
|
9127
9127
|
}
|
|
9128
|
+
var CUSTOM_EVENT = "oxy-local-storage";
|
|
9129
|
+
function useLocalStorage(key, initialValue) {
|
|
9130
|
+
const read = useCallback(() => {
|
|
9131
|
+
if (typeof window === "undefined") return initialValue;
|
|
9132
|
+
try {
|
|
9133
|
+
const item = window.localStorage.getItem(key);
|
|
9134
|
+
return item != null ? JSON.parse(item) : initialValue;
|
|
9135
|
+
} catch {
|
|
9136
|
+
return initialValue;
|
|
9137
|
+
}
|
|
9138
|
+
}, [key]);
|
|
9139
|
+
const [stored, setStored] = useState(read);
|
|
9140
|
+
const setValue = useCallback((value) => {
|
|
9141
|
+
setStored((prev) => {
|
|
9142
|
+
const next = value instanceof Function ? value(prev) : value;
|
|
9143
|
+
try {
|
|
9144
|
+
if (typeof window !== "undefined") {
|
|
9145
|
+
window.localStorage.setItem(key, JSON.stringify(next));
|
|
9146
|
+
window.dispatchEvent(new CustomEvent(CUSTOM_EVENT, { detail: key }));
|
|
9147
|
+
}
|
|
9148
|
+
} catch {
|
|
9149
|
+
}
|
|
9150
|
+
return next;
|
|
9151
|
+
});
|
|
9152
|
+
}, [key]);
|
|
9153
|
+
const remove = useCallback(() => {
|
|
9154
|
+
try {
|
|
9155
|
+
if (typeof window !== "undefined") {
|
|
9156
|
+
window.localStorage.removeItem(key);
|
|
9157
|
+
window.dispatchEvent(new CustomEvent(CUSTOM_EVENT, { detail: key }));
|
|
9158
|
+
}
|
|
9159
|
+
} catch {
|
|
9160
|
+
}
|
|
9161
|
+
setStored(initialValue);
|
|
9162
|
+
}, [key]);
|
|
9163
|
+
useEffect(() => {
|
|
9164
|
+
setStored(read());
|
|
9165
|
+
}, [key, read]);
|
|
9166
|
+
useEffect(() => {
|
|
9167
|
+
if (typeof window === "undefined") return;
|
|
9168
|
+
const onStorage = (e) => {
|
|
9169
|
+
if (e.key === null || e.key === key) setStored(read());
|
|
9170
|
+
};
|
|
9171
|
+
const onCustom = (e) => {
|
|
9172
|
+
if (e.detail === key) setStored(read());
|
|
9173
|
+
};
|
|
9174
|
+
window.addEventListener("storage", onStorage);
|
|
9175
|
+
window.addEventListener(CUSTOM_EVENT, onCustom);
|
|
9176
|
+
return () => {
|
|
9177
|
+
window.removeEventListener("storage", onStorage);
|
|
9178
|
+
window.removeEventListener(CUSTOM_EVENT, onCustom);
|
|
9179
|
+
};
|
|
9180
|
+
}, [key, read]);
|
|
9181
|
+
return [stored, setValue, remove];
|
|
9182
|
+
}
|
|
9183
|
+
function useMediaQuery(query) {
|
|
9184
|
+
const get = () => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query).matches : false;
|
|
9185
|
+
const [matches, setMatches] = useState(get);
|
|
9186
|
+
useEffect(() => {
|
|
9187
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
9188
|
+
const mql = window.matchMedia(query);
|
|
9189
|
+
const onChange = () => setMatches(mql.matches);
|
|
9190
|
+
onChange();
|
|
9191
|
+
mql.addEventListener("change", onChange);
|
|
9192
|
+
return () => mql.removeEventListener("change", onChange);
|
|
9193
|
+
}, [query]);
|
|
9194
|
+
return matches;
|
|
9195
|
+
}
|
|
9196
|
+
var BREAKPOINTS = { sm: 480, md: 768, lg: 976, xl: 1440 };
|
|
9197
|
+
function useBreakpoint() {
|
|
9198
|
+
const sm = useMediaQuery(`(min-width: ${BREAKPOINTS.sm}px)`);
|
|
9199
|
+
const md = useMediaQuery(`(min-width: ${BREAKPOINTS.md}px)`);
|
|
9200
|
+
const lg = useMediaQuery(`(min-width: ${BREAKPOINTS.lg}px)`);
|
|
9201
|
+
const xl = useMediaQuery(`(min-width: ${BREAKPOINTS.xl}px)`);
|
|
9202
|
+
const active = xl ? "xl" : lg ? "lg" : md ? "md" : sm ? "sm" : "base";
|
|
9203
|
+
return { sm, md, lg, xl, active };
|
|
9204
|
+
}
|
|
9205
|
+
function decodeSegment(seg) {
|
|
9206
|
+
if (!seg || typeof atob === "undefined") return null;
|
|
9207
|
+
try {
|
|
9208
|
+
const json = decodeURIComponent(
|
|
9209
|
+
atob(seg.replace(/-/g, "+").replace(/_/g, "/")).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join("")
|
|
9210
|
+
);
|
|
9211
|
+
return JSON.parse(json);
|
|
9212
|
+
} catch {
|
|
9213
|
+
return null;
|
|
9214
|
+
}
|
|
9215
|
+
}
|
|
9216
|
+
function useJwt(token) {
|
|
9217
|
+
const [, tick] = useState(0);
|
|
9218
|
+
const decoded = useMemo(() => {
|
|
9219
|
+
if (!token) return { payload: null, header: null, exp: null };
|
|
9220
|
+
const [h, p] = token.split(".");
|
|
9221
|
+
const header = decodeSegment(h);
|
|
9222
|
+
const payload = decodeSegment(p);
|
|
9223
|
+
const exp = payload && typeof payload.exp === "number" ? payload.exp : null;
|
|
9224
|
+
return { payload, header, exp };
|
|
9225
|
+
}, [token]);
|
|
9226
|
+
useEffect(() => {
|
|
9227
|
+
if (decoded.exp == null) return;
|
|
9228
|
+
const ms = decoded.exp * 1e3 - Date.now();
|
|
9229
|
+
if (ms <= 0) return;
|
|
9230
|
+
const id = setTimeout(() => tick((n) => n + 1), ms + 50);
|
|
9231
|
+
return () => clearTimeout(id);
|
|
9232
|
+
}, [decoded.exp]);
|
|
9233
|
+
const expiresAt = decoded.exp != null ? new Date(decoded.exp * 1e3) : null;
|
|
9234
|
+
const isExpired = decoded.exp != null ? decoded.exp * 1e3 <= Date.now() : false;
|
|
9235
|
+
const isValid = decoded.payload != null && !isExpired;
|
|
9236
|
+
return { payload: decoded.payload, header: decoded.header, expiresAt, isExpired, isValid, raw: token ?? null };
|
|
9237
|
+
}
|
|
9128
9238
|
|
|
9129
|
-
export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Box, Breadcrumbs, Button_default as Button, CARD_BRANDS, Calendar2 as Calendar, Card_default as Card, CardCarousel, Cart, CartButton, CartProvider, Catalog, CatalogCarousel, CatalogGrid, Checkbox, Checkout, ColorPicker, ContextMenu, CreditCardForm, DateRangePicker, Drawer, Dropdown, EmptyCart, FAB, FadingBase, Field, FieldHelpIcon, FieldLabel, FileInput, Flex, Form, FormContext, FormField, FormStore, Grid2 as Grid, GridCard, icons_default as Icon, IconButton, Kbd, List2 as List, LoadingSpinner, LogoutTimer, MegaMenu_default as MegaMenu, MenuButton, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Password, PopConfirm, Portal, RadioGroup, Rating, ScalableContainer, Scheduler, SearchInput_default as SearchInput, SecureLayout, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, Slider, Statistic, Stepper, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Timeline, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Wizard, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useCart, useFieldArray, useForm, useFormField, useFormStore, useNotification };
|
|
9239
|
+
export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Box, Breadcrumbs, Button_default as Button, CARD_BRANDS, Calendar2 as Calendar, Card_default as Card, CardCarousel, Cart, CartButton, CartProvider, Catalog, CatalogCarousel, CatalogGrid, Checkbox, Checkout, ColorPicker, ContextMenu, CreditCardForm, DateRangePicker, Drawer, Dropdown, EmptyCart, FAB, FadingBase, Field, FieldHelpIcon, FieldLabel, FileInput, Flex, Form, FormContext, FormField, FormStore, Grid2 as Grid, GridCard, icons_default as Icon, IconButton, Kbd, List2 as List, LoadingSpinner, LogoutTimer, MegaMenu_default as MegaMenu, MenuButton, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Password, PopConfirm, Portal, RadioGroup, Rating, ScalableContainer, Scheduler, SearchInput_default as SearchInput, SecureLayout, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, Slider, Statistic, Stepper, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Timeline, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Wizard, cardNumberError, cvvError, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
|
|
9130
9240
|
//# sourceMappingURL=index.js.map
|
|
9131
9241
|
//# sourceMappingURL=index.js.map
|