@stll/ui 0.74.0 → 0.76.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/components/button-classes.d.ts +45 -0
- package/dist/components/button-classes.js +49 -0
- package/dist/components/button.d.ts +1 -3
- package/dist/components/button.js +8 -43
- package/dist/components/checkbox.js +1 -1
- package/dist/components/composer-tokens.d.ts +9 -1
- package/dist/components/composer-tokens.js +9 -1
- package/dist/components/composer.d.ts +2 -2
- package/dist/components/composer.js +4 -4
- package/dist/components/control-face.d.ts +132 -0
- package/dist/components/control-face.js +168 -0
- package/dist/components/court-badge.d.ts +4 -2
- package/dist/components/court-badge.js +5 -3
- package/dist/components/document-mark.shared.d.ts +149 -0
- package/dist/components/document-mark.shared.js +62 -0
- package/dist/components/frame.d.ts +5 -1
- package/dist/components/frame.js +2 -2
- package/dist/components/input-otp-face.d.ts +4 -0
- package/dist/components/input-otp-face.js +15 -0
- package/dist/components/input-otp.d.ts +1 -1
- package/dist/components/input-otp.js +3 -8
- package/dist/components/input.native.js +2 -7
- package/dist/components/label-classes.d.ts +20 -0
- package/dist/components/label-classes.js +21 -0
- package/dist/components/label.d.ts +2 -20
- package/dist/components/label.js +2 -19
- package/dist/components/landing-shell.d.ts +64 -0
- package/dist/components/landing-shell.js +189 -0
- package/dist/components/landing.d.ts +2 -39
- package/dist/components/landing.js +2 -66
- package/dist/components/list-shell.d.ts +39 -0
- package/dist/components/list-shell.js +99 -0
- package/dist/components/list.d.ts +3 -17
- package/dist/components/list.js +2 -42
- package/dist/components/segmented-icon-toggle.d.ts +4 -1
- package/dist/components/segmented-icon-toggle.js +5 -4
- package/dist/components/select-classes.d.ts +10 -0
- package/dist/components/select-classes.js +13 -0
- package/dist/components/select.js +3 -7
- package/dist/components/separator.native.js +2 -1
- package/dist/components/sheet.native.js +4 -3
- package/dist/components/skeleton.d.ts +3 -1
- package/dist/components/skeleton.js +9 -2
- package/dist/components/split-button.d.ts +2 -1
- package/dist/components/split-button.js +6 -14
- package/dist/components/switch.d.ts +1 -5
- package/dist/components/switch.js +2 -5
- package/dist/components/table-cell.d.ts +35 -0
- package/dist/components/table-cell.js +26 -0
- package/dist/components/table-chart.js +28 -18
- package/dist/components/table-shell.d.ts +126 -0
- package/dist/components/table-shell.js +136 -0
- package/dist/components/table.d.ts +4 -88
- package/dist/components/table.js +21 -70
- package/dist/components/tabs-classes.d.ts +8 -0
- package/dist/components/tabs-classes.js +10 -0
- package/dist/components/tabs.js +4 -3
- package/dist/components/toggle-classes.d.ts +13 -0
- package/dist/components/toggle-classes.js +10 -0
- package/dist/components/toggle-group-classes.d.ts +12 -0
- package/dist/components/toggle-group-classes.js +13 -0
- package/dist/components/toggle-group.js +3 -2
- package/dist/components/tooltip.d.ts +6 -1
- package/dist/components/tooltip.js +2 -1
- package/dist/components/truncated-text-face.d.ts +33 -0
- package/dist/components/truncated-text-face.js +30 -0
- package/dist/components/truncated-text.d.ts +1 -6
- package/dist/components/truncated-text.js +1 -15
- package/dist/components/view-toolbar-classes.d.ts +13 -0
- package/dist/components/view-toolbar-classes.js +15 -0
- package/dist/components/view-toolbar-shell.d.ts +24 -0
- package/dist/components/view-toolbar-shell.js +43 -0
- package/dist/components/view-toolbar.d.ts +2 -15
- package/dist/components/view-toolbar.js +8 -26
- package/dist/components/workspace-shell.d.ts +7 -1
- package/dist/components/workspace-shell.js +21 -3
- package/dist/data-table/table.js +2 -1
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +2 -2
- package/dist/index.d.ts +15 -9
- package/dist/index.js +11 -8
- package/dist/inspector/pane-width.d.ts +1 -1
- package/dist/inspector/pane-width.js +2 -2
- package/dist/inspector/use-pane-width.d.ts +7 -9
- package/dist/inspector/use-pane-width.js +42 -27
- package/dist/kanban/card-shell.js +1 -1
- package/dist/kanban/column-bands.d.ts +0 -8
- package/dist/kanban/column-bands.js +1 -18
- package/dist/kanban/column-header-shell.d.ts +39 -0
- package/dist/kanban/column-header-shell.js +48 -0
- package/dist/kanban/column-header.js +9 -12
- package/dist/kanban/index.d.ts +2 -2
- package/dist/kanban/index.js +3 -3
- package/dist/kanban/layout-tokens.d.ts +18 -1
- package/dist/kanban/layout-tokens.js +18 -1
- package/dist/kanban/sticky-lane.d.ts +2 -7
- package/dist/kanban/sticky-lane.js +1 -6
- package/dist/kanban/subgroup-board.js +2 -2
- package/package.json +52 -4
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { COMPOSER_BOX_CLASS, COMPOSER_LARGE_ACTION_ROW_CLASS, COMPOSER_LARGE_EDITOR_CLASS, COMPOSER_LARGE_TEXT_WELL_CLASS } from "./composer-tokens.js";
|
|
4
|
+
import { ScrollArea } from "./scroll-area.js";
|
|
5
|
+
import { Skeleton } from "./skeleton.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createContext, use } from "react";
|
|
8
|
+
// src/components/landing-shell.tsx
|
|
9
|
+
/**
|
|
10
|
+
* A home screen's one shape: a greeting and a box in the upper fold, three
|
|
11
|
+
* columns of what the reader reaches from it below. The chat home and the
|
|
12
|
+
* law home render from these, so a reader who has learned one has learned
|
|
13
|
+
* the other, and the two cannot drift apart.
|
|
14
|
+
*/
|
|
15
|
+
const LandingPlaceholderContext = createContext(false);
|
|
16
|
+
const LandingScroll = ({ children, className, scrollFade = false }) => use(LandingPlaceholderContext) ? /* @__PURE__ */ jsx("div", {
|
|
17
|
+
className: cn("flex size-full min-h-0 flex-col", className),
|
|
18
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "relative min-h-0 flex-1 overflow-hidden rounded-[inherit]",
|
|
20
|
+
children
|
|
21
|
+
})
|
|
22
|
+
}) : /* @__PURE__ */ jsx(ScrollArea, {
|
|
23
|
+
className,
|
|
24
|
+
scrollFade,
|
|
25
|
+
children
|
|
26
|
+
});
|
|
27
|
+
const LandingLayout = ({ actions, placeholder = false, hero, children, footer }) => /* @__PURE__ */ jsx(LandingPlaceholderContext, {
|
|
28
|
+
value: placeholder,
|
|
29
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: "mx-auto flex h-full w-full max-w-5xl flex-1 flex-col overflow-hidden",
|
|
31
|
+
children: [actions, /* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: "@container flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
33
|
+
children: /* @__PURE__ */ jsx(LandingScroll, {
|
|
34
|
+
className: "min-h-0 flex-1",
|
|
35
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: "flex min-h-full w-full flex-col items-center px-4 @2xl:h-full",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx(LandingScroll, {
|
|
39
|
+
className: "min-h-72 w-full max-w-2xl shrink-0 basis-[22rem] @2xl:shrink",
|
|
40
|
+
scrollFade: true,
|
|
41
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "flex min-h-full w-full flex-col items-center justify-center gap-8 px-1",
|
|
43
|
+
children: hero
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ jsx("div", {
|
|
47
|
+
className: "grid w-full shrink-0 gap-8 pb-6 @2xl:min-h-0 @2xl:flex-1 @2xl:auto-rows-fr @2xl:grid-cols-3",
|
|
48
|
+
children
|
|
49
|
+
}),
|
|
50
|
+
footer !== void 0 && /* @__PURE__ */ jsx(LandingScroll, {
|
|
51
|
+
className: "h-auto max-h-[40dvh] w-full shrink-0",
|
|
52
|
+
scrollFade: true,
|
|
53
|
+
children: footer
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
const LandingGreeting = ({ icon, children }) => /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: "flex w-full flex-col items-center gap-4 text-center",
|
|
63
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
64
|
+
className: "border-border bg-background text-foreground flex size-12 items-center justify-center rounded-lg border shadow-sm",
|
|
65
|
+
children: icon
|
|
66
|
+
}), /* @__PURE__ */ jsx("h1", {
|
|
67
|
+
className: "text-foreground max-w-md text-center text-lg font-medium",
|
|
68
|
+
children
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
/** A column's heading: an icon and a sentence-case label, as a link or a trigger. */
|
|
72
|
+
const LANDING_SECTION_HEADING_CLASS = "text-foreground hover:bg-accent/50 focus-visible:ring-ring [&>svg]:text-muted-foreground flex items-center gap-2 rounded-md px-2 py-0.5 text-sm font-semibold outline-none focus-visible:ring-2";
|
|
73
|
+
/** A row of a column, as a link or a button. Its text lines up with the
|
|
74
|
+
* heading's label; the icon slot under the heading icon stays empty unless
|
|
75
|
+
* the icon identifies the row (a matter's colour). */
|
|
76
|
+
const LANDING_ROW_CLASS = "group hover:bg-accent/50 focus-visible:ring-ring rounded-md px-2 py-1.5 text-start outline-none focus-visible:ring-2";
|
|
77
|
+
/** A row's box without its interaction: the inset `LANDING_ROW_CLASS` gives. */
|
|
78
|
+
const LANDING_ROW_BOX_CLASS = "rounded-md px-2 py-1.5";
|
|
79
|
+
const LANDING_ROWS_PENDING_KEYS = [
|
|
80
|
+
"a",
|
|
81
|
+
"b",
|
|
82
|
+
"c"
|
|
83
|
+
];
|
|
84
|
+
const LANDING_ROW_TITLE_WIDTHS = [
|
|
85
|
+
"w-3/5",
|
|
86
|
+
"w-4/5",
|
|
87
|
+
"w-1/2"
|
|
88
|
+
];
|
|
89
|
+
const LANDING_ROW_META_WIDTHS = [
|
|
90
|
+
"w-2/5",
|
|
91
|
+
"w-1/3",
|
|
92
|
+
"w-2/5"
|
|
93
|
+
];
|
|
94
|
+
/** The stack a column's rows sit in (`LandingSection`'s list). */
|
|
95
|
+
const LANDING_ROWS_CLASS = "flex flex-col gap-1";
|
|
96
|
+
/**
|
|
97
|
+
* A column's rows while they load, on a `LandingItemText` row's lines (the
|
|
98
|
+
* empty icon slot, a `text-sm` title over a `text-xs` meta line), so the rows
|
|
99
|
+
* that arrive take the placeholders' place without moving anything. With a
|
|
100
|
+
* `label` the stack is announced as one busy region; without one (inside a
|
|
101
|
+
* pending frame that already announces itself) it is decoration.
|
|
102
|
+
*/
|
|
103
|
+
const LandingRowsPending = ({ label }) => /* @__PURE__ */ jsx("div", {
|
|
104
|
+
...label === void 0 ? { "aria-hidden": true } : {
|
|
105
|
+
"aria-busy": true,
|
|
106
|
+
"aria-label": label,
|
|
107
|
+
role: "status"
|
|
108
|
+
},
|
|
109
|
+
className: LANDING_ROWS_CLASS,
|
|
110
|
+
children: LANDING_ROWS_PENDING_KEYS.map((key, index) => /* @__PURE__ */ jsx("div", {
|
|
111
|
+
"aria-hidden": "true",
|
|
112
|
+
className: LANDING_ROW_BOX_CLASS,
|
|
113
|
+
"data-slot": "landing-row-skeleton",
|
|
114
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
115
|
+
className: "flex min-w-0 items-start gap-2",
|
|
116
|
+
children: [/* @__PURE__ */ jsx("span", { className: "size-4 shrink-0" }), /* @__PURE__ */ jsxs("div", {
|
|
117
|
+
className: "min-w-0 flex-1",
|
|
118
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
119
|
+
className: "flex h-5 items-center",
|
|
120
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: cn("h-3.5", LANDING_ROW_TITLE_WIDTHS[index]) })
|
|
121
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
122
|
+
className: "flex h-4 items-center",
|
|
123
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: cn("h-2.5", LANDING_ROW_META_WIDTHS[index]) })
|
|
124
|
+
})]
|
|
125
|
+
})]
|
|
126
|
+
})
|
|
127
|
+
}, key))
|
|
128
|
+
});
|
|
129
|
+
/** A column heading whose label is not known yet: its real icon (it needs no
|
|
130
|
+
* data) and a bar on the label's line, in the heading's own inset. */
|
|
131
|
+
const LandingSectionHeadingPending = ({ icon }) => /* @__PURE__ */ jsxs("div", {
|
|
132
|
+
"aria-hidden": "true",
|
|
133
|
+
className: "[&>svg]:text-muted-foreground flex items-center gap-2 px-2 py-0.5",
|
|
134
|
+
children: [icon ?? /* @__PURE__ */ jsx(Skeleton, { className: "size-4 shrink-0" }), /* @__PURE__ */ jsx("div", {
|
|
135
|
+
className: "flex h-5 items-center",
|
|
136
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-28" })
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
const BOX_TRAILING_CONTROLS_CLASS = {
|
|
140
|
+
composer: "h-9.5",
|
|
141
|
+
search: "h-7"
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The hero's box before it mounts (the chat composer, the law entry box),
|
|
145
|
+
* from the composer tokens both are built on: the bordered box, the
|
|
146
|
+
* three-line text well, the action row with its round ends, and the status
|
|
147
|
+
* row's line beneath.
|
|
148
|
+
*/
|
|
149
|
+
const LandingBoxPending = ({ box }) => /* @__PURE__ */ jsxs("div", {
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
className: "flex w-full flex-col",
|
|
152
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
153
|
+
className: COMPOSER_BOX_CLASS,
|
|
154
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
155
|
+
className: COMPOSER_LARGE_TEXT_WELL_CLASS,
|
|
156
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
157
|
+
className: cn(COMPOSER_LARGE_EDITOR_CLASS, "py-0.5"),
|
|
158
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" })
|
|
159
|
+
})
|
|
160
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
161
|
+
className: COMPOSER_LARGE_ACTION_ROW_CLASS,
|
|
162
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "me-auto size-7 rounded-full" }), /* @__PURE__ */ jsx("span", {
|
|
163
|
+
className: cn("flex items-center", BOX_TRAILING_CONTROLS_CLASS[box]),
|
|
164
|
+
children: /* @__PURE__ */ jsx(Skeleton, { className: "size-7 rounded-full" })
|
|
165
|
+
})]
|
|
166
|
+
})]
|
|
167
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
168
|
+
className: "mt-1.5 flex h-6 items-center justify-between gap-2 px-1",
|
|
169
|
+
children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" })]
|
|
170
|
+
})]
|
|
171
|
+
});
|
|
172
|
+
/** A column: its heading stays put, its rows scroll beneath it. The rows get
|
|
173
|
+
* the same ring room as the hero box, since the viewport clips a flush row's
|
|
174
|
+
* focus ring; the heading takes the same inset so the labels stay aligned. */
|
|
175
|
+
const LandingSection = ({ children, heading }) => /* @__PURE__ */ jsxs("section", {
|
|
176
|
+
className: "flex min-h-0 min-w-0 flex-col",
|
|
177
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
178
|
+
className: "mb-3 shrink-0 px-1",
|
|
179
|
+
children: heading
|
|
180
|
+
}), /* @__PURE__ */ jsx(LandingScroll, {
|
|
181
|
+
className: "@2xl:min-h-0 @2xl:flex-1",
|
|
182
|
+
scrollFade: true,
|
|
183
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
184
|
+
className: cn(LANDING_ROWS_CLASS, "px-1 pt-1 pb-4"),
|
|
185
|
+
children
|
|
186
|
+
})
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
export { LANDING_ROW_CLASS, LANDING_SECTION_HEADING_CLASS, LandingBoxPending, LandingGreeting, LandingLayout, LandingRowsPending, LandingSection, LandingSectionHeadingPending };
|
|
@@ -1,42 +1,5 @@
|
|
|
1
|
+
import { LANDING_ROW_CLASS, LANDING_SECTION_HEADING_CLASS, LandingBoxPending, LandingGreeting, LandingLayout, LandingRowsPending, LandingSection, LandingSectionHeadingPending } from "./landing-shell.js";
|
|
1
2
|
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* A home screen's one shape: a greeting and a box in the upper fold, three
|
|
4
|
-
* columns of what the reader reaches from it below. The chat home and the
|
|
5
|
-
* law home render from these, so a reader who has learned one has learned
|
|
6
|
-
* the other, and the two cannot drift apart.
|
|
7
|
-
*/
|
|
8
|
-
type LandingLayoutProps = {
|
|
9
|
-
/** Header-slot actions that belong to the page rather than the fold. */
|
|
10
|
-
actions?: ReactNode | undefined;
|
|
11
|
-
/** The greeting and the box; centred in the upper fold. */
|
|
12
|
-
hero: ReactNode;
|
|
13
|
-
/** The columns; take the rest of the height, each scrolling on its own. */
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
/** Below the columns, in its own bounded scroll: crawlable navigation. */
|
|
16
|
-
footer?: ReactNode | undefined;
|
|
17
|
-
};
|
|
18
|
-
export declare const LandingLayout: ({ actions, hero, children, footer }: LandingLayoutProps) => import("react").JSX.Element;
|
|
19
|
-
type LandingGreetingProps = {
|
|
20
|
-
/** The mark in the tile: the product mark, or the section's icon. */
|
|
21
|
-
icon: ReactNode;
|
|
22
|
-
/** The one line under the tile, as the page's heading. */
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
};
|
|
25
|
-
export declare const LandingGreeting: ({ icon, children }: LandingGreetingProps) => import("react").JSX.Element;
|
|
26
|
-
/** A column's heading: an icon and a sentence-case label, as a link or a trigger. */
|
|
27
|
-
export declare const LANDING_SECTION_HEADING_CLASS = "text-foreground hover:bg-accent/50 focus-visible:ring-ring [&>svg]:text-muted-foreground flex items-center gap-2 rounded-md px-2 py-0.5 text-sm font-semibold outline-none focus-visible:ring-2";
|
|
28
|
-
/** A row of a column, as a link or a button. Its text lines up with the
|
|
29
|
-
* heading's label; the icon slot under the heading icon stays empty unless
|
|
30
|
-
* the icon identifies the row (a matter's colour). */
|
|
31
|
-
export declare const LANDING_ROW_CLASS = "group hover:bg-accent/50 focus-visible:ring-ring rounded-md px-2 py-1.5 text-start outline-none focus-visible:ring-2";
|
|
32
|
-
type LandingSectionProps = {
|
|
33
|
-
children: ReactNode;
|
|
34
|
-
heading: ReactNode;
|
|
35
|
-
};
|
|
36
|
-
/** A column: its heading stays put, its rows scroll beneath it. The rows get
|
|
37
|
-
* the same ring room as the hero box, since the viewport clips a flush row's
|
|
38
|
-
* focus ring; the heading takes the same inset so the labels stay aligned. */
|
|
39
|
-
export declare const LandingSection: ({ children, heading }: LandingSectionProps) => import("react").JSX.Element;
|
|
40
3
|
type LandingButtonProps = {
|
|
41
4
|
icon?: ReactElement;
|
|
42
5
|
meta?: ReactNode | undefined;
|
|
@@ -60,4 +23,4 @@ type LandingEmptyProps = {
|
|
|
60
23
|
children: ReactNode;
|
|
61
24
|
};
|
|
62
25
|
export declare const LandingEmpty: ({ children }: LandingEmptyProps) => import("react").JSX.Element;
|
|
63
|
-
export {};
|
|
26
|
+
export { LANDING_ROW_CLASS, LANDING_SECTION_HEADING_CLASS, LandingBoxPending, LandingGreeting, LandingLayout, LandingRowsPending, LandingSection, LandingSectionHeadingPending };
|
|
@@ -1,74 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { BidiText } from "./bidi-text.js";
|
|
4
|
-
import {
|
|
4
|
+
import { LANDING_ROW_CLASS, LANDING_SECTION_HEADING_CLASS, LandingBoxPending, LandingGreeting, LandingLayout, LandingRowsPending, LandingSection, LandingSectionHeadingPending } from "./landing-shell.js";
|
|
5
5
|
import { TruncatedText } from "./truncated-text.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
// src/components/landing.tsx
|
|
8
|
-
const LandingLayout = ({ actions, hero, children, footer }) => /* @__PURE__ */ jsxs("div", {
|
|
9
|
-
className: "mx-auto flex h-full w-full max-w-5xl flex-1 flex-col overflow-hidden",
|
|
10
|
-
children: [actions, /* @__PURE__ */ jsx("div", {
|
|
11
|
-
className: "@container flex min-h-0 flex-1 flex-col overflow-hidden",
|
|
12
|
-
children: /* @__PURE__ */ jsx(ScrollArea, {
|
|
13
|
-
className: "min-h-0 flex-1",
|
|
14
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
15
|
-
className: "flex min-h-full w-full flex-col items-center px-4 @2xl:h-full",
|
|
16
|
-
children: [
|
|
17
|
-
/* @__PURE__ */ jsx(ScrollArea, {
|
|
18
|
-
className: "min-h-72 w-full max-w-2xl shrink-0 basis-[22rem] @2xl:shrink",
|
|
19
|
-
scrollFade: true,
|
|
20
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
21
|
-
className: "flex min-h-full w-full flex-col items-center justify-center gap-8 px-1",
|
|
22
|
-
children: hero
|
|
23
|
-
})
|
|
24
|
-
}),
|
|
25
|
-
/* @__PURE__ */ jsx("div", {
|
|
26
|
-
className: "grid w-full shrink-0 gap-8 pb-6 @2xl:min-h-0 @2xl:flex-1 @2xl:auto-rows-fr @2xl:grid-cols-3",
|
|
27
|
-
children
|
|
28
|
-
}),
|
|
29
|
-
footer !== void 0 && /* @__PURE__ */ jsx(ScrollArea, {
|
|
30
|
-
className: "h-auto max-h-[40dvh] w-full shrink-0",
|
|
31
|
-
scrollFade: true,
|
|
32
|
-
children: footer
|
|
33
|
-
})
|
|
34
|
-
]
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
})]
|
|
38
|
-
});
|
|
39
|
-
const LandingGreeting = ({ icon, children }) => /* @__PURE__ */ jsxs("div", {
|
|
40
|
-
className: "flex w-full flex-col items-center gap-4 text-center",
|
|
41
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
42
|
-
className: "border-border bg-background text-foreground flex size-12 items-center justify-center rounded-lg border shadow-sm",
|
|
43
|
-
children: icon
|
|
44
|
-
}), /* @__PURE__ */ jsx("h1", {
|
|
45
|
-
className: "text-foreground max-w-md text-center text-lg font-medium",
|
|
46
|
-
children
|
|
47
|
-
})]
|
|
48
|
-
});
|
|
49
|
-
/** A column's heading: an icon and a sentence-case label, as a link or a trigger. */
|
|
50
|
-
const LANDING_SECTION_HEADING_CLASS = "text-foreground hover:bg-accent/50 focus-visible:ring-ring [&>svg]:text-muted-foreground flex items-center gap-2 rounded-md px-2 py-0.5 text-sm font-semibold outline-none focus-visible:ring-2";
|
|
51
|
-
/** A row of a column, as a link or a button. Its text lines up with the
|
|
52
|
-
* heading's label; the icon slot under the heading icon stays empty unless
|
|
53
|
-
* the icon identifies the row (a matter's colour). */
|
|
54
|
-
const LANDING_ROW_CLASS = "group hover:bg-accent/50 focus-visible:ring-ring rounded-md px-2 py-1.5 text-start outline-none focus-visible:ring-2";
|
|
55
|
-
/** A column: its heading stays put, its rows scroll beneath it. The rows get
|
|
56
|
-
* the same ring room as the hero box, since the viewport clips a flush row's
|
|
57
|
-
* focus ring; the heading takes the same inset so the labels stay aligned. */
|
|
58
|
-
const LandingSection = ({ children, heading }) => /* @__PURE__ */ jsxs("section", {
|
|
59
|
-
className: "flex min-h-0 min-w-0 flex-col",
|
|
60
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
61
|
-
className: "mb-3 shrink-0 px-1",
|
|
62
|
-
children: heading
|
|
63
|
-
}), /* @__PURE__ */ jsx(ScrollArea, {
|
|
64
|
-
className: "@2xl:min-h-0 @2xl:flex-1",
|
|
65
|
-
scrollFade: true,
|
|
66
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
67
|
-
className: "flex flex-col gap-1 px-1 pt-1 pb-4",
|
|
68
|
-
children
|
|
69
|
-
})
|
|
70
|
-
})]
|
|
71
|
-
});
|
|
72
8
|
const LandingButton = ({ icon, meta, onClick, title }) => /* @__PURE__ */ jsx("button", {
|
|
73
9
|
className: LANDING_ROW_CLASS,
|
|
74
10
|
onClick,
|
|
@@ -107,4 +43,4 @@ const LandingEmpty = ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
|
107
43
|
className: "border-border text-muted-foreground rounded-md border border-dashed px-3 py-3 text-sm",
|
|
108
44
|
children
|
|
109
45
|
});
|
|
110
|
-
export { LANDING_ROW_CLASS, LANDING_SECTION_HEADING_CLASS, LandingButton, LandingEmpty, LandingGreeting, LandingItemText, LandingLayout, LandingRowIcon, LandingSection };
|
|
46
|
+
export { LANDING_ROW_CLASS, LANDING_SECTION_HEADING_CLASS, LandingBoxPending, LandingButton, LandingEmpty, LandingGreeting, LandingItemText, LandingLayout, LandingRowIcon, LandingRowsPending, LandingSection, LandingSectionHeadingPending };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const ListGroup: ({ className, ...props }: React.ComponentProps<"section">) => React.JSX.Element;
|
|
3
|
+
declare const ListGroupHeader: ({ className, ...props }: React.ComponentProps<"header">) => React.JSX.Element;
|
|
4
|
+
/** Title and description stack; takes the space the header action leaves. */
|
|
5
|
+
declare const ListGroupHeading: ({ className, ...props }: React.ComponentProps<"div">) => React.JSX.Element;
|
|
6
|
+
declare const ListGroupTitle: ({ className, children, ...props }: React.ComponentProps<"h2">) => React.JSX.Element;
|
|
7
|
+
/** The group's one quiet line under its title. */
|
|
8
|
+
declare const ListGroupDescription: ({ className, ...props }: React.ComponentProps<"p">) => React.JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* The surface. Depth comes from a ring plus a soft shadow, not a frame.
|
|
11
|
+
*
|
|
12
|
+
* A row wrapped in `EntityActions` sits inside its `display: contents`
|
|
13
|
+
* listener, which draws no border, and its menu anchor follows it as a
|
|
14
|
+
* sibling, so `divide-y` cannot reach it: such a row draws its own hairline
|
|
15
|
+
* on top, from the second wrapped row on.
|
|
16
|
+
*/
|
|
17
|
+
declare const List: ({ className, ...props }: React.ComponentProps<"ul">) => React.JSX.Element;
|
|
18
|
+
/** A row's box: its height floor, inset and the gap between its slots. */
|
|
19
|
+
export declare const LIST_ITEM_ROW_CLASS = "flex min-h-14 w-full items-center gap-3 px-4 py-2.5 text-start";
|
|
20
|
+
type ListItemSkeletonProps = {
|
|
21
|
+
/** Which placeholder row this is: the widths vary row to row. */
|
|
22
|
+
index: number;
|
|
23
|
+
/** A 32px `ListItemMedia` tile before the text. */
|
|
24
|
+
media?: boolean | undefined;
|
|
25
|
+
/** A `ListItemDescription` line under the title. */
|
|
26
|
+
description?: boolean | undefined;
|
|
27
|
+
/** The trailing slot (a date, a status), as wide as its placeholder. */
|
|
28
|
+
trailing?: "text" | undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A `ListItem` while its data loads: the row's box, and a bar on each line
|
|
32
|
+
* the row will hold (a `text-sm` title, a `text-xs` description, the
|
|
33
|
+
* trailing text), so the row that arrives takes its place without moving
|
|
34
|
+
* anything. Decoration: the loading view announces itself once.
|
|
35
|
+
*/
|
|
36
|
+
declare const ListItemSkeleton: ({ description, index, media, trailing }: ListItemSkeletonProps) => React.JSX.Element;
|
|
37
|
+
/** A group title whose text waits on data: a bar on the title's line. */
|
|
38
|
+
declare const ListGroupTitlePending: () => React.JSX.Element;
|
|
39
|
+
export { List, ListGroup, ListGroupDescription, ListGroupHeader, ListGroupHeading, ListGroupTitle, ListGroupTitlePending, ListItemSkeleton };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { InlineSkeleton, Skeleton } from "./skeleton.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/list-shell.tsx
|
|
6
|
+
const ListGroup = ({ className, ...props }) => /* @__PURE__ */ jsx("section", {
|
|
7
|
+
className: cn("flex flex-col gap-2.5", className),
|
|
8
|
+
"data-slot": "list-group",
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
const ListGroupHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("header", {
|
|
12
|
+
className: cn("flex items-end gap-4 px-1", className),
|
|
13
|
+
"data-slot": "list-group-header",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
/** Title and description stack; takes the space the header action leaves. */
|
|
17
|
+
const ListGroupHeading = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: cn("flex min-w-0 flex-1 flex-col gap-0.5", className),
|
|
19
|
+
"data-slot": "list-group-heading",
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
const ListGroupTitle = ({ className, children, ...props }) => /* @__PURE__ */ jsx("h2", {
|
|
23
|
+
className: cn("text-foreground text-sm font-medium text-balance", className),
|
|
24
|
+
"data-slot": "list-group-title",
|
|
25
|
+
...props,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
/** The group's one quiet line under its title. */
|
|
29
|
+
const ListGroupDescription = ({ className, ...props }) => /* @__PURE__ */ jsx("p", {
|
|
30
|
+
className: cn("text-muted-foreground text-xs text-pretty", className),
|
|
31
|
+
"data-slot": "list-group-description",
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* The surface. Depth comes from a ring plus a soft shadow, not a frame.
|
|
36
|
+
*
|
|
37
|
+
* A row wrapped in `EntityActions` sits inside its `display: contents`
|
|
38
|
+
* listener, which draws no border, and its menu anchor follows it as a
|
|
39
|
+
* sibling, so `divide-y` cannot reach it: such a row draws its own hairline
|
|
40
|
+
* on top, from the second wrapped row on.
|
|
41
|
+
*/
|
|
42
|
+
const List = ({ className, ...props }) => /* @__PURE__ */ jsx("ul", {
|
|
43
|
+
className: cn("bg-background ring-border divide-border flex flex-col divide-y overflow-hidden rounded-xl shadow-xs/5 ring-1", "[&>[data-slot=entity-actions]~[data-slot=entity-actions]>*]:border-border [&>[data-slot=entity-actions]~[data-slot=entity-actions]>*]:border-t", className),
|
|
44
|
+
"data-slot": "list",
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
/** A row's box: its height floor, inset and the gap between its slots. */
|
|
48
|
+
const LIST_ITEM_ROW_CLASS = "flex min-h-14 w-full items-center gap-3 px-4 py-2.5 text-start";
|
|
49
|
+
const LIST_ITEM_TITLE_WIDTHS = [
|
|
50
|
+
"w-56",
|
|
51
|
+
"w-44",
|
|
52
|
+
"w-64",
|
|
53
|
+
"w-48"
|
|
54
|
+
];
|
|
55
|
+
const LIST_ITEM_DESCRIPTION_WIDTHS = [
|
|
56
|
+
"w-40",
|
|
57
|
+
"w-32",
|
|
58
|
+
"w-36",
|
|
59
|
+
"w-28"
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* A `ListItem` while its data loads: the row's box, and a bar on each line
|
|
63
|
+
* the row will hold (a `text-sm` title, a `text-xs` description, the
|
|
64
|
+
* trailing text), so the row that arrives takes its place without moving
|
|
65
|
+
* anything. Decoration: the loading view announces itself once.
|
|
66
|
+
*/
|
|
67
|
+
const ListItemSkeleton = ({ description = true, index, media = false, trailing }) => /* @__PURE__ */ jsx("li", {
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
className: "flex",
|
|
70
|
+
"data-slot": "list-item-skeleton",
|
|
71
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: LIST_ITEM_ROW_CLASS,
|
|
73
|
+
children: [
|
|
74
|
+
media && /* @__PURE__ */ jsx(Skeleton, { className: "size-8 shrink-0 rounded-lg" }),
|
|
75
|
+
/* @__PURE__ */ jsxs("div", {
|
|
76
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
77
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "flex h-5 items-center",
|
|
79
|
+
children: /* @__PURE__ */ jsx(InlineSkeleton, { className: cn("h-3.5 max-w-full", LIST_ITEM_TITLE_WIDTHS[index % LIST_ITEM_TITLE_WIDTHS.length]) })
|
|
80
|
+
}), description && /* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: "flex h-4 items-center",
|
|
82
|
+
children: /* @__PURE__ */ jsx(InlineSkeleton, { className: cn("h-3 max-w-full", LIST_ITEM_DESCRIPTION_WIDTHS[index % LIST_ITEM_DESCRIPTION_WIDTHS.length]) })
|
|
83
|
+
})]
|
|
84
|
+
}),
|
|
85
|
+
trailing === "text" && /* @__PURE__ */ jsx("span", {
|
|
86
|
+
className: "flex h-4 shrink-0 items-center",
|
|
87
|
+
children: /* @__PURE__ */ jsx(InlineSkeleton, { className: "h-3 w-12" })
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
/** A group title whose text waits on data: a bar on the title's line. */
|
|
93
|
+
const ListGroupTitlePending = () => /* @__PURE__ */ jsx("span", {
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
className: "flex h-5 items-center",
|
|
96
|
+
"data-slot": "list-group-title-skeleton",
|
|
97
|
+
children: /* @__PURE__ */ jsx(InlineSkeleton, { className: "h-3.5 w-24" })
|
|
98
|
+
});
|
|
99
|
+
export { LIST_ITEM_ROW_CLASS, List, ListGroup, ListGroupDescription, ListGroupHeader, ListGroupHeading, ListGroupTitle, ListGroupTitlePending, ListItemSkeleton };
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
+
import "./truncated-text.js";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
+
import { List, ListGroup, ListGroupDescription, ListGroupHeader, ListGroupHeading, ListGroupTitle } from "./list-shell.js";
|
|
4
|
+
import { TruncatedTextLines } from "./truncated-text-face.js";
|
|
3
5
|
import { VariantProps } from "class-variance-authority";
|
|
4
6
|
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
-
/**
|
|
6
|
-
* Grouped list: a titled section holding one surface of hairline-divided
|
|
7
|
-
* rows. Use it for settings and inventories of named things (connections,
|
|
8
|
-
* sessions, members, keys) where each row is icon + name + one quiet line +
|
|
9
|
-
* trailing status or action. Rows never scroll sideways: the content column
|
|
10
|
-
* truncates and the trailing column keeps its width, so actions stay on
|
|
11
|
-
* screen at any viewport.
|
|
12
|
-
*/
|
|
13
|
-
declare const ListGroup: ({ className, ...props }: React.ComponentProps<"section">) => React.JSX.Element;
|
|
14
|
-
declare const ListGroupHeader: ({ className, ...props }: React.ComponentProps<"header">) => React.JSX.Element;
|
|
15
|
-
/** Title and description stack; takes the space the header action leaves. */
|
|
16
|
-
declare const ListGroupHeading: ({ className, ...props }: React.ComponentProps<"div">) => React.JSX.Element;
|
|
17
|
-
declare const ListGroupTitle: ({ className, children, ...props }: React.ComponentProps<"h2">) => React.JSX.Element;
|
|
18
7
|
/**
|
|
19
8
|
* Quiet item count after the title; shows matches while a search filters,
|
|
20
9
|
* and a changed digit fades in rather than snapping. `count` arrives
|
|
@@ -23,11 +12,8 @@ declare const ListGroupTitle: ({ className, children, ...props }: React.Componen
|
|
|
23
12
|
declare const ListGroupCount: ({ className, count, ...props }: Omit<React.ComponentProps<"span">, "children"> & {
|
|
24
13
|
count: string;
|
|
25
14
|
}) => React.JSX.Element;
|
|
26
|
-
declare const ListGroupDescription: ({ className, ...props }: React.ComponentProps<"p">) => React.JSX.Element;
|
|
27
15
|
/** Quiet trailing affordance on the header row (a link or ghost button). */
|
|
28
16
|
declare const ListGroupAction: ({ className, ...props }: React.ComponentProps<"div">) => React.JSX.Element;
|
|
29
|
-
/** The surface. Depth comes from a ring plus a soft shadow, not a frame. */
|
|
30
|
-
declare const List: ({ className, ...props }: React.ComponentProps<"ul">) => React.JSX.Element;
|
|
31
17
|
/**
|
|
32
18
|
* One row. Pass `render` (a link or button element) to make the whole row the
|
|
33
19
|
* target; then keep other interactive elements out of it. Rows with their own
|
package/dist/components/list.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { AnimatedCount } from "./animated-count.js";
|
|
4
|
+
import { LIST_ITEM_ROW_CLASS, List, ListGroup, ListGroupDescription, ListGroupHeader, ListGroupHeading, ListGroupTitle } from "./list-shell.js";
|
|
4
5
|
import { TruncatedText } from "./truncated-text.js";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
@@ -8,36 +9,6 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
8
9
|
import { cva } from "class-variance-authority";
|
|
9
10
|
// src/components/list.tsx
|
|
10
11
|
/**
|
|
11
|
-
* Grouped list: a titled section holding one surface of hairline-divided
|
|
12
|
-
* rows. Use it for settings and inventories of named things (connections,
|
|
13
|
-
* sessions, members, keys) where each row is icon + name + one quiet line +
|
|
14
|
-
* trailing status or action. Rows never scroll sideways: the content column
|
|
15
|
-
* truncates and the trailing column keeps its width, so actions stay on
|
|
16
|
-
* screen at any viewport.
|
|
17
|
-
*/
|
|
18
|
-
const ListGroup = ({ className, ...props }) => /* @__PURE__ */ jsx("section", {
|
|
19
|
-
className: cn("flex flex-col gap-2.5", className),
|
|
20
|
-
"data-slot": "list-group",
|
|
21
|
-
...props
|
|
22
|
-
});
|
|
23
|
-
const ListGroupHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("header", {
|
|
24
|
-
className: cn("flex items-end gap-4 px-1", className),
|
|
25
|
-
"data-slot": "list-group-header",
|
|
26
|
-
...props
|
|
27
|
-
});
|
|
28
|
-
/** Title and description stack; takes the space the header action leaves. */
|
|
29
|
-
const ListGroupHeading = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
30
|
-
className: cn("flex min-w-0 flex-1 flex-col gap-0.5", className),
|
|
31
|
-
"data-slot": "list-group-heading",
|
|
32
|
-
...props
|
|
33
|
-
});
|
|
34
|
-
const ListGroupTitle = ({ className, children, ...props }) => /* @__PURE__ */ jsx("h2", {
|
|
35
|
-
className: cn("text-foreground text-sm font-medium text-balance", className),
|
|
36
|
-
"data-slot": "list-group-title",
|
|
37
|
-
...props,
|
|
38
|
-
children
|
|
39
|
-
});
|
|
40
|
-
/**
|
|
41
12
|
* Quiet item count after the title; shows matches while a search filters,
|
|
42
13
|
* and a changed digit fades in rather than snapping. `count` arrives
|
|
43
14
|
* formatted in the caller's locale.
|
|
@@ -48,23 +19,12 @@ const ListGroupCount = ({ className, count, ...props }) => /* @__PURE__ */ jsx("
|
|
|
48
19
|
...props,
|
|
49
20
|
children: /* @__PURE__ */ jsx(AnimatedCount, { value: count })
|
|
50
21
|
});
|
|
51
|
-
const ListGroupDescription = ({ className, ...props }) => /* @__PURE__ */ jsx("p", {
|
|
52
|
-
className: cn("text-muted-foreground text-xs text-pretty", className),
|
|
53
|
-
"data-slot": "list-group-description",
|
|
54
|
-
...props
|
|
55
|
-
});
|
|
56
22
|
/** Quiet trailing affordance on the header row (a link or ghost button). */
|
|
57
23
|
const ListGroupAction = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
58
24
|
className: cn("flex shrink-0 items-center gap-1", className),
|
|
59
25
|
"data-slot": "list-group-action",
|
|
60
26
|
...props
|
|
61
27
|
});
|
|
62
|
-
/** The surface. Depth comes from a ring plus a soft shadow, not a frame. */
|
|
63
|
-
const List = ({ className, ...props }) => /* @__PURE__ */ jsx("ul", {
|
|
64
|
-
className: cn("bg-background ring-border divide-border flex flex-col divide-y overflow-hidden rounded-xl shadow-xs/5 ring-1", className),
|
|
65
|
-
"data-slot": "list",
|
|
66
|
-
...props
|
|
67
|
-
});
|
|
68
28
|
/**
|
|
69
29
|
* One row. Pass `render` (a link or button element) to make the whole row the
|
|
70
30
|
* target; then keep other interactive elements out of it. Rows with their own
|
|
@@ -72,7 +32,7 @@ const List = ({ className, ...props }) => /* @__PURE__ */ jsx("ul", {
|
|
|
72
32
|
*/
|
|
73
33
|
const ListItem = ({ className, render, children, ...props }) => {
|
|
74
34
|
const defaultProps = {
|
|
75
|
-
className: cn(
|
|
35
|
+
className: cn(LIST_ITEM_ROW_CLASS, render !== void 0 && "hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:ring-ring cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-inset", className),
|
|
76
36
|
"data-slot": "list-item",
|
|
77
37
|
children
|
|
78
38
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ComponentType } from "react";
|
|
2
|
+
import { SegmentedIconToggleSize } from "./toggle-group-classes.js";
|
|
2
3
|
type SegmentedIconToggleOption<T extends string> = {
|
|
4
|
+
/** A fixed id for the option, where generated ones would differ per mount. */
|
|
5
|
+
id?: string | undefined;
|
|
3
6
|
value: T;
|
|
4
7
|
icon: ComponentType<{
|
|
5
8
|
className?: string;
|
|
@@ -11,7 +14,7 @@ type SegmentedIconToggleProps<T extends string> = {
|
|
|
11
14
|
value: T;
|
|
12
15
|
options: readonly SegmentedIconToggleOption<T>[];
|
|
13
16
|
onChange: (value: T) => void;
|
|
14
|
-
size?:
|
|
17
|
+
size?: SegmentedIconToggleSize;
|
|
15
18
|
};
|
|
16
19
|
/** Compact segmented control of icon buttons (e.g. table row wrap, list
|
|
17
20
|
* density). One shared shell so every density/mode switch looks and behaves
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../lib/utils.js";
|
|
3
2
|
import { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
|
|
3
|
+
import { SEGMENTED_ICON_TOGGLE_ICON_CLASS_NAME, segmentedIconToggleClassName, segmentedIconToggleItemClassName } from "./toggle-group-classes.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
// src/components/segmented-icon-toggle.tsx
|
|
6
6
|
/** Compact segmented control of icon buttons (e.g. table row wrap, list
|
|
@@ -8,7 +8,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
8
8
|
* the same across the app. A `ToggleGroup` of icon items that always holds
|
|
9
9
|
* one value: clicking the chosen option keeps it. */
|
|
10
10
|
const SegmentedIconToggle = ({ value, options, onChange, size = "compact" }) => /* @__PURE__ */ jsx(ToggleGroup, {
|
|
11
|
-
className:
|
|
11
|
+
className: segmentedIconToggleClassName(size),
|
|
12
12
|
"data-slot": "segmented-icon-toggle",
|
|
13
13
|
onValueChange: (next) => {
|
|
14
14
|
const [chosen] = next;
|
|
@@ -19,11 +19,12 @@ const SegmentedIconToggle = ({ value, options, onChange, size = "compact" }) =>
|
|
|
19
19
|
const Icon = option.icon;
|
|
20
20
|
return /* @__PURE__ */ jsx(ToggleGroupItem, {
|
|
21
21
|
"aria-label": option.label,
|
|
22
|
-
className:
|
|
22
|
+
className: segmentedIconToggleItemClassName(size),
|
|
23
23
|
"data-control-value": option.value,
|
|
24
|
+
id: option.id,
|
|
24
25
|
size: "icon-xs",
|
|
25
26
|
value: option.value,
|
|
26
|
-
children: /* @__PURE__ */ jsx(Icon, { className:
|
|
27
|
+
children: /* @__PURE__ */ jsx(Icon, { className: SEGMENTED_ICON_TOGGLE_ICON_CLASS_NAME })
|
|
27
28
|
}, option.value);
|
|
28
29
|
})
|
|
29
30
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The trigger's metric per control size, over the field trigger's box. */
|
|
2
|
+
export declare const SELECT_TRIGGER_SIZE_CLASS_NAMES: {
|
|
3
|
+
readonly sm: "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] text-sm sm:min-h-7 sm:text-xs";
|
|
4
|
+
readonly default: undefined;
|
|
5
|
+
readonly lg: "min-h-10 sm:min-h-9";
|
|
6
|
+
};
|
|
7
|
+
/** The chosen value's line inside the trigger. */
|
|
8
|
+
export declare const SELECT_VALUE_CLASS_NAME = "data-placeholder:text-muted-foreground flex-1 truncate";
|
|
9
|
+
/** The up-down chevrons at the trigger's end. */
|
|
10
|
+
export declare const SELECT_TRIGGER_ICON_CLASS_NAME = "-me-1 size-4.5 opacity-80 sm:size-4";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
2
|
+
// src/components/select-classes.ts
|
|
3
|
+
/** The trigger's metric per control size, over the field trigger's box. */
|
|
4
|
+
const SELECT_TRIGGER_SIZE_CLASS_NAMES = {
|
|
5
|
+
[CONTROL_SIZE.sm]: "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] text-sm sm:min-h-7 sm:text-xs",
|
|
6
|
+
[CONTROL_SIZE.default]: void 0,
|
|
7
|
+
[CONTROL_SIZE.lg]: "min-h-10 sm:min-h-9"
|
|
8
|
+
};
|
|
9
|
+
/** The chosen value's line inside the trigger. */
|
|
10
|
+
const SELECT_VALUE_CLASS_NAME = "data-placeholder:text-muted-foreground flex-1 truncate";
|
|
11
|
+
/** The up-down chevrons at the trigger's end. */
|
|
12
|
+
const SELECT_TRIGGER_ICON_CLASS_NAME = "-me-1 size-4.5 opacity-80 sm:size-4";
|
|
13
|
+
export { SELECT_TRIGGER_ICON_CLASS_NAME, SELECT_TRIGGER_SIZE_CLASS_NAMES, SELECT_VALUE_CLASS_NAME };
|