@lax-wp/design-system 0.3.1 → 0.3.2

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.
@@ -1,4 +1,4 @@
1
- import type { TSwitchProps, TTypeKey } from './types';
1
+ import type { TSwitchProps, TTypeKey, TNavigationUtils } from './types';
2
2
  import type { ReactNode } from 'react';
3
3
  type TProps<T extends TTypeKey> = TSwitchProps<T> & {
4
4
  iconsOnly?: boolean;
@@ -6,6 +6,7 @@ type TProps<T extends TTypeKey> = TSwitchProps<T> & {
6
6
  disableAnimation?: boolean;
7
7
  tabOptions?: ReactNode;
8
8
  color?: string;
9
+ navigationUtils?: TNavigationUtils;
9
10
  };
10
11
  declare const TabSwitch: <T extends TTypeKey>(props: TProps<T>) => import("react/jsx-runtime").JSX.Element;
11
12
  export default TabSwitch;
@@ -1,4 +1,4 @@
1
1
  export { default as TabSwitch } from './TabSwitch';
2
2
  export { Children as TabSwitchChildren } from './Children';
3
- export { useResolveTo } from './useResolveTo';
3
+ export { resolveTo } from './useResolveTo';
4
4
  export * from './types';
@@ -1,8 +1,11 @@
1
- import type { HTMLAttributes, ReactNode } from 'react';
2
- import type { LinkProps } from 'react-router-dom';
1
+ import type { ComponentType, HTMLAttributes, ReactNode } from 'react';
3
2
  export type THtmlButton = HTMLAttributes<HTMLButtonElement>;
4
3
  export type THtmlAnchor = HTMLAttributes<HTMLAnchorElement>;
5
- export type TBaseLinkProps = LinkProps & HTMLAttributes<HTMLAnchorElement>;
4
+ export type TBaseLinkProps = {
5
+ to: string;
6
+ className?: string;
7
+ children?: ReactNode;
8
+ } & HTMLAttributes<HTMLAnchorElement>;
6
9
  export type TChildrenElement = JSX.Element | JSX.Element[];
7
10
  export type TChildren = string | TChildrenElement | null;
8
11
  export type TSize = 'sm' | 'md' | 'lg';
@@ -14,6 +17,11 @@ export type TResolveToConfig = {
14
17
  resolver?(title?: string): string;
15
18
  onResolve?(searchParams?: URLSearchParams): void;
16
19
  };
20
+ export type TNavigationUtils = {
21
+ searchParams: URLSearchParams;
22
+ navigate: (path: string) => void;
23
+ LinkComponent: ComponentType<TBaseLinkProps>;
24
+ };
17
25
  export type TPassedProps<T extends string = string> = {
18
26
  linkConfig?: TResolveToConfig;
19
27
  size?: TSize;
@@ -1,2 +1,2 @@
1
1
  import type { TResolveToConfig } from './types';
2
- export declare const useResolveTo: (title: string, config?: TResolveToConfig) => string;
2
+ export declare const resolveTo: (title: string, searchParams: URLSearchParams, config?: TResolveToConfig) => string;
@@ -1,4 +1,5 @@
1
1
  import type { CommonContextProps, SetTabSettingsAction, TabSettingSelector, TabUtilServices, TBaseTabProps, TPassedProps, TSuffixRecord } from './types';
2
+ import type { TNavigationUtils } from '../tab-switch/types';
2
3
  import type { ReactNode, ComponentType } from 'react';
3
4
  import type { OptionButtonProps } from '../../buttons/option-button/OptionButton';
4
5
  /**
@@ -118,13 +119,8 @@ export type TabsProps<T extends string> = TBaseTabProps<T> & TPassedProps & {
118
119
  useEventListener?: (event: string, handler: () => void) => void;
119
120
  /** External components required by Tabs */
120
121
  components: TabsExternalComponents;
121
- /** Navigation function (optional, required if linkConfig is provided) */
122
- navigate?: (options: {
123
- pathname: string;
124
- search: string;
125
- }) => void;
126
- /** Search params (optional, used with linkConfig) */
127
- searchParams?: URLSearchParams;
122
+ /** Navigation utilities (searchParams, navigate, LinkComponent) - optional, only needed if using linkConfig */
123
+ navigationUtils?: TNavigationUtils;
128
124
  };
129
125
  /**
130
126
  * Tabs Component
@@ -159,4 +155,4 @@ export type TabsProps<T extends string> = TBaseTabProps<T> & TPassedProps & {
159
155
  * />
160
156
  * ```
161
157
  */
162
- export declare const Tabs: <T extends string>({ variant, linkConfig, tabs, activeTab, onTabClick, suffixRecord, isLoading, size, className, draggable, tabKey, parentContainer, showAllItems, copyLink, isDisabled, color, iconsOnly, tabIcons, height, fullWidth, fitContentWidth, onDelete, onEdit, allowPin, sortAlphabetically, rightSection, contextProps, selectTabSetting, setTabSettingsAction, utilServices, dispatch, systemMessages, formatNumber, randomHexString, useEventListener, components, navigate: navigateProp, searchParams: searchParamsProp, }: TabsProps<T>) => import("react/jsx-runtime").JSX.Element;
158
+ export declare const Tabs: <T extends string>({ variant, linkConfig, tabs, activeTab, onTabClick, suffixRecord, isLoading, size, className, draggable, tabKey, parentContainer, showAllItems, copyLink, isDisabled, color, iconsOnly, tabIcons, height, fullWidth, fitContentWidth, onDelete, onEdit, allowPin, sortAlphabetically, rightSection, contextProps, selectTabSetting, setTabSettingsAction, utilServices, dispatch, systemMessages, formatNumber, randomHexString, useEventListener, components, navigationUtils, }: TabsProps<T>) => import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -71,8 +71,8 @@ export { default as TabDragOverlay } from "./components/buttons/tab-drag-overlay
71
71
  export type { TabDragOverlayProps, } from "./components/buttons/tab-drag-overlay/TabDragOverlay";
72
72
  export { FloatingBar } from "./components/floating-bar/FloatingBar";
73
73
  export type { FloatingBarProps, FloatingBarActionConfig, FloatingBarDeleteConfig, FloatingBarSize, FloatingBarPosition, FloatingBarTheme, } from "./components/floating-bar/FloatingBar";
74
- export { TabSwitch, TabSwitchChildren, useResolveTo } from "./components/navigation/tab-switch";
75
- export type { TSwitchProps, TTypeKey, TResolveToConfig, TPassedProps as TabSwitchPassedProps, TSharedProps, TChildrenProps, TSuffixRecord, TSize, TabVariant as TabSwitchVariant, THtmlButton, THtmlAnchor, TBaseLinkProps, } from "./components/navigation/tab-switch";
74
+ export { TabSwitch, TabSwitchChildren, resolveTo } from "./components/navigation/tab-switch";
75
+ export type { TSwitchProps, TTypeKey, TResolveToConfig, TPassedProps as TabSwitchPassedProps, TSharedProps, TChildrenProps, TSuffixRecord, TSize, TabVariant as TabSwitchVariant, THtmlButton, THtmlAnchor, TBaseLinkProps, TNavigationUtils, } from "./components/navigation/tab-switch";
76
76
  export { Tabs, SortableTab, DropableWrapper } from "./components/navigation/tabs";
77
77
  export type { TabsProps, TabsExternalComponents, Tab, TBaseTabProps, TPassedProps, TabVariant, TabSetting, TabUtilServices, TabSettingSelector, SetTabSettingsAction, CommonContextProps, } from "./components/navigation/tabs";
78
78
  export { useOutsideClick } from "./hooks/useOutsideClick";