hakumi_components 0.1.17.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 +33 -3
- data/README.md +218 -369
- data/app/assets/javascripts/hakumi_components.js +40 -34
- data/app/assets/stylesheets/hakumi_components.css +1 -1
- data/app/components/{hakumi → hakumi_components}/admin_panel/component.html.erb +2 -2
- data/app/components/hakumi_components/admin_panel/component.rb +50 -0
- data/app/components/hakumi_components/affix/component.rb +112 -0
- data/app/components/{hakumi → hakumi_components}/alert/component.html.erb +3 -3
- data/app/components/hakumi_components/alert/component.rb +134 -0
- data/app/components/hakumi_components/anchor/component.rb +88 -0
- data/app/components/{hakumi → hakumi_components}/anchor/link/component.html.erb +1 -1
- data/app/components/hakumi_components/anchor/link/component.rb +53 -0
- data/app/components/hakumi_components/autocomplete/component.html.erb +94 -0
- data/app/components/hakumi_components/autocomplete/component.rb +228 -0
- data/app/components/hakumi_components/avatar/component.rb +124 -0
- data/app/components/hakumi_components/badge/component.rb +139 -0
- data/app/components/hakumi_components/base_component.rb +391 -0
- data/app/components/hakumi_components/breadcrumb/component.rb +38 -0
- data/app/components/hakumi_components/breadcrumb/item/component.html.erb +17 -0
- data/app/components/hakumi_components/breadcrumb/item/component.rb +83 -0
- data/app/components/hakumi_components/breadcrumb/item/menu_entry.rb +71 -0
- data/app/components/hakumi_components/button/component.rb +163 -0
- data/app/components/{hakumi → hakumi_components}/calendar/component.html.erb +24 -24
- data/app/components/hakumi_components/calendar/component.rb +471 -0
- 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 → hakumi_components}/card/component.html.erb +2 -2
- data/app/components/hakumi_components/card/component.rb +121 -0
- data/app/components/hakumi_components/card/grid/component.html.erb +3 -0
- data/app/components/hakumi_components/card/grid/component.rb +43 -0
- data/app/components/hakumi_components/card/meta/component.html.erb +23 -0
- data/app/components/hakumi_components/card/meta/component.rb +64 -0
- data/app/components/hakumi_components/carousel/autoplay_config.rb +27 -0
- data/app/components/{hakumi → hakumi_components}/carousel/component.html.erb +2 -2
- data/app/components/hakumi_components/carousel/component.rb +165 -0
- data/app/components/hakumi_components/carousel/dots_config.rb +36 -0
- data/app/components/hakumi_components/cascader/component.html.erb +59 -0
- data/app/components/hakumi_components/cascader/component.rb +168 -0
- data/app/components/{hakumi → hakumi_components}/checkbox/component.html.erb +5 -5
- data/app/components/hakumi_components/checkbox/component.rb +98 -0
- data/app/components/hakumi_components/checkbox/group/component.html.erb +12 -0
- data/app/components/hakumi_components/checkbox/group/component.rb +91 -0
- data/app/components/hakumi_components/checkbox/group/option.rb +34 -0
- data/app/components/{hakumi → hakumi_components}/collapse/component.html.erb +1 -1
- data/app/components/hakumi_components/collapse/component.rb +133 -0
- data/app/components/hakumi_components/collapse/panel/component.rb +108 -0
- data/app/components/{hakumi → hakumi_components}/color_picker/component.html.erb +21 -22
- data/app/components/hakumi_components/color_picker/component.rb +279 -0
- data/app/components/hakumi_components/color_picker/preset_group.rb +27 -0
- data/app/components/hakumi_components/concerns/form_field.rb +236 -0
- 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 → hakumi_components}/container/component.rb +31 -16
- data/app/components/{hakumi → hakumi_components}/date_picker/component.html.erb +4 -6
- data/app/components/hakumi_components/date_picker/component.rb +254 -0
- data/app/components/{hakumi → hakumi_components}/date_picker/range_picker.html.erb +4 -4
- data/app/components/hakumi_components/date_picker/range_picker.rb +267 -0
- data/app/components/hakumi_components/date_picker/shared_rendering.rb +289 -0
- data/app/components/{hakumi → hakumi_components}/descriptions/component.html.erb +6 -6
- data/app/components/hakumi_components/descriptions/component.rb +219 -0
- data/app/components/hakumi_components/descriptions/item/component.rb +52 -0
- data/app/components/hakumi_components/divider/component.rb +86 -0
- data/app/components/{hakumi → hakumi_components}/drawer/component.html.erb +3 -3
- data/app/components/hakumi_components/drawer/component.rb +191 -0
- data/app/components/hakumi_components/dropdown/component.rb +94 -0
- data/app/components/{hakumi → hakumi_components}/dropdown/divider/component.rb +6 -2
- data/app/components/hakumi_components/dropdown/item/component.rb +73 -0
- data/app/components/{hakumi → hakumi_components}/empty/component.rb +68 -33
- data/app/components/hakumi_components/flex/component.rb +96 -0
- data/app/components/hakumi_components/float_button/back_top/component.rb +86 -0
- data/app/components/hakumi_components/float_button/component.rb +289 -0
- data/app/components/hakumi_components/float_button/group/component.rb +214 -0
- data/app/components/hakumi_components/float_button/group_cluster/component.rb +133 -0
- 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 → hakumi_components}/form/item/component.rb +36 -29
- data/app/components/hakumi_components/grid/col/component.rb +169 -0
- data/app/components/hakumi_components/grid/row/component.rb +97 -0
- data/app/components/{hakumi → hakumi_components}/icon/component.rb +53 -53
- data/app/components/{hakumi → hakumi_components}/image/component.html.erb +17 -17
- data/app/components/hakumi_components/image/component.rb +175 -0
- data/app/components/{hakumi → hakumi_components}/image/preview_group/component.html.erb +10 -10
- data/app/components/hakumi_components/image/preview_group/component.rb +75 -0
- data/app/components/hakumi_components/image/preview_group/item.rb +48 -0
- data/app/components/{hakumi → hakumi_components}/input/component.html.erb +1 -1
- data/app/components/hakumi_components/input/component.rb +261 -0
- data/app/components/hakumi_components/input/password/component.rb +84 -0
- data/app/components/{hakumi → hakumi_components}/input/text_area/component.html.erb +2 -2
- data/app/components/hakumi_components/input/text_area/component.rb +178 -0
- data/app/components/{hakumi → hakumi_components}/input_number/component.html.erb +9 -9
- data/app/components/hakumi_components/input_number/component.rb +280 -0
- data/app/components/hakumi_components/layout/component.html.erb +1 -0
- data/app/components/hakumi_components/layout/component.rb +28 -0
- data/app/components/hakumi_components/layout/content/component.html.erb +1 -0
- data/app/components/hakumi_components/layout/content/component.rb +29 -0
- data/app/components/hakumi_components/layout/footer/component.html.erb +1 -0
- data/app/components/hakumi_components/layout/footer/component.rb +29 -0
- data/app/components/hakumi_components/layout/header/component.html.erb +1 -0
- data/app/components/hakumi_components/layout/header/component.rb +29 -0
- data/app/components/hakumi_components/layout/sider/component.html.erb +1 -0
- data/app/components/hakumi_components/layout/sider/component.rb +90 -0
- data/app/components/hakumi_components/mentions/coercion.rb +46 -0
- data/app/components/{hakumi → hakumi_components}/mentions/component.html.erb +6 -6
- data/app/components/hakumi_components/mentions/component.rb +229 -0
- data/app/components/hakumi_components/mentions/option.rb +30 -0
- data/app/components/hakumi_components/menu/component.rb +117 -0
- data/app/components/{hakumi → hakumi_components}/menu/divider/component.rb +6 -2
- data/app/components/hakumi_components/menu/group/component.rb +48 -0
- data/app/components/hakumi_components/menu/item/component.rb +70 -0
- data/app/components/hakumi_components/menu/sub_menu/component.rb +104 -0
- data/app/components/hakumi_components/message/component.rb +141 -0
- data/app/components/{hakumi → hakumi_components}/modal/component.html.erb +7 -7
- data/app/components/hakumi_components/modal/component.rb +152 -0
- data/app/components/hakumi_components/modal/confirm/component.html.erb +23 -0
- data/app/components/hakumi_components/modal/confirm/component.rb +87 -0
- data/app/components/hakumi_components/modal/error/component.rb +20 -0
- data/app/components/hakumi_components/modal/info/component.rb +17 -0
- data/app/components/hakumi_components/modal/status_component.rb +150 -0
- data/app/components/hakumi_components/modal/success/component.rb +17 -0
- data/app/components/hakumi_components/modal/warning/component.rb +26 -0
- data/app/components/hakumi_components/notification/component.rb +160 -0
- data/app/components/{hakumi → hakumi_components}/pagination/component.html.erb +8 -12
- data/app/components/hakumi_components/pagination/component.rb +238 -0
- data/app/components/hakumi_components/pagination/page_item.rb +49 -0
- data/app/components/{hakumi → hakumi_components}/popconfirm/component.html.erb +2 -2
- data/app/components/hakumi_components/popconfirm/component.rb +120 -0
- data/app/components/{hakumi → hakumi_components}/popover/component.html.erb +2 -2
- data/app/components/hakumi_components/popover/component.rb +196 -0
- 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 → hakumi_components}/progress/component.html.erb +19 -18
- data/app/components/hakumi_components/progress/component.rb +393 -0
- 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 +405 -0
- data/app/components/{hakumi → hakumi_components}/radio/component.html.erb +3 -3
- data/app/components/hakumi_components/radio/component.rb +113 -0
- data/app/components/{hakumi → hakumi_components}/radio/group/component.html.erb +10 -10
- data/app/components/hakumi_components/radio/group/component.rb +181 -0
- data/app/components/hakumi_components/radio/group/option.rb +43 -0
- data/app/components/{hakumi → hakumi_components}/rate/component.html.erb +2 -2
- data/app/components/{hakumi → hakumi_components}/rate/component.rb +58 -12
- data/app/components/hakumi_components/result/component.rb +175 -0
- data/app/components/{hakumi → hakumi_components}/segmented/component.html.erb +1 -1
- data/app/components/hakumi_components/segmented/component.rb +232 -0
- data/app/components/hakumi_components/segmented/option.rb +191 -0
- data/app/components/{hakumi → hakumi_components}/select/component.html.erb +22 -22
- data/app/components/hakumi_components/select/component.rb +176 -0
- 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 +88 -0
- data/app/components/hakumi_components/skeleton/avatar_config.rb +79 -0
- data/app/components/hakumi_components/skeleton/button/component.rb +77 -0
- data/app/components/hakumi_components/skeleton/component.rb +186 -0
- data/app/components/{hakumi → hakumi_components}/skeleton/image/component.html.erb +1 -1
- data/app/components/hakumi_components/skeleton/image/component.rb +104 -0
- data/app/components/hakumi_components/skeleton/input/component.rb +66 -0
- data/app/components/hakumi_components/skeleton/node/component.rb +59 -0
- 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 → hakumi_components}/slider/component.html.erb +11 -11
- data/app/components/hakumi_components/slider/component.rb +347 -0
- data/app/components/hakumi_components/slider/mark.rb +27 -0
- data/app/components/hakumi_components/space/compact/component.html.erb +1 -0
- data/app/components/hakumi_components/space/compact/component.rb +52 -0
- data/app/components/{hakumi → hakumi_components}/space/component.html.erb +1 -1
- data/app/components/hakumi_components/space/component.rb +109 -0
- data/app/components/hakumi_components/spin/component.rb +270 -0
- data/app/components/hakumi_components/splitter/component.html.erb +9 -0
- data/app/components/hakumi_components/splitter/component.rb +71 -0
- data/app/components/hakumi_components/splitter/panel/component.html.erb +1 -0
- data/app/components/hakumi_components/splitter/panel/component.rb +98 -0
- data/app/components/hakumi_components/statistic/component.rb +371 -0
- data/app/components/{hakumi → hakumi_components}/steps/component.html.erb +4 -4
- data/app/components/hakumi_components/steps/component.rb +177 -0
- data/app/components/hakumi_components/steps/item/component.rb +130 -0
- data/app/components/{hakumi → hakumi_components}/switch/component.html.erb +2 -3
- data/app/components/hakumi_components/switch/component.rb +150 -0
- data/app/components/hakumi_components/table/column/component.rb +137 -0
- data/app/components/hakumi_components/table/column_definition.rb +181 -0
- data/app/components/{hakumi → hakumi_components}/table/column_group/component.rb +35 -24
- data/app/components/{hakumi → hakumi_components}/table/component.html.erb +22 -31
- data/app/components/hakumi_components/table/component.rb +470 -0
- 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 +421 -0
- data/app/components/hakumi_components/table/concerns/editable.rb +68 -0
- data/app/components/hakumi_components/table/concerns/ellipsis.rb +64 -0
- data/app/components/hakumi_components/table/concerns/fixed_columns.rb +94 -0
- 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 → hakumi_components}/tabs/component.html.erb +11 -11
- data/app/components/hakumi_components/tabs/component.rb +246 -0
- data/app/components/hakumi_components/tabs/indicator_config.rb +34 -0
- data/app/components/hakumi_components/tabs/item/component.rb +147 -0
- data/app/components/hakumi_components/tag/component.rb +282 -0
- data/app/components/{hakumi → hakumi_components}/tag/group/component.rb +20 -8
- data/app/components/{hakumi → hakumi_components}/time_picker/component.html.erb +10 -10
- data/app/components/{hakumi → hakumi_components}/time_picker/component.rb +75 -21
- data/app/components/hakumi_components/timeline/component.html.erb +8 -0
- data/app/components/hakumi_components/timeline/component.rb +301 -0
- data/app/components/{hakumi → hakumi_components}/timeline/item/component.html.erb +2 -2
- data/app/components/hakumi_components/timeline/item/component.rb +198 -0
- data/app/components/{hakumi → hakumi_components}/tooltip/component.html.erb +1 -1
- data/app/components/hakumi_components/tooltip/component.rb +146 -0
- data/app/components/hakumi_components/tour/component.rb +183 -0
- 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 +204 -0
- data/app/components/hakumi_components/transfer/component.rb +395 -0
- data/app/components/hakumi_components/transfer/item.rb +54 -0
- data/app/components/hakumi_components/transfer/operations.rb +31 -0
- data/app/components/{hakumi → hakumi_components}/tree/component.html.erb +1 -1
- data/app/components/hakumi_components/tree/component.rb +342 -0
- 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 → hakumi_components}/tree_select/component.html.erb +27 -13
- data/app/components/hakumi_components/tree_select/component.rb +270 -0
- data/app/components/hakumi_components/typography/base_component.rb +142 -0
- data/app/components/hakumi_components/typography/link/component.rb +91 -0
- data/app/components/{hakumi → hakumi_components}/typography/paragraph/component.rb +7 -1
- data/{sig/hakumi/typography/text/component.rbs → app/components/hakumi_components/typography/text/component.rb} +3 -1
- data/app/components/hakumi_components/typography/title/component.rb +84 -0
- data/app/components/hakumi_components/upload/component.html.erb +135 -0
- data/app/components/hakumi_components/upload/component.rb +367 -0
- data/app/components/hakumi_components/upload/file_entry.rb +53 -0
- data/app/controllers/{hakumi → hakumi_components}/components_controller.rb +3 -2
- 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 +403 -0
- data/app/helpers/hakumi_components/form_helper.rb +43 -0
- 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 +124 -0
- data/app/services/hakumi_components/icon/loader.rb +112 -0
- data/app/services/hakumi_components/illustrations/loader.rb +51 -0
- data/app/views/hakumi/_admin_panel.html.erb +1 -1
- data/app/views/hakumi/_affix.html.erb +1 -1
- data/app/views/hakumi/_alert.html.erb +4 -1
- data/app/views/hakumi/_confirm.html.erb +1 -1
- data/app/views/hakumi/_drawer.html.erb +2 -2
- data/app/views/hakumi/_message.html.erb +1 -1
- data/app/views/hakumi/_modal.html.erb +1 -1
- data/app/views/hakumi/_notification.html.erb +1 -1
- data/app/views/hakumi/_popconfirm.html.erb +1 -1
- data/app/views/hakumi/_popover.html.erb +1 -1
- data/app/views/hakumi/_qr_code.html.erb +1 -1
- data/app/views/hakumi/_result.html.erb +1 -1
- data/app/views/hakumi/_segmented.html.erb +1 -1
- data/app/views/hakumi/_skeleton.html.erb +1 -1
- data/app/views/hakumi/_spin.html.erb +1 -1
- data/app/views/hakumi/_statistic.html.erb +12 -12
- data/app/views/hakumi/_table.html.erb +1 -1
- data/app/views/hakumi/_tag.html.erb +1 -1
- data/app/views/hakumi/_timeline.html.erb +1 -1
- data/app/views/hakumi/_tree.html.erb +1 -1
- data/lib/generators/{hakumi → hakumi_components}/install_generator.rb +17 -4
- data/lib/hakumi_components/documentation/models.rb +290 -0
- data/lib/hakumi_components/documentation/node.rb +73 -0
- data/lib/hakumi_components/documentation.rb +141 -64
- data/lib/hakumi_components/engine.rb +26 -14
- 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 +40 -108
- data/lib/hakumi_components/rails/model_reflection.rb +154 -0
- data/lib/hakumi_components/rails/validation_introspection.rb +26 -74
- data/lib/hakumi_components/rails/validation_mapper.rb +149 -202
- data/lib/hakumi_components/rails.rb +3 -1
- 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 +3 -2
- data/lib/hakumi_components.rb +26 -5
- data/lib/tasks/coverage.rake +1 -0
- metadata +310 -346
- data/app/components/hakumi/admin_panel/component.rb +0 -40
- data/app/components/hakumi/affix/component.rb +0 -88
- data/app/components/hakumi/alert/component.rb +0 -84
- data/app/components/hakumi/anchor/component.rb +0 -80
- data/app/components/hakumi/anchor/link/component.rb +0 -34
- data/app/components/hakumi/autocomplete/component.html.erb +0 -74
- data/app/components/hakumi/autocomplete/component.rb +0 -202
- data/app/components/hakumi/avatar/component.rb +0 -91
- data/app/components/hakumi/badge/component.rb +0 -85
- data/app/components/hakumi/base_component.rb +0 -192
- data/app/components/hakumi/breadcrumb/component.rb +0 -27
- data/app/components/hakumi/breadcrumb/item/component.html.erb +0 -17
- data/app/components/hakumi/breadcrumb/item/component.rb +0 -35
- data/app/components/hakumi/button/component.rb +0 -121
- data/app/components/hakumi/calendar/component.rb +0 -448
- data/app/components/hakumi/card/component.rb +0 -94
- data/app/components/hakumi/card/grid/component.html.erb +0 -3
- data/app/components/hakumi/card/grid/component.rb +0 -37
- data/app/components/hakumi/card/meta/component.html.erb +0 -23
- data/app/components/hakumi/card/meta/component.rb +0 -46
- data/app/components/hakumi/carousel/component.rb +0 -147
- data/app/components/hakumi/cascader/component.html.erb +0 -41
- data/app/components/hakumi/cascader/component.rb +0 -119
- data/app/components/hakumi/checkbox/component.rb +0 -64
- data/app/components/hakumi/checkbox/group/component.html.erb +0 -12
- data/app/components/hakumi/checkbox/group/component.rb +0 -64
- data/app/components/hakumi/collapse/component.rb +0 -117
- data/app/components/hakumi/collapse/panel/component.rb +0 -65
- data/app/components/hakumi/color_picker/component.rb +0 -169
- data/app/components/hakumi/concerns/form_field.rb +0 -135
- data/app/components/hakumi/date_picker/component.rb +0 -140
- data/app/components/hakumi/date_picker/range_picker.rb +0 -136
- data/app/components/hakumi/date_picker/shared_rendering.rb +0 -199
- data/app/components/hakumi/descriptions/component.rb +0 -182
- data/app/components/hakumi/descriptions/item/component.rb +0 -28
- data/app/components/hakumi/divider/component.rb +0 -66
- data/app/components/hakumi/drawer/component.rb +0 -108
- data/app/components/hakumi/dropdown/component.rb +0 -97
- data/app/components/hakumi/dropdown/item/component.rb +0 -47
- data/app/components/hakumi/flex/component.rb +0 -78
- data/app/components/hakumi/float_button/back_top/component.rb +0 -79
- data/app/components/hakumi/float_button/component.rb +0 -203
- data/app/components/hakumi/float_button/group/component.rb +0 -227
- data/app/components/hakumi/float_button/group_cluster/component.rb +0 -141
- data/app/components/hakumi/grid/col/component.rb +0 -98
- data/app/components/hakumi/grid/row/component.rb +0 -79
- data/app/components/hakumi/image/component.rb +0 -112
- data/app/components/hakumi/image/preview_group/component.rb +0 -70
- data/app/components/hakumi/input/component.rb +0 -185
- data/app/components/hakumi/input/password/component.rb +0 -95
- data/app/components/hakumi/input/text_area/component.rb +0 -131
- data/app/components/hakumi/input_number/component.rb +0 -198
- data/app/components/hakumi/layout/component.html.erb +0 -1
- data/app/components/hakumi/layout/component.rb +0 -21
- data/app/components/hakumi/layout/content/component.html.erb +0 -1
- data/app/components/hakumi/layout/content/component.rb +0 -19
- data/app/components/hakumi/layout/footer/component.html.erb +0 -1
- data/app/components/hakumi/layout/footer/component.rb +0 -19
- data/app/components/hakumi/layout/header/component.html.erb +0 -1
- data/app/components/hakumi/layout/header/component.rb +0 -19
- data/app/components/hakumi/layout/sider/component.html.erb +0 -1
- data/app/components/hakumi/layout/sider/component.rb +0 -56
- data/app/components/hakumi/mentions/component.rb +0 -165
- data/app/components/hakumi/menu/component.rb +0 -126
- data/app/components/hakumi/menu/group/component.rb +0 -47
- data/app/components/hakumi/menu/item/component.rb +0 -47
- data/app/components/hakumi/menu/sub_menu/component.rb +0 -92
- data/app/components/hakumi/message/component.rb +0 -106
- data/app/components/hakumi/modal/component.rb +0 -99
- data/app/components/hakumi/modal/confirm/component.html.erb +0 -23
- data/app/components/hakumi/modal/confirm/component.rb +0 -46
- data/app/components/hakumi/modal/error/component.rb +0 -51
- data/app/components/hakumi/modal/info/component.rb +0 -51
- data/app/components/hakumi/modal/success/component.rb +0 -51
- data/app/components/hakumi/modal/warning/component.rb +0 -56
- data/app/components/hakumi/notification/component.rb +0 -126
- data/app/components/hakumi/pagination/component.rb +0 -205
- data/app/components/hakumi/popconfirm/component.rb +0 -72
- data/app/components/hakumi/popover/component.rb +0 -132
- data/app/components/hakumi/progress/component.rb +0 -565
- data/app/components/hakumi/qr_code/component.rb +0 -339
- data/app/components/hakumi/radio/component.rb +0 -80
- data/app/components/hakumi/radio/group/component.rb +0 -132
- data/app/components/hakumi/result/component.rb +0 -125
- data/app/components/hakumi/segmented/component.rb +0 -269
- data/app/components/hakumi/select/component.rb +0 -125
- data/app/components/hakumi/skeleton/avatar/component.rb +0 -66
- data/app/components/hakumi/skeleton/button/component.rb +0 -59
- data/app/components/hakumi/skeleton/component.rb +0 -200
- data/app/components/hakumi/skeleton/image/component.rb +0 -80
- data/app/components/hakumi/skeleton/input/component.rb +0 -51
- data/app/components/hakumi/skeleton/node/component.rb +0 -43
- data/app/components/hakumi/slider/component.rb +0 -228
- data/app/components/hakumi/space/compact/component.html.erb +0 -3
- data/app/components/hakumi/space/compact/component.rb +0 -36
- data/app/components/hakumi/space/component.rb +0 -73
- data/app/components/hakumi/spin/component.rb +0 -209
- data/app/components/hakumi/splitter/component.html.erb +0 -3
- data/app/components/hakumi/splitter/component.rb +0 -38
- data/app/components/hakumi/splitter/panel/component.html.erb +0 -3
- data/app/components/hakumi/splitter/panel/component.rb +0 -73
- data/app/components/hakumi/statistic/component.rb +0 -287
- data/app/components/hakumi/steps/component.rb +0 -145
- data/app/components/hakumi/steps/item/component.rb +0 -91
- data/app/components/hakumi/switch/component.rb +0 -124
- data/app/components/hakumi/table/column/component.rb +0 -80
- data/app/components/hakumi/table/component.rb +0 -731
- data/app/components/hakumi/table/concerns/columns.rb +0 -219
- data/app/components/hakumi/table/concerns/editable.rb +0 -121
- data/app/components/hakumi/table/concerns/ellipsis.rb +0 -63
- data/app/components/hakumi/table/concerns/fixed_columns.rb +0 -87
- data/app/components/hakumi/tabs/component.rb +0 -196
- data/app/components/hakumi/tabs/item/component.rb +0 -87
- data/app/components/hakumi/tag/component.rb +0 -187
- data/app/components/hakumi/timeline/component.html.erb +0 -7
- data/app/components/hakumi/timeline/component.rb +0 -168
- data/app/components/hakumi/timeline/item/component.rb +0 -137
- data/app/components/hakumi/tooltip/component.rb +0 -121
- data/app/components/hakumi/tour/component.rb +0 -158
- data/app/components/hakumi/transfer/component.html.erb +0 -173
- data/app/components/hakumi/transfer/component.rb +0 -245
- data/app/components/hakumi/tree/component.rb +0 -523
- data/app/components/hakumi/tree_select/component.rb +0 -261
- data/app/components/hakumi/typography/base_component.rb +0 -109
- data/app/components/hakumi/typography/link/component.rb +0 -34
- data/app/components/hakumi/typography/text/component.rb +0 -8
- data/app/components/hakumi/typography/title/component.rb +0 -29
- data/app/components/hakumi/upload/component.html.erb +0 -117
- data/app/components/hakumi/upload/component.rb +0 -193
- data/app/form_builders/hakumi/form_builder.rb +0 -482
- data/app/helpers/hakumi/form_helper.rb +0 -39
- data/app/services/hakumi/component_handler.rb +0 -53
- data/app/services/hakumi/icon/loader.rb +0 -95
- data/app/services/hakumi/illustrations/loader.rb +0 -43
- data/sig/action_view/tag_builder.rbs +0 -24
- data/sig/active_support/concern_patch.rbs +0 -7
- data/sig/generators/hakumi/install_generator.rbs +0 -11
- data/sig/hakumi/admin_panel/component.rbs +0 -28
- data/sig/hakumi/affix/component.rbs +0 -44
- data/sig/hakumi/alert/component.rbs +0 -64
- data/sig/hakumi/anchor/component.rbs +0 -45
- data/sig/hakumi/anchor/link/component.rbs +0 -31
- data/sig/hakumi/autocomplete/component.rbs +0 -68
- data/sig/hakumi/avatar/component.rbs +0 -44
- data/sig/hakumi/badge/component.rbs +0 -41
- data/sig/hakumi/base_component.rbs +0 -82
- data/sig/hakumi/breadcrumb/component.rbs +0 -21
- data/sig/hakumi/breadcrumb/item/component.rbs +0 -36
- data/sig/hakumi/button/component.rbs +0 -56
- data/sig/hakumi/calendar/component.rbs +0 -41
- data/sig/hakumi/card/component.rbs +0 -50
- data/sig/hakumi/card/grid/component.rbs +0 -21
- data/sig/hakumi/card/meta/component.rbs +0 -25
- data/sig/hakumi/carousel/component.rbs +0 -88
- data/sig/hakumi/cascader/component.rbs +0 -52
- data/sig/hakumi/checkbox/component.rbs +0 -46
- data/sig/hakumi/checkbox/group/component.rbs +0 -34
- data/sig/hakumi/collapse/component.rbs +0 -57
- data/sig/hakumi/collapse/panel/component.rbs +0 -47
- data/sig/hakumi/color_picker/component.rbs +0 -80
- data/sig/hakumi/concerns/form_field.rbs +0 -89
- data/sig/hakumi/container/component.rbs +0 -37
- data/sig/hakumi/date_picker/component.rbs +0 -72
- data/sig/hakumi/date_picker/range_picker.rbs +0 -68
- data/sig/hakumi/date_picker/shared_rendering.rbs +0 -41
- data/sig/hakumi/descriptions/component.rbs +0 -59
- data/sig/hakumi/descriptions/item/component.rbs +0 -31
- data/sig/hakumi/divider/component.rbs +0 -39
- data/sig/hakumi/drawer/component.rbs +0 -66
- data/sig/hakumi/dropdown/component.rbs +0 -45
- data/sig/hakumi/dropdown/divider/component.rbs +0 -11
- data/sig/hakumi/dropdown/item/component.rbs +0 -45
- data/sig/hakumi/empty/component.rbs +0 -40
- data/sig/hakumi/flex/component.rbs +0 -47
- data/sig/hakumi/float_button/back_top/component.rbs +0 -45
- data/sig/hakumi/float_button/component.rbs +0 -80
- data/sig/hakumi/float_button/group/component.rbs +0 -95
- data/sig/hakumi/float_button/group_cluster/component.rbs +0 -60
- data/sig/hakumi/form/item/component.rbs +0 -39
- data/sig/hakumi/form_builder.rbs +0 -37
- data/sig/hakumi/grid/col/component.rbs +0 -50
- data/sig/hakumi/grid/row/component.rbs +0 -46
- data/sig/hakumi/icon/component.rbs +0 -56
- data/sig/hakumi/image/component.rbs +0 -56
- data/sig/hakumi/image/preview_group/component.rbs +0 -28
- data/sig/hakumi/input/component.rbs +0 -71
- data/sig/hakumi/input/password/component.rbs +0 -27
- data/sig/hakumi/input/text_area/component.rbs +0 -42
- data/sig/hakumi/input_number/component.rbs +0 -85
- data/sig/hakumi/layout/component.rbs +0 -21
- data/sig/hakumi/layout/content/component.rbs +0 -19
- data/sig/hakumi/layout/footer/component.rbs +0 -19
- data/sig/hakumi/layout/header/component.rbs +0 -19
- data/sig/hakumi/layout/sider/component.rbs +0 -19
- data/sig/hakumi/mentions/component.rbs +0 -75
- data/sig/hakumi/menu/component.rbs +0 -52
- data/sig/hakumi/menu/divider/component.rbs +0 -11
- data/sig/hakumi/menu/group/component.rbs +0 -20
- data/sig/hakumi/menu/item/component.rbs +0 -42
- data/sig/hakumi/menu/sub_menu/component.rbs +0 -37
- data/sig/hakumi/message/component.rbs +0 -50
- data/sig/hakumi/modal/component.rbs +0 -76
- data/sig/hakumi/modal/confirm/component.rbs +0 -32
- data/sig/hakumi/modal/error/component.rbs +0 -27
- data/sig/hakumi/modal/info/component.rbs +0 -27
- data/sig/hakumi/modal/success/component.rbs +0 -27
- data/sig/hakumi/modal/warning/component.rbs +0 -27
- data/sig/hakumi/notification/component.rbs +0 -64
- data/sig/hakumi/pagination/component.rbs +0 -113
- data/sig/hakumi/popconfirm/component.rbs +0 -52
- data/sig/hakumi/popover/component.rbs +0 -66
- data/sig/hakumi/progress/component.rbs +0 -201
- data/sig/hakumi/qr_code/component.rbs +0 -111
- data/sig/hakumi/radio/component.rbs +0 -55
- data/sig/hakumi/radio/group/component.rbs +0 -71
- data/sig/hakumi/rails/attribute_introspection.rbs +0 -16
- data/sig/hakumi/rails/validation_introspection.rbs +0 -18
- data/sig/hakumi/rails/validation_mapper.rbs +0 -53
- data/sig/hakumi/rails.rbs +0 -6
- data/sig/hakumi/rate/component.rbs +0 -56
- data/sig/hakumi/result/component.rbs +0 -65
- data/sig/hakumi/segmented/component.rbs +0 -72
- data/sig/hakumi/select/component.rbs +0 -73
- data/sig/hakumi/skeleton/avatar/component.rbs +0 -23
- data/sig/hakumi/skeleton/button/component.rbs +0 -24
- data/sig/hakumi/skeleton/component.rbs +0 -76
- data/sig/hakumi/skeleton/image/component.rbs +0 -22
- data/sig/hakumi/skeleton/input/component.rbs +0 -23
- data/sig/hakumi/skeleton/node/component.rbs +0 -21
- data/sig/hakumi/slider/component.rbs +0 -85
- data/sig/hakumi/space/compact/component.rbs +0 -21
- data/sig/hakumi/space/component.rbs +0 -47
- data/sig/hakumi/spin/component.rbs +0 -77
- data/sig/hakumi/splitter/component.rbs +0 -27
- data/sig/hakumi/splitter/panel/component.rbs +0 -36
- data/sig/hakumi/statistic/component.rbs +0 -97
- data/sig/hakumi/steps/component.rbs +0 -82
- data/sig/hakumi/steps/item/component.rbs +0 -29
- data/sig/hakumi/switch/component.rbs +0 -52
- data/sig/hakumi/table/column/component.rbs +0 -57
- data/sig/hakumi/table/column_group/component.rbs +0 -20
- data/sig/hakumi/table/component.rbs +0 -279
- data/sig/hakumi/table/concerns/columns.rbs +0 -95
- data/sig/hakumi/table/concerns/editable.rbs +0 -40
- data/sig/hakumi/table/concerns/ellipsis.rbs +0 -27
- data/sig/hakumi/table/concerns/fixed_columns.rbs +0 -33
- data/sig/hakumi/tabs/component.rbs +0 -66
- data/sig/hakumi/tabs/item/component.rbs +0 -29
- data/sig/hakumi/tag/component.rbs +0 -86
- data/sig/hakumi/tag/group/component.rbs +0 -24
- data/sig/hakumi/time_picker/component.rbs +0 -72
- data/sig/hakumi/timeline/component.rbs +0 -61
- data/sig/hakumi/timeline/item/component.rbs +0 -70
- data/sig/hakumi/tooltip/component.rbs +0 -73
- data/sig/hakumi/tour/component.rbs +0 -84
- data/sig/hakumi/transfer/component.rbs +0 -75
- data/sig/hakumi/tree/component.rbs +0 -126
- data/sig/hakumi/tree_select/component.rbs +0 -122
- data/sig/hakumi/typography/base_component.rbs +0 -57
- data/sig/hakumi/typography/link/component.rbs +0 -28
- data/sig/hakumi/typography/paragraph/component.rbs +0 -13
- data/sig/hakumi/typography/title/component.rbs +0 -28
- data/sig/hakumi/upload/component.rbs +0 -78
- data/sig/hakumi.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/app/components/{hakumi → hakumi_components}/affix/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/anchor/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/breadcrumb/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/dropdown/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/dropdown/item/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/icon/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/menu/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/menu/group/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/menu/item/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/menu/sub_menu/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/message/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/qr_code/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/result/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/skeleton/avatar/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/skeleton/button/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/skeleton/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/skeleton/input/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/skeleton/node/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/spin/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/statistic/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/steps/item/component.html.erb +0 -0
- /data/app/components/{hakumi → hakumi_components}/tour/component.html.erb +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
class ComponentHandler
|
|
5
|
-
def initialize(component, params)
|
|
6
|
-
@component = component.to_sym
|
|
7
|
-
@params = params
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def locals
|
|
11
|
-
base_locals.merge(specific_locals)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def base_locals
|
|
17
|
-
{
|
|
18
|
-
id: @params[:id].presence || "hakumi-#{@component}-#{SecureRandom.hex(4)}"
|
|
19
|
-
}
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def specific_locals
|
|
23
|
-
component_class = resolve_component_class
|
|
24
|
-
return {} unless component_class.respond_to?(:extract_controller_locals)
|
|
25
|
-
|
|
26
|
-
component_class.extract_controller_locals(@params)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def resolve_component_class
|
|
30
|
-
case @component
|
|
31
|
-
when :modal then Hakumi::Modal::Component
|
|
32
|
-
when :confirm then Hakumi::Modal::Confirm::Component
|
|
33
|
-
when :alert then Hakumi::Alert::Component
|
|
34
|
-
when :drawer then Hakumi::Drawer::Component
|
|
35
|
-
when :message then Hakumi::Message::Component
|
|
36
|
-
when :notification then Hakumi::Notification::Component
|
|
37
|
-
when :popover then Hakumi::Popover::Component
|
|
38
|
-
when :progress then Hakumi::Progress::Component
|
|
39
|
-
when :result then Hakumi::Result::Component
|
|
40
|
-
when :skeleton then Hakumi::Skeleton::Component
|
|
41
|
-
when :spin then Hakumi::Spin::Component
|
|
42
|
-
when :qr_code then Hakumi::QrCode::Component
|
|
43
|
-
when :affix then Hakumi::Affix::Component
|
|
44
|
-
when :segmented then Hakumi::Segmented::Component
|
|
45
|
-
when :statistic then Hakumi::Statistic::Component
|
|
46
|
-
when :tag then Hakumi::Tag::Component
|
|
47
|
-
when :timeline then Hakumi::Timeline::Component
|
|
48
|
-
when :tree then Hakumi::Tree::Component
|
|
49
|
-
else nil
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Icon
|
|
5
|
-
# Loads Ant Design icons from lib/hakumi_components/app/assets/icons
|
|
6
|
-
class Loader
|
|
7
|
-
ICONS_BASE_PATH = if defined?(Hakumi::Engine)
|
|
8
|
-
Hakumi::Engine.root.join("app", "assets", "icons")
|
|
9
|
-
else
|
|
10
|
-
Rails.root.join("app", "assets", "icons")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class << self
|
|
14
|
-
def cache
|
|
15
|
-
@cache ||= {}
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def load(name, theme = :outlined)
|
|
19
|
-
cache_key = "#{name}_#{theme}"
|
|
20
|
-
return cache[cache_key] if cache.key?(cache_key)
|
|
21
|
-
|
|
22
|
-
svg = read_icon_file(name, theme)
|
|
23
|
-
cache[cache_key] = svg
|
|
24
|
-
svg
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def exists?(name, theme = :outlined)
|
|
28
|
-
!load(name, theme).nil?
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def list_icons(theme = :outlined)
|
|
32
|
-
theme_dir = theme_directory(theme)
|
|
33
|
-
return [] unless theme_dir.exist?
|
|
34
|
-
|
|
35
|
-
Dir.glob(theme_dir.join("*.svg")).map do |path|
|
|
36
|
-
File.basename(path, ".svg").gsub("-", "_")
|
|
37
|
-
end.sort
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def clear_cache!
|
|
41
|
-
@cache = {}
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
|
|
46
|
-
def read_icon_file(name, theme)
|
|
47
|
-
filepath = icon_filepath(name, theme)
|
|
48
|
-
return nil unless filepath.exist?
|
|
49
|
-
|
|
50
|
-
svg_content = File.read(filepath)
|
|
51
|
-
enhance_svg(svg_content)
|
|
52
|
-
rescue => e
|
|
53
|
-
Rails.logger.error("Error loading icon #{name} (#{theme}): #{e.message}")
|
|
54
|
-
nil
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def icon_filepath(name, theme)
|
|
58
|
-
theme_dir = theme_directory(theme)
|
|
59
|
-
filename = kebabize(name.to_s)
|
|
60
|
-
theme_dir.join("#{filename}.svg")
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def theme_directory(theme)
|
|
64
|
-
theme_str = case theme.to_sym
|
|
65
|
-
when :outlined then "outlined"
|
|
66
|
-
when :filled then "filled"
|
|
67
|
-
when :two_tone, :twotone then "twotone"
|
|
68
|
-
else "outlined"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
ICONS_BASE_PATH.join(theme_str)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def enhance_svg(svg_content)
|
|
75
|
-
svg = svg_content.dup
|
|
76
|
-
|
|
77
|
-
svg.sub!("<svg", '<svg width="1em"') unless svg.include?("width=")
|
|
78
|
-
svg.sub!("<svg", '<svg height="1em"') unless svg.include?("height=")
|
|
79
|
-
svg.sub!("<svg", '<svg fill="currentColor"') unless svg.include?("fill=")
|
|
80
|
-
|
|
81
|
-
svg
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def kebabize(str)
|
|
85
|
-
str.gsub(/::/, "/")
|
|
86
|
-
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1-\2')
|
|
87
|
-
.gsub(/([a-z\d])([A-Z])/, '\1-\2')
|
|
88
|
-
.tr("_", "-")
|
|
89
|
-
.downcase
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
HakumiIconLoader = Hakumi::Icon::Loader unless defined?(HakumiIconLoader)
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Illustrations
|
|
5
|
-
# Loads SVG illustrations stored under lib/hakumi_components/app/assets/illustrations
|
|
6
|
-
class Loader
|
|
7
|
-
ILLUSTRATIONS_PATH = if defined?(Hakumi::Engine)
|
|
8
|
-
Hakumi::Engine.root.join("app", "assets", "illustrations")
|
|
9
|
-
else
|
|
10
|
-
Rails.root.join("lib", "hakumi_components", "app", "assets", "illustrations")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class << self
|
|
14
|
-
def load(name)
|
|
15
|
-
filename = "#{name}.svg"
|
|
16
|
-
cache[filename] ||= read_svg(filename)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def clear_cache!
|
|
20
|
-
@cache = {}
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def cache
|
|
26
|
-
@cache ||= {}
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def read_svg(filename)
|
|
30
|
-
path = ILLUSTRATIONS_PATH.join(filename)
|
|
31
|
-
return nil unless path.exist?
|
|
32
|
-
|
|
33
|
-
svg = File.read(path)
|
|
34
|
-
svg.respond_to?(:html_safe) ? svg.html_safe : svg
|
|
35
|
-
rescue => e
|
|
36
|
-
::Rails.logger.error("Error loading illustration #{filename}: #{e.message}")
|
|
37
|
-
nil
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
HakumiIllustrationLoader = Hakumi::Illustrations::Loader unless defined?(HakumiIllustrationLoader)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module ActionView
|
|
4
|
-
module Helpers
|
|
5
|
-
class TagBuilder
|
|
6
|
-
def method_missing: (Symbol name, *Object args, **hakumi_html_options) -> String
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
module TagHelper
|
|
10
|
-
def tag: () -> TagBuilder
|
|
11
|
-
def content_tag: (Symbol tag_name, String? content, **Object attributes) -> String
|
|
12
|
-
def content_tag: (Symbol tag_name, **Object attributes) { () -> String? } -> String
|
|
13
|
-
def safe_join: (Array[Object] array, ?String separator) -> String
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
module AssetTagHelper
|
|
17
|
-
def image_tag: (String src, **Object options) -> String
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
module CaptureHelper
|
|
21
|
-
def capture: () { () -> String } -> String
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
class InstallGenerator < Rails::Generators::Base
|
|
5
|
-
def add_npm_package: () -> void
|
|
6
|
-
def setup_javascript: () -> void
|
|
7
|
-
def setup_stylesheets: () -> void
|
|
8
|
-
def setup_form_builder: () -> void
|
|
9
|
-
def show_post_install: () -> void
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module AdminPanel
|
|
5
|
-
class Component < Hakumi::BaseComponent
|
|
6
|
-
# Extracts locals from controller params for dynamic rendering
|
|
7
|
-
def self.extract_controller_locals: (untyped params) -> Hash[Symbol, untyped]
|
|
8
|
-
|
|
9
|
-
@title: String
|
|
10
|
-
@enabled: bool
|
|
11
|
-
@html_options: hakumi_html_options
|
|
12
|
-
|
|
13
|
-
def initialize: (
|
|
14
|
-
?title: String,
|
|
15
|
-
?enabled: bool,
|
|
16
|
-
**hakumi_html_options html_options
|
|
17
|
-
) -> void
|
|
18
|
-
|
|
19
|
-
def render?: () -> bool
|
|
20
|
-
|
|
21
|
-
private
|
|
22
|
-
|
|
23
|
-
attr_reader title: String
|
|
24
|
-
|
|
25
|
-
def wrapper_attributes: () -> hakumi_html_options
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Affix
|
|
5
|
-
class Component < Hakumi::BaseComponent
|
|
6
|
-
# Extracts locals from controller params for dynamic rendering
|
|
7
|
-
def self.extract_controller_locals: (untyped params) -> Hash[Symbol, untyped]
|
|
8
|
-
|
|
9
|
-
@body: String?
|
|
10
|
-
@offset_top: Float?
|
|
11
|
-
@offset_bottom: Float?
|
|
12
|
-
@target_selector: String?
|
|
13
|
-
@z_index: Integer?
|
|
14
|
-
@on_change: String?
|
|
15
|
-
@html_options: hakumi_html_options
|
|
16
|
-
|
|
17
|
-
def initialize: (
|
|
18
|
-
?body: String?,
|
|
19
|
-
?offset_top: (Float | Integer | String)?,
|
|
20
|
-
?offset_bottom: (Float | Integer | String)?,
|
|
21
|
-
?target_selector: String?,
|
|
22
|
-
?z_index: (Integer | String)?,
|
|
23
|
-
?on_change: String?,
|
|
24
|
-
**hakumi_html_options html_options
|
|
25
|
-
) -> void
|
|
26
|
-
|
|
27
|
-
def root_attributes: () -> hakumi_html_options
|
|
28
|
-
|
|
29
|
-
def content_value: () -> String?
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def data_attributes: () -> hakumi_data_attributes
|
|
34
|
-
|
|
35
|
-
def normalize_numeric: ((Float | Integer | String)? value) -> (Float | Integer)?
|
|
36
|
-
|
|
37
|
-
def normalize_offsets!: () -> void
|
|
38
|
-
|
|
39
|
-
def validate_props!: () -> void
|
|
40
|
-
|
|
41
|
-
def append_action: (String? existing, String action) -> String
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Alert
|
|
5
|
-
class Component < Hakumi::BaseComponent
|
|
6
|
-
type alert_type = :success | :info | :warning | :error
|
|
7
|
-
|
|
8
|
-
TYPES: Array[alert_type]
|
|
9
|
-
|
|
10
|
-
# Extracts locals from controller params for dynamic rendering
|
|
11
|
-
def self.extract_controller_locals: (untyped params) -> Hash[Symbol, untyped]
|
|
12
|
-
|
|
13
|
-
@type: alert_type
|
|
14
|
-
@message: String?
|
|
15
|
-
@description: String?
|
|
16
|
-
@show_icon: bool
|
|
17
|
-
@icon: hakumi_icon?
|
|
18
|
-
@closable: bool
|
|
19
|
-
@close_text: String?
|
|
20
|
-
@banner: bool
|
|
21
|
-
@action: untyped
|
|
22
|
-
@html_options: hakumi_html_options
|
|
23
|
-
|
|
24
|
-
def initialize: (
|
|
25
|
-
?type: alert_type?,
|
|
26
|
-
?message: String?,
|
|
27
|
-
?description: String?,
|
|
28
|
-
?show_icon: bool?,
|
|
29
|
-
?icon: hakumi_icon?,
|
|
30
|
-
?closable: bool,
|
|
31
|
-
?close_text: String?,
|
|
32
|
-
?banner: bool,
|
|
33
|
-
?action: untyped,
|
|
34
|
-
**hakumi_html_options html_options
|
|
35
|
-
) -> void
|
|
36
|
-
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
def validate_props!: () -> void
|
|
40
|
-
|
|
41
|
-
def wrapper_classes: () -> String
|
|
42
|
-
|
|
43
|
-
def wrapper_attributes: () -> hakumi_html_options
|
|
44
|
-
|
|
45
|
-
def message_content: () -> String?
|
|
46
|
-
|
|
47
|
-
def description_present?: () -> bool
|
|
48
|
-
|
|
49
|
-
def description_content: () -> String?
|
|
50
|
-
|
|
51
|
-
def action_present?: () -> bool
|
|
52
|
-
|
|
53
|
-
def action_content: () -> String?
|
|
54
|
-
|
|
55
|
-
def show_icon?: () -> bool
|
|
56
|
-
|
|
57
|
-
def icon_element: () -> String?
|
|
58
|
-
|
|
59
|
-
def default_icon: () -> Symbol
|
|
60
|
-
|
|
61
|
-
def close_button_classes: () -> String
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Anchor
|
|
5
|
-
class Component < Hakumi::BaseComponent
|
|
6
|
-
type anchor_direction = :vertical | :horizontal
|
|
7
|
-
|
|
8
|
-
DIRECTIONS: Array[anchor_direction]
|
|
9
|
-
|
|
10
|
-
@affix: bool
|
|
11
|
-
@bounds: (Integer | Float)
|
|
12
|
-
@offset_top: (Integer | Float)
|
|
13
|
-
@target_offset: (Integer | Float)?
|
|
14
|
-
@direction: anchor_direction
|
|
15
|
-
@replace: bool
|
|
16
|
-
@html_options: hakumi_html_options
|
|
17
|
-
|
|
18
|
-
def initialize: (
|
|
19
|
-
?affix: bool,
|
|
20
|
-
?bounds: (Integer | Float),
|
|
21
|
-
?offset_top: (Integer | Float),
|
|
22
|
-
?target_offset: (Integer | Float)?,
|
|
23
|
-
?direction: anchor_direction,
|
|
24
|
-
?replace: bool,
|
|
25
|
-
**hakumi_html_options html_options
|
|
26
|
-
) -> void
|
|
27
|
-
|
|
28
|
-
def wrapper_classes: () -> String
|
|
29
|
-
|
|
30
|
-
def anchor_classes: () -> String
|
|
31
|
-
|
|
32
|
-
def stimulus_controller: () -> String
|
|
33
|
-
|
|
34
|
-
def stimulus_values: () -> Hash[Symbol, untyped]
|
|
35
|
-
|
|
36
|
-
def wrapper_attributes: () -> hakumi_html_options
|
|
37
|
-
|
|
38
|
-
def horizontal?: () -> bool
|
|
39
|
-
|
|
40
|
-
private
|
|
41
|
-
|
|
42
|
-
def validate_props!: () -> void
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Anchor
|
|
5
|
-
module Link
|
|
6
|
-
class Component < Hakumi::BaseComponent
|
|
7
|
-
@href: String
|
|
8
|
-
@title: String
|
|
9
|
-
@target: String?
|
|
10
|
-
@html_options: hakumi_html_options
|
|
11
|
-
|
|
12
|
-
def initialize: (
|
|
13
|
-
href: String,
|
|
14
|
-
title: String,
|
|
15
|
-
?target: String?,
|
|
16
|
-
**hakumi_html_options html_options
|
|
17
|
-
) -> void
|
|
18
|
-
|
|
19
|
-
attr_reader href: String
|
|
20
|
-
attr_reader title: String
|
|
21
|
-
attr_reader target: String?
|
|
22
|
-
|
|
23
|
-
def link_classes: () -> String
|
|
24
|
-
|
|
25
|
-
def title_classes: () -> String
|
|
26
|
-
|
|
27
|
-
def has_children?: () -> bool
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Autocomplete
|
|
5
|
-
class Component < Hakumi::BaseComponent
|
|
6
|
-
type autocomplete_variant = :outlined | :filled | :borderless | :underlined
|
|
7
|
-
type autocomplete_status = :error | :warning
|
|
8
|
-
type filter_mode = :contains | :starts_with
|
|
9
|
-
|
|
10
|
-
SIZES: Array[hakumi_size_standard]
|
|
11
|
-
VARIANTS: Array[autocomplete_variant]
|
|
12
|
-
STATUSES: Array[autocomplete_status]
|
|
13
|
-
FILTER_MODES: Array[filter_mode]
|
|
14
|
-
|
|
15
|
-
@name: String
|
|
16
|
-
@options: Array[untyped]
|
|
17
|
-
@value: String?
|
|
18
|
-
@placeholder: String?
|
|
19
|
-
@size: hakumi_size_standard
|
|
20
|
-
@variant: autocomplete_variant
|
|
21
|
-
@status: autocomplete_status?
|
|
22
|
-
@disabled: bool
|
|
23
|
-
@allow_clear: bool
|
|
24
|
-
@clear_icon: hakumi_icon
|
|
25
|
-
@input_renderer: Proc?
|
|
26
|
-
@case_sensitive: bool
|
|
27
|
-
@filter_mode: filter_mode
|
|
28
|
-
@not_found_content: String
|
|
29
|
-
@html_options: hakumi_html_options
|
|
30
|
-
|
|
31
|
-
def initialize: (
|
|
32
|
-
name: String,
|
|
33
|
-
?options: Array[untyped],
|
|
34
|
-
?value: String?,
|
|
35
|
-
?placeholder: String?,
|
|
36
|
-
?size: hakumi_size_standard,
|
|
37
|
-
?variant: autocomplete_variant,
|
|
38
|
-
?status: autocomplete_status?,
|
|
39
|
-
?disabled: bool,
|
|
40
|
-
?allow_clear: bool,
|
|
41
|
-
?clear_icon: hakumi_icon,
|
|
42
|
-
?input_renderer: Proc?,
|
|
43
|
-
?case_sensitive: bool,
|
|
44
|
-
?filter_mode: filter_mode,
|
|
45
|
-
?not_found_content: String,
|
|
46
|
-
**hakumi_html_options html_options
|
|
47
|
-
) -> void
|
|
48
|
-
|
|
49
|
-
private
|
|
50
|
-
|
|
51
|
-
def validate_props!: () -> void
|
|
52
|
-
def wrapper_classes: () -> String
|
|
53
|
-
def wrapper_attributes: () -> hakumi_html_options
|
|
54
|
-
def input_attributes: () -> hakumi_html_options
|
|
55
|
-
def input_classes: () -> String
|
|
56
|
-
def dropdown_id: () -> String
|
|
57
|
-
def allow_clear?: () -> bool
|
|
58
|
-
def custom_input_renderer?: () -> bool
|
|
59
|
-
def input_renderer: () -> Proc?
|
|
60
|
-
def disabled?: () -> bool
|
|
61
|
-
def clear_icon: () -> hakumi_icon
|
|
62
|
-
def not_found_content: () -> String
|
|
63
|
-
def normalized_items: () -> Array[Hash[Symbol, untyped]]
|
|
64
|
-
def normalize_group_options: (Array[untyped] options) -> Array[Hash[Symbol, untyped]]
|
|
65
|
-
def normalize_simple_option: (untyped opt) -> Hash[Symbol, untyped]?
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Avatar
|
|
5
|
-
class Component < Hakumi::BaseComponent
|
|
6
|
-
type avatar_shape = :circle | :square
|
|
7
|
-
type avatar_size = :small | :default | :large
|
|
8
|
-
|
|
9
|
-
SHAPES: Array[avatar_shape]
|
|
10
|
-
SIZES: Array[avatar_size]
|
|
11
|
-
|
|
12
|
-
@shape: avatar_shape
|
|
13
|
-
@size: (avatar_size | Integer)
|
|
14
|
-
@src: String?
|
|
15
|
-
@icon: hakumi_icon?
|
|
16
|
-
@alt: String?
|
|
17
|
-
@html_options: hakumi_html_options
|
|
18
|
-
|
|
19
|
-
def initialize: (
|
|
20
|
-
?shape: avatar_shape,
|
|
21
|
-
?size: (avatar_size | Integer),
|
|
22
|
-
?src: String?,
|
|
23
|
-
?icon: hakumi_icon?,
|
|
24
|
-
?alt: String?,
|
|
25
|
-
**hakumi_html_options html_options
|
|
26
|
-
) -> void
|
|
27
|
-
|
|
28
|
-
def call: () -> String
|
|
29
|
-
|
|
30
|
-
private
|
|
31
|
-
|
|
32
|
-
def validate_props!: () -> void
|
|
33
|
-
|
|
34
|
-
def wrapper_classes: () -> String
|
|
35
|
-
|
|
36
|
-
def content_wrapper: () -> String
|
|
37
|
-
|
|
38
|
-
# Type assertion: case statement always returns Integer despite @size being (avatar_size | Integer)
|
|
39
|
-
def avatar_size: () -> (avatar_size | Integer)
|
|
40
|
-
|
|
41
|
-
def wrapper_attributes: () -> hakumi_html_options
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
module Badge
|
|
5
|
-
class Component < Hakumi::BaseComponent
|
|
6
|
-
type badge_status = :success | :processing | :default | :error | :warning
|
|
7
|
-
|
|
8
|
-
@count: (Integer | String)?
|
|
9
|
-
@dot: bool
|
|
10
|
-
@overflow_count: Integer
|
|
11
|
-
@status: badge_status?
|
|
12
|
-
@text: String?
|
|
13
|
-
@color: hakumi_color?
|
|
14
|
-
@show_zero: bool
|
|
15
|
-
@icon: hakumi_icon?
|
|
16
|
-
@html_options: hakumi_html_options
|
|
17
|
-
|
|
18
|
-
def initialize: (
|
|
19
|
-
?count: (Integer | String)?,
|
|
20
|
-
?dot: bool,
|
|
21
|
-
?overflow_count: Integer,
|
|
22
|
-
?status: badge_status?,
|
|
23
|
-
?text: String?,
|
|
24
|
-
?color: hakumi_color?,
|
|
25
|
-
?show_zero: bool,
|
|
26
|
-
?icon: hakumi_icon?,
|
|
27
|
-
**hakumi_html_options html_options
|
|
28
|
-
) -> void
|
|
29
|
-
|
|
30
|
-
def call: () -> String
|
|
31
|
-
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
def badge_element: () -> String?
|
|
35
|
-
|
|
36
|
-
def status_text_element: () -> String?
|
|
37
|
-
|
|
38
|
-
def display_count: () -> (Integer | String | nil)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Hakumi
|
|
4
|
-
class BaseComponent < ViewComponent::Base
|
|
5
|
-
# Core class methods
|
|
6
|
-
def self.inherited: (Class klass) -> void
|
|
7
|
-
|
|
8
|
-
# Instance methods
|
|
9
|
-
# Generate class names with the hakumi- prefix
|
|
10
|
-
# @param base [String] Base class name (e.g., 'btn', 'icon')
|
|
11
|
-
# @param modifiers [Hash] Hash of modifier keys and their values (Symbol, String, Integer, or bool)
|
|
12
|
-
# @param extras [Array<String>] Additional classes to append
|
|
13
|
-
# @return [String] Combined class string
|
|
14
|
-
def class_names: (String base, ?Hash[Symbol, (Symbol | String | Integer | bool)] modifiers, ?Array[String] extras) -> String
|
|
15
|
-
|
|
16
|
-
# Merge HTML attributes with defaults
|
|
17
|
-
# @param defaults [Hash] Default attributes
|
|
18
|
-
# @param overrides [Hash] User-provided attributes
|
|
19
|
-
# @return [Hash] Merged attributes
|
|
20
|
-
def merge_attributes: (hakumi_html_options defaults, hakumi_html_options overrides) -> hakumi_html_options
|
|
21
|
-
|
|
22
|
-
# Internal helper to check presence without clobbering ActiveSupport#present?
|
|
23
|
-
# Accepts any value type since it's a generic utility method
|
|
24
|
-
# @param value [untyped] Value to check
|
|
25
|
-
# @return [Boolean]
|
|
26
|
-
def value_present?: (untyped value) -> bool
|
|
27
|
-
|
|
28
|
-
# Validate required props
|
|
29
|
-
# @param props [Array<Symbol>] List of required prop names
|
|
30
|
-
# @raise [ArgumentError] if any prop is missing
|
|
31
|
-
def validate_required!: (*Symbol props) -> void
|
|
32
|
-
|
|
33
|
-
# Validate prop is one of allowed values
|
|
34
|
-
# @param prop [Symbol] Prop name
|
|
35
|
-
# @param allowed [Array] Allowed values (typically Symbol enums, but can include strings/integers)
|
|
36
|
-
# @raise [ArgumentError] if value is not allowed
|
|
37
|
-
def validate_inclusion!: (Symbol prop, Array[Symbol | String | Integer | bool] allowed) -> void
|
|
38
|
-
|
|
39
|
-
# Ensure attrs has a DOM ID if it has a Stimulus controller
|
|
40
|
-
# @param attrs [Hash] Attributes hash
|
|
41
|
-
# @return [void]
|
|
42
|
-
def ensure_dom_id!: (hakumi_html_options attrs) -> void
|
|
43
|
-
|
|
44
|
-
# Generate a unique ID with a prefix
|
|
45
|
-
# @param prefix [String] Prefix for the ID
|
|
46
|
-
# @param length [Integer] Length of the random hex (default: 4)
|
|
47
|
-
# @return [String] Generated ID
|
|
48
|
-
def generate_id: (String prefix, ?length: Integer) -> String
|
|
49
|
-
|
|
50
|
-
# Render a value that can be a String, ViewComponent, or other renderable object
|
|
51
|
-
# Accepts: String, ActiveSupport::SafeBuffer, ViewComponent, or any object with to_s
|
|
52
|
-
# @param value [untyped] Value to render (String, ViewComponent, etc.)
|
|
53
|
-
# @return [String, nil] Rendered value or nil if empty
|
|
54
|
-
def render_value: (untyped value) -> (String | nil)
|
|
55
|
-
|
|
56
|
-
# Convert size string/symbol to integer pixels
|
|
57
|
-
# Useful for components that accept both symbolic (:small, :large) and numeric sizes
|
|
58
|
-
# @param size [Symbol, Integer] Size value
|
|
59
|
-
# @param mapping [Hash] Size to pixel mapping
|
|
60
|
-
# @return [Integer] Size in pixels
|
|
61
|
-
def size_to_pixels: ((Symbol | Integer) size, ?Hash[Symbol, Integer] mapping) -> Integer
|
|
62
|
-
|
|
63
|
-
# Convert dimension value to CSS string
|
|
64
|
-
# @param value [Numeric, String, nil] Dimension value
|
|
65
|
-
# @return [String, nil] CSS dimension string
|
|
66
|
-
def dimension_to_css: ((Numeric | String | nil) value) -> String?
|
|
67
|
-
|
|
68
|
-
# Cast a value to boolean using ActiveModel::Type::Boolean
|
|
69
|
-
# @param value [untyped] Value to cast
|
|
70
|
-
# @return [Boolean] Casted boolean value
|
|
71
|
-
def cast_boolean: (untyped value) -> bool
|
|
72
|
-
|
|
73
|
-
# Build inline style string from array or hash
|
|
74
|
-
# @param styles [Array<String>, Hash] Styles as array of CSS strings or hash of property => value
|
|
75
|
-
# @return [String, nil] Combined style string
|
|
76
|
-
def build_inline_style: ((Array[String] | Hash[Symbol | String, (String | Integer | Float)]) styles) -> String?
|
|
77
|
-
|
|
78
|
-
private
|
|
79
|
-
|
|
80
|
-
def prepare_data_attributes: (hakumi_html_options attrs) -> hakumi_html_options
|
|
81
|
-
end
|
|
82
|
-
end
|