shoelace-rails-ui 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +49 -22
  4. data/Rakefile +5 -13
  5. data/app/assets/config/shoelace_rails_ui_manifest.js +1 -0
  6. data/app/assets/javascripts/shoelace.js +300 -0
  7. data/app/assets/stylesheets/sl_styles_light.css +455 -0
  8. data/app/controllers/shoelace/rails/ui/application_controller.rb +8 -0
  9. data/app/helpers/shoelace/rails/ui/application_helper.rb +11 -0
  10. data/app/helpers/shoelace/rails/ui/form_helper.rb +442 -0
  11. data/app/jobs/shoelace/rails/ui/application_job.rb +8 -0
  12. data/app/mailers/shoelace/rails/ui/application_mailer.rb +10 -0
  13. data/app/models/shoelace/rails/ui/application_record.rb +9 -0
  14. data/app/views/layouts/shoelace/rails/ui/application.html.erb +15 -0
  15. data/config/routes.rb +2 -0
  16. data/lib/shoelace/rails/ui/engine.rb +15 -0
  17. data/lib/shoelace/rails/ui/version.rb +1 -3
  18. data/lib/shoelace/rails/ui.rb +2 -4
  19. data/lib/tasks/shoelace/rails/ui_tasks.rake +4 -0
  20. metadata +36 -334
  21. data/.DS_Store +0 -0
  22. data/CHANGELOG.md +0 -5
  23. data/CODE_OF_CONDUCT.md +0 -84
  24. data/Gemfile +0 -12
  25. data/Gemfile.lock +0 -42
  26. data/LICENSE.txt +0 -21
  27. data/README-real.md +0 -24
  28. data/bin/console +0 -15
  29. data/bin/setup +0 -8
  30. data/regenerate.rb +0 -48
  31. data/remote-src/.DS_Store +0 -0
  32. data/remote-src/2.0.0.beta64/.DS_Store +0 -0
  33. data/remote-src/2.0.0.beta64/shoelace-next/.editorconfig +0 -15
  34. data/remote-src/2.0.0.beta64/shoelace-next/.github/CODE_OF_CONDUCT.md +0 -44
  35. data/remote-src/2.0.0.beta64/shoelace-next/.github/FUNDING.yml +0 -1
  36. data/remote-src/2.0.0.beta64/shoelace-next/.github/ISSUE_TEMPLATE/bug_report.md +0 -36
  37. data/remote-src/2.0.0.beta64/shoelace-next/.github/ISSUE_TEMPLATE/config.yml +0 -4
  38. data/remote-src/2.0.0.beta64/shoelace-next/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  39. data/remote-src/2.0.0.beta64/shoelace-next/.github/SECURITY.md +0 -7
  40. data/remote-src/2.0.0.beta64/shoelace-next/.github/workflows/node.js.yml +0 -30
  41. data/remote-src/2.0.0.beta64/shoelace-next/.github/workflows/release.yml +0 -17
  42. data/remote-src/2.0.0.beta64/shoelace-next/.gitignore +0 -8
  43. data/remote-src/2.0.0.beta64/shoelace-next/.husky/pre-commit +0 -4
  44. data/remote-src/2.0.0.beta64/shoelace-next/.prettierignore +0 -12
  45. data/remote-src/2.0.0.beta64/shoelace-next/.vscode/extensions.json +0 -9
  46. data/remote-src/2.0.0.beta64/shoelace-next/.vscode/settings.json +0 -4
  47. data/remote-src/2.0.0.beta64/shoelace-next/CONTRIBUTING.md +0 -5
  48. data/remote-src/2.0.0.beta64/shoelace-next/LICENSE.md +0 -7
  49. data/remote-src/2.0.0.beta64/shoelace-next/README.md +0 -94
  50. data/remote-src/2.0.0.beta64/shoelace-next/cspell.json +0 -110
  51. data/remote-src/2.0.0.beta64/shoelace-next/custom-elements-manifest.config.js +0 -104
  52. data/remote-src/2.0.0.beta64/shoelace-next/docs/404.md +0 -5
  53. data/remote-src/2.0.0.beta64/shoelace-next/docs/_sidebar.md +0 -89
  54. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/icons/sprite.svg +0 -1
  55. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/chrome.png +0 -0
  56. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/edge.png +0 -0
  57. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/firefox.png +0 -0
  58. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/logo.svg +0 -7
  59. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/og-image.png +0 -0
  60. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/opera.png +0 -0
  61. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/safari.png +0 -0
  62. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/shoe.svg +0 -134
  63. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/tie.webp +0 -0
  64. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/touch-icon.png +0 -0
  65. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/twitter-card.png +0 -0
  66. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/undraw-content-team.svg +0 -80
  67. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/undraw-not-found.svg +0 -1
  68. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/walk.gif +0 -0
  69. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/wordmark.svg +0 -7
  70. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/code-block/code-block.css +0 -228
  71. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/code-block/code-block.js +0 -376
  72. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/metadata/metadata.js +0 -537
  73. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/scroll-position/scroll-position.js +0 -24
  74. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/search/lunr.min.js +0 -1311
  75. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/search/search.css +0 -180
  76. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/search/search.js +0 -293
  77. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/theme-picker/theme-picker.css +0 -29
  78. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/theme-picker/theme-picker.js +0 -83
  79. data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/styles/docs.css +0 -642
  80. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/alert.md +0 -441
  81. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/animated-image.md +0 -128
  82. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/animation.md +0 -351
  83. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/avatar.md +0 -201
  84. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/badge.md +0 -191
  85. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/breadcrumb-item.md +0 -35
  86. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/breadcrumb.md +0 -266
  87. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/button-group.md +0 -470
  88. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/button.md +0 -453
  89. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/card.md +0 -311
  90. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/checkbox.md +0 -71
  91. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/color-picker.md +0 -101
  92. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/details.md +0 -89
  93. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/dialog.md +0 -265
  94. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/divider.md +0 -152
  95. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/drawer.md +0 -452
  96. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/dropdown.md +0 -389
  97. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/format-bytes.md +0 -126
  98. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/format-date.md +0 -120
  99. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/format-number.md +0 -124
  100. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/icon-button.md +0 -160
  101. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/icon.md +0 -711
  102. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/image-comparer.md +0 -51
  103. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/include.md +0 -47
  104. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/input.md +0 -283
  105. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/menu-item.md +0 -255
  106. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/menu-label.md +0 -52
  107. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/menu.md +0 -49
  108. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/mutation-observer.md +0 -196
  109. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/progress-bar.md +0 -144
  110. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/progress-ring.md +0 -178
  111. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/qr-code.md +0 -167
  112. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/radio-group.md +0 -52
  113. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/radio.md +0 -59
  114. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/range.md +0 -180
  115. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/rating.md +0 -153
  116. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/relative-time.md +0 -105
  117. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/resize-observer.md +0 -68
  118. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/responsive-media.md +0 -73
  119. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/select.md +0 -457
  120. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/skeleton.md +0 -439
  121. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/spinner.md +0 -86
  122. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/split-panel.md +0 -671
  123. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/switch.md +0 -77
  124. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tab-group.md +0 -359
  125. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tab-panel.md +0 -41
  126. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tab.md +0 -29
  127. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tag.md +0 -142
  128. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/textarea.md +0 -184
  129. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tooltip.md +0 -410
  130. data/remote-src/2.0.0.beta64/shoelace-next/docs/components/visually-hidden.md +0 -47
  131. data/remote-src/2.0.0.beta64/shoelace-next/docs/frameworks/angular.md +0 -46
  132. data/remote-src/2.0.0.beta64/shoelace-next/docs/frameworks/react.md +0 -156
  133. data/remote-src/2.0.0.beta64/shoelace-next/docs/frameworks/vue.md +0 -92
  134. data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/customizing.md +0 -153
  135. data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/form-controls.md +0 -336
  136. data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/installation.md +0 -137
  137. data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/localization.md +0 -140
  138. data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/overview.md +0 -131
  139. data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/themes.md +0 -139
  140. data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/usage.md +0 -173
  141. data/remote-src/2.0.0.beta64/shoelace-next/docs/index.html +0 -98
  142. data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/accessibility.md +0 -18
  143. data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/changelog.md +0 -925
  144. data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/community.md +0 -53
  145. data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/contributing.md +0 -261
  146. data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/border-radius.md +0 -12
  147. data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/color.md +0 -439
  148. data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/elevation.md +0 -11
  149. data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/spacing.md +0 -16
  150. data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/transition.md +0 -11
  151. data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/typography.md +0 -58
  152. data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/z-index.md +0 -11
  153. data/remote-src/2.0.0.beta64/shoelace-next/docs/tutorials/integrating-with-laravel.md +0 -117
  154. data/remote-src/2.0.0.beta64/shoelace-next/docs/tutorials/integrating-with-nextjs.md +0 -137
  155. data/remote-src/2.0.0.beta64/shoelace-next/docs/tutorials/integrating-with-rails.md +0 -103
  156. data/remote-src/2.0.0.beta64/shoelace-next/lint-staged.config.js +0 -4
  157. data/remote-src/2.0.0.beta64/shoelace-next/package-lock.json +0 -9534
  158. data/remote-src/2.0.0.beta64/shoelace-next/package.json +0 -93
  159. data/remote-src/2.0.0.beta64/shoelace-next/prettier.config.cjs +0 -17
  160. data/remote-src/2.0.0.beta64/shoelace-next/scripts/build.js +0 -158
  161. data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-css.js +0 -42
  162. data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-icons.js +0 -71
  163. data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-metadata.js +0 -11
  164. data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-react.js +0 -63
  165. data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-search.js +0 -100
  166. data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-vscode-data.js +0 -58
  167. data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/plopfile.js +0 -67
  168. data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/component.hbs +0 -44
  169. data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/docs.hbs +0 -21
  170. data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/styles.hbs +0 -10
  171. data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/tests.hbs +0 -13
  172. data/remote-src/2.0.0.beta64/shoelace-next/scripts/shared.js +0 -18
  173. data/remote-src/2.0.0.beta64/shoelace-next/src/components/alert/alert.styles.ts +0 -95
  174. data/remote-src/2.0.0.beta64/shoelace-next/src/components/alert/alert.test.ts +0 -93
  175. data/remote-src/2.0.0.beta64/shoelace-next/src/components/alert/alert.ts +0 -238
  176. data/remote-src/2.0.0.beta64/shoelace-next/src/components/animated-image/animated-image.styles.ts +0 -52
  177. data/remote-src/2.0.0.beta64/shoelace-next/src/components/animated-image/animated-image.test.ts +0 -13
  178. data/remote-src/2.0.0.beta64/shoelace-next/src/components/animated-image/animated-image.ts +0 -120
  179. data/remote-src/2.0.0.beta64/shoelace-next/src/components/animation/animation.styles.ts +0 -10
  180. data/remote-src/2.0.0.beta64/shoelace-next/src/components/animation/animation.ts +0 -222
  181. data/remote-src/2.0.0.beta64/shoelace-next/src/components/animation/animations.ts +0 -15
  182. data/remote-src/2.0.0.beta64/shoelace-next/src/components/avatar/avatar.styles.ts +0 -66
  183. data/remote-src/2.0.0.beta64/shoelace-next/src/components/avatar/avatar.test.ts +0 -111
  184. data/remote-src/2.0.0.beta64/shoelace-next/src/components/avatar/avatar.ts +0 -83
  185. data/remote-src/2.0.0.beta64/shoelace-next/src/components/badge/badge.styles.ts +0 -94
  186. data/remote-src/2.0.0.beta64/shoelace-next/src/components/badge/badge.test.ts +0 -77
  187. data/remote-src/2.0.0.beta64/shoelace-next/src/components/badge/badge.ts +0 -53
  188. data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb/breadcrumb.styles.ts +0 -12
  189. data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb/breadcrumb.test.ts +0 -104
  190. data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb/breadcrumb.ts +0 -82
  191. data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb-item/breadcrumb-item.styles.ts +0 -85
  192. data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb-item/breadcrumb-item.test.ts +0 -160
  193. data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb-item/breadcrumb-item.ts +0 -92
  194. data/remote-src/2.0.0.beta64/shoelace-next/src/components/button/button.styles.ts +0 -637
  195. data/remote-src/2.0.0.beta64/shoelace-next/src/components/button/button.ts +0 -209
  196. data/remote-src/2.0.0.beta64/shoelace-next/src/components/button-group/button-group.styles.ts +0 -15
  197. data/remote-src/2.0.0.beta64/shoelace-next/src/components/button-group/button-group.ts +0 -84
  198. data/remote-src/2.0.0.beta64/shoelace-next/src/components/card/card.styles.ts +0 -62
  199. data/remote-src/2.0.0.beta64/shoelace-next/src/components/card/card.test.ts +0 -139
  200. data/remote-src/2.0.0.beta64/shoelace-next/src/components/card/card.ts +0 -68
  201. data/remote-src/2.0.0.beta64/shoelace-next/src/components/checkbox/checkbox.styles.ts +0 -108
  202. data/remote-src/2.0.0.beta64/shoelace-next/src/components/checkbox/checkbox.test.ts +0 -47
  203. data/remote-src/2.0.0.beta64/shoelace-next/src/components/checkbox/checkbox.ts +0 -203
  204. data/remote-src/2.0.0.beta64/shoelace-next/src/components/color-picker/color-picker.styles.ts +0 -326
  205. data/remote-src/2.0.0.beta64/shoelace-next/src/components/color-picker/color-picker.test.ts +0 -43
  206. data/remote-src/2.0.0.beta64/shoelace-next/src/components/color-picker/color-picker.ts +0 -853
  207. data/remote-src/2.0.0.beta64/shoelace-next/src/components/details/details.styles.ts +0 -73
  208. data/remote-src/2.0.0.beta64/shoelace-next/src/components/details/details.test.ts +0 -153
  209. data/remote-src/2.0.0.beta64/shoelace-next/src/components/details/details.ts +0 -192
  210. data/remote-src/2.0.0.beta64/shoelace-next/src/components/dialog/dialog.styles.ts +0 -106
  211. data/remote-src/2.0.0.beta64/shoelace-next/src/components/dialog/dialog.test.ts +0 -135
  212. data/remote-src/2.0.0.beta64/shoelace-next/src/components/dialog/dialog.ts +0 -296
  213. data/remote-src/2.0.0.beta64/shoelace-next/src/components/divider/divider.styles.ts +0 -25
  214. data/remote-src/2.0.0.beta64/shoelace-next/src/components/divider/divider.ts +0 -34
  215. data/remote-src/2.0.0.beta64/shoelace-next/src/components/drawer/drawer.styles.ts +0 -142
  216. data/remote-src/2.0.0.beta64/shoelace-next/src/components/drawer/drawer.test.ts +0 -135
  217. data/remote-src/2.0.0.beta64/shoelace-next/src/components/drawer/drawer.ts +0 -377
  218. data/remote-src/2.0.0.beta64/shoelace-next/src/components/dropdown/dropdown.styles.ts +0 -58
  219. data/remote-src/2.0.0.beta64/shoelace-next/src/components/dropdown/dropdown.test.ts +0 -147
  220. data/remote-src/2.0.0.beta64/shoelace-next/src/components/dropdown/dropdown.ts +0 -459
  221. data/remote-src/2.0.0.beta64/shoelace-next/src/components/format-bytes/format-bytes.ts +0 -35
  222. data/remote-src/2.0.0.beta64/shoelace-next/src/components/format-date/format-date.ts +0 -81
  223. data/remote-src/2.0.0.beta64/shoelace-next/src/components/format-number/format-number.ts +0 -69
  224. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/icon.styles.ts +0 -21
  225. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/icon.ts +0 -131
  226. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/library.default.ts +0 -9
  227. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/library.system.ts +0 -97
  228. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/library.ts +0 -49
  229. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/request.ts +0 -36
  230. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon-button/icon-button.styles.ts +0 -48
  231. data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon-button/icon-button.ts +0 -100
  232. data/remote-src/2.0.0.beta64/shoelace-next/src/components/image-comparer/image-comparer.styles.ts +0 -77
  233. data/remote-src/2.0.0.beta64/shoelace-next/src/components/image-comparer/image-comparer.ts +0 -147
  234. data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/include.styles.ts +0 -10
  235. data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/include.test.ts +0 -62
  236. data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/include.ts +0 -80
  237. data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/request.ts +0 -23
  238. data/remote-src/2.0.0.beta64/shoelace-next/src/components/input/input.styles.ts +0 -282
  239. data/remote-src/2.0.0.beta64/shoelace-next/src/components/input/input.test.ts +0 -35
  240. data/remote-src/2.0.0.beta64/shoelace-next/src/components/input/input.ts +0 -410
  241. data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu/menu.styles.ts +0 -18
  242. data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu/menu.ts +0 -205
  243. data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-item/menu-item.styles.ts +0 -84
  244. data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-item/menu-item.ts +0 -92
  245. data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-label/menu-label.styles.ts +0 -21
  246. data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-label/menu-label.ts +0 -30
  247. data/remote-src/2.0.0.beta64/shoelace-next/src/components/mutation-observer/mutation-observer.styles.ts +0 -10
  248. data/remote-src/2.0.0.beta64/shoelace-next/src/components/mutation-observer/mutation-observer.test.ts +0 -13
  249. data/remote-src/2.0.0.beta64/shoelace-next/src/components/mutation-observer/mutation-observer.ts +0 -118
  250. data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-bar/progress-bar.styles.ts +0 -57
  251. data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-bar/progress-bar.test.ts +0 -89
  252. data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-bar/progress-bar.ts +0 -74
  253. data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-ring/progress-ring.styles.ts +0 -66
  254. data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-ring/progress-ring.test.ts +0 -68
  255. data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-ring/progress-ring.ts +0 -84
  256. data/remote-src/2.0.0.beta64/shoelace-next/src/components/qr-code/qr-code.styles.ts +0 -22
  257. data/remote-src/2.0.0.beta64/shoelace-next/src/components/qr-code/qr-code.ts +0 -90
  258. data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio/radio.styles.ts +0 -107
  259. data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio/radio.test.ts +0 -65
  260. data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio/radio.ts +0 -226
  261. data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio-group/radio-group.styles.ts +0 -47
  262. data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio-group/radio-group.ts +0 -66
  263. data/remote-src/2.0.0.beta64/shoelace-next/src/components/range/range.styles.ts +0 -192
  264. data/remote-src/2.0.0.beta64/shoelace-next/src/components/range/range.ts +0 -273
  265. data/remote-src/2.0.0.beta64/shoelace-next/src/components/rating/rating.styles.ts +0 -79
  266. data/remote-src/2.0.0.beta64/shoelace-next/src/components/rating/rating.ts +0 -249
  267. data/remote-src/2.0.0.beta64/shoelace-next/src/components/relative-time/relative-time.ts +0 -116
  268. data/remote-src/2.0.0.beta64/shoelace-next/src/components/resize-observer/resize-observer.styles.ts +0 -10
  269. data/remote-src/2.0.0.beta64/shoelace-next/src/components/resize-observer/resize-observer.ts +0 -87
  270. data/remote-src/2.0.0.beta64/shoelace-next/src/components/responsive-media/responsive-media.styles.ts +0 -36
  271. data/remote-src/2.0.0.beta64/shoelace-next/src/components/responsive-media/responsive-media.ts +0 -50
  272. data/remote-src/2.0.0.beta64/shoelace-next/src/components/select/select.styles.ts +0 -331
  273. data/remote-src/2.0.0.beta64/shoelace-next/src/components/select/select.test.ts +0 -56
  274. data/remote-src/2.0.0.beta64/shoelace-next/src/components/select/select.ts +0 -560
  275. data/remote-src/2.0.0.beta64/shoelace-next/src/components/skeleton/skeleton.styles.ts +0 -60
  276. data/remote-src/2.0.0.beta64/shoelace-next/src/components/skeleton/skeleton.ts +0 -46
  277. data/remote-src/2.0.0.beta64/shoelace-next/src/components/spinner/spinner.styles.ts +0 -56
  278. data/remote-src/2.0.0.beta64/shoelace-next/src/components/spinner/spinner.test.ts +0 -24
  279. data/remote-src/2.0.0.beta64/shoelace-next/src/components/spinner/spinner.ts +0 -34
  280. data/remote-src/2.0.0.beta64/shoelace-next/src/components/split-panel/split-panel.styles.ts +0 -76
  281. data/remote-src/2.0.0.beta64/shoelace-next/src/components/split-panel/split-panel.test.ts +0 -13
  282. data/remote-src/2.0.0.beta64/shoelace-next/src/components/split-panel/split-panel.ts +0 -272
  283. data/remote-src/2.0.0.beta64/shoelace-next/src/components/switch/switch.styles.ts +0 -135
  284. data/remote-src/2.0.0.beta64/shoelace-next/src/components/switch/switch.test.ts +0 -64
  285. data/remote-src/2.0.0.beta64/shoelace-next/src/components/switch/switch.ts +0 -187
  286. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab/tab.styles.ts +0 -61
  287. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab/tab.ts +0 -104
  288. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-group/tab-group.styles.ts +0 -209
  289. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-group/tab-group.ts +0 -409
  290. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-panel/tab-panel.styles.ts +0 -17
  291. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-panel/tab-panel.ts +0 -49
  292. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tag/tag.styles.ts +0 -110
  293. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tag/tag.ts +0 -92
  294. data/remote-src/2.0.0.beta64/shoelace-next/src/components/textarea/textarea.styles.ts +0 -167
  295. data/remote-src/2.0.0.beta64/shoelace-next/src/components/textarea/textarea.test.ts +0 -35
  296. data/remote-src/2.0.0.beta64/shoelace-next/src/components/textarea/textarea.ts +0 -339
  297. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tooltip/tooltip.styles.ts +0 -131
  298. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tooltip/tooltip.test.ts +0 -117
  299. data/remote-src/2.0.0.beta64/shoelace-next/src/components/tooltip/tooltip.ts +0 -355
  300. data/remote-src/2.0.0.beta64/shoelace-next/src/components/visually-hidden/visually-hidden.styles.ts +0 -18
  301. data/remote-src/2.0.0.beta64/shoelace-next/src/components/visually-hidden/visually-hidden.test.ts +0 -39
  302. data/remote-src/2.0.0.beta64/shoelace-next/src/components/visually-hidden/visually-hidden.ts +0 -24
  303. data/remote-src/2.0.0.beta64/shoelace-next/src/declaration.d.ts +0 -8
  304. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/animate.ts +0 -70
  305. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/event.ts +0 -35
  306. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/focus-visible.ts +0 -26
  307. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/form-control.ts +0 -203
  308. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/formdata-event-polyfill.ts +0 -93
  309. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/math.ts +0 -8
  310. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/modal.ts +0 -53
  311. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/number.ts +0 -32
  312. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/offset.ts +0 -13
  313. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/scroll.ts +0 -57
  314. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/slot.ts +0 -91
  315. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/string.ts +0 -3
  316. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/support.ts +0 -15
  317. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/tabbable.ts +0 -81
  318. data/remote-src/2.0.0.beta64/shoelace-next/src/internal/watch.ts +0 -40
  319. data/remote-src/2.0.0.beta64/shoelace-next/src/shoelace.ts +0 -58
  320. data/remote-src/2.0.0.beta64/shoelace-next/src/styles/component.styles.ts +0 -23
  321. data/remote-src/2.0.0.beta64/shoelace-next/src/styles/form-control.styles.ts +0 -52
  322. data/remote-src/2.0.0.beta64/shoelace-next/src/styles/utility.styles.ts +0 -23
  323. data/remote-src/2.0.0.beta64/shoelace-next/src/themes/dark.styles.ts +0 -524
  324. data/remote-src/2.0.0.beta64/shoelace-next/src/themes/light.styles.ts +0 -524
  325. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/de-ch.ts +0 -21
  326. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/de.ts +0 -21
  327. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/en.ts +0 -21
  328. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/es.ts +0 -21
  329. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/fr.ts +0 -21
  330. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/he.ts +0 -21
  331. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/ja.ts +0 -21
  332. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/nl.ts +0 -21
  333. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/pl.ts +0 -21
  334. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/pt.ts +0 -21
  335. data/remote-src/2.0.0.beta64/shoelace-next/src/translations/ru.ts +0 -21
  336. data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/animation-registry.ts +0 -59
  337. data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/animation.ts +0 -1
  338. data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/base-path.ts +0 -43
  339. data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/form.ts +0 -22
  340. data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/icon-library.ts +0 -1
  341. data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/localize.ts +0 -5
  342. data/remote-src/2.0.0.beta64/shoelace-next/tsconfig.json +0 -35
  343. data/remote-src/2.0.0.beta64/shoelace-next/vercel.json +0 -4
  344. data/remote-src/2.0.0.beta64/shoelace-next/web-test-runner.config.js +0 -14
  345. data/shoelace-rails-ui.gemspec +0 -39
  346. data/shoelace-rails-ui.rb +0 -0
@@ -0,0 +1,442 @@
1
+ # frozen_string_literal: true
2
+
3
+ # CREDIT: FORKED FROM https://github.com/yuki24/shoelace-rails/blob/main/app/helpers/shoelace/form_helper.rb
4
+ # The MIT License (MIT)
5
+
6
+ # Copyright (c) 2021 Yuki Nishijima
7
+
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+
26
+ module Shoelace
27
+ module Rails
28
+ module Ui
29
+ module FormHelper
30
+ class ShoelaceInputField < ActionView::Helpers::Tags::TextField #:nodoc:
31
+ attr_reader :field_type
32
+
33
+ def initialize(field_type, *args)
34
+ super(*args)
35
+ @field_type = field_type
36
+ end
37
+
38
+ def render(&block)
39
+ options = @options.stringify_keys
40
+
41
+ value = options.fetch("value") { value_before_type_cast }
42
+ options["value"] = value if value.present?
43
+
44
+ options["size"] = options["maxlength"] unless options.key?("size")
45
+ options["type"] ||= field_type
46
+ options["invalid"] = options.fetch("invalid") { @object.errors[@method_name].presence }
47
+ add_default_name_and_id(options)
48
+
49
+ @template_object.content_tag('sl-input', '', options, &block)
50
+ end
51
+ end
52
+
53
+ class ShoelaceColorPicker < ActionView::Helpers::Tags::ColorField #:nodoc:
54
+ RGB_VALUE_REGEX = /#[0-9a-fA-F]{6}/
55
+
56
+ def field_type; nil; end
57
+
58
+ def tag(tag_name, *args, &block)
59
+ tag_name.to_s == 'input' ? content_tag('sl-color-picker', '', *args, &block) : super
60
+ end
61
+
62
+ private
63
+
64
+ def validate_color_string(string)
65
+ string.downcase if RGB_VALUE_REGEX.match?(string)
66
+ end
67
+ end
68
+
69
+ class ShoelaceRange < ActionView::Helpers::Tags::NumberField #:nodoc:
70
+ def field_type; nil; end
71
+
72
+ def tag(tag_name, *args, &block)
73
+ tag_name.to_s == 'input' ? content_tag('sl-range', '', *args, &block) : super
74
+ end
75
+ end
76
+
77
+ class ShoelaceSwitch < ActionView::Helpers::Tags::TextField #:nodoc:
78
+ def field_type; nil; end
79
+
80
+ def render(&block)
81
+ options = @options.stringify_keys
82
+ options["value"] = options.fetch("value") { value_before_type_cast }
83
+ add_default_name_and_id(options)
84
+
85
+ @template_object.content_tag('sl-switch', @method_name.to_s.humanize, options, &block)
86
+ end
87
+ end
88
+
89
+ class ShoelaceTextArea < ActionView::Helpers::Tags::TextArea #:nodoc:
90
+ def content_tag(tag_name, content, options)
91
+ options[:value] = content if content.present?
92
+
93
+ tag_name.to_s == 'textarea' ? super('sl-textarea', '', options) : super
94
+ end
95
+ end
96
+
97
+ class ShoelaceSelect < ActionView::Helpers::Tags::Select #:nodoc:
98
+ def grouped_options_for_select(grouped_options, options)
99
+ @template_object.grouped_sl_options_for_select(grouped_options, options)
100
+ end
101
+
102
+ def options_for_select(container, options = nil)
103
+ @template_object.sl_options_for_select(container, options)
104
+ end
105
+
106
+ def select_content_tag(option_tags, _options, html_options)
107
+ html_options = html_options.stringify_keys
108
+ html_options['value']= value
109
+ add_default_name_and_id(html_options)
110
+
111
+ @template_object.content_tag("sl-select", option_tags, html_options)
112
+ end
113
+ end
114
+
115
+ class ShoelaceCollectionSelect < ActionView::Helpers::Tags::CollectionSelect #:nodoc:
116
+ def options_from_collection_for_select(collection, value_method, text_method, selected = nil)
117
+ @template_object.sl_options_from_collection_for_select(collection, value_method, text_method, selected)
118
+ end
119
+
120
+ def select_content_tag(option_tags, _options, html_options)
121
+ html_options = html_options.stringify_keys
122
+ html_options['value']= value
123
+ add_default_name_and_id(html_options)
124
+
125
+ @template_object.content_tag("sl-select", option_tags, html_options)
126
+ end
127
+ end
128
+
129
+ class ShoelaceCheckBox < ActionView::Helpers::Tags::CheckBox #:nodoc:
130
+ def render(&block)
131
+ options = @options.stringify_keys
132
+ options["value"] = @checked_value
133
+ options["checked"] = true if input_checked?(options)
134
+
135
+ if options["multiple"]
136
+ add_default_name_and_id_for_value(@checked_value, options)
137
+ options.delete("multiple")
138
+ else
139
+ add_default_name_and_id(options)
140
+ end
141
+
142
+ if block_given?
143
+ @template_object.content_tag('sl-checkbox', '', options, &block)
144
+ else
145
+ @template_object.content_tag('sl-checkbox', @method_name.to_s.humanize, options)
146
+ end
147
+ end
148
+ end
149
+
150
+ class ShoelaceRadioButton < ActionView::Helpers::Tags::RadioButton #:nodoc:
151
+ def render(&block)
152
+ options = @options.stringify_keys
153
+ options["value"] = @tag_value
154
+ options["checked"] = "checked" if input_checked?(options)
155
+ add_default_name_and_id_for_value(@tag_value, options)
156
+
157
+ @template_object.content_tag('sl-radio', '', options.except("type"), &block)
158
+ end
159
+ end
160
+
161
+ class ShoelaceCollectionRadioButtons < ActionView::Helpers::Tags::CollectionRadioButtons #:nodoc:
162
+ class RadioButtonBuilder < Builder # :nodoc:
163
+ def label(*)
164
+ text
165
+ end
166
+
167
+ def radio_button(extra_html_options = {}, &block)
168
+ html_options = extra_html_options.merge(@input_html_options)
169
+ html_options[:skip_default_ids] = false
170
+ @template_object.sl_radio_button(@object_name, @method_name, @value, html_options, &block)
171
+ end
172
+ end
173
+
174
+ def render(&block)
175
+ render_collection_for(RadioButtonBuilder, &block)
176
+ end
177
+
178
+ private
179
+
180
+ def render_collection(&block)
181
+ @template_object.content_tag('sl-radio-group', 'label' => @method_name.to_s.humanize) { super(&block) }
182
+ end
183
+
184
+ def hidden_field
185
+ ''.html_safe
186
+ end
187
+
188
+ def render_component(builder)
189
+ builder.radio_button { builder.label }
190
+ end
191
+ end
192
+
193
+ class ShoelaceFormBuilder < ActionView::Helpers::FormBuilder #:nodoc:
194
+ {
195
+ email: :email,
196
+ number: :number,
197
+ password: :password,
198
+ search: :search,
199
+ telephone: :tel,
200
+ phone: :tel,
201
+ text: :text,
202
+ url: :url
203
+ }.each do |field_type, field_class|
204
+ # def email_field(method, **options, &block)
205
+ # ShoelaceInputField.new(:email, object_name, method, @template, options.with_defaults(label: method.to_s.humanize)).render(&block)
206
+ # end
207
+ eval <<-RUBY, nil, __FILE__, __LINE__ + 1
208
+ def #{field_type}_field(method, **options, &block)
209
+ ShoelaceInputField.new(:#{field_class}, object_name, method, @template, options.with_defaults(object: @object, label: method.to_s.humanize)).render(&block)
210
+ end
211
+ RUBY
212
+ end
213
+
214
+ def color_field(method, **options)
215
+ ShoelaceColorPicker.new(object_name, method, @template, options.with_defaults(object: @object)).render
216
+ end
217
+ alias color_picker color_field
218
+
219
+ def range_field(method, **options)
220
+ ShoelaceRange.new(object_name, method, @template, options.with_defaults(object: @object)).render
221
+ end
222
+ alias range range_field
223
+
224
+ def switch_field(method, **options, &block)
225
+ ShoelaceSwitch.new(object_name, method, @template, options.with_defaults(object: @object)).render(&block)
226
+ end
227
+ alias switch switch_field
228
+
229
+ def text_area(method, **options)
230
+ ShoelaceTextArea.new(object_name, method, @template, options.with_defaults(object: @object, resize: 'auto')).render
231
+ end
232
+
233
+ def check_box(method, options = {}, checked_value = "1", unchecked_value = "0", &block)
234
+ ShoelaceCheckBox.new(object_name, method, @template, checked_value, unchecked_value, options.merge(object: @object)).render(&block)
235
+ end
236
+
237
+ def select(method, choices = nil, options = {}, html_options = {}, &block)
238
+ ShoelaceSelect.new(object_name, method, @template, choices, options.with_defaults(object: @object), html_options, &block).render
239
+ end
240
+
241
+ def collection_select(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
242
+ ShoelaceCollectionSelect.new(object_name, method, @template, collection, value_method, text_method, options.with_defaults(object: @object), html_options, &block).render
243
+ end
244
+
245
+ def collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
246
+ ShoelaceCollectionRadioButtons.new(object_name, method, @template, collection, value_method, text_method, options.with_defaults(object: @object), html_options).render(&block)
247
+ end
248
+
249
+ def submit(value = nil, options = {})
250
+ value, options = nil, value if value.is_a?(Hash)
251
+
252
+ @template.sl_submit_tag(value || submit_default_value, **options)
253
+ end
254
+ end
255
+
256
+ DEFAULT_FORM_PARAMETERS = {
257
+ builder: ShoelaceFormBuilder,
258
+ data: {
259
+ remote: true,
260
+ }
261
+ }
262
+
263
+ DEFAULT_TURBO_FORM_PARAMETERS = {
264
+ builder: ShoelaceFormBuilder,
265
+ }
266
+
267
+ DIVIDER_TAG = "<sl-divider></sl-divider>".html_safe
268
+ OPENING_SL_FORM_TAG = '<sl-form'.html_safe
269
+ CLOSING_SL_FORM_TAG = '</sl-form>'.html_safe
270
+ OPENING_SL_TURBO_FORM_TAG = '<sl-turbo-form'.html_safe
271
+ CLOSING_SL_TURBO_FORM_TAG = '</sl-turbo-form>'.html_safe
272
+
273
+ private_constant :DEFAULT_FORM_PARAMETERS, :DIVIDER_TAG, :OPENING_SL_FORM_TAG, :CLOSING_SL_FORM_TAG, :OPENING_SL_TURBO_FORM_TAG, :CLOSING_SL_TURBO_FORM_TAG
274
+
275
+ def sl_form_for(*args, **options, &block)
276
+ content = form_for(*args, **DEFAULT_FORM_PARAMETERS.deep_merge(options), &block)
277
+ content[0, 5] = OPENING_SL_FORM_TAG
278
+ content[-7, 7] = CLOSING_SL_FORM_TAG
279
+ content
280
+ end
281
+
282
+ def sl_form_with(**args, &block)
283
+ content = form_with(**args, **DEFAULT_FORM_PARAMETERS.except(:data), &block)
284
+ content[0, 5] = OPENING_SL_FORM_TAG
285
+ content[-7, 7] = CLOSING_SL_FORM_TAG
286
+ content
287
+ end
288
+
289
+ def sl_form_tag(url_for_options = {}, options = {}, &block)
290
+ content = form_tag(url_for_options, options.with_defaults(DEFAULT_FORM_PARAMETERS.except(:builder)), &block)
291
+ content[0, 5] = OPENING_SL_FORM_TAG
292
+ content[-7, 7] = CLOSING_SL_FORM_TAG
293
+ content
294
+ end
295
+
296
+ def sl_turbo_form_for(*args, **options, &block)
297
+ content = form_for(*args, **DEFAULT_TURBO_FORM_PARAMETERS.deep_merge(options), &block)
298
+ content[0, 5] = OPENING_SL_TURBO_FORM_TAG
299
+ content[-7, 7] = CLOSING_SL_TURBO_FORM_TAG
300
+ content
301
+ end
302
+
303
+ def sl_turbo_form_with(**args, &block)
304
+ content = form_with(**args, **DEFAULT_TURBO_FORM_PARAMETERS.except(:data), &block)
305
+ content[0, 5] = OPENING_SL_TURBO_FORM_TAG
306
+ content[-7, 7] = CLOSING_SL_TURBO_FORM_TAG
307
+ content
308
+ end
309
+
310
+ def sl_turbo_form_tag(url_for_options = {}, options = {}, &block)
311
+ content = form_tag(url_for_options, options.with_defaults(DEFAULT_TURBO_FORM_PARAMETERS.except(:builder)), &block)
312
+ content[0, 5] = OPENING_SL_TURBO_FORM_TAG
313
+ content[-7, 7] = CLOSING_SL_TURBO_FORM_TAG
314
+ content
315
+ end
316
+
317
+ # Creates a generic +<sl-button>+ element.
318
+ def sl_button_tag(**attrs, &block)
319
+ content_tag("sl-button", **attrs, &block)
320
+ end
321
+
322
+ # Not providing this helper for now due to potentially untraceable HTML. E.g.
323
+ #
324
+ # <a href="...">
325
+ # <sl-button>...</sl-button>
326
+ # </a>
327
+ #
328
+ # may be trackable and traceable by search bots and scrapers, but:
329
+ #
330
+ # <sl-button href="...">...</sl-button>
331
+ #
332
+ # may not be. In the mean time, it is advisable to wrap a <sl-button> tag with an <a> tag.
333
+ #
334
+ # def sl_button_to(href, **attrs, &block)
335
+ # sl_button_tag(href: href, **attrs, &block)
336
+ # end
337
+
338
+ # Creates a submit button with the text value as the caption, with the +submit+ attribute.
339
+ def sl_submit_tag(value = 'Save changes', **options)
340
+ options = options.deep_stringify_keys
341
+ tag_options = { "submit" => true, "type" => "primary" }.update(options)
342
+ set_default_disable_with(value, tag_options)
343
+
344
+ content_tag('sl-button', value, tag_options)
345
+ end
346
+
347
+ # Creates a shoelace text field; use these text fields to input smaller chunks of text like a username or a search
348
+ # query.
349
+ #
350
+ # For the properties available on this tag, please refer to the official documentation:
351
+ # https://shoelace.style/components/input?id=properties
352
+ #
353
+ def sl_text_field_tag(name, value = nil, **options, &block)
354
+ content_tag('sl-input', '', { "type" => "text", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys), &block)
355
+ end
356
+
357
+ # Returns a string of +<sl-menu-item>+ tags, like +options_for_select+, but prepends a +<sl-menu-label>+ tag to
358
+ # each group.
359
+ def grouped_sl_options_for_select(grouped_options, options)
360
+ body = "".html_safe
361
+
362
+ grouped_options.each_with_index do |container, index|
363
+ label, values = container
364
+
365
+ body.safe_concat(DIVIDER_TAG) if index > 0
366
+ body.safe_concat(content_tag("sl-menu-label", label)) if label.present?
367
+ body.safe_concat(sl_options_for_select(values, options))
368
+ end
369
+
370
+ body
371
+ end
372
+
373
+ # Accepts an enumerable (hash, array, enumerable, your type) and returns a string of +sl-menu-item+ tags. Given
374
+ # an enumerable where the elements respond to +first+ and +last+ (such as a two-element array), the “lasts” serve
375
+ # as option values and the “firsts” as option text.
376
+ def sl_options_for_select(enumerable, options = nil)
377
+ return enumerable if String === enumerable
378
+
379
+ selected, disabled = extract_selected_and_disabled(options).map { |r| Array(r).map(&:to_s) }
380
+
381
+ enumerable.map do |element|
382
+ html_attributes = option_html_attributes(element)
383
+ text, value = option_text_and_value(element).map(&:to_s)
384
+
385
+ html_attributes[:checked] ||= selected.include?(value)
386
+ html_attributes[:disabled] ||= disabled.include?(value)
387
+ html_attributes[:value] = value
388
+
389
+ tag_builder.content_tag_string('sl-menu-item', text, html_attributes)
390
+ end.join("\n").html_safe
391
+ end
392
+
393
+ # Returns a string of +<sl-menu-item>+ tags compiled by iterating over the collection and assigning the result of
394
+ # a call to the +value_method+ as the option value and the +text_method+ as the option text.
395
+ def sl_options_from_collection_for_select(collection, value_method, text_method, selected = nil)
396
+ options = collection.map do |element|
397
+ [value_for_collection(element, text_method), value_for_collection(element, value_method), option_html_attributes(element)]
398
+ end
399
+
400
+ selected, disabled = extract_selected_and_disabled(selected)
401
+
402
+ select_deselect = {
403
+ selected: extract_values_from_collection(collection, value_method, selected),
404
+ disabled: extract_values_from_collection(collection, value_method, disabled)
405
+ }
406
+
407
+ sl_options_for_select(options, select_deselect)
408
+ end
409
+
410
+ # Returns a +<sl-radio>+ tag for accessing a specified attribute (identified by method) on an object assigned to
411
+ # the template (identified by object). If the current value of method is +tag_value+ the radio button will be
412
+ # checked.
413
+ #
414
+ # To force the radio button to be checked pass checked: true in the options hash. You may pass HTML options there
415
+ # as well.
416
+ def sl_radio_button(object_name, method, tag_value, options = {}, &block)
417
+ ShoelaceRadioButton.new(object_name, method, self, tag_value, options).render(&block)
418
+ end
419
+
420
+ {
421
+ email: :email,
422
+ number: :number,
423
+ password: :password,
424
+ search: :search,
425
+ telephone: :tel,
426
+ phone: :tel,
427
+ url: :url
428
+ }.each do |field_type, field_class|
429
+ # def sl_email_field_tag(method, **options, &block)
430
+ # sl_text_field_tag(name, value, options.merge(type: :email))
431
+ # end
432
+ eval <<-RUBY, nil, __FILE__, __LINE__ + 1
433
+ # Creates a text field of type “#{field_type}”.
434
+ def sl_#{field_type}_field_tag(method, **options, &block)
435
+ sl_text_field_tag(name, value, options.merge(type: :#{field_class}))
436
+ end
437
+ RUBY
438
+ end
439
+ end
440
+ end
441
+ end
442
+ end
@@ -0,0 +1,8 @@
1
+ module Shoelace
2
+ module Rails
3
+ module Ui
4
+ class ApplicationJob < ActiveJob::Base
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module Shoelace
2
+ module Rails
3
+ module Ui
4
+ class ApplicationMailer < ActionMailer::Base
5
+ default from: "from@example.com"
6
+ layout "mailer"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Shoelace
2
+ module Rails
3
+ module Ui
4
+ class ApplicationRecord < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Shoelace rails ui</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "shoelace/rails/ui/application", media: "all" %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Shoelace::Rails::Ui::Engine.routes.draw do
2
+ end
@@ -0,0 +1,15 @@
1
+ module Shoelace
2
+ module Rails
3
+ module Ui
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Shoelace::Rails::Ui
6
+ initializer 'local_helper.action_controller' do
7
+ ActiveSupport.on_load :action_controller do
8
+ helper Shoelace::Rails::Ui::ApplicationHelper
9
+ helper Shoelace::Rails::Ui::FormHelper
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,9 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Shoelace
4
2
  module Rails
5
3
  module Ui
6
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
7
5
  end
8
6
  end
9
7
  end
@@ -1,11 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "ui/version"
1
+ require "shoelace/rails/ui/version"
2
+ require "shoelace/rails/ui/engine"
4
3
 
5
4
  module Shoelace
6
5
  module Rails
7
6
  module Ui
8
- class Error < StandardError; end
9
7
  # Your code goes here...
10
8
  end
11
9
  end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :shoelace_rails_ui do
3
+ # # Task goes here
4
+ # end