@sentio/ui-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # @sentio/ui-core
2
+
3
+ A basic UI component library with zero Web3 dependencies.
4
+
5
+ ## Features
6
+
7
+ - 🎨 Full Tailwind CSS theme system
8
+ - 🧩 Core UI components (Button, Dialog, Tooltip, Loading, etc.)
9
+ - 📦 No Web3 dependency
10
+ - 🎯 Lightweight
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pnpm add @sentio/ui-core
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```tsx
21
+ import { Button, BaseDialog, BarLoading, CopyButton } from '@sentio/ui-core'
22
+ import '@sentio/ui-core/dist/style.css'
23
+
24
+ function App() {
25
+ return (
26
+ <>
27
+ <Button>Click me</Button>
28
+ <BarLoading />
29
+ <CopyButton text="Copy this" />
30
+ </>
31
+ )
32
+ }
33
+ ```
34
+
35
+ ## Included components
36
+
37
+ ### Common Components
38
+ - `BarLoading` - Bar loading indicator
39
+ - `SpinLoading` - Spinner loading indicator
40
+ - `CopyButton`, `CopyIcon`, `CopySuccessIcon` - Copy button with icons
41
+ - `Button` - Button component with variants
42
+ - `BaseDialog` - Dialog component
43
+ - `PopoverTooltip` - Tooltip component
44
+ - `DisclosurePanel` - Collapsible disclosure panel
45
+ - `Collapse` - Collapse/expand animation wrapper
46
+ - `Input` - Text input component
47
+ - `RadioSelect` - Radio button group
48
+ - `Switch` - Toggle switch component
49
+ - `Select` - Dropdown select component
50
+ - `Empty` - Empty state component
51
+ - `StatusBadge` - Badge component with status colors
52
+ - `HeaderToolsToggleButton`, `HeaderToolsContent` - Header tools dropdown
53
+
54
+ ### Table Components
55
+ - `ResizeTable` - Resizable table component
56
+ - `MoveLeftIcon`, `MoveRightIcon`, `RenameIcon`, `DeleteIcon` - Table action icons
57
+
58
+ ### Menu Components
59
+ - `PopupMenuButton` - Popup menu trigger button
60
+ - `MenuItem` - Menu item component
61
+ - `SubMenuButton` - Submenu button component
62
+ - `MenuContext` - Menu context provider
63
+ - `COLOR_MAP` - Color mapping for menu items
64
+
65
+ ### Tree Components
66
+ - `FlatTree` - Flat tree component
67
+ - `ROOT_KEY`, `SUFFIX_NODE_KEY` - Tree node key constants
68
+ - `PlusSquareO`, `MinusSquareO`, `CloseSquareO`, `EyeO` - Tree icons
69
+
70
+ ### Text Components
71
+ - `LinkifyText` - Text component that converts URLs to clickable links
72
+
73
+ ### Utilities / Hooks
74
+ - `useMobile()` - Detect mobile device
75
+ - `useBoolean()` - Boolean state hook
76
+ - `classNames()` - Conditional class name utility
77
+ - `getNumberWithDecimal()` - Number formatting utilities
78
+ - Extension context utilities
79
+ - `NavSizeContext` - Navigation size context
80
+
81
+ ## Theming
82
+
83
+ Components are themed using CSS variables. You can customize the theme by overriding these variables:
84
+
85
+ ```css
86
+ :root {
87
+ --primary-600: 7, 86, 213;
88
+ --gray-600: 75, 85, 99;
89
+ /* ... */
90
+ }
91
+ ```
92
+
93
+ ## Development
94
+
95
+ ### Component Development with Ladle
96
+
97
+ This package uses [Ladle](https://ladle.dev/) for component development and testing. Ladle provides a fast, lightweight alternative to Storybook for developing React components in isolation.
98
+
99
+ #### Prerequisites
100
+
101
+ Make sure you have dependencies installed:
102
+
103
+ ```bash
104
+ pnpm install
105
+ ```
106
+
107
+ #### Starting the Development Server
108
+
109
+ To start the Ladle development server:
110
+
111
+ ```bash
112
+ pnpm ladle serve
113
+ ```
114
+
115
+ This will:
116
+ - Start a local development server (typically at `http://localhost:61000`)
117
+ - Watch for changes in your component stories
118
+ - Provide hot module replacement for fast development
119
+ - Display all your component stories in an interactive UI
120
+
121
+ #### Writing Stories
122
+
123
+ Stories are located alongside components with the `.stories.tsx` extension. For example:
124
+
125
+ ```tsx
126
+ // src/common/Button.stories.tsx
127
+ import type { Story } from '@ladle/react'
128
+ import { Button } from './Button'
129
+
130
+ export const Default: Story = () => <Button>Click me</Button>
131
+
132
+ export const Primary: Story = () => <Button variant="primary">Primary</Button>
133
+
134
+ export const Disabled: Story = () => <Button disabled>Disabled</Button>
135
+ ```
136
+
137
+ #### Available Story Examples
138
+
139
+ Check out existing stories in the `src/` directory:
140
+ - `src/common/NewButton.stories.tsx` - Button component examples
141
+ - `src/common/dialog/BaseDialog.stories.tsx` - Dialog examples
142
+ - `src/common/table/ResizeTable.stories.tsx` - Table examples
143
+ - `src/common/tree/FlatTree.stories.tsx` - Tree component examples
144
+ - And many more...
145
+
146
+ #### Building for Production
147
+
148
+ To build the package:
149
+
150
+ ```bash
151
+ pnpm build
152
+ ```
153
+
154
+ This will:
155
+ 1. Build CSS with Tailwind (`pnpm build:css`)
156
+ 2. Build JavaScript/TypeScript with tsup (`pnpm build:js`)
157
+
158
+ #### Watch Mode for Development
159
+
160
+ If you're developing this package alongside another package:
161
+
162
+ ```bash
163
+ pnpm dev
164
+ ```
165
+
166
+ This runs both CSS and JS builds in watch mode concurrently.