@charcuterie/ui 3.30.0 → 3.32.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/README.md +14 -0
- package/dist/ActionTiles/ActionTiles.d.ts +115 -0
- package/dist/ActionTiles/ActionTiles.d.ts.map +1 -0
- package/dist/ActionTiles/ActionTiles.js +115 -0
- package/dist/ActionTiles/ActionTiles.js.map +1 -0
- package/dist/RadioGroup/RadioGroup.d.ts +10 -0
- package/dist/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup/RadioGroup.js +12 -39
- package/dist/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/RadioGroup/RadioGroupOption.d.ts.map +1 -1
- package/dist/RadioGroup/RadioGroupOption.js +3 -33
- package/dist/RadioGroup/RadioGroupOption.js.map +1 -1
- package/dist/Tabs/PanelTabs.d.ts +56 -0
- package/dist/Tabs/PanelTabs.d.ts.map +1 -0
- package/dist/Tabs/PanelTabs.js +163 -0
- package/dist/Tabs/PanelTabs.js.map +1 -0
- package/dist/Tabs/RoutedTabs.d.ts +19 -0
- package/dist/Tabs/RoutedTabs.d.ts.map +1 -0
- package/dist/Tabs/RoutedTabs.js +28 -0
- package/dist/Tabs/RoutedTabs.js.map +1 -0
- package/dist/Tabs/TabLink.d.ts +34 -0
- package/dist/Tabs/TabLink.d.ts.map +1 -0
- package/dist/Tabs/TabLink.js +66 -0
- package/dist/Tabs/TabLink.js.map +1 -0
- package/dist/Tabs/TabTrigger.d.ts +1 -1
- package/dist/Tabs/TabTrigger.d.ts.map +1 -1
- package/dist/Tabs/TabTrigger.js +6 -30
- package/dist/Tabs/TabTrigger.js.map +1 -1
- package/dist/Tabs/Tabs.d.ts +80 -64
- package/dist/Tabs/Tabs.d.ts.map +1 -1
- package/dist/Tabs/Tabs.js +53 -182
- package/dist/Tabs/Tabs.js.map +1 -1
- package/dist/Tabs/tabItems.d.ts +36 -0
- package/dist/Tabs/tabItems.d.ts.map +1 -0
- package/dist/Tabs/tabItems.js +2 -0
- package/dist/Tabs/tabItems.js.map +1 -0
- package/dist/Tabs/tabStyles.d.ts +41 -0
- package/dist/Tabs/tabStyles.d.ts.map +1 -0
- package/dist/Tabs/tabStyles.js +79 -0
- package/dist/Tabs/tabStyles.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tileStyles.d.ts +83 -0
- package/dist/tileStyles.d.ts.map +1 -0
- package/dist/tileStyles.js +98 -0
- package/dist/tileStyles.js.map +1 -0
- package/package.json +1 -1
- package/src/ActionTiles/ActionTiles.mdx +131 -0
- package/src/ActionTiles/ActionTiles.stories.tsx +311 -0
- package/src/ActionTiles/ActionTiles.test.tsx +292 -0
- package/src/ActionTiles/ActionTiles.tsx +292 -0
- package/src/RadioGroup/RadioGroup.mdx +7 -0
- package/src/RadioGroup/RadioGroup.tsx +16 -42
- package/src/RadioGroup/RadioGroupOption.tsx +8 -38
- package/src/Tabs/PanelTabs.tsx +260 -0
- package/src/Tabs/RoutedTabs.tsx +58 -0
- package/src/Tabs/TabLink.tsx +132 -0
- package/src/Tabs/TabTrigger.tsx +10 -39
- package/src/Tabs/Tabs.mdx +70 -0
- package/src/Tabs/Tabs.stories.tsx +133 -1
- package/src/Tabs/Tabs.test.tsx +169 -0
- package/src/Tabs/Tabs.tsx +94 -296
- package/src/Tabs/tabItems.ts +40 -0
- package/src/Tabs/tabStyles.ts +107 -0
- package/src/index.ts +13 -3
- package/src/sourceRules.test.ts +9 -1
- package/src/tileStyles.ts +118 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tile shape, shared by the two components that draw it.
|
|
3
|
+
*
|
|
4
|
+
* A tile is a bordered card carrying a name and a line of help, laid
|
|
5
|
+
* out in a grid that gains columns with its CONTAINER. `RadioGroup`
|
|
6
|
+
* draws one per option when `itemShape="tile"`; `ActionTiles` draws
|
|
7
|
+
* one per action. The two must be the **same box** — a page that puts
|
|
8
|
+
* "which activity" beside "what would you like to do" would otherwise
|
|
9
|
+
* show two cards with different padding, different corners and
|
|
10
|
+
* different gaps, which is the drift this file exists to make
|
|
11
|
+
* impossible.
|
|
12
|
+
*
|
|
13
|
+
* Same argument as `CONTROL_BASE_CLASS`, which `Button` and
|
|
14
|
+
* `ButtonLink` share for the same reason: "identical" spelled as two
|
|
15
|
+
* copies of one string is a promise that survives exactly one edit.
|
|
16
|
+
*
|
|
17
|
+
* These were `RadioGroup`'s private constants until `ActionTiles`
|
|
18
|
+
* shipped. Nothing about their values changed on the way out.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type { ControlSize } from "@charcuterie/tokens"
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A tile is a card, so its padding is a card's rather than a
|
|
25
|
+
* control's — enough that the border reads as a box around content
|
|
26
|
+
* and not as an outline on a line of text.
|
|
27
|
+
*
|
|
28
|
+
* This is also the whole reason `ActionTiles` exists rather than a
|
|
29
|
+
* `Button` with a `className`: a `Button` is sized by
|
|
30
|
+
* `h-(--control-height-md)` and carries **no block padding at all**,
|
|
31
|
+
* so an app that reaches for `height: auto` to let one wrap gets a
|
|
32
|
+
* two-line card with `padding: 0` down its block axis and no error
|
|
33
|
+
* anywhere. QueuePilot's queue-type chooser shipped exactly that.
|
|
34
|
+
*/
|
|
35
|
+
export const TILE_PADDING_CLASS: Record<
|
|
36
|
+
ControlSize,
|
|
37
|
+
string
|
|
38
|
+
> = {
|
|
39
|
+
sm: "px-3 py-2.5",
|
|
40
|
+
md: "px-3.5 py-3",
|
|
41
|
+
lg: "px-4 py-3.5",
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The box, and only the box. Every state layered over it is a
|
|
46
|
+
* **border and a surface**, never colour alone — the same reason
|
|
47
|
+
* `Stepper` refuses to say "done" with a hue.
|
|
48
|
+
*/
|
|
49
|
+
export const TILE_BOX_CLASS =
|
|
50
|
+
"rounded-lg border border-border-subtle bg-surface-raised"
|
|
51
|
+
|
|
52
|
+
export const TILE_TEXT_SIZE_CLASS: Record<
|
|
53
|
+
ControlSize,
|
|
54
|
+
string
|
|
55
|
+
> = {
|
|
56
|
+
sm: "text-sm",
|
|
57
|
+
md: "text-md",
|
|
58
|
+
lg: "text-lg",
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* One step down from the tile's own text, and never below `xs`: a
|
|
63
|
+
* hint that keeps shrinking with the density axis is the 11px
|
|
64
|
+
* caption the 2026-08-10 ramp rebuild exists to have removed.
|
|
65
|
+
*/
|
|
66
|
+
export const TILE_HINT_TEXT_CLASS: Record<
|
|
67
|
+
ControlSize,
|
|
68
|
+
string
|
|
69
|
+
> = {
|
|
70
|
+
sm: "text-xs",
|
|
71
|
+
md: "text-xs",
|
|
72
|
+
lg: "text-sm",
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Wider than a list's row gaps: rows are separated by their leading,
|
|
77
|
+
* and tiles by nothing but the gap, so the same 6px that reads as a
|
|
78
|
+
* list reads as a seam between two cards.
|
|
79
|
+
*/
|
|
80
|
+
export const TILE_GAP_CLASS: Record<ControlSize, string> = {
|
|
81
|
+
sm: "gap-1.5",
|
|
82
|
+
md: "gap-2",
|
|
83
|
+
lg: "gap-3",
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* `auto-fill`, and deliberately not `auto-fit`.
|
|
88
|
+
*
|
|
89
|
+
* `auto-fit` collapses the empty tracks and lets the ones that
|
|
90
|
+
* remain share the whole row, so six tiles in a 2560px container
|
|
91
|
+
* become six 420px slabs — the full-width-row shape in a new
|
|
92
|
+
* costume. `auto-fill` keeps the empty tracks, so a tile stays a
|
|
93
|
+
* tile and the grid simply has room to spare.
|
|
94
|
+
*
|
|
95
|
+
* `min(…, 100%)` is what stops the floor overflowing a container
|
|
96
|
+
* narrower than one tile, which is the Narrow View and is otherwise
|
|
97
|
+
* a horizontal scrollbar on a phone.
|
|
98
|
+
*
|
|
99
|
+
* The floor arrives as a custom property rather than an interpolated
|
|
100
|
+
* class because Tailwind scans source *text* for complete class
|
|
101
|
+
* strings: `` `grid-cols-[…${n}px…]` `` generates nothing, paints
|
|
102
|
+
* nothing and reports nothing. One written-out literal reading
|
|
103
|
+
* `var(--charcuterie-tile-min-inline-size)` covers every width an
|
|
104
|
+
* app can ask for — the same reason `Card`'s accent edge goes
|
|
105
|
+
* through one property.
|
|
106
|
+
*
|
|
107
|
+
* This is **not** `useAdaptiveColumns`, and the difference is the
|
|
108
|
+
* question being asked. That hook buys a column with height, for an
|
|
109
|
+
* unbounded gallery that will scroll; a tile set is a bounded group
|
|
110
|
+
* inside a form section or a first step, where the only question is
|
|
111
|
+
* how many fit across the box it was given.
|
|
112
|
+
*/
|
|
113
|
+
export const TILE_COLUMNS_CLASS =
|
|
114
|
+
"grid-cols-[repeat(auto-fill,minmax(min(var(--charcuterie-tile-min-inline-size),100%),1fr))]"
|
|
115
|
+
|
|
116
|
+
/** The property `TILE_COLUMNS_CLASS` reads its floor from. */
|
|
117
|
+
export const TILE_MIN_INLINE_SIZE_PROPERTY =
|
|
118
|
+
"--charcuterie-tile-min-inline-size"
|