@siyahi/ui 0.1.7-next.1 → 0.1.7-next.3

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/README.md CHANGED
@@ -79,7 +79,10 @@ Every merge to `main` also attaches both tarballs to a GitHub release
79
79
  - **Cards and badges as installed**: every `Card`, stat tiles included, keeps
80
80
  luma's `rounded-4xl`, `shadow-md` and faint ring. A category (a sector, a
81
81
  broker, a unit's kind) is an outline `Badge`: categories stay neutral, and
82
- colour is left to the four meaning colours and the charts.
82
+ colour is left to the four meaning colours and the charts. On a narrow card
83
+ (header under 24rem, so any phone) a header action such as a toggle drops
84
+ under the title and description, left-aligned; a stat tile's badge stays
85
+ top right.
83
86
  - **Formatters**: `money`, `moneyCompact`, `pct` and `time`, or `useFormat()`
84
87
  for the same bound to the provider's locale.
85
88
  `useFormat().time(value, { withDate: true })` (or
@@ -1,14 +1,22 @@
1
1
  "use client";
2
2
  import { Badge } from "../../ui/badge.js";
3
3
  import { Card, CardAction, CardDescription, CardFooter, CardHeader, CardTitle } from "../../ui/card.js";
4
+ import { cn } from "../../../lib/utils.js";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import "react";
6
7
  //#region src/components/registry/dashboard-01/section-cards.tsx
8
+ const COLUMNS = {
9
+ 2: "@xl/main:grid-cols-2",
10
+ 3: "@3xl/main:grid-cols-3",
11
+ 4: "@xl/main:grid-cols-2 @5xl/main:grid-cols-4",
12
+ 5: "@3xl/main:grid-cols-3 @7xl/main:grid-cols-5",
13
+ 6: "@3xl/main:grid-cols-3"
14
+ };
7
15
  function SectionCards({ items }) {
8
16
  return /* @__PURE__ */ jsx("div", {
9
17
  className: "@container/main",
10
18
  children: /* @__PURE__ */ jsx("div", {
11
- className: "grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4",
19
+ className: cn("grid grid-cols-1 gap-4", COLUMNS[items.length] ?? COLUMNS[4]),
12
20
  children: items.map((item) => /* @__PURE__ */ jsxs(Card, {
13
21
  className: "@container/card",
14
22
  children: [/* @__PURE__ */ jsxs(CardHeader, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siyahi/ui",
3
- "version": "0.1.7-next.1",
3
+ "version": "0.1.7-next.3",
4
4
  "description": "Stock shadcn/ui on Base UI and Tailwind v4, a finance theme, a few compositions and formatters.",
5
5
  "keywords": [
6
6
  "base-ui",
package/styles/siyahi.css CHANGED
@@ -194,3 +194,24 @@
194
194
  }
195
195
  }
196
196
  }
197
+
198
+ /*
199
+ * On a narrow card a header action (a toggle, a button) drops under the title
200
+ * and description, left-aligned. Stock CardHeader keeps the action in its own
201
+ * column at every width, so a two-item toggle squeezes the title and runs past
202
+ * the card's edge, where the card's overflow-hidden cuts it off. card.tsx is
203
+ * core, so the fix lives here, unlayered to outrank its utility classes.
204
+ * A lone Badge, the stat tile's figure, is short and stays top right: tiles in
205
+ * a four-column row are as narrow as a phone card.
206
+ */
207
+ @container card-header (width < 24rem) {
208
+ [data-slot="card-header"]:not(:has(> [data-slot="card-action"] > [data-slot="badge"]:only-child)) {
209
+ > * {
210
+ grid-column: 1 / -1;
211
+ }
212
+ > [data-slot="card-action"] {
213
+ grid-row: auto;
214
+ justify-self: start;
215
+ }
216
+ }
217
+ }