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
@@ -1,203 +0,0 @@
1
- import { html, ReactiveController, ReactiveControllerHost, TemplateResult } from 'lit';
2
- import { classMap } from 'lit/directives/class-map.js';
3
- import { ifDefined } from 'lit/directives/if-defined.js';
4
- import './formdata-event-polyfill';
5
-
6
- export interface FormSubmitControllerOptions {
7
- /** A function that returns the form containing the form control. */
8
- form: (input: unknown) => HTMLFormElement;
9
- /** A function that returns the form control's name, which will be submitted with the form data. */
10
- name: (input: unknown) => string;
11
- /** A function that returns the form control's current value. */
12
- value: (input: unknown) => any;
13
- /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */
14
- disabled: (input: unknown) => boolean;
15
- /**
16
- * A function that maps to the form control's reportValidity() function. When the control is invalid, this will
17
- * prevent submission and trigger the browser's constraint violation warning.
18
- */
19
- reportValidity: (input: unknown) => boolean;
20
- }
21
-
22
- export class FormSubmitController implements ReactiveController {
23
- host?: ReactiveControllerHost & Element;
24
- form?: HTMLFormElement;
25
- options?: FormSubmitControllerOptions;
26
-
27
- constructor(host: ReactiveControllerHost & Element, options?: FormSubmitControllerOptions) {
28
- (this.host = host).addController(this);
29
- this.options = Object.assign(
30
- {
31
- form: (input: HTMLInputElement) => input.closest('form'),
32
- name: (input: HTMLInputElement) => input.name,
33
- value: (input: HTMLInputElement) => input.value,
34
- disabled: (input: HTMLInputElement) => input.disabled,
35
- reportValidity: (input: HTMLInputElement) => {
36
- return typeof input.reportValidity === 'function' ? input.reportValidity() : true;
37
- }
38
- },
39
- options
40
- );
41
- this.handleFormData = this.handleFormData.bind(this);
42
- this.handleFormSubmit = this.handleFormSubmit.bind(this);
43
- }
44
-
45
- hostConnected() {
46
- this.form = this.options?.form(this.host);
47
-
48
- if (this.form) {
49
- this.form.addEventListener('formdata', this.handleFormData);
50
- this.form.addEventListener('submit', this.handleFormSubmit);
51
- }
52
- }
53
-
54
- hostDisconnected() {
55
- if (this.form) {
56
- this.form.removeEventListener('formdata', this.handleFormData);
57
- this.form.removeEventListener('submit', this.handleFormSubmit);
58
- this.form = undefined;
59
- }
60
- }
61
-
62
- handleFormData(event: FormDataEvent) {
63
- const disabled = this.options?.disabled(this.host);
64
- const name = this.options?.name(this.host);
65
- const value = this.options?.value(this.host);
66
-
67
- if (!disabled && name && value !== undefined) {
68
- if (Array.isArray(value)) {
69
- value.map(val => event.formData.append(name, val));
70
- } else {
71
- event.formData.append(name, value);
72
- }
73
- }
74
- }
75
-
76
- handleFormSubmit(event: Event) {
77
- const form = this.form;
78
- const disabled = this.options?.disabled(this.host);
79
- const reportValidity = this.options?.reportValidity;
80
-
81
- if (form && !form.noValidate && !disabled && reportValidity && !reportValidity(this.host)) {
82
- event.preventDefault();
83
- event.stopImmediatePropagation();
84
- }
85
- }
86
-
87
- submit() {
88
- // Calling form.submit() seems to bypass the submit event and constraint validation. Instead, we can inject a
89
- // native submit button into the form, click it, then remove it to simulate a standard form submission.
90
- const button = document.createElement('button');
91
- if (this.form) {
92
- button.type = 'submit';
93
- button.style.position = 'absolute';
94
- button.style.width = '0';
95
- button.style.height = '0';
96
- button.style.clip = 'rect(0 0 0 0)';
97
- button.style.clipPath = 'inset(50%)';
98
- button.style.overflow = 'hidden';
99
- button.style.whiteSpace = 'nowrap';
100
- this.form.append(button);
101
- button.click();
102
- button.remove();
103
- }
104
- }
105
- }
106
-
107
- export const renderFormControl = (
108
- props: {
109
- /** The input id, used to map the input to the label */
110
- inputId: string;
111
-
112
- /** The size of the form control */
113
- size: 'small' | 'medium' | 'large';
114
-
115
- /** The label id, used to map the label to the input */
116
- labelId?: string;
117
-
118
- /** The label text (if the label slot isn't used) */
119
- label?: string;
120
-
121
- /** Whether or not a label slot has been provided. */
122
- hasLabelSlot?: boolean;
123
-
124
- /** The help text id, used to map the input to the help text */
125
- helpTextId?: string;
126
-
127
- /** The help text (if the help-text slot isn't used) */
128
- helpText?: string;
129
-
130
- /** Whether or not a help text slot has been provided. */
131
- hasHelpTextSlot?: boolean;
132
-
133
- /** A function that gets called when the label is clicked. */
134
- onLabelClick?: (event: MouseEvent) => void;
135
- },
136
- input: TemplateResult
137
- ) => {
138
- const hasLabel = props.label ? true : !!props.hasLabelSlot;
139
- const hasHelpText = props.helpText ? true : !!props.hasHelpTextSlot;
140
-
141
- return html`
142
- <div
143
- part="form-control"
144
- class=${classMap({
145
- 'form-control': true,
146
- 'form-control--small': props.size === 'small',
147
- 'form-control--medium': props.size === 'medium',
148
- 'form-control--large': props.size === 'large',
149
- 'form-control--has-label': hasLabel,
150
- 'form-control--has-help-text': hasHelpText
151
- })}
152
- >
153
- <label
154
- part="label"
155
- id=${ifDefined(props.labelId)}
156
- class="form-control__label"
157
- for=${props.inputId}
158
- aria-hidden=${hasLabel ? 'false' : 'true'}
159
- @click=${(event: MouseEvent) => (props.onLabelClick ? props.onLabelClick(event) : null)}
160
- >
161
- <slot name="label">${props.label}</slot>
162
- </label>
163
-
164
- <div class="form-control__input">${html`${input}`}</div>
165
-
166
- <div
167
- part="help-text"
168
- id=${ifDefined(props.helpTextId)}
169
- class="form-control__help-text"
170
- aria-hidden=${hasHelpText ? 'false' : 'true'}
171
- >
172
- <slot name="help-text">${props.helpText}</slot>
173
- </div>
174
- </div>
175
- `;
176
- };
177
-
178
- export function getLabelledBy(props: {
179
- /** The label id, used to map the label to the input */
180
- labelId: string;
181
-
182
- /** The label text (if the label slot isn't used) */
183
- label: string;
184
-
185
- /** Whether or not a label slot has been provided. */
186
- hasLabelSlot: boolean;
187
-
188
- /** The help text id, used to map the input to the help text */
189
- helpTextId: string;
190
-
191
- /** The help text (if the help-text slot isn't used) */
192
- helpText: string;
193
-
194
- /** Whether or not a help text slot has been provided. */
195
- hasHelpTextSlot: boolean;
196
- }) {
197
- const labelledBy = [
198
- props.label || props.hasLabelSlot ? props.labelId : '',
199
- props.helpText || props.hasHelpTextSlot ? props.helpTextId : ''
200
- ].filter(val => val);
201
-
202
- return labelledBy.join(' ') || undefined;
203
- }
@@ -1,93 +0,0 @@
1
- //
2
- // Polyfills the formdata event in unsupportive browsers. This is a partial polyfill to support appending custom element
3
- // form data on submit. The formdata event landed in Safari until 15.1, which is slighly too new to rely on. All other
4
- // browsers have great support.
5
- //
6
- // https://caniuse.com/mdn-api_htmlformelement_formdata_event
7
- //
8
- // Original code derived from: https://gist.github.com/WickyNilliams/eb6a44075356ee504dd9491c5a3ab0be
9
- //
10
- // Copyright (c) 2021 Nick Williams (https://wicky.nillia.ms)
11
- //
12
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
- // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
- //
16
- class FormDataEventPolyfill extends Event {
17
- formData: FormData;
18
-
19
- constructor(formData: FormData) {
20
- super('formdata');
21
- this.formData = formData;
22
- }
23
- }
24
-
25
- class FormDataPolyfill extends FormData {
26
- private form: HTMLFormElement;
27
-
28
- constructor(form: HTMLFormElement) {
29
- super(form);
30
- this.form = form;
31
- form.dispatchEvent(new FormDataEventPolyfill(this));
32
- }
33
-
34
- append(name: string, value: any) {
35
- let input = this.form.elements[name as any] as HTMLInputElement;
36
-
37
- if (!input) {
38
- input = document.createElement('input');
39
- input.type = 'hidden';
40
- input.name = name;
41
- this.form.appendChild(input);
42
- }
43
-
44
- if (this.has(name)) {
45
- const entries = this.getAll(name);
46
- const index = entries.indexOf(input.value);
47
-
48
- if (index !== -1) {
49
- entries.splice(index, 1);
50
- }
51
-
52
- entries.push(value);
53
- this.set(name, entries as any);
54
- } else {
55
- super.append(name, value);
56
- }
57
-
58
- input.value = value;
59
- }
60
- }
61
-
62
- function supportsFormDataEvent() {
63
- const form = document.createElement('form');
64
- let isSupported = false;
65
-
66
- document.body.append(form);
67
-
68
- form.addEventListener('submit', event => {
69
- new FormData(event.target as HTMLFormElement);
70
- event.preventDefault();
71
- });
72
-
73
- form.addEventListener('formdata', () => (isSupported = true));
74
- form.dispatchEvent(new Event('submit', { cancelable: true }));
75
- form.remove();
76
-
77
- return isSupported;
78
- }
79
-
80
- function polyfillFormData() {
81
- if (!window.FormData || supportsFormDataEvent()) {
82
- return;
83
- }
84
-
85
- window.FormData = FormDataPolyfill;
86
- window.addEventListener('submit', event => {
87
- if (!event.defaultPrevented) {
88
- new FormData(event.target as HTMLFormElement);
89
- }
90
- });
91
- }
92
-
93
- polyfillFormData();
@@ -1,8 +0,0 @@
1
- //
2
- // Ensures a number stays within a minimum and maximum value
3
- //
4
- export function clamp(value: number, min: number, max: number) {
5
- if (value < min) return min;
6
- if (value > max) return max;
7
- return value;
8
- }
@@ -1,53 +0,0 @@
1
- import { getTabbableBoundary } from '../internal/tabbable';
2
-
3
- let activeModals: HTMLElement[] = [];
4
-
5
- export default class Modal {
6
- element: HTMLElement;
7
- tabDirection: 'forward' | 'backward' = 'forward';
8
-
9
- constructor(element: HTMLElement) {
10
- this.element = element;
11
- this.handleFocusIn = this.handleFocusIn.bind(this);
12
- this.handleKeyDown = this.handleKeyDown.bind(this);
13
- }
14
-
15
- activate() {
16
- activeModals.push(this.element);
17
- document.addEventListener('focusin', this.handleFocusIn);
18
- document.addEventListener('keydown', this.handleKeyDown);
19
- }
20
-
21
- deactivate() {
22
- activeModals = activeModals.filter(modal => modal !== this.element);
23
- document.removeEventListener('focusin', this.handleFocusIn);
24
- document.removeEventListener('keydown', this.handleKeyDown);
25
- }
26
-
27
- isActive() {
28
- // The "active" modal is always the most recent one shown
29
- return activeModals[activeModals.length - 1] === this.element;
30
- }
31
-
32
- handleFocusIn(event: Event) {
33
- const path = event.composedPath();
34
-
35
- // Trap focus so it doesn't go out of the modal's boundary
36
- if (this.isActive() && !path.includes(this.element)) {
37
- const { start, end } = getTabbableBoundary(this.element);
38
- const target = this.tabDirection === 'forward' ? start : end;
39
-
40
- if (typeof target?.focus === 'function') {
41
- target.focus({ preventScroll: true });
42
- }
43
- }
44
- }
45
-
46
- handleKeyDown(event: KeyboardEvent) {
47
- // Quick hack to determine tab direction
48
- if (event.key === 'Tab' && event.shiftKey) {
49
- this.tabDirection = 'backward';
50
- setTimeout(() => (this.tabDirection = 'forward'));
51
- }
52
- }
53
- }
@@ -1,32 +0,0 @@
1
- //
2
- // Formats a number to a human-readable string of bytes or bits such as "100 MB"
3
- //
4
- export function formatBytes(bytes: number, options: FormatBytesOptions) {
5
- options = Object.assign(
6
- {
7
- unit: 'bytes',
8
- formatter: (number: number) => number.toLocaleString()
9
- },
10
- options
11
- );
12
-
13
- const byteUnits = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
14
- const bitUnits = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit']; // cspell:disable-line
15
- const units = options.unit === 'bytes' ? byteUnits : bitUnits;
16
- const isNegative = bytes < 0;
17
-
18
- bytes = Math.abs(bytes);
19
- if (bytes === 0) return '0 B';
20
-
21
- const i = Math.min(Math.floor(Math.log10(bytes) / 3), units.length - 1);
22
- const num = Number((bytes / Math.pow(1000, i)).toPrecision(3));
23
- const numString = options.formatter ? options.formatter(num) : num;
24
- const prefix = isNegative ? '-' : '';
25
-
26
- return `${prefix}${numString} ${units[i]}`;
27
- }
28
-
29
- interface FormatBytesOptions {
30
- unit?: 'bytes' | 'bits';
31
- formatter?: (number: number) => string;
32
- }
@@ -1,13 +0,0 @@
1
- //
2
- // Returns an element's offset relative to its parent. Similar to element.offsetTop and element.offsetLeft, except the
3
- // parent doesn't have to be positioned relative or absolute.
4
- //
5
- // NOTE: This was created to work around what appears to be a bug in Chrome where a slotted element's offsetParent
6
- // seems to ignore elements inside the surrounding shadow DOM: https://bugs.chromium.org/p/chromium/issues/detail?id=920069
7
- //
8
- export function getOffset(element: HTMLElement, parent: HTMLElement) {
9
- return {
10
- top: Math.round(element.getBoundingClientRect().top - parent.getBoundingClientRect().top),
11
- left: Math.round(element.getBoundingClientRect().left - parent.getBoundingClientRect().left)
12
- };
13
- }
@@ -1,57 +0,0 @@
1
- import { getOffset } from './offset';
2
-
3
- const locks = new Set();
4
-
5
- //
6
- // Prevents body scrolling. Keeps track of which elements requested a lock so multiple levels of locking are possible
7
- // without premature unlocking.
8
- //
9
- export function lockBodyScrolling(lockingEl: HTMLElement) {
10
- locks.add(lockingEl);
11
- document.body.classList.add('sl-scroll-lock');
12
- }
13
-
14
- //
15
- // Unlocks body scrolling. Scrolling will only be unlocked once all elements that requested a lock call this method.
16
- //
17
- export function unlockBodyScrolling(lockingEl: HTMLElement) {
18
- locks.delete(lockingEl);
19
-
20
- if (locks.size === 0) {
21
- document.body.classList.remove('sl-scroll-lock');
22
- }
23
- }
24
-
25
- //
26
- // Scrolls an element into view of its container. If the element is already in view, nothing will happen.
27
- //
28
- export function scrollIntoView(
29
- element: HTMLElement,
30
- container: HTMLElement,
31
- direction: 'horizontal' | 'vertical' | 'both' = 'vertical',
32
- behavior: 'smooth' | 'auto' = 'smooth'
33
- ) {
34
- const offset = getOffset(element, container);
35
- const offsetTop = offset.top + container.scrollTop;
36
- const offsetLeft = offset.left + container.scrollLeft;
37
- const minX = container.scrollLeft;
38
- const maxX = container.scrollLeft + container.offsetWidth;
39
- const minY = container.scrollTop;
40
- const maxY = container.scrollTop + container.offsetHeight;
41
-
42
- if (direction === 'horizontal' || direction === 'both') {
43
- if (offsetLeft < minX) {
44
- container.scrollTo({ left: offsetLeft, behavior });
45
- } else if (offsetLeft + element.clientWidth > maxX) {
46
- container.scrollTo({ left: offsetLeft - container.offsetWidth + element.clientWidth, behavior });
47
- }
48
- }
49
-
50
- if (direction === 'vertical' || direction === 'both') {
51
- if (offsetTop < minY) {
52
- container.scrollTo({ top: offsetTop, behavior });
53
- } else if (offsetTop + element.clientHeight > maxY) {
54
- container.scrollTo({ top: offsetTop - container.offsetHeight + element.clientHeight, behavior });
55
- }
56
- }
57
- }
@@ -1,91 +0,0 @@
1
- import { ReactiveController, ReactiveControllerHost } from 'lit';
2
-
3
- export class HasSlotController implements ReactiveController {
4
- host: ReactiveControllerHost & Element;
5
- slotNames: string[] = [];
6
-
7
- constructor(host: ReactiveControllerHost & Element, ...slotNames: string[]) {
8
- (this.host = host).addController(this);
9
- this.slotNames = slotNames;
10
- this.handleSlotChange = this.handleSlotChange.bind(this);
11
- }
12
-
13
- private hasDefaultSlot() {
14
- return [...this.host.childNodes].some(node => {
15
- if (node.nodeType === node.TEXT_NODE && node.textContent!.trim() !== '') {
16
- return true;
17
- }
18
-
19
- if (node.nodeType === node.ELEMENT_NODE) {
20
- const el = node as HTMLElement;
21
- if (!el.hasAttribute('slot')) {
22
- return true;
23
- }
24
- }
25
-
26
- return false;
27
- });
28
- }
29
-
30
- private hasNamedSlot(name: string) {
31
- return this.host.querySelector(`:scope > [slot="${name}"]`) !== null;
32
- }
33
-
34
- test(slotName: string) {
35
- return slotName === '[default]' ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);
36
- }
37
-
38
- hostConnected() {
39
- this.host.shadowRoot!.addEventListener('slotchange', this.handleSlotChange);
40
- }
41
-
42
- hostDisconnected() {
43
- this.host.shadowRoot!.removeEventListener('slotchange', this.handleSlotChange);
44
- }
45
-
46
- handleSlotChange(event: Event) {
47
- const slot = event.target as HTMLSlotElement;
48
-
49
- if ((this.slotNames.includes('[default]') && !slot.name) || (slot.name && this.slotNames?.includes(slot.name))) {
50
- this.host.requestUpdate();
51
- }
52
- }
53
- }
54
-
55
- //
56
- // Given a slot, this function iterates over all of its assigned element and text nodes and returns the concatenated
57
- // HTML as a string. This is useful because we can't use slot.innerHTML as an alternative.
58
- //
59
- export function getInnerHTML(slot: HTMLSlotElement): string {
60
- const nodes = slot.assignedNodes({ flatten: true });
61
- let html = '';
62
-
63
- [...nodes].map(node => {
64
- if (node.nodeType === Node.ELEMENT_NODE) {
65
- html += (node as HTMLElement).outerHTML;
66
- }
67
-
68
- if (node.nodeType === Node.TEXT_NODE) {
69
- html += node.textContent;
70
- }
71
- });
72
-
73
- return html;
74
- }
75
-
76
- //
77
- // Given a slot, this function iterates over all of its assigned text nodes and returns the concatenated text as a
78
- // string. This is useful because we can't use slot.textContent as an alternative.
79
- //
80
- export function getTextContent(slot: HTMLSlotElement): string {
81
- const nodes = slot ? slot.assignedNodes({ flatten: true }) : [];
82
- let text = '';
83
-
84
- [...nodes].map(node => {
85
- if (node.nodeType === Node.TEXT_NODE) {
86
- text += node.textContent;
87
- }
88
- });
89
-
90
- return text;
91
- }
@@ -1,3 +0,0 @@
1
- export function uppercaseFirstLetter(string: string) {
2
- return string.charAt(0).toUpperCase() + string.slice(1);
3
- }
@@ -1,15 +0,0 @@
1
- //
2
- // Determines if the browser supports focus({ preventScroll })
3
- //
4
- export function isPreventScrollSupported() {
5
- let supported = false;
6
-
7
- document.createElement('div').focus({
8
- get preventScroll() {
9
- supported = true;
10
- return false;
11
- }
12
- });
13
-
14
- return supported;
15
- }
@@ -1,81 +0,0 @@
1
- // Determines if the specified element is tabbable using heuristics inspired by https://github.com/focus-trap/tabbable
2
- function isTabbable(el: HTMLElement) {
3
- const tag = el.tagName.toLowerCase();
4
-
5
- // Elements with a -1 tab index are not tabbable
6
- if (el.getAttribute('tabindex') === '-1') {
7
- return false;
8
- }
9
-
10
- // Elements with a disabled attribute are not tabbable
11
- if (el.hasAttribute('disabled')) {
12
- return false;
13
- }
14
-
15
- // Elements with aria-disabled are not tabbable
16
- if (el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') !== 'false') {
17
- return false;
18
- }
19
-
20
- // Radios without a checked attribute are not tabbable
21
- if (tag === 'input' && el.getAttribute('type') === 'radio' && !el.hasAttribute('checked')) {
22
- return false;
23
- }
24
-
25
- // Elements that are hidden have no offsetParent and are not tabbable
26
- if (!el.offsetParent) {
27
- return false;
28
- }
29
-
30
- // Elements without visibility are not tabbable
31
- if (window.getComputedStyle(el).visibility === 'hidden') {
32
- return false;
33
- }
34
-
35
- // Audio and video elements with the controls attribute are tabbable
36
- if ((tag === 'audio' || tag === 'video') && el.hasAttribute('controls')) {
37
- return true;
38
- }
39
-
40
- // Elements with a tabindex other than -1 are tabbable
41
- if (el.hasAttribute('tabindex')) {
42
- return true;
43
- }
44
-
45
- // Elements with a contenteditable attribute are tabbable
46
- if (el.hasAttribute('contenteditable') && el.getAttribute('contenteditable') !== 'false') {
47
- return true;
48
- }
49
-
50
- // At this point, the following elements are considered tabbable
51
- return ['button', 'input', 'select', 'textarea', 'a', 'audio', 'video', 'summary'].includes(tag);
52
- }
53
-
54
- //
55
- // Returns the first and last bounding elements that are tabbable. This is more performant than checking every single
56
- // element because it short-circuits after finding the first and last ones.
57
- //
58
- export function getTabbableBoundary(root: HTMLElement | ShadowRoot) {
59
- const allElements: HTMLElement[] = [];
60
-
61
- function walk(el: HTMLElement | ShadowRoot) {
62
- if (el instanceof HTMLElement) {
63
- allElements.push(el);
64
-
65
- if (el.shadowRoot && el.shadowRoot.mode === 'open') {
66
- walk(el.shadowRoot);
67
- }
68
- }
69
-
70
- [...el.querySelectorAll('*')].map((e: HTMLElement) => walk(e));
71
- }
72
-
73
- // Collect all elements including the root
74
- walk(root);
75
-
76
- // Find the first and last tabbable elements
77
- const start = allElements.find(el => isTabbable(el)) || null;
78
- const end = allElements.reverse().find(el => isTabbable(el)) || null;
79
-
80
- return { start, end };
81
- }