poetry-ui 0.0.2
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 +7 -0
- data/.gitattributes +6 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +87 -0
- data/THIRD_PARTY_NOTICES.md +201 -0
- data/app/components/poetry/ui/accordion/component.html.erb +3 -0
- data/app/components/poetry/ui/accordion/component.rb +197 -0
- data/app/components/poetry/ui/accordion/preview.rb +39 -0
- data/app/components/poetry/ui/accordion/style.rb +37 -0
- data/app/components/poetry/ui/alert/component.html.erb +6 -0
- data/app/components/poetry/ui/alert/component.rb +61 -0
- data/app/components/poetry/ui/alert/preview.rb +35 -0
- data/app/components/poetry/ui/alert/style.rb +24 -0
- data/app/components/poetry/ui/alert_dialog/component.html.erb +17 -0
- data/app/components/poetry/ui/alert_dialog/component.rb +208 -0
- data/app/components/poetry/ui/alert_dialog/preview.rb +48 -0
- data/app/components/poetry/ui/alert_dialog/style.rb +46 -0
- data/app/components/poetry/ui/aspect_ratio/component.rb +63 -0
- data/app/components/poetry/ui/aspect_ratio/preview.rb +29 -0
- data/app/components/poetry/ui/aspect_ratio/style.rb +13 -0
- data/app/components/poetry/ui/attachment/component.html.erb +13 -0
- data/app/components/poetry/ui/attachment/component.rb +139 -0
- data/app/components/poetry/ui/attachment/preview.rb +83 -0
- data/app/components/poetry/ui/attachment/style.rb +59 -0
- data/app/components/poetry/ui/autocomplete/component.html.erb +16 -0
- data/app/components/poetry/ui/autocomplete/component.rb +193 -0
- data/app/components/poetry/ui/autocomplete/preview.rb +39 -0
- data/app/components/poetry/ui/autocomplete/style.rb +18 -0
- data/app/components/poetry/ui/avatar/component.rb +103 -0
- data/app/components/poetry/ui/avatar/group_preview.html.erb +11 -0
- data/app/components/poetry/ui/avatar/preview.rb +50 -0
- data/app/components/poetry/ui/avatar/style.rb +34 -0
- data/app/components/poetry/ui/badge/component.rb +73 -0
- data/app/components/poetry/ui/badge/preview.rb +54 -0
- data/app/components/poetry/ui/badge/style.rb +35 -0
- data/app/components/poetry/ui/breadcrumb/component.html.erb +32 -0
- data/app/components/poetry/ui/breadcrumb/component.rb +102 -0
- data/app/components/poetry/ui/breadcrumb/dropdown_crumb_preview.html.erb +21 -0
- data/app/components/poetry/ui/breadcrumb/preview.rb +45 -0
- data/app/components/poetry/ui/breadcrumb/style.rb +25 -0
- data/app/components/poetry/ui/bubble/component.html.erb +4 -0
- data/app/components/poetry/ui/bubble/component.rb +106 -0
- data/app/components/poetry/ui/bubble/preview.rb +62 -0
- data/app/components/poetry/ui/bubble/style.rb +47 -0
- data/app/components/poetry/ui/button/component.html.erb +14 -0
- data/app/components/poetry/ui/button/component.rb +168 -0
- data/app/components/poetry/ui/button/preview.rb +94 -0
- data/app/components/poetry/ui/button/style.rb +41 -0
- data/app/components/poetry/ui/button_group/component.rb +70 -0
- data/app/components/poetry/ui/button_group/popup_triggers_preview.html.erb +21 -0
- data/app/components/poetry/ui/button_group/preview.rb +46 -0
- data/app/components/poetry/ui/button_group/style.rb +27 -0
- data/app/components/poetry/ui/button_group/text_prefix_preview.html.erb +7 -0
- data/app/components/poetry/ui/calendar/component.html.erb +72 -0
- data/app/components/poetry/ui/calendar/component.rb +366 -0
- data/app/components/poetry/ui/calendar/preview.rb +55 -0
- data/app/components/poetry/ui/calendar/style.rb +55 -0
- data/app/components/poetry/ui/card/component.html.erb +11 -0
- data/app/components/poetry/ui/card/component.rb +90 -0
- data/app/components/poetry/ui/card/preview.rb +29 -0
- data/app/components/poetry/ui/card/style.rb +23 -0
- data/app/components/poetry/ui/carousel/component.html.erb +17 -0
- data/app/components/poetry/ui/carousel/component.rb +179 -0
- data/app/components/poetry/ui/carousel/preview.rb +67 -0
- data/app/components/poetry/ui/carousel/style.rb +39 -0
- data/app/components/poetry/ui/checkbox/component.html.erb +22 -0
- data/app/components/poetry/ui/checkbox/component.rb +179 -0
- data/app/components/poetry/ui/checkbox/preview.rb +68 -0
- data/app/components/poetry/ui/checkbox/style.rb +28 -0
- data/app/components/poetry/ui/clipboard_text/component.html.erb +15 -0
- data/app/components/poetry/ui/clipboard_text/component.rb +154 -0
- data/app/components/poetry/ui/clipboard_text/preview.rb +24 -0
- data/app/components/poetry/ui/clipboard_text/style.rb +23 -0
- data/app/components/poetry/ui/code_block/component.html.erb +13 -0
- data/app/components/poetry/ui/code_block/component.rb +141 -0
- data/app/components/poetry/ui/code_block/preview.rb +40 -0
- data/app/components/poetry/ui/code_block/style.rb +38 -0
- data/app/components/poetry/ui/collapsible/component.html.erb +4 -0
- data/app/components/poetry/ui/collapsible/component.rb +134 -0
- data/app/components/poetry/ui/collapsible/preview.rb +24 -0
- data/app/components/poetry/ui/combobox/component.html.erb +49 -0
- data/app/components/poetry/ui/combobox/component.rb +1086 -0
- data/app/components/poetry/ui/combobox/preview.rb +164 -0
- data/app/components/poetry/ui/combobox/style.rb +148 -0
- data/app/components/poetry/ui/command/component.html.erb +20 -0
- data/app/components/poetry/ui/command/component.rb +526 -0
- data/app/components/poetry/ui/command/dialog_component.html.erb +14 -0
- data/app/components/poetry/ui/command/dialog_component.rb +206 -0
- data/app/components/poetry/ui/command/dialog_preview.rb +39 -0
- data/app/components/poetry/ui/command/preview.rb +121 -0
- data/app/components/poetry/ui/command/style.rb +78 -0
- data/app/components/poetry/ui/composable_trigger.rb +63 -0
- data/app/components/poetry/ui/context_menu/component.html.erb +6 -0
- data/app/components/poetry/ui/context_menu/component.rb +358 -0
- data/app/components/poetry/ui/context_menu/preview.rb +111 -0
- data/app/components/poetry/ui/context_menu/style.rb +59 -0
- data/app/components/poetry/ui/data_table/component.html.erb +78 -0
- data/app/components/poetry/ui/data_table/component.rb +277 -0
- data/app/components/poetry/ui/data_table/preview.rb +68 -0
- data/app/components/poetry/ui/data_table/state.rb +115 -0
- data/app/components/poetry/ui/data_table/style.rb +42 -0
- data/app/components/poetry/ui/date_field/component.html.erb +7 -0
- data/app/components/poetry/ui/date_field/component.rb +209 -0
- data/app/components/poetry/ui/date_field/preview.rb +42 -0
- data/app/components/poetry/ui/date_field/style.rb +35 -0
- data/app/components/poetry/ui/date_picker/component.html.erb +23 -0
- data/app/components/poetry/ui/date_picker/component.rb +242 -0
- data/app/components/poetry/ui/date_picker/preview.rb +31 -0
- data/app/components/poetry/ui/date_picker/style.rb +25 -0
- data/app/components/poetry/ui/deferred/component.html.erb +16 -0
- data/app/components/poetry/ui/deferred/component.rb +90 -0
- data/app/components/poetry/ui/deferred/preview.rb +24 -0
- data/app/components/poetry/ui/dialog/component.html.erb +21 -0
- data/app/components/poetry/ui/dialog/component.rb +194 -0
- data/app/components/poetry/ui/dialog/preview.rb +33 -0
- data/app/components/poetry/ui/dialog/style.rb +30 -0
- data/app/components/poetry/ui/drawer/component.html.erb +16 -0
- data/app/components/poetry/ui/drawer/component.rb +207 -0
- data/app/components/poetry/ui/drawer/preview.rb +69 -0
- data/app/components/poetry/ui/drawer/style.rb +105 -0
- data/app/components/poetry/ui/dropdown_menu/component.html.erb +6 -0
- data/app/components/poetry/ui/dropdown_menu/component.rb +350 -0
- data/app/components/poetry/ui/dropdown_menu/preview.rb +101 -0
- data/app/components/poetry/ui/dropdown_menu/style.rb +60 -0
- data/app/components/poetry/ui/empty/component.html.erb +10 -0
- data/app/components/poetry/ui/empty/component.rb +79 -0
- data/app/components/poetry/ui/empty/preview.rb +27 -0
- data/app/components/poetry/ui/empty/style.rb +27 -0
- data/app/components/poetry/ui/family_identity.rb +52 -0
- data/app/components/poetry/ui/field/component.html.erb +19 -0
- data/app/components/poetry/ui/field/component.rb +183 -0
- data/app/components/poetry/ui/field/preview.html.erb +30 -0
- data/app/components/poetry/ui/field/preview.rb +72 -0
- data/app/components/poetry/ui/field/style.rb +68 -0
- data/app/components/poetry/ui/field_group/component.rb +61 -0
- data/app/components/poetry/ui/field_group/preview.html.erb +30 -0
- data/app/components/poetry/ui/field_group/preview.rb +20 -0
- data/app/components/poetry/ui/field_group/style.rb +25 -0
- data/app/components/poetry/ui/field_separator/component.rb +70 -0
- data/app/components/poetry/ui/field_separator/preview.rb +18 -0
- data/app/components/poetry/ui/field_separator/style.rb +20 -0
- data/app/components/poetry/ui/fieldset/component.rb +90 -0
- data/app/components/poetry/ui/fieldset/preview.html.erb +22 -0
- data/app/components/poetry/ui/fieldset/preview.rb +25 -0
- data/app/components/poetry/ui/fieldset/style.rb +18 -0
- data/app/components/poetry/ui/file_input/component.html.erb +14 -0
- data/app/components/poetry/ui/file_input/component.rb +188 -0
- data/app/components/poetry/ui/file_input/preview.rb +30 -0
- data/app/components/poetry/ui/file_input/style.rb +35 -0
- data/app/components/poetry/ui/hover_card/component.html.erb +6 -0
- data/app/components/poetry/ui/hover_card/component.rb +201 -0
- data/app/components/poetry/ui/hover_card/preview.rb +60 -0
- data/app/components/poetry/ui/hover_card/style.rb +17 -0
- data/app/components/poetry/ui/icon/component.rb +127 -0
- data/app/components/poetry/ui/icon/preview.rb +21 -0
- data/app/components/poetry/ui/input/component.rb +80 -0
- data/app/components/poetry/ui/input/preview.rb +35 -0
- data/app/components/poetry/ui/input/style.rb +18 -0
- data/app/components/poetry/ui/input_group/button_preview.html.erb +12 -0
- data/app/components/poetry/ui/input_group/component.rb +69 -0
- data/app/components/poetry/ui/input_group/preview.rb +23 -0
- data/app/components/poetry/ui/input_group/search_preview.html.erb +13 -0
- data/app/components/poetry/ui/input_group/style.rb +40 -0
- data/app/components/poetry/ui/input_group/textarea_preview.html.erb +10 -0
- data/app/components/poetry/ui/input_group_field.rb +61 -0
- data/app/components/poetry/ui/input_otp/component.html.erb +25 -0
- data/app/components/poetry/ui/input_otp/component.rb +250 -0
- data/app/components/poetry/ui/input_otp/preview.rb +91 -0
- data/app/components/poetry/ui/input_otp/style.rb +36 -0
- data/app/components/poetry/ui/item/component.html.erb +13 -0
- data/app/components/poetry/ui/item/component.rb +99 -0
- data/app/components/poetry/ui/item/group_preview.html.erb +15 -0
- data/app/components/poetry/ui/item/preview.rb +52 -0
- data/app/components/poetry/ui/item/style.rb +45 -0
- data/app/components/poetry/ui/kbd/component.rb +47 -0
- data/app/components/poetry/ui/kbd/group_preview.html.erb +4 -0
- data/app/components/poetry/ui/kbd/preview.rb +23 -0
- data/app/components/poetry/ui/kbd/style.rb +13 -0
- data/app/components/poetry/ui/label/component.rb +46 -0
- data/app/components/poetry/ui/label/preview.html.erb +5 -0
- data/app/components/poetry/ui/label/preview.rb +16 -0
- data/app/components/poetry/ui/label/style.rb +13 -0
- data/app/components/poetry/ui/link/component.rb +62 -0
- data/app/components/poetry/ui/link/preview.rb +31 -0
- data/app/components/poetry/ui/link/style.rb +20 -0
- data/app/components/poetry/ui/marker/component.html.erb +4 -0
- data/app/components/poetry/ui/marker/component.rb +81 -0
- data/app/components/poetry/ui/marker/preview.rb +43 -0
- data/app/components/poetry/ui/marker/style.rb +24 -0
- data/app/components/poetry/ui/menubar/component.html.erb +3 -0
- data/app/components/poetry/ui/menubar/component.rb +493 -0
- data/app/components/poetry/ui/menubar/preview.rb +164 -0
- data/app/components/poetry/ui/menubar/style.rb +71 -0
- data/app/components/poetry/ui/menus.rb +386 -0
- data/app/components/poetry/ui/message/component.html.erb +8 -0
- data/app/components/poetry/ui/message/component.rb +64 -0
- data/app/components/poetry/ui/message/preview.rb +33 -0
- data/app/components/poetry/ui/message/style.rb +29 -0
- data/app/components/poetry/ui/message_scroller/component.html.erb +15 -0
- data/app/components/poetry/ui/message_scroller/component.rb +163 -0
- data/app/components/poetry/ui/message_scroller/preview.rb +33 -0
- data/app/components/poetry/ui/message_scroller/style.rb +39 -0
- data/app/components/poetry/ui/metadata_list/component.rb +88 -0
- data/app/components/poetry/ui/metadata_list/preview.rb +55 -0
- data/app/components/poetry/ui/metadata_list/style.rb +35 -0
- data/app/components/poetry/ui/meter/component.rb +117 -0
- data/app/components/poetry/ui/meter/preview.rb +28 -0
- data/app/components/poetry/ui/meter/style.rb +16 -0
- data/app/components/poetry/ui/native_select/component.rb +124 -0
- data/app/components/poetry/ui/native_select/labelled_preview.html.erb +7 -0
- data/app/components/poetry/ui/native_select/preview.rb +20 -0
- data/app/components/poetry/ui/native_select/style.rb +22 -0
- data/app/components/poetry/ui/navigation_menu/bar_preview.html.erb +14 -0
- data/app/components/poetry/ui/navigation_menu/component.html.erb +25 -0
- data/app/components/poetry/ui/navigation_menu/component.rb +254 -0
- data/app/components/poetry/ui/navigation_menu/preview.rb +20 -0
- data/app/components/poetry/ui/navigation_menu/style.rb +73 -0
- data/app/components/poetry/ui/navigation_menu/viewport_preview.html.erb +23 -0
- data/app/components/poetry/ui/number_field/component.html.erb +19 -0
- data/app/components/poetry/ui/number_field/component.rb +263 -0
- data/app/components/poetry/ui/number_field/preview.rb +66 -0
- data/app/components/poetry/ui/number_field/style.rb +14 -0
- data/app/components/poetry/ui/pagination/component.html.erb +40 -0
- data/app/components/poetry/ui/pagination/component.rb +182 -0
- data/app/components/poetry/ui/pagination/preview.rb +47 -0
- data/app/components/poetry/ui/pagination/style.rb +27 -0
- data/app/components/poetry/ui/popover/component.html.erb +17 -0
- data/app/components/poetry/ui/popover/component.rb +203 -0
- data/app/components/poetry/ui/popover/preview.html.erb +29 -0
- data/app/components/poetry/ui/popover/preview.rb +66 -0
- data/app/components/poetry/ui/popover/style.rb +26 -0
- data/app/components/poetry/ui/popper_consumer.rb +69 -0
- data/app/components/poetry/ui/progress/component.rb +95 -0
- data/app/components/poetry/ui/progress/preview.rb +22 -0
- data/app/components/poetry/ui/progress/style.rb +19 -0
- data/app/components/poetry/ui/questionnaire/component.html.erb +80 -0
- data/app/components/poetry/ui/questionnaire/component.rb +396 -0
- data/app/components/poetry/ui/questionnaire/preview.rb +99 -0
- data/app/components/poetry/ui/questionnaire/style.rb +53 -0
- data/app/components/poetry/ui/radio_group/component.html.erb +4 -0
- data/app/components/poetry/ui/radio_group/component.rb +323 -0
- data/app/components/poetry/ui/radio_group/preview.rb +109 -0
- data/app/components/poetry/ui/radio_group/style.rb +53 -0
- data/app/components/poetry/ui/resizable/component.html.erb +10 -0
- data/app/components/poetry/ui/resizable/component.rb +178 -0
- data/app/components/poetry/ui/resizable/preview.rb +42 -0
- data/app/components/poetry/ui/resizable/style.rb +30 -0
- data/app/components/poetry/ui/scroll_area/component.rb +76 -0
- data/app/components/poetry/ui/scroll_area/preview.rb +35 -0
- data/app/components/poetry/ui/scroll_area/style.rb +19 -0
- data/app/components/poetry/ui/search_field/component.html.erb +15 -0
- data/app/components/poetry/ui/search_field/component.rb +137 -0
- data/app/components/poetry/ui/search_field/preview.rb +23 -0
- data/app/components/poetry/ui/search_field/style.rb +18 -0
- data/app/components/poetry/ui/select/component.html.erb +15 -0
- data/app/components/poetry/ui/select/component.rb +639 -0
- data/app/components/poetry/ui/select/preview.rb +113 -0
- data/app/components/poetry/ui/select/style.rb +58 -0
- data/app/components/poetry/ui/sensitive_input/component.html.erb +29 -0
- data/app/components/poetry/ui/sensitive_input/component.rb +274 -0
- data/app/components/poetry/ui/sensitive_input/preview.rb +40 -0
- data/app/components/poetry/ui/sensitive_input/style.rb +49 -0
- data/app/components/poetry/ui/separator/component.rb +57 -0
- data/app/components/poetry/ui/separator/preview.rb +19 -0
- data/app/components/poetry/ui/separator/style.rb +15 -0
- data/app/components/poetry/ui/sheet/component.html.erb +21 -0
- data/app/components/poetry/ui/sheet/component.rb +97 -0
- data/app/components/poetry/ui/sheet/preview.rb +57 -0
- data/app/components/poetry/ui/sheet/style.rb +47 -0
- data/app/components/poetry/ui/sidebar/component.html.erb +20 -0
- data/app/components/poetry/ui/sidebar/component.rb +249 -0
- data/app/components/poetry/ui/sidebar/preview.rb +21 -0
- data/app/components/poetry/ui/sidebar/shell_preview.html.erb +47 -0
- data/app/components/poetry/ui/sidebar/style.rb +139 -0
- data/app/components/poetry/ui/skeleton/component.rb +39 -0
- data/app/components/poetry/ui/skeleton/preview.rb +22 -0
- data/app/components/poetry/ui/skeleton/style.rb +13 -0
- data/app/components/poetry/ui/slider/component.html.erb +13 -0
- data/app/components/poetry/ui/slider/component.rb +360 -0
- data/app/components/poetry/ui/slider/preview.rb +73 -0
- data/app/components/poetry/ui/slider/style.rb +55 -0
- data/app/components/poetry/ui/spinner/component.rb +58 -0
- data/app/components/poetry/ui/spinner/preview.rb +22 -0
- data/app/components/poetry/ui/spinner/style.rb +12 -0
- data/app/components/poetry/ui/stat/component.html.erb +13 -0
- data/app/components/poetry/ui/stat/component.rb +102 -0
- data/app/components/poetry/ui/stat/preview.rb +47 -0
- data/app/components/poetry/ui/stat/style.rb +29 -0
- data/app/components/poetry/ui/switch/component.html.erb +15 -0
- data/app/components/poetry/ui/switch/component.rb +136 -0
- data/app/components/poetry/ui/switch/preview.rb +66 -0
- data/app/components/poetry/ui/switch/style.rb +22 -0
- data/app/components/poetry/ui/table/component.html.erb +3 -0
- data/app/components/poetry/ui/table/component.rb +93 -0
- data/app/components/poetry/ui/table/preview.rb +96 -0
- data/app/components/poetry/ui/table/style.rb +26 -0
- data/app/components/poetry/ui/tabs/component.html.erb +10 -0
- data/app/components/poetry/ui/tabs/component.rb +253 -0
- data/app/components/poetry/ui/tabs/preview.rb +43 -0
- data/app/components/poetry/ui/tabs/style.rb +49 -0
- data/app/components/poetry/ui/tag_group/component.html.erb +8 -0
- data/app/components/poetry/ui/tag_group/component.rb +203 -0
- data/app/components/poetry/ui/tag_group/preview.rb +43 -0
- data/app/components/poetry/ui/tag_group/style.rb +29 -0
- data/app/components/poetry/ui/textarea/component.rb +64 -0
- data/app/components/poetry/ui/textarea/preview.rb +75 -0
- data/app/components/poetry/ui/textarea/style.rb +18 -0
- data/app/components/poetry/ui/time_field/component.html.erb +6 -0
- data/app/components/poetry/ui/time_field/component.rb +85 -0
- data/app/components/poetry/ui/time_field/preview.rb +40 -0
- data/app/components/poetry/ui/time_field/style.rb +30 -0
- data/app/components/poetry/ui/timeline/component.rb +134 -0
- data/app/components/poetry/ui/timeline/preview.rb +61 -0
- data/app/components/poetry/ui/timeline/style.rb +54 -0
- data/app/components/poetry/ui/toast/component.html.erb +24 -0
- data/app/components/poetry/ui/toast/component.rb +178 -0
- data/app/components/poetry/ui/toast/preview.rb +69 -0
- data/app/components/poetry/ui/toast/style.rb +33 -0
- data/app/components/poetry/ui/toast_trigger/addressed_preview.html.erb +12 -0
- data/app/components/poetry/ui/toast_trigger/component.html.erb +3 -0
- data/app/components/poetry/ui/toast_trigger/component.rb +82 -0
- data/app/components/poetry/ui/toast_trigger/default_preview.html.erb +11 -0
- data/app/components/poetry/ui/toast_trigger/preview.rb +19 -0
- data/app/components/poetry/ui/toaster/component.html.erb +1 -0
- data/app/components/poetry/ui/toaster/component.rb +99 -0
- data/app/components/poetry/ui/toaster/positions_preview.html.erb +24 -0
- data/app/components/poetry/ui/toaster/preview.rb +46 -0
- data/app/components/poetry/ui/toaster/stamp_preview.html.erb +15 -0
- data/app/components/poetry/ui/toaster/style.rb +26 -0
- data/app/components/poetry/ui/toggle/component.rb +120 -0
- data/app/components/poetry/ui/toggle/preview.rb +79 -0
- data/app/components/poetry/ui/toggle/style.rb +33 -0
- data/app/components/poetry/ui/toggle_group/component.html.erb +4 -0
- data/app/components/poetry/ui/toggle_group/component.rb +252 -0
- data/app/components/poetry/ui/toggle_group/preview.rb +143 -0
- data/app/components/poetry/ui/toggle_group/style.rb +33 -0
- data/app/components/poetry/ui/toolbar/component.rb +125 -0
- data/app/components/poetry/ui/toolbar/preview.rb +41 -0
- data/app/components/poetry/ui/toolbar/style.rb +20 -0
- data/app/components/poetry/ui/tooltip/component.html.erb +20 -0
- data/app/components/poetry/ui/tooltip/component.rb +185 -0
- data/app/components/poetry/ui/tooltip/preview.rb +74 -0
- data/app/components/poetry/ui/tooltip/previews/provider_row.html.erb +25 -0
- data/app/components/poetry/ui/tooltip/style.rb +24 -0
- data/app/components/poetry/ui/tree/component.html.erb +32 -0
- data/app/components/poetry/ui/tree/component.rb +233 -0
- data/app/components/poetry/ui/tree/preview.rb +55 -0
- data/app/components/poetry/ui/tree/style.rb +29 -0
- data/app/components/poetry/ui/typeset/component.rb +73 -0
- data/app/components/poetry/ui/typeset/preview.rb +45 -0
- data/app/components/poetry/ui/typeset/style.rb +15 -0
- data/app/controllers/poetry/ui/llms_controller.rb +28 -0
- data/app/helpers/poetry/ui/components_helper.rb +1794 -0
- data/app/helpers/poetry/ui/form_builder/type_inference.rb +117 -0
- data/app/helpers/poetry/ui/form_builder.rb +916 -0
- data/app/helpers/poetry/ui/optimistic_form_builder.rb +55 -0
- data/app/helpers/poetry/ui/toast_stream_actions.rb +27 -0
- data/config/component_descriptions.yml +96 -0
- data/config/component_registry.yml +12257 -0
- data/config/locales/en.yml +93 -0
- data/config/routes.rb +8 -0
- data/config/template_classes.txt +113 -0
- data/lib/generators/poetry/add/add_generator.rb +218 -0
- data/lib/generators/poetry/agent_rules/agent_rules_generator.rb +91 -0
- data/lib/generators/poetry/agents/agents_generator.rb +24 -0
- data/lib/generators/poetry/agents_section.rb +148 -0
- data/lib/generators/poetry/block/block_generator.rb +67 -0
- data/lib/generators/poetry/block/templates/action_bar.html.erb +45 -0
- data/lib/generators/poetry/block/templates/app_shell.html.erb +139 -0
- data/lib/generators/poetry/block/templates/data_index.html.erb +85 -0
- data/lib/generators/poetry/block/templates/destructive_panel.html.erb +26 -0
- data/lib/generators/poetry/block/templates/page_header.html.erb +25 -0
- data/lib/generators/poetry/block/templates/section_card.html.erb +42 -0
- data/lib/generators/poetry/block/templates/stepper.html.erb +79 -0
- data/lib/generators/poetry/block/templates/top_nav.html.erb +44 -0
- data/lib/generators/poetry/diff/diff_generator.rb +135 -0
- data/lib/generators/poetry/editor/editor_generator.rb +344 -0
- data/lib/generators/poetry/editor/templates/poetry-check-hook +81 -0
- data/lib/generators/poetry/install/install_generator.rb +364 -0
- data/lib/generators/poetry/pagination/pagination_generator.rb +76 -0
- data/lib/generators/poetry/pagination/templates/kaminari_paginator.html.erb +29 -0
- data/lib/generators/poetry/pagination/templates/poetry_link_renderer.rb +34 -0
- data/lib/generators/poetry/pagination/templates/poetry_pagy_helper.rb +28 -0
- data/lib/generators/poetry/recipes/agent_embed/app/javascript/controllers/agent_demo_controller.js +131 -0
- data/lib/generators/poetry/recipes/screen_data_index/app/controllers/orders_controller.rb +15 -0
- data/lib/generators/poetry/recipes/screen_data_index/app/views/orders/index.html.erb +7 -0
- data/lib/generators/poetry/recipes/screen_data_index/test/system/orders_index_test.rb +16 -0
- data/lib/generators/poetry/recipes/screen_settings/app/controllers/settings_controller.rb +14 -0
- data/lib/generators/poetry/recipes/screen_settings/app/views/settings/show.html.erb +9 -0
- data/lib/generators/poetry/recipes/screen_settings/test/system/settings_show_test.rb +16 -0
- data/lib/generators/poetry/scaffold_templates/scaffold_templates_generator.rb +60 -0
- data/lib/generators/poetry/scaffold_templates/templates/_form.html.erb.tt +77 -0
- data/lib/generators/poetry/scaffold_templates/templates/controller.rb.tt +78 -0
- data/lib/generators/poetry/scaffold_templates/templates/edit.html.erb.tt +14 -0
- data/lib/generators/poetry/scaffold_templates/templates/index.html.erb.tt +24 -0
- data/lib/generators/poetry/scaffold_templates/templates/new.html.erb.tt +11 -0
- data/lib/generators/poetry/scaffold_templates/templates/partial.html.erb.tt +13 -0
- data/lib/generators/poetry/scaffold_templates/templates/show.html.erb.tt +18 -0
- data/lib/generators/poetry/skill/skill_generator.rb +34 -0
- data/lib/generators/poetry/skill/templates/poetry-component/SKILL.md +58 -0
- data/lib/generators/poetry/skill/templates/poetry-component/references/anatomy.md +152 -0
- data/lib/generators/poetry/skill/templates/poetry-component/references/checklist.md +67 -0
- data/lib/generators/poetry/skill/templates/poetry-component/references/documentation.md +137 -0
- data/lib/generators/poetry/skill/templates/poetry-design/SKILL.md +56 -0
- data/lib/generators/poetry/skill/templates/poetry-design/references/audit.md +123 -0
- data/lib/generators/poetry/skill/templates/poetry-design/references/compose.md +73 -0
- data/lib/generators/poetry/skill/templates/poetry-design/references/figma.md +68 -0
- data/lib/generators/poetry/skill/templates/poetry-design/references/paper.md +56 -0
- data/lib/generators/poetry/skill/templates/poetry-design/references/study.md +47 -0
- data/lib/generators/poetry/skill/templates/poetry-design/references/theme.md +70 -0
- data/lib/generators/poetry/skills_section.rb +58 -0
- data/lib/poetry/ui/chat.rb +283 -0
- data/lib/poetry/ui/code_block_highlighter.rb +60 -0
- data/lib/poetry/ui/engine.rb +55 -0
- data/lib/poetry/ui/recipes.rb +157 -0
- data/lib/poetry/ui/testing/combobox.rb +167 -0
- data/lib/poetry/ui/testing/dialog.rb +73 -0
- data/lib/poetry/ui/testing/menu.rb +127 -0
- data/lib/poetry/ui/testing/registration.rb +58 -0
- data/lib/poetry/ui/testing/select.rb +147 -0
- data/lib/poetry/ui/testing/tester.rb +130 -0
- data/lib/poetry/ui/testing.rb +130 -0
- data/lib/poetry/ui/themes.rb +109 -0
- data/lib/poetry/ui/version.rb +8 -0
- data/lib/poetry/ui/webmcp.rb +91 -0
- data/lib/poetry/ui.rb +285 -0
- data/lib/poetry-ui.rb +5 -0
- data/lib/tasks/poetry/check.rake +73 -0
- data/lib/tasks/poetry/design.rake +293 -0
- data/lib/tasks/poetry/verify.rake +36 -0
- data/themes/default.css +1793 -0
- data/themes/luma.css +1764 -0
- data/themes/lyra.css +1768 -0
- data/themes/maia.css +1768 -0
- data/themes/mira.css +1760 -0
- data/themes/nova.css +1755 -0
- data/themes/rhea.css +1771 -0
- data/themes/sera.css +1757 -0
- data/themes/vega.css +1775 -0
- data/typeset/typeset.css +499 -0
- metadata +502 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
module Resizable
|
|
6
|
+
# The Resizable preview: the two-pane split (with the grip) and a
|
|
7
|
+
# nested two-axis layout.
|
|
8
|
+
class Preview < Poetry::Core::Preview::Base
|
|
9
|
+
def default
|
|
10
|
+
render_component(grip: true, class: "h-48 max-w-md rounded-lg border") do |group|
|
|
11
|
+
group.with_panel(default_size: 25, min_size: 15) do
|
|
12
|
+
tag.div("Sidebar", class: "flex h-full items-center justify-center p-6 text-sm")
|
|
13
|
+
end
|
|
14
|
+
group.with_panel do
|
|
15
|
+
tag.div("Content", class: "flex h-full items-center justify-center p-6 text-sm")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def nested
|
|
21
|
+
render_component(class: "h-48 max-w-md rounded-lg border") do |group|
|
|
22
|
+
group.with_panel(default_size: 40) do
|
|
23
|
+
tag.div("Left", class: "flex h-full items-center justify-center p-6 text-sm")
|
|
24
|
+
end
|
|
25
|
+
group.with_panel do
|
|
26
|
+
embed(nested_group)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def nested_group
|
|
34
|
+
Poetry::Ui::Resizable::Component.new(direction: :vertical).tap do |group|
|
|
35
|
+
group.with_panel { tag.div("Top", class: "flex h-full items-center justify-center p-6 text-sm") }
|
|
36
|
+
group.with_panel { tag.div("Bottom", class: "flex h-full items-center justify-center p-6 text-sm") }
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
module Resizable
|
|
6
|
+
# Style dictionary for the Resizable family. The GROUP's layout keys
|
|
7
|
+
# off data-orientation - aria-orientation is not permitted on a
|
|
8
|
+
# plain group container (an axe aria-allowed-attr violation). The
|
|
9
|
+
# handle keeps aria-[orientation] selectors (valid on
|
|
10
|
+
# role=separator).
|
|
11
|
+
class Style < Poetry::Core::Style
|
|
12
|
+
base "flex h-full w-full data-[orientation=vertical]:flex-col"
|
|
13
|
+
|
|
14
|
+
element :panel, "overflow-hidden"
|
|
15
|
+
|
|
16
|
+
element :handle, "relative flex w-px touch-none items-center justify-center bg-border " \
|
|
17
|
+
"cursor-col-resize aria-[orientation=horizontal]:cursor-row-resize " \
|
|
18
|
+
"ring-offset-background after:absolute after:inset-y-0 after:left-1/2 " \
|
|
19
|
+
"after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring " \
|
|
20
|
+
"focus-visible:outline-hidden aria-[orientation=horizontal]:h-px " \
|
|
21
|
+
"aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 " \
|
|
22
|
+
"aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full " \
|
|
23
|
+
"aria-[orientation=horizontal]:after:translate-x-0 " \
|
|
24
|
+
"aria-[orientation=horizontal]:after:-translate-y-1/2 " \
|
|
25
|
+
"[&[aria-orientation=horizontal]>div]:rotate-90"
|
|
26
|
+
element :grip, "cn-resizable-handle-icon z-10 flex shrink-0"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
# A bounded scroll region with themed scrollbars.
|
|
6
|
+
module ScrollArea
|
|
7
|
+
# A bounded, keyboard-reachable scroll region with themed
|
|
8
|
+
# scrollbars. Reach for it when content should scroll inside a fixed
|
|
9
|
+
# height or width. Deliberately NATIVE: scrollbar-width and
|
|
10
|
+
# scrollbar-color are Baseline CSS, so the platform's own scrollbars
|
|
11
|
+
# are styled and zero JS ships - scrolling, momentum, and keyboard
|
|
12
|
+
# support come from the browser.
|
|
13
|
+
#
|
|
14
|
+
# The viewport is focusable (tabindex=0) - a scrollable region a
|
|
15
|
+
# keyboard can't reach fails WCAG (the axe scrollable-region-focusable
|
|
16
|
+
# rule); label: names it (role=region + aria-label) and is required.
|
|
17
|
+
#
|
|
18
|
+
# @example A bounded list that scrolls
|
|
19
|
+
# render Poetry::Ui::ScrollArea::Component.new(label: "Tags", class: "h-72 w-48") do
|
|
20
|
+
# safe_join(tags.map { |tag| tag.name })
|
|
21
|
+
# end
|
|
22
|
+
class Component < Poetry::Core::Component
|
|
23
|
+
requires_content "what scrolls"
|
|
24
|
+
|
|
25
|
+
# Projected into the registry, llms.txt, and the agent surface.
|
|
26
|
+
AGENT_RULES = [
|
|
27
|
+
"Size the scroll area with classes (h-72 w-48, max-h-96) - content decides the overflow.",
|
|
28
|
+
"label: is REQUIRED - the viewport is focusable, and a focusable region needs a name " \
|
|
29
|
+
"(role=region + aria-label).",
|
|
30
|
+
"This is a NATIVE scroll surface - never bolt scroll JS onto it; " \
|
|
31
|
+
"use MessageScroller for chat transcripts."
|
|
32
|
+
].freeze
|
|
33
|
+
|
|
34
|
+
option :label, :string, required: true,
|
|
35
|
+
doc: "The region's accessible name (role=region + aria-label) - required, because a " \
|
|
36
|
+
"focusable region must be named."
|
|
37
|
+
|
|
38
|
+
part "scroll-area", "The bounding wrapper - size it with classes; content decides the overflow"
|
|
39
|
+
part "scroll-area-viewport", "The focusable native scroll region (role=region + tabindex=0) " \
|
|
40
|
+
"with themed platform scrollbars - zero JS"
|
|
41
|
+
|
|
42
|
+
# @api private
|
|
43
|
+
def before_render
|
|
44
|
+
raise ArgumentError, "ScrollArea requires label: (the region's accessible name)" if label.blank?
|
|
45
|
+
|
|
46
|
+
ensure_content!
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# @api private
|
|
50
|
+
def call
|
|
51
|
+
content_tag(:div, root_attributes.to_attributes) do
|
|
52
|
+
content_tag(:div, content, viewport_attributes)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @api private
|
|
57
|
+
def root_attributes
|
|
58
|
+
html_attributes.merge_if_not_set(
|
|
59
|
+
{ "data-slot" => "scroll-area" }.merge(component_data_attributes)
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# @api private
|
|
64
|
+
def viewport_attributes
|
|
65
|
+
{
|
|
66
|
+
"data-slot" => "scroll-area-viewport", "tabindex" => "0",
|
|
67
|
+
"role" => "region", "aria-label" => label,
|
|
68
|
+
"class" => css(:viewport)
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private :root_attributes, :viewport_attributes
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
module ScrollArea
|
|
6
|
+
# The ScrollArea preview: a vertical tag list and a horizontal strip -
|
|
7
|
+
# both overflow so the themed native scrollbars actually show.
|
|
8
|
+
class Preview < Poetry::Core::Preview::Base
|
|
9
|
+
def default
|
|
10
|
+
render_component(label: "Tags", class: "h-72 w-48 rounded-md border") do
|
|
11
|
+
tag.div(class: "p-4") do
|
|
12
|
+
safe_join([
|
|
13
|
+
tag.h4("Tags", class: "mb-4 text-sm leading-none font-medium"),
|
|
14
|
+
*(1..30).map do |n|
|
|
15
|
+
tag.div("v1.2.0-beta.#{n}", class: "border-b py-2 text-sm last:border-0")
|
|
16
|
+
end
|
|
17
|
+
])
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def horizontal
|
|
23
|
+
render_component(label: "Artwork strip", class: "w-96 rounded-md border") do
|
|
24
|
+
tag.div(class: "flex w-max gap-4 p-4") do
|
|
25
|
+
safe_join((1..8).map do |n|
|
|
26
|
+
tag.div("Artwork #{n}",
|
|
27
|
+
class: "flex h-32 w-40 shrink-0 items-center justify-center rounded-md bg-muted text-sm")
|
|
28
|
+
end)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
module ScrollArea
|
|
6
|
+
# Style dictionary for the ScrollArea family: overflow-auto +
|
|
7
|
+
# scrollbar-width/scrollbar-color (Baseline CSS) style the native
|
|
8
|
+
# scrollbars, so no scrollbar/thumb part dictionaries exist.
|
|
9
|
+
class Style < Poetry::Core::Style
|
|
10
|
+
base "relative"
|
|
11
|
+
|
|
12
|
+
element :viewport, "size-full rounded-[inherit] transition-[color,box-shadow] outline-none " \
|
|
13
|
+
"focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 " \
|
|
14
|
+
"overflow-auto [scrollbar-width:thin] " \
|
|
15
|
+
"[scrollbar-color:var(--color-border)_transparent]"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%# InputGroup anatomy: leading search glyph, the type=search control,
|
|
2
|
+
trailing clear affordance (hidden while empty). %>
|
|
3
|
+
<%= content_tag(:div, **root_attributes.to_attributes) do %>
|
|
4
|
+
<%= content_tag(:div, **Poetry::Core::HTML::Attributes.new(group_attributes).to_attributes) do %>
|
|
5
|
+
<%= content_tag(:div, **Poetry::Core::HTML::Attributes.new(addon_attributes(:start)).to_attributes) do %>
|
|
6
|
+
<%= render Poetry::Ui::Icon::Component.new(name: :search) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<%= tag.input(**input_attributes.to_attributes) %>
|
|
9
|
+
<%= content_tag(:div, **Poetry::Core::HTML::Attributes.new(addon_attributes(:end)).to_attributes) do %>
|
|
10
|
+
<%= render clear_button do %>
|
|
11
|
+
<%= render Poetry::Ui::Icon::Component.new(name: :x) %>
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
# A search input with a leading glyph and a clear affordance.
|
|
6
|
+
module SearchField
|
|
7
|
+
# A type=search input on the bordered group chrome - leading search
|
|
8
|
+
# glyph, trailing clear affordance. Escape CLEARS a non-empty field
|
|
9
|
+
# and is consumed (the NEXT press reaches the dismissal layer), an
|
|
10
|
+
# empty field lets it propagate; the clear button never steals focus
|
|
11
|
+
# (mobile keyboards stay up) and is not a tab stop - keyboard users
|
|
12
|
+
# already have Escape. Enter is never intercepted: native form
|
|
13
|
+
# submission is the Rails path. The native WebKit cancel affordance
|
|
14
|
+
# is suppressed so the clear button is the only one.
|
|
15
|
+
#
|
|
16
|
+
# @example
|
|
17
|
+
# render Poetry::Ui::SearchField::Component.new(name: "q", label: "Search", placeholder: "Search...")
|
|
18
|
+
class Component < Poetry::Core::Component
|
|
19
|
+
include Poetry::Ui::InputGroupField
|
|
20
|
+
|
|
21
|
+
# Projected into the registry, llms.txt, and the agent surface.
|
|
22
|
+
AGENT_RULES = [
|
|
23
|
+
"Search inputs are a SearchField (poetry_search_field) - never a bare Input with a " \
|
|
24
|
+
"hand-rolled clear button; Escape-clears and focus retention ride the controller.",
|
|
25
|
+
"Enter submits the surrounding form natively - wrap it in a form/turbo-frame for " \
|
|
26
|
+
"live search; listen for poetry:search-field:clear to reset results.",
|
|
27
|
+
"Pair with a Label/Field for the accessible name, or pass label: standalone."
|
|
28
|
+
].freeze
|
|
29
|
+
|
|
30
|
+
use_stimulus do
|
|
31
|
+
on :root do
|
|
32
|
+
controller(:search_field) { register }
|
|
33
|
+
end
|
|
34
|
+
on :input do
|
|
35
|
+
controller :search_field do
|
|
36
|
+
target :input
|
|
37
|
+
action :changed, on: :input
|
|
38
|
+
action :keydown, on: :keydown
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
# The clear affordance holds focus through pointerdown (never a
|
|
42
|
+
# tab stop) and clears on click.
|
|
43
|
+
on :clear do
|
|
44
|
+
controller :search_field do
|
|
45
|
+
target :clear
|
|
46
|
+
action :holdFocus, on: :pointerdown
|
|
47
|
+
action :clear, on: :click
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
option :name, :string, required: true, doc: "The form field name on the search input."
|
|
53
|
+
option :value, :string, doc: "The pre-filled query; presence unhides the clear affordance."
|
|
54
|
+
option :placeholder, :string, doc: "Hint text shown while the field is empty."
|
|
55
|
+
option :id, :string, doc: "The input's DOM id - what a Field label's for: must reference."
|
|
56
|
+
option :label, :string,
|
|
57
|
+
doc: "The accessible name (aria-label) for standalone use - or pair with a Label/Field instead."
|
|
58
|
+
option :described_by, :string, doc: "aria-describedby on the input - Field hint/error wiring."
|
|
59
|
+
option :disabled, :boolean, default: false, doc: "Disables the input and hides the clear affordance."
|
|
60
|
+
option :readonly, :boolean, default: false,
|
|
61
|
+
doc: "The query can be read but not edited; the clear affordance hides."
|
|
62
|
+
option :required, :boolean, default: false, doc: "Marks the input required for native constraint validation."
|
|
63
|
+
option :invalid, :boolean, default: false,
|
|
64
|
+
doc: "aria-invalid on the input - set by Field/FormBuilder from model errors."
|
|
65
|
+
|
|
66
|
+
part "search-field", "Root - the controller and the emptiness state ride here",
|
|
67
|
+
states: {
|
|
68
|
+
"data-empty" => "the input holds no text (server-set, controller-kept; hides " \
|
|
69
|
+
"the clear affordance)"
|
|
70
|
+
}
|
|
71
|
+
part "input-group-addon", "The leading search-glyph cell - InputGroup's addon " \
|
|
72
|
+
"vocabulary (the NumberField precedent)",
|
|
73
|
+
states: {
|
|
74
|
+
"data-align" => { condition: "always - inline-start holds the glyph, " \
|
|
75
|
+
"inline-end the clear button",
|
|
76
|
+
values: %w[inline-start inline-end] }
|
|
77
|
+
}
|
|
78
|
+
part "search-field-group", "The bordered field surface - InputGroup's chrome, focus " \
|
|
79
|
+
"ring keyed on the control inside"
|
|
80
|
+
part "input-group-control", "The native <input type=search> - InputGroup's control " \
|
|
81
|
+
"slot (the themes' focus-ring hook); WebKit's own cancel " \
|
|
82
|
+
"affordance suppressed"
|
|
83
|
+
# The clear affordance renders as a composed ghost Button carrying
|
|
84
|
+
# data-slot=search-field-clear on Button's root - part ownership
|
|
85
|
+
# attributes it to Button, so it is documented here in prose only:
|
|
86
|
+
# tabindex -1 (Escape is the keyboard path), hidden while empty,
|
|
87
|
+
# never steals focus.
|
|
88
|
+
|
|
89
|
+
# @api private
|
|
90
|
+
def root_attributes
|
|
91
|
+
attrs = {
|
|
92
|
+
"data-slot" => "search-field",
|
|
93
|
+
"class" => css
|
|
94
|
+
}.merge(component_data_attributes)
|
|
95
|
+
attrs["data-empty"] = "" if value.blank?
|
|
96
|
+
html_attributes.merge_if_not_set(attrs.merge(stimulus_attributes_for(:root)))
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# @api private
|
|
100
|
+
def input_attributes
|
|
101
|
+
attrs = Poetry::Core::HTML::Attributes.new(
|
|
102
|
+
"type" => "search",
|
|
103
|
+
"name" => name,
|
|
104
|
+
"id" => control_id,
|
|
105
|
+
"data-slot" => "input-group-control",
|
|
106
|
+
"class" => "#{Input::Style.css(class: InputGroup::Style.css(:control_input))} #{css(:input)}",
|
|
107
|
+
"autocomplete" => "off",
|
|
108
|
+
"autocorrect" => "off",
|
|
109
|
+
"spellcheck" => "false"
|
|
110
|
+
)
|
|
111
|
+
attrs["value"] = value if value.present?
|
|
112
|
+
attrs["placeholder"] = placeholder if placeholder.present?
|
|
113
|
+
attrs["aria-label"] = label if label.present?
|
|
114
|
+
attrs["aria-invalid"] = "true" if invalid && !disabled
|
|
115
|
+
attrs["aria-describedby"] = described_by if described_by.present?
|
|
116
|
+
attrs["disabled"] = "" if disabled
|
|
117
|
+
attrs["readonly"] = "" if readonly
|
|
118
|
+
attrs["required"] = "" if required
|
|
119
|
+
attrs.merge!(stimulus_attributes_for(:input))
|
|
120
|
+
attrs
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# The clear affordance: a ghost icon Button that is NEVER a tab
|
|
124
|
+
# stop and never steals focus.
|
|
125
|
+
# @api private
|
|
126
|
+
def clear_button
|
|
127
|
+
group_tool_button(slot: "search-field-clear",
|
|
128
|
+
label: t("poetry.search_field.clear"),
|
|
129
|
+
extra: { "hidden" => value.blank? || readonly || disabled ? "" : nil },
|
|
130
|
+
wiring: stimulus_attributes_for(:clear))
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
private :root_attributes, :input_attributes, :clear_button
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
module SearchField
|
|
6
|
+
class Preview < Poetry::Core::Preview::Base
|
|
7
|
+
def default
|
|
8
|
+
render_component(name: "q", label: "Search", placeholder: "Search…")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Non-empty: the clear affordance shows; Escape clears once, the
|
|
12
|
+
# next Escape reaches the dismissal layer.
|
|
13
|
+
def with_value
|
|
14
|
+
render_component(name: "q", label: "Search", value: "design tokens")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def disabled
|
|
18
|
+
render_component(name: "q", label: "Search", value: "locked", disabled: true)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Poetry
|
|
4
|
+
module Ui
|
|
5
|
+
module SearchField
|
|
6
|
+
# Utility-only: InputGroup + Input wear the chrome (the NumberField
|
|
7
|
+
# composition - zero new theme CSS). The input element only
|
|
8
|
+
# suppresses WebKit's native search affordances so poetry's clear
|
|
9
|
+
# button is the single clear path.
|
|
10
|
+
class Style < Poetry::Core::Style
|
|
11
|
+
base "flex w-full flex-col"
|
|
12
|
+
|
|
13
|
+
element :input, "[&::-webkit-search-cancel-button]:hidden " \
|
|
14
|
+
"[&::-webkit-search-decoration]:hidden"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%# The option union renders FIRST (into a capture) so the shared
|
|
2
|
+
OptionSet is populated before the native <select> and the trigger's
|
|
3
|
+
value display derive from it - one server-side truth, three surfaces. %>
|
|
4
|
+
<% listbox_body = capture do %>
|
|
5
|
+
<% items.each do |item| %><%= item %><% end %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<%= content_tag(:div, **root_attributes.to_attributes) do %>
|
|
8
|
+
<%= native_select %>
|
|
9
|
+
<%= trigger_button %>
|
|
10
|
+
<%= content_tag(:div, **Poetry::Core::HTML::Attributes.new(content_attributes).to_attributes) do %>
|
|
11
|
+
<%= scroll_button(:up) %>
|
|
12
|
+
<%= content_tag(:div, listbox_body, viewport_attributes) %>
|
|
13
|
+
<%= scroll_button(:down) %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|