@hakumi-dev/hakumi-components 0.1.18-pre → 0.1.19-pre

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 (56) hide show
  1. package/README.md +208 -381
  2. package/app/javascript/hakumi_components/controllers/hakumi/admin_panel_controller.js +5 -7
  3. package/app/javascript/hakumi_components/controllers/hakumi/back_top_controller.js +1 -1
  4. package/app/javascript/hakumi_components/controllers/hakumi/button_controller.js +108 -2
  5. package/app/javascript/hakumi_components/controllers/hakumi/calendar_controller.js +183 -95
  6. package/app/javascript/hakumi_components/controllers/hakumi/color_picker_controller.js +23 -285
  7. package/app/javascript/hakumi_components/controllers/hakumi/date_picker_controller.js +274 -262
  8. package/app/javascript/hakumi_components/controllers/hakumi/float_button_group_controller.js +2 -2
  9. package/app/javascript/hakumi_components/controllers/hakumi/message_controller.js +4 -2
  10. package/app/javascript/hakumi_components/controllers/hakumi/modal_controller.js +119 -125
  11. package/app/javascript/hakumi_components/controllers/hakumi/table/editable.js +291 -0
  12. package/app/javascript/hakumi_components/controllers/hakumi/table_controller.js +166 -366
  13. package/app/javascript/hakumi_components/controllers/hakumi/tabs_controller.js +8 -2
  14. package/app/javascript/hakumi_components/controllers/hakumi/tag_controller.js +27 -25
  15. package/app/javascript/hakumi_components/controllers/hakumi/tag_group_controller.js +19 -18
  16. package/app/javascript/hakumi_components/controllers/hakumi/theme_controller.js +116 -117
  17. package/app/javascript/hakumi_components/controllers/hakumi/transfer_controller.js +17 -1
  18. package/app/javascript/hakumi_components/controllers/hakumi/tree_controller.js +363 -78
  19. package/app/javascript/hakumi_components/controllers/hakumi/typography_controller.js +3 -3
  20. package/app/javascript/hakumi_components/controllers/hakumi/upload_controller.js +320 -204
  21. package/app/javascript/hakumi_components/core/render_component.js +37 -11
  22. package/app/javascript/hakumi_components/utils/color_helper.js +262 -0
  23. package/app/javascript/stylesheets/_base.scss +9 -0
  24. package/app/javascript/stylesheets/_hakumi_components.scss +1 -0
  25. package/app/javascript/stylesheets/components/_breadcrumb.scss +2 -2
  26. package/app/javascript/stylesheets/components/_calendar.scss +13 -13
  27. package/app/javascript/stylesheets/components/_cascader.scss +5 -5
  28. package/app/javascript/stylesheets/components/_checkbox.scss +9 -11
  29. package/app/javascript/stylesheets/components/_color_picker.scss +11 -11
  30. package/app/javascript/stylesheets/components/_date_picker.scss +4 -4
  31. package/app/javascript/stylesheets/components/_descriptions.scss +2 -2
  32. package/app/javascript/stylesheets/components/_drawer.scss +3 -3
  33. package/app/javascript/stylesheets/components/_dropdown.scss +2 -2
  34. package/app/javascript/stylesheets/components/_flex.scss +1 -1
  35. package/app/javascript/stylesheets/components/_float_button.scss +5 -5
  36. package/app/javascript/stylesheets/components/_form_item.scss +92 -0
  37. package/app/javascript/stylesheets/components/_image.scss +15 -15
  38. package/app/javascript/stylesheets/components/_input.scss +23 -113
  39. package/app/javascript/stylesheets/components/_layout.scss +27 -26
  40. package/app/javascript/stylesheets/components/_menu.scss +15 -15
  41. package/app/javascript/stylesheets/components/_modal.scss +13 -13
  42. package/app/javascript/stylesheets/components/_notification.scss +3 -3
  43. package/app/javascript/stylesheets/components/_popover.scss +1 -1
  44. package/app/javascript/stylesheets/components/_segmented.scss +3 -3
  45. package/app/javascript/stylesheets/components/_select.scss +6 -6
  46. package/app/javascript/stylesheets/components/_slider.scss +1 -1
  47. package/app/javascript/stylesheets/components/_spin.scss +2 -2
  48. package/app/javascript/stylesheets/components/_steps.scss +10 -10
  49. package/app/javascript/stylesheets/components/_switch.scss +11 -10
  50. package/app/javascript/stylesheets/components/_table.scss +6 -6
  51. package/app/javascript/stylesheets/components/_tag.scss +2 -2
  52. package/app/javascript/stylesheets/components/_tooltip.scss +4 -4
  53. package/app/javascript/stylesheets/components/_tree_select.scss +3 -3
  54. package/app/javascript/stylesheets/components/_typography.scss +3 -3
  55. package/app/javascript/stylesheets/components/_upload.scss +4 -4
  56. package/package.json +2 -2
package/README.md CHANGED
@@ -1,130 +1,100 @@
1
- <div align="center">
2
- <a href="https://github.com/hakumi-dev/hakumi-components">
3
- <img src="logo-hakumi-full.png" alt="Logo" width="250">
4
- </a>
1
+ <p align="center">
2
+ <br />
3
+ <img src="logo-hakumi-full.png" alt="Hakumi Components" width="250" />
4
+ <br />
5
+ </p>
6
+
7
+ <h1 align="center">Hakumi Components</h1>
8
+
9
+ <p align="center">
10
+ ViewComponent-based UI library for Ruby on Rails — 65 components, Ant Design conventions, Stimulus controllers
11
+ <br />
12
+ <a href="https://github.com/hakumi-dev/hakumi-components"><strong>Source Code</strong></a>
13
+ &middot;
14
+ <a href="https://components.hakumi.dev">Playground</a>
15
+ &middot;
16
+ <a href="https://github.com/hakumi-dev/hakumi-components/issues">Report Bug</a>
17
+ &middot;
18
+ <a href="https://github.com/hakumi-dev/hakumi-components/blob/main/CHANGELOG.md">Changelog</a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="https://github.com/hakumi-dev/hakumi-components/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
23
+ <a href="https://ruby-doc.org/"><img src="https://img.shields.io/badge/ruby-%3E%3D%203.0-CC342D.svg?logo=ruby" alt="Ruby >= 3.0" /></a>
24
+ </p>
5
25
 
6
- <h3 align="center">Hakumi Components</h3>
7
-
8
- <p align="center">
9
- Elegant UI component library for Ruby on Rails
10
- <br />
11
- <a href="https://components.hakumi.dev"><strong>View Live Playground »</strong></a>
12
- ·
13
- <a href="https://github.com/hakumi-dev/hakumi-components/issues">Report Bug</a>
14
- ·
15
- <a href="https://www.npmjs.com/package/@hakumi-dev/hakumi-components">npm Package</a>
16
- ·
17
- <a href="https://rubygems.org/gems/hakumi_components">RubyGems</a>
18
- </p>
19
- </div>
20
-
21
- ## About The Project
22
-
23
- Hakumi Components is a comprehensive UI component library for Ruby on Rails applications, inspired by Ant Design. It provides 65 production-ready, accessible components with light/dark theme support, combining the power of ViewComponent, Stimulus, and modern CSS.
26
+ ---
24
27
 
25
- **✨ Key Features:**
26
- - 🎨 **65 Components** - Button, Form, Table, Modal, Menu, Calendar, and more
27
- - 🌓 **Light/Dark Theme** - Built-in theme support with CSS variables
28
- - 📦 **Rails Engine** - Drop-in integration with ViewComponent
29
- - ⚡ **Modern Stack** - Stimulus controllers with clean JavaScript API
30
- - 🎯 **Ant Design Inspired** - Familiar design patterns and conventions
31
- - 🔧 **Customizable** - Override styles and behavior easily
28
+ ## Table of Contents
32
29
 
33
- **🎮 [Try the Interactive Playground](https://components.hakumi.dev)** - See all components in action with live examples
30
+ | | |
31
+ |---|---|
32
+ | [About](#about) | What Hakumi Components is and why it exists |
33
+ | [Installation](#installation) | Gem and npm setup |
34
+ | [Configuration](#configuration) | Initializer options |
35
+ | [Usage](#usage) | Basic examples |
36
+ | [Components](#components) | All 65 components by category |
37
+ | [JavaScript API](#javascript-api) | Programmatic control |
38
+ | [Architecture](#architecture) | How components are structured |
39
+ | [Development](#development) | Local playground, tests |
40
+ | [Contributing](#contributing) | How to contribute |
34
41
 
35
- ## Built With
42
+ ---
36
43
 
37
- [![Ruby][Ruby-badge]][Ruby-url] [![ViewComponent][ViewComponent-badge]][ViewComponent-url] [![Stimulus][Stimulus-badge]][Stimulus-url]
44
+ ## About
38
45
 
39
- **Core Technologies:**
40
- - Ruby on Rails 7.1+ as a Rails Engine
41
- - ViewComponent 3.0+ for Ruby components
42
- - Stimulus 3.0+ for JavaScript interactivity
43
- - SCSS with CSS variables for theming
46
+ Hakumi Components is a Rails UI component library built on ViewComponent, Stimulus, and SCSS. It follows Ant Design conventions and ships 65 server-rendered components with optional JavaScript interactivity. Light and dark themes are supported via CSS variables.
44
47
 
45
- ## Getting Started
48
+ Stack: ViewComponent 3.0+, Stimulus 3.0+, Rails 7.1+, SCSS.
46
49
 
47
- ### Prerequisites
50
+ ---
48
51
 
49
- **Required:**
50
- - Ruby 3.0 or higher
51
- - Rails 7.1 or higher
52
- - Node.js 16.9+ (for npm package)
53
- - A JavaScript bundler (Vite, Webpack, esbuild, etc.)
54
- - SCSS processor (sass, sass-embedded, etc.)
52
+ ## Installation
55
53
 
56
- **Recommended:**
57
- - Vite (via `vite_rails` gem)
58
- - Yarn or npm for package management
54
+ ### Requirements
59
55
 
60
- ### Installation
56
+ - Ruby 3.0+
57
+ - Rails 7.1+
58
+ - Node.js 16.9+
59
+ - A JavaScript bundler (Vite, Webpack, esbuild)
60
+ - SCSS processor
61
61
 
62
- #### Option A: Automatic Installation (Recommended)
62
+ ### Automatic (recommended)
63
63
 
64
- **1. Add the gem to your Gemfile:**
64
+ Add the gem:
65
65
 
66
66
  ```ruby
67
- # Always use the latest pre-release version (recommended during development)
68
67
  gem 'hakumi_components', '>= 0.1.0.pre'
69
-
70
- # Or pin to a specific version for stability
71
- gem 'hakumi_components', '0.1.16.pre'
72
68
  ```
73
69
 
74
- **2. Run the installer:**
70
+ Run the installer:
75
71
 
76
72
  ```bash
77
73
  bundle install
78
74
  bin/rails generate hakumi:install
79
75
  ```
80
76
 
81
- The generator will automatically:
82
- - ✅ Install the npm package with correct version (`@pre`)
83
- - ✅ Detect your JavaScript entry point (Vite/Webpack/Sprockets)
84
- - ✅ Add imports with complete configuration
85
- - ✅ Setup stylesheets with appropriate syntax (`@use` or `@import`)
86
- - ✅ Configure the FormBuilder (optional)
87
-
88
- **3. Restart your server and you're done! 🎉**
89
-
90
- ---
91
-
92
- #### Option B: Manual Installation
77
+ The generator detects your JavaScript entry point and SCSS setup, installs the npm package, and wires up imports automatically.
93
78
 
94
- If you prefer manual setup or the generator doesn't work for your setup:
79
+ ### Manual
95
80
 
96
81
  **1. Add the gem:**
97
82
 
98
83
  ```ruby
99
- # Always use the latest pre-release version
100
84
  gem 'hakumi_components', '>= 0.1.0.pre'
101
-
102
- # Or pin to a specific version
103
- gem 'hakumi_components', '0.1.16.pre'
104
85
  ```
105
86
 
106
- **2. Install dependencies:**
87
+ **2. Install the npm package:**
107
88
 
108
89
  ```bash
109
- bundle install
110
-
111
- # Using Yarn - latest pre-release
112
90
  yarn add @hakumi-dev/hakumi-components@pre
113
-
114
- # Using Yarn - specific version
115
- yarn add @hakumi-dev/hakumi-components@0.1.16-pre
116
-
117
- # Using npm - latest pre-release
91
+ # or
118
92
  npm install @hakumi-dev/hakumi-components@pre
119
-
120
- # Using npm - specific version
121
- npm install @hakumi-dev/hakumi-components@0.1.16-pre
122
93
  ```
123
94
 
124
- **3. Setup JavaScript:**
95
+ **3. JavaScript:**
125
96
 
126
97
  ```javascript
127
- // app/javascript/application.js (or entrypoints/application.js for Vite)
128
98
  import { Application } from "@hotwired/stimulus"
129
99
  import HakumiComponents, { registerHakumiControllers } from "@hakumi-dev/hakumi-components"
130
100
 
@@ -133,377 +103,234 @@ window.HakumiComponents = HakumiComponents
133
103
  registerHakumiControllers(application)
134
104
  ```
135
105
 
136
- **4. Setup stylesheets:**
106
+ **4. Stylesheets:**
137
107
 
138
108
  ```scss
139
- // For Vite/Webpack (modern bundlers)
140
- // app/javascript/stylesheets/application.scss
109
+ // Vite / Webpack
141
110
  @use '@hakumi-dev/hakumi-components/styles';
142
111
 
143
- // OR for Sprockets/traditional setup
144
- // app/assets/stylesheets/application.scss
112
+ // Sprockets
145
113
  @import "@hakumi-dev/hakumi-components/styles";
146
114
  ```
147
115
 
148
- ## Configuration
116
+ ---
149
117
 
150
- You can configure HakumiComponents in an initializer:
118
+ ## Configuration
151
119
 
152
120
  ```ruby
153
121
  # config/initializers/hakumi_components.rb
154
122
  HakumiComponents.configure do |config|
155
123
  config.default_form_builder = true # Use HakumiComponents::FormBuilder as default
156
- config.base_path = "hakumi/components" # Base URL path for component routes
124
+ config.base_path = "hakumi/components" # Base URL for modal/drawer routes
157
125
  end
158
126
  ```
159
127
 
160
- ### Available Configuration Options
161
-
162
128
  | Option | Default | Description |
163
129
  |--------|---------|-------------|
164
- | `default_form_builder` | `false` | Use `HakumiComponents::FormBuilder` as the default form builder |
165
- | `base_path` | `"hakumi/components"` | Base URL path for component routes (modals, drawers, etc.) |
166
-
167
- ### Accessing Configuration
168
-
169
- ```ruby
170
- HakumiComponents.config.default_form_builder
171
- # => true
130
+ | `default_form_builder` | `false` | Set `HakumiComponents::FormBuilder` as the application default |
131
+ | `base_path` | `"hakumi/components"` | Base URL path for components that require server routes |
172
132
 
173
- HakumiComponents.config.base_path
174
- # => "hakumi/components"
175
- ```
133
+ ---
176
134
 
177
135
  ## Usage
178
136
 
179
- ### Basic Component Example
180
-
181
137
  ```erb
182
- <%# Simple button %>
183
138
  <%= render HakumiComponents::Button::Component.new(type: :primary) do %>
184
- Click me
139
+ Save
185
140
  <% end %>
186
141
 
187
- <%# Form with automatic validation detection %>
188
142
  <%= form_with model: @user, builder: HakumiComponents::FormBuilder do |f| %>
189
143
  <%= f.text_field :email %>
190
144
  <%= f.text_field :name %>
191
145
  <%= f.submit "Save", type: :primary %>
192
146
  <% end %>
193
147
 
194
- <%# Modal with programmatic control %>
195
- <%= render HakumiComponents::Modal::Component.new(
196
- id: "my-modal",
197
- title: "Confirm Action"
198
- ) do %>
199
- Are you sure you want to proceed?
148
+ <%= render HakumiComponents::Modal::Component.new(id: "confirm-modal", title: "Confirm") do %>
149
+ Are you sure?
200
150
  <% end %>
201
151
  ```
202
152
 
203
- ### Component Reference
204
-
205
- Browse all **65 components** organized by category. Each component includes detailed documentation, examples, and API reference.
206
-
207
- #### General (4)
208
- - [Button](./app/components/hakumi_components/button/docs/README.md) - Clickable button element
209
- - [Float Button](./app/components/hakumi_components/float_button/docs/README.md) - Floating action button
210
- - [Icon](./app/components/hakumi_components/icon/docs/README.md) - Icon display component
211
- - [Typography](./app/components/hakumi_components/typography/docs/README.md) - Text styling and formatting
212
-
213
- #### Layout (6)
214
- - [Divider](./app/components/hakumi_components/divider/docs/README.md) - Horizontal or vertical divider line
215
- - [Flex](./app/components/hakumi_components/flex/docs/README.md) - Flexbox layout container
216
- - [Grid](./app/components/hakumi_components/grid/docs/README.md) - Grid layout system
217
- - [Layout](./app/components/hakumi_components/layout/docs/README.md) - Page layout structure
218
- - [Space](./app/components/hakumi_components/space/docs/README.md) - Spacing between elements
219
- - [Splitter](./app/components/hakumi_components/splitter/docs/README.md) - Resizable split panels
220
-
221
- #### Navigation (6)
222
- - [Anchor](./app/components/hakumi_components/anchor/docs/README.md) - Anchor navigation for page sections
223
- - [Breadcrumb](./app/components/hakumi_components/breadcrumb/docs/README.md) - Breadcrumb navigation trail
224
- - [Dropdown](./app/components/hakumi_components/dropdown/docs/README.md) - Dropdown menu
225
- - [Menu](./app/components/hakumi_components/menu/docs/README.md) - Navigation menu
226
- - [Pagination](./app/components/hakumi_components/pagination/docs/README.md) - Pagination controls
227
- - [Steps](./app/components/hakumi_components/steps/docs/README.md) - Step-by-step navigation
228
-
229
- #### Data Entry (18)
230
- - [Autocomplete](./app/components/hakumi_components/autocomplete/docs/README.md) - Input with autocomplete suggestions
231
- - [Cascader](./app/components/hakumi_components/cascader/docs/README.md) - Cascading selection dropdown
232
- - [Checkbox](./app/components/hakumi_components/checkbox/docs/README.md) - Checkbox input
233
- - [Color Picker](./app/components/hakumi_components/color_picker/docs/README.md) - Color selection input
234
- - [Date Picker](./app/components/hakumi_components/date_picker/docs/README.md) - Date selection input
235
- - [Form](./app/components/hakumi_components/form/docs/README.md) - Form wrapper with validation
236
- - [Input](./app/components/hakumi_components/input/docs/README.md) - Text input field
237
- - [Input Number](./app/components/hakumi_components/input_number/docs/README.md) - Numeric input field
238
- - [Mentions](./app/components/hakumi_components/mentions/docs/README.md) - @mentions input
239
- - [Radio](./app/components/hakumi_components/radio/docs/README.md) - Radio button input
240
- - [Rate](./app/components/hakumi_components/rate/docs/README.md) - Star rating input
241
- - [Select](./app/components/hakumi_components/select/docs/README.md) - Dropdown select input
242
- - [Slider](./app/components/hakumi_components/slider/docs/README.md) - Range slider input
243
- - [Switch](./app/components/hakumi_components/switch/docs/README.md) - Toggle switch input
244
- - [Time Picker](./app/components/hakumi_components/time_picker/docs/README.md) - Time selection input
245
- - [Transfer](./app/components/hakumi_components/transfer/docs/README.md) - Dual list transfer
246
- - [Tree Select](./app/components/hakumi_components/tree_select/docs/README.md) - Tree structure select
247
- - [Upload](./app/components/hakumi_components/upload/docs/README.md) - File upload component
248
-
249
- #### Data Display (20)
250
- - [Avatar](./app/components/hakumi_components/avatar/docs/README.md) - User avatar display
251
- - [Badge](./app/components/hakumi_components/badge/docs/README.md) - Badge and status dot
252
- - [Calendar](./app/components/hakumi_components/calendar/docs/README.md) - Calendar display
253
- - [Card](./app/components/hakumi_components/card/docs/README.md) - Card container
254
- - [Carousel](./app/components/hakumi_components/carousel/docs/README.md) - Image/content carousel
255
- - [Collapse](./app/components/hakumi_components/collapse/docs/README.md) - Collapsible accordion panels
256
- - [Descriptions](./app/components/hakumi_components/descriptions/docs/README.md) - Description list display
257
- - [Empty](./app/components/hakumi_components/empty/docs/README.md) - Empty state placeholder
258
- - [Image](./app/components/hakumi_components/image/docs/README.md) - Image display with preview
259
- - [Popover](./app/components/hakumi_components/popover/docs/README.md) - Popover overlay
260
- - [QR Code](./app/components/hakumi_components/qr_code/docs/README.md) - QR code generator
261
- - [Segmented](./app/components/hakumi_components/segmented/docs/README.md) - Segmented control
262
- - [Statistic](./app/components/hakumi_components/statistic/docs/README.md) - Statistic display
263
- - [Table](./app/components/hakumi_components/table/docs/README.md) - Data table
264
- - [Tabs](./app/components/hakumi_components/tabs/docs/README.md) - Tab navigation
265
- - [Tag](./app/components/hakumi_components/tag/docs/README.md) - Tag label
266
- - [Timeline](./app/components/hakumi_components/timeline/docs/README.md) - Timeline display
267
- - [Tooltip](./app/components/hakumi_components/tooltip/docs/README.md) - Tooltip overlay
268
- - [Tour](./app/components/hakumi_components/tour/docs/README.md) - Guided tour
269
- - [Tree](./app/components/hakumi_components/tree/docs/README.md) - Tree structure display
270
-
271
- #### Feedback (10)
272
- - [Alert](./app/components/hakumi_components/alert/docs/README.md) - Alert message display
273
- - [Drawer](./app/components/hakumi_components/drawer/docs/README.md) - Slide-out drawer panel
274
- - [Message](./app/components/hakumi_components/message/docs/README.md) - Global message notification
275
- - [Modal](./app/components/hakumi_components/modal/docs/README.md) - Modal dialog
276
- - [Notification](./app/components/hakumi_components/notification/docs/README.md) - Notification message
277
- - [Popconfirm](./app/components/hakumi_components/popconfirm/docs/README.md) - Confirmation popover
278
- - [Progress](./app/components/hakumi_components/progress/docs/README.md) - Progress indicator
279
- - [Result](./app/components/hakumi_components/result/docs/README.md) - Result status page
280
- - [Skeleton](./app/components/hakumi_components/skeleton/docs/README.md) - Skeleton loading placeholder
281
- - [Spin](./app/components/hakumi_components/spin/docs/README.md) - Loading spinner
282
-
283
- #### Other (1)
284
- - [Affix](./app/components/hakumi_components/affix/docs/README.md) - Pin element to viewport
153
+ ---
154
+
155
+ ## Components
156
+
157
+ 65 components organized by category. Each links to its own documentation with API reference and examples.
158
+
159
+ ### General
160
+
161
+ - [Button](./app/components/hakumi_components/button/docs/README.md)
162
+ - [Float Button](./app/components/hakumi_components/float_button/docs/README.md)
163
+ - [Icon](./app/components/hakumi_components/icon/docs/README.md)
164
+ - [Typography](./app/components/hakumi_components/typography/docs/README.md)
165
+
166
+ ### Layout
167
+
168
+ - [Divider](./app/components/hakumi_components/divider/docs/README.md)
169
+ - [Flex](./app/components/hakumi_components/flex/docs/README.md)
170
+ - [Grid](./app/components/hakumi_components/grid/docs/README.md)
171
+ - [Layout](./app/components/hakumi_components/layout/docs/README.md)
172
+ - [Space](./app/components/hakumi_components/space/docs/README.md)
173
+ - [Splitter](./app/components/hakumi_components/splitter/docs/README.md)
174
+
175
+ ### Navigation
176
+
177
+ - [Anchor](./app/components/hakumi_components/anchor/docs/README.md)
178
+ - [Breadcrumb](./app/components/hakumi_components/breadcrumb/docs/README.md)
179
+ - [Dropdown](./app/components/hakumi_components/dropdown/docs/README.md)
180
+ - [Menu](./app/components/hakumi_components/menu/docs/README.md)
181
+ - [Pagination](./app/components/hakumi_components/pagination/docs/README.md)
182
+ - [Steps](./app/components/hakumi_components/steps/docs/README.md)
183
+
184
+ ### Data Entry
185
+
186
+ - [Autocomplete](./app/components/hakumi_components/autocomplete/docs/README.md)
187
+ - [Cascader](./app/components/hakumi_components/cascader/docs/README.md)
188
+ - [Checkbox](./app/components/hakumi_components/checkbox/docs/README.md)
189
+ - [Color Picker](./app/components/hakumi_components/color_picker/docs/README.md)
190
+ - [Date Picker](./app/components/hakumi_components/date_picker/docs/README.md)
191
+ - [Form](./app/components/hakumi_components/form/docs/README.md)
192
+ - [Input](./app/components/hakumi_components/input/docs/README.md)
193
+ - [Input Number](./app/components/hakumi_components/input_number/docs/README.md)
194
+ - [Mentions](./app/components/hakumi_components/mentions/docs/README.md)
195
+ - [Radio](./app/components/hakumi_components/radio/docs/README.md)
196
+ - [Rate](./app/components/hakumi_components/rate/docs/README.md)
197
+ - [Select](./app/components/hakumi_components/select/docs/README.md)
198
+ - [Slider](./app/components/hakumi_components/slider/docs/README.md)
199
+ - [Switch](./app/components/hakumi_components/switch/docs/README.md)
200
+ - [Time Picker](./app/components/hakumi_components/time_picker/docs/README.md)
201
+ - [Transfer](./app/components/hakumi_components/transfer/docs/README.md)
202
+ - [Tree Select](./app/components/hakumi_components/tree_select/docs/README.md)
203
+ - [Upload](./app/components/hakumi_components/upload/docs/README.md)
204
+
205
+ ### Data Display
206
+
207
+ - [Avatar](./app/components/hakumi_components/avatar/docs/README.md)
208
+ - [Badge](./app/components/hakumi_components/badge/docs/README.md)
209
+ - [Calendar](./app/components/hakumi_components/calendar/docs/README.md)
210
+ - [Card](./app/components/hakumi_components/card/docs/README.md)
211
+ - [Carousel](./app/components/hakumi_components/carousel/docs/README.md)
212
+ - [Collapse](./app/components/hakumi_components/collapse/docs/README.md)
213
+ - [Descriptions](./app/components/hakumi_components/descriptions/docs/README.md)
214
+ - [Empty](./app/components/hakumi_components/empty/docs/README.md)
215
+ - [Image](./app/components/hakumi_components/image/docs/README.md)
216
+ - [Popover](./app/components/hakumi_components/popover/docs/README.md)
217
+ - [QR Code](./app/components/hakumi_components/qr_code/docs/README.md)
218
+ - [Segmented](./app/components/hakumi_components/segmented/docs/README.md)
219
+ - [Statistic](./app/components/hakumi_components/statistic/docs/README.md)
220
+ - [Table](./app/components/hakumi_components/table/docs/README.md)
221
+ - [Tabs](./app/components/hakumi_components/tabs/docs/README.md)
222
+ - [Tag](./app/components/hakumi_components/tag/docs/README.md)
223
+ - [Timeline](./app/components/hakumi_components/timeline/docs/README.md)
224
+ - [Tooltip](./app/components/hakumi_components/tooltip/docs/README.md)
225
+ - [Tour](./app/components/hakumi_components/tour/docs/README.md)
226
+ - [Tree](./app/components/hakumi_components/tree/docs/README.md)
227
+
228
+ ### Feedback
229
+
230
+ - [Alert](./app/components/hakumi_components/alert/docs/README.md)
231
+ - [Drawer](./app/components/hakumi_components/drawer/docs/README.md)
232
+ - [Message](./app/components/hakumi_components/message/docs/README.md)
233
+ - [Modal](./app/components/hakumi_components/modal/docs/README.md)
234
+ - [Notification](./app/components/hakumi_components/notification/docs/README.md)
235
+ - [Popconfirm](./app/components/hakumi_components/popconfirm/docs/README.md)
236
+ - [Progress](./app/components/hakumi_components/progress/docs/README.md)
237
+ - [Result](./app/components/hakumi_components/result/docs/README.md)
238
+ - [Skeleton](./app/components/hakumi_components/skeleton/docs/README.md)
239
+ - [Spin](./app/components/hakumi_components/spin/docs/README.md)
240
+
241
+ ### Other
242
+
243
+ - [Affix](./app/components/hakumi_components/affix/docs/README.md)
244
+
245
+ ---
285
246
 
286
247
  ## JavaScript API
287
248
 
288
- Components with interactivity expose programmatic APIs:
249
+ Interactive components expose a programmatic API:
289
250
 
290
251
  ```javascript
291
- // Access component API via element
292
- const modal = document.getElementById('my-modal')
293
- modal.hakumiComponent.api.open()
294
- modal.hakumiComponent.api.close()
252
+ // Via element
253
+ document.getElementById('my-modal').hakumiComponent.api.open()
254
+ document.getElementById('my-modal').hakumiComponent.api.close()
295
255
 
296
- // Or via global registry
256
+ // Via global registry
297
257
  window.HakumiComponents.get('my-modal').open()
298
258
  ```
299
259
 
300
- Common API methods by component type:
301
- - **Toggleables** (Modal, Drawer): `open()`, `close()`, `toggle()`, `isOpen()`
302
- - **Inputs** (Input, Select): `getValue()`, `setValue(value)`, `clear()`, `focus()`
303
- - **Navigation** (Carousel, Tabs): `next()`, `prev()`, `goTo(index)`, `getCurrent()`
304
-
305
- ## Architecture
306
-
307
- Components follow a three-layer pattern:
308
- 1. **Ruby Component** (`component.rb`) - Props and rendering logic
309
- 2. **ERB Template** (`component.html.erb`) - HTML structure (optional)
310
- 3. **Stimulus Controller** (`{component}_controller.js`) - Interactivity (when needed)
311
-
312
- **Note:** Not all components need JavaScript controllers. Many are purely presentational (Typography, Space, Divider, etc.).
313
-
314
- ## Troubleshooting
315
-
316
- ### Installation Issues
317
-
318
- If you encounter problems during installation:
319
-
320
- 1. **Try the automatic installer first:**
321
- ```bash
322
- bin/rails generate hakumi:install
323
- ```
324
-
325
- 2. **If the installer fails**, follow the manual installation steps above
326
-
327
- 3. **Check compatibility:**
328
- - Ruby 3.0+
329
- - Rails 7.1+
330
- - Node.js 16.9+
331
- - A JavaScript bundler (Vite, Webpack, esbuild)
332
-
333
- ### Controllers not registering
334
-
335
- If components don't respond to interactions:
336
-
337
- 1. **Verify the npm package is installed:**
338
- ```bash
339
- yarn list @hakumi-dev/hakumi-components
340
- # or
341
- npm list @hakumi-dev/hakumi-components
342
- ```
343
-
344
- 2. **Check browser console:**
345
- - Should see: `"[HakumiComponents] Registered X controllers"`
346
- - If you see errors, check your import paths
347
-
348
- 3. **Verify Stimulus is properly configured:**
349
- ```javascript
350
- console.log(window.Stimulus) // Should not be undefined
351
- console.log(window.HakumiComponents) // Should be an object with methods
352
- ```
353
-
354
- 4. **Ensure imports are complete:**
355
- ```javascript
356
- // ✅ Correct - includes both exports
357
- import HakumiComponents, { registerHakumiControllers } from "@hakumi-dev/hakumi-components"
358
-
359
- // ❌ Wrong - missing default export
360
- import { registerHakumiControllers } from "@hakumi-dev/hakumi-components"
361
- ```
362
-
363
- ### Styles not loading
364
-
365
- 1. Verify you're using SCSS (not plain CSS)
366
- 2. Check your bundler configuration supports node_modules imports
367
- 3. For Vite, ensure `@use` syntax is used (not `@import`)
368
-
369
- ### Version mismatches
370
-
371
- Keep gem and npm versions in sync:
372
-
373
- ```ruby
374
- # Gemfile - pin to specific version
375
- gem 'hakumi_components', '0.1.16.pre'
376
- ```
377
- ```bash
378
- # package.json - matching version
379
- yarn add @hakumi-dev/hakumi-components@0.1.16-pre
380
- ```
381
-
382
- Or use dynamic versioning to always get the latest:
383
- ```ruby
384
- # Gemfile - always latest pre-release
385
- gem 'hakumi_components', '>= 0.1.0.pre'
386
- ```
387
- ```bash
388
- # package.json - always latest pre-release
389
- yarn add @hakumi-dev/hakumi-components@pre
390
- ```
260
+ | Component type | Methods |
261
+ |----------------|---------|
262
+ | Toggleables (Modal, Drawer) | `open()`, `close()`, `toggle()`, `isOpen()` |
263
+ | Inputs (Input, Select) | `getValue()`, `setValue(value)`, `clear()`, `focus()` |
264
+ | Navigation (Carousel, Tabs) | `next()`, `prev()`, `goTo(index)`, `getCurrent()` |
391
265
 
392
- ## Updating
266
+ ---
393
267
 
394
- To update to the latest version:
268
+ ## Architecture
395
269
 
396
- ```bash
397
- # Update Ruby gem
398
- bundle update hakumi_components
270
+ Each component follows a three-layer pattern:
399
271
 
400
- # Update npm package to latest pre-release
401
- yarn add @hakumi-dev/hakumi-components@pre
402
- # or
403
- npm install @hakumi-dev/hakumi-components@pre
404
- ```
272
+ 1. **Ruby component** (`component.rb`) props, validation, rendering logic
273
+ 2. **ERB template** (`component.html.erb`) — HTML structure
274
+ 3. **Stimulus controller** (`*_controller.js`) — JavaScript interactivity (only when needed)
405
275
 
406
- **Version Strategy:**
407
- - **During development:** Use `>= 0.1.0.pre` (gem) and `@pre` (npm) to always get the latest features
408
- - **For production:** Pin to a specific version like `0.1.16.pre` for stability
276
+ Purely presentational components (Typography, Space, Divider, etc.) have no JavaScript layer.
409
277
 
410
- **Note:** Currently in pre-release (`0.1.x.pre`). Stable `1.0.0` release coming soon.
278
+ ---
411
279
 
412
280
  ## Development
413
281
 
414
- ### Local Playground
415
-
416
- Want to see and test components locally? We have a built-in playground:
282
+ ### Playground
417
283
 
418
284
  ```bash
419
- # From the gem root directory
420
285
  bin/playground
421
286
  ```
422
287
 
423
- Then visit http://localhost:3000 to browse all components and examples.
424
-
425
- **Features:**
426
- - 📋 Browse all 65 components
427
- - 🎨 See examples in action
428
- - 🔍 Test component behavior
429
- - 💻 Perfect for development
288
+ Opens a local Rails app at `http://localhost:3000` with all components and examples. Located in `test/dummy/`, not included in the published gem.
430
289
 
431
- The playground is located in `test/dummy/` and is **not included** in the published gem.
432
-
433
- ### Adding Examples
434
-
435
- To add a new example for testing:
290
+ To add an example:
436
291
 
437
292
  ```bash
438
- # Create a new example partial
439
293
  touch test/dummy/app/views/test_examples/[component]/_[example_name].html.erb
440
294
  ```
441
295
 
442
- It will automatically appear in the playground at `/test/[component]/[example_name]`.
296
+ It appears automatically at `/test/[component]/[example_name]`.
443
297
 
444
- ### Running Tests
298
+ ### Tests
445
299
 
446
300
  ```bash
447
- # All tests
448
- bundle exec rake test
301
+ bundle exec rake test # all tests
302
+ bundle exec rake test TEST=test/components/hakumi/button/component_test.rb # single file
303
+ bundle exec rake test:system # browser tests
304
+ ```
449
305
 
450
- # Specific test file
451
- bundle exec rake test TEST=test/components/hakumi/button/component_test.rb
306
+ ### Versioning
452
307
 
453
- # System tests (browser tests)
454
- bundle exec rake test:system
455
- ```
308
+ Gem and npm versions must be kept in sync:
456
309
 
457
- ## Contributing
310
+ ```ruby
311
+ # Gemfile
312
+ gem 'hakumi_components', '0.1.16.pre'
313
+ ```
458
314
 
459
- Contributions are welcome! This is an open-source project and we'd love your help.
460
-
461
- **For Contributors:**
462
-
463
- 1. Fork the Project
464
- 2. Clone your fork and setup:
465
- ```bash
466
- git clone https://github.com/your-username/hakumi-components.git
467
- cd hakumi-components
468
- bin/setup
469
- ```
470
- 3. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
471
- 4. Make your changes and add tests
472
- 5. Run tests: `bundle exec rake test`
473
- 6. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
474
- 7. Push to the Branch (`git push origin feature/AmazingFeature`)
475
- 8. Open a Pull Request
476
-
477
- **Development Commands:**
478
315
  ```bash
479
- bin/setup # Initial setup
480
- bundle exec rake test # Run Ruby tests
481
- yarn test # Run JavaScript tests
482
- bin/ci # Run full CI suite locally
316
+ yarn add @hakumi-dev/hakumi-components@0.1.16-pre
483
317
  ```
484
318
 
485
- ## License
319
+ Use `>= 0.1.0.pre` / `@pre` to always track the latest pre-release.
486
320
 
487
- Distributed under the MIT License. See `LICENSE` for more information.
321
+ ---
488
322
 
489
- ## Contact
323
+ ## Contributing
490
324
 
491
- Project Link: [https://github.com/hakumi-dev/hakumi-components](https://github.com/hakumi-dev/hakumi-components)
325
+ 1. Fork the repository
326
+ 2. Set up locally: `bin/setup`
327
+ 3. Create a branch: `git checkout -b my-feature`
328
+ 4. Make changes and add tests
329
+ 5. Run the test suite: `bundle exec rake test`
330
+ 6. Open a pull request
492
331
 
493
- ## Acknowledgments
332
+ ---
494
333
 
495
- - Inspired by [Ant Design](https://ant.design/)
496
- - Built with [ViewComponent](https://viewcomponent.org/)
497
- - Powered by [Stimulus](https://stimulus.hotwired.dev/)
334
+ ## License
498
335
 
499
- <!-- MARKDOWN LINKS & IMAGES -->
500
- [Ruby-badge]: https://img.shields.io/badge/Ruby-CC342D?style=for-the-badge&logo=ruby&logoColor=white
501
- [Ruby-url]: https://www.ruby-lang.org/
502
- [Rails-badge]: https://img.shields.io/badge/Rails-CC0000?style=for-the-badge&logo=ruby-on-rails&logoColor=white
503
- [Rails-url]: https://rubyonrails.org/
504
- [ViewComponent-badge]: https://img.shields.io/badge/ViewComponent-FE7A16?style=for-the-badge&logo=ruby&logoColor=white
505
- [ViewComponent-url]: https://viewcomponent.org/
506
- [Stimulus-badge]: https://img.shields.io/badge/Stimulus-77E8B9?style=for-the-badge&logo=stimulus&logoColor=black
507
- [Stimulus-url]: https://stimulus.hotwired.dev/
508
- [Vite-badge]: https://img.shields.io/badge/Vite-646CFF?style=for-the-badge&logo=vite&logoColor=white
509
- [Vite-url]: https://vitejs.dev/
336
+ MIT. See [LICENSE](./LICENSE).