@offlinemediainc/offline-ui 0.1.3 → 0.2.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/USAGE.md ADDED
@@ -0,0 +1,239 @@
1
+ # @offlinemediainc/offline-ui
2
+
3
+ Design system knowledge for building Offline interfaces.
4
+
5
+ ---
6
+
7
+ ## The Brand Identity
8
+
9
+ Offline's visual identity is **bold, modern, and premium**. The palette is restrained: black dominates, yellow accents, blue links.
10
+
11
+ **Black (#191919) is the hero.** Primary buttons, text, key UI elements. It grounds everything.
12
+
13
+ **Yellow (#DE8E0F) is sacred.** It's the brand accent — badges, highlights, chart emphasis, premium touches. Never use it for buttons. When users see yellow, it should feel special, not routine.
14
+
15
+ **Blue (#004FFF) means interaction.** Links, clickable text. Users learn: blue = I can click this.
16
+
17
+ This restraint creates hierarchy. When everything is colorful, nothing stands out. When color is rare, it commands attention.
18
+
19
+ ---
20
+
21
+ ## Shadows Communicate Elevation
22
+
23
+ Three levels, each with purpose:
24
+
25
+ - **shadow-card**: Subtle. Cards sit gently on the page. This is your default.
26
+ - **shadow-tag**: Medium. Floating badges, tags that "hover" above content.
27
+ - **shadow-elevated**: Dramatic. Modals, popovers — things that demand focus.
28
+
29
+ Match shadow to importance. A settings card? `shadow-card`. A critical modal? `shadow-elevated`.
30
+
31
+ ---
32
+
33
+ ## Typography Creates Rhythm
34
+
35
+ **Cabinet Grotesk** (display-*) is for moments. Hero headlines, major section titles. It's bold, distinctive — use sparingly.
36
+
37
+ **Satoshi** handles everything else. Headlines, titles, body, labels. It's the workhorse. Clean, readable, professional.
38
+
39
+ **DM Mono** is for data. Stats, numbers, code. When precision matters.
40
+
41
+ The scale flows: display (36/32/29) → headline (26/23/20) → title (18/16/14) → body (16/14/12/10) → label (14/12/10).
42
+
43
+ Pick based on content importance, not aesthetic preference.
44
+
45
+ ---
46
+
47
+ ## The Navigation System
48
+
49
+ Sidebar and Breadcrumb work together. They answer different questions:
50
+
51
+ **Sidebar**: "Where can I go?" Shows all destinations.
52
+
53
+ **Breadcrumb**: "Where am I? How did I get here?" Shows the path back.
54
+
55
+ The current page appears in BOTH places — this is intentional:
56
+ - In breadcrumb: muted, shows hierarchy
57
+ - As page h1: primary identifier, shows content
58
+
59
+ Don't "fix" this by removing one. They serve different cognitive purposes.
60
+
61
+ ### Breadcrumb Placement
62
+
63
+ Breadcrumbs live in the **sticky header row**, not the content area:
64
+
65
+ ```
66
+ ┌─────────────────────────────────────────────────┐
67
+ │ [☰] │ Home / Partners / Wye Hill / Offers │ ← Header (sticky)
68
+ ├─────────────────────────────────────────────────┤
69
+ │ │
70
+ │ Offers │ ← h1 in content
71
+ │ Manage offers for Wye Hill Kitchen │
72
+ │ │
73
+ ```
74
+
75
+ Use "Home" text, not an icon. The sidebar trigger already provides an icon — two icons side by side creates noise.
76
+
77
+ ---
78
+
79
+ ## Overlays: Dialog vs Sheet vs AlertDialog
80
+
81
+ Three overlay types, each for specific situations:
82
+
83
+ **Dialog**: Forms, content, multi-step flows. User initiates, can dismiss freely.
84
+ - Edit profile, view details, complex forms
85
+ - Add `max-h-[90vh] overflow-y-auto` for mobile
86
+
87
+ **Sheet**: Slide-in panels. Secondary content, navigation, filters.
88
+ - `side="right"`: Detail panels (default)
89
+ - `side="left"`: Mobile navigation
90
+ - `side="bottom"`: Mobile action sheets (add `h-auto max-h-[80vh]`)
91
+
92
+ **AlertDialog**: Interruptions that demand a decision. Blocks until resolved.
93
+ - Destructive confirmations ("Delete this? Cannot undo.")
94
+ - Unsaved changes warnings
95
+ - Header is title + description ONLY. No icons, no decoration. Keep it serious.
96
+
97
+ The choice matters for UX. Dialog = user-driven exploration. AlertDialog = system demands attention. Sheet = supplementary panel.
98
+
99
+ ---
100
+
101
+ ## Status Patterns with Badge
102
+
103
+ Badges communicate state. The variant tells the story:
104
+
105
+ | State | Variant | Examples |
106
+ |-------|---------|----------|
107
+ | Needs attention | `warning` | "Pending Review", "Draft" |
108
+ | Active/live | `secondary` | "Active", "Live", "Today!" |
109
+ | Completed/past | `outline` | "Launched Dec '24", "Event Recap" |
110
+ | Problem | `destructive` | "Failed", "Expired" |
111
+ | Success | `success` | "Approved", "Verified" |
112
+
113
+ For premium/VIP content, use the `badge-premium` class — black background with gold gradient text.
114
+
115
+ Add `shadow-tag` for badges that need to "float" above content.
116
+
117
+ ---
118
+
119
+ ## Chart Colors Tell Stories
120
+
121
+ Colors aren't random. They're semantic:
122
+
123
+ | Color | Variable | Meaning |
124
+ |-------|----------|---------|
125
+ | Yellow | `--chart-1` | Primary data, brand highlight |
126
+ | Blue | `--chart-2` | Secondary series |
127
+ | Green | `--chart-3` | Positive, growth, success |
128
+ | Gray | `--chart-4` | Neutral, baseline, comparison |
129
+ | Red | `--chart-5` | Negative, alerts, problems |
130
+
131
+ For rating distributions:
132
+ - 5 stars → green (chart-3)
133
+ - 4 stars → yellow (chart-1)
134
+ - 3 stars → gray (chart-4)
135
+ - 1-2 stars → red (chart-5)
136
+
137
+ Users intuitively understand: green good, red bad. Don't fight this.
138
+
139
+ ---
140
+
141
+ ## Premium Styling
142
+
143
+ For VIP, premium, or featured content:
144
+
145
+ **surface-premium**: Card with gold gradient border. Instantly signals "special."
146
+
147
+ **badge-premium**: Black pill with gold gradient text. Use for "PREMIUM", "VIP ACCESS", "EXCLUSIVE."
148
+
149
+ Use sparingly. If everything is premium, nothing is.
150
+
151
+ ---
152
+
153
+ ## Card Composition
154
+
155
+ Cards are compositional — mix pieces as needed:
156
+
157
+ - **Card**: Container
158
+ - **CardHeader**: Top section (title area)
159
+ - **CardTitle**: Heading
160
+ - **CardDescription**: Subtitle/helper
161
+ - **CardContent**: Main body
162
+ - **CardFooter**: Actions
163
+
164
+ Add separators with borders:
165
+ - `border-b` on CardHeader
166
+ - `border-t` on CardFooter
167
+
168
+ For compact cards, override padding: `className="p-4"` on sub-components.
169
+
170
+ ---
171
+
172
+ ## Item: The List Building Block
173
+
174
+ Item is flexible — use it for any list-style UI:
175
+
176
+ **Variants**:
177
+ - `default`: Clean, no border (use inside bordered container)
178
+ - `outline`: Individual border per item
179
+ - `muted`: Gray background fill
180
+
181
+ **Composition**:
182
+ - ItemMedia: Icon or image on left
183
+ - ItemContent: Title + description
184
+ - ItemActions: Buttons on right
185
+
186
+ For image thumbnails, use `<ItemMedia variant="image">`.
187
+
188
+ For clickable items, use `asChild` with an anchor: `<Item asChild><a href="#">...`
189
+
190
+ ---
191
+
192
+ ## Tabs: Two Styles
193
+
194
+ **Default (pill/segment)**: Solid background tabs. Good for switching views.
195
+
196
+ **Line style**: Underline indicator. More subtle, good for content categories.
197
+
198
+ For line style, override the defaults:
199
+ ```
200
+ TabsList: bg-transparent border-b rounded-none h-auto p-0
201
+ TabsTrigger: rounded-none border-b-2 border-transparent data-[state=active]:border-black data-[state=active]:bg-transparent data-[state=active]:shadow-none px-4 pb-2
202
+ ```
203
+
204
+ Add icons with `className="gap-1.5"` on the trigger.
205
+
206
+ ---
207
+
208
+ ## Mobile Considerations
209
+
210
+ **Dialogs**: Add `max-h-[90vh] overflow-y-auto` to DialogContent. Prevents content from being cut off.
211
+
212
+ **Sheets**: Bottom sheets need `h-auto max-h-[80vh]`. Left sheets work great for mobile nav.
213
+
214
+ **Sidebar**: Automatically becomes a sheet on mobile. The `OfflineSidebar` component handles this.
215
+
216
+ ---
217
+
218
+ ## Accessibility Essentials
219
+
220
+ - Icon-only buttons need `aria-label`
221
+ - Inputs and checkboxes need `<Label htmlFor>`
222
+ - AlertDialog traps focus — use for real decisions
223
+ - Tabs support arrow key navigation
224
+
225
+ ---
226
+
227
+ ## Common Anti-Patterns
228
+
229
+ 1. **Yellow buttons** — Yellow is accent, not action. Use black (default variant).
230
+
231
+ 2. **Home icon in breadcrumb** — Sidebar trigger already has an icon. Use "Home" text.
232
+
233
+ 3. **Decorating AlertDialog headers** — Keep them clean. Title + description only. This is serious UI.
234
+
235
+ 4. **Missing input labels** — Screen readers need them. Always pair inputs with Label.
236
+
237
+ 5. **Hardcoded colors** — Use CSS variables. They're designed to work together.
238
+
239
+ 6. **Overusing premium styling** — Reserve gold borders and badges for actually premium content.