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,156 @@
|
|
1
|
+
# React
|
2
|
+
|
3
|
+
Shoelace offers a React version of every component to provide an idiomatic experience for React users. You can easily toggle between HTML and React examples throughout the documentation.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
To add Shoelace to your React app, install the package from npm.
|
8
|
+
|
9
|
+
```bash
|
10
|
+
npm install @shoelace-style/shoelace
|
11
|
+
```
|
12
|
+
|
13
|
+
Next, [include a theme](/getting-started/themes) and set the [base path](/getting-started/installation#setting-the-base-path) for icons and other assets. In this example, we'll import the light theme and use the CDN as a base path.
|
14
|
+
|
15
|
+
```jsx
|
16
|
+
// App.jsx
|
17
|
+
import '@shoelace-style/shoelace/dist/themes/light.css';
|
18
|
+
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path';
|
19
|
+
|
20
|
+
setBasePath('https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@%VERSION%/dist/');
|
21
|
+
```
|
22
|
+
|
23
|
+
?> If you'd rather not use the CDN for assets, you can create a [build task](https://webpack.js.org/plugins/copy-webpack-plugin/) that copies `node_modules/@shoelace-style/shoelace/dist/assets` into your app's `public` directory. Then you can point the base path to that folder instead.
|
24
|
+
|
25
|
+
Now you can start using components!
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
### Importing Components
|
30
|
+
|
31
|
+
Every Shoelace component is available to import as a React component. Note that we're importing the `<SlButton>` _React component_ instead of the `<sl-button>` _custom element_ in the example below.
|
32
|
+
|
33
|
+
```jsx
|
34
|
+
import { SlButton } from '@shoelace-style/shoelace/dist/react';
|
35
|
+
|
36
|
+
const MyComponent = () => (
|
37
|
+
<SlButton variant="primary">
|
38
|
+
Click me
|
39
|
+
</SlButton>
|
40
|
+
);
|
41
|
+
|
42
|
+
export default MyComponent;
|
43
|
+
```
|
44
|
+
|
45
|
+
You can find a copy + paste import for each component in the "importing" section of its documentation.
|
46
|
+
|
47
|
+
### Event Handling
|
48
|
+
|
49
|
+
Many Shoelace components emit [custom events](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). For example, the [input component](/components/input) emits the `sl-input` event when it receives input. In React, you can listen for the event using `onSlInput`.
|
50
|
+
|
51
|
+
Here's how you can bind the input's value to a state variable.
|
52
|
+
|
53
|
+
```jsx
|
54
|
+
import { useState } from 'react';
|
55
|
+
import { SlInput } from '@shoelace-style/shoelace/dist/react';
|
56
|
+
|
57
|
+
function MyComponent() {
|
58
|
+
const [value, setValue] = useState('');
|
59
|
+
|
60
|
+
return (
|
61
|
+
<SlInput
|
62
|
+
value={value}
|
63
|
+
onSlInput={event => setValue(event.target.value)}
|
64
|
+
/>
|
65
|
+
)
|
66
|
+
};
|
67
|
+
|
68
|
+
export default MyComponent;
|
69
|
+
```
|
70
|
+
|
71
|
+
If you're using TypeScript, it's important to note that `event.target` will be a reference to the underlying custom element. You can use `(event.target as any).value` as a quick fix, or you can strongly type the event target as shown below.
|
72
|
+
|
73
|
+
```tsx
|
74
|
+
import { useState } from 'react';
|
75
|
+
import { SlInput } from '@shoelace-style/shoelace/dist/react';
|
76
|
+
import type SlInputElement from '@shoelace-style/shoelace/dist/components/input/input';
|
77
|
+
|
78
|
+
function MyComponent() {
|
79
|
+
const [value, setValue] = useState('');
|
80
|
+
|
81
|
+
return (
|
82
|
+
<SlInput
|
83
|
+
value={value}
|
84
|
+
onSlInput={event => setValue((event.target as SlInputElement).value)}
|
85
|
+
/>
|
86
|
+
)
|
87
|
+
};
|
88
|
+
|
89
|
+
export default MyComponent;
|
90
|
+
```
|
91
|
+
|
92
|
+
## Testing with Jest
|
93
|
+
|
94
|
+
Testing with web components can be challenging if your test environment runs in a Node environment (i.e. it doesn't run in a real browser). Fortunately, [Jest](https://jestjs.io/) has made a number of strides to support web components and provide additional browser APIs. However, it's still not a complete replication of a browser environment.
|
95
|
+
|
96
|
+
Here are some tips that will help smooth things over if you're having trouble with Jest + Shoelace.
|
97
|
+
|
98
|
+
?> If you're looking for a fast, modern testing alternative, consider [Web Test Runner](https://modern-web.dev/docs/test-runner/overview/).
|
99
|
+
|
100
|
+
### Upgrade Jest
|
101
|
+
|
102
|
+
Jest underwent a major revamp and received support for web components in [version 26.5.0](https://github.com/facebook/jest/blob/main/CHANGELOG.md#2650) when it introduced [JSDOM 16.2.0](https://github.com/jsdom/jsdom/blob/master/Changelog.md#1620). This release also included a number of mocks for built-in browser functions such as `MutationObserver`, `document.createRange`, and others.
|
103
|
+
|
104
|
+
If you're using [Create React App](https://reactjs.org/docs/create-a-new-react-app.html#create-react-app), you can update `react-scripts` which will also update Jest.
|
105
|
+
|
106
|
+
```
|
107
|
+
npm install react-scripts@latest
|
108
|
+
```
|
109
|
+
|
110
|
+
### Mock Missing APIs
|
111
|
+
|
112
|
+
Some components use `window.matchMedia`, but this function isn't supported by JSDOM so you'll need to mock it yourself.
|
113
|
+
|
114
|
+
In `src/setupTests.js`, add the following.
|
115
|
+
|
116
|
+
```js
|
117
|
+
Object.defineProperty(window, 'matchMedia', {
|
118
|
+
writable: true,
|
119
|
+
value: jest.fn().mockImplementation(query => ({
|
120
|
+
matches: false,
|
121
|
+
media: query,
|
122
|
+
onchange: null,
|
123
|
+
addListener: jest.fn(), // deprecated
|
124
|
+
removeListener: jest.fn(), // deprecated
|
125
|
+
addEventListener: jest.fn(),
|
126
|
+
removeEventListener: jest.fn(),
|
127
|
+
dispatchEvent: jest.fn(),
|
128
|
+
})),
|
129
|
+
});
|
130
|
+
```
|
131
|
+
|
132
|
+
For more details, refer to Jest's [manual mocking](https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom) documentation.
|
133
|
+
|
134
|
+
### Transform ES Modules
|
135
|
+
|
136
|
+
ES Modules are a [well-supported browser standard](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/). This is how Shoelace is distributed, but most React apps expect CommonJS. As a result, you'll probably run into the following error.
|
137
|
+
|
138
|
+
```
|
139
|
+
Error: Unable to import outside of a module
|
140
|
+
```
|
141
|
+
|
142
|
+
To fix this, add the following to your `package.json` which tells the transpiler to process Shoelace modules.
|
143
|
+
|
144
|
+
```js
|
145
|
+
{
|
146
|
+
"jest": {
|
147
|
+
"transformIgnorePatterns": ["node_modules/?!(@shoelace)"]
|
148
|
+
}
|
149
|
+
}
|
150
|
+
```
|
151
|
+
|
152
|
+
These instructions are for apps created via Create React App. If you're using Jest directly, you can add `transformIgnorePatterns` directly into `jest.config.js`.
|
153
|
+
|
154
|
+
For more details, refer to Jest's [`transformIgnorePatterns` customization](https://jestjs.io/docs/tutorial-react-native#transformignorepatterns-customization) documentation.
|
155
|
+
|
156
|
+
?> Are you using Shoelace with React? [Help us improve this page!](https://github.com/shoelace-style/shoelace/blob/next/docs/frameworks/react.md)
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Vue
|
2
|
+
|
3
|
+
Vue [plays nice](https://custom-elements-everywhere.com/#vue) with custom elements, so you can use Shoelace in your Vue apps with ease.
|
4
|
+
|
5
|
+
?> These instructions are for Vue 2. If you're using Vue 3, [please help us update this page](https://github.com/shoelace-style/shoelace/blob/next/docs/frameworks/vue.md).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
To add Shoelace to your Vue app, install the package from npm.
|
10
|
+
|
11
|
+
```bash
|
12
|
+
npm install @shoelace-style/shoelace
|
13
|
+
```
|
14
|
+
|
15
|
+
Next, [include a theme](/getting-started/themes) and set the [base path](/getting-started/installation#setting-the-base-path) for icons and other assets. In this example, we'll import the light theme and use the CDN as a base path.
|
16
|
+
|
17
|
+
```jsx
|
18
|
+
import '@shoelace-style/shoelace/dist/themes/light.css';
|
19
|
+
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path';
|
20
|
+
|
21
|
+
setBasePath('https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@%VERSION%/dist/');
|
22
|
+
```
|
23
|
+
|
24
|
+
?> If you'd rather not use the CDN for assets, you can create a build task that copies `node_modules/@shoelace-style/shoelace/dist/assets` into a public folder in your app. Then you can point the base path to that folder instead.
|
25
|
+
|
26
|
+
## Configuration
|
27
|
+
|
28
|
+
You'll need to tell Vue to ignore Shoelace components. This is pretty easy because they all start with `sl-`.
|
29
|
+
|
30
|
+
```js
|
31
|
+
import { createApp } from 'vue';
|
32
|
+
import App from './App.vue';
|
33
|
+
|
34
|
+
const app = createApp(App);
|
35
|
+
|
36
|
+
app.config.compilerOptions.isCustomElement = tag => tag.startsWith('sl-');
|
37
|
+
|
38
|
+
app.mount('#app');
|
39
|
+
```
|
40
|
+
|
41
|
+
Now you can start using Shoelace components in your app!
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
### Binding Complex Data
|
46
|
+
|
47
|
+
When binding complex data such as objects and arrays, use the `.prop` modifier to make Vue bind them as a property instead of an attribute.
|
48
|
+
|
49
|
+
```html
|
50
|
+
<sl-color-picker :swatches.prop="mySwatches" />
|
51
|
+
```
|
52
|
+
|
53
|
+
### Two-way Binding
|
54
|
+
|
55
|
+
One caveat is there's currently [no support for v-model on custom elements](https://github.com/vuejs/vue/issues/7830), but you can still achieve two-way binding manually.
|
56
|
+
|
57
|
+
```html
|
58
|
+
<!-- This doesn't work -->
|
59
|
+
<sl-input v-model="name">
|
60
|
+
|
61
|
+
<!-- This works, but it's a bit longer -->
|
62
|
+
<sl-input :value="name" @input="name = $event.target.value">
|
63
|
+
```
|
64
|
+
|
65
|
+
If that's too verbose for your liking, you can use a custom directive instead. [This utility](https://www.npmjs.com/package/@shoelace-style/vue-sl-model) adds a custom directive that will work just like `v-model` but for Shoelace components. To install it, use this command.
|
66
|
+
|
67
|
+
```bash
|
68
|
+
npm install @shoelace-style/vue-sl-model
|
69
|
+
```
|
70
|
+
|
71
|
+
Next, import the directive and enable it like this.
|
72
|
+
|
73
|
+
```js
|
74
|
+
import ShoelaceModelDirective from '@shoelace-style/vue-sl-model';
|
75
|
+
import { createApp } from 'vue';
|
76
|
+
import App from './App.vue';
|
77
|
+
|
78
|
+
const app = createApp(App);
|
79
|
+
app.use(ShoelaceModelDirective);
|
80
|
+
|
81
|
+
app.config.compilerOptions.isCustomElement = tag => tag.startsWith('sl-');
|
82
|
+
|
83
|
+
app.mount('#app');
|
84
|
+
```
|
85
|
+
|
86
|
+
Now you can use the `v-sl-model` directive to keep your data in sync!
|
87
|
+
|
88
|
+
```html
|
89
|
+
<sl-input v-sl-model="name">
|
90
|
+
```
|
91
|
+
|
92
|
+
?> Are you using Shoelace with Vue? [Help us improve this page!](https://github.com/shoelace-style/shoelace/blob/next/docs/frameworks/vue.md)
|
@@ -0,0 +1,153 @@
|
|
1
|
+
# Customizing
|
2
|
+
|
3
|
+
Shoelace components can be customized at a high level through design tokens. This gives you control over theme colors and general styling. For more advanced customizations, you can make use of component parts and custom properties to target individual components.
|
4
|
+
|
5
|
+
## Design Tokens
|
6
|
+
|
7
|
+
Shoelace makes use of several design tokens to provide a consistent appearance across components. You can customize them and use them in your own application with pure CSS — no preprocessor required.
|
8
|
+
|
9
|
+
Design tokens offer a high-level way to customize the library with minimal effort. There are no component-specific variables, however, as design tokens are intended to be generic and highly reusable. To customize an individual component, refer to the section entitled [Component Parts](#component-parts).
|
10
|
+
|
11
|
+
Design tokens are accessed through CSS custom properties that are defined in your theme. Because design tokens live at the page level, they're prefixed with `--sl-` to avoid collisions with other libraries.
|
12
|
+
|
13
|
+
To customize a design token, simply override it in your stylesheet using a `:root` block. Here's an example that changes the primary theme to purple based on existing [color primitives](/tokens/color#primitives).
|
14
|
+
|
15
|
+
```css
|
16
|
+
:root {
|
17
|
+
/* Changes the primary theme color to purple using primitives */
|
18
|
+
--sl-color-primary-50: var(--sl-color-purple-50);
|
19
|
+
--sl-color-primary-100: var(--sl-color-purple-100);
|
20
|
+
--sl-color-primary-200: var(--sl-color-purple-200);
|
21
|
+
--sl-color-primary-300: var(--sl-color-purple-300);
|
22
|
+
--sl-color-primary-400: var(--sl-color-purple-400);
|
23
|
+
--sl-color-primary-500: var(--sl-color-purple-500);
|
24
|
+
--sl-color-primary-600: var(--sl-color-purple-600);
|
25
|
+
--sl-color-primary-700: var(--sl-color-purple-700);
|
26
|
+
--sl-color-primary-800: var(--sl-color-purple-800);
|
27
|
+
--sl-color-primary-900: var(--sl-color-purple-900);
|
28
|
+
--sl-color-primary-950: var(--sl-color-purple-950);
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
Many design tokens are described further along in this documentation. For a complete list, refer to `src/themes/light.styles.ts` in the project's [source code](https://github.com/shoelace-style/shoelace/blob/current/src/themes/light.styles.ts).
|
33
|
+
|
34
|
+
## Component Parts
|
35
|
+
|
36
|
+
Whereas design tokens offer a high-level way to customize the library, component parts offer a low-level way to customize individual components. Again, this is done with pure CSS — no preprocessor required.
|
37
|
+
|
38
|
+
Shoelace components use a [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM) to encapsulate their styles and behaviors. As a result, you can't simply target their internals with the usual CSS selectors. Instead, components expose "parts" that can be targeted with the [CSS part selector](https://developer.mozilla.org/en-US/docs/Web/CSS/::part), or `::part()`.
|
39
|
+
|
40
|
+
Here's an example that modifies buttons with the `tomato-button` class.
|
41
|
+
|
42
|
+
```html preview
|
43
|
+
<sl-button class="tomato-button"> Tomato Button </sl-button>
|
44
|
+
|
45
|
+
<style>
|
46
|
+
.tomato-button::part(base) {
|
47
|
+
background: var(--sl-color-neutral-0);
|
48
|
+
border: solid 1px tomato;
|
49
|
+
}
|
50
|
+
|
51
|
+
.tomato-button::part(base):hover {
|
52
|
+
background: rgba(255, 99, 71, 0.1);
|
53
|
+
}
|
54
|
+
|
55
|
+
.tomato-button::part(base):active {
|
56
|
+
background: rgba(255, 99, 71, 0.2);
|
57
|
+
}
|
58
|
+
|
59
|
+
.tomato-button::part(base):focus-visible {
|
60
|
+
box-shadow: 0 0 0 3px rgba(255, 99, 71, 0.33);
|
61
|
+
}
|
62
|
+
|
63
|
+
.tomato-button::part(label) {
|
64
|
+
color: tomato;
|
65
|
+
}
|
66
|
+
</style>
|
67
|
+
```
|
68
|
+
|
69
|
+
At first glance, this approach might seem a bit verbose or even limiting, but it comes with a few important advantages:
|
70
|
+
|
71
|
+
- Customizations can be made to components with explicit selectors, such as `::part(icon)`, rather than implicit selectors, such as `.button > div > span + .icon`, that are much more fragile.
|
72
|
+
|
73
|
+
- The internal structure of a component will likely change as it evolves. By exposing component parts through an API, the internals can be reworked without fear of breaking customizations as long as its parts remain intact.
|
74
|
+
|
75
|
+
- It encourages us to think more about how components are designed and how customizations should be allowed before users can take advantage of them. Once we opt a part into the component's API, it's guaranteed to be supported and can't be removed until a major version of the library is released.
|
76
|
+
|
77
|
+
Most (but not all) components expose parts. You can find them in each component's API documentation under the "CSS Parts" section.
|
78
|
+
|
79
|
+
## Custom Properties
|
80
|
+
|
81
|
+
For convenience, some components expose CSS custom properties you can override. These are not design tokens, nor do they have the same `--sl-` prefix since they're scoped to a component.
|
82
|
+
|
83
|
+
You can set custom properties on a component in your stylesheet.
|
84
|
+
|
85
|
+
```css
|
86
|
+
sl-avatar {
|
87
|
+
--size: 6rem;
|
88
|
+
}
|
89
|
+
```
|
90
|
+
|
91
|
+
This will also work if you need to target a subset of components with a specific class.
|
92
|
+
|
93
|
+
```css
|
94
|
+
sl-avatar.your-class {
|
95
|
+
--size: 6rem;
|
96
|
+
}
|
97
|
+
```
|
98
|
+
|
99
|
+
Alternatively, you can set them inline directly on the element.
|
100
|
+
|
101
|
+
```html
|
102
|
+
<sl-avatar style="--size: 6rem;"></sl-avatar>
|
103
|
+
```
|
104
|
+
|
105
|
+
Not all components expose CSS custom properties. For those that do, they can be found in the component's API documentation.
|
106
|
+
|
107
|
+
## Animations
|
108
|
+
|
109
|
+
Some components use animation, such as when a dialog is shown or hidden. Animations are performed using the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API) rather than CSS. However, you can still customize them through Shoelace's animation registry. If a component has customizable animations, they'll be listed in the "Animation" section of its documentation.
|
110
|
+
|
111
|
+
To customize a default animation, use the `setDefaultAnimation()` method. The function accepts an animation name (found in the component's docs) and an object with `keyframes` and `options` or `null` to disable the animation.
|
112
|
+
|
113
|
+
This example will make all dialogs use a custom show animation.
|
114
|
+
|
115
|
+
```js
|
116
|
+
import { setDefaultAnimation } from '@shoelace-style/shoelace/dist/utilities/animation-registry.js';
|
117
|
+
|
118
|
+
// Change the default animation for all dialogs
|
119
|
+
setDefaultAnimation('dialog.show', {
|
120
|
+
keyframes: [
|
121
|
+
{ transform: 'rotate(-10deg) scale(0.5)', opacity: '0' },
|
122
|
+
{ transform: 'rotate(0deg) scale(1)', opacity: '1' }
|
123
|
+
],
|
124
|
+
options: {
|
125
|
+
duration: 500
|
126
|
+
}
|
127
|
+
});
|
128
|
+
```
|
129
|
+
|
130
|
+
If you only want to target a single component, use the `setAnimation()` method instead. This function accepts an element, an animation name, and an object comprised of animation `keyframes` and `options`.
|
131
|
+
|
132
|
+
In this example, only the target dialog will use a custom show animation.
|
133
|
+
|
134
|
+
```js
|
135
|
+
import { setAnimation } from '@shoelace-style/shoelace/dist/utilities/animation-registry.js';
|
136
|
+
|
137
|
+
// Change the animation for a single dialog
|
138
|
+
const dialog = document.querySelector('#my-dialog');
|
139
|
+
|
140
|
+
setAnimation(dialog, 'dialog.show', {
|
141
|
+
keyframes: [
|
142
|
+
{ transform: 'rotate(-10deg) scale(0.5)', opacity: '0' },
|
143
|
+
{ transform: 'rotate(0deg) scale(1)', opacity: '1' }
|
144
|
+
],
|
145
|
+
options: {
|
146
|
+
duration: 500
|
147
|
+
}
|
148
|
+
});
|
149
|
+
```
|
150
|
+
|
151
|
+
To learn more about creating Web Animations, refer to the documentation for [`Element.animate()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/animate).
|
152
|
+
|
153
|
+
?> Animations respect the users `prefers-reduced-motion` setting. When this setting is enabled, animations will not be played. To disable animations for all users, pass in `null` instead of a keyframes/options object.
|