shoelace-rails-ui 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +42 -0
- data/LICENSE.txt +21 -0
- data/README-real.md +24 -0
- data/README.md +43 -0
- data/Rakefile +16 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/shoelace/rails/ui/version.rb +9 -0
- data/lib/shoelace/rails/ui.rb +12 -0
- data/regenerate.rb +48 -0
- data/remote-src/.DS_Store +0 -0
- data/remote-src/2.0.0.beta64/.DS_Store +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.editorconfig +15 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/CODE_OF_CONDUCT.md +44 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/FUNDING.yml +1 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/ISSUE_TEMPLATE/config.yml +4 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/SECURITY.md +7 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/workflows/node.js.yml +30 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.github/workflows/release.yml +17 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.gitignore +8 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.husky/pre-commit +4 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.prettierignore +12 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.vscode/extensions.json +9 -0
- data/remote-src/2.0.0.beta64/shoelace-next/.vscode/settings.json +4 -0
- data/remote-src/2.0.0.beta64/shoelace-next/CONTRIBUTING.md +5 -0
- data/remote-src/2.0.0.beta64/shoelace-next/LICENSE.md +7 -0
- data/remote-src/2.0.0.beta64/shoelace-next/README.md +94 -0
- data/remote-src/2.0.0.beta64/shoelace-next/cspell.json +110 -0
- data/remote-src/2.0.0.beta64/shoelace-next/custom-elements-manifest.config.js +104 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/404.md +5 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/_sidebar.md +89 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/icons/sprite.svg +1 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/chrome.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/edge.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/firefox.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/logo.svg +7 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/og-image.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/opera.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/safari.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/shoe.svg +134 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/tie.webp +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/touch-icon.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/twitter-card.png +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/undraw-content-team.svg +80 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/undraw-not-found.svg +1 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/walk.gif +0 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/images/wordmark.svg +7 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/code-block/code-block.css +228 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/code-block/code-block.js +376 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/metadata/metadata.js +537 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/scroll-position/scroll-position.js +24 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/search/lunr.min.js +1311 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/search/search.css +180 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/search/search.js +293 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/theme-picker/theme-picker.css +29 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/plugins/theme-picker/theme-picker.js +83 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/assets/styles/docs.css +642 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/alert.md +441 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/animated-image.md +128 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/animation.md +351 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/avatar.md +201 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/badge.md +191 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/breadcrumb-item.md +35 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/breadcrumb.md +266 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/button-group.md +470 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/button.md +453 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/card.md +311 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/checkbox.md +71 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/color-picker.md +101 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/details.md +89 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/dialog.md +265 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/divider.md +152 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/drawer.md +452 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/dropdown.md +389 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/format-bytes.md +126 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/format-date.md +120 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/format-number.md +124 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/icon-button.md +160 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/icon.md +711 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/image-comparer.md +51 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/include.md +47 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/input.md +283 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/menu-item.md +255 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/menu-label.md +52 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/menu.md +49 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/mutation-observer.md +196 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/progress-bar.md +144 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/progress-ring.md +178 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/qr-code.md +167 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/radio-group.md +52 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/radio.md +59 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/range.md +180 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/rating.md +153 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/relative-time.md +105 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/resize-observer.md +68 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/responsive-media.md +73 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/select.md +457 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/skeleton.md +439 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/spinner.md +86 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/split-panel.md +671 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/switch.md +77 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tab-group.md +359 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tab-panel.md +41 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tab.md +29 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tag.md +142 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/textarea.md +184 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/tooltip.md +410 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/components/visually-hidden.md +47 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/frameworks/angular.md +46 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/frameworks/react.md +156 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/frameworks/vue.md +92 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/customizing.md +153 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/form-controls.md +336 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/installation.md +137 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/localization.md +140 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/overview.md +131 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/themes.md +139 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/getting-started/usage.md +173 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/index.html +98 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/accessibility.md +18 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/changelog.md +925 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/community.md +53 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/resources/contributing.md +261 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/border-radius.md +12 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/color.md +439 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/elevation.md +11 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/spacing.md +16 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/transition.md +11 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/typography.md +58 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tokens/z-index.md +11 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tutorials/integrating-with-laravel.md +117 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tutorials/integrating-with-nextjs.md +137 -0
- data/remote-src/2.0.0.beta64/shoelace-next/docs/tutorials/integrating-with-rails.md +103 -0
- data/remote-src/2.0.0.beta64/shoelace-next/lint-staged.config.js +4 -0
- data/remote-src/2.0.0.beta64/shoelace-next/package-lock.json +9534 -0
- data/remote-src/2.0.0.beta64/shoelace-next/package.json +93 -0
- data/remote-src/2.0.0.beta64/shoelace-next/prettier.config.cjs +17 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/build.js +158 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-css.js +42 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-icons.js +71 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-metadata.js +11 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-react.js +63 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-search.js +100 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/make-vscode-data.js +58 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/plopfile.js +67 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/component.hbs +44 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/docs.hbs +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/styles.hbs +10 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/plop/templates/component/tests.hbs +13 -0
- data/remote-src/2.0.0.beta64/shoelace-next/scripts/shared.js +18 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/alert/alert.styles.ts +95 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/alert/alert.test.ts +93 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/alert/alert.ts +238 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/animated-image/animated-image.styles.ts +52 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/animated-image/animated-image.test.ts +13 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/animated-image/animated-image.ts +120 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/animation/animation.styles.ts +10 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/animation/animation.ts +222 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/animation/animations.ts +15 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/avatar/avatar.styles.ts +66 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/avatar/avatar.test.ts +111 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/avatar/avatar.ts +83 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/badge/badge.styles.ts +94 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/badge/badge.test.ts +77 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/badge/badge.ts +53 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb/breadcrumb.styles.ts +12 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb/breadcrumb.test.ts +104 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb/breadcrumb.ts +82 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb-item/breadcrumb-item.styles.ts +85 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb-item/breadcrumb-item.test.ts +160 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/breadcrumb-item/breadcrumb-item.ts +92 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/button/button.styles.ts +637 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/button/button.ts +209 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/button-group/button-group.styles.ts +15 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/button-group/button-group.ts +84 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/card/card.styles.ts +62 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/card/card.test.ts +139 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/card/card.ts +68 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/checkbox/checkbox.styles.ts +108 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/checkbox/checkbox.test.ts +47 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/checkbox/checkbox.ts +203 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/color-picker/color-picker.styles.ts +326 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/color-picker/color-picker.test.ts +43 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/color-picker/color-picker.ts +853 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/details/details.styles.ts +73 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/details/details.test.ts +153 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/details/details.ts +192 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/dialog/dialog.styles.ts +106 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/dialog/dialog.test.ts +135 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/dialog/dialog.ts +296 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/divider/divider.styles.ts +25 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/divider/divider.ts +34 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/drawer/drawer.styles.ts +142 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/drawer/drawer.test.ts +135 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/drawer/drawer.ts +377 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/dropdown/dropdown.styles.ts +58 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/dropdown/dropdown.test.ts +147 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/dropdown/dropdown.ts +459 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/format-bytes/format-bytes.ts +35 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/format-date/format-date.ts +81 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/format-number/format-number.ts +69 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/icon.styles.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/icon.ts +131 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/library.default.ts +9 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/library.system.ts +97 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/library.ts +49 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon/request.ts +36 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon-button/icon-button.styles.ts +48 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/icon-button/icon-button.ts +100 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/image-comparer/image-comparer.styles.ts +77 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/image-comparer/image-comparer.ts +147 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/include.styles.ts +10 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/include.test.ts +62 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/include.ts +80 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/include/request.ts +23 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/input/input.styles.ts +282 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/input/input.test.ts +35 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/input/input.ts +410 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu/menu.styles.ts +18 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu/menu.ts +205 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-item/menu-item.styles.ts +84 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-item/menu-item.ts +92 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-label/menu-label.styles.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/menu-label/menu-label.ts +30 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/mutation-observer/mutation-observer.styles.ts +10 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/mutation-observer/mutation-observer.test.ts +13 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/mutation-observer/mutation-observer.ts +118 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-bar/progress-bar.styles.ts +57 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-bar/progress-bar.test.ts +89 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-bar/progress-bar.ts +74 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-ring/progress-ring.styles.ts +66 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-ring/progress-ring.test.ts +68 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/progress-ring/progress-ring.ts +84 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/qr-code/qr-code.styles.ts +22 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/qr-code/qr-code.ts +90 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio/radio.styles.ts +107 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio/radio.test.ts +65 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio/radio.ts +226 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio-group/radio-group.styles.ts +47 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/radio-group/radio-group.ts +66 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/range/range.styles.ts +192 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/range/range.ts +273 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/rating/rating.styles.ts +79 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/rating/rating.ts +249 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/relative-time/relative-time.ts +116 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/resize-observer/resize-observer.styles.ts +10 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/resize-observer/resize-observer.ts +87 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/responsive-media/responsive-media.styles.ts +36 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/responsive-media/responsive-media.ts +50 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/select/select.styles.ts +331 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/select/select.test.ts +56 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/select/select.ts +560 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/skeleton/skeleton.styles.ts +60 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/skeleton/skeleton.ts +46 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/spinner/spinner.styles.ts +56 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/spinner/spinner.test.ts +24 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/spinner/spinner.ts +34 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/split-panel/split-panel.styles.ts +76 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/split-panel/split-panel.test.ts +13 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/split-panel/split-panel.ts +272 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/switch/switch.styles.ts +135 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/switch/switch.test.ts +64 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/switch/switch.ts +187 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab/tab.styles.ts +61 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab/tab.ts +104 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-group/tab-group.styles.ts +209 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-group/tab-group.ts +409 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-panel/tab-panel.styles.ts +17 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tab-panel/tab-panel.ts +49 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tag/tag.styles.ts +110 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tag/tag.ts +92 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/textarea/textarea.styles.ts +167 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/textarea/textarea.test.ts +35 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/textarea/textarea.ts +339 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tooltip/tooltip.styles.ts +131 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tooltip/tooltip.test.ts +117 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/tooltip/tooltip.ts +355 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/visually-hidden/visually-hidden.styles.ts +18 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/visually-hidden/visually-hidden.test.ts +39 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/components/visually-hidden/visually-hidden.ts +24 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/declaration.d.ts +8 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/animate.ts +70 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/event.ts +35 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/focus-visible.ts +26 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/form-control.ts +203 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/formdata-event-polyfill.ts +93 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/math.ts +8 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/modal.ts +53 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/number.ts +32 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/offset.ts +13 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/scroll.ts +57 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/slot.ts +91 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/string.ts +3 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/support.ts +15 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/tabbable.ts +81 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/internal/watch.ts +40 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/shoelace.ts +58 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/styles/component.styles.ts +23 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/styles/form-control.styles.ts +52 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/styles/utility.styles.ts +23 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/themes/dark.styles.ts +524 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/themes/light.styles.ts +524 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/de-ch.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/de.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/en.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/es.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/fr.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/he.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/ja.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/nl.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/pl.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/pt.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/translations/ru.ts +21 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/animation-registry.ts +59 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/animation.ts +1 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/base-path.ts +43 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/form.ts +22 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/icon-library.ts +1 -0
- data/remote-src/2.0.0.beta64/shoelace-next/src/utilities/localize.ts +5 -0
- data/remote-src/2.0.0.beta64/shoelace-next/tsconfig.json +35 -0
- data/remote-src/2.0.0.beta64/shoelace-next/vercel.json +4 -0
- data/remote-src/2.0.0.beta64/shoelace-next/web-test-runner.config.js +14 -0
- data/shoelace-rails-ui.gemspec +39 -0
- data/shoelace-rails-ui.rb +0 -0
- metadata +377 -0
@@ -0,0 +1,351 @@
|
|
1
|
+
# Animation
|
2
|
+
|
3
|
+
[component-header:sl-animation]
|
4
|
+
|
5
|
+
Animate elements declaratively with nearly 100 baked-in presets, or roll your own with custom keyframes. Powered by the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API).
|
6
|
+
|
7
|
+
To animate an element, wrap it in `<sl-animation>` and set an animation `name`. The animation will not start until you add the `play` attribute. Refer to the [properties table](#properties) for a list of all animation options.
|
8
|
+
|
9
|
+
```html preview
|
10
|
+
<div class="animation-overview">
|
11
|
+
<sl-animation name="bounce" duration="2000" play><div class="box"></div></sl-animation>
|
12
|
+
<sl-animation name="jello" duration="2000" play><div class="box"></div></sl-animation>
|
13
|
+
<sl-animation name="heartBeat" duration="2000" play><div class="box"></div></sl-animation>
|
14
|
+
<sl-animation name="flip" duration="2000" play><div class="box"></div></sl-animation>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<style>
|
18
|
+
.animation-overview .box {
|
19
|
+
display: inline-block;
|
20
|
+
width: 100px;
|
21
|
+
height: 100px;
|
22
|
+
background-color: var(--sl-color-primary-600);
|
23
|
+
margin: 1.5rem;
|
24
|
+
}
|
25
|
+
</style>
|
26
|
+
```
|
27
|
+
|
28
|
+
```jsx react
|
29
|
+
import { SlAnimation } from '@shoelace-style/shoelace/dist/react';
|
30
|
+
|
31
|
+
const css = `
|
32
|
+
.animation-overview .box {
|
33
|
+
display: inline-block;
|
34
|
+
width: 100px;
|
35
|
+
height: 100px;
|
36
|
+
background-color: var(--sl-color-primary-600);
|
37
|
+
margin: 1.5rem;
|
38
|
+
}
|
39
|
+
`;
|
40
|
+
|
41
|
+
const App = () => (
|
42
|
+
<>
|
43
|
+
<div class="animation-overview">
|
44
|
+
<SlAnimation name="bounce" duration={2000} play><div class="box" /></SlAnimation>
|
45
|
+
<SlAnimation name="jello" duration={2000} play><div class="box" /></SlAnimation>
|
46
|
+
<SlAnimation name="heartBeat" duration={2000} play><div class="box" /></SlAnimation>
|
47
|
+
<SlAnimation name="flip" duration={2000} play><div class="box" /></SlAnimation>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<style>{css}</style>
|
51
|
+
</>
|
52
|
+
);
|
53
|
+
```
|
54
|
+
|
55
|
+
?> The animation will only be applied to the first child element found in `<sl-animation>`.
|
56
|
+
|
57
|
+
## Examples
|
58
|
+
|
59
|
+
### Animations & Easings
|
60
|
+
|
61
|
+
This example demonstrates all of the baked-in animations and easings. Animations are based on those found in the popular [Animate.css](https://animate.style/) library.
|
62
|
+
|
63
|
+
```html preview
|
64
|
+
<div class="animation-sandbox">
|
65
|
+
<sl-animation name="bounce" easing="ease-in-out" duration="2000" play>
|
66
|
+
<div class="box"></div>
|
67
|
+
</sl-animation>
|
68
|
+
|
69
|
+
<div class="controls">
|
70
|
+
<sl-select label="Animation" value="bounce"></sl-select>
|
71
|
+
<sl-select label="Easing" value="linear"></sl-select>
|
72
|
+
<sl-input label="Playback Rate" type="number" min="0" max="2" step=".25" value="1"></sl-input>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
<script type="module">
|
77
|
+
import { getAnimationNames, getEasingNames } from '/dist/utilities/animation.js';
|
78
|
+
|
79
|
+
const container = document.querySelector('.animation-sandbox');
|
80
|
+
const animation = container.querySelector('sl-animation');
|
81
|
+
const animationName = container.querySelector('.controls sl-select:nth-child(1)');
|
82
|
+
const easingName = container.querySelector('.controls sl-select:nth-child(2)');
|
83
|
+
const playbackRate = container.querySelector('sl-input[type="number"]');
|
84
|
+
const animations = getAnimationNames();
|
85
|
+
const easings = getEasingNames();
|
86
|
+
|
87
|
+
animations.map(name => {
|
88
|
+
const menuItem = Object.assign(document.createElement('sl-menu-item'), {
|
89
|
+
textContent: name,
|
90
|
+
value: name
|
91
|
+
});
|
92
|
+
animationName.appendChild(menuItem);
|
93
|
+
});
|
94
|
+
|
95
|
+
easings.map(name => {
|
96
|
+
const menuItem = Object.assign(document.createElement('sl-menu-item'), {
|
97
|
+
textContent: name,
|
98
|
+
value: name
|
99
|
+
});
|
100
|
+
easingName.appendChild(menuItem);
|
101
|
+
});
|
102
|
+
|
103
|
+
animationName.addEventListener('sl-change', () => animation.name = animationName.value);
|
104
|
+
easingName.addEventListener('sl-change', () => animation.easing = easingName.value);
|
105
|
+
playbackRate.addEventListener('sl-input', () => animation.playbackRate = playbackRate.value);
|
106
|
+
</script>
|
107
|
+
|
108
|
+
<style>
|
109
|
+
.animation-sandbox .box {
|
110
|
+
width: 100px;
|
111
|
+
height: 100px;
|
112
|
+
background-color: var(--sl-color-primary-600);
|
113
|
+
}
|
114
|
+
|
115
|
+
.animation-sandbox .controls {
|
116
|
+
max-width: 300px;
|
117
|
+
margin-top: 2rem;
|
118
|
+
}
|
119
|
+
|
120
|
+
.animation-sandbox .controls sl-select {
|
121
|
+
margin-bottom: 1rem;
|
122
|
+
}
|
123
|
+
</style>
|
124
|
+
```
|
125
|
+
|
126
|
+
### Using Intersection Observer
|
127
|
+
|
128
|
+
Use an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) to control the animation when an element enters or exits the viewport. For example, scroll the box below in and out of your screen. The animation stops when the box exits the viewport and restarts each time it enters the viewport.
|
129
|
+
|
130
|
+
```html preview
|
131
|
+
<div class="animation-scroll">
|
132
|
+
<sl-animation name="jackInTheBox" duration="2000" iterations="1"><div class="box"></div></sl-animation>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<script>
|
136
|
+
const container = document.querySelector('.animation-scroll');
|
137
|
+
const animation = container.querySelector('sl-animation');
|
138
|
+
const box = animation.querySelector('.box');
|
139
|
+
|
140
|
+
// Watch for the box to enter and exit the viewport. Note that we're observing the box, not the animation element!
|
141
|
+
const observer = new IntersectionObserver(entries => {
|
142
|
+
if (entries[0].isIntersecting) {
|
143
|
+
// Start the animation when the box enters the viewport
|
144
|
+
animation.play = true;
|
145
|
+
} else {
|
146
|
+
animation.play = false;
|
147
|
+
animation.currentTime = 0;
|
148
|
+
}
|
149
|
+
});
|
150
|
+
observer.observe(box);
|
151
|
+
</script>
|
152
|
+
|
153
|
+
<style>
|
154
|
+
.animation-scroll .box {
|
155
|
+
display: inline-block;
|
156
|
+
width: 100px;
|
157
|
+
height: 100px;
|
158
|
+
background-color: var(--sl-color-primary-600);
|
159
|
+
}
|
160
|
+
</style>
|
161
|
+
```
|
162
|
+
|
163
|
+
```jsx react
|
164
|
+
import { useEffect, useRef, useState } from 'react';
|
165
|
+
import { SlAnimation } from '@shoelace-style/shoelace/dist/react';
|
166
|
+
|
167
|
+
const css = `
|
168
|
+
.animation-scroll {
|
169
|
+
height: calc(100vh + 100px);
|
170
|
+
}
|
171
|
+
|
172
|
+
.animation-scroll .box {
|
173
|
+
display: inline-block;
|
174
|
+
width: 100px;
|
175
|
+
height: 100px;
|
176
|
+
background-color: var(--sl-color-primary-600);
|
177
|
+
}
|
178
|
+
`;
|
179
|
+
|
180
|
+
const App = () => {
|
181
|
+
const animation = useRef(null);
|
182
|
+
const box = useRef(null);
|
183
|
+
|
184
|
+
useEffect(() => {
|
185
|
+
const observer = new IntersectionObserver(
|
186
|
+
(entries) => {
|
187
|
+
if (entries[0].isIntersecting) {
|
188
|
+
animation.current.play = true;
|
189
|
+
} else {
|
190
|
+
animation.current.play = false;
|
191
|
+
animation.current.currentTime = 0;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
);
|
195
|
+
|
196
|
+
if (box.current) {
|
197
|
+
observer.observe(box.current);
|
198
|
+
}
|
199
|
+
}, [box]);
|
200
|
+
|
201
|
+
return (
|
202
|
+
<>
|
203
|
+
<div class="animation-scroll">
|
204
|
+
<SlAnimation
|
205
|
+
ref={animation}
|
206
|
+
name="jackInTheBox"
|
207
|
+
duration={2000}
|
208
|
+
iterations={1}
|
209
|
+
>
|
210
|
+
<div ref={box} class="box" />
|
211
|
+
</SlAnimation>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
<style>{css}</style>
|
215
|
+
</>
|
216
|
+
);
|
217
|
+
};
|
218
|
+
```
|
219
|
+
|
220
|
+
### Custom Keyframe Formats
|
221
|
+
|
222
|
+
Supply your own [keyframe formats](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats) to build custom animations.
|
223
|
+
|
224
|
+
```html preview
|
225
|
+
<div class="animation-keyframes">
|
226
|
+
<sl-animation easing="ease-in-out" duration="2000" play>
|
227
|
+
<div class="box"></div>
|
228
|
+
</sl-animation>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<script>
|
232
|
+
const animation = document.querySelector('.animation-keyframes sl-animation');
|
233
|
+
animation.keyframes = [
|
234
|
+
{
|
235
|
+
offset: 0,
|
236
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
237
|
+
fillMode: 'both',
|
238
|
+
transformOrigin: 'center center',
|
239
|
+
transform: 'rotate(0)'
|
240
|
+
},
|
241
|
+
{
|
242
|
+
offset: 1,
|
243
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
244
|
+
fillMode: 'both',
|
245
|
+
transformOrigin: 'center center',
|
246
|
+
transform: 'rotate(90deg)'
|
247
|
+
}
|
248
|
+
];
|
249
|
+
</script>
|
250
|
+
|
251
|
+
<style>
|
252
|
+
.animation-keyframes .box {
|
253
|
+
width: 100px;
|
254
|
+
height: 100px;
|
255
|
+
background-color: var(--sl-color-primary-600);
|
256
|
+
}
|
257
|
+
</style>
|
258
|
+
```
|
259
|
+
|
260
|
+
```jsx react
|
261
|
+
import { SlAnimation } from '@shoelace-style/shoelace/dist/react';
|
262
|
+
|
263
|
+
const css = `
|
264
|
+
.animation-keyframes .box {
|
265
|
+
width: 100px;
|
266
|
+
height: 100px;
|
267
|
+
background-color: var(--sl-color-primary-600);
|
268
|
+
}
|
269
|
+
`;
|
270
|
+
|
271
|
+
const App = () => (
|
272
|
+
<>
|
273
|
+
<div class="animation-keyframes">
|
274
|
+
<SlAnimation
|
275
|
+
easing="ease-in-out"
|
276
|
+
duration={2000}
|
277
|
+
play
|
278
|
+
keyframes={[
|
279
|
+
{
|
280
|
+
offset: 0,
|
281
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
282
|
+
fillMode: 'both',
|
283
|
+
transformOrigin: 'center center',
|
284
|
+
transform: 'rotate(0)'
|
285
|
+
},
|
286
|
+
{
|
287
|
+
offset: 1,
|
288
|
+
easing: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
|
289
|
+
fillMode: 'both',
|
290
|
+
transformOrigin: 'center center',
|
291
|
+
transform: 'rotate(90deg)'
|
292
|
+
}
|
293
|
+
]}
|
294
|
+
>
|
295
|
+
<div class="box" />
|
296
|
+
</SlAnimation>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
<style>{css}</style>
|
300
|
+
</>
|
301
|
+
);
|
302
|
+
```
|
303
|
+
|
304
|
+
### Playing Animations on Demand
|
305
|
+
|
306
|
+
Animations won't play until you apply the `play` attribute. You can omit it initially, then apply it on demand such as after a user interaction. In this example, the button will animate once every time the button is clicked.
|
307
|
+
|
308
|
+
```html preview
|
309
|
+
<div class="animation-form">
|
310
|
+
<sl-animation name="rubberBand" duration="1000" iterations="1">
|
311
|
+
<sl-button variant="primary">Click me</sl-button>
|
312
|
+
</sl-animation>
|
313
|
+
</div>
|
314
|
+
|
315
|
+
<script>
|
316
|
+
const container = document.querySelector('.animation-form');
|
317
|
+
const animation = container.querySelector('sl-animation');
|
318
|
+
const button = container.querySelector('sl-button');
|
319
|
+
|
320
|
+
button.addEventListener('click', () => {
|
321
|
+
animation.play = true;
|
322
|
+
});
|
323
|
+
</script>
|
324
|
+
```
|
325
|
+
|
326
|
+
```jsx react
|
327
|
+
import { useState } from 'react';
|
328
|
+
import { SlAnimation, SlButton } from '@shoelace-style/shoelace/dist/react';
|
329
|
+
|
330
|
+
const App = () => {
|
331
|
+
const [play, setPlay] = useState(false);
|
332
|
+
|
333
|
+
return (
|
334
|
+
<div class="animation-form">
|
335
|
+
<SlAnimation
|
336
|
+
name="rubberBand"
|
337
|
+
duration={1000}
|
338
|
+
iterations={1}
|
339
|
+
play={play}
|
340
|
+
onSlFinish={() => setPlay(false)}
|
341
|
+
>
|
342
|
+
<SlButton variant="primary" onClick={() => setPlay(true)}>
|
343
|
+
Click me
|
344
|
+
</SlButton>
|
345
|
+
</SlAnimation>
|
346
|
+
</div>
|
347
|
+
);
|
348
|
+
};
|
349
|
+
```
|
350
|
+
|
351
|
+
[component-metadata:sl-animation]
|
@@ -0,0 +1,201 @@
|
|
1
|
+
# Avatar
|
2
|
+
|
3
|
+
[component-header:sl-avatar]
|
4
|
+
|
5
|
+
Avatars are used to represent a person or object.
|
6
|
+
|
7
|
+
Like [images](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img), you should always provide `alt` text for avatars as alternate text for assistive devices.
|
8
|
+
|
9
|
+
```html preview
|
10
|
+
<sl-avatar label="User avatar"></sl-avatar>
|
11
|
+
```
|
12
|
+
|
13
|
+
```jsx react
|
14
|
+
import { SlAvatar } from '@shoelace-style/shoelace/dist/react';
|
15
|
+
|
16
|
+
const App = () => (
|
17
|
+
<SlAvatar label="User avatar" />
|
18
|
+
);
|
19
|
+
```
|
20
|
+
|
21
|
+
## Examples
|
22
|
+
|
23
|
+
### Images
|
24
|
+
|
25
|
+
To use an image for the avatar, set the `image` and `alt` attributes. This will take priority and be shown over initials and icons.
|
26
|
+
|
27
|
+
```html preview
|
28
|
+
<sl-avatar
|
29
|
+
image="https://images.unsplash.com/photo-1529778873920-4da4926a72c2?ixlib=rb-1.2.1&auto=format&fit=crop&w=300&q=80"
|
30
|
+
label="Avatar of a gray tabby kitten looking down"
|
31
|
+
></sl-avatar>
|
32
|
+
```
|
33
|
+
|
34
|
+
```jsx react
|
35
|
+
import { SlAvatar } from '@shoelace-style/shoelace/dist/react';
|
36
|
+
|
37
|
+
const App = () => (
|
38
|
+
<SlAvatar
|
39
|
+
image="https://images.unsplash.com/photo-1529778873920-4da4926a72c2?ixlib=rb-1.2.1&auto=format&fit=crop&w=300&q=80"
|
40
|
+
label="Avatar of a gray tabby kitten looking down"
|
41
|
+
/>
|
42
|
+
);
|
43
|
+
```
|
44
|
+
|
45
|
+
### Initials
|
46
|
+
|
47
|
+
When you don't have an image to use, you can set the `initials` attribute to show something more personalized than an icon.
|
48
|
+
|
49
|
+
```html preview
|
50
|
+
<sl-avatar initials="SL" label="Avatar with initials: SL"></sl-avatar>
|
51
|
+
```
|
52
|
+
|
53
|
+
```jsx react
|
54
|
+
import { SlAvatar } from '@shoelace-style/shoelace/dist/react';
|
55
|
+
|
56
|
+
const App = () => (
|
57
|
+
<SlAvatar initials="SL" label="Avatar with initials: SL" />
|
58
|
+
);
|
59
|
+
```
|
60
|
+
|
61
|
+
### Custom Icons
|
62
|
+
|
63
|
+
When no image or initials are set, an icon will be shown. The default avatar shows a generic "user" icon, but you can customize this with the `icon` slot.
|
64
|
+
|
65
|
+
```html preview
|
66
|
+
<sl-avatar label="Avatar with an image icon">
|
67
|
+
<sl-icon slot="icon" name="image"></sl-icon>
|
68
|
+
</sl-avatar>
|
69
|
+
|
70
|
+
<sl-avatar label="Avatar with an archive icon">
|
71
|
+
<sl-icon slot="icon" name="archive"></sl-icon>
|
72
|
+
</sl-avatar>
|
73
|
+
|
74
|
+
<sl-avatar label="Avatar with a briefcase icon">
|
75
|
+
<sl-icon slot="icon" name="briefcase"></sl-icon>
|
76
|
+
</sl-avatar>
|
77
|
+
```
|
78
|
+
|
79
|
+
```jsx react
|
80
|
+
import { SlAvatar, SlIcon } from '@shoelace-style/shoelace/dist/react';
|
81
|
+
|
82
|
+
const App = () => (
|
83
|
+
<>
|
84
|
+
<SlAvatar label="Avatar with an image icon">
|
85
|
+
<SlIcon slot="icon" name="image" />
|
86
|
+
</SlAvatar>
|
87
|
+
|
88
|
+
<SlAvatar label="Avatar with an archive icon">
|
89
|
+
<SlIcon slot="icon" name="archive" />
|
90
|
+
</SlAvatar>
|
91
|
+
|
92
|
+
<SlAvatar label="Avatar with a briefcase icon">
|
93
|
+
<SlIcon slot="icon" name="briefcase" />
|
94
|
+
</SlAvatar>
|
95
|
+
</>
|
96
|
+
);
|
97
|
+
```
|
98
|
+
|
99
|
+
### Shapes
|
100
|
+
|
101
|
+
Avatars can be shaped using the `shape` attribute.
|
102
|
+
|
103
|
+
```html preview
|
104
|
+
<sl-avatar shape="square" label="Square avatar"></sl-avatar>
|
105
|
+
<sl-avatar shape="rounded" label="Rounded avatar"></sl-avatar>
|
106
|
+
<sl-avatar shape="circle" label="Circle avatar"></sl-avatar>
|
107
|
+
```
|
108
|
+
|
109
|
+
```jsx react
|
110
|
+
import { SlAvatar, SlIcon } from '@shoelace-style/shoelace/dist/react';
|
111
|
+
|
112
|
+
const App = () => (
|
113
|
+
<>
|
114
|
+
<SlAvatar shape="square" label="Square avatar" />
|
115
|
+
<SlAvatar shape="rounded" label="Rounded avatar" />
|
116
|
+
<SlAvatar shape="circle" label="Circle avatar" />
|
117
|
+
</>
|
118
|
+
);
|
119
|
+
```
|
120
|
+
|
121
|
+
### Avatar Groups
|
122
|
+
|
123
|
+
You can group avatars with a few lines of CSS.
|
124
|
+
|
125
|
+
```html preview
|
126
|
+
<div class="avatar-group">
|
127
|
+
<sl-avatar
|
128
|
+
image="https://images.unsplash.com/photo-1490150028299-bf57d78394e0?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&q=80&crop=right"
|
129
|
+
label="Avatar 1 of 4"
|
130
|
+
></sl-avatar>
|
131
|
+
|
132
|
+
<sl-avatar
|
133
|
+
image="https://images.unsplash.com/photo-1503454537195-1dcabb73ffb9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&crop=left&q=80"
|
134
|
+
label="Avatar 2 of 4"
|
135
|
+
></sl-avatar>
|
136
|
+
|
137
|
+
<sl-avatar
|
138
|
+
image="https://images.unsplash.com/photo-1456439663599-95b042d50252?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&crop=left&q=80"
|
139
|
+
label="Avatar 3 of 4"
|
140
|
+
></sl-avatar>
|
141
|
+
|
142
|
+
<sl-avatar
|
143
|
+
image="https://images.unsplash.com/flagged/photo-1554078875-e37cb8b0e27d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&crop=top&q=80"
|
144
|
+
label="Avatar 4 of 4"
|
145
|
+
></sl-avatar>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<style>
|
149
|
+
.avatar-group sl-avatar:not(:first-of-type) {
|
150
|
+
margin-left: -1rem;
|
151
|
+
}
|
152
|
+
|
153
|
+
.avatar-group sl-avatar::part(base) {
|
154
|
+
border: solid 2px var(--sl-color-neutral-0);
|
155
|
+
}
|
156
|
+
</style>
|
157
|
+
```
|
158
|
+
|
159
|
+
```jsx react
|
160
|
+
import { SlAvatar, SlIcon } from '@shoelace-style/shoelace/dist/react';
|
161
|
+
|
162
|
+
const css = `
|
163
|
+
.avatar-group sl-avatar:not(:first-of-type) {
|
164
|
+
margin-left: -1rem;
|
165
|
+
}
|
166
|
+
|
167
|
+
.avatar-group sl-avatar::part(base) {
|
168
|
+
border: solid 2px var(--sl-color-neutral-0);
|
169
|
+
}
|
170
|
+
`;
|
171
|
+
|
172
|
+
const App = () => (
|
173
|
+
<>
|
174
|
+
<div className="avatar-group">
|
175
|
+
<SlAvatar
|
176
|
+
image="https://images.unsplash.com/photo-1490150028299-bf57d78394e0?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&q=80&crop=right"
|
177
|
+
label="Avatar 1 of 4"
|
178
|
+
/>
|
179
|
+
|
180
|
+
<SlAvatar
|
181
|
+
image="https://images.unsplash.com/photo-1503454537195-1dcabb73ffb9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&crop=left&q=80"
|
182
|
+
label="Avatar 2 of 4"
|
183
|
+
/>
|
184
|
+
|
185
|
+
<SlAvatar
|
186
|
+
image="https://images.unsplash.com/photo-1456439663599-95b042d50252?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&crop=left&q=80"
|
187
|
+
label="Avatar 3 of 4"
|
188
|
+
/>
|
189
|
+
|
190
|
+
<SlAvatar
|
191
|
+
image="https://images.unsplash.com/flagged/photo-1554078875-e37cb8b0e27d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=256&h=256&crop=top&q=80"
|
192
|
+
label="Avatar 4 of 4"
|
193
|
+
/>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<style>{css}</style>
|
197
|
+
</>
|
198
|
+
);
|
199
|
+
```
|
200
|
+
|
201
|
+
[component-metadata:sl-avatar]
|