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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -2
- data/README.md +208 -381
- data/app/assets/javascripts/hakumi_components.js +40 -34
- data/app/assets/stylesheets/hakumi_components.css +1 -1
- data/app/components/hakumi_components/admin_panel/component.rb +19 -9
- data/app/components/hakumi_components/affix/component.rb +54 -30
- data/app/components/hakumi_components/alert/component.html.erb +2 -2
- data/app/components/hakumi_components/alert/component.rb +68 -18
- data/app/components/hakumi_components/anchor/component.rb +35 -27
- data/app/components/hakumi_components/anchor/link/component.html.erb +1 -1
- data/app/components/hakumi_components/anchor/link/component.rb +28 -9
- data/app/components/hakumi_components/autocomplete/component.html.erb +86 -66
- data/app/components/hakumi_components/autocomplete/component.rb +115 -89
- data/app/components/hakumi_components/avatar/component.rb +45 -12
- data/app/components/hakumi_components/badge/component.rb +99 -45
- data/app/components/hakumi_components/base_component.rb +290 -91
- data/app/components/hakumi_components/breadcrumb/component.rb +16 -5
- data/app/components/hakumi_components/breadcrumb/item/component.html.erb +5 -5
- data/app/components/hakumi_components/breadcrumb/item/component.rb +56 -8
- data/app/components/hakumi_components/breadcrumb/item/menu_entry.rb +71 -0
- data/app/components/hakumi_components/button/component.rb +62 -20
- data/app/components/hakumi_components/calendar/component.html.erb +19 -19
- data/app/components/hakumi_components/calendar/component.rb +225 -202
- data/app/components/hakumi_components/calendar/day_cell.rb +62 -0
- data/app/components/hakumi_components/calendar/display_model.rb +237 -0
- data/app/components/hakumi_components/calendar/event_entry.rb +54 -0
- data/app/components/hakumi_components/calendar/locale_pack.rb +28 -0
- data/app/components/hakumi_components/calendar/panel_entry.rb +48 -0
- data/app/components/hakumi_components/calendar/week_row.rb +28 -0
- data/app/components/hakumi_components/card/component.html.erb +2 -2
- data/app/components/hakumi_components/card/component.rb +76 -49
- data/app/components/hakumi_components/card/grid/component.html.erb +1 -1
- data/app/components/hakumi_components/card/grid/component.rb +23 -17
- data/app/components/hakumi_components/card/meta/component.html.erb +8 -8
- data/app/components/hakumi_components/card/meta/component.rb +42 -24
- data/app/components/hakumi_components/carousel/autoplay_config.rb +27 -0
- data/app/components/hakumi_components/carousel/component.rb +85 -67
- data/app/components/hakumi_components/carousel/dots_config.rb +36 -0
- data/app/components/hakumi_components/cascader/component.html.erb +54 -36
- data/app/components/hakumi_components/cascader/component.rb +111 -62
- data/app/components/hakumi_components/checkbox/component.html.erb +5 -5
- data/app/components/hakumi_components/checkbox/component.rb +40 -6
- data/app/components/hakumi_components/checkbox/group/component.html.erb +4 -4
- data/app/components/hakumi_components/checkbox/group/component.rb +40 -13
- data/app/components/hakumi_components/checkbox/group/option.rb +34 -0
- data/app/components/hakumi_components/collapse/component.rb +64 -48
- data/app/components/hakumi_components/collapse/panel/component.rb +64 -21
- data/app/components/hakumi_components/color_picker/component.html.erb +21 -22
- data/app/components/hakumi_components/color_picker/component.rb +159 -49
- data/app/components/hakumi_components/color_picker/preset_group.rb +27 -0
- data/app/components/hakumi_components/concerns/form_field.rb +169 -68
- data/app/components/hakumi_components/concerns/form_field_contract.rb +57 -0
- data/app/components/hakumi_components/concerns/form_field_interface.rb +16 -0
- data/app/components/hakumi_components/concerns/input_control.rb +111 -0
- data/app/components/hakumi_components/concerns/input_control_contract.rb +47 -0
- data/app/components/hakumi_components/concerns/input_control_interface.rb +34 -0
- data/app/components/hakumi_components/concerns/selection_control.rb +122 -0
- data/app/components/hakumi_components/concerns/selection_control_contract.rb +47 -0
- data/app/components/hakumi_components/concerns/selection_control_interface.rb +34 -0
- data/app/components/hakumi_components/container/component.rb +29 -14
- data/app/components/hakumi_components/date_picker/component.html.erb +1 -3
- data/app/components/hakumi_components/date_picker/component.rb +130 -16
- data/app/components/hakumi_components/date_picker/range_picker.rb +159 -28
- data/app/components/hakumi_components/date_picker/shared_rendering.rb +151 -61
- data/app/components/hakumi_components/descriptions/component.html.erb +6 -6
- data/app/components/hakumi_components/descriptions/component.rb +98 -61
- data/app/components/hakumi_components/descriptions/item/component.rb +32 -8
- data/app/components/hakumi_components/divider/component.rb +36 -16
- data/app/components/hakumi_components/drawer/component.html.erb +2 -2
- data/app/components/hakumi_components/drawer/component.rb +112 -29
- data/app/components/hakumi_components/dropdown/component.rb +32 -35
- data/app/components/hakumi_components/dropdown/divider/component.rb +4 -0
- data/app/components/hakumi_components/dropdown/item/component.rb +42 -16
- data/app/components/hakumi_components/empty/component.rb +66 -31
- data/app/components/hakumi_components/flex/component.rb +39 -21
- data/app/components/hakumi_components/float_button/back_top/component.rb +35 -28
- data/app/components/hakumi_components/float_button/component.rb +161 -75
- data/app/components/hakumi_components/float_button/group/component.rb +85 -98
- data/app/components/hakumi_components/float_button/group_cluster/component.rb +46 -54
- data/app/components/hakumi_components/float_button/group_spec.rb +259 -0
- data/app/components/hakumi_components/float_button/item_spec.rb +115 -0
- data/app/components/hakumi_components/float_button/position_config.rb +68 -0
- data/app/components/hakumi_components/form/item/component.rb +34 -27
- data/app/components/hakumi_components/grid/col/component.rb +88 -17
- data/app/components/hakumi_components/grid/row/component.rb +35 -17
- data/app/components/hakumi_components/icon/component.rb +49 -49
- data/app/components/hakumi_components/image/component.html.erb +7 -7
- data/app/components/hakumi_components/image/component.rb +103 -40
- data/app/components/hakumi_components/image/preview_group/component.html.erb +1 -1
- data/app/components/hakumi_components/image/preview_group/component.rb +41 -36
- data/app/components/hakumi_components/image/preview_group/item.rb +48 -0
- data/app/components/hakumi_components/input/component.html.erb +1 -1
- data/app/components/hakumi_components/input/component.rb +142 -66
- data/app/components/hakumi_components/input/password/component.rb +30 -41
- data/app/components/hakumi_components/input/text_area/component.html.erb +2 -2
- data/app/components/hakumi_components/input/text_area/component.rb +89 -42
- data/app/components/hakumi_components/input_number/component.html.erb +5 -5
- data/app/components/hakumi_components/input_number/component.rb +137 -55
- data/app/components/hakumi_components/layout/component.html.erb +1 -1
- data/app/components/hakumi_components/layout/component.rb +23 -16
- data/app/components/hakumi_components/layout/content/component.html.erb +1 -1
- data/app/components/hakumi_components/layout/content/component.rb +24 -14
- data/app/components/hakumi_components/layout/footer/component.html.erb +1 -1
- data/app/components/hakumi_components/layout/footer/component.rb +24 -14
- data/app/components/hakumi_components/layout/header/component.html.erb +1 -1
- data/app/components/hakumi_components/layout/header/component.rb +24 -14
- data/app/components/hakumi_components/layout/sider/component.html.erb +1 -1
- data/app/components/hakumi_components/layout/sider/component.rb +83 -49
- data/app/components/hakumi_components/mentions/coercion.rb +46 -0
- data/app/components/hakumi_components/mentions/component.html.erb +6 -6
- data/app/components/hakumi_components/mentions/component.rb +131 -67
- data/app/components/hakumi_components/mentions/option.rb +30 -0
- data/app/components/hakumi_components/menu/component.rb +50 -59
- data/app/components/hakumi_components/menu/divider/component.rb +4 -0
- data/app/components/hakumi_components/menu/group/component.rb +16 -15
- data/app/components/hakumi_components/menu/item/component.rb +42 -19
- data/app/components/hakumi_components/menu/sub_menu/component.rb +49 -37
- data/app/components/hakumi_components/message/component.rb +62 -27
- data/app/components/hakumi_components/modal/component.html.erb +6 -6
- data/app/components/hakumi_components/modal/component.rb +93 -40
- data/app/components/hakumi_components/modal/confirm/component.html.erb +2 -2
- data/app/components/hakumi_components/modal/confirm/component.rb +49 -8
- data/app/components/hakumi_components/modal/error/component.rb +8 -39
- data/app/components/hakumi_components/modal/info/component.rb +6 -40
- data/app/components/hakumi_components/modal/status_component.rb +150 -0
- data/app/components/hakumi_components/modal/success/component.rb +6 -40
- data/app/components/hakumi_components/modal/warning/component.rb +14 -44
- data/app/components/hakumi_components/notification/component.rb +72 -38
- data/app/components/hakumi_components/pagination/component.html.erb +7 -11
- data/app/components/hakumi_components/pagination/component.rb +105 -72
- data/app/components/hakumi_components/pagination/page_item.rb +49 -0
- data/app/components/hakumi_components/popconfirm/component.rb +67 -19
- data/app/components/hakumi_components/popover/component.html.erb +2 -2
- data/app/components/hakumi_components/popover/component.rb +102 -38
- data/app/components/hakumi_components/progress/attribute_renderer.rb +354 -0
- data/app/components/hakumi_components/progress/circle_geometry.rb +76 -0
- data/app/components/hakumi_components/progress/component.html.erb +18 -17
- data/app/components/hakumi_components/progress/component.rb +230 -402
- data/app/components/hakumi_components/progress/controller_locals_parser.rb +130 -0
- data/app/components/hakumi_components/progress/info_tooltip_policy.rb +39 -0
- data/app/components/hakumi_components/progress/info_value.rb +75 -0
- data/app/components/hakumi_components/progress/status_state.rb +31 -0
- data/app/components/hakumi_components/progress/steps_renderer.rb +149 -0
- data/app/components/hakumi_components/progress/stroke_gradient_value.rb +90 -0
- data/app/components/hakumi_components/qr_code/component.rb +138 -72
- data/app/components/hakumi_components/radio/component.html.erb +3 -3
- data/app/components/hakumi_components/radio/component.rb +42 -9
- data/app/components/hakumi_components/radio/group/component.html.erb +9 -9
- data/app/components/hakumi_components/radio/group/component.rb +76 -27
- data/app/components/hakumi_components/radio/group/option.rb +43 -0
- data/app/components/hakumi_components/rate/component.html.erb +1 -1
- data/app/components/hakumi_components/rate/component.rb +55 -9
- data/app/components/hakumi_components/result/component.rb +87 -37
- data/app/components/hakumi_components/segmented/component.html.erb +1 -1
- data/app/components/hakumi_components/segmented/component.rb +81 -118
- data/app/components/hakumi_components/segmented/option.rb +191 -0
- data/app/components/hakumi_components/select/component.html.erb +19 -19
- data/app/components/hakumi_components/select/component.rb +88 -37
- data/app/components/hakumi_components/selection_control/coercion.rb +161 -0
- data/app/components/hakumi_components/selection_control/entry.rb +22 -0
- data/app/components/hakumi_components/selection_control/option.rb +42 -0
- data/app/components/hakumi_components/selection_control/option_group.rb +34 -0
- data/app/components/hakumi_components/selection_control/tree_node.rb +123 -0
- data/app/components/hakumi_components/skeleton/avatar/component.rb +36 -14
- data/app/components/hakumi_components/skeleton/avatar_config.rb +79 -0
- data/app/components/hakumi_components/skeleton/button/component.rb +32 -14
- data/app/components/hakumi_components/skeleton/component.rb +79 -93
- data/app/components/hakumi_components/skeleton/image/component.rb +46 -22
- data/app/components/hakumi_components/skeleton/input/component.rb +25 -10
- data/app/components/hakumi_components/skeleton/node/component.rb +23 -7
- data/app/components/hakumi_components/skeleton/paragraph_config.rb +92 -0
- data/app/components/hakumi_components/skeleton/title_config.rb +31 -0
- data/app/components/hakumi_components/slider/component.html.erb +11 -11
- data/app/components/hakumi_components/slider/component.rb +172 -53
- data/app/components/hakumi_components/slider/mark.rb +27 -0
- data/app/components/hakumi_components/space/compact/component.html.erb +1 -3
- data/app/components/hakumi_components/space/compact/component.rb +35 -19
- data/app/components/hakumi_components/space/component.html.erb +1 -1
- data/app/components/hakumi_components/space/component.rb +75 -39
- data/app/components/hakumi_components/spin/component.rb +92 -31
- data/app/components/hakumi_components/splitter/component.html.erb +9 -3
- data/app/components/hakumi_components/splitter/component.rb +55 -22
- data/app/components/hakumi_components/splitter/panel/component.html.erb +1 -3
- data/app/components/hakumi_components/splitter/panel/component.rb +64 -39
- data/app/components/hakumi_components/statistic/component.rb +143 -59
- data/app/components/hakumi_components/steps/component.rb +87 -55
- data/app/components/hakumi_components/steps/item/component.rb +59 -20
- data/app/components/hakumi_components/switch/component.html.erb +2 -3
- data/app/components/hakumi_components/switch/component.rb +62 -36
- data/app/components/hakumi_components/table/column/component.rb +80 -23
- data/app/components/hakumi_components/table/column_definition.rb +181 -0
- data/app/components/hakumi_components/table/column_group/component.rb +32 -21
- data/app/components/hakumi_components/table/component.html.erb +22 -31
- data/app/components/hakumi_components/table/component.rb +248 -509
- data/app/components/hakumi_components/table/concerns/attribute_helpers.rb +22 -0
- data/app/components/hakumi_components/table/concerns/cell_rendering.rb +277 -0
- data/app/components/hakumi_components/table/concerns/columns.rb +293 -91
- data/app/components/hakumi_components/table/concerns/editable.rb +36 -89
- data/app/components/hakumi_components/table/concerns/ellipsis.rb +31 -30
- data/app/components/hakumi_components/table/concerns/fixed_columns.rb +26 -19
- data/app/components/hakumi_components/table/concerns/surface_rendering.rb +365 -0
- data/app/components/hakumi_components/table/configs.rb +518 -0
- data/app/components/hakumi_components/table/definition_types.rb +40 -0
- data/app/components/hakumi_components/table/display_rows.rb +56 -0
- data/app/components/hakumi_components/table/ellipsis_config.rb +143 -0
- data/app/components/hakumi_components/table/fixed_offset.rb +36 -0
- data/app/components/hakumi_components/table/header_cell.rb +23 -0
- data/app/components/hakumi_components/table/row_record.rb +60 -0
- data/app/components/hakumi_components/table/row_render_state.rb +85 -0
- data/app/components/hakumi_components/tabs/component.html.erb +8 -8
- data/app/components/hakumi_components/tabs/component.rb +114 -64
- data/app/components/hakumi_components/tabs/indicator_config.rb +34 -0
- data/app/components/hakumi_components/tabs/item/component.rb +73 -13
- data/app/components/hakumi_components/tag/component.rb +142 -47
- data/app/components/hakumi_components/tag/group/component.rb +18 -6
- data/app/components/hakumi_components/time_picker/component.html.erb +8 -8
- data/app/components/hakumi_components/time_picker/component.rb +71 -17
- data/app/components/hakumi_components/timeline/component.html.erb +3 -2
- data/app/components/hakumi_components/timeline/component.rb +188 -55
- data/app/components/hakumi_components/timeline/item/component.html.erb +2 -2
- data/app/components/hakumi_components/timeline/item/component.rb +121 -60
- data/app/components/hakumi_components/tooltip/component.html.erb +1 -1
- data/app/components/hakumi_components/tooltip/component.rb +89 -64
- data/app/components/hakumi_components/tour/component.rb +74 -49
- data/app/components/hakumi_components/tour/step.rb +86 -0
- data/app/components/hakumi_components/transfer/coercion.rb +66 -0
- data/app/components/hakumi_components/transfer/component.html.erb +171 -140
- data/app/components/hakumi_components/transfer/component.rb +232 -82
- data/app/components/hakumi_components/transfer/item.rb +54 -0
- data/app/components/hakumi_components/transfer/operations.rb +31 -0
- data/app/components/hakumi_components/tree/component.rb +219 -400
- data/app/components/hakumi_components/tree/concerns/node_rendering.rb +365 -0
- data/app/components/hakumi_components/tree/node.rb +276 -0
- data/app/components/hakumi_components/tree_select/component.html.erb +23 -9
- data/app/components/hakumi_components/tree_select/component.rb +116 -107
- data/app/components/hakumi_components/typography/base_component.rb +69 -36
- data/app/components/hakumi_components/typography/link/component.rb +63 -6
- data/app/components/hakumi_components/typography/paragraph/component.rb +6 -0
- data/app/components/hakumi_components/typography/text/component.rb +4 -0
- data/app/components/hakumi_components/typography/title/component.rb +61 -6
- data/app/components/hakumi_components/upload/component.html.erb +106 -88
- data/app/components/hakumi_components/upload/component.rb +222 -48
- data/app/components/hakumi_components/upload/file_entry.rb +53 -0
- data/app/controllers/hakumi_components/components_controller.rb +2 -1
- data/app/form_builders/hakumi_components/form_builder/contracts.rb +55 -0
- data/app/form_builders/hakumi_components/form_builder/field_context.rb +43 -0
- data/app/form_builders/hakumi_components/form_builder/model_binding.rb +163 -0
- data/app/form_builders/hakumi_components/form_builder.rb +238 -317
- data/app/helpers/hakumi_components/form_helper.rb +27 -23
- data/app/javascript/hakumi_components/controllers/hakumi/admin_panel_controller.js +5 -7
- data/app/javascript/hakumi_components/controllers/hakumi/back_top_controller.js +1 -1
- data/app/javascript/hakumi_components/controllers/hakumi/button_controller.js +108 -2
- data/app/javascript/hakumi_components/controllers/hakumi/calendar_controller.js +183 -95
- data/app/javascript/hakumi_components/controllers/hakumi/color_picker_controller.js +23 -285
- data/app/javascript/hakumi_components/controllers/hakumi/date_picker_controller.js +274 -262
- data/app/javascript/hakumi_components/controllers/hakumi/float_button_group_controller.js +2 -2
- data/app/javascript/hakumi_components/controllers/hakumi/message_controller.js +4 -2
- data/app/javascript/hakumi_components/controllers/hakumi/modal_controller.js +119 -125
- data/app/javascript/hakumi_components/controllers/hakumi/table/editable.js +291 -0
- data/app/javascript/hakumi_components/controllers/hakumi/table_controller.js +166 -366
- data/app/javascript/hakumi_components/controllers/hakumi/tabs_controller.js +8 -2
- data/app/javascript/hakumi_components/controllers/hakumi/tag_controller.js +27 -25
- data/app/javascript/hakumi_components/controllers/hakumi/tag_group_controller.js +19 -18
- data/app/javascript/hakumi_components/controllers/hakumi/theme_controller.js +116 -117
- data/app/javascript/hakumi_components/controllers/hakumi/transfer_controller.js +17 -1
- data/app/javascript/hakumi_components/controllers/hakumi/tree_controller.js +363 -78
- data/app/javascript/hakumi_components/controllers/hakumi/typography_controller.js +3 -3
- data/app/javascript/hakumi_components/controllers/hakumi/upload_controller.js +320 -204
- data/app/javascript/hakumi_components/core/render_component.js +37 -11
- data/app/javascript/hakumi_components/utils/color_helper.js +262 -0
- data/app/javascript/stylesheets/_base.scss +9 -0
- data/app/javascript/stylesheets/_hakumi_components.scss +1 -0
- data/app/javascript/stylesheets/components/_breadcrumb.scss +2 -2
- data/app/javascript/stylesheets/components/_calendar.scss +13 -13
- data/app/javascript/stylesheets/components/_cascader.scss +5 -5
- data/app/javascript/stylesheets/components/_checkbox.scss +9 -11
- data/app/javascript/stylesheets/components/_color_picker.scss +11 -11
- data/app/javascript/stylesheets/components/_date_picker.scss +4 -4
- data/app/javascript/stylesheets/components/_descriptions.scss +2 -2
- data/app/javascript/stylesheets/components/_drawer.scss +3 -3
- data/app/javascript/stylesheets/components/_dropdown.scss +2 -2
- data/app/javascript/stylesheets/components/_flex.scss +1 -1
- data/app/javascript/stylesheets/components/_float_button.scss +5 -5
- data/app/javascript/stylesheets/components/_form_item.scss +92 -0
- data/app/javascript/stylesheets/components/_image.scss +15 -15
- data/app/javascript/stylesheets/components/_input.scss +23 -113
- data/app/javascript/stylesheets/components/_layout.scss +27 -26
- data/app/javascript/stylesheets/components/_menu.scss +15 -15
- data/app/javascript/stylesheets/components/_modal.scss +13 -13
- data/app/javascript/stylesheets/components/_notification.scss +3 -3
- data/app/javascript/stylesheets/components/_popover.scss +1 -1
- data/app/javascript/stylesheets/components/_segmented.scss +3 -3
- data/app/javascript/stylesheets/components/_select.scss +6 -6
- data/app/javascript/stylesheets/components/_slider.scss +1 -1
- data/app/javascript/stylesheets/components/_spin.scss +2 -2
- data/app/javascript/stylesheets/components/_steps.scss +10 -10
- data/app/javascript/stylesheets/components/_switch.scss +11 -10
- data/app/javascript/stylesheets/components/_table.scss +6 -6
- data/app/javascript/stylesheets/components/_tag.scss +2 -2
- data/app/javascript/stylesheets/components/_tooltip.scss +4 -4
- data/app/javascript/stylesheets/components/_tree_select.scss +3 -3
- data/app/javascript/stylesheets/components/_typography.scss +3 -3
- data/app/javascript/stylesheets/components/_upload.scss +4 -4
- data/app/services/hakumi_components/component_handler.rb +95 -24
- data/app/services/hakumi_components/icon/loader.rb +84 -67
- data/app/services/hakumi_components/illustrations/loader.rb +35 -27
- data/app/views/hakumi/_alert.html.erb +4 -1
- data/app/views/hakumi/_drawer.html.erb +1 -1
- data/app/views/hakumi/_statistic.html.erb +11 -11
- data/lib/generators/hakumi_components/install_generator.rb +14 -1
- data/lib/hakumi_components/documentation/models.rb +290 -0
- data/lib/hakumi_components/documentation/node.rb +73 -0
- data/lib/hakumi_components/documentation.rb +139 -62
- data/lib/hakumi_components/engine.rb +17 -11
- data/lib/hakumi_components/file_size_checker.rb +215 -0
- data/lib/hakumi_components/locales/en.yml +115 -0
- data/lib/hakumi_components/rails/attribute_introspection.rb +39 -107
- data/lib/hakumi_components/rails/model_reflection.rb +154 -0
- data/lib/hakumi_components/rails/validation_introspection.rb +25 -73
- data/lib/hakumi_components/rails/validation_mapper.rb +148 -201
- data/lib/hakumi_components/rails.rb +2 -0
- data/lib/hakumi_components/stylesheet_ownership_checker.rb +191 -0
- data/lib/hakumi_components/types/form_field.rb +24 -0
- data/lib/hakumi_components/types/html.rb +28 -0
- data/lib/hakumi_components/types/rendering.rb +10 -0
- data/lib/hakumi_components/types/stimulus.rb +19 -0
- data/lib/hakumi_components/types/validation.rb +22 -0
- data/lib/hakumi_components/types.rb +13 -0
- data/lib/hakumi_components/version.rb +2 -1
- data/lib/hakumi_components.rb +26 -6
- data/lib/tasks/coverage.rake +1 -0
- metadata +100 -136
- data/sig/action_view/tag_builder.rbs +0 -24
- data/sig/active_support/concern_patch.rbs +0 -7
- data/sig/generators/hakumi_components/install_generator.rbs +0 -11
- data/sig/hakumi_components/admin_panel/component.rbs +0 -28
- data/sig/hakumi_components/affix/component.rbs +0 -44
- data/sig/hakumi_components/alert/component.rbs +0 -64
- data/sig/hakumi_components/anchor/component.rbs +0 -45
- data/sig/hakumi_components/anchor/link/component.rbs +0 -31
- data/sig/hakumi_components/autocomplete/component.rbs +0 -68
- data/sig/hakumi_components/avatar/component.rbs +0 -44
- data/sig/hakumi_components/badge/component.rbs +0 -41
- data/sig/hakumi_components/base_component.rbs +0 -82
- data/sig/hakumi_components/breadcrumb/component.rbs +0 -21
- data/sig/hakumi_components/breadcrumb/item/component.rbs +0 -36
- data/sig/hakumi_components/button/component.rbs +0 -56
- data/sig/hakumi_components/calendar/component.rbs +0 -41
- data/sig/hakumi_components/card/component.rbs +0 -50
- data/sig/hakumi_components/card/grid/component.rbs +0 -21
- data/sig/hakumi_components/card/meta/component.rbs +0 -25
- data/sig/hakumi_components/carousel/component.rbs +0 -88
- data/sig/hakumi_components/cascader/component.rbs +0 -52
- data/sig/hakumi_components/checkbox/component.rbs +0 -46
- data/sig/hakumi_components/checkbox/group/component.rbs +0 -34
- data/sig/hakumi_components/collapse/component.rbs +0 -57
- data/sig/hakumi_components/collapse/panel/component.rbs +0 -47
- data/sig/hakumi_components/color_picker/component.rbs +0 -80
- data/sig/hakumi_components/concerns/form_field.rbs +0 -89
- data/sig/hakumi_components/container/component.rbs +0 -37
- data/sig/hakumi_components/date_picker/component.rbs +0 -72
- data/sig/hakumi_components/date_picker/range_picker.rbs +0 -68
- data/sig/hakumi_components/date_picker/shared_rendering.rbs +0 -41
- data/sig/hakumi_components/descriptions/component.rbs +0 -59
- data/sig/hakumi_components/descriptions/item/component.rbs +0 -31
- data/sig/hakumi_components/divider/component.rbs +0 -39
- data/sig/hakumi_components/drawer/component.rbs +0 -66
- data/sig/hakumi_components/dropdown/component.rbs +0 -45
- data/sig/hakumi_components/dropdown/divider/component.rbs +0 -11
- data/sig/hakumi_components/dropdown/item/component.rbs +0 -45
- data/sig/hakumi_components/empty/component.rbs +0 -40
- data/sig/hakumi_components/flex/component.rbs +0 -47
- data/sig/hakumi_components/float_button/back_top/component.rbs +0 -45
- data/sig/hakumi_components/float_button/component.rbs +0 -80
- data/sig/hakumi_components/float_button/group/component.rbs +0 -95
- data/sig/hakumi_components/float_button/group_cluster/component.rbs +0 -60
- data/sig/hakumi_components/form/item/component.rbs +0 -39
- data/sig/hakumi_components/form_builder.rbs +0 -37
- data/sig/hakumi_components/grid/col/component.rbs +0 -50
- data/sig/hakumi_components/grid/row/component.rbs +0 -46
- data/sig/hakumi_components/icon/component.rbs +0 -56
- data/sig/hakumi_components/image/component.rbs +0 -56
- data/sig/hakumi_components/image/preview_group/component.rbs +0 -28
- data/sig/hakumi_components/input/component.rbs +0 -71
- data/sig/hakumi_components/input/password/component.rbs +0 -27
- data/sig/hakumi_components/input/text_area/component.rbs +0 -42
- data/sig/hakumi_components/input_number/component.rbs +0 -85
- data/sig/hakumi_components/layout/component.rbs +0 -21
- data/sig/hakumi_components/layout/content/component.rbs +0 -19
- data/sig/hakumi_components/layout/footer/component.rbs +0 -19
- data/sig/hakumi_components/layout/header/component.rbs +0 -19
- data/sig/hakumi_components/layout/sider/component.rbs +0 -19
- data/sig/hakumi_components/mentions/component.rbs +0 -75
- data/sig/hakumi_components/menu/component.rbs +0 -52
- data/sig/hakumi_components/menu/divider/component.rbs +0 -11
- data/sig/hakumi_components/menu/group/component.rbs +0 -20
- data/sig/hakumi_components/menu/item/component.rbs +0 -42
- data/sig/hakumi_components/menu/sub_menu/component.rbs +0 -37
- data/sig/hakumi_components/message/component.rbs +0 -50
- data/sig/hakumi_components/modal/component.rbs +0 -76
- data/sig/hakumi_components/modal/confirm/component.rbs +0 -32
- data/sig/hakumi_components/modal/error/component.rbs +0 -27
- data/sig/hakumi_components/modal/info/component.rbs +0 -27
- data/sig/hakumi_components/modal/success/component.rbs +0 -27
- data/sig/hakumi_components/modal/warning/component.rbs +0 -27
- data/sig/hakumi_components/notification/component.rbs +0 -64
- data/sig/hakumi_components/pagination/component.rbs +0 -113
- data/sig/hakumi_components/popconfirm/component.rbs +0 -52
- data/sig/hakumi_components/popover/component.rbs +0 -66
- data/sig/hakumi_components/progress/component.rbs +0 -201
- data/sig/hakumi_components/qr_code/component.rbs +0 -111
- data/sig/hakumi_components/radio/component.rbs +0 -55
- data/sig/hakumi_components/radio/group/component.rbs +0 -71
- data/sig/hakumi_components/rails/attribute_introspection.rbs +0 -16
- data/sig/hakumi_components/rails/validation_introspection.rbs +0 -18
- data/sig/hakumi_components/rails/validation_mapper.rbs +0 -53
- data/sig/hakumi_components/rails.rbs +0 -6
- data/sig/hakumi_components/rate/component.rbs +0 -56
- data/sig/hakumi_components/result/component.rbs +0 -65
- data/sig/hakumi_components/segmented/component.rbs +0 -72
- data/sig/hakumi_components/select/component.rbs +0 -73
- data/sig/hakumi_components/skeleton/avatar/component.rbs +0 -23
- data/sig/hakumi_components/skeleton/button/component.rbs +0 -24
- data/sig/hakumi_components/skeleton/component.rbs +0 -76
- data/sig/hakumi_components/skeleton/image/component.rbs +0 -22
- data/sig/hakumi_components/skeleton/input/component.rbs +0 -23
- data/sig/hakumi_components/skeleton/node/component.rbs +0 -21
- data/sig/hakumi_components/slider/component.rbs +0 -85
- data/sig/hakumi_components/space/compact/component.rbs +0 -21
- data/sig/hakumi_components/space/component.rbs +0 -47
- data/sig/hakumi_components/spin/component.rbs +0 -77
- data/sig/hakumi_components/splitter/component.rbs +0 -27
- data/sig/hakumi_components/splitter/panel/component.rbs +0 -36
- data/sig/hakumi_components/statistic/component.rbs +0 -97
- data/sig/hakumi_components/steps/component.rbs +0 -82
- data/sig/hakumi_components/steps/item/component.rbs +0 -29
- data/sig/hakumi_components/switch/component.rbs +0 -52
- data/sig/hakumi_components/table/column/component.rbs +0 -57
- data/sig/hakumi_components/table/column_group/component.rbs +0 -20
- data/sig/hakumi_components/table/component.rbs +0 -279
- data/sig/hakumi_components/table/concerns/columns.rbs +0 -95
- data/sig/hakumi_components/table/concerns/editable.rbs +0 -40
- data/sig/hakumi_components/table/concerns/ellipsis.rbs +0 -27
- data/sig/hakumi_components/table/concerns/fixed_columns.rbs +0 -33
- data/sig/hakumi_components/tabs/component.rbs +0 -66
- data/sig/hakumi_components/tabs/item/component.rbs +0 -29
- data/sig/hakumi_components/tag/component.rbs +0 -86
- data/sig/hakumi_components/tag/group/component.rbs +0 -24
- data/sig/hakumi_components/time_picker/component.rbs +0 -72
- data/sig/hakumi_components/timeline/component.rbs +0 -61
- data/sig/hakumi_components/timeline/item/component.rbs +0 -70
- data/sig/hakumi_components/tooltip/component.rbs +0 -73
- data/sig/hakumi_components/tour/component.rbs +0 -84
- data/sig/hakumi_components/transfer/component.rbs +0 -75
- data/sig/hakumi_components/tree/component.rbs +0 -126
- data/sig/hakumi_components/tree_select/component.rbs +0 -122
- data/sig/hakumi_components/typography/base_component.rbs +0 -57
- data/sig/hakumi_components/typography/link/component.rbs +0 -28
- data/sig/hakumi_components/typography/paragraph/component.rbs +0 -13
- data/sig/hakumi_components/typography/text/component.rbs +0 -10
- data/sig/hakumi_components/typography/title/component.rbs +0 -28
- data/sig/hakumi_components/upload/component.rbs +0 -78
- data/sig/hakumi_components.rbs +0 -96
- data/sig/rails/active_model/validations/comparison_validator.rbs +0 -6
- data/sig/rails.rbs +0 -18
- data/sig/view_component/base.rbs +0 -28
data/README.md
CHANGED
|
@@ -1,130 +1,100 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
·
|
|
14
|
+
<a href="https://components.hakumi.dev">Playground</a>
|
|
15
|
+
·
|
|
16
|
+
<a href="https://github.com/hakumi-dev/hakumi-components/issues">Report Bug</a>
|
|
17
|
+
·
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
+
---
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
## About
|
|
38
45
|
|
|
39
|
-
|
|
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
|
-
|
|
48
|
+
Stack: ViewComponent 3.0+, Stimulus 3.0+, Rails 7.1+, SCSS.
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
---
|
|
48
51
|
|
|
49
|
-
|
|
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
|
-
|
|
57
|
-
- Vite (via `vite_rails` gem)
|
|
58
|
-
- Yarn or npm for package management
|
|
54
|
+
### Requirements
|
|
59
55
|
|
|
60
|
-
|
|
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
|
-
|
|
62
|
+
### Automatic (recommended)
|
|
63
63
|
|
|
64
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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.
|
|
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.
|
|
106
|
+
**4. Stylesheets:**
|
|
137
107
|
|
|
138
108
|
```scss
|
|
139
|
-
//
|
|
140
|
-
// app/javascript/stylesheets/application.scss
|
|
109
|
+
// Vite / Webpack
|
|
141
110
|
@use '@hakumi-dev/hakumi-components/styles';
|
|
142
111
|
|
|
143
|
-
//
|
|
144
|
-
// app/assets/stylesheets/application.scss
|
|
112
|
+
// Sprockets
|
|
145
113
|
@import "@hakumi-dev/hakumi-components/styles";
|
|
146
114
|
```
|
|
147
115
|
|
|
148
|
-
|
|
116
|
+
---
|
|
149
117
|
|
|
150
|
-
|
|
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
|
|
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` |
|
|
165
|
-
| `base_path` | `"hakumi/components"` | Base URL path for
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
195
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
- [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- [
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
- [
|
|
219
|
-
- [
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
- [
|
|
223
|
-
- [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
- [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
- [
|
|
231
|
-
- [
|
|
232
|
-
- [
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
- [
|
|
237
|
-
- [
|
|
238
|
-
- [
|
|
239
|
-
- [
|
|
240
|
-
- [
|
|
241
|
-
- [
|
|
242
|
-
- [
|
|
243
|
-
- [
|
|
244
|
-
- [
|
|
245
|
-
- [
|
|
246
|
-
- [
|
|
247
|
-
- [
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
- [
|
|
251
|
-
- [
|
|
252
|
-
- [
|
|
253
|
-
- [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
- [
|
|
258
|
-
- [
|
|
259
|
-
- [
|
|
260
|
-
- [
|
|
261
|
-
- [
|
|
262
|
-
- [
|
|
263
|
-
- [
|
|
264
|
-
- [
|
|
265
|
-
- [
|
|
266
|
-
- [
|
|
267
|
-
- [
|
|
268
|
-
- [
|
|
269
|
-
- [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
- [
|
|
273
|
-
- [
|
|
274
|
-
- [
|
|
275
|
-
- [
|
|
276
|
-
- [
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
- [
|
|
281
|
-
- [
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
- [
|
|
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
|
-
|
|
249
|
+
Interactive components expose a programmatic API:
|
|
289
250
|
|
|
290
251
|
```javascript
|
|
291
|
-
//
|
|
292
|
-
|
|
293
|
-
modal.hakumiComponent.api.
|
|
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
|
-
//
|
|
256
|
+
// Via global registry
|
|
297
257
|
window.HakumiComponents.get('my-modal').open()
|
|
298
258
|
```
|
|
299
259
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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
|
-
|
|
266
|
+
---
|
|
393
267
|
|
|
394
|
-
|
|
268
|
+
## Architecture
|
|
395
269
|
|
|
396
|
-
|
|
397
|
-
# Update Ruby gem
|
|
398
|
-
bundle update hakumi_components
|
|
270
|
+
Each component follows a three-layer pattern:
|
|
399
271
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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
|
-
|
|
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
|
-
|
|
278
|
+
---
|
|
411
279
|
|
|
412
280
|
## Development
|
|
413
281
|
|
|
414
|
-
###
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
296
|
+
It appears automatically at `/test/[component]/[example_name]`.
|
|
443
297
|
|
|
444
|
-
###
|
|
298
|
+
### Tests
|
|
445
299
|
|
|
446
300
|
```bash
|
|
447
|
-
#
|
|
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
|
-
|
|
451
|
-
bundle exec rake test TEST=test/components/hakumi/button/component_test.rb
|
|
306
|
+
### Versioning
|
|
452
307
|
|
|
453
|
-
|
|
454
|
-
bundle exec rake test:system
|
|
455
|
-
```
|
|
308
|
+
Gem and npm versions must be kept in sync:
|
|
456
309
|
|
|
457
|
-
|
|
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
|
-
|
|
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
|
-
|
|
319
|
+
Use `>= 0.1.0.pre` / `@pre` to always track the latest pre-release.
|
|
486
320
|
|
|
487
|
-
|
|
321
|
+
---
|
|
488
322
|
|
|
489
|
-
##
|
|
323
|
+
## Contributing
|
|
490
324
|
|
|
491
|
-
|
|
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
|
-
|
|
332
|
+
---
|
|
494
333
|
|
|
495
|
-
|
|
496
|
-
- Built with [ViewComponent](https://viewcomponent.org/)
|
|
497
|
-
- Powered by [Stimulus](https://stimulus.hotwired.dev/)
|
|
334
|
+
## License
|
|
498
335
|
|
|
499
|
-
|
|
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).
|