silva-ui 0.0.0-stage → 1.0.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.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -2
  3. package/dist/library/silva-ui.css +2 -0
  4. package/dist/library/silva-ui.js +28243 -0
  5. package/dist/types/core/Theme.d.ts +28 -0
  6. package/dist/types/core/colors/index.d.ts +9 -0
  7. package/dist/types/core/colors/radix.d.ts +1396 -0
  8. package/dist/types/core/create-theme/index.d.ts +1 -0
  9. package/dist/types/core/sprinkles.css.d.ts +921 -0
  10. package/dist/types/core/theme/index.css.d.ts +395 -0
  11. package/dist/types/core/theme/index.d.ts +10 -0
  12. package/dist/types/core/theme-builder/index.d.ts +34 -0
  13. package/dist/types/core/theme.css.d.ts +3 -0
  14. package/dist/types/core/themes/index.d.ts +283 -0
  15. package/dist/types/core/types.d.ts +16 -0
  16. package/dist/types/core/utils.d.ts +15 -0
  17. package/dist/types/display/Avatar.d.ts +16 -0
  18. package/dist/types/display/Card.d.ts +9 -0
  19. package/dist/types/display/Image.d.ts +10 -0
  20. package/dist/types/display/ListItem.d.ts +11 -0
  21. package/dist/types/display/Loader.d.ts +6 -0
  22. package/dist/types/display/Spinner.d.ts +7 -0
  23. package/dist/types/display/avatar.css.d.ts +4 -0
  24. package/dist/types/display/card.css.d.ts +5 -0
  25. package/dist/types/display/listitem.css.d.ts +7 -0
  26. package/dist/types/display/loader.css.d.ts +2 -0
  27. package/dist/types/display/spinner.css.d.ts +2 -0
  28. package/dist/types/forms/Button.d.ts +10 -0
  29. package/dist/types/forms/Checkbox.d.ts +13 -0
  30. package/dist/types/forms/Field.d.ts +9 -0
  31. package/dist/types/forms/Form.d.ts +8 -0
  32. package/dist/types/forms/Input.d.ts +14 -0
  33. package/dist/types/forms/Label.d.ts +8 -0
  34. package/dist/types/forms/Progress.d.ts +9 -0
  35. package/dist/types/forms/RadioGroup.d.ts +20 -0
  36. package/dist/types/forms/Select.d.ts +12 -0
  37. package/dist/types/forms/Slider.d.ts +16 -0
  38. package/dist/types/forms/Switch.d.ts +13 -0
  39. package/dist/types/forms/TextArea.d.ts +14 -0
  40. package/dist/types/forms/ToggleGroup.d.ts +14 -0
  41. package/dist/types/forms/button.css.d.ts +3 -0
  42. package/dist/types/forms/checkbox.css.d.ts +5 -0
  43. package/dist/types/forms/field.css.d.ts +3 -0
  44. package/dist/types/forms/form.css.d.ts +1 -0
  45. package/dist/types/forms/input.css.d.ts +2 -0
  46. package/dist/types/forms/label.css.d.ts +3 -0
  47. package/dist/types/forms/progress.css.d.ts +3 -0
  48. package/dist/types/forms/radiogroup.css.d.ts +7 -0
  49. package/dist/types/forms/select.css.d.ts +10 -0
  50. package/dist/types/forms/slider.css.d.ts +3 -0
  51. package/dist/types/forms/switch.css.d.ts +6 -0
  52. package/dist/types/forms/textarea.css.d.ts +2 -0
  53. package/dist/types/forms/togglegroup.css.d.ts +2 -0
  54. package/dist/types/index.d.ts +93 -0
  55. package/dist/types/layout/Box.d.ts +19 -0
  56. package/dist/types/layout/Separator.d.ts +7 -0
  57. package/dist/types/layout/XGroup.d.ts +5 -0
  58. package/dist/types/layout/XStack.d.ts +18 -0
  59. package/dist/types/layout/YStack.d.ts +18 -0
  60. package/dist/types/layout/separator.css.d.ts +2 -0
  61. package/dist/types/layout/stacks.css.d.ts +4 -0
  62. package/dist/types/layout/xgroup.css.d.ts +1 -0
  63. package/dist/types/overlays/Accordion.d.ts +22 -0
  64. package/dist/types/overlays/AlertDialog.d.ts +22 -0
  65. package/dist/types/overlays/ContextMenu.d.ts +20 -0
  66. package/dist/types/overlays/Dialog.d.ts +21 -0
  67. package/dist/types/overlays/Menu.d.ts +20 -0
  68. package/dist/types/overlays/Popover.d.ts +13 -0
  69. package/dist/types/overlays/Sheet.d.ts +22 -0
  70. package/dist/types/overlays/Tabs.d.ts +60 -0
  71. package/dist/types/overlays/Toast.d.ts +14 -0
  72. package/dist/types/overlays/Tooltip.d.ts +12 -0
  73. package/dist/types/overlays/accordion.css.d.ts +10 -0
  74. package/dist/types/overlays/alertdialog.css.d.ts +18 -0
  75. package/dist/types/overlays/contextmenu.css.d.ts +14 -0
  76. package/dist/types/overlays/dialog.css.d.ts +16 -0
  77. package/dist/types/overlays/menu.css.d.ts +14 -0
  78. package/dist/types/overlays/popover.css.d.ts +10 -0
  79. package/dist/types/overlays/sheet.css.d.ts +18 -0
  80. package/dist/types/overlays/tabs.css.d.ts +4 -0
  81. package/dist/types/overlays/toast.css.d.ts +14 -0
  82. package/dist/types/overlays/tooltip.css.d.ts +8 -0
  83. package/dist/types/typography/Anchor.d.ts +9 -0
  84. package/dist/types/typography/Heading.d.ts +9 -0
  85. package/dist/types/typography/Headings.d.ts +15 -0
  86. package/dist/types/typography/Paragraph.d.ts +4 -0
  87. package/dist/types/typography/SizableText.d.ts +7 -0
  88. package/dist/types/typography/Text.d.ts +7 -0
  89. package/dist/types/typography/anchor.css.d.ts +1 -0
  90. package/dist/types/typography/heading.css.d.ts +2 -0
  91. package/dist/types/typography/text.css.d.ts +4 -0
  92. package/package.json +47 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Blacksilva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,227 @@
1
- # Temporary Holding Version
1
+ # silva-ui Component Library
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![Bundle size](https://badgen.net/bundlephobia/min/silva-ui)](https://bundlephobia.com/package/silva-ui)
4
+ [![Minified + gzipped size](https://badgen.net/bundlephobia/minzip/silva-ui)](https://bundlephobia.com/package/silva-ui)
5
+ [![TypeScript](https://badgen.net/badge/built%20with/TypeScript/blue)](https://www.typescriptlang.org/)
6
+ [![License](https://badgen.net/badge/license/MIT/green)](./LICENSE)
7
+
8
+ A Hono JSX UI component library with framework-neutral styling and Tamagui-inspired theming, built on `@vanilla-extract/css` and `@vanilla-extract/sprinkles`.
9
+
10
+ ---
11
+
12
+ ## Component Inventory
13
+
14
+ ### 1. Core Layout Primitives
15
+ - [`Box`](./src/layout/Box.tsx) — Foundation primitive with polymorphic `as` prop
16
+ - [`YStack`](./src/layout/YStack.tsx) — Vertical flex column container
17
+ - [`XStack`](./src/layout/XStack.tsx) — Horizontal flex row container
18
+ - [`XGroup`](./src/layout/XGroup.tsx) — Connected horizontal item grouping (collapsing adjacent borders)
19
+ - [`Separator`](./src/layout/Separator.tsx) — Horizontal or vertical dividing rule (`orientation="horizontal" | "vertical"`)
20
+
21
+ ### 2. Typography
22
+ - [`Text`](./src/typography/Text.tsx) — Base inline/block text primitive with `as` prop
23
+ - [`SizableText`](./src/typography/SizableText.tsx) — Text with size scale (`xs`, `sm`, `md`, `lg`, `xl`) coordinating `fontSize` + `lineHeight`
24
+ - [`Paragraph`](./src/typography/Paragraph.tsx) — `<p>` wrapper with margin/spacing defaults
25
+ - [`Heading`](./src/typography/Heading.tsx) — Dynamic heading primitive (`level={1 | 2 | 3 | 4 | 5 | 6}`)
26
+ - [`H1`–`H6`](./src/typography/Headings.tsx) — Semantic heading shorthand components
27
+ - [`Anchor`](./src/typography/Anchor.tsx) — Styled accessible link (`<a>`) with focus ring and disabled states
28
+
29
+ ### 3. Forms & Inputs
30
+ - [`Button`](./src/forms/Button.tsx) — Buttons with `size` (`xs`–`xl`) and `variant` (`solid`, `outline`, `ghost`, `link`)
31
+ - [`Input`](./src/forms/Input.tsx) — Styled text inputs with size variants (`sm`, `md`, `lg`)
32
+ - [`TextArea`](./src/forms/TextArea.tsx) — Multi-line text inputs with auto-resize support
33
+ - [`Label`](./src/forms/Label.tsx) — Accessible form labels with optional `required` asterisk indicator
34
+ - [`Form`](./src/forms/Form.tsx) — Flex column `<form>` wrapper
35
+ - [`Field`](./src/forms/Field.tsx), [`FieldError`](./src/forms/Field.tsx), [`FieldHelper`](./src/forms/Field.tsx) — Form field composition wrappers
36
+
37
+ ### 4. Advanced Form Controls
38
+ - [`Checkbox`](./src/forms/Checkbox.tsx) — Custom-styled checkbox with checkmark SVG and native input
39
+ - [`RadioGroup`](./src/forms/RadioGroup.tsx), [`RadioGroupItem`](./src/forms/RadioGroup.tsx) — Accessible radio button group with circular dot indicator
40
+ - [`Select`](./src/forms/Select.tsx) — Styled native select with custom chevron indicator
41
+ - [`Slider`](./src/forms/Slider.tsx) — Range slider with styled track and thumb pseudo-elements
42
+ - [`Switch`](./src/forms/Switch.tsx) — Smooth toggle switch with pill track and sliding thumb
43
+ - [`ToggleGroup`](./src/forms/ToggleGroup.tsx), [`ToggleGroupItem`](./src/forms/ToggleGroup.tsx) — Single or multi-selection toggle button group
44
+ - [`Progress`](./src/forms/Progress.tsx) — Accessible progress bar (`role="progressbar"`)
45
+
46
+ ### 5. Media & Display
47
+ - [`Avatar`](./src/display/Avatar.tsx), [`AvatarImage`](./src/display/Avatar.tsx), [`AvatarFallback`](./src/display/Avatar.tsx) — User avatar circle with image and initials fallback
48
+ - [`Card`](./src/display/Card.tsx), [`CardHeader`](./src/display/Card.tsx), [`CardFooter`](./src/display/Card.tsx) — Structured content container with `bordered` and `elevated` options
49
+ - [`Image`](./src/display/Image.tsx) — Lazy-loading `<img>` primitive with sprinkles sizing & objectFit
50
+ - [`ListItem`](./src/display/ListItem.tsx) — Structured list item with `title`, `subTitle`, `icon`, and optional `pressable` hover state
51
+ - [`Spinner`](./src/display/Spinner.tsx) — Keyframe-animated loading circle (`role="status"`)
52
+ - [`Loader`](./src/display/Loader.tsx) — Theme-aware horizontal indeterminate loader with size variants (`role="status"`)
53
+
54
+ ### 6. Overlays & Compound Elements (Zero-Runtime, Stateless)
55
+ - [`Tabs`](./src/overlays/Tabs.tsx), [`TabList`](./src/overlays/Tabs.tsx), [`Tab`](./src/overlays/Tabs.tsx), [`TabPanel`](./src/overlays/Tabs.tsx) — Composable tabs controlled via `data-active` & `hidden`
56
+ - [`Dialog`](./src/overlays/Dialog.tsx) family (`Overlay`, `Content`, `Header`, `Footer`, `Title`, `Description`, `Close`)
57
+ - [`AlertDialog`](./src/overlays/AlertDialog.tsx) family (`Overlay`, `Content`, `Header`, `Footer`, `Title`, `Description`, `Action`, `Cancel`)
58
+ - [`Popover`](./src/overlays/Popover.tsx) family (`Trigger`, `Content` with `side="top"|"bottom"|"left"|"right"`, `Close`)
59
+ - [`Sheet`](./src/overlays/Sheet.tsx) family — Slide-over drawer with side positioning (`side="bottom"|"top"|"left"|"right"`)
60
+ - [`Tooltip`](./src/overlays/Tooltip.tsx) family (`Trigger`, `Content` with `side="top"|"bottom"|"left"|"right"`)
61
+ - [`ToastProvider`](./src/overlays/Toast.tsx), [`Toast`](./src/overlays/Toast.tsx) family (`Title`, `Description`, `Close`) with variant borders (`success`, `error`, `warning`)
62
+ - [`Menu`](./src/overlays/Menu.tsx) family (`Trigger`, `Content`, `Item`, `Separator`, `Label`, `Group`)
63
+ - [`ContextMenu`](./src/overlays/ContextMenu.tsx) family — Fixed positioning at coordinates via CSS custom properties
64
+ - [`Accordion`](./src/overlays/Accordion.tsx) family (`Item`, `Trigger` with rotating chevron, `Content`)
65
+
66
+ ## Profiling the library
67
+
68
+ The library can be profiled without including the documentation example app:
69
+
70
+ ```bash
71
+ npm run profile:library
72
+ ```
73
+
74
+ This builds from `src/index.ts` using `vite.library.config.ts`, excludes the
75
+ `example/` entry point, writes the library output to `dist/library`, and
76
+ generates `vite-profile-0.cpuprofile`. Open the `.cpuprofile` file in Chrome
77
+ DevTools under **Performance** to inspect build-time CPU usage.
78
+
79
+ ---
80
+
81
+ ## Quick Example in Hono JSX
82
+
83
+ ```tsx
84
+ import {
85
+ YStack,
86
+ XStack,
87
+ H1,
88
+ Paragraph,
89
+ Button,
90
+ Card,
91
+ CardHeader,
92
+ CardFooter,
93
+ Field,
94
+ Label,
95
+ Input,
96
+ Checkbox,
97
+ Switch,
98
+ Badge,
99
+ } from 'silva-ui';
100
+
101
+ export function SignupCard() {
102
+ return (
103
+ <Card elevated p="large" maxWidth={400} bg="background">
104
+ <CardHeader>
105
+ <H1 fontSize="2xl">Create Account</H1>
106
+ <Paragraph color="muted" size="sm">
107
+ Enter your details below to get started.
108
+ </Paragraph>
109
+ </CardHeader>
110
+
111
+ <YStack gap="medium" my="medium">
112
+ <Field>
113
+ <Label htmlFor="email" required>Email address</Label>
114
+ <Input id="email" type="email" placeholder="you@example.com" />
115
+ </Field>
116
+
117
+ <XStack alignItems="center" justifyContent="space-between">
118
+ <Checkbox id="terms">I agree to terms</Checkbox>
119
+ <Switch size="sm" />
120
+ </XStack>
121
+ </YStack>
122
+
123
+ <CardFooter>
124
+ <Button variant="solid" w="full">Sign Up</Button>
125
+ </CardFooter>
126
+ </Card>
127
+ );
128
+ }
129
+ ```
130
+
131
+ ## Colors and themes
132
+
133
+ Theme styling is generated at build time with Vanilla Extract. `Theme` scopes the
134
+ selected theme to a subtree, so nested themes override their parent without
135
+ runtime style injection:
136
+
137
+ ```tsx
138
+ import { Box, Text, Theme } from 'silva-ui';
139
+
140
+ <Theme name="dark">
141
+ <Box bg="card" p="large">
142
+ <Text color="secondary">Semantic tokens follow the active theme.</Text>
143
+ <Theme name="emerald">
144
+ <Box bg="teal6" color="white" p="medium">
145
+ A nested light emerald theme.
146
+ </Box>
147
+ </Theme>
148
+ </Box>
149
+ </Theme>;
150
+ ```
151
+
152
+ Color ramps are exported as `colorScales` and are also registered as sprinkles
153
+ color tokens. They follow the Tamagui/Radix convention: the same numbered token
154
+ has a light-palette value in light themes and a dark-palette value in dark
155
+ themes. The referenced `colors` source provides 28 hue ramps plus `blackA` and
156
+ `whiteA`, each with 12 numbered stops.
157
+
158
+ For example, `color="blue12"` is dark on light themes and light on dark themes;
159
+ `bg="blue6"` adapts with the rest of the ramp. Use tokens such as `bg="blue6"`,
160
+ `color="gray11"`, `borderColor="teal4"`, or alpha tokens such as
161
+ `backgroundColor="blackA4"`. Semantic names such as `background`, `card`,
162
+ `primary`, `muted`, and `border` also adapt to the active theme and are
163
+ preferred when a semantic role is clearer than a specific hue.
164
+
165
+ Built-in themes are `light`, `dark`, `emerald`, `emerald-dark`, and `midnight`.
166
+ Their semantic values are defined in `src/core/themes`; the token contract and
167
+ CSS variables are in `src/core/theme`; `src/core/theme-builder` combines theme
168
+ definitions with the palette tokens. To add a theme, add a complete semantic
169
+ color map to `themeDefinitions` in `src/core/themes` and register dark variants
170
+ in `darkThemeNames` there so their ramps reverse. The theme class and
171
+ `data-theme` selector are generated from those maps. Add a switcher control in
172
+ `example/App.tsx` if you want it available in the demo. Theme classes and CSS
173
+ variables are emitted at build time.
174
+
175
+ `Theme` can be nested to switch a subtree back to any built-in theme. For inline styles, use the exported contract values such as
176
+ `themeColors.background` or `themeColors.blue6`; Vanilla Extract can then keep
177
+ the variable names consistent through production builds.
178
+
179
+ Silva UI follows Tamagui's palette/template model while remaining framework
180
+ agnostic. The exported `createThemes` helper composes named palettes and
181
+ templates into theme records, and built-in themes include generated surface
182
+ variants such as `dark_surface1` and `light_surface2`:
183
+
184
+ ```tsx
185
+ import { Card, Theme } from 'silva-ui';
186
+
187
+ <Theme name="dark">
188
+ <Card bg="card">Base dark theme</Card>
189
+ <Theme name="dark_surface1">
190
+ <Card bg="card">A nested surface theme</Card>
191
+ </Theme>
192
+ </Theme>;
193
+ ```
194
+
195
+ Palette themes can also be selected without registering or prebuilding a
196
+ custom theme. Pass a supported color scale directly to `Theme`, or prefix it
197
+ with `light-` or `dark-`:
198
+
199
+ ```tsx
200
+ <Theme name="red">
201
+ <Button>Light red theme</Button>
202
+ </Theme>
203
+
204
+ <Theme name="dark-blue">
205
+ <Button>Dark blue theme</Button>
206
+ </Theme>
207
+ ```
208
+
209
+ These names are resolved from the existing color ramps at runtime and scoped
210
+ to that `Theme` subtree. Built-in names such as `dark`, `emerald`, and
211
+ `midnight` continue to use their precompiled theme classes. Supported palette
212
+ names are the exported color scales, including `red`, `blue`, `green`,
213
+ `purple`, and the other Radix scales.
214
+
215
+ Theme values are extracted into CSS classes at build time. For framework-neutral
216
+ runtime tooling, `addTheme`, `updateTheme`, `replaceTheme`, `getTheme`, and
217
+ `getThemes` provide an in-memory theme registry; applications can use the
218
+ returned records with their own CSS or rendering integration.
219
+
220
+ ## Interactive documentation
221
+
222
+ The `example` app is the interactive component documentation. Start it with
223
+ `npm run dev`, then use the sidebar or home page to browse live examples for
224
+ each exported component, color tokens, and themes. The theme selector in the
225
+ header lets you preview the documentation in every built-in theme. The
226
+ installation and project setup walkthrough is available from its **Get started**
227
+ page in the documentation sidebar.