@appss/ui 0.0.0-stage → 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/AGENTS.md +41 -0
- package/README.md +262 -2
- package/dist/appearances/profiles.d.ts +4 -0
- package/dist/appearances/profiles.d.ts.map +1 -0
- package/dist/appearances/profiles.js +5 -0
- package/dist/appearances/profiles.js.map +1 -0
- package/dist/appearances/reddit/profile.d.ts +187 -0
- package/dist/appearances/reddit/profile.d.ts.map +1 -0
- package/dist/appearances/reddit/profile.js +107 -0
- package/dist/appearances/reddit/profile.js.map +1 -0
- package/dist/appearances/reddit/reddit.module.css.js +240 -0
- package/dist/appearances/reddit/reddit.module.css.js.map +1 -0
- package/dist/appearances/telegram/profile.d.ts +197 -0
- package/dist/appearances/telegram/profile.d.ts.map +1 -0
- package/dist/appearances/telegram/profile.js +114 -0
- package/dist/appearances/telegram/profile.js.map +1 -0
- package/dist/appearances/telegram/telegram.module.css.js +270 -0
- package/dist/appearances/telegram/telegram.module.css.js.map +1 -0
- package/dist/components/Accordion/Accordion.d.ts +4 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +91 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/Accordion.module.css.js +30 -0
- package/dist/components/Accordion/Accordion.module.css.js.map +1 -0
- package/dist/components/Accordion/Accordion.types.d.ts +34 -0
- package/dist/components/Accordion/Accordion.types.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +4 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +50 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/Avatar.module.css.js +18 -0
- package/dist/components/Avatar/Avatar.module.css.js.map +1 -0
- package/dist/components/Avatar/Avatar.types.d.ts +24 -0
- package/dist/components/Avatar/Avatar.types.d.ts.map +1 -0
- package/dist/components/Banner/Banner.d.ts +3 -0
- package/dist/components/Banner/Banner.d.ts.map +1 -0
- package/dist/components/Banner/Banner.js +39 -0
- package/dist/components/Banner/Banner.js.map +1 -0
- package/dist/components/Banner/Banner.module.css.js +24 -0
- package/dist/components/Banner/Banner.module.css.js.map +1 -0
- package/dist/components/Banner/Banner.types.d.ts +25 -0
- package/dist/components/Banner/Banner.types.d.ts.map +1 -0
- package/dist/components/BottomNav/BottomNav.d.ts +3 -0
- package/dist/components/BottomNav/BottomNav.d.ts.map +1 -0
- package/dist/components/BottomNav/BottomNav.js +68 -0
- package/dist/components/BottomNav/BottomNav.js.map +1 -0
- package/dist/components/BottomNav/BottomNav.module.css.js +24 -0
- package/dist/components/BottomNav/BottomNav.module.css.js.map +1 -0
- package/dist/components/BottomNav/BottomNav.types.d.ts +35 -0
- package/dist/components/BottomNav/BottomNav.types.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +3 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +52 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.module.css.js +24 -0
- package/dist/components/Button/Button.module.css.js.map +1 -0
- package/dist/components/Button/Button.types.d.ts +23 -0
- package/dist/components/Button/Button.types.d.ts.map +1 -0
- package/dist/components/Card/Card.d.ts +3 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +50 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/Card.module.css.js +21 -0
- package/dist/components/Card/Card.module.css.js.map +1 -0
- package/dist/components/Card/Card.types.d.ts +23 -0
- package/dist/components/Card/Card.types.d.ts.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.d.ts +7 -0
- package/dist/components/ChatListItem/ChatListItem.d.ts.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.js +75 -0
- package/dist/components/ChatListItem/ChatListItem.js.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.module.css.js +51 -0
- package/dist/components/ChatListItem/ChatListItem.module.css.js.map +1 -0
- package/dist/components/ChatListItem/ChatListItem.types.d.ts +38 -0
- package/dist/components/ChatListItem/ChatListItem.types.d.ts.map +1 -0
- package/dist/components/ChatListItem/MessageStatusIcon.d.ts +7 -0
- package/dist/components/ChatListItem/MessageStatusIcon.d.ts.map +1 -0
- package/dist/components/ChatListItem/MessageStatusIcon.js +18 -0
- package/dist/components/ChatListItem/MessageStatusIcon.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +4 -0
- package/dist/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.js +63 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/Dialog.module.css.js +21 -0
- package/dist/components/Dialog/Dialog.module.css.js.map +1 -0
- package/dist/components/Dialog/Dialog.types.d.ts +26 -0
- package/dist/components/Dialog/Dialog.types.d.ts.map +1 -0
- package/dist/components/Divider/Divider.d.ts +3 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.js +27 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/Divider.module.css.js +9 -0
- package/dist/components/Divider/Divider.module.css.js.map +1 -0
- package/dist/components/Divider/Divider.types.d.ts +17 -0
- package/dist/components/Divider/Divider.types.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -0
- package/dist/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.js +49 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/IconButton.module.css.js +15 -0
- package/dist/components/IconButton/IconButton.module.css.js.map +1 -0
- package/dist/components/IconButton/IconButton.types.d.ts +25 -0
- package/dist/components/IconButton/IconButton.types.d.ts.map +1 -0
- package/dist/components/Likes/Likes.d.ts +4 -0
- package/dist/components/Likes/Likes.d.ts.map +1 -0
- package/dist/components/Likes/Likes.js +85 -0
- package/dist/components/Likes/Likes.js.map +1 -0
- package/dist/components/Likes/Likes.module.css.js +18 -0
- package/dist/components/Likes/Likes.module.css.js.map +1 -0
- package/dist/components/Likes/Likes.types.d.ts +27 -0
- package/dist/components/Likes/Likes.types.d.ts.map +1 -0
- package/dist/components/Link/Link.d.ts +3 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.js +47 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/Link/Link.module.css.js +15 -0
- package/dist/components/Link/Link.module.css.js.map +1 -0
- package/dist/components/Link/Link.types.d.ts +22 -0
- package/dist/components/Link/Link.types.d.ts.map +1 -0
- package/dist/components/Menu/Menu.d.ts +4 -0
- package/dist/components/Menu/Menu.d.ts.map +1 -0
- package/dist/components/Menu/Menu.js +134 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/Menu.module.css.js +27 -0
- package/dist/components/Menu/Menu.module.css.js.map +1 -0
- package/dist/components/Menu/Menu.types.d.ts +32 -0
- package/dist/components/Menu/Menu.types.d.ts.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.d.ts +3 -0
- package/dist/components/MessageBubble/MessageBubble.d.ts.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.js +85 -0
- package/dist/components/MessageBubble/MessageBubble.js.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.module.css.js +54 -0
- package/dist/components/MessageBubble/MessageBubble.module.css.js.map +1 -0
- package/dist/components/MessageBubble/MessageBubble.types.d.ts +54 -0
- package/dist/components/MessageBubble/MessageBubble.types.d.ts.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.d.ts +3 -0
- package/dist/components/MessageComposer/MessageComposer.d.ts.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.js +55 -0
- package/dist/components/MessageComposer/MessageComposer.js.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.module.css.js +24 -0
- package/dist/components/MessageComposer/MessageComposer.module.css.js.map +1 -0
- package/dist/components/MessageComposer/MessageComposer.types.d.ts +27 -0
- package/dist/components/MessageComposer/MessageComposer.types.d.ts.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.d.ts +3 -0
- package/dist/components/MessageDivider/MessageDivider.d.ts.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.js +28 -0
- package/dist/components/MessageDivider/MessageDivider.js.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.module.css.js +12 -0
- package/dist/components/MessageDivider/MessageDivider.module.css.js.map +1 -0
- package/dist/components/MessageDivider/MessageDivider.types.d.ts +19 -0
- package/dist/components/MessageDivider/MessageDivider.types.d.ts.map +1 -0
- package/dist/components/NavBar/NavBar.d.ts +3 -0
- package/dist/components/NavBar/NavBar.d.ts.map +1 -0
- package/dist/components/NavBar/NavBar.js +42 -0
- package/dist/components/NavBar/NavBar.js.map +1 -0
- package/dist/components/NavBar/NavBar.module.css.js +24 -0
- package/dist/components/NavBar/NavBar.module.css.js.map +1 -0
- package/dist/components/NavBar/NavBar.types.d.ts +26 -0
- package/dist/components/NavBar/NavBar.types.d.ts.map +1 -0
- package/dist/components/NavList/NavList.d.ts +3 -0
- package/dist/components/NavList/NavList.d.ts.map +1 -0
- package/dist/components/NavList/NavList.js +53 -0
- package/dist/components/NavList/NavList.js.map +1 -0
- package/dist/components/NavList/NavList.module.css.js +24 -0
- package/dist/components/NavList/NavList.module.css.js.map +1 -0
- package/dist/components/NavList/NavList.types.d.ts +31 -0
- package/dist/components/NavList/NavList.types.d.ts.map +1 -0
- package/dist/components/SearchField/SearchField.d.ts +3 -0
- package/dist/components/SearchField/SearchField.d.ts.map +1 -0
- package/dist/components/SearchField/SearchField.js +38 -0
- package/dist/components/SearchField/SearchField.js.map +1 -0
- package/dist/components/SearchField/SearchField.module.css.js +18 -0
- package/dist/components/SearchField/SearchField.module.css.js.map +1 -0
- package/dist/components/SearchField/SearchField.types.d.ts +23 -0
- package/dist/components/SearchField/SearchField.types.d.ts.map +1 -0
- package/dist/components/Section/Section.d.ts +4 -0
- package/dist/components/Section/Section.d.ts.map +1 -0
- package/dist/components/Section/Section.js +101 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/Section/Section.module.css.js +36 -0
- package/dist/components/Section/Section.module.css.js.map +1 -0
- package/dist/components/Section/Section.types.d.ts +36 -0
- package/dist/components/Section/Section.types.d.ts.map +1 -0
- package/dist/components/Stat/Stat.d.ts +4 -0
- package/dist/components/Stat/Stat.d.ts.map +1 -0
- package/dist/components/Stat/Stat.js +31 -0
- package/dist/components/Stat/Stat.js.map +1 -0
- package/dist/components/Stat/Stat.module.css.js +15 -0
- package/dist/components/Stat/Stat.module.css.js.map +1 -0
- package/dist/components/Stat/Stat.types.d.ts +18 -0
- package/dist/components/Stat/Stat.types.d.ts.map +1 -0
- package/dist/components/Switch/Switch.d.ts +4 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -0
- package/dist/components/Switch/Switch.js +45 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/Switch.module.css.js +21 -0
- package/dist/components/Switch/Switch.module.css.js.map +1 -0
- package/dist/components/Switch/Switch.types.d.ts +19 -0
- package/dist/components/Switch/Switch.types.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +4 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +92 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/Tabs.module.css.js +24 -0
- package/dist/components/Tabs/Tabs.module.css.js.map +1 -0
- package/dist/components/Tabs/Tabs.types.d.ts +31 -0
- package/dist/components/Tabs/Tabs.types.d.ts.map +1 -0
- package/dist/components/Tag/Tag.d.ts +3 -0
- package/dist/components/Tag/Tag.d.ts.map +1 -0
- package/dist/components/Tag/Tag.js +33 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Tag/Tag.module.css.js +12 -0
- package/dist/components/Tag/Tag.module.css.js.map +1 -0
- package/dist/components/Tag/Tag.types.d.ts +20 -0
- package/dist/components/Tag/Tag.types.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +63 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.module.css.js +12 -0
- package/dist/components/Tooltip/Tooltip.module.css.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +24 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts.map +1 -0
- package/dist/core/AppssProvider.d.ts +21 -0
- package/dist/core/AppssProvider.d.ts.map +1 -0
- package/dist/core/AppssProvider.js +42 -0
- package/dist/core/AppssProvider.js.map +1 -0
- package/dist/core/appearance.d.ts +28 -0
- package/dist/core/appearance.d.ts.map +1 -0
- package/dist/core/appearance.js +40 -0
- package/dist/core/appearance.js.map +1 -0
- package/dist/core/host.d.ts +28 -0
- package/dist/core/host.d.ts.map +1 -0
- package/dist/core/host.js +42 -0
- package/dist/core/host.js.map +1 -0
- package/dist/hosts/adapters.d.ts +5 -0
- package/dist/hosts/adapters.d.ts.map +1 -0
- package/dist/hosts/adapters.js +21 -0
- package/dist/hosts/adapters.js.map +1 -0
- package/dist/icons/icons.d.ts +164 -0
- package/dist/icons/icons.d.ts.map +1 -0
- package/dist/icons/icons.js +220 -0
- package/dist/icons/icons.js.map +1 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +43 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations.d.ts +9 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/integrations.js +27 -0
- package/dist/integrations.js.map +1 -0
- package/dist/modules/hideOnScroll.d.ts +7 -0
- package/dist/modules/hideOnScroll.d.ts.map +1 -0
- package/dist/modules/hideOnScroll.js +39 -0
- package/dist/modules/hideOnScroll.js.map +1 -0
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +5 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/recipes/buttons.d.ts +30 -0
- package/dist/recipes/buttons.d.ts.map +1 -0
- package/dist/recipes/buttons.js +28 -0
- package/dist/recipes/buttons.js.map +1 -0
- package/dist/recipes/index.d.ts +4 -0
- package/dist/recipes/index.d.ts.map +1 -0
- package/dist/recipes/index.js +23 -0
- package/dist/recipes/index.js.map +1 -0
- package/dist/recipes/navigation.d.ts +36 -0
- package/dist/recipes/navigation.d.ts.map +1 -0
- package/dist/recipes/navigation.js +28 -0
- package/dist/recipes/navigation.js.map +1 -0
- package/dist/recipes/recipes.module.css.js +27 -0
- package/dist/recipes/recipes.module.css.js.map +1 -0
- package/dist/recipes/whatsapp.d.ts +155 -0
- package/dist/recipes/whatsapp.d.ts.map +1 -0
- package/dist/recipes/whatsapp.js +155 -0
- package/dist/recipes/whatsapp.js.map +1 -0
- package/dist/recipes/whatsapp.module.css.js +135 -0
- package/dist/recipes/whatsapp.module.css.js.map +1 -0
- package/dist/styles.css +4157 -0
- package/docs/components/Accordion.md +76 -0
- package/docs/components/Avatar.md +64 -0
- package/docs/components/Banner.md +70 -0
- package/docs/components/BottomNav.md +86 -0
- package/docs/components/Button.md +93 -0
- package/docs/components/Card.md +75 -0
- package/docs/components/Cell.md +89 -0
- package/docs/components/ChatListItem.md +102 -0
- package/docs/components/Dialog.md +93 -0
- package/docs/components/Divider.md +66 -0
- package/docs/components/IconButton.md +86 -0
- package/docs/components/Likes.md +74 -0
- package/docs/components/Link.md +79 -0
- package/docs/components/Menu.md +105 -0
- package/docs/components/MessageBubble.md +91 -0
- package/docs/components/MessageComposer.md +93 -0
- package/docs/components/MessageDivider.md +66 -0
- package/docs/components/NavBar.md +85 -0
- package/docs/components/NavList.md +85 -0
- package/docs/components/SearchField.md +81 -0
- package/docs/components/Section.md +81 -0
- package/docs/components/Stat.md +66 -0
- package/docs/components/Switch.md +74 -0
- package/docs/components/Tabs.md +85 -0
- package/docs/components/Tag.md +63 -0
- package/docs/components/Tooltip.md +62 -0
- package/docs/exports.json +90 -0
- package/docs/foundations.md +99 -0
- package/docs/gaps.json +12 -0
- package/docs/icons.md +20 -0
- package/docs/index.md +57 -0
- package/docs/recipes.md +43 -0
- package/docs/replaces.json +12 -0
- package/package.json +81 -4
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
ARIA tabs with keyboard support (arrows, Home, End): an underline bar, pills or a segmented control. Controlled: you own `value`.
|
|
4
|
+
|
|
5
|
+
Import `Tabs` from `@appss/ui`.
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- Switching or filtering views inside one screen: All / Unread, Upcoming / Past.
|
|
10
|
+
- A segmented choice of 2-4 options: Day / Week / Month (`variant="segmented"`, `stretch`).
|
|
11
|
+
- Chat folders or categories as pills (`variant="pill"`), with `badge` counters.
|
|
12
|
+
- Without `content` on items the tabs act as a filter and you render the list yourself; with `content` they render the active panel.
|
|
13
|
+
- Not for top-level app sections: use `BottomNav`.
|
|
14
|
+
- Not for picking from many options: use `Menu` (actions) or a select (gap).
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Notes |
|
|
19
|
+
| --------------- | ---------------------------------------------- | ------------- | ------------------------------------------------ |
|
|
20
|
+
| `items` | `{ id, label, badge?, disabled?, content? }[]` | required | `label` is a string; `content` makes it a panel. |
|
|
21
|
+
| `value` | `string` | required | Id of the selected tab. |
|
|
22
|
+
| `onValueChange` | `(id: string) => void` | | Set your state here. |
|
|
23
|
+
| `label` | `string` | required | Accessible name of the tab list, e.g. "Period". |
|
|
24
|
+
| `variant` | `"underline" \| "pill" \| "segmented"` | `"underline"` | |
|
|
25
|
+
| `stretch` | `boolean` | `false` | Tabs share the full width. |
|
|
26
|
+
|
|
27
|
+
Also `appearance`, `recipe`, `adaptation`, `className`, `style` and native `<div>` attributes except `children` and `onChange`.
|
|
28
|
+
|
|
29
|
+
## Slots
|
|
30
|
+
|
|
31
|
+
`root`, `list`, `tab`, `label`, `badge`, `panel`.
|
|
32
|
+
|
|
33
|
+
## Sizes by platform
|
|
34
|
+
|
|
35
|
+
| Platform | Tab height | Look |
|
|
36
|
+
| -------- | ------------------------------ | ------------------------------------ |
|
|
37
|
+
| Web | 40 (segmented 34) | accent underline or filled pill |
|
|
38
|
+
| Telegram | 44, indicator 3 px | theme colours, iOS segmented control |
|
|
39
|
+
| Reddit | 40, pills, dark 2 px indicator | dense |
|
|
40
|
+
|
|
41
|
+
## Recipes
|
|
42
|
+
|
|
43
|
+
None.
|
|
44
|
+
|
|
45
|
+
## Correct
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { useState } from "react";
|
|
49
|
+
|
|
50
|
+
const periods = [
|
|
51
|
+
{ id: "week", label: "Week" },
|
|
52
|
+
{ id: "month", label: "Month" },
|
|
53
|
+
{ id: "year", label: "Year" },
|
|
54
|
+
] as const;
|
|
55
|
+
|
|
56
|
+
export function PeriodSwitch() {
|
|
57
|
+
const [period, setPeriod] = useState("week");
|
|
58
|
+
return (
|
|
59
|
+
<Tabs
|
|
60
|
+
label="Period"
|
|
61
|
+
variant="segmented"
|
|
62
|
+
stretch
|
|
63
|
+
items={periods}
|
|
64
|
+
value={period}
|
|
65
|
+
onValueChange={setPeriod}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Wrong
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
// Hand-made tabs: no ARIA roles, no keyboard support, hard-coded active colour.
|
|
75
|
+
<div className="tabs">
|
|
76
|
+
<button style={{ borderBottom: "2px solid #6554d9" }}>Week</button>
|
|
77
|
+
<button>Month</button>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
// Invented props: Tabs takes items, value, onValueChange and label.
|
|
81
|
+
<Tabs tabs={["Week", "Month"]} active={0} onChange={setTab} />
|
|
82
|
+
|
|
83
|
+
// Missing value and label: TypeScript errors, and the tab list has no name.
|
|
84
|
+
<Tabs items={periods} />
|
|
85
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Tag
|
|
2
|
+
|
|
3
|
+
A small non-interactive label: status, category, flair, chat folder.
|
|
4
|
+
|
|
5
|
+
Import `Tag` from `@appss/ui`.
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- Statuses: Paid, Pending, Cancelled, New (`tone` carries the meaning).
|
|
10
|
+
- Categories and flair on cards and feed posts.
|
|
11
|
+
- Folder labels under a `ChatListItem` (`tags`).
|
|
12
|
+
- Not for clickable filters: use `Tabs variant="pill"`.
|
|
13
|
+
- Not for a counter on an icon: use `IconButton` `badge`.
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Default | Notes |
|
|
18
|
+
| ---------- | ------------------------------------------------------------------------ | ----------- | ----------------- |
|
|
19
|
+
| `children` | `ReactNode` | | Label text. |
|
|
20
|
+
| `tone` | `"neutral" \| "accent" \| "brand" \| "success" \| "warning" \| "danger"` | `"neutral"` | |
|
|
21
|
+
| `variant` | `"soft" \| "solid" \| "outline" \| "plain"` | `"soft"` | |
|
|
22
|
+
| `icon` | `ReactNode` | | Icon before text. |
|
|
23
|
+
|
|
24
|
+
Also `appearance`, `recipe`, `adaptation`, `className`, `style` and native `<span>` attributes. There is no `color` prop: pick a `tone`.
|
|
25
|
+
|
|
26
|
+
## Slots
|
|
27
|
+
|
|
28
|
+
`root`, `icon`, `label`.
|
|
29
|
+
|
|
30
|
+
## Sizes by platform
|
|
31
|
+
|
|
32
|
+
| Platform | Height | Look |
|
|
33
|
+
| -------- | ------ | ------------------------------------- |
|
|
34
|
+
| Web | 22 | 12 px text, pill |
|
|
35
|
+
| Telegram | 22 | uppercase on a tinted plate, radius 4 |
|
|
36
|
+
| Reddit | 20 | 12 px text |
|
|
37
|
+
|
|
38
|
+
## Recipes
|
|
39
|
+
|
|
40
|
+
None.
|
|
41
|
+
|
|
42
|
+
## Correct
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
const statusTone = { paid: "success", pending: "warning", cancelled: "danger" } as const;
|
|
46
|
+
|
|
47
|
+
export function OrderStatus({ status }: { status: keyof typeof statusTone }) {
|
|
48
|
+
const label = { paid: "Paid", pending: "Pending", cancelled: "Cancelled" }[status];
|
|
49
|
+
return <Tag tone={statusTone[status]}>{label}</Tag>;
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Wrong
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
// Raw badge with hard-coded colours.
|
|
57
|
+
<span style={{ background: "#e8f5e9", color: "#2e7d32", borderRadius: 4, padding: "2px 6px" }}>
|
|
58
|
+
Paid
|
|
59
|
+
</span>
|
|
60
|
+
|
|
61
|
+
// Invented colour prop and a click handler: Tag is not interactive.
|
|
62
|
+
<Tag color="green" onClick={filterPaid}>Paid</Tag>
|
|
63
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
A short hint shown on hover and on keyboard focus, closed by Escape. Supplementary only: never the only name of a control.
|
|
4
|
+
|
|
5
|
+
Import `Tooltip` from `@appss/ui`.
|
|
6
|
+
|
|
7
|
+
## When to use
|
|
8
|
+
|
|
9
|
+
- Explaining an icon action on desktop and web.
|
|
10
|
+
- Not as the accessible name of a button: give `IconButton` a `label` (the tooltip can repeat it).
|
|
11
|
+
- Not for long help text: use `Accordion` or a `Dialog`. Touch devices rarely show tooltips.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Notes |
|
|
16
|
+
| ----------- | --------------------------------------- | ---------- | ------------------------------------------ |
|
|
17
|
+
| `content` | `string` | required | Short text. |
|
|
18
|
+
| `children` | `ReactElement` | required | One focusable element, e.g. an IconButton. |
|
|
19
|
+
| `placement` | `"top" \| "bottom" \| "start" \| "end"` | `"bottom"` | |
|
|
20
|
+
| `delay` | `number` | `300` | Hover delay in ms. |
|
|
21
|
+
|
|
22
|
+
Also `appearance`, `recipe`, `adaptation`, `className`, `style` and native `<span>` attributes except `content` and `children`.
|
|
23
|
+
|
|
24
|
+
## Slots
|
|
25
|
+
|
|
26
|
+
`root`, `tooltip`.
|
|
27
|
+
|
|
28
|
+
## Sizes by platform
|
|
29
|
+
|
|
30
|
+
| Platform | Look |
|
|
31
|
+
| -------- | ---------------------------------- |
|
|
32
|
+
| Web | small dark label |
|
|
33
|
+
| Telegram | radius 10, near-black, 14/500 text |
|
|
34
|
+
| Reddit | radius 4, 14/20 semibold |
|
|
35
|
+
|
|
36
|
+
## Recipes
|
|
37
|
+
|
|
38
|
+
None.
|
|
39
|
+
|
|
40
|
+
## Correct
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { TransferIcon } from "@appss/ui/icons";
|
|
44
|
+
|
|
45
|
+
export function SortButton({ onSort }: { onSort: () => void }) {
|
|
46
|
+
return (
|
|
47
|
+
<Tooltip content="Newest first" placement="top">
|
|
48
|
+
<IconButton label="Change sort order" icon={<TransferIcon />} onClick={onSort} />
|
|
49
|
+
</Tooltip>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Wrong
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
// The native title attribute: not shown on focus, not styled.
|
|
58
|
+
<button title="Change sort order"><TransferIcon /></button>
|
|
59
|
+
|
|
60
|
+
// Tooltip as the only name, and a plain text child that cannot take focus.
|
|
61
|
+
<Tooltip content="Sort"><span><TransferIcon /></span></Tooltip>
|
|
62
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
"Button",
|
|
4
|
+
"BottomNav",
|
|
5
|
+
"Link",
|
|
6
|
+
"Tabs",
|
|
7
|
+
"Menu",
|
|
8
|
+
"NavBar",
|
|
9
|
+
"Section",
|
|
10
|
+
"Cell",
|
|
11
|
+
"Switch",
|
|
12
|
+
"IconButton",
|
|
13
|
+
"Avatar",
|
|
14
|
+
"Tag",
|
|
15
|
+
"Divider",
|
|
16
|
+
"Stat",
|
|
17
|
+
"SearchField",
|
|
18
|
+
"NavList",
|
|
19
|
+
"Accordion",
|
|
20
|
+
"Card",
|
|
21
|
+
"Tooltip",
|
|
22
|
+
"Likes",
|
|
23
|
+
"Banner",
|
|
24
|
+
"Dialog",
|
|
25
|
+
"ChatListItem",
|
|
26
|
+
"MessageBubble",
|
|
27
|
+
"MessageDivider",
|
|
28
|
+
"MessageComposer"
|
|
29
|
+
],
|
|
30
|
+
"icons": [
|
|
31
|
+
"MoreIcon",
|
|
32
|
+
"PlusIcon",
|
|
33
|
+
"BackIcon",
|
|
34
|
+
"ChevronRightIcon",
|
|
35
|
+
"CloseIcon",
|
|
36
|
+
"SearchIcon",
|
|
37
|
+
"CameraIcon",
|
|
38
|
+
"VideoIcon",
|
|
39
|
+
"PhoneIcon",
|
|
40
|
+
"CallOutgoingIcon",
|
|
41
|
+
"CheckIcon",
|
|
42
|
+
"DoubleCheckIcon",
|
|
43
|
+
"ReplyIcon",
|
|
44
|
+
"MicIcon",
|
|
45
|
+
"StickerIcon",
|
|
46
|
+
"QrCodeIcon",
|
|
47
|
+
"EditIcon",
|
|
48
|
+
"StatusIcon",
|
|
49
|
+
"CommunitiesIcon",
|
|
50
|
+
"ChatsIcon",
|
|
51
|
+
"ChatsFilledIcon",
|
|
52
|
+
"ChatIcon",
|
|
53
|
+
"PersonIcon",
|
|
54
|
+
"ContactListIcon",
|
|
55
|
+
"StarIcon",
|
|
56
|
+
"BroadcastIcon",
|
|
57
|
+
"LaptopIcon",
|
|
58
|
+
"KeyIcon",
|
|
59
|
+
"LockIcon",
|
|
60
|
+
"NotificationIcon",
|
|
61
|
+
"TransferIcon",
|
|
62
|
+
"ShieldIcon",
|
|
63
|
+
"HelpIcon",
|
|
64
|
+
"MutedIcon",
|
|
65
|
+
"VerifiedIcon",
|
|
66
|
+
"PinIcon",
|
|
67
|
+
"AttachIcon",
|
|
68
|
+
"NewMessageIcon",
|
|
69
|
+
"AddStoryIcon"
|
|
70
|
+
],
|
|
71
|
+
"recipes": [
|
|
72
|
+
"essentialButton",
|
|
73
|
+
"pillButton",
|
|
74
|
+
"softButton",
|
|
75
|
+
"dockNav",
|
|
76
|
+
"lineNav",
|
|
77
|
+
"glassNav",
|
|
78
|
+
"whatsappTabBar",
|
|
79
|
+
"whatsappIconButton",
|
|
80
|
+
"whatsappHeader",
|
|
81
|
+
"whatsappSection",
|
|
82
|
+
"whatsappCell",
|
|
83
|
+
"whatsappSwitch",
|
|
84
|
+
"whatsappAvatar",
|
|
85
|
+
"whatsappChatListItem",
|
|
86
|
+
"whatsappMessageBubble",
|
|
87
|
+
"whatsappMessageDivider",
|
|
88
|
+
"whatsappComposer"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Foundations
|
|
2
|
+
|
|
3
|
+
How `@appss/ui` is styled, how it adapts to each platform, and the rules every screen follows. Start from `docs/index.md` to pick components and open `docs/components/<Name>.md` for props.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import "@appss/ui/styles.css"; // once, at the app root
|
|
9
|
+
import { AppssProvider } from "@appss/ui";
|
|
10
|
+
import { integrations, webIntegration } from "@appss/ui/integrations";
|
|
11
|
+
|
|
12
|
+
export function App({ children }: { children: React.ReactNode }) {
|
|
13
|
+
return (
|
|
14
|
+
<AppssProvider integrations={integrations} fallback={webIntegration}>
|
|
15
|
+
{children}
|
|
16
|
+
</AppssProvider>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Every kit component must render inside `AppssProvider`. In an appss builder project the provider is already mounted in `packages/core/src/CoreApp.tsx`; do not add a second one.
|
|
22
|
+
|
|
23
|
+
| Import | Contents |
|
|
24
|
+
| ------------------------ | ---------------------------------------------------------------------------- |
|
|
25
|
+
| `@appss/ui` | `AppssProvider`, `useHost`, every component and its prop types |
|
|
26
|
+
| `@appss/ui/integrations` | `integrations`, `webIntegration`, `telegramIntegration`, `redditIntegration` |
|
|
27
|
+
| `@appss/ui/recipes` | ready-made styles per component (`docs/recipes.md`) |
|
|
28
|
+
| `@appss/ui/icons` | 39 stroke icons (`docs/icons.md`) |
|
|
29
|
+
| `@appss/ui/modules` | `hideOnScroll` for BottomNav |
|
|
30
|
+
| `@appss/ui/styles.css` | all styles; without it components are unstyled |
|
|
31
|
+
|
|
32
|
+
Components come from `@appss/ui`, icons and recipes from `@appss/ui/icons` and `@appss/ui/recipes`. Import by name; never `import *`.
|
|
33
|
+
|
|
34
|
+
## Appearance layers
|
|
35
|
+
|
|
36
|
+
Each component is styled in layers, weakest first:
|
|
37
|
+
|
|
38
|
+
1. **Base**: the neutral web look.
|
|
39
|
+
2. **Recipe** (`recipe={...}`): a ready-made style for one component (shape, spacing, colour).
|
|
40
|
+
3. **Platform kit**: the Telegram or Reddit look, applied automatically inside those platforms.
|
|
41
|
+
4. **`appearance`**: per-instance tweaks by slot: `{ classNames: { slot: "class" }, styles: { slot: { ...CSS } } }`.
|
|
42
|
+
5. **`className` / `style`**: on the root element.
|
|
43
|
+
|
|
44
|
+
Consequences:
|
|
45
|
+
|
|
46
|
+
- Inside Telegram and Reddit the platform kit **overrides the recipe**; recipes show on the web. Pass `adaptation="fixed"` to keep a recipe everywhere (the platform kit is then skipped for that instance).
|
|
47
|
+
- States (`disabled`, the selected tab, `checked`, `activeId`) are props, never styling.
|
|
48
|
+
- Slot names are fixed per component (each doc lists them). An unknown slot or an unknown prop is a TypeScript error: do not invent props, variants or slots.
|
|
49
|
+
|
|
50
|
+
## Platforms
|
|
51
|
+
|
|
52
|
+
`AppssProvider` detects the host:
|
|
53
|
+
|
|
54
|
+
| Platform | Detected by | Force it |
|
|
55
|
+
| ----------------- | ----------------------------------------------------------------------------- | ----------------- |
|
|
56
|
+
| Web | default | `host="web"` |
|
|
57
|
+
| Telegram Mini App | `tgWebAppData` and `tgWebAppPlatform` in the launch hash, or `__APPSS_HOST__` | `host="telegram"` |
|
|
58
|
+
| Reddit (Devvit) | only `window.__APPSS_HOST__ = "reddit"` | `host="reddit"` |
|
|
59
|
+
|
|
60
|
+
| Platform | Character | Key traits |
|
|
61
|
+
| ------------------ | --------------------------- | ------------------------------------------------------------------------------------------- |
|
|
62
|
+
| Web (base) | neutral, modern, calm | soft radii 10-16 px, font inherited from the page; projects set their own accent |
|
|
63
|
+
| Telegram | light, native, iOS-like | colours from the user's Telegram theme, glass buttons and capsules, grouped lists radius 12 |
|
|
64
|
+
| Reddit | energetic, community, dense | orange actions, blue links, pill shapes, heights 32/40/48, 14/20 semibold text |
|
|
65
|
+
| WhatsApp (recipes) | friendly, everyday, calm | green accents, white round buttons with shadow, groups radius 26, large 17 px text |
|
|
66
|
+
|
|
67
|
+
Choosing a look: a Telegram Mini App needs nothing, the kit switches itself. A messenger or home-services web app: the WhatsApp recipes. A feed, community or voting app: the Reddit kit. Anything else: the base with Button and BottomNav recipes (`docs/recipes.md`).
|
|
68
|
+
|
|
69
|
+
Dark mode: Telegram follows the client theme automatically; Reddit and the Telegram fallbacks follow `prefers-color-scheme` or `data-appss-theme="light" | "dark"` on any ancestor. WhatsApp recipes are light only.
|
|
70
|
+
|
|
71
|
+
## Colour tokens
|
|
72
|
+
|
|
73
|
+
The web look reads every colour from `--appss-*` CSS variables (`src/ui/tokens.css` in the kit); their defaults are the kit's own palette. Set them without a layer to re-colour every component at once, e.g. `:root { --appss-accent: #1f8f55; --appss-on-accent: #fff; }`. The main ones: `--appss-accent`, `--appss-on-accent`, `--appss-accent-soft`, `--appss-text`, `--appss-text-hint`, `--appss-surface`, `--appss-surface-secondary`, `--appss-border`, `--appss-danger`, `--appss-success`, `--appss-warning`, `--appss-focus`. In an appss builder project they are already bound to the `--app-*` tokens: change those instead. The Telegram and Reddit kits keep their platform colours.
|
|
74
|
+
|
|
75
|
+
## Theming rules
|
|
76
|
+
|
|
77
|
+
- **Never hard-code platform colours.** In Telegram, colours come from the user's theme (`--tg-theme-*`): a hex value breaks dark and custom themes.
|
|
78
|
+
- Change the look in this order: project tokens, then component props and recipes, then `appearance` / `className` by slot, then your own variant that wraps the kit component, and only for what the kit lacks, your own component.
|
|
79
|
+
- Your own CSS (layout, gap components, slot classes) uses the project's colour tokens. In an appss builder project these are the `--app-*` tokens in `packages/core/src/styles.css`: `--app-bg`, `--app-surface`, `--app-surface-2`, `--app-text`, `--app-text-soft`, `--app-border`, `--app-accent`, `--app-accent-text`, `--app-accent-soft`, `--app-danger`, `--app-success`, `--app-warning`, `--app-shadow`, `--app-radius`, `--app-radius-sm`. Spacing and sizes can be plain px.
|
|
80
|
+
- One character per screen: do not mix recipes of different moods (`docs/recipes.md`).
|
|
81
|
+
- One `variant="solid"` Button per screen; destructive actions use `tone="destructive"`.
|
|
82
|
+
|
|
83
|
+
## What the kit does not have
|
|
84
|
+
|
|
85
|
+
Text fields and textareas, select, checkbox and radio, date and time pickers, a full sheet (Dialog `placement="bottom"` covers simple cases), toast, skeleton, empty state, progress bar, charts. Write them yourself as small components in the project (`packages/core/src/ui` in a builder project) on the colour tokens, with a real `<label>` or `aria-label`, and mark them so they are easy to find later.
|
|
86
|
+
|
|
87
|
+
## Accessibility rules
|
|
88
|
+
|
|
89
|
+
- Required names: `label` on IconButton, Tabs, SearchField and MessageComposer; `name` on Avatar; `triggerLabel` on a Menu whose trigger is an icon; visible text or `aria-label` on Switch.
|
|
90
|
+
- Some built-in accessible strings default to Russian. Pass English ones where a prop exists: Likes `upLabel`, `downLabel`, `label`; BottomNav `aria-label`.
|
|
91
|
+
- A placeholder is not a label. A Tooltip is not a label.
|
|
92
|
+
- Never nest interactive elements: a Cell with `href` or `onClick` must not contain a Switch or Button; put the control in a static Cell's `after`.
|
|
93
|
+
- Navigation components are controlled: keep `activeId` / `value` in state and call `event.preventDefault()` in `onNavigate` for SPA routing.
|
|
94
|
+
|
|
95
|
+
## Content rules
|
|
96
|
+
|
|
97
|
+
- Neutral, realistic product content. No lorem ipsum, no real people, brands, logos, mascots, phone numbers or codes.
|
|
98
|
+
- No platform logos or brand icons (Telegram, Reddit, WhatsApp, Apple): the icon set has none and must not get any.
|
|
99
|
+
- Use icons from `@appss/ui/icons`; write an inline SVG only when no icon fits, with `stroke="currentColor"`. Never use emoji as icons.
|
package/docs/gaps.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "need": "text field / textarea", "category": "input" },
|
|
3
|
+
{ "need": "select", "category": "input" },
|
|
4
|
+
{ "need": "checkbox / radio", "category": "input" },
|
|
5
|
+
{ "need": "date / time picker", "category": "input" },
|
|
6
|
+
{ "need": "sheet (Dialog placement=\"bottom\" covers simple cases)", "category": "overlays" },
|
|
7
|
+
{ "need": "toast", "category": "overlays" },
|
|
8
|
+
{ "need": "skeleton", "category": "content" },
|
|
9
|
+
{ "need": "empty state", "category": "content" },
|
|
10
|
+
{ "need": "progress bar", "category": "content" },
|
|
11
|
+
{ "need": "charts", "category": "content" }
|
|
12
|
+
]
|
package/docs/icons.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Icons
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { ChatsIcon, PlusIcon } from "@appss/ui/icons";
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Original stroke icons on a 24 px grid, `stroke="currentColor"` (they take the text colour). Props: `size` (default 24), `strokeWidth` (default 1.75), `title` (accessible name). Without `title` an icon is decorative and hidden from screen readers. Inside IconButton, Button, Cell and navigation items do not pass `title`: the control provides the name.
|
|
8
|
+
|
|
9
|
+
| Group | Icons |
|
|
10
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
11
|
+
| Navigation | `BackIcon`, `ChevronRightIcon`, `CloseIcon`, `MoreIcon`, `PlusIcon`, `SearchIcon`, `EditIcon`, `QrCodeIcon` |
|
|
12
|
+
| Tabs | `ChatsIcon`, `ChatsFilledIcon` (filled, for the active tab), `ChatIcon`, `PhoneIcon`, `StatusIcon`, `CommunitiesIcon`, `PersonIcon` |
|
|
13
|
+
| Messages | `CheckIcon`, `DoubleCheckIcon`, `ReplyIcon`, `MicIcon`, `StickerIcon`, `AttachIcon`, `CameraIcon`, `VideoIcon`, `CallOutgoingIcon`, `NewMessageIcon`, `AddStoryIcon`, `PinIcon`, `MutedIcon`, `VerifiedIcon` |
|
|
14
|
+
| Settings | `ContactListIcon`, `StarIcon`, `BroadcastIcon`, `LaptopIcon`, `KeyIcon`, `LockIcon`, `NotificationIcon`, `TransferIcon`, `ShieldIcon`, `HelpIcon` |
|
|
15
|
+
|
|
16
|
+
Good stand-ins when the exact icon is missing: `StatusIcon` (concentric circles) for a goal or progress tab, `StarIcon` for favourites or ranking, `ContactListIcon` for bookings or a profile card, `CheckIcon` for "today" or done, `CommunitiesIcon` for friends or groups.
|
|
17
|
+
|
|
18
|
+
The set has no home, calendar, cart, chart, trophy, settings gear, trash or share icon. When nothing fits, write a small inline SVG in the same style (24 grid, `fill="none"`, `stroke="currentColor"`, `strokeWidth={1.75}`, round caps and joins) and keep it next to your other UI code. Never use emoji as icons.
|
|
19
|
+
|
|
20
|
+
There are no logos or brand icons (Telegram, Reddit, WhatsApp, Apple), and none may be added.
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @appss/ui component index
|
|
2
|
+
|
|
3
|
+
Use these, not raw HTML. Before first use open `node_modules/@appss/ui/docs/components/<Name>.md`.
|
|
4
|
+
|
|
5
|
+
## Navigation
|
|
6
|
+
|
|
7
|
+
- NavBar — Screen header: title, back, actions. Use: top of every screen. Not: headings inside content → Card.
|
|
8
|
+
- BottomNav — Bottom tab bar. Use: 3-5 main app sections. Not: views in one screen → Tabs.
|
|
9
|
+
- Tabs — Underline, pill or segmented tabs. Use: switch or filter views in a screen. Not: app sections → BottomNav.
|
|
10
|
+
- NavList — Sidebar or header links. Use: site and desktop navigation. Not: mobile tabs → BottomNav.
|
|
11
|
+
- Link — Inline text link. Use: links inside text. Not: list rows → Cell.
|
|
12
|
+
|
|
13
|
+
## Actions
|
|
14
|
+
|
|
15
|
+
- Button — Text button; one solid per screen. Use: any labelled action. Not: icon-only → IconButton.
|
|
16
|
+
- IconButton — Icon-only button; label required. Use: header and toolbar actions. Not: visible text → Button.
|
|
17
|
+
- Menu — Dropdown action menu. Use: 3+ secondary actions. Not: filters → Tabs.
|
|
18
|
+
- Likes — Up/down vote with score. Use: rating posts or answers. Not: a favourite toggle → IconButton.
|
|
19
|
+
|
|
20
|
+
## Lists and data
|
|
21
|
+
|
|
22
|
+
- Section — Grouped list with header and footer. Use: settings, lists of Cells. Not: free-form content → Card.
|
|
23
|
+
- Cell — List row: icon, title, subtitle, value. Use: rows inside a Section. Not: chats → ChatListItem.
|
|
24
|
+
- Accordion — Expandable rows or sidebar groups. Use: FAQ, rules, details. Not: switching views → Tabs.
|
|
25
|
+
|
|
26
|
+
## Messaging
|
|
27
|
+
|
|
28
|
+
- ChatListItem — Chat row: avatar, preview, time, unread. Use: chat and inbox lists. Not: data rows → Cell.
|
|
29
|
+
- MessageBubble — Chat message, replies, quick actions. Use: chat and AI chat threads. Not: feed comments → Card.
|
|
30
|
+
- MessageDivider — Date chip or unread bar. Use: between message days. Not: content blocks → Divider.
|
|
31
|
+
- MessageComposer — Chat input bar with actions. Use: bottom of a chat or AI chat. Not: search → SearchField.
|
|
32
|
+
|
|
33
|
+
## Overlays
|
|
34
|
+
|
|
35
|
+
- Dialog — Modal or bottom sheet. Use: confirmations, short choices. Not: inline notices → Banner.
|
|
36
|
+
- Tooltip — Hover/focus hint for one control. Use: explaining icons on desktop. Not: a button's name → IconButton label.
|
|
37
|
+
|
|
38
|
+
## Surfaces
|
|
39
|
+
|
|
40
|
+
- Card — Content block with title and action. Use: posts, widgets, product tiles. Not: rows → Section.
|
|
41
|
+
- Banner — Colored promo link block. Use: one call to action per screen. Not: neutral content → Card.
|
|
42
|
+
- Divider — 1px rule. Use: between content blocks. Not: between Cells → Section.
|
|
43
|
+
|
|
44
|
+
## Content and labels
|
|
45
|
+
|
|
46
|
+
- Avatar — Photo or initials; name required. Use: people, shops, bots. Not: product photos → img in Card.
|
|
47
|
+
- Tag — Non-interactive label. Use: status, category, flair. Not: clickable filters → Tabs.
|
|
48
|
+
- Stat — Big value with caption. Use: totals, streaks, scores. Not: row values → Cell after.
|
|
49
|
+
|
|
50
|
+
## Input
|
|
51
|
+
|
|
52
|
+
- SearchField — Search input; label required. Use: search and text filters. Not: other text input → text field (gap).
|
|
53
|
+
- Switch — On/off toggle; label required. Use: settings, in Cell after. Not: one of options → Tabs.
|
|
54
|
+
|
|
55
|
+
## Not in the kit
|
|
56
|
+
|
|
57
|
+
Write it yourself in `packages/core/src/ui` on `--app-*` tokens: text field / textarea, select, checkbox / radio, date / time picker, sheet (Dialog placement="bottom" covers simple cases), toast, skeleton, empty state, progress bar, charts.
|
package/docs/recipes.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Recipes
|
|
2
|
+
|
|
3
|
+
A recipe is a ready-made style for one component: shape, spacing and colours. Import it from `@appss/ui/recipes` and pass it as `recipe`. TypeScript only accepts a recipe on its own component (a Button recipe cannot go on BottomNav).
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { pillButton, dockNav } from "@appss/ui/recipes";
|
|
7
|
+
|
|
8
|
+
<Button recipe={pillButton}>Continue</Button>;
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Recipes show on the web. Inside Telegram and Reddit the platform kit overrides them; add `adaptation="fixed"` to keep the recipe there too (use it rarely: the native look is usually what users expect).
|
|
12
|
+
|
|
13
|
+
## All recipes
|
|
14
|
+
|
|
15
|
+
| Recipe | Component | Character | Shape |
|
|
16
|
+
| ------------------------ | --------------- | ---------------------- | --------------------------------------------------------------------------------------- |
|
|
17
|
+
| `essentialButton` | Button | neutral, businesslike | as the base: heights 36/44/52, radius 10 |
|
|
18
|
+
| `pillButton` | Button | friendly, soft, modern | base heights, fully rounded, horizontal padding 25 |
|
|
19
|
+
| `softButton` | Button | playful, tactile | base heights, radius 16, 5 px bottom shadow so the button looks raised |
|
|
20
|
+
| `dockNav` | BottomNav | calm, tidy | floating white card, radius 22, light shadow, height 72 |
|
|
21
|
+
| `lineNav` | BottomNav | strict, utilitarian | full width, no radius, top line, active item underlined |
|
|
22
|
+
| `glassNav` | BottomNav | modern, premium | glass capsule with blur, items 54, active item is a pill |
|
|
23
|
+
| `whatsappTabBar` | BottomNav | friendly, everyday | glass capsule, items 56, 10 px labels, green counters |
|
|
24
|
+
| `whatsappIconButton` | IconButton | friendly, airy | circle 48; `soft` white with a soft shadow, `solid` green, `plain` no background |
|
|
25
|
+
| `whatsappHeader` | NavBar | friendly, calm | height 64, translucent blurred background; with `titleSize="large"` transparent, 34/800 |
|
|
26
|
+
| `whatsappSection` | Section | calm, orderly | white groups radius 26 on a grey page, 13 px grey captions |
|
|
27
|
+
| `whatsappCell` | Cell | calm, large | row 52, text 17, 24 px icon on the left, separator starts at the text |
|
|
28
|
+
| `whatsappSwitch` | Switch | modern, soft | track 64x28, stretched thumb 38x24, green when on |
|
|
29
|
+
| `whatsappAvatar` | Avatar | soft, neutral | pastel placeholder; set the background through `style` |
|
|
30
|
+
| `whatsappChatListItem` | ChatListItem | friendly, everyday | avatar 52, name 17/600, grey 15 px preview, green time and counter when unread |
|
|
31
|
+
| `whatsappMessageBubble` | MessageBubble | friendly, warm | radius 18, text 17, white incoming, light green outgoing, green quick-reply buttons |
|
|
32
|
+
| `whatsappMessageDivider` | MessageDivider | calm | white 14/600 chip with a light shadow; translucent white unread bar |
|
|
33
|
+
| `whatsappComposer` | MessageComposer | everyday, calm | beige bar, white capsule field 40 with a grey border, text 17 |
|
|
34
|
+
|
|
35
|
+
## Picking by mood
|
|
36
|
+
|
|
37
|
+
- Serious, businesslike: `essentialButton` with `lineNav`.
|
|
38
|
+
- Friendly: `pillButton` and the WhatsApp recipes.
|
|
39
|
+
- Playful (games, kids, habits): `softButton` with `dockNav`.
|
|
40
|
+
- Modern, premium: `glassNav` with `pillButton`.
|
|
41
|
+
- A messenger or home-services app on the web: every `whatsapp*` recipe together.
|
|
42
|
+
|
|
43
|
+
Keep one character per screen and per app: do not mix `softButton` with `lineNav`. Components without recipes (Link, Tabs, Menu, NavList, Tag, Divider, Stat, SearchField, Accordion, Card, Tooltip, Likes, Banner, Dialog) follow the base or platform look.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"a[href]": ["Link", "Cell", "Banner"],
|
|
3
|
+
"button": ["Button", "IconButton"],
|
|
4
|
+
"details": ["Accordion"],
|
|
5
|
+
"dialog": ["Dialog"],
|
|
6
|
+
"div[role=tablist]": ["Tabs"],
|
|
7
|
+
"header": ["NavBar"],
|
|
8
|
+
"hr": ["Divider"],
|
|
9
|
+
"input[type=checkbox][role=switch]": ["Switch"],
|
|
10
|
+
"input[type=search]": ["SearchField"],
|
|
11
|
+
"nav": ["BottomNav", "NavList"]
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,83 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appss/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Adaptive React UI kit with Web, Telegram Mini App and Reddit appearances.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css"
|
|
8
|
+
],
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"AGENTS.md",
|
|
12
|
+
"docs"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./integrations": {
|
|
20
|
+
"types": "./dist/integrations.d.ts",
|
|
21
|
+
"import": "./dist/integrations.js"
|
|
22
|
+
},
|
|
23
|
+
"./recipes": {
|
|
24
|
+
"types": "./dist/recipes/index.d.ts",
|
|
25
|
+
"import": "./dist/recipes/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./modules": {
|
|
28
|
+
"types": "./dist/modules/index.d.ts",
|
|
29
|
+
"import": "./dist/modules/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./icons": {
|
|
32
|
+
"types": "./dist/icons/index.d.ts",
|
|
33
|
+
"import": "./dist/icons/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./styles.css": "./dist/styles.css",
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"dev": "npm run storybook",
|
|
40
|
+
"storybook": "npm run styles:types && concurrently -k -n css,storybook \"npm:styles:watch\" \"storybook dev -p 6006 --host 127.0.0.1 --ci --no-open --disable-telemetry\"",
|
|
41
|
+
"styles:types": "tcm src --pattern '**/*.module.css'",
|
|
42
|
+
"styles:watch": "tcm src --pattern '**/*.module.css' --watch",
|
|
43
|
+
"typecheck": "npm run styles:types && tsc --noEmit",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"docs:agent": "node scripts/gen-agent-docs.mjs",
|
|
46
|
+
"docs:agent:check": "node scripts/gen-agent-docs.mjs --check",
|
|
47
|
+
"build": "npm run typecheck && vite build -c vite.lib.config.ts && tsc -p tsconfig.build.json",
|
|
48
|
+
"build-storybook": "npm run typecheck && storybook build --disable-telemetry",
|
|
49
|
+
"format": "prettier --write .",
|
|
50
|
+
"format:check": "prettier --check .",
|
|
51
|
+
"prepack": "npm run build",
|
|
52
|
+
"pack:check": "npm pack --dry-run"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": "^19.0.0",
|
|
56
|
+
"react-dom": "^19.0.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@storybook/addon-a11y": "10.6.5",
|
|
60
|
+
"@storybook/addon-docs": "10.6.5",
|
|
61
|
+
"@storybook/react-vite": "10.6.5",
|
|
62
|
+
"@types/node": "^22.10.0",
|
|
63
|
+
"@types/react": "^19.2.0",
|
|
64
|
+
"@types/react-dom": "^19.2.0",
|
|
65
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
66
|
+
"concurrently": "^9.1.0",
|
|
67
|
+
"lucide-react": "^0.468.0",
|
|
68
|
+
"prettier": "^3.9.10",
|
|
69
|
+
"react": "^19.2.0",
|
|
70
|
+
"react-dom": "^19.2.0",
|
|
71
|
+
"storybook": "10.6.5",
|
|
72
|
+
"typed-css-modules": "^0.9.1",
|
|
73
|
+
"typescript": "~5.9.3",
|
|
74
|
+
"vite": "^7.2.0",
|
|
75
|
+
"vitest": "^4.0.0"
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=20.19.0"
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
}
|
|
83
|
+
}
|