silva-ui 0.0.0-stage → 1.0.1

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 +206 -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 +60 -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,207 @@
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
+ Contributions are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for
11
+ development setup, validation commands, and pull request expectations.
12
+
13
+ ---
14
+
15
+ ## Component Inventory
16
+
17
+ ### 1. Core Layout Primitives
18
+ - [`Box`](./src/layout/Box.tsx) — Foundation primitive with polymorphic `as` prop
19
+ - [`YStack`](./src/layout/YStack.tsx) — Vertical flex column container
20
+ - [`XStack`](./src/layout/XStack.tsx) — Horizontal flex row container
21
+ - [`XGroup`](./src/layout/XGroup.tsx) — Connected horizontal item grouping (collapsing adjacent borders)
22
+ - [`Separator`](./src/layout/Separator.tsx) — Horizontal or vertical dividing rule (`orientation="horizontal" | "vertical"`)
23
+
24
+ ### 2. Typography
25
+ - [`Text`](./src/typography/Text.tsx) — Base inline/block text primitive with `as` prop
26
+ - [`SizableText`](./src/typography/SizableText.tsx) — Text with size scale (`xs`, `sm`, `md`, `lg`, `xl`) coordinating `fontSize` + `lineHeight`
27
+ - [`Paragraph`](./src/typography/Paragraph.tsx) — `<p>` wrapper with margin/spacing defaults
28
+ - [`Heading`](./src/typography/Heading.tsx) — Dynamic heading primitive (`level={1 | 2 | 3 | 4 | 5 | 6}`)
29
+ - [`H1`–`H6`](./src/typography/Headings.tsx) — Semantic heading shorthand components
30
+ - [`Anchor`](./src/typography/Anchor.tsx) — Styled accessible link (`<a>`) with focus ring and disabled states
31
+
32
+ ### 3. Forms & Inputs
33
+ - [`Button`](./src/forms/Button.tsx) — Buttons with `size` (`xs`–`xl`) and `variant` (`solid`, `outline`, `ghost`, `link`)
34
+ - [`Input`](./src/forms/Input.tsx) — Styled text inputs with size variants (`sm`, `md`, `lg`)
35
+ - [`TextArea`](./src/forms/TextArea.tsx) — Multi-line text inputs with auto-resize support
36
+ - [`Label`](./src/forms/Label.tsx) — Accessible form labels with optional `required` asterisk indicator
37
+ - [`Form`](./src/forms/Form.tsx) — Flex column `<form>` wrapper
38
+ - [`Field`](./src/forms/Field.tsx), [`FieldError`](./src/forms/Field.tsx), [`FieldHelper`](./src/forms/Field.tsx) — Form field composition wrappers
39
+
40
+ ### 4. Advanced Form Controls
41
+ - [`Checkbox`](./src/forms/Checkbox.tsx) — Custom-styled checkbox with checkmark SVG and native input
42
+ - [`RadioGroup`](./src/forms/RadioGroup.tsx), [`RadioGroupItem`](./src/forms/RadioGroup.tsx) — Accessible radio button group with circular dot indicator
43
+ - [`Select`](./src/forms/Select.tsx) — Styled native select with custom chevron indicator
44
+ - [`Slider`](./src/forms/Slider.tsx) — Range slider with styled track and thumb pseudo-elements
45
+ - [`Switch`](./src/forms/Switch.tsx) — Smooth toggle switch with pill track and sliding thumb
46
+ - [`ToggleGroup`](./src/forms/ToggleGroup.tsx), [`ToggleGroupItem`](./src/forms/ToggleGroup.tsx) — Single or multi-selection toggle button group
47
+ - [`Progress`](./src/forms/Progress.tsx) — Accessible progress bar (`role="progressbar"`)
48
+
49
+ ### 5. Media & Display
50
+ - [`Avatar`](./src/display/Avatar.tsx), [`AvatarImage`](./src/display/Avatar.tsx), [`AvatarFallback`](./src/display/Avatar.tsx) — User avatar circle with image and initials fallback
51
+ - [`Card`](./src/display/Card.tsx), [`CardHeader`](./src/display/Card.tsx), [`CardFooter`](./src/display/Card.tsx) — Structured content container with `bordered` and `elevated` options
52
+ - [`Image`](./src/display/Image.tsx) — Lazy-loading `<img>` primitive with sprinkles sizing & objectFit
53
+ - [`ListItem`](./src/display/ListItem.tsx) — Structured list item with `title`, `subTitle`, `icon`, and optional `pressable` hover state
54
+ - [`Spinner`](./src/display/Spinner.tsx) — Keyframe-animated loading circle (`role="status"`)
55
+ - [`Loader`](./src/display/Loader.tsx) — Theme-aware horizontal indeterminate loader with size variants (`role="status"`)
56
+
57
+ ### 6. Overlays & Compound Elements (Zero-Runtime, Stateless)
58
+ - [`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`
59
+ - [`Dialog`](./src/overlays/Dialog.tsx) family (`Overlay`, `Content`, `Header`, `Footer`, `Title`, `Description`, `Close`)
60
+ - [`AlertDialog`](./src/overlays/AlertDialog.tsx) family (`Overlay`, `Content`, `Header`, `Footer`, `Title`, `Description`, `Action`, `Cancel`)
61
+ - [`Popover`](./src/overlays/Popover.tsx) family (`Trigger`, `Content` with `side="top"|"bottom"|"left"|"right"`, `Close`)
62
+ - [`Sheet`](./src/overlays/Sheet.tsx) family — Slide-over drawer with side positioning (`side="bottom"|"top"|"left"|"right"`)
63
+ - [`Tooltip`](./src/overlays/Tooltip.tsx) family (`Trigger`, `Content` with `side="top"|"bottom"|"left"|"right"`)
64
+ - [`ToastProvider`](./src/overlays/Toast.tsx), [`Toast`](./src/overlays/Toast.tsx) family (`Title`, `Description`, `Close`) with variant borders (`success`, `error`, `warning`)
65
+ - [`Menu`](./src/overlays/Menu.tsx) family (`Trigger`, `Content`, `Item`, `Separator`, `Label`, `Group`)
66
+ - [`ContextMenu`](./src/overlays/ContextMenu.tsx) family — Fixed positioning at coordinates via CSS custom properties
67
+ - [`Accordion`](./src/overlays/Accordion.tsx) family (`Item`, `Trigger` with rotating chevron, `Content`)
68
+
69
+
70
+ ---
71
+
72
+ ## Quick Example in Hono JSX
73
+
74
+ ```tsx
75
+ import 'silva-ui/style.css';
76
+ import {
77
+ YStack,
78
+ XStack,
79
+ H1,
80
+ Paragraph,
81
+ Button,
82
+ Card,
83
+ CardHeader,
84
+ CardFooter,
85
+ Field,
86
+ Label,
87
+ Input,
88
+ Checkbox,
89
+ Switch,
90
+ Badge,
91
+ } from 'silva-ui';
92
+
93
+ export function SignupCard() {
94
+ return (
95
+ <Card elevated p="large" maxWidth={400} bg="background">
96
+ <CardHeader>
97
+ <H1 fontSize="2xl">Create Account</H1>
98
+ <Paragraph color="muted" size="sm">
99
+ Enter your details below to get started.
100
+ </Paragraph>
101
+ </CardHeader>
102
+
103
+ <YStack gap="medium" my="medium">
104
+ <Field>
105
+ <Label htmlFor="email" required>Email address</Label>
106
+ <Input id="email" type="email" placeholder="you@example.com" />
107
+ </Field>
108
+
109
+ <XStack alignItems="center" justifyContent="space-between">
110
+ <Checkbox id="terms">I agree to terms</Checkbox>
111
+ <Switch size="sm" />
112
+ </XStack>
113
+ </YStack>
114
+
115
+ <CardFooter>
116
+ <Button variant="solid" w="full">Sign Up</Button>
117
+ </CardFooter>
118
+ </Card>
119
+ );
120
+ }
121
+ ```
122
+
123
+ The published package includes prebuilt CSS. Import `silva-ui/style.css` once
124
+ from your application entry point.
125
+
126
+ ## Colors and themes
127
+
128
+ Theme styling is generated at build time with Vanilla Extract. `Theme` scopes the
129
+ selected theme to a subtree, so nested themes override their parent without
130
+ runtime style injection:
131
+
132
+ ```tsx
133
+ import { Box, Text, Theme } from 'silva-ui';
134
+
135
+ <Theme name="dark">
136
+ <Box bg="card" p="large">
137
+ <Text color="secondary">Semantic tokens follow the active theme.</Text>
138
+ <Theme name="emerald">
139
+ <Box bg="teal6" color="white" p="medium">
140
+ A nested light emerald theme.
141
+ </Box>
142
+ </Theme>
143
+ </Box>
144
+ </Theme>;
145
+ ```
146
+
147
+ Color ramps are exported as `colorScales` and are also registered as sprinkles
148
+ color tokens. They follow the Tamagui/Radix convention: the same numbered token
149
+ has a light-palette value in light themes and a dark-palette value in dark
150
+ themes. The referenced `colors` source provides 28 hue ramps plus `blackA` and
151
+ `whiteA`, each with 12 numbered stops.
152
+
153
+ For example, `color="blue12"` is dark on light themes and light on dark themes;
154
+ `bg="blue6"` adapts with the rest of the ramp. Use tokens such as `bg="blue6"`,
155
+ `color="gray11"`, `borderColor="teal4"`, or alpha tokens such as
156
+ `backgroundColor="blackA4"`. Semantic names such as `background`, `card`,
157
+ `primary`, `muted`, and `border` also adapt to the active theme and are
158
+ preferred when a semantic role is clearer than a specific hue.
159
+
160
+ Built-in themes are `light`, `dark`, `emerald`, `emerald-dark`, and `midnight`.
161
+ Their semantic values are defined in `src/core/themes`; the token contract and
162
+ CSS variables are in `src/core/theme`; `src/core/theme-builder` combines theme
163
+ definitions with the palette tokens. To add a theme, add a complete semantic
164
+ color map to `themeDefinitions` in `src/core/themes` and register dark variants
165
+ in `darkThemeNames` there so their ramps reverse. The theme class and
166
+ `data-theme` selector are generated from those maps. Add a switcher control in
167
+ `example/App.tsx` if you want it available in the demo. Theme classes and CSS
168
+ variables are emitted at build time.
169
+
170
+ `Theme` can be nested to switch a subtree back to any built-in theme. For inline styles, use the exported contract values such as
171
+ `themeColors.background` or `themeColors.blue6`; Vanilla Extract can then keep
172
+ the variable names consistent through production builds.
173
+
174
+ Silva UI follows Tamagui's palette/template model. The exported `createThemes` helper composes named palettes and
175
+ templates into theme records, and built-in themes include generated surface
176
+ variants such as `dark_surface1` and `light_surface2`:
177
+
178
+ ```tsx
179
+ import { Card, Theme } from 'silva-ui';
180
+
181
+ <Theme name="dark">
182
+ <Card bg="card">Base dark theme</Card>
183
+ <Theme name="dark_surface1">
184
+ <Card bg="card">A nested surface theme</Card>
185
+ </Theme>
186
+ </Theme>;
187
+ ```
188
+
189
+ Palette themes can also be selected without registering or prebuilding a
190
+ custom theme. Pass a supported color scale directly to `Theme`, or prefix it
191
+ with `light-` or `dark-`:
192
+
193
+ ```tsx
194
+ <Theme name="red">
195
+ <Button>Light red theme</Button>
196
+ </Theme>
197
+
198
+ <Theme name="dark-blue">
199
+ <Button>Dark blue theme</Button>
200
+ </Theme>
201
+ ```
202
+
203
+ These names are resolved from the existing color ramps at runtime and scoped
204
+ to that `Theme` subtree. Built-in names such as `dark`, `emerald`, and
205
+ `midnight` continue to use their precompiled theme classes. Supported palette
206
+ names are the exported color scales, including `red`, `blue`, `green`,
207
+ `purple`, and the other Radix scales.