@talogic/react 0.7.0 → 0.8.1

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,7 +1,7 @@
1
1
  import type { ComponentProps } from 'react';
2
2
  import { Toaster as Sonner } from 'sonner';
3
3
  /**
4
- * The shadcn/ui Toaster (Sonner), drawn with the Talogic tokens: popover colours, large elevation, 10 px radius.
4
+ * The shadcn/ui Toaster (Sonner), drawn with the talogic tokens: popover colours, large elevation, 10 px radius.
5
5
  * Mount one per app, then call `toast()` from `sonner`.
6
6
  *
7
7
  * @param props - Sonner Toaster props.
package/ui/index.d.ts CHANGED
@@ -10,5 +10,6 @@ export * from './layout';
10
10
  export * from './menu';
11
11
  export * from './navigation';
12
12
  export * from './overlay';
13
+ export * from './presence';
13
14
  export * from './sidebar';
14
15
  export * from './tags-input';
@@ -6,6 +6,6 @@ export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMe
6
6
  export { Pagination } from './pagination.component';
7
7
  export type { PaginationProps } from './pagination.component';
8
8
  export { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs.component';
9
- export type { TabsListProps, TabsTriggerProps, TabsVariant } from './tabs.component';
9
+ export type { TabsContentProps, TabsListProps, TabsTriggerProps, TabsVariant } from './tabs.component';
10
10
  export { Stepper } from './stepper.component';
11
11
  export type { StepperProps, StepperStep } from './stepper.component';
@@ -1,7 +1,8 @@
1
1
  import { NavigationMenu as NavigationMenuPrimitive } from 'radix-ui';
2
2
  import type { ComponentProps } from 'react';
3
3
  /**
4
- * The shadcn/ui NavigationMenu: the main navigation of a website, with drop-down panels.
4
+ * The shadcn/ui NavigationMenu: the main navigation of a website, with drop-down panels. The box of a panel drops
5
+ * into place while it fades in, and the panel content grows in it.
5
6
  *
6
7
  * @param props - Radix NavigationMenu root props.
7
8
  * @returns The navigation menu.
@@ -1,14 +1,16 @@
1
1
  import { Tabs as TabsPrimitive } from 'radix-ui';
2
2
  import { type ComponentProps } from 'react';
3
3
  /**
4
- * The Tabs root. When the active tab changes, it records on `data-direction` which way the indicator moved, so the
5
- * new panel slides in from that side: from the right for a tab further on, from the left for an earlier one, and
6
- * from below or above in a vertical list. The first panel does not move, and reduced motion keeps panels still.
4
+ * The Tabs root. When the active tab changes, the content of the new panel slides in with the indicator, from the
5
+ * side the indicator came from. It travels further than the indicator, in proportion to the size of the panel, so
6
+ * it moves faster, like a parallax. The panel frame stays in place and grows or shrinks from the old panel's height
7
+ * to the new one's in the same time. The first panel does not move. Reduced motion
8
+ * keeps panels still.
7
9
  *
8
10
  * @param props - Radix Tabs root props. `orientation="vertical"` puts the list beside the panels.
9
11
  * @returns The tabs.
10
12
  */
11
- export declare function Tabs({ className, value, defaultValue, onValueChange, orientation, ...props }: ComponentProps<typeof TabsPrimitive.Root>): import("react").JSX.Element;
13
+ export declare function Tabs({ className, style, children, value, defaultValue, onValueChange, orientation, ...props }: ComponentProps<typeof TabsPrimitive.Root>): import("react").JSX.Element;
12
14
  /** The look of a {@link TabsList}. */
13
15
  export type TabsVariant = 'pill' | 'underline' | 'outline';
14
16
  /** Props of {@link TabsList}. */
@@ -49,10 +51,18 @@ export interface TabsTriggerProps extends ComponentProps<typeof TabsPrimitive.Tr
49
51
  * @returns The tab.
50
52
  */
51
53
  export declare function TabsTrigger({ className, count, onClose, closeLabel, onKeyDown, children, value, ...props }: TabsTriggerProps): import("react").JSX.Element;
54
+ /** Props of {@link TabsContent}. */
55
+ export interface TabsContentProps extends ComponentProps<typeof TabsPrimitive.Content> {
56
+ /** Classes for the content inside the panel: its layout, such as `flex flex-col gap-4`. `className` styles the frame. */
57
+ bodyClassName?: string;
58
+ }
52
59
  /**
53
- * The panel of one tab. After a change it slides in from the side the indicator came from (see {@link Tabs}).
60
+ * The panel of one tab. The panel itself (its frame, from `className`) stays in place and eases from the old panel's
61
+ * height to its own. After a change, its content
62
+ * slides in with the indicator (see {@link Tabs}) and is clipped by the frame. With the `outline` list, the panel
63
+ * joins the list with no gap, so give it the side and bottom borders.
54
64
  *
55
- * @param props - Radix Tabs content props.
65
+ * @param props - `bodyClassName` and Radix Tabs content props.
56
66
  * @returns The panel.
57
67
  */
58
- export declare function TabsContent({ className, ...props }: ComponentProps<typeof TabsPrimitive.Content>): import("react").JSX.Element;
68
+ export declare function TabsContent({ className, bodyClassName, children, ...props }: TabsContentProps): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { Presence } from './presence.component';
2
+ export type { PresenceProps } from './presence.component';
3
+ export { presenceClassName } from './presence.recipe';
4
+ export type { PresenceAnimation } from './presence.recipe';
@@ -0,0 +1,21 @@
1
+ import { type ComponentProps } from 'react';
2
+ import { type PresenceAnimation } from './presence.recipe';
3
+ /** Props of {@link Presence}. */
4
+ export interface PresenceProps extends ComponentProps<'div'> {
5
+ /** Shows the content when true. When it turns false, the exit animation plays before the content goes. */
6
+ present: boolean;
7
+ /** The motion: `fade` (default), `scale` or `drop`. */
8
+ animation?: PresenceAnimation;
9
+ /** Removes the content from the DOM after the exit animation. Default true. When false, it is hidden instead. */
10
+ unmountOnExit?: boolean;
11
+ }
12
+ /**
13
+ * Shows and hides a box with an enter and an exit animation, like Chakra's Presence. When `present` turns true the
14
+ * box mounts and plays its enter animation. When `present` turns false it plays the exit animation, and only then
15
+ * leaves the DOM (or hides, with `unmountOnExit={false}`). Use it for content that appears in place, such as a
16
+ * notice, a details panel or a filter row. Overlays (dialogs, popovers, menus) already animate themselves.
17
+ *
18
+ * @param props - `present`, `animation`, `unmountOnExit` and any `div` props.
19
+ * @returns The animated box, or nothing once it has left.
20
+ */
21
+ export declare function Presence({ present, animation, unmountOnExit, className, onAnimationEnd, ...props }: PresenceProps): import("react").JSX.Element | null;
@@ -0,0 +1,8 @@
1
+ /** The motion of a {@link Presence}. */
2
+ export type PresenceAnimation = 'fade' | 'scale' | 'drop';
3
+ /**
4
+ * The enter and exit classes of each {@link PresenceAnimation}: `fade` fades, `scale` grows from 96 % while it
5
+ * fades (like popovers), `drop` falls 6 px into place while it fades (like the navigation menu). Reduced motion
6
+ * keeps only the fade.
7
+ */
8
+ export declare const presenceClassName: Record<PresenceAnimation, string>;
@@ -18,7 +18,7 @@ export interface SiteHeaderProps {
18
18
  nav: readonly SiteNavEntry[];
19
19
  /** The actions at the end, such as Sign in and Talk to us. */
20
20
  actions?: ReactNode;
21
- /** The brand at the start. Default the Talogic symbol and name, linking home. */
21
+ /** The brand at the start. Default the talogic symbol and name, linking home. */
22
22
  brand?: ReactNode;
23
23
  className?: string;
24
24
  }