cekat-ui 1.2.3 → 1.2.5

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.
@@ -0,0 +1,4 @@
1
+ import { TabBrowserProps } from './tabbrowser.types';
2
+ import * as React from 'react';
3
+ declare const TabBrowser: React.ForwardRefExoticComponent<TabBrowserProps & React.RefAttributes<HTMLButtonElement>>;
4
+ export default TabBrowser;
@@ -0,0 +1,17 @@
1
+ import { TabBrowserBarProps } from './tabbrowser.types';
2
+ /**
3
+ * Pure layout for a row of TabBrowsers. It deliberately draws no divider — that belongs
4
+ * to whatever surface hosts the row, so it can span the full header width.
5
+ *
6
+ * No `gap` either: each tab reserves its own breathing room (see TAB_PADDING_X), which
7
+ * keeps spacing identical whether or not a tab is selected. A flex gap on top would read
8
+ * as dead space beside the selected tab only.
9
+ *
10
+ * Nor any height or leading space — how far the row sits from what's above it depends on
11
+ * the surface, so that stays with the caller.
12
+ */
13
+ declare const TabBrowserBar: {
14
+ ({ children, separators, trailingSlot, className }: TabBrowserBarProps): import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
17
+ export default TabBrowserBar;
@@ -0,0 +1,4 @@
1
+ import { default as TabBrowser } from './TabBrowser';
2
+ import { default as TabBrowserBar } from './TabBrowserBar';
3
+ export { TabBrowser, TabBrowserBar };
4
+ export type { TabBrowserProps, TabBrowserBarProps, TabBrowserType } from './tabbrowser.types';
@@ -0,0 +1,53 @@
1
+ /** Radius every corner turns through, in px — top corners and bottom flares alike. */
2
+ export declare const TAB_GIRTH = 9;
3
+ /** Outline weight, in px. Also the divider's thickness, which the flares hand off to. */
4
+ export declare const TAB_HAIRLINE = 1;
5
+ /**
6
+ * Label inset from the tab's box edge, in px, split between the button's padding and the
7
+ * fill's. Both states leave the same hairline on the button, so the split lands the same
8
+ * either way — selecting a tab neither resizes it nor shifts the row. Keep it that way:
9
+ * `max-width` tabs are `flex-1`, and flex-grow divides a row from bases that already
10
+ * include each item's padding, so a state-dependent button padding resizes the tab.
11
+ */
12
+ export declare const TAB_PADDING_X = 30;
13
+ /**
14
+ * Silhouette of a tab, with bottom corners flaring *outward* into the divider line.
15
+ * A border can't survive a clip, so the outline is the gap between two clipped layers —
16
+ * a border-colored box wrapped around a white one, both tracing this path at a
17
+ * different `inset`. Three things keep that gap even; none are safe to tidy away:
18
+ *
19
+ * - Only concentric arcs hold a constant weight through a turn, so the inner arc
20
+ * shrinks on the convex top corners but *grows* on the flares, which curve the other
21
+ * way. A uniformly inset box gets the flares ~40% bolder than the corners they meet.
22
+ * - Left to itself a flare runs tangent to the bottom edge, where the two curves meet
23
+ * at a point and the outline fades out short of the divider. The skirt lifts the
24
+ * outer arc 1px clear so it lands at full weight, as Figma's assets do (`…H0 V7.5…`).
25
+ * - Coordinates are box-relative, so the inner path leans 1px outside its own at the
26
+ * bottom corners. The fill can't paint there, which trims the skirt back to 1px.
27
+ *
28
+ * Without `shape()` the declaration is dropped and tabs fall back to the `rounded-t-lg`
29
+ * top corners in TabBrowser's base classes, 1px padding standing in as a border.
30
+ *
31
+ * Technique: https://master.dev/blog/modern-css-round-out-tabs/
32
+ */
33
+ export declare function tabOutlinePath(inset: number): string;
34
+ export declare const TAB_CLIP_OUTER: string;
35
+ export declare const TAB_CLIP_INNER: string;
36
+ /**
37
+ * `default` tabs size to their own label and sit at the head of a page. `max-width` tabs
38
+ * divide a row equally between them and run shorter, for tighter surfaces like a side panel.
39
+ *
40
+ * `padX` is the label's inset from the tab's box edge, split between the button and the fill
41
+ * — see Tab's ACTIVE_FILL/INACTIVE_FILL. Equal-width tabs centre their label anyway, so
42
+ * theirs only has to clear the flare reserve.
43
+ */
44
+ export declare const tabBrowserTypeMap: {
45
+ readonly default: {
46
+ readonly box: "h-12 shrink-0";
47
+ readonly padX: 30;
48
+ };
49
+ readonly 'max-width': {
50
+ readonly box: "h-9 min-w-px flex-1";
51
+ readonly padX: 9;
52
+ };
53
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Sizing variant, mirroring the design system's Tab Browser Base. `default` sizes each tab
4
+ * to its own label; `max-width` makes them equal-width and lets the row divide itself
5
+ * between them, which also runs them shorter.
6
+ */
7
+ export type TabBrowserType = 'default' | 'max-width';
8
+ /**
9
+ * Everything a `<button>` takes comes through — `id`, `aria-controls`, `tabIndex`,
10
+ * `onKeyDown`, `data-*`. The tab carries `role="tab"` but leaves selection and panel wiring
11
+ * to the caller, so those are the props they build it out of.
12
+ *
13
+ * `type` is the exception: it names the sizing variant here, and the rendered button is
14
+ * pinned to `type="button"` so it never submits a form it happens to sit in.
15
+ */
16
+ export interface TabBrowserProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
17
+ /** Whether this tab is the currently selected one. */
18
+ active?: boolean;
19
+ type?: TabBrowserType;
20
+ /** Icon rendered before the label. */
21
+ iconLeft?: React.ReactNode;
22
+ /** Rendered after the label, e.g. a status Badge. */
23
+ trailing?: React.ReactNode;
24
+ /** Shorthand for the native `title`, which wins if both are given. */
25
+ tooltip?: string;
26
+ children: React.ReactNode;
27
+ }
28
+ export interface TabBrowserBarProps {
29
+ children: React.ReactNode;
30
+ /** Renders a vertical divider between adjacent tabs. */
31
+ separators?: boolean;
32
+ /** Extra content pinned to the end of the row, e.g. a "+" add button or CTA buttons. */
33
+ trailingSlot?: React.ReactNode;
34
+ className?: string;
35
+ }
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from './components/AvatarGroup';
12
12
  export * from './components/AvatarLabelGroup';
13
13
  export * from './components/AvatarProfilePhoto';
14
14
  export * from './components/Tab';
15
+ export * from './components/TabBrowser';
15
16
  export * from './components/Input';
16
17
  export * from './components/Textarea';
17
18
  export * from './components/MultiSelectInput';